Closed qzhu2017 closed 2 years ago
from pyxtal.lattice import Lattice
import numpy as np
paras = [(3.454, 3.401, 5.908, 90.00, 105.80, 90.00, 'monoclinic'),
(6.028, 3.419, 6.028, 90.00, 146.92, 90.00, 'monoclinic'),
(5.148, 6.121, 6.234, 108.8, 91.710, 113.4, 'triclinic'),
(5.163, 6.119, 6.256, 108.6, 91.778, 113.4, 'triclinic'),
]
for i in range(int(len(paras)/2)):
(a1, b1, c1, alpha1, beta1, gamma1, type1) = paras[i*2]
(a2, b2, c2, alpha2, beta2, gamma2, type2) = paras[i*2+1]
l1 = Lattice.from_para(a1, b1, c1, alpha1, beta1, gamma1, ltype=type1)
l2 = Lattice.from_para(a2, b2, c2, alpha2, beta2, gamma2, ltype=type2)
l1, _ = l1.optimize_multi()
l2, _ = l2.optimize_multi()
print(l1)
print(l2)
trans, diff = l2.search_transformation(l1)
l2 = l2.transform_multi(trans)
diff = l1.matrix-l2.matrix
print(l2)
if np.abs(diff).sum() > 0.25:
print("Problem")
break
When comparing two structures, sometimes lattice can be represented a different setting
There will be two steps to get the consistent lattice representation
Mainly used for finding the symmetry mapping