abinit / abipy

Open-source library for analyzing the results produced by ABINIT
http://abinit.github.io/abipy
Other
117 stars 96 forks source link

Bug of abilab.Structure.lattice?? #177

Closed tlsong closed 5 years ago

tlsong commented 5 years ago

When I do the band calculation,it always gives this: “UserWarning: The input structure does not match the expected standard primitive! The path can be incorrect. Use at your own risk.”

So,I check it carefully,use these code: 1. first step:

`import abipy.abilab as abilab from pymatgen.symmetry.analyzer import SpacegroupAnalyzer import numpy as np

structure = abilab.Structure.from_file('Si_mp-149_computed.cif') spg_a =SpacegroupAnalyzer(structure) primitive_standard_structure=spg_a.get_primitive_standard_structure(international_monoclinic=False) primitive_standard_structure.to(fmt='cif', filename='Si_mp-149_primitive_standard_structure.cif') print(np.allclose(structure.lattice.matrix,structure.hsym_kpath.prim.lattice.matrix)) print(structure.lattice.matrix) print(primitive_standard_structure.lattice.matrix) print(structure.hsym_kpath.prim.lattice.matrix)`

output: False [[3.34889826 0. 1.93348731] [1.11629942 3.15737156 1.93348731] [0. 0. 3.86697462]] [[4.39719264e-16 2.73436398e+00 2.73436398e+00] [2.73436398e+00 0.00000000e+00 2.73436398e+00] [2.73436398e+00 2.73436398e+00 3.34863009e-16]] [[4.39719264e-16 2.73436398e+00 2.73436398e+00] [2.73436398e+00 0.00000000e+00 2.73436398e+00] [2.73436398e+00 2.73436398e+00 3.34863009e-16]]

2. second step: `import abipy.abilab as abilab from pymatgen.symmetry.analyzer import SpacegroupAnalyzer import numpy as np

structure = abilab.Structure.from_file('Si_mp-149_primitive_standard_structure.cif') spg_analy =SpacegroupAnalyzer(structure) primitive_standard_structure=spg_analy.get_primitive_standard_structure(international_monoclinic=False) print(np.allclose(structure.lattice.matrix,structure.hsym_kpath.prim.lattice.matrix)) print(structure.lattice.matrix) print(primitive_standard_structure.lattice.matrix) print(structure.hsym_kpath.prim.lattice.matrix)`

output: False [[3.34889826 0. 1.93348731] [1.11629942 3.15737156 1.93348731] [0. 0. 3.86697462]] [[4.39719264e-16 2.73436398e+00 2.73436398e+00] [2.73436398e+00 0.00000000e+00 2.73436398e+00] [2.73436398e+00 2.73436398e+00 3.34863009e-16]] [[4.39719264e-16 2.73436398e+00 2.73436398e+00] [2.73436398e+00 0.00000000e+00 2.73436398e+00] [2.73436398e+00 2.73436398e+00 3.34863009e-16]]

Why "np.allclose(structure.lattice.matrix,structure.hsym_kpath.prim.lattice.matrix)" give "False" in the step 2 ? The structure file download from here: Si_mp-149_computed.cif The abipy version is 0.6.0 The pymatgen version is 2019.3.13