Skip to content

Commit

Permalink
Merge pull request #2123 from gpetretto/bugfix
Browse files Browse the repository at this point in the history
bug fix in SpacegroupAnalyzer
  • Loading branch information
shyuep committed May 6, 2021
2 parents 570019d + 381b843 commit a51bd9e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions pymatgen/symmetry/analyzer.py
Expand Up @@ -662,6 +662,7 @@ def get_conventional_standard_structure(self, international_monoclinic=True):
elif latt_type == "triclinic":
# we use a LLL Minkowski-like reduction for the triclinic cells
struct = struct.get_reduced_structure("LLL")
latt = struct.lattice

a, b, c = latt.lengths
alpha, beta, gamma = [math.pi * i / 180 for i in latt.angles]
Expand Down
10 changes: 10 additions & 0 deletions pymatgen/symmetry/tests/test_analyzer.py
Expand Up @@ -265,6 +265,16 @@ def test_get_conventional_standard_structure(self):
self.assertAlmostEqual(conv.lattice.b, 3.699919902005897)
self.assertAlmostEqual(conv.lattice.c, 6.9779585500000003)

structure = Structure.from_file(os.path.join(PymatgenTest.TEST_FILES_DIR, "tric_684654.json"))
s = SpacegroupAnalyzer(structure, symprec=1e-2)
conv = s.get_conventional_standard_structure()
self.assertAlmostEqual(conv.lattice.alpha, 74.09581916308757)
self.assertAlmostEqual(conv.lattice.beta, 75.72817279281173)
self.assertAlmostEqual(conv.lattice.gamma, 63.63234318667333)
self.assertAlmostEqual(conv.lattice.a, 3.741372924048738)
self.assertAlmostEqual(conv.lattice.b, 3.9883228679270686)
self.assertAlmostEqual(conv.lattice.c, 7.288495840048958)

def test_get_primitive_standard_structure(self):
parser = CifParser(os.path.join(PymatgenTest.TEST_FILES_DIR, "bcc_1927.cif"))
structure = parser.get_structures(False)[0]
Expand Down
1 change: 1 addition & 0 deletions test_files/tric_684654.json
@@ -0,0 +1 @@
{"@module": "pymatgen.core.structure", "@class": "Structure", "charge": null, "lattice": {"matrix": [[3.576398, -0.11991, 1.960909], [1.136592, 3.033825, 1.871346], [-0.195795, -0.335361, 8.19359]], "a": 4.080461391654747, "b": 3.7413729240487377, "c": 8.202787317152994, "alpha": 62.66372061243767, "beta": 62.59337208026763, "gamma": 61.13165529519131, "volume": 92.7242594235707}, "sites": [{"species": [{"element": "Bi", "occu": 1}], "abc": [0.946029, 0.02822, 0.013308], "xyz": [3.412845209922, -0.032286780078, 2.0169264602009997], "label": "Bi", "properties": {"magmom": 0.0}}, {"species": [{"element": "Bi", "occu": 1}], "abc": [0.079023, 0.994276, 0.492394], "xyz": [1.316295563316, 2.841853993536, 6.050065881863], "label": "Bi", "properties": {"magmom": 0.0}}, {"species": [{"element": "O", "occu": 1}], "abc": [0.305839, 0.221561, 0.157295], "xyz": [1.3148288735090004, 0.5827535378400001, 2.303150477807], "label": "O", "properties": {"magmom": -0.0}}, {"species": [{"element": "O", "occu": 1}], "abc": [0.740353, 0.688628, 0.471626], "xyz": [3.3381440516000005, 1.8422361468840003, 6.604736191505], "label": "O", "properties": {"magmom": -0.0}}, {"species": [{"element": "O", "occu": 1}], "abc": [0.876757, 0.751315, 0.839377], "xyz": [3.825224780051, 1.8927319879080002, 10.002722005533], "label": "O", "properties": {"magmom": -0.0}}]}

0 comments on commit a51bd9e

Please sign in to comment.