def setUp(self): self.structure = io.read_from_file_structure_poscar('Si_data/POSCAR') self.structure.set_primitive_matrix([[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) self.structure.set_force_constants( get_force_constants_from_file(file_name='Si_data/FORCE_CONSTANTS', fc_supercell=[[2, 0, 0], [0, 2, 0], [0, 0, 2]]))
def setUp(self): structure = io.read_from_file_structure_poscar('MgO_data/POSCAR') structure.set_primitive_matrix([[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) structure.set_force_constants(get_force_constants_from_file(file_name='MgO_data/FORCE_CONSTANTS', fc_supercell=[[2, 0, 0], [0, 2, 0], [0, 0, 2]])) trajectory = io.generate_test_trajectory(structure, supercell=[2, 2, 2], total_time=5, silent=False) self.calculation = dynaphopy.Quasiparticle(trajectory)
def setUp(self): import phonopy print('Using phonopy {}'.format(phonopy.__version__)) # structure = io.read_from_file_structure_poscar('Si_data/POSCAR') self.structure = io.read_from_file_structure_outcar('Si_data/OUTCAR') self.structure.set_primitive_matrix([[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) self.structure.set_force_constants( get_force_constants_from_file(file_name='Si_data/FORCE_CONSTANTS', fc_supercell=[[2, 0, 0], [0, 2, 0], [0, 0, 2]]))
def setUp(self): self.structure = io.read_from_file_structure_poscar('GaN_data/POSCAR') self.structure.set_primitive_matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) self.structure.set_force_constants(get_force_constants_from_file(file_name='GaN_data/FORCE_CONSTANTS', fc_supercell=[[3, 0, 0], [0, 3, 0], [0, 0, 3]])) if not os.path.exists('test_gan.h5'): trajectory = io.generate_test_trajectory(self.structure, supercell=[3, 3, 3], total_time=8, silent=False) self.calculation = dynaphopy.Quasiparticle(trajectory) self.calculation.save_velocity_hdf5('test_gan.h5', save_trajectory=True)
def setUp(self): import phonopy print ('Using phonopy {}'.format(phonopy.__version__)) # structure = io.read_from_file_structure_poscar('Si_data/POSCAR') structure = io.read_from_file_structure_outcar('Si_data/OUTCAR') structure.set_primitive_matrix([[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) structure.set_force_constants(get_force_constants_from_file(file_name='Si_data/FORCE_CONSTANTS', fc_supercell=[[2, 0, 0], [0, 2, 0], [0, 0, 2]])) trajectory = io.generate_test_trajectory(structure, supercell=[2, 2, 2], total_time=5, silent=False) self.calculation = dynaphopy.Quasiparticle(trajectory)
def setUp(self): self.structure = io.read_from_file_structure_poscar('GaN_data/POSCAR') self.structure.set_primitive_matrix([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]) self.structure.set_force_constants( get_force_constants_from_file(file_name='GaN_data/FORCE_CONSTANTS', fc_supercell=[[3, 0, 0], [0, 3, 0], [0, 0, 3]])) if not os.path.exists('test_gan.h5'): trajectory = io.generate_test_trajectory(self.structure, supercell=[3, 3, 3], total_time=8, silent=False) self.calculation = dynaphopy.Quasiparticle(trajectory) self.calculation.save_velocity_hdf5('test_gan.h5', save_trajectory=True)
def setUp(self): import phonopy print('Using phonopy {}'.format(phonopy.__version__)) # structure = io.read_from_file_structure_poscar('Si_data/POSCAR') structure = io.read_from_file_structure_outcar('Si_data/OUTCAR') structure.set_primitive_matrix([[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) structure.set_force_constants( get_force_constants_from_file(file_name='Si_data/FORCE_CONSTANTS', fc_supercell=[[2, 0, 0], [0, 2, 0], [0, 0, 2]])) trajectory = io.generate_test_trajectory(structure, supercell=[2, 2, 2], total_time=5, silent=False) self.calculation = dynaphopy.Quasiparticle(trajectory)
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()