From 5ed21ecba39241ed985b9a0656495dac9d15d08e Mon Sep 17 00:00:00 2001 From: Rick Sexton Date: Wed, 14 Feb 2024 16:13:51 -0700 Subject: [PATCH] modified contacts to check error --- basicrta/contacts.py | 4 ++-- basicrta/weighted_density.py | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/basicrta/contacts.py b/basicrta/contacts.py index e2151c8..1e53332 100755 --- a/basicrta/contacts.py +++ b/basicrta/contacts.py @@ -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() diff --git a/basicrta/weighted_density.py b/basicrta/weighted_density.py index 18301a7..56f7b03 100644 --- a/basicrta/weighted_density.py +++ b/basicrta/weighted_density.py @@ -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):