def _get_band_qpoints(): band_paths = [ [[0, 0, 0], [0.5, 0.5, 0.5]], [[0.5, 0.5, 0], [0, 0, 0], [0.5, 0.25, 0.75]], ] qpoints = get_band_qpoints(band_paths, npoints=11) return qpoints
def run_task(self, fw_spec): create_FORCE_CONSTANTS("vasprun.xml", False, 1) (Keylist, Coordslist, prims, transmat) = get_highsympath("POSCAR-unitcell") phonon = phonopy.load(supercell_matrix=self.get("supercell"), primitive_matrix=transmat, unitcell_filename="POSCAR-unitcell", calculator="vasp", is_nac=False, force_constants_filename="FORCE_CONSTANTS") points = get_band_qpoints([np.array(Coordslist)], 51) phonon.run_band_structure(points, with_group_velocities=True) phonon.write_yaml_band_structure()
def run_gruneisen_then_exit(phono3py, settings, output_filename, log_level): """Run mode Grueneisen parameter calculation from fc3.""" if (settings.mesh_numbers is None and settings.band_paths is None and settings.qpoints is None): print("An option of --mesh, --band, or --qpoints has to be specified.") if log_level: print_error() sys.exit(1) if len(phono3py.fc2) != len(phono3py.fc3): print("Supercells used for fc2 and fc3 have to be same.") if log_level: print_error() sys.exit(1) if settings.band_paths is not None: if settings.band_points is None: npoints = 51 else: npoints = settings.band_points band_paths = settings.band_paths bands = get_band_qpoints(band_paths, npoints=npoints) else: bands = None rotations = phono3py.primitive_symmetry.pointgroup_operations run_gruneisen_parameters( phono3py.fc2, phono3py.fc3, phono3py.supercell, phono3py.primitive, bands, settings.mesh_numbers, rotations, settings.qpoints, nac_params=phono3py.nac_params, nac_q_direction=settings.nac_q_direction, ion_clamped=settings.ion_clamped, factor=VaspToTHz, symprec=phono3py.symmetry.tolerance, output_filename=output_filename, log_level=log_level, ) if log_level: print_end() sys.exit(0)
def testBand(self): band_paths = [[[0, 0, 0], [0.5, 0.5, 0.5]], [[0.5, 0.5, 0], [0, 0, 0], [0.5, 0.25, 0.75]]] qpoints = get_band_qpoints(band_paths, npoints=11) phonon = self._get_phonon() phonon.run_band_structure(qpoints, with_group_velocities=True) band_structure = phonon.band_structure phonon.get_band_structure_dict() self.assertTrue(id(band_structure.distances), id(band_structure.get_distances())) self.assertTrue(id(band_structure.qpoints), id(band_structure.get_qpoints())) self.assertTrue(id(band_structure.frequencies), id(band_structure.get_frequencies())) self.assertTrue(id(band_structure.eigenvectors), id(band_structure.get_eigenvectors())) self.assertTrue(id(band_structure.group_velocities), id(band_structure.get_group_velocities()))
def run_task(self, fw_spec): files_to_copy = [ "POSCAR-unitcell", "INCAR", "vasprun.xml", "FORCE_CONSTANTS", "band.yaml" ] path_dict = dict() calc_loc_orig = get_calc_loc("orig phonon band", fw_spec["calc_locs"]) path_dict["orig"] = calc_loc_orig["path"] calc_loc_minus = get_calc_loc("minus phonon band", fw_spec["calc_locs"]) path_dict["minus"] = calc_loc_minus["path"] calc_loc_plus = get_calc_loc("plus phonon band", fw_spec["calc_locs"]) path_dict["plus"] = calc_loc_plus["path"] curr_dir = os.getcwd() for key, path in path_dict.items(): new_dir = os.path.join(curr_dir, key) os.makedirs(new_dir) copy = CopyFiles(from_dir=path, to_dir=new_dir, files_to_copy=files_to_copy) copy.run_task(fw_spec) phonons = {} for vol in ("orig", "plus", "minus"): (Keylist, Coordslist, prims, transmat) = get_highsympath("%s/POSCAR-unitcell" % vol) phonon = phonopy.load( supercell_matrix=self.get("supercell"), primitive_matrix=transmat, unitcell_filename="%s/POSCAR-unitcell" % vol, calculator="vasp", is_nac=False, force_constants_filename="%s/FORCE_CONSTANTS" % vol) phonons[vol] = phonon gruneisen = PhonopyGruneisen(phonons["orig"], phonons["plus"], phonons["minus"]) bands = get_band_qpoints([np.array(Coordslist)], 51) gruneisen.set_band_structure(bands) gruneisen.write_yaml_band_structure()
def test_gruneisen_band(ph_nacl_gruneisen): """Test of mode Grueneisen parameter calculation along band paths.""" paths = get_band_qpoints([[[0.05, 0.05, 0.05], [0.5, 0.5, 0.5]]], npoints=10) ph0, ph_minus, ph_plus = ph_nacl_gruneisen phg = PhonopyGruneisen(ph0, ph_minus, ph_plus) phg.set_band_structure(paths) qpoints, distances, freqs, _, gammas = phg.get_band_structure() # print(", ".join(["%.5f" % v for v in distances[0]])) np.testing.assert_allclose(distances[0], band_distances, atol=1e-5) np.testing.assert_allclose(qpoints[0], band_qpoints, atol=1e-5) # for line in freqs[0].reshape(-1, 6): # print(", ".join(["%.5f" % v for v in line])) for freqs_q, band_freqs_q in zip(freqs[0], band_freqs): np.testing.assert_allclose(np.sort(freqs_q), np.sort(band_freqs_q), atol=1e-5) # for line in gammas[0].reshape(-1, 6): # print(", ".join(["%.5f" % v for v in line])) for gammas_q, band_gammas_q in zip(gammas[0], band_gammas): np.testing.assert_allclose(np.sort(gammas_q), np.sort(band_gammas_q), atol=1e-5)
"""NaCl band structure calculation example.""" import phonopy from phonopy.phonon.band_structure import get_band_qpoints 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", ) points = get_band_qpoints( [[[0.5, 0, 0.5], [0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0.25, 0.75]]], 51) phonon.run_band_structure(points, labels=["X", r"$\Gamma$", "L", "W"]) phonon.plot_band_structure().show()
import phonopy from phonopy.phonon.band_structure import get_band_qpoints phonon = phonopy.load([[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", force_sets_filename="FORCE_SETS", born_filename="BORN") points = get_band_qpoints( [[[0.5, 0, 0.5], [0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0.25, 0.75]]], 51) phonon.set_band_structure(points) phonon.plot_band_structure(labels=['X', '$\Gamma$', 'L', 'W']).show()
[0.5000000000, 0.0000000000, 0.5000000000]]] ################ fid = open('results.txt', 'w') fid.write(' System Model MAE fc2 MAE freq. MAE bands\n') fid.write('==================== ==================== =========== =========== ===========\n') for system in systems: phonon_ref = phonopy.load( unitcell_filename=system+'/POSCAR-unitcell', supercell_matrix=supercell, force_constants_filename=system+'/FORCE_CONSTANTS') bands = get_band_qpoints(band_path, 100) phonon_ref.run_band_structure(bands) for model_file in natsorted(os.listdir(models_path)): calc = spk_calculator(models_path+model_file, environment_provider, device) if relax: relax_poscar(system+'/POSCAR-unitcell', calc) phonon = phonopy.load( unitcell_filename='POSCAR-opt', supercell_matrix=supercell, produce_fc=False) else: phonon = phonopy.load( unitcell_filename=system+'/POSCAR-unitcell',