def create_from_castep(self, request): material, phonon_file, json_file = request.param qpt_ph_modes = QpointPhononModes.from_castep( get_castep_path(material, phonon_file)) expected_qpt_ph_modes = ExpectedQpointPhononModes( os.path.join(get_qpt_ph_modes_dir(material), json_file)) return qpt_ph_modes, expected_qpt_ph_modes
def modes_from_file(filename: Union[str, os.PathLike] ) -> QpointPhononModes: """ Load phonon mode data from file Parameters ---------- filename Data file Returns ------- QpointPhononmodes """ path = pathlib.Path(filename) if path.suffix == '.phonon': return QpointPhononModes.from_castep(path) elif path.suffix == '.json': return QpointPhononModes.from_json_file(path) elif path.suffix in ('.yaml', '.hdf5'): return QpointPhononModes.from_phonopy(path=path.parent, phonon_name=path.name) else: raise ValueError("File not recognised. Should have extension " ".yaml or .hdf5 (phonopy), " ".phonon (castep) or .json (JSON from Euphonic).")
def test_calculate_dos(self, material, qpt_ph_modes_file, expected_dos_json, ebins): if qpt_ph_modes_file.endswith('.phonon'): qpt_ph_modes = QpointPhononModes.from_castep( get_castep_path(material, qpt_ph_modes_file)) else: qpt_ph_modes = QpointPhononModes.from_phonopy( phonon_name=get_phonopy_path(material, qpt_ph_modes_file)) dos = qpt_ph_modes.calculate_dos(ebins) expected_dos = get_expected_spectrum1d(expected_dos_json) check_spectrum1d(dos, expected_dos)
def test_calculate_debye_waller(self, material, qpt_ph_modes_file, expected_dw_json, temperature, kwargs): if qpt_ph_modes_file.endswith('.phonon'): qpt_ph_modes = QpointPhononModes.from_castep( get_castep_path(material, qpt_ph_modes_file)) else: qpt_ph_modes = QpointPhononModes.from_phonopy( phonon_name=get_phonopy_path(material, qpt_ph_modes_file)) dw = qpt_ph_modes.calculate_debye_waller(temperature * ureg('K'), **kwargs) expected_dw = get_expected_dw(material, expected_dw_json) check_debye_waller(dw, expected_dw, dw_atol=1e-12)
def get_si2_qpt_ph_modes(): return QpointPhononModes.from_castep( get_castep_path('Si2-sc-skew', 'Si2-sc-skew.phonon'))
def get_quartz_qpt_ph_modes(): return QpointPhononModes.from_castep( get_castep_path('quartz', 'quartz_nosplit.phonon'))