Find the mapping/transformation relationship between the Cartesian coordinates of all atoms of two POSCARs. #3737
Closed
hongyi-zhao
started this conversation in
General
Replies: 1 comment
-
I got it, as shown below: In [79]: from pymatgen.core import Structure
...: from pymatgen.analysis.structure_matcher import StructureMatcher
...:
...: poscar1 = 'POSCAR_ms'
...: poscar2 = 'POSCAR_vaspkit'
...:
...: structure1 = Structure.from_file(poscar1)
...: structure2 = Structure.from_file(poscar2)
...:
...: matcher = StructureMatcher(primitive_cell=False)
...: matches = matcher.fit(structure1, structure2)
...:
...: if matches:
...: try:
...: transformation = matcher.get_transformation(structure1, structure2)
...: print(transformation)
...: except ValueError as e:
...: print(f"error:{str(e)}")
...: else:
...: print("Failed to match.")
...:
(array([[ 0, 0, -1],
[ 0, -1, 0],
[-1, 0, 0]]), array([0.25, 0.25, 0.25]), [1, 0])
In [80]: from numpy import array
...: from numpy.linalg import inv
...: from pymatgen.core import Structure
...: s1=Structure.from_file("POSCAR_ms")
...: s2=Structure.from_file("POSCAR_vaspkit")
...:
...: m1=s1.lattice.matrix
...: m2=s2.lattice.matrix
...:
...: R=transformation[0]
...: t=transformation[1]
...:
...: print(m2.T@(R@inv(m1.T)@array([0,0,0]) + t))
...: print(m2.T@(R@inv(m1.T)@array([1.93350005, 1.11630678, 0.78934807]) + t))
[1.36718201 1.36718201 1.36718203]
[-1.69082426e-08 6.72491127e-09 1.75588875e-08] See below for the related discussions and specifications: https://www.vasp.at/forum/viewtopic.php?p=26107#p26107 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The two POSCARs, which come here, are listed below:
The Cartesian coordinates of all atoms are shown below:
Then, how can I find the mapping/transformation relationship between the Cartesian coordinates of all atoms of these two structures?
Regards,
Zhao
Beta Was this translation helpful? Give feedback.
All reactions