-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from pyiron/phonopy
Convert from phonopy to ASE
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
def phonopy_to_atoms(ph_atoms): | ||
""" | ||
Convert Phonopy Atoms to ASE-like Atoms | ||
Args: | ||
ph_atoms: Phonopy Atoms object | ||
Returns: ASE-like Atoms object | ||
""" | ||
from ase.atoms import Atoms | ||
|
||
return Atoms( | ||
symbols=list(ph_atoms.get_chemical_symbols()), | ||
positions=list(ph_atoms.get_positions()), | ||
cell=list(ph_atoms.get_cell()), | ||
pbc=True, | ||
) | ||
|
||
|
||
def atoms_to_phonopy(atom): | ||
""" | ||
Convert ASE-like Atoms to Phonopy Atoms | ||
Args: | ||
atom: ASE-like Atoms | ||
Returns: | ||
Phonopy Atoms | ||
""" | ||
from phonopy.structure.atoms import PhonopyAtoms | ||
|
||
return PhonopyAtoms( | ||
symbols=list(atom.get_chemical_symbols()), | ||
scaled_positions=list(atom.get_scaled_positions()), | ||
cell=list(atom.get_cell()), | ||
) |