Skip to content

Commit 10aa38c

Browse files
committed
prep for v0.4.0
1 parent c446f50 commit 10aa38c

File tree

6 files changed

+192
-190
lines changed

6 files changed

+192
-190
lines changed

doc/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
# -- Project information -----------------------------------------------------
2121

2222
project = "PyXtal"
23-
copyright = "2018-2021, Qiang Zhu, Scott Fredericks, Kevin Parrish"
23+
copyright = "2018-2022, Qiang Zhu, Scott Fredericks, Kevin Parrish"
2424
author = "Qiang Zhu, Scott Fredericks, Kevin Parrish"
2525

2626
# The short X.Y version
27-
version = "0.3.9"
27+
version = "0.4.0"
2828
# The full version, including alpha/beta/rc tags
29-
release = "0.3.9"
29+
release = "0.4.0"
3030

3131

3232
# -- General configuration ---------------------------------------------------

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PyXtal (pronounced ``pie-crystal``) is an open source Python library for the ab-
2323
- Structural manipulation via symmetry relation (both subgroup and supergroup)
2424
- Geometry optimization from built-in and external optimization methods
2525

26-
The current version is ``0.3.9`` at `GitHub <https://github.com/qzhu2017/PyXtal>`_. It is available for use under the MIT license. Expect updates upon request by `Qiang Zhu\'s group <http://www.physics.unlv.edu/~qzhu/index.html>`_ at University of Nevada Las Vegas.
26+
The current version is ``0.4.0`` at `GitHub <https://github.com/qzhu2017/PyXtal>`_. It is available for use under the MIT license. Expect updates upon request by `Qiang Zhu\'s group <http://www.physics.unlv.edu/~qzhu/index.html>`_ at University of Nevada Las Vegas.
2727

2828
PyXtal is an open source project. You are welcome to contribute it directly via the `GitHub platform <https://github.com/qzhu2017/PyXtal>`_ or send your comments and suggestions to the `developer <http://www.physics.unlv.edu/~qzhu/>`_.
2929

pyxtal/__init__.py

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,45 @@ class pyxtal:
115115
133.720 0.838 [ 4 4 0] 9.80 12
116116
148.177 0.802 [ 5 3 1] 28.27 48
117117
118+
One can also try to get the transition path between two pyxtals
119+
that are symmetry related via the `get_transition` function
120+
121+
>>> s1 = pyxtal()
122+
>>> s2 = pyxtal()
123+
>>> s1.from_seed("pyxtal/database/cifs/0-G62.cif") #structure with low symmetry
124+
>>> s2.from_seed("pyxtal/database/cifs/2-G71.cif") #structure with high symmetry
125+
>>> strucs, _, _ = s2.get_transition(s1) # get the transition from high to low
126+
>>> strucs
127+
[
128+
------Crystal from Transition 0 0.000------
129+
Dimension: 3
130+
Composition: O24Mg4W4Pb8
131+
Group: Pnma (62)
132+
orthorhombic lattice: 11.6075 8.0526 5.8010 90.0000 90.0000 90.0000
133+
Wyckoff sites:
134+
Mg @ [ 0.8750 0.2500 0.7500], WP [4c] Site [.m.]
135+
Pb @ [ 0.6406 0.0053 0.7856], WP [8d] Site [1]
136+
W @ [ 0.6119 0.2500 0.2483], WP [4c] Site [.m.]
137+
O @ [ 0.6292 0.0083 0.2235], WP [8d] Site [1]
138+
O @ [ 0.4966 0.2500 0.0093], WP [4c] Site [.m.]
139+
O @ [ 0.5055 0.2500 0.4897], WP [4c] Site [.m.]
140+
O @ [ 0.7308 0.2500 0.9717], WP [4c] Site [.m.]
141+
O @ [ 0.7467 0.2500 0.4570], WP [4c] Site [.m.],
142+
------Crystal from Transition 1 0.323------
143+
Dimension: 3
144+
Composition: O24Mg4W4Pb8
145+
Group: Pnma (62)
146+
orthorhombic lattice: 11.6020 8.0526 5.8038 90.0000 90.0000 90.0000
147+
Wyckoff sites:
148+
Mg @ [ 0.8750 0.2500 0.7500], WP [4c] Site [.m.]
149+
Pb @ [ 0.6250 -0.0053 0.7500], WP [8d] Site [1]
150+
W @ [ 0.6250 0.2500 0.2500], WP [4c] Site [.m.]
151+
O @ [ 0.6250 0.0083 0.2500], WP [8d] Site [1]
152+
O @ [ 0.5158 0.2500 -0.0068], WP [4c] Site [.m.]
153+
O @ [ 0.5158 0.2500 0.5068], WP [4c] Site [.m.]
154+
O @ [ 0.7342 0.2500 0.9932], WP [4c] Site [.m.]
155+
O @ [ 0.7342 0.2500 0.5068], WP [4c] Site [.m.]]
156+
118157
Finally, the structure can be saved to different formats
119158
120159
>>> struc.to_file('my.cif')
@@ -1690,17 +1729,42 @@ def _get_elements_and_sites(self):
16901729
sites[id].append(site)
16911730
return elements, sites
16921731

