def convert_phonopy_atoms_to_structure(phonopy_atoms_structure):
    """
	Converts phonopy's representation of a structure to an instance of Structure.
	"""

    temporary_write_path = Path.get_temporary_path()

    Path.validate_does_not_exist(temporary_write_path)
    Path.validate_writeable(temporary_write_path)

    write_vasp(temporary_write_path, phonopy_atoms_structure)

    species_list = convert_phonopy_symbols_to_unique_species_list(
        phonopy_atoms_structure.symbols)

    structure_poscar_file = File(temporary_write_path)
    structure_poscar_file.insert(
        5, " ".join(species_list))  #phonopy uses bad poscar format
    structure_poscar_file.write_to_path()

    final_structure = Structure(temporary_write_path)

    Path.remove(temporary_write_path)

    Structure.validate(final_structure)

    return final_structure
def convert_structure_to_phonopy_atoms(structure):
    """
	Takes structure, a Structure instance, and returns a PhonopyAtoms class (phonopy's representation of structures)
	"""

    temporary_write_path = Path.get_temporary_path()

    Structure.validate(structure)

    Path.validate_does_not_exist(temporary_write_path)
    Path.validate_writeable(temporary_write_path)

    structure.to_poscar_file_path(temporary_write_path)
    phonopy_structure = read_vasp(temporary_write_path)

    Path.remove(temporary_write_path)

    return phonopy_structure
Exemple #3
0
	def delete_big_vasp_files_if_complete(self):
		if self.complete:
			for file_name in ['WAVECAR', 'CHG', 'CHGCAR', 'vasprun.xml']:
				if Path.exists(self.get_extended_path(file_name)):
					Path.remove(self.get_extended_path(file_name))			
Exemple #4
0
	def delete_wavecar_if_complete(self):
		if Path.exists(self.get_extended_path('WAVECAR')) and self.complete:
			Path.remove(self.get_extended_path('WAVECAR'))