forked from lijiext/lammps
some more whitespace cleanup
This commit is contained in:
parent
fd63b08f99
commit
28b634f20d
|
@ -15,16 +15,16 @@ for i in range(ntemps):
|
||||||
logfn = '%s.%d' % (logfnprefix, i)
|
logfn = '%s.%d' % (logfnprefix, i)
|
||||||
with open(logfn, 'r') as of:
|
with open(logfn, 'r') as of:
|
||||||
lines = of.readlines()
|
lines = of.readlines()
|
||||||
|
|
||||||
# extract relevant lines from logfile
|
# extract relevant lines from logfile
|
||||||
start = [lines.index(line) for line in lines if line.startswith(start_token)][0]
|
start = [lines.index(line) for line in lines if line.startswith(start_token)][0]
|
||||||
lines = lines[(start+1) : ]
|
lines = lines[(start+1) : ]
|
||||||
stop = [lines.index(line) for line in lines if line.startswith(end_token)][0]
|
stop = [lines.index(line) for line in lines if line.startswith(end_token)][0]
|
||||||
lines = lines[:stop]
|
lines = lines[:stop]
|
||||||
|
|
||||||
# store the potential energies
|
# store the potential energies
|
||||||
pe = [float(line.strip().split()[-1]) for line in lines]
|
pe = [float(line.strip().split()[-1]) for line in lines]
|
||||||
u_kn.append(pe)
|
u_kn.append(pe)
|
||||||
|
|
||||||
u_kn = np.array(u_kn)
|
u_kn = np.array(u_kn)
|
||||||
np.savetxt('ene.peptide', u_kn, fmt = '%5.5f')
|
np.savetxt('ene.peptide', u_kn, fmt = '%5.5f')
|
||||||
|
|
|
@ -351,7 +351,7 @@ def get_canonical_logw(enefn, frametuple_dict, temps, nprod, writefreq,
|
||||||
u_kln = np.zeros([ntemps, ntemps, nframes], float)
|
u_kln = np.zeros([ntemps, ntemps, nframes], float)
|
||||||
for k in range(ntemps):
|
for k in range(ntemps):
|
||||||
u_kln[k] = np.outer(beta_k, u_kn[k])
|
u_kln[k] = np.outer(beta_k, u_kn[k])
|
||||||
|
|
||||||
# run pymbar and extract the free energies
|
# run pymbar and extract the free energies
|
||||||
print("\nRunning pymbar...")
|
print("\nRunning pymbar...")
|
||||||
mbar = pymbar.mbar.MBAR(u_kln, nframes_k, verbose = True)
|
mbar = pymbar.mbar.MBAR(u_kln, nframes_k, verbose = True)
|
||||||
|
@ -368,7 +368,7 @@ def get_canonical_logw(enefn, frametuple_dict, temps, nprod, writefreq,
|
||||||
denom = f_k - beta_k[k] * u_kn[k,n]
|
denom = f_k - beta_k[k] * u_kn[k,n]
|
||||||
for l in range(ntemps):
|
for l in range(ntemps):
|
||||||
logw[l][k,n] = num - logsumexp(denom) - log_nframes
|
logw[l][k,n] = num - logsumexp(denom) - log_nframes
|
||||||
|
|
||||||
return logw
|
return logw
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# open all replica files for reading
|
# open all replica files for reading
|
||||||
infobjs = [readwrite(i, "rb") for i in intrajfns]
|
infobjs = [readwrite(i, "rb") for i in intrajfns]
|
||||||
|
|
||||||
# open all byteindex files
|
# open all byteindex files
|
||||||
byte_inds = dict( (i, np.loadtxt(fn)) for i, fn in enumerate(byteindfns) )
|
byte_inds = dict( (i, np.loadtxt(fn)) for i, fn in enumerate(byteindfns) )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue