Skip to content

Commit 87f2e77

Browse files
committed
io: new function read_lattice_extxyz
1 parent 669d57f commit 87f2e77

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/io.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use pyo3::prelude::*;
44
// 45ba73aa ends here
55

66
// [[file:../spdkit-python.note::4cfd5c0b][4cfd5c0b]]
7-
use super::{PyMolecule, PyMoleculeIter};
7+
use super::{PyMolecule, PyMoleculeIter, PyLattice};
88

99
#[pyfunction]
1010
/// Read a list of `Molecule` from `path`. Returns an iterator over
@@ -29,6 +29,13 @@ pub fn guess_format_from_path(path: &str) -> Option<String> {
2929
Some(fmt)
3030
}
3131

32+
/// Guess chemical file format from `path`
33+
#[pyfunction]
34+
pub fn read_lattice_extxyz(line: &str) -> Option<PyLattice> {
35+
let inner = gchemol::io::read_lattice_extxyz(line)?;
36+
Some(PyLattice { inner })
37+
}
38+
3239
#[pyfunction]
3340
#[pyo3(signature = (pattern, /, root=".", recursive=true))]
3441
#[pyo3(text_signature = "(pattern, root='.', recursive=True)")]

0 commit comments

Comments
 (0)