douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.
https://crates.io/crates/pdbtbx
MIT License
49 stars 12 forks source link

Support atom bonds #80

Open douweschulte opened 2 years ago

douweschulte commented 2 years ago

Bonds are currently partly supported, only disulfide bonds are read from PDBs. The main issue is in the implementation design. Currently the bonds are saved as a list of bond type and the serial numbers of the atoms involved on the PDB struct. This removes any possibility to trace the bound state from an individual atom. The implementation is open for discussion.

Best case from a user perspective

Implementation idea: the bonds function on atoms could use a reference to the PDB to get the reference to the other atoms.

douweschulte commented 2 years ago

If a bonds method on an atom takes a PDB by reference it has to go through all bonds listed in the PDB and for the ones matching the current atom find the atom reference using binary_find_atom. This would leave a n * a log a runtime (n = number of bonds matching the atom, a = total number of atoms) which should be reasonable for the current goals.