Closed qzhu2017 closed 2 years ago
search_supergroup_paths
function from Group objectsearch_subgroup_paths
function from Group objectget_valid_solutions
from Group objectcheck_compatibility
to some generic placefrom pyxtal import pyxtal
import pymatgen.analysis.structure_matcher as sm
paras = [
('0-G62', '2-G71'),
('0-G62', '3-G139'),
('0-G62', '4-G225'),
]
for para in paras:
(cif1, cif2) = para
s1 = pyxtal()
s2 = pyxtal()
s1.from_seed('pyxtal/database/cifs/'+cif1+'.cif')
s2.from_seed('pyxtal/database/cifs/'+cif2+'.cif')
pmg_s2 = s2.to_pymatgen()
strucs, _, _ = s2.get_transition(s1)
if strucs is not None:
# high symmetry structure in subgroup representation
struc_G_in_H = strucs[-1]
s3 = pyxtal()
s3.from_seed(struc_G_in_H.to_pymatgen(), tol=1e-3)
# Match in space group number
print("Space group", s3.group.number == s2.group.number)
# Match in structure
pmg_s3 = s3.to_pymatgen()
print("Structure", sm.StructureMatcher().get_rms_dist(pmg_s2, pmg_s3))
else:
print("Problem in ", cif1, cif2)
The current functions is a bit messy. Needs a better organization so that one can easily do 1, search for pseudo symmetry 2, find the mapping between two symmetry-related structures.