pub struct PDB {
pub identifier: Option<String>,
pub scale: Option<TransformationMatrix>,
pub origx: Option<TransformationMatrix>,
pub unit_cell: Option<UnitCell>,
pub symmetry: Option<Symmetry>,
/* private fields */
}
Expand description
A PDB struct is generated by opening a PDB or mmCIF file. It contains all information present in this file, like its atoms, bonds, hierarchy , and metadata. The struct can be used to access, interact with, and edit this data.
use pdbtbx::*;
let (mut pdb, _errors) = pdbtbx::open(
"example-pdbs/1ubq.pdb",
StrictnessLevel::Medium
).unwrap();
pdb.remove_atoms_by(|atom| atom.element() == Some(&Element::H)); // Remove all H atoms
let mut avg_b_factor = 0.0;
for atom in pdb.atoms() { // Iterate over all atoms in the structure
avg_b_factor += atom.b_factor();
}
avg_b_factor /= pdb.atom_count() as f64;
println!("The average B factor of the protein is: {}", avg_b_factor);
pdbtbx::save(&pdb, "dump/1ubq_no_hydrogens.pdb", pdbtbx::StrictnessLevel::Loose);
Fields§
§identifier: Option<String>
The identifier as posed in the PDB Header or mmCIF entry.id, normally a 4 char string like ‘1UBQ’.
scale: Option<TransformationMatrix>
The Scale needed to transform orthogonal coordinates to fractional coordinates. This is inversely related to the unit cell.
origx: Option<TransformationMatrix>
The OrigX needed to transform orthogonal coordinates to submitted coordinates. In normal cases this is equal to the identity transformation.
unit_cell: Option<UnitCell>
The unit cell of the crystal, containing its size and shape. This is the size and shape of the repeating element in the crystal.
symmetry: Option<Symmetry>
The Symmetry or space group of the crystal. This is the way in which the protein is placed inside the unit cell.
Implementations§
source§impl PDB
impl PDB
Remarks
Functionality for working with remarks.
sourcepub fn remark_count(&self) -> usize
pub fn remark_count(&self) -> usize
Get the number of remark records in the PDB file.
sourcepub fn remarks(&self) -> impl DoubleEndedIterator<Item = &(usize, String)> + '_
pub fn remarks(&self) -> impl DoubleEndedIterator<Item = &(usize, String)> + '_
Get an iterator of references to the remarks, containing the remark-type-number and a line of free text.
sourcepub fn par_remarks(&self) -> impl ParallelIterator<Item = &(usize, String)> + '_
Available on crate feature rayon
only.
pub fn par_remarks(&self) -> impl ParallelIterator<Item = &(usize, String)> + '_
rayon
only.Get a parallel iterator of references to the remarks, containing the remark-type-number and a line of free text.
sourcepub fn remarks_mut(
&mut self
) -> impl DoubleEndedIterator<Item = &mut (usize, String)> + '_
pub fn remarks_mut( &mut self ) -> impl DoubleEndedIterator<Item = &mut (usize, String)> + '_
Get an iterator of references to the remarks, containing the remark-type-number and a line of free text.
sourcepub fn par_remarks_mut(
&mut self
) -> impl ParallelIterator<Item = &mut (usize, String)> + '_
Available on crate feature rayon
only.
pub fn par_remarks_mut( &mut self ) -> impl ParallelIterator<Item = &mut (usize, String)> + '_
rayon
only.Get a parallel iterator of references to the remarks, containing the remark-type-number and a line of free text.
source§impl PDB
impl PDB
MtriX
Functionality for working with the MtriX records form the PDB. The MtriX are needed to transform the Models to the full asymmetric subunit, if needed to contain the non-crystallographic symmetry.
sourcepub fn mtrix(&self) -> impl DoubleEndedIterator<Item = &MtriX> + '_
pub fn mtrix(&self) -> impl DoubleEndedIterator<Item = &MtriX> + '_
Get an iterator of references to the MtriX records for this PDB.
sourcepub fn par_mtrix(&self) -> impl ParallelIterator<Item = &MtriX> + '_
Available on crate feature rayon
only.
pub fn par_mtrix(&self) -> impl ParallelIterator<Item = &MtriX> + '_
rayon
only.Get a parallel iterator of references to the MtriX records for this PDB.
sourcepub fn mtrix_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut MtriX> + '_
pub fn mtrix_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut MtriX> + '_
Get an iterator of mutable references to the MtriX records for this PDB.
sourcepub fn par_mtrix_mut(&mut self) -> impl ParallelIterator<Item = &mut MtriX> + '_
Available on crate feature rayon
only.
pub fn par_mtrix_mut(&mut self) -> impl ParallelIterator<Item = &mut MtriX> + '_
rayon
only.Get a parallel iterator of mutable references to the MtriX records for this PDB.
sourcepub fn delete_mtrix_by<F>(&mut self, predicate: F)where
F: Fn(&MtriX) -> bool,
pub fn delete_mtrix_by<F>(&mut self, predicate: F)where F: Fn(&MtriX) -> bool,
Delete the MtriX matching the given predicate.
source§impl<'a> PDB
impl<'a> PDB
sourcepub fn model_count(&self) -> usize
pub fn model_count(&self) -> usize
Get the number of Models making up this PDB.
sourcepub fn chain_count(&self) -> usize
pub fn chain_count(&self) -> usize
Get the number of Chains making up this PDB.
sourcepub fn residue_count(&self) -> usize
pub fn residue_count(&self) -> usize
Get the number of Residues making up this PDB.
sourcepub fn par_residue_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_residue_count(&self) -> usize
rayon
only.Get the number of Residues making up this PDB in parallel.
sourcepub fn conformer_count(&self) -> usize
pub fn conformer_count(&self) -> usize
Get the number of Conformers making up this PDB.
sourcepub fn par_conformer_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_conformer_count(&self) -> usize
rayon
only.Get the number of Conformers making up this PDB in parallel.
sourcepub fn atom_count(&self) -> usize
pub fn atom_count(&self) -> usize
Get the number of Atoms making up this PDB.
sourcepub fn par_atom_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_atom_count(&self) -> usize
rayon
only.Get the number of Atoms making up this PDB in parallel.
sourcepub fn total_chain_count(&self) -> usize
pub fn total_chain_count(&self) -> usize
Get the number of Chains making up this PDB. Includes all models.
sourcepub fn par_total_chain_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_total_chain_count(&self) -> usize
rayon
only.Get the number of Chains making up this PDB in parallel. Includes all models.
sourcepub fn total_residue_count(&self) -> usize
pub fn total_residue_count(&self) -> usize
Get the number of Residues making up this PDB. Includes all models.
sourcepub fn par_total_residue_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_total_residue_count(&self) -> usize
rayon
only.Get the number of Residues making up this PDB in parallel. Includes all models.
sourcepub fn total_conformer_count(&self) -> usize
pub fn total_conformer_count(&self) -> usize
Get the number of Conformer making up this PDB. Includes all models.
sourcepub fn par_total_conformer_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_total_conformer_count(&self) -> usize
rayon
only.Get the number of Conformer making up this PDB in parallel. Includes all models.
sourcepub fn total_atom_count(&self) -> usize
pub fn total_atom_count(&self) -> usize
Get the number of Atoms making up this PDB. Includes all models.
sourcepub fn par_total_atom_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_total_atom_count(&self) -> usize
rayon
only.Get the number of Atoms making up this PDB in parallel. Includes all models.
sourcepub fn residue_mut(&mut self, index: usize) -> Option<&mut Residue>
pub fn residue_mut(&mut self, index: usize) -> Option<&mut Residue>
sourcepub fn conformer_mut(&mut self, index: usize) -> Option<&mut Conformer>
pub fn conformer_mut(&mut self, index: usize) -> Option<&mut Conformer>
sourcepub fn binary_find_atom(
&'a self,
serial_number: usize,
alternative_location: Option<&str>
) -> Option<AtomConformerResidueChainModel<'a>>
pub fn binary_find_atom( &'a self, serial_number: usize, alternative_location: Option<&str> ) -> Option<AtomConformerResidueChainModel<'a>>
Get a reference to the specified atom. Its uniqueness is guaranteed by including the
insertion_code
, with its full hierarchy. The algorithm is based
on binary search so it is faster than an exhaustive search, but the
full structure is assumed to be sorted. This assumption can be enforced
by using pdb.full_sort()
.
sourcepub fn binary_find_atom_mut(
&'a mut self,
serial_number: usize,
alternative_location: Option<&str>
) -> Option<AtomConformerResidueChainModelMut<'a>>
pub fn binary_find_atom_mut( &'a mut self, serial_number: usize, alternative_location: Option<&str> ) -> Option<AtomConformerResidueChainModelMut<'a>>
Get a mutable reference to the specified atom. Its uniqueness is guaranteed by
including the insertion_code
, with its full hierarchy. The algorithm is based
on binary search so it is faster than an exhaustive search, but the
full structure is assumed to be sorted. This assumption can be enforced
by using pdb.full_sort()
.
sourcepub fn find(
&'a self,
search: Search
) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModel<'a>> + '_
pub fn find( &'a self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModel<'a>> + '_
Find all hierarchies matching the given search. For more details see Search.
use pdbtbx::*;
let (pdb, errors) = open_pdb("example-pdbs/1ubq.pdb", StrictnessLevel::Loose).unwrap();
let selection = pdb.find(
Term::ChainId("A".to_owned())
& Term::ConformerName("GLY".to_owned())
& Term::AtomSerialNumber(750)
);
Find all hierarchies matching the given information
sourcepub fn find_mut(
&'a mut self,
search: Search
) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModelMut<'a>> + '_
pub fn find_mut( &'a mut self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModelMut<'a>> + '_
Find all hierarchies matching the given search. For more details see Search.
sourcepub fn models(&self) -> impl DoubleEndedIterator<Item = &Model> + '_
pub fn models(&self) -> impl DoubleEndedIterator<Item = &Model> + '_
Get an iterator of references to Models making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_models(&self) -> impl ParallelIterator<Item = &Model> + '_
Available on crate feature rayon
only.
pub fn par_models(&self) -> impl ParallelIterator<Item = &Model> + '_
rayon
only.Get a parallel iterator of references to Models making up this PDB.
sourcepub fn models_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Model> + '_
pub fn models_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Model> + '_
Get an iterator of mutable references to Models making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_models_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Model> + '_
Available on crate feature rayon
only.
pub fn par_models_mut( &mut self ) -> impl ParallelIterator<Item = &mut Model> + '_
rayon
only.Get a parallel iterator of mutable references to Models making up this PDB.
sourcepub fn chains(&self) -> impl DoubleEndedIterator<Item = &Chain> + '_
pub fn chains(&self) -> impl DoubleEndedIterator<Item = &Chain> + '_
Get an iterator of references to Chains making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_chains(&self) -> impl ParallelIterator<Item = &Chain> + '_
Available on crate feature rayon
only.
pub fn par_chains(&self) -> impl ParallelIterator<Item = &Chain> + '_
rayon
only.Get a parallel iterator of references to Chains making up this PDB.
sourcepub fn chains_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Chain> + '_
pub fn chains_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Chain> + '_
Get a iterator of mutable references to Chains making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_chains_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Chain> + '_
Available on crate feature rayon
only.
pub fn par_chains_mut( &mut self ) -> impl ParallelIterator<Item = &mut Chain> + '_
rayon
only.Get a parallel iterator of mutable references to Chains making up this PDB.
sourcepub fn residues(&self) -> impl DoubleEndedIterator<Item = &Residue> + '_
pub fn residues(&self) -> impl DoubleEndedIterator<Item = &Residue> + '_
Get an iterator of references to Residues making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_residues(&self) -> impl ParallelIterator<Item = &Residue> + '_
Available on crate feature rayon
only.
pub fn par_residues(&self) -> impl ParallelIterator<Item = &Residue> + '_
rayon
only.Get a parallel iterator of references to Residues making up this PDB.
sourcepub fn residues_mut(
&mut self
) -> impl DoubleEndedIterator<Item = &mut Residue> + '_
pub fn residues_mut( &mut self ) -> impl DoubleEndedIterator<Item = &mut Residue> + '_
Get an iterator of mutable references to Residues making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_residues_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Residue> + '_
Available on crate feature rayon
only.
pub fn par_residues_mut( &mut self ) -> impl ParallelIterator<Item = &mut Residue> + '_
rayon
only.Get a parallel iterator of mutable references to Residues making up this PDB.
sourcepub fn conformers(&self) -> impl DoubleEndedIterator<Item = &Conformer> + '_
pub fn conformers(&self) -> impl DoubleEndedIterator<Item = &Conformer> + '_
Get an iterator of references to Conformers making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_conformers(&self) -> impl ParallelIterator<Item = &Conformer> + '_
Available on crate feature rayon
only.
pub fn par_conformers(&self) -> impl ParallelIterator<Item = &Conformer> + '_
rayon
only.Get a parallel iterator of references to Conformers making up this PDB.
sourcepub fn conformers_mut(
&mut self
) -> impl DoubleEndedIterator<Item = &mut Conformer> + '_
pub fn conformers_mut( &mut self ) -> impl DoubleEndedIterator<Item = &mut Conformer> + '_
Get an iterator of mutable references to Conformers making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_conformers_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Conformer> + '_
Available on crate feature rayon
only.
pub fn par_conformers_mut( &mut self ) -> impl ParallelIterator<Item = &mut Conformer> + '_
rayon
only.Get a parallel iterator of mutable references to Conformers making up this PDB.
sourcepub fn atoms(&self) -> impl DoubleEndedIterator<Item = &Atom> + '_
pub fn atoms(&self) -> impl DoubleEndedIterator<Item = &Atom> + '_
Get an iterator of references to Atom making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_atoms(&self) -> impl ParallelIterator<Item = &Atom> + '_
Available on crate feature rayon
only.
pub fn par_atoms(&self) -> impl ParallelIterator<Item = &Atom> + '_
rayon
only.Get a parallel iterator of references to Atom making up this PDB.
sourcepub fn atoms_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Atom> + '_
pub fn atoms_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Atom> + '_
Get an iterator of mutable references to Atom making up this PDB. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_atoms_mut(&mut self) -> impl ParallelIterator<Item = &mut Atom> + '_
Available on crate feature rayon
only.
pub fn par_atoms_mut(&mut self) -> impl ParallelIterator<Item = &mut Atom> + '_
rayon
only.Get a parallel iterator of mutable references to Atom making up this PDB.
sourcepub fn atoms_with_hierarchy(
&'a self
) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModel<'a>> + '_
pub fn atoms_with_hierarchy( &'a self ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModel<'a>> + '_
Get an iterator of references to a struct containing all atoms with their hierarchy making up this PDB.
sourcepub fn atoms_with_hierarchy_mut(
&'a mut self
) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModelMut<'a>> + '_
pub fn atoms_with_hierarchy_mut( &'a mut self ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainModelMut<'a>> + '_
Get an iterator of mutable references to a struct containing all atoms with their hierarchy making up this PDB.
sourcepub fn remove_atoms_by<F>(&mut self, predicate: F)where
F: Fn(&Atom) -> bool,
pub fn remove_atoms_by<F>(&mut self, predicate: F)where F: Fn(&Atom) -> bool,
Remove all Atoms matching the given predicate. The predicate will be run on all Atoms. As this is done in place this is the fastest way to remove Atoms from this PDB.
sourcepub fn remove_conformers_by<F>(&mut self, predicate: F)where
F: Fn(&Conformer) -> bool,
pub fn remove_conformers_by<F>(&mut self, predicate: F)where F: Fn(&Conformer) -> bool,
Remove all Conformers matching the given predicate. The predicate will be run on all Conformers. As this is done in place this is the fastest way to remove Conformers from this PDB.
sourcepub fn remove_residues_by<F>(&mut self, predicate: F)where
F: Fn(&Residue) -> bool,
pub fn remove_residues_by<F>(&mut self, predicate: F)where F: Fn(&Residue) -> bool,
Remove all Residues matching the given predicate. The predicate will be run on all Residues. As this is done in place this is the fastest way to remove Residues from this PDB.
sourcepub fn remove_chains_by<F>(&mut self, predicate: F)where
F: Fn(&Chain) -> bool,
pub fn remove_chains_by<F>(&mut self, predicate: F)where F: Fn(&Chain) -> bool,
Remove all Residues matching the given predicate. The predicate will be run on all Residues. As this is done in place this is the fastest way to remove Residues from this PDB.
sourcepub fn remove_models_by<F>(&mut self, predicate: F)where
F: Fn(&Model) -> bool,
pub fn remove_models_by<F>(&mut self, predicate: F)where F: Fn(&Model) -> bool,
Remove all Chains matching the given predicate. The predicate will be run on all Chains. As this is done in place this is the fastest way to remove Chains from this PDB.
sourcepub fn remove_model(&mut self, index: usize)
pub fn remove_model(&mut self, index: usize)
Remove the Model specified.
Complexity
- Time: amortized O(n) where n is the number of models, best case O(1) if model is the last one.
- Memory: O(1)
Arguments
index
- the index of the Model to remove
Panics
Panics if the index is out of bounds.
sourcepub fn remove_models_except(&mut self, idxs: &[usize]) -> Option<usize>
pub fn remove_models_except(&mut self, idxs: &[usize]) -> Option<usize>
Remove all Models except for models specified by idxs.
Complexity
- Time: O(n) where n is the number of models.
- Memory: O(k) where k is the number of models to keep.
Arguments
idxs
- the indices of the Models to keep
Returns
None
if any of the indices are out of bounds.
Some(usize)
the number of models removed.
sourcepub fn remove_all_models_except_first(&mut self) -> Option<usize>
pub fn remove_all_models_except_first(&mut self) -> Option<usize>
Remove all Models except for the first one.
sourcepub fn remove_model_serial_number(&mut self, serial_number: usize) -> bool
pub fn remove_model_serial_number(&mut self, serial_number: usize) -> bool
Remove the Model specified. It returns true
if it found a matching Model and removed it.
It removes the first matching Model from the list.
Arguments
serial_number
- the serial number of the Model to remove
sourcepub fn par_remove_model_serial_number(&mut self, serial_number: usize) -> bool
Available on crate feature rayon
only.
pub fn par_remove_model_serial_number(&mut self, serial_number: usize) -> bool
rayon
only.Remove the Model specified. It returns true
if it found a matching Model and removed it.
It removes the first matching Model from the list.
Done in parallel.
Arguments
serial_number
- the serial number of the Model to remove
sourcepub fn remove_empty(&mut self)
pub fn remove_empty(&mut self)
Remove all empty Models from this PDB, and all empty Chains from the Model, and all empty Residues from the Chains.
sourcepub fn par_remove_empty(&mut self)
Available on crate feature rayon
only.
pub fn par_remove_empty(&mut self)
rayon
only.Remove all empty Models from this PDB, and all empty Chains from the Model, and all empty Residues from the Chains. Done in parallel.
sourcepub fn renumber(&mut self)
pub fn renumber(&mut self)
This renumbers all numbered structs in the PDB.
So it renumbers models, atoms, residues, chains and MtriX
s.
sourcepub fn apply_transformation(&mut self, transformation: &TransformationMatrix)
pub fn apply_transformation(&mut self, transformation: &TransformationMatrix)
Apply a transformation to the position of all atoms making up this PDB, the new position is immediately set.
sourcepub fn par_apply_transformation(
&mut self,
transformation: &TransformationMatrix
)
Available on crate feature rayon
only.
pub fn par_apply_transformation( &mut self, transformation: &TransformationMatrix )
rayon
only.Apply a transformation to the position of all atoms making up this PDB, the new position is immediately set. Done in parallel.
sourcepub fn join(&mut self, other: PDB)
pub fn join(&mut self, other: PDB)
Joins two PDBs. If one has multiple models it extends the models of this PDB with the models of the other PDB. If this PDB does not have any models it moves the models of the other PDB to this PDB. If both have one model it moves all chains/residues/atoms from the model of the other PDB to the model of this PDB. Effectively the same as calling join on those models.
sourcepub fn par_sort(&mut self)
Available on crate feature rayon
only.
pub fn par_sort(&mut self)
rayon
only.Sort the Models of this PDB in parallel.
sourcepub fn par_full_sort(&mut self)
Available on crate feature rayon
only.
pub fn par_full_sort(&mut self)
rayon
only.Sort all structs in this PDB in parallel.
sourcepub fn create_atom_rtree(&self) -> RTree<&Atom>
Available on crate feature rstar
only.
pub fn create_atom_rtree(&self) -> RTree<&Atom>
rstar
only.Create an R star tree of Atoms which can be used for fast lookup of spatially close atoms. See the crate rstar for documentation on how to use the tree. (https://crates.io/crates/rstar)
Keep in mind that this creates a tree that is separate from the original PDB, so any changes to one of the data structures is not seen in the other data structure (until you generate a new tree of course).
sourcepub fn create_hierarchy_rtree(
&'a self
) -> RTree<AtomConformerResidueChainModel<'a>>
Available on crate feature rstar
only.
pub fn create_hierarchy_rtree( &'a self ) -> RTree<AtomConformerResidueChainModel<'a>>
rstar
only.Create an R star tree of structs containing Atoms and their hierarchies which can be used for fast lookup of spatial close atoms. See the crate rstar for documentation on how to use the tree. (https://crates.io/crates/rstar)
Keep in mind that this creates a tree that is separate from the original PDB, so any changes to one of the data structures is not seen in the other data structure (until you generate a new tree of course).
sourcepub fn bounding_box(&self) -> ((f64, f64, f64), (f64, f64, f64))
pub fn bounding_box(&self) -> ((f64, f64, f64), (f64, f64, f64))
Finds the square bounding box around the PDB. The first tuple is the bottom left point, lowest value for all dimensions for all points. The second tuple is the top right point, the highest value for all dimensions for all points.
sourcepub fn bonds(
&self
) -> impl DoubleEndedIterator<Item = (&Atom, &Atom, Bond)> + '_
pub fn bonds( &self ) -> impl DoubleEndedIterator<Item = (&Atom, &Atom, Bond)> + '_
Get the bonds in this PDB file. Runtime is O(bonds_count * 2 * atom_count)
because it
has to iterate over all atoms to prevent borrowing problems.
sourcepub fn add_bond(
&mut self,
atom1: (usize, Option<&str>),
atom2: (usize, Option<&str>),
bond: Bond
) -> Option<()>
pub fn add_bond( &mut self, atom1: (usize, Option<&str>), atom2: (usize, Option<&str>), bond: Bond ) -> Option<()>
Add a bond of the given type to the list of bonds in this PDB.
The atoms are selected by serial number and alternative location.
It uses binary_find_atom
in the background so the PDB should be sorted.
If one of the atoms could not be found it returns None
otherwise it
will return Some(())
.
Trait Implementations§
source§impl<'de> Deserialize<'de> for PDB
impl<'de> Deserialize<'de> for PDB
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Extend<Model> for PDB
impl Extend<Model> for PDB
source§fn extend<T: IntoIterator<Item = Model>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Model>>(&mut self, iter: T)
Extend the Models on this PDB by the given iterator of Models.
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)