Skip to content

Commit

Permalink
don't unwrap list comprehension at all
Browse files Browse the repository at this point in the history
  • Loading branch information
j-wags committed Oct 8, 2024
1 parent b1c054e commit 5388d6e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/gmxio.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,19 +971,19 @@ def evaluate_(self, force=False, dipole=False, traj=None):
## Calculate and record force
if force:
self.callgmx("g_traj -xvg no -s %s.tpr -f %s.trr -of %s-f.xvg -fp" % (self.name, self.name, self.name), stdin='System')
val = []
for line in open("%s-f.xvg" % self.name).readlines():
val2 = []
for i, j in enumerate(line.split()[1:]):
if self.AtomMask[int(i / 3)]:
val2.append(float(j))
val.append(val2)
Result["Force"] = np.array(val)
#val = []
#for line in open("%s-f.xvg" % self.name).readlines():
# val2 = []
# for i, j in enumerate(line.split()[1:]):
# if self.AtomMask[int(i / 3)]:
# val2.append(float(j))
# val.append(val2)
#Result["Force"] = np.array(val)
#import ipdb; ipdb.set_trace()


#Result["Force"] = np.array([[float(j) for i, j in enumerate(line.split()[1:]) if self.AtomMask[int(i/3)]] \
# for line in open("%s-f.xvg" % self.name).readlines()])
Result["Force"] = np.array([[float(j) for i, j in enumerate(line.split()[1:]) if self.AtomMask[int(i/3)]] \
for line in open("%s-f.xvg" % self.name).readlines()])
## Calculate and record dipole
if dipole:
self.callgmx("g_dipoles -s %s.tpr -f %s -o %s-d.xvg -xvg no" % (self.name, traj if traj else '%s.gro' % self.name, self.name), stdin="System\n")
Expand Down

0 comments on commit 5388d6e

Please sign in to comment.