Open gongshuai0606 opened 1 year ago
Hey,
does the issue still exists? I might be able to help if you provide a bit more details: Can you show your implementation at what software you are using for wham
?
Hey, does the issue still exists? I might be able to help if you provide a bit more details: Can you show your implementation at what software you are using for
wham
?
Thanks for your reply. I installed wham-2d according to the link "http://membrane.urmc.rochester.edu/sites/default/files/wham/doc.html" in line 69 of adaptiveumbrella/adaptiveumbrella/wham2d.py
cd wham-2d`
make clean
make
then run the example.py
import os
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
import sys
from adaptiveumbrella.wham2d import WHAM2DRunner
sys.path.append('..')
class MyUmbrellaRunner(WHAM2DRunner):
def __init__(self):
WHAM2DRunner.__init__(self)
cum_frames = [0]
def after_run_hook(self):
filename = "tmp/pmf_{}.pdf".format("%02d" % self.num_iterations)
print("Writing new pmf to {}".format(filename))
pmf_to_plot = deepcopy(self.pmf)
pmf_to_plot[pmf_to_plot < 0] = None
pmf_to_plot[self.sample_list == 0] = None
pmf_to_plot = pmf_to_plot.T
self.cum_frames.append(len(self.sample_list[self.sample_list > 0]))
fig, (ax0, ax1) = plt.subplots(ncols=2)
im = ax0.imshow(pmf_to_plot, origin='lower', cmap='jet')
cb = fig.colorbar(im, ax=ax0, orientation='horizontal', pad=0.15)
cb.set_label("kJ/mol")
ax1.plot(self.cum_frames, linewidth=0.5, marker="o", color='black')
ax1.set_xlabel("Cycles")
ax1.set_ylabel("Number of umbrella Windows")
# ticks = [(x,x) for x in [-3, -2, -1, 0, 1, 2, 3]]
# tick_positions = [ self._get_index_for_lambdas(x)[0] for x in ticks ]
# tick_labels = [ str(x[0]) for x in ticks ]
# ax0.set_yticks(tick_positions)
# ax0.set_yticklabels(tick_labels)
# ax0.set_xticks(tick_positions)
# ax0.set_xticklabels(tick_labels)
ax0.set_ylabel("$\phi$")
ax0.set_xlabel("$\psi$")
fig.subplots_adjust(wspace=.5)
plt.savefig(filename, bbox_inches='tight', dpi=200)
os.system("cp {} {}".format(filename, "tmp/pmf_current.pdf"))
def simulate_frames(self, lambdas, frames):
print("{} new simulations:".format(len(lambdas)))
counter = 0
if not os.path.exists("tmp"):
os.mkdir('tmp')
threads = []
for f in lambdas:
counter += 1
print("{}) Simulate lambda1={}, lambda2={}".format(counter, *f))
command = "bash data/sim.sh {} {} 2>&1 > tmp/run.log".format(*f)
# print("Running {}".format(command))
os.system(command)
runner = MyUmbrellaRunner()
runner.WHAM_EXEC = "/home/user/Documents/gs/wham/wham-2d/wham-2d"
runner.whamconfig = {
'Px': 'pi',
'hist_min_x': -3,
'hist_max_x': 3,
'num_bins_x': 100,
'Py': 'pi',
'hist_min_y': -3,
'hist_max_y': 3,
'num_bins_y': 100,
'tolerance': 0.1,
'fc_x': 100,
'fc_y': 100,
'temperature': None,
'mask': None
}
runner.cvs = np.array([
(-3, 3, 0.2),
(-3, 3, 0.2),
])
runner.cvs_init = (0, 0)
runner.E_min = 5
runner.E_max = 100
runner.E_incr = 10
runner.max_iterations = 1
runner.run()
It returned the error:
/home/user/anaconda3/envs/pytorch1.10/bin/python /home/user/Documents/gs/adaptiveumbrella/examples/example.py
np.shape(windows) (30,)
np.shape(windows) (30,)
~~~~~~~~~~~~~~~ Iteration 1/1 ~~~~~~~~~~~~~~~~
Energy: 5
Running simulations
9 new simulations:
1) Simulate lambda1=-0.2, lambda2=-0.2
2) Simulate lambda1=-0.2, lambda2=0.0
3) Simulate lambda1=-0.2, lambda2=0.2
4) Simulate lambda1=0.0, lambda2=-0.2
5) Simulate lambda1=0.0, lambda2=0.0
6) Simulate lambda1=0.0, lambda2=0.2
7) Simulate lambda1=0.2, lambda2=-0.2
8) Simulate lambda1=0.2, lambda2=0.0
9) Simulate lambda1=0.2, lambda2=0.2
Calculating new PMF
wham exited with error code 2
Process finished with exit code 1
the simulation is performed by gromacs-2018.8
One thing you could try is setting runner.verbose=True
. This will print the generated wham-2d
command before executing it. This way you can try to run the command manually and see if the error is related to Wham or to this python library.
Unfortunately I do not know what error code 2 means.
Hope this helps!
10 Jun 2023 14:49:38 gongshuai0606 @.***>:
Hey, does the issue still exists? I might be able to help if you provide a bit more details: Can you show your implementation at what software you are using for wham?
Thanks for your reply. I installed wham-2d according to the link "http://membrane.urmc.rochester.edu/sites/default/files/wham/doc.html" in line 69 of adaptiveumbrella/adaptiveumbrella/wham2d.py cd wham-2d make clean make
then run the example.py `#!/usr/bin/env python3 import os from copy import deepcopy
import matplotlib.pyplot as plt import numpy as np
import sys
from adaptiveumbrella.wham2d import WHAM2DRunner
sys.path.append('..')
class MyUmbrellaRunner(WHAM2DRunner):
*def init(self): WHAM2DRunner.init(self)
cum_frames = [0]
def after_runhook(self): filename = "tmp/pmf{}.pdf".format("%02d" % self.num_iterations) print("Writing new pmf to {}".format(filename)) pmf_to_plot = deepcopy(self.pmf) pmf_to_plot[pmf_to_plot < 0] = None pmf_to_plot[self.sample_list == 0] = None pmf_to_plot = pmf_to_plot.T
self.cum_frames.append(len(self.sample_list[self.sample_list > 0])) fig, (ax0, ax1) = plt.subplots(ncols=2) im = ax0.imshow(pmf_to_plot, origin='lower', cmap='jet') cb = fig.colorbar(im, ax=ax0, orientation='horizontal', pad=0.15) cb.set_label("kJ/mol") ax1.plot(self.cum_frames, linewidth=0.5, marker="o", color='black') ax1.set_xlabel("Cycles") ax1.set_ylabel("Number of umbrella Windows") # ticks = [(x,x) for x in [-3, -2, -1, 0, 1, 2, 3]] # tick_positions = [ self._get_index_for_lambdas(x)[0] for x in ticks ] # tick_labels = [ str(x[0]) for x in ticks ] # ax0.set_yticks(tick_positions) # ax0.set_yticklabels(tick_labels) # ax0.set_xticks(tick_positions) # ax0.set_xticklabels(tick_labels) ax0.set_ylabel("$\phi$") ax0.set_xlabel("$\psi$") fig.subplots_adjust(wspace=.5) plt.savefig(filename, bbox_inches='tight', dpi=200) os.system("cp {} {}".format(filename, "tmp/pmf_current.pdf"))
def simulate_frames(self, lambdas, frames): print("{} new simulations:".format(len(lambdas))) counter = 0
if not os.path.exists("tmp"): os.mkdir('tmp') threads = [] for f in lambdas: counter += 1 print("{}) Simulate lambda1={}, lambda2={}".format(counter, *f)) command = "bash data/sim.sh {} {} 2>&1 > tmp/run.log".format(*f) # print("Running {}".format(command)) os.system(command)
* runner = MyUmbrellaRunner() runner.WHAM_EXEC = "/home/user/Documents/gs/wham/wham-2d/wham-2d" runner.whamconfig = { 'Px': 'pi', 'hist_min_x': -3, 'hist_max_x': 3, 'num_bins_x': 100, 'Py': 'pi', 'hist_min_y': -3, 'hist_max_y': 3, 'num_bins_y': 100, 'tolerance': 0.1, 'fc_x': 100, 'fc_y': 100, 'temperature': None, 'mask': None }
runner.cvs = np.array([ (-3, 3, 0.2), (-3, 3, 0.2), ]) runner.cvs_init = (0, 0) runner.E_min = 5 runner.E_max = 100 runner.E_incr = 10 runner.max_iterations = 1
runner.run()`
It returned the error: `/home/user/anaconda3/envs/pytorch1.10/bin/python /home/user/Documents/gs/adaptiveumbrella/examples/example.py np.shape(windows) (30,) np.shape(windows) (30,)
*Energy: 5 Running simulations 9 new simulations: 1) Simulate lambda1=-0.2, lambda2=-0.2 2) Simulate lambda1=-0.2, lambda2=0.0 3) Simulate lambda1=-0.2, lambda2=0.2 4) Simulate lambda1=0.0, lambda2=-0.2 5) Simulate lambda1=0.0, lambda2=0.0 6) Simulate lambda1=0.0, lambda2=0.2 7) Simulate lambda1=0.2, lambda2=-0.2 8) Simulate lambda1=0.2, lambda2=0.0 9) Simulate lambda1=0.2, lambda2=0.2 Calculating new PMF wham exited with error code 2
Process finished with exit code 1`
the simulation is performed by gromacs-2018.8 * — Reply to this email directly, view it on GitHub[https://github.com/dnlbauer/adaptiveumbrella/issues/2#issuecomment-1585652126], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABDZB4TKPAGYHAHNQIOUIV3XKRUNVANCNFSM6AAAAAAYUCKFPA]. You are receiving this because you commented.[Tracking image][https://github.com/notifications/beacon/ABDZB4WS5ORGF34GYEU3XIDXKRUNVA5CNFSM6AAAAAAYUCKFPCWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS6QMQZ4.gif]
Hi, thanks for the good implementation. However, when I run the example.py, I encountered the error: "wham exited with error code 2"