File: NaCl-read_write_fc.py

package info (click to toggle)
phonopy 2.47.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 29,380 kB
  • sloc: python: 43,690; xml: 12,080; ansic: 3,227; cpp: 525; sh: 213; makefile: 20
file content (18 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Example to read and write FORCE_CONSTANTS file."""

import phonopy
from phonopy.file_IO import parse_FORCE_CONSTANTS, write_FORCE_CONSTANTS

phonon = phonopy.load(
    supercell_matrix=[[2, 0, 0], [0, 2, 0], [0, 0, 2]],
    primitive_matrix=[[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]],
    unitcell_filename="POSCAR-unitcell",
    force_sets_filename="FORCE_SETS",
    born_filename="BORN",
)
write_FORCE_CONSTANTS(phonon.force_constants, filename="FORCE_CONSTANTS")

force_constants = parse_FORCE_CONSTANTS()
phonon.force_constants = force_constants
phonon.symmetrize_force_constants()
write_FORCE_CONSTANTS(phonon.force_constants, filename="FORCE_CONSTANTS_NEW")