@@ -1697,7 +1697,7 @@ def optimize_nsc(self, axis=None, R=None):
16971697
16981698 return nsc
16991699
1700- def sub (self , atoms , cell = None ):
1700+ def sub (self , atoms ):
17011701 """ Create a new `Geometry` with a subset of this `Geometry`
17021702
17031703 Indices passed *MUST* be unique.
@@ -1708,20 +1708,14 @@ def sub(self, atoms, cell=None):
17081708 ----------
17091709 atoms : int or array_like
17101710 indices/boolean of all atoms to be removed
1711- cell : array_like or SuperCell, optional
1712- the new associated cell of the geometry (defaults to the same cell)
17131711
17141712 See Also
17151713 --------
17161714 SuperCell.fit : update the supercell according to a reference supercell
17171715 remove : the negative of this routine, i.e. remove a subset of atoms
17181716 """
17191717 atoms = self .sc2uc (atoms )
1720- if cell is None :
1721- return self .__class__ (self .xyz [atoms , :],
1722- atoms = self .atoms .sub (atoms ), sc = self .sc .copy ())
1723- return self .__class__ (self .xyz [atoms , :],
1724- atoms = self .atoms .sub (atoms ), sc = cell )
1718+ return self .__class__ (self .xyz [atoms , :], atoms = self .atoms .sub (atoms ), sc = self .sc .copy ())
17251719
17261720 def sub_orbital (self , atoms , orbitals ):
17271721 r""" Retain only a subset of the orbitals on `atoms` according to `orbitals`
@@ -1965,7 +1959,8 @@ def cut(self, seps, axis, seg=0, rtol=1e-4, atol=1e-4):
19651959 # List of atoms
19661960 n = self .na // seps
19671961 off = n * lseg
1968- new = self .sub (_a .arangei (off , off + n ), cell = sc )
1962+ new = self .sub (_a .arangei (off , off + n ))
1963+ new .set_supercell (sc )
19691964 if not np .allclose (new .tile (seps , axis ).xyz , self .xyz , rtol = rtol , atol = atol ):
19701965 st = 'The cut structure cannot be re-created by tiling'
19711966 st += '\n The tolerance between the coordinates can be altered using rtol, atol'
0 commit comments