Skip to content

Commit

Permalink
Multiple Fixes
Browse files Browse the repository at this point in the history
  1. Bug in rmax and rmin property setter fixed
  2. Skeleton of protein bonlists are maintained when selecting bondlist
     with rmax cutoff.
  • Loading branch information
nixnmtm committed Nov 25, 2019
1 parent 55b7691 commit 7abc2ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/fluctmatch/commands/cmd_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ def cli(
return

kwargs = dict()
kwargs.update(dict(rmin=rmin, rmax=rmax,))

universe = modeller(topology, trajectory, com=com, model=model, **kwargs)

kwargs.update(
dict(
outdir=outdir,
prefix=prefix,
rmin=rmin,
rmax=rmax,
charmm_version=charmm_version,
extended=extended,
resid=not resid,
Expand Down
11 changes: 7 additions & 4 deletions src/fluctmatch/models/enm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class Enm(ModelBase):
describe = "Elastic network model"

def __init__(self, *args, **kwargs):
self._rmin = kwargs.pop("rmin", 0.)
self._rmax = kwargs.pop("rmax", 10.)
super().__init__(*args, **kwargs)
self._rmin = kwargs.get("rmin", 0.)
self._rmax = kwargs.get("rmax", 10.)
self._initialize(*args, **kwargs)

def __repr__(self):
Expand Down Expand Up @@ -91,8 +91,11 @@ def _add_bonds(self):
(distmat <= self._rmax))
else:
a0, a1 = np.where((distmat > self._rmin) & (distmat <= self._rmax))
bonds = topologyattrs.Bonds(
set([(x, y) for x, y in zip(a0, a1) if y > x]))
# backbone skeleton must be maintained.
skeleton_bonds = set([(skeleton[0].ix, skeleton[1].ix) for skeleton in self.atu.bonds])
rmax_bonds = set([(x, y) for x, y in zip(a0, a1) if y > x])
all_bonds = skeleton_bonds.union(rmax_bonds)
bonds = topologyattrs.Bonds(all_bonds)
self._topology.add_TopologyAttr(bonds)
self._generate_from_topology()

Expand Down

0 comments on commit 7abc2ed

Please sign in to comment.