Skip to content

Commit 33d497d

Browse files
committed
enh: finalized TF suggestions and clarified intents
Signed-off-by: Nick Papior <[email protected]>
1 parent b669a95 commit 33d497d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

sisl/io/vasp/car.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _setup(self, *args, **kwargs):
2323
self._scale = 1.
2424

2525
@sile_fh_open()
26-
def write_geometry(self, geometry, dynamic=None, sort=False):
26+
def write_geometry(self, geometry, dynamic=True, group_species=False):
2727
r""" Writes the geometry to the contained file
2828
2929
Parameters
@@ -34,9 +34,9 @@ def write_geometry(self, geometry, dynamic=None, sort=False):
3434
define which atoms are dynamic in the VASP run (default is True,
3535
which means all atoms are dynamic).
3636
If None, the resulting file will not contain any dynamic flags
37-
sort : bool, optional
37+
group_species: bool, optional
3838
before writing `geometry` first re-order species to
39-
have species in consecutive blocks (see `geometry_sort`)
39+
have species in consecutive blocks (see `geometry_group`)
4040
4141
Examples
4242
--------
@@ -48,13 +48,13 @@ def write_geometry(self, geometry, dynamic=None, sort=False):
4848
4949
See Also
5050
--------
51-
geometry_sort: method used to sort atoms in geometry
51+
geometry_group: method used to group atoms together according to their species
5252
"""
5353
# Check that we can write to the file
5454
sile_raise_write(self)
5555

56-
if sort:
57-
geometry, idx = self.geometry_sort(geometry, ret_index=True)
56+
if group_species:
57+
geometry, idx = self.geometry_group(geometry, ret_index=True)
5858
else:
5959
# small hack to allow dynamic
6060
idx = _a.arangei(len(geometry))

sisl/io/vasp/sile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
__all__ = ['SileVASP', 'SileCDFVASP', 'SileBinVASP']
99

1010

11-
def _geometry_sort(geometry, ret_index=False):
11+
def _geometry_group(geometry, ret_index=False):
1212
r""" Order atoms in geometry according to species such that all of one specie is consecutive
1313
1414
When creating VASP input files (`poscarSileVASP` for instance) the equivalent
@@ -51,12 +51,12 @@ def _geometry_sort(geometry, ret_index=False):
5151

5252

5353
class SileVASP(Sile):
54-
geometry_sort = staticmethod(_geometry_sort)
54+
geometry_group = staticmethod(_geometry_group)
5555

5656

5757
class SileCDFVASP(SileCDF):
58-
geometry_sort = staticmethod(_geometry_sort)
58+
geometry_group = staticmethod(_geometry_group)
5959

6060

6161
class SileBinVASP(SileBin):
62-
geometry_sort = staticmethod(_geometry_sort)
62+
geometry_group = staticmethod(_geometry_group)

sisl/io/vasp/tests/test_car.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_geometry_car_mixed(sisl_tmp):
2727
assert carSileVASP(f).read_geometry() == geom
2828

2929

30-
def test_geometry_car_sort(sisl_tmp):
30+
def test_geometry_car_group(sisl_tmp):
3131
f = sisl_tmp('test_sort.POSCAR', _dir)
3232

3333
atoms = [Atom[1],
@@ -40,10 +40,10 @@ def test_geometry_car_sort(sisl_tmp):
4040
xyz = np.random.rand(len(atoms), 3)
4141
geom = Geometry(xyz, atoms, 100)
4242

43-
geom.write(carSileVASP(f, 'w'), sort=True)
43+
geom.write(carSileVASP(f, 'w'), group_species=True)
4444

4545
assert carSileVASP(f).read_geometry() != geom
46-
geom = carSileVASP(f).geometry_sort(geom)
46+
geom = carSileVASP(f).geometry_group(geom)
4747
assert carSileVASP(f).read_geometry() == geom
4848

4949

@@ -69,7 +69,7 @@ def test_geometry_car_dynamic(sisl_tmp):
6969
read = carSileVASP(f)
7070

7171
# no dynamic (direct geometry)
72-
geom.write(carSileVASP(f, 'w'))
72+
geom.write(carSileVASP(f, 'w'), dynamic=None)
7373
g, dyn = read.read_geometry(ret_dynamic=True)
7474
assert dyn is None
7575

0 commit comments

Comments
 (0)