Skip to content

Commit

Permalink
Implement pymatgen_read_from_file()
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Jul 24, 2023
1 parent 5fae62a commit 430f988
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ stk.plot3d(structure)
* `stk.build.high_index_surface()`
* `stk.build.get_high_index_surface_info()`
* `stk.build.sqs_structures()`
* `stk.build.pyxtal()`
* `stk.build.B2()`
* `stk.build.C14()`
* `stk.build.C15()`
Expand All @@ -60,4 +61,11 @@ stk.plot3d(structure)
### Common
* `stk.common.ase_to_pymatgen()`
* `stk.common.pymatgen_to_ase()`
* `stk.common.pymatgen_read_from_file()`
* `stk.common.ase_to_pyscal()`
* `stk.common.apply_strain()`
* `stk.common.center_coordinates_in_unit_cell()`
* `stk.common.get_extended_positions()`
* `stk.common.get_vertical_length()`
* `stk.common.get_wrapped_coordinates()`
* `stk.common.select_index()`
6 changes: 5 additions & 1 deletion structuretoolkit/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
get_wrapped_coordinates,
select_index,
)
from structuretoolkit.common.pymatgen import ase_to_pymatgen, pymatgen_to_ase
from structuretoolkit.common.pymatgen import (
ase_to_pymatgen,
pymatgen_read_from_file,
pymatgen_to_ase,
)
from structuretoolkit.common.pyscal import ase_to_pyscal
6 changes: 6 additions & 0 deletions structuretoolkit/common/pymatgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ def pymatgen_to_ase(structure):

adapter = AseAtomsAdaptor()
return adapter.get_atoms(structure=structure)


def pymatgen_read_from_file(*args, **kwargs):
from pymatgen.core import Structure

return pymatgen_to_ase(structure=Structure.from_file(*args, **kwargs))

0 comments on commit 430f988

Please sign in to comment.