def symmetrize_force_constants(force_constants, level=1): """Symmetry force constants by translational and permutation symmetries. Note ---- Schemes of symmetrization are slightly different between C and python implementations. If these give very different results, the original force constants are not reliable anyway. Parameters ---------- force_constants: ndarray Force constants. Symmetrized force constants are overwritten. dtype=double shape=(n_satom,n_satom,3,3) primitive: Primitive Primitive cell level: int Controls the number of times the following steps repeated: 1) Subtract drift force constants along row and column 2) Average fc and fc.T """ try: import phonopy._phonopy as phonoc phonoc.perm_trans_symmetrize_fc(force_constants, level) except ImportError: for i in range(level): set_translational_invariance(force_constants) set_permutation_symmetry(force_constants) set_translational_invariance(force_constants)
def symmetrize_force_constants(force_constants, iteration=1): """Symmetry force constants by translational and permutation symmetries. The way of doing is currently different between C and python implementations. If these give very different results, the original force constants are not reliable anyway. The one implemented in C is simpler and so considered better. """ try: import phonopy._phonopy as phonoc phonoc.perm_trans_symmetrize_fc(force_constants) except ImportError: for i in range(iteration): set_permutation_symmetry(force_constants) set_translational_invariance(force_constants)