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