Skip to content

Commit

Permalink
revert accidental str.rjust removal
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed May 29, 2023
1 parent 1d12f00 commit c1345b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pymatgen/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ def to_str(x):

outs.append("abc : " + " ".join(to_str(i) for i in self.lattice.abc))
outs.append("angles: " + " ".join(to_str(i) for i in self.lattice.angles))
outs.append("pbc : " + " ".join(str(p) for p in self.lattice.pbc))
outs.append("pbc : " + " ".join(str(p).rjust(10) for p in self.lattice.pbc))
if self._charge:
outs.append(f"Overall Charge: {self._charge:+}")
outs.append(f"Sites ({len(self)})")
Expand Down
8 changes: 4 additions & 4 deletions pymatgen/core/tests/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,8 +1347,8 @@ def test_relax_with_observer(self):
assert len(getattr(trajectory, key)) == {"atoms": 2}.get(key, 1)

def test_from_prototype(self):
for pt in ["bcc", "fcc", "hcp", "diamond"]:
struct = Structure.from_prototype(pt, ["C"], a=3, c=4)
for prototype in ["bcc", "fcc", "hcp", "diamond"]:
struct = Structure.from_prototype(prototype, ["C"], a=3, c=4)
assert isinstance(struct, Structure)

with pytest.raises(ValueError):
Expand All @@ -1372,8 +1372,8 @@ def test_from_prototype(self):
6 Cl 0.5 0.5 0
7 Cl 0 0 0"""
assert str(struct) == expected_struct_str
for pt in ("cscl", "fluorite", "antifluorite", "zincblende"):
struct = Structure.from_prototype(pt, ["Cs", "Cl"], a=5)
for prototype in ("cscl", "fluorite", "antifluorite", "zincblende"):
struct = Structure.from_prototype(prototype, ["Cs", "Cl"], a=5)
assert struct.lattice.is_orthogonal


Expand Down
6 changes: 3 additions & 3 deletions pymatgen/symmetry/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, structure: Structure, symprec: float | None = 0.01, angle_tol
self._symprec = symprec
self._angle_tol = angle_tolerance
self._structure = structure
self._siteprops = structure.site_properties
self._site_props = structure.site_properties
unique_species: list[Element | Species] = []
zs = []
magmoms = []
Expand Down Expand Up @@ -336,7 +336,7 @@ def get_refined_structure(self, keep_site_properties=False):
species = [self._unique_species[i - 1] for i in numbers]
if keep_site_properties:
site_properties = {}
for k, v in self._siteprops.items():
for k, v in self._site_props.items():
site_properties[k] = [v[i - 1] for i in numbers]
else:
site_properties = None
Expand Down Expand Up @@ -365,7 +365,7 @@ def find_primitive(self, keep_site_properties=False):
species = [self._unique_species[i - 1] for i in numbers]
if keep_site_properties:
site_properties = {}
for k, v in self._siteprops.items():
for k, v in self._site_props.items():
site_properties[k] = [v[i - 1] for i in numbers]
else:
site_properties = None
Expand Down

0 comments on commit c1345b6

Please sign in to comment.