File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
# [[file:spdkit-python.note::e345323a][e345323a]]
2
2
[package ]
3
3
name = " spdkit-python"
4
- version = " 0.1.16 "
4
+ version = " 0.2.0 "
5
5
edition = " 2021"
6
6
authors = [
" Wenping Guo <[email protected] >" ]
7
7
description = " structure prediction kit for python"
Original file line number Diff line number Diff line change @@ -443,12 +443,25 @@ impl PyMolecule {
443
443
Self { inner }
444
444
}
445
445
446
+ /// Return its json representation of molecule object for template rendering.
447
+ pub fn to_json_renderable ( & self ) -> PyResult < String > {
448
+ let json = gchemol:: io:: to_json ( & self . inner ) ?;
449
+ Ok ( json)
450
+ }
451
+
446
452
/// Return its json representation of molecule object.
447
453
pub fn to_json ( & self ) -> PyResult < String > {
448
- let json = gchemol :: io :: to_json ( & self . inner ) ?;
454
+ let json = self . inner . to_json ( ) ?;
449
455
Ok ( json)
450
456
}
451
457
458
+ /// Return its json representation of molecule object.
459
+ #[ staticmethod]
460
+ pub fn from_json ( json : & str ) -> PyResult < Self > {
461
+ let inner = Molecule :: from_json ( json) ?;
462
+ Ok ( Self { inner } )
463
+ }
464
+
452
465
/// Replace atom `i` with new `atom`.
453
466
pub fn set_atom ( & mut self , i : usize , atom : PyAtom ) -> PyResult < ( ) > {
454
467
let a = self . inner . get_atom_mut ( i) . ok_or ( format_err ! ( "no atom {i}" ) ) ?;
You can’t perform that action at this time.
0 commit comments