# calculate forces and convert to phonopy force_sets force_gap_scells = api_q.calc_force_sets_GAP(gp_xml_file, Scells_quippy) #parse force set and calc force constants phonon_scell.set_forces(force_gap_scells) PhonIO.write_FORCE_SETS(phonon_scell.get_displacement_dataset() ) # write forces & displacements to FORCE_SET force_set = PhonIO.parse_FORCE_SETS() # parse force_sets phonon_scell.set_displacement_dataset( force_set) # force_set is a list of forces and displacements if NAC == True: nac_params = PhonIO.get_born_parameters( open("BORN"), phonon_scell.get_primitive(), phonon_scell.get_primitive_symmetry()) if nac_params['factor'] == None: physical_units = get_default_physical_units(interface_mode) nac_params['factor'] = physical_units['nac_factor'] phonon_scell._nac_params = nac_params phonon_scell.produce_force_constants() phonon_scell.symmetrize_force_constants() api_ph.write_ShengBTE_FC2(phonon_scell.get_force_constants(), filename='FORCE_CONSTANTS_2ND') # phonopy 2.7 changed format, ShengBTE won't read, use the file in api_qpv to write. # calc and plot bandstructure bands = api_ph.qpoints_Band_paths(Qpoints, Band_points) phonon_scell.set_band_structure(bands, is_eigenvectors=True,
from phonopy.structure.symmetry import Symmetry from phonopy.interface.vasp import read_vasp from phonopy.file_IO import parse_FORCE_SETS, parse_BORN from phonopy.structure.spglib import get_stabilized_reciprocal_mesh from phonopy.structure.tetrahedron_method import TetrahedronMethod from phonopy.phonon.tetrahedron_mesh import TetrahedronMesh cell = read_vasp(sys.argv[1]) phonon = Phonopy(cell, [[2, 0, 0], [0, 2, 0], [0, 0, 2]], is_auto_displacements=False) force_sets = parse_FORCE_SETS() phonon.set_force_sets(force_sets) phonon.set_post_process([[0, 0.5, 0.5], [0.5, 0, 0.5], [0.5, 0.5, 0]]) primitive = phonon.get_primitive() born = parse_BORN(primitive) phonon.set_nac_params(born) symmetry = phonon.get_primitive_symmetry() mesh = [20, 20, 20] # phonon.set_mesh(mesh) # phonon.set_total_DOS(sigma=0.1) # phonon.plot_total_DOS().show() rotations = symmetry.get_pointgroup_operations() thm = TetrahedronMesh(phonon.get_dynamical_matrix(), mesh, rotations, is_gamma_center=True) thm.run_dos() for f, iw in zip(thm.get_frequency_points(), thm.get_integration_weights()): print f, iw