Skip to content

Commit

Permalink
modified contacts to check error
Browse files Browse the repository at this point in the history
  • Loading branch information
rsexton2 committed Feb 14, 2024
1 parent 6b078d1 commit 5ed21ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions basicrta/contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ def run(self):
pool.terminate()
pool.close()

bounds = np.concatenate([[0], np.cumsum(lens)])
bounds = np.concatenate([[0], np.cumsum(lens)]).astype(int)
mapsize = sum(lens)
contact_map = np.memmap(f'.tmpmap', mode='w+',
shape=(mapsize, 4), dtype=dtype)

for i in range(self.nproc):
for i in range(len(lresids)):
contact_map[bounds[i]:bounds[i+1]] = np.load(f'.contacts_{i:04}.'
f'npy')
contact_map.flush()
Expand Down
16 changes: 7 additions & 9 deletions basicrta/weighted_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,18 @@ def _create_traj(self):
tmp = np.load(self.dataname)
wf, wl, wi = tmp[:, 0].astype(int), tmp[:, 1].astype(int), tmp[:, 2:]

if self.N is not None:
sortinds = [wi[:, i].argsort()[::-1][:self.N] for i in
range(self.gibbs.processed_results.ncomp)]
else:
sortinds = None
# if self.N is not None:
# sortinds = [wi[:, i].argsort()[::-1][:self.N] for i in
# range(self.gibbs.processed_results.ncomp)]
# else:
# sortinds = None

if not os.path.exists(self.trajname):
with mda.Writer(self.trajname, len(write_ag.atoms)) as W:
for i, ts in tqdm(enumerate(self.u.trajectory[wf[sortinds]]),
for i, ts in tqdm(enumerate(self.u.trajectory[wf]),
total=self.N, desc='writing trajectory'):
W.write(self.ag1.atoms +
self.ag2.residues[wl[sortinds][i]].atoms)
else:

self.ag2.residues[wl[i]].atoms)


def compute_weighted_densities(self):
Expand Down

0 comments on commit 5ed21ec

Please sign in to comment.