Skip to content

Commit 56b1b79

Browse files
committed
surface: new function fragment_atoms_by_layer
1 parent 7ef2269 commit 56b1b79

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repository = "https://github.com/gosh-rs/gosh"
1212
[dependencies]
1313
gut = { version = "0.4", package = "gchemol-gut" }
1414
spdkit = { version = "0.1.1" }
15-
spdkit-surface = { version = "0.1", features = ["adhoc"] }
15+
spdkit-surface = { version = "0.1.1", features = ["adhoc"] }
1616
educate = { version = "0.1", features = ["adhoc"] }
1717
distances = { version = "0.1", features = ["adhoc"] }
1818
gchemol = { version = "0.1", features = ["adhoc"] }

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Surface
7676
==================
7777
.. autofunction:: spdkit.surface.probe_surface_atoms
7878
.. autofunction:: spdkit.surface.probe_adsorption_sites
79+
.. autofunction:: spdkit.surface.fragment_atoms_by_layer
7980

8081

8182
Reaction Path

src/surface.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,24 @@ pub fn probe_adsorption_sites(mol: &PyMolecule, probe_element: &str, maxcycle: u
3434
}
3535
// 3b89501f ends here
3636

37+
// [[file:../spdkit-python.note::09bb2ce3][09bb2ce3]]
38+
#[pyfunction]
39+
/// Fragment molecule into connected parts by layer for periodic slab model.
40+
pub fn fragment_atoms_by_layer(mol: &PyMolecule) -> Result<Vec<Vec<usize>>> {
41+
use spdkit_surface::fragment_atoms_by_layer;
42+
43+
let probed = fragment_atoms_by_layer(&mol.inner)?.collect();
44+
Ok(probed)
45+
}
46+
// 09bb2ce3 ends here
47+
3748
// [[file:../spdkit-python.note::4b881b59][4b881b59]]
3849
pub fn new<'p>(py: Python<'p>, name: &str) -> PyResult<&'p PyModule> {
3950
let m = PyModule::new(py, name)?;
4051
// m.add_class::<PyTemplate>()?;
4152
m.add_function(wrap_pyfunction!(probe_surface_atoms, m)?)?;
4253
m.add_function(wrap_pyfunction!(probe_adsorption_sites, m)?)?;
54+
m.add_function(wrap_pyfunction!(fragment_atoms_by_layer, m)?)?;
4355

4456
Ok(m)
4557
}

0 commit comments

Comments
 (0)