From 70c4d5d94fcce9b59b15b1da2141f7c2487398f6 Mon Sep 17 00:00:00 2001 From: Qiang Zhu Date: Sat, 15 Jan 2022 10:18:33 -0800 Subject: [PATCH] add the output of path --- pyxtal/__init__.py | 13 +++++++------ pyxtal/test_all.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pyxtal/__init__.py b/pyxtal/__init__.py index e60dd642..34be6b57 100644 --- a/pyxtal/__init__.py +++ b/pyxtal/__init__.py @@ -122,7 +122,7 @@ class pyxtal: >>> s2 = pyxtal() >>> s1.from_seed("pyxtal/database/cifs/0-G62.cif") #structure with low symmetry >>> s2.from_seed("pyxtal/database/cifs/2-G71.cif") #structure with high symmetry - >>> strucs, _, _ = s2.get_transition(s1) # get the transition from high to low + >>> strucs, _, _, _ = s2.get_transition(s1) # get the transition from high to low >>> strucs [ ------Crystal from Transition 0 0.000------ @@ -1927,13 +1927,14 @@ def get_transition(self, ref_struc, d_tol=1.0, d_tol2=0.3, N_images=2, max_path= - strucs: - displacements: - cell translation: + - the list of space groups along the path """ ref_struc.sort_sites_by_numIons() self.sort_sites_by_numIons() paths = self.group.search_subgroup_paths(ref_struc.group.number) if len(paths) == 0: print("No valid paths between the structure pairs") - return None, None, None + return None, None, None, None else: Skipped = len(paths) - max_path if Skipped > 0: paths = paths[:max_path] #sample(paths, max_path) @@ -1941,7 +1942,7 @@ def get_transition(self, ref_struc, d_tol=1.0, d_tol2=0.3, N_images=2, max_path= res = self.get_transition_by_path(ref_struc, p, d_tol, d_tol2, N_images) strucs, disp, tran = res if strucs is not None: - return strucs, disp, tran + return strucs, disp, tran, p else: #Some quick fix to try self k-spliting along the path for i in range(len(p)): @@ -1950,7 +1951,7 @@ def get_transition(self, ref_struc, d_tol=1.0, d_tol2=0.3, N_images=2, max_path= r = self.get_transition_by_path(ref_struc, p0, d_tol, d_tol2, N_images) (strucs, disp, tran) = r if strucs is not None: - return strucs, disp, tran + return strucs, disp, tran, p0 # more extensive search if 4*sum(self.numIons) <= sum(ref_struc.numIons) and len(p)<4: @@ -1961,11 +1962,11 @@ def get_transition(self, ref_struc, d_tol=1.0, d_tol2=0.3, N_images=2, max_path= r = self.get_transition_by_path(ref_struc, p0, d_tol, d_tol2, N_images) (strucs, disp, tran) = r if strucs is not None: - return strucs, disp, tran + return strucs, disp, tran, p0 if Skipped > 0: print("Warning: ignore some solutions: ", Skipped) - return None, None, None + return None, None, None, None def get_transition_by_path(self, ref_struc, path, d_tol, d_tol2=0.5, N_images=2): """ diff --git a/pyxtal/test_all.py b/pyxtal/test_all.py index 0b7176e8..26464024 100644 --- a/pyxtal/test_all.py +++ b/pyxtal/test_all.py @@ -221,7 +221,7 @@ def test_similarity(self): s2.from_seed('pyxtal/database/cifs/'+cif2+'.cif') pmg_s2 = s2.to_pymatgen() - strucs, _, _ = s2.get_transition(s1) + strucs, _, _, _ = s2.get_transition(s1) if strucs is None: print("Problem between ", cif1, cif2)