def get_phonon(pk, pk_nac): n = load_node(pk) unitcell = phonopy_atoms_from_structure(n.inputs.structure) smat = n.outputs.phonon_setting_info['supercell_matrix'] ph = Phonopy(unitcell, supercell_matrix=smat, primitive_matrix='auto') force_sets = n.outputs.force_sets.get_array('force_sets') dataset = n.outputs.phonon_setting_info['displacement_dataset'] ph.dataset = dataset ph.forces = force_sets ph.nac_params = get_nac_params(pk_nac) return ph
def dump_phonopy(pk): n = load_node(pk) unitcell = phonopy_atoms_from_structure(n.inputs.structure) smat = n.outputs.phonon_setting_info['supercell_matrix'] ph = Phonopy(unitcell, smat, primitive_matrix='auto') force_sets = n.outputs.force_sets.get_array('force_sets') dataset = n.outputs.phonon_setting_info['displacement_dataset'] ph.dataset = dataset ph.forces = force_sets if 'nac_params' in n.outputs: borns = n.outputs.nac_params.get_array('born_charges') epsilon = n.outputs.nac_params.get_array('epsilon') nac_params = { 'born': borns, 'factor': 14.399652, 'dielectric': epsilon } ph.nac_params = nac_params # phonopy-params.yaml is written out. ph.save() print("phonopy_params.yaml was made for PK=%d" % pk)