Skip to content

Commit

Permalink
guess and filebonds options for Molecule.get
Browse files Browse the repository at this point in the history
  • Loading branch information
stefdoerr committed Sep 25, 2024
1 parent 1a2aa4f commit c2ff4dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions moleculekit/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def remove(self, selection, _logger=True):
)
return sel

def get(self, field, sel=None):
def get(self, field, sel=None, fileBonds=True, guessBonds=True):
"""Retrieve a specific PDB field based on the selection
Parameters
Expand All @@ -633,6 +633,10 @@ def get(self, field, sel=None):
sel : str
Atom selection string for which atoms we want to get the field from. Default all.
See more `here <http://www.ks.uiuc.edu/Research/vmd/vmd-1.9.2/ug/node89.html>`__
fileBonds : bool
If True will use bonds read from files.
guessBonds : bool
If True will use guessed bonds. Both fileBonds and guessBonds can be combined.
Returns
-------
Expand All @@ -651,7 +655,7 @@ def get(self, field, sel=None):
"""
if field != "index" and field not in self._atom_and_coord_fields:
raise RuntimeError(f"Invalid field '{field}'")
s = self.atomselect(sel)
s = self.atomselect(sel, fileBonds=fileBonds, guessBonds=guessBonds)
if field == "coords":
cc = np.squeeze(self.coords[s, :, self.frame])
if cc.ndim == 1:
Expand Down

0 comments on commit c2ff4dc

Please sign in to comment.