Re: Find the transformation matrix connecting two POSCAR structures.
Posted: Fri Apr 05, 2024 3:32 am
I want to find the mapping/transformation relationship between the Cartesian coordinates of all atoms of these two POSCARs, as shown below:
After some thought and trying, the problem still hasn't been solved.
Code: Select all
In [14]: from pymatgen.io.vasp import Poscar
...:
...: # Reading the POSCAR files
...: poscar_ms = Poscar.from_file("POSCAR_ms")
...: poscar_vaspkit = Poscar.from_file("POSCAR_vaspkit")
...:
...: # Getting the Cartesian coordinates of all atoms in both structures
...: cart_coords_ms = poscar_ms.structure.cart_coords
...: cart_coords_vaspkit = poscar_vaspkit.structure.cart_coords
...:
...: # Printing the Cartesian coordinates of all atoms in the original structure (POSCAR_ms)
...: print("Cartesian coordinates of all atoms in the original structure (POSCAR_ms):")
...: for i, coords in enumerate(cart_coords_ms, start=1):
...: print(f"Atom {i}: {coords}")
...:
...: # Printing the Cartesian coordinates of all atoms in the target structure (POSCAR_vaspkit)
...: print("\nCartesian coordinates of all atoms in the target structure (POSCAR_vaspkit):")
...: for i, coords in enumerate(cart_coords_vaspkit, start=1):
...: print(f"Atom {i}: {coords}")
...:
Cartesian coordinates of all atoms in the original structure (POSCAR_ms):
Atom 1: [0. 0. 0.]
Atom 2: [1.93350005 1.11630678 0.78934807]
Cartesian coordinates of all atoms in the target structure (POSCAR_vaspkit):
Atom 1: [0. 0. 0.]
Atom 2: [1.36718202 1.36718202 1.36718202]