eigenvectors) dynmat2fc.run() force_constants = ForceConstants(dynmat2fc.get_force_constants(), supercell=fc_supercell) # Symmetrize force constants using crystal symmetry if symmetrize: print('Symmetrizing force constants') set_tensor_symmetry_PJ(force_constants.get_array(), phonon.supercell.get_cell().T, phonon.supercell.get_scaled_positions(), phonon.symmetry) return force_constants if __name__ == "__main__": import dynaphopy.interface.iofile as reading input_parameters = reading.read_parameters_from_input_file( '/home/abel/VASP/Ag2Cu2O4/MD/input_dynaphopy') structure = reading.read_from_file_structure_poscar( input_parameters['structure_file_name_poscar']) structure.set_primitive_matrix(input_parameters['_primitive_matrix']) # structure.set_supercell_phonon(input_parameters['_supercell_phonon']) structure.set_force_set( get_force_sets_from_file( file_name=input_parameters['force_constants_file_name'])) obtain_phonopy_dos(structure)
def __init__(self, args, load_data=False, verbose=False, tmin=None): input_parameters = reading.read_parameters_from_input_file(args.input_file) if 'structure_file_name_outcar' in input_parameters: structure = reading.read_from_file_structure_outcar(input_parameters['structure_file_name_outcar']) else: structure = reading.read_from_file_structure_poscar(input_parameters['structure_file_name_poscar']) structure.get_data_from_dict(input_parameters) if 'supercell_phonon' in input_parameters: supercell_phonon = input_parameters['supercell_phonon'] else: supercell_phonon = np.identity(3) structure.set_force_constants(get_force_constants_from_file(file_name=input_parameters['force_constants_file_name'], fc_supercell=supercell_phonon)) if '_mesh_phonopy' in input_parameters: mesh = input_parameters['_mesh_phonopy'] else: mesh = [20, 20, 20] # Default print ('mesh set to: {}'.format(mesh)) if 'bands' in input_parameters is None: self._bands = structure.get_path_using_seek_path() else: self._bands = input_parameters['_band_ranges'] volumes, energies = read_v_e(args.ev, factor=1.0, volume_factor=1.0, pressure=args.pressure) self._fc_fit = ForceConstantsFitting(structure, files_temperature=args.ct_data, files_volume=args.cv_data, temperatures=args.temperatures, volumes=volumes, mesh=mesh, ref_temperature=args.ref_temperature, fitting_order=args.order, tmin=tmin, use_NAC=True) if not load_data: temperatures = self._fc_fit.get_temperature_range() free_energy = [] entropy = [] cv = [] for v, e in zip(volumes, energies): print ('Volume: {} Ang. Energy(U): {} eV'.format(v, e)) tp_data = self._fc_fit.get_thermal_properties(volume=v) free_energy.append(tp_data[0]) entropy.append(tp_data[1]) cv.append(tp_data[2]) free_energy = np.array(free_energy).T entropy = np.array(entropy).T cv = np.array(cv).T np.save('free_energy.npy', free_energy) np.save('temperatures.npy', temperatures) np.save('cv.npy', cv) np.save('entropy.npy', entropy) else: free_energy = np.load('free_energy.npy') temperatures = np.load('temperatures.npy') cv = np.load('cv.npy') entropy = np.load('entropy.npy') self.phonopy_qha = PhonopyQHA(volumes, energies, eos="vinet", # options: 'vinet', 'murnaghan' or 'birch_murnaghan' temperatures=temperatures, free_energy=free_energy, cv=cv, entropy=entropy, t_max=self.fc_fit.get_temperature_range()[-1], verbose=False) # Write data files to disk self.phonopy_qha.write_bulk_modulus_temperature() self.phonopy_qha.write_gibbs_temperature() self.phonopy_qha.write_heat_capacity_P_numerical() self.phonopy_qha.write_gruneisen_temperature() self.phonopy_qha.write_thermal_expansion() self.phonopy_qha.write_helmholtz_volume() self.phonopy_qha.write_volume_expansion() self.phonopy_qha.write_volume_temperature() if verbose: self.phonopy_qha.plot_qha().show()
def __init__(self, args, load_data=False, verbose=False, tmin=None): input_parameters = reading.read_parameters_from_input_file( args.input_file) if 'structure_file_name_outcar' in input_parameters: structure = reading.read_from_file_structure_outcar( input_parameters['structure_file_name_outcar']) else: structure = reading.read_from_file_structure_poscar( input_parameters['structure_file_name_poscar']) structure.get_data_from_dict(input_parameters) if 'supercell_phonon' in input_parameters: supercell_phonon = input_parameters['supercell_phonon'] else: supercell_phonon = np.identity(3) structure.set_force_constants( get_force_constants_from_file( file_name=input_parameters['force_constants_file_name'], fc_supercell=supercell_phonon)) if '_mesh_phonopy' in input_parameters: mesh = input_parameters['_mesh_phonopy'] else: mesh = [20, 20, 20] # Default print('mesh set to: {}'.format(mesh)) if 'bands' in input_parameters is None: self._bands = structure.get_path_using_seek_path() else: self._bands = input_parameters['_band_ranges'] volumes, energies = read_v_e(args.ev, factor=1.0, volume_factor=1.0, pressure=args.pressure) self._fc_fit = ForceConstantsFitting( structure, files_temperature=args.ct_data, files_volume=args.cv_data, temperatures=args.temperatures, volumes=volumes, mesh=mesh, ref_temperature=args.ref_temperature, fitting_order=args.order, tmin=tmin, use_NAC=True) if not load_data: temperatures = self._fc_fit.get_temperature_range() free_energy = [] entropy = [] cv = [] for v, e in zip(volumes, energies): print('Volume: {} Ang. Energy(U): {} eV'.format(v, e)) tp_data = self._fc_fit.get_thermal_properties(volume=v) free_energy.append(tp_data[0]) entropy.append(tp_data[1]) cv.append(tp_data[2]) free_energy = np.array(free_energy).T entropy = np.array(entropy).T cv = np.array(cv).T np.save('free_energy.npy', free_energy) np.save('temperatures.npy', temperatures) np.save('cv.npy', cv) np.save('entropy.npy', entropy) else: free_energy = np.load('free_energy.npy') temperatures = np.load('temperatures.npy') cv = np.load('cv.npy') entropy = np.load('entropy.npy') self.phonopy_qha = PhonopyQHA( volumes, energies, eos="vinet", # options: 'vinet', 'murnaghan' or 'birch_murnaghan' temperatures=temperatures, free_energy=free_energy, cv=cv, entropy=entropy, t_max=self.fc_fit.get_temperature_range()[-1], verbose=False) # Write data files to disk self.phonopy_qha.write_bulk_modulus_temperature() self.phonopy_qha.write_gibbs_temperature() self.phonopy_qha.write_heat_capacity_P_numerical() self.phonopy_qha.write_gruneisen_temperature() self.phonopy_qha.write_thermal_expansion() self.phonopy_qha.write_helmholtz_volume() self.phonopy_qha.write_volume_expansion() self.phonopy_qha.write_volume_temperature() if verbose: self.phonopy_qha.plot_qha().show()
size = structure.get_number_of_dimensions() * structure.get_number_of_primitive_atoms() eigenvectors = np.array([eigenvector.reshape(size, size, order='C').T for eigenvector in eigenvectors ]) renormalized_frequencies = np.array(renormalized_frequencies) dynmat2fc.set_dynamical_matrices(renormalized_frequencies / VaspToTHz, eigenvectors) dynmat2fc.run() force_constants = ForceConstants(dynmat2fc.get_force_constants(), supercell=fc_supercell) # Symmetrize force constants using crystal symmetry if symmetrize: print('Symmetrizing force constants') set_tensor_symmetry_PJ(force_constants.get_array(), phonon.supercell.get_cell(), phonon.supercell.get_scaled_positions(), phonon.symmetry) return force_constants if __name__ == "__main__": import dynaphopy.interface.iofile as reading input_parameters = reading.read_parameters_from_input_file('/home/abel/VASP/Ag2Cu2O4/MD/input_dynaphopy') structure = reading.read_from_file_structure_poscar(input_parameters['structure_file_name_poscar']) structure.set_primitive_matrix(input_parameters['_primitive_matrix']) # structure.set_supercell_phonon(input_parameters['_supercell_phonon']) structure.set_force_set(get_force_sets_from_file(file_name=input_parameters['force_constants_file_name'])) obtain_phonopy_dos(structure)