pub struct ConformerHandle { /* private fields */ }Expand description
A conformer ensemble: one molecule geometry with multiple 3D coordinate sets.
Create with new(smiles), then add conformers with add_generated_conformer
or add_minimized_conformer. Retrieve coordinates as PDB strings via
get_conformer_pdb(idx). Compare conformers with conformer_rmsd.
Implementations§
Source§impl ConformerHandle
impl ConformerHandle
Sourcepub fn new(smiles: &str) -> Result<ConformerHandle, JsValue>
pub fn new(smiles: &str) -> Result<ConformerHandle, JsValue>
Create a new empty ensemble for the molecule given by smiles.
Returns a JS error on SMILES parse failure.
Sourcepub fn conformer_count(&self) -> usize
pub fn conformer_count(&self) -> usize
Number of conformers currently stored.
Sourcepub fn add_generated_conformer(&mut self) -> usize
pub fn add_generated_conformer(&mut self) -> usize
Generate a new 3D conformer using distance-geometry and add it to the ensemble.
Returns the index of the newly added conformer.
Sourcepub fn add_minimized_conformer(&mut self) -> usize
pub fn add_minimized_conformer(&mut self) -> usize
Generate a new 3D conformer, run force-field minimization, and add it.
Returns the index of the newly added conformer.
Sourcepub fn get_conformer_pdb(&self, idx: usize) -> Option<String>
pub fn get_conformer_pdb(&self, idx: usize) -> Option<String>
Return conformer idx as a PDB string, or null if idx is out of range.
Sourcepub fn conformer_rmsd(&self, a: usize, b: usize) -> f64
pub fn conformer_rmsd(&self, a: usize, b: usize) -> f64
Kabsch-aligned RMSD (Å) between conformers a and b.
Returns NaN if either index is out of range.
Sourcepub fn conformer_rmsd_no_align(&self, a: usize, b: usize) -> f64
pub fn conformer_rmsd_no_align(&self, a: usize, b: usize) -> f64
Un-aligned (translation + rotation NOT removed) RMSD (Å) between conformers a and b.
Returns NaN if either index is out of range.
Sourcepub fn remove_conformer(&mut self, idx: usize) -> bool
pub fn remove_conformer(&mut self, idx: usize) -> bool
Remove conformer idx and return true, or false if idx is out of range.
Sourcepub fn cluster_conformers_json(&self, rms_threshold: f64) -> String
pub fn cluster_conformers_json(&self, rms_threshold: f64) -> String
Cluster conformers by Kabsch-aligned RMSD and return a JSON object describing which conformers to keep.
Uses greedy leader-linkage: conformers are visited in index order; each
is compared against existing cluster representatives. If the RMSD to any
representative is < rms_threshold, the conformer is discarded; otherwise
it starts a new cluster and is kept.
Returns {"kept_indices":[0,3,7,...],"removed_count":5} on success.
Trait Implementations§
Source§impl From<ConformerHandle> for JsValue
impl From<ConformerHandle> for JsValue
Source§fn from(value: ConformerHandle) -> Self
fn from(value: ConformerHandle) -> Self
Source§impl FromWasmAbi for ConformerHandle
impl FromWasmAbi for ConformerHandle
Source§impl IntoWasmAbi for ConformerHandle
impl IntoWasmAbi for ConformerHandle
Source§impl LongRefFromWasmAbi for ConformerHandle
impl LongRefFromWasmAbi for ConformerHandle
Source§type Abi = WasmPtr<WasmRefCell<ConformerHandle>>
type Abi = WasmPtr<WasmRefCell<ConformerHandle>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<ConformerHandle>
type Anchor = RcRef<ConformerHandle>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for ConformerHandle
impl OptionFromWasmAbi for ConformerHandle
Source§impl OptionIntoWasmAbi for ConformerHandle
impl OptionIntoWasmAbi for ConformerHandle
Source§impl RefFromWasmAbi for ConformerHandle
impl RefFromWasmAbi for ConformerHandle
Source§type Abi = WasmPtr<WasmRefCell<ConformerHandle>>
type Abi = WasmPtr<WasmRefCell<ConformerHandle>>
Self are recovered from.Source§type Anchor = RcRef<ConformerHandle>
type Anchor = RcRef<ConformerHandle>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for ConformerHandle
impl RefMutFromWasmAbi for ConformerHandle
Source§type Abi = WasmPtr<WasmRefCell<ConformerHandle>>
type Abi = WasmPtr<WasmRefCell<ConformerHandle>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<ConformerHandle>
type Anchor = RcRefMut<ConformerHandle>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for ConformerHandle
impl SupportsInstanceProperty for ConformerHandle
impl SupportsStaticProperty for ConformerHandle
Source§impl TryFromJsValue for ConformerHandle
impl TryFromJsValue for ConformerHandle
Source§impl VectorFromWasmAbi for ConformerHandle
impl VectorFromWasmAbi for ConformerHandle
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[ConformerHandle]>
Source§impl VectorIntoWasmAbi for ConformerHandle
impl VectorIntoWasmAbi for ConformerHandle
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[ConformerHandle]>) -> Self::Abi
Source§impl WasmDescribeVector for ConformerHandle
impl WasmDescribeVector for ConformerHandle
Auto Trait Implementations§
impl Freeze for ConformerHandle
impl RefUnwindSafe for ConformerHandle
impl Send for ConformerHandle
impl Sync for ConformerHandle
impl Unpin for ConformerHandle
impl UnsafeUnpin for ConformerHandle
impl UnwindSafe for ConformerHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.