code: def get_pmg_structure(phonopy_structure):
      
  
      lattice = phonopy_structure.get_cell()
      frac_coords = phonopy_structure.get_scaled_positions()
      symbols = phonopy_structure.get_chemical_symbols()
      masses = phonopy_structure.get_masses()
      mms = phonopy_structure.get_magnetic_moments()
      mms = mms or [0] * len(symbols)
  
      return Structure(lattice, symbols, frac_coords,
                       site_properties={"phonopy_masses": masses,
                                        "magnetic_moments": mms})
docs: Convert a PhonopyAtoms object to pymatgen Structure object.
  
      Args:
          phonopy_structure (PhonopyAtoms): A phonopy structure object.