1693-
def get_transition_by_path(self, path, ref_struc):
1732+
def get_transition(self, ref_struc, N_images=2):
16941733
"""
16951734
Get the splitted wyckoff information along a given path:
16961735
16971736
Args:
1698-
path: a list of transition path
16991737
ref_struc: structure with subgroup symmetry
1738+
N_images (int): number of images along the transition
1739+
1740+
Returns:
1741+
- strucs:
1742+
- displacements:
1743+
- cell translation:
1744+
"""
1745+
paths = self.group.search_subgroup_paths(ref_struc.group.number)
1746+
if len(paths) == 0:
1747+
return None, None, None
1748+
else:
1749+
for p in paths:
1750+
res = self.get_transition_by_path(ref_struc, p, N_images)
1751+
strucs, disp, tran = res
1752+
if strucs is not None:
1753+
return strucs, disp, tran
1754+
return None, None, None
1755+
1756+
def get_transition_by_path(self, ref_struc, path, N_images=2):
1757+
"""
1758+
Get the splitted wyckoff information along a given path:
1759+
1760+
Args:
1761+
ref_struc: structure with subgroup symmetry
1762+
path: a list of transition path
17001763
17011764
Returns:
1702-
displacements and struc_H in subgroup
1703-
If not a match, return None
1765+
- strucs:
1766+
- displacements:
1767+
- cell translation:
17041768
"""
17051769
import string
17061770

@@ -1774,7 +1838,7 @@ def get_transition_by_path(self, path, ref_struc):
17741838
disp, tran, s = ref_struc.get_disps_sets(s, True)
17751839
if disp is not None:
17761840
cell = s.lattice.matrix
1777-
strucs = ref_struc.make_transitions(disp, cell, tran, 2)
1841+
strucs = ref_struc.make_transitions(disp, cell, tran, N_images)
17781842
return strucs, disp, tran
17791843
return None, None, None
17801844

pyxtal/miscellaneous/single_check.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

pyxtal/test_all.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,20 @@ def test_multi(self):
219219

220220
def test_similarity(self):
221221
paras = [
222-
('0-G62', '2-G71', 0),
223-
('0-G62', '3-G139', 2),
224-
('0-G62', '4-G225', 4),
222+
('0-G62', '2-G71'),
223+
('0-G62', '3-G139'),
224+
#('0-G62', '4-G225'),
225225
]
226226
for para in paras:
227-
(cif1, cif2, p) = para
227+
(cif1, cif2) = para
228228
s1 = pyxtal()
229229
s2 = pyxtal()
230230
s1.from_seed('pyxtal/database/cifs/'+cif1+'.cif')
231231
s2.from_seed('pyxtal/database/cifs/'+cif2+'.cif')
232232
pmg_s2 = s2.to_pymatgen()
233-
path = s2.group.search_subgroup_paths(s1.group.number)[p]
234-
strucs, _, _ = s2.get_transition_by_path(path, s1)
233+
234+
strucs, _, _ = s2.get_transition(s1)
235+
235236
if strucs is None:
236237
print("Problem between ", cif1, cif2)
237238
else:

0 commit comments

Comments
 (0)