wham2d now uses minimal dimensios for wham exec
This commit is contained in:
@@ -3,4 +3,4 @@ from .runner import UmbrellaRunner
|
|||||||
from .wham2d import WHAM2DRunner
|
from .wham2d import WHAM2DRunner
|
||||||
|
|
||||||
__all__ = ['AdaptiveUmbrella']
|
__all__ = ['AdaptiveUmbrella']
|
||||||
__version__ = "0.3.1"
|
__version__ = "0.3.2"
|
||||||
|
|||||||
@@ -194,13 +194,14 @@ class UmbrellaRunner():
|
|||||||
print("Running simulations")
|
print("Running simulations")
|
||||||
self.simulate_frames(lambdas, new_frames)
|
self.simulate_frames(lambdas, new_frames)
|
||||||
|
|
||||||
print("Calculating new PMF")
|
|
||||||
self.pmf = self.calculate_new_pmf()
|
|
||||||
|
|
||||||
# update list of sampled windows
|
# update list of sampled windows
|
||||||
for new_frame in new_frames.keys():
|
for new_frame in new_frames.keys():
|
||||||
self.sample_list[new_frame] = self.num_iterations
|
self.sample_list[new_frame] = self.num_iterations
|
||||||
|
|
||||||
|
|
||||||
|
print("Calculating new PMF")
|
||||||
|
self.pmf = self.calculate_new_pmf()
|
||||||
|
|
||||||
self.after_run_hook()
|
self.after_run_hook()
|
||||||
|
|
||||||
if(self.max_iterations > 0 and self.num_iterations == self.max_iterations):
|
if(self.max_iterations > 0 and self.num_iterations == self.max_iterations):
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ class WHAM2DRunner(UmbrellaRunner):
|
|||||||
path = os.path.join(self.tmp_folder, "{}_metadata.dat".format(self.num_iterations))
|
path = os.path.join(self.tmp_folder, "{}_metadata.dat".format(self.num_iterations))
|
||||||
with open(path, 'w') as out:
|
with open(path, 'w') as out:
|
||||||
for file in os.listdir(self.simulation_folder):
|
for file in os.listdir(self.simulation_folder):
|
||||||
if not os.path.exists(os.path.join(path, file, "COLVAR")):
|
filepath = os.path.join(self.simulation_folder, file, "COLVAR")
|
||||||
|
if not os.path.exists(filepath):
|
||||||
|
print("Not found: {}".format(filepath))
|
||||||
continue
|
continue
|
||||||
prefix, x, y = file.split("_")
|
prefix, x, y = file.split("_")
|
||||||
colvar_file = os.path.join(file, 'COLVAR')
|
colvar_file = os.path.join(file, 'COLVAR')
|
||||||
@@ -47,18 +49,38 @@ class WHAM2DRunner(UmbrellaRunner):
|
|||||||
""" Output file for wham-2d """
|
""" Output file for wham-2d """
|
||||||
return os.path.join(self.tmp_folder, 'freeenergy_tmp.dat')
|
return os.path.join(self.tmp_folder, 'freeenergy_tmp.dat')
|
||||||
|
|
||||||
|
def get_wham_borders(self):
|
||||||
|
""" we need to find dimensions for wham-2d calculations
|
||||||
|
that are as small as possible but contain all sampled frames. """
|
||||||
|
nonzero = np.nonzero(self.sample_list)
|
||||||
|
borders = np.array(
|
||||||
|
self._get_lambdas_for_index((nonzero[0].min(), nonzero[1].min())),
|
||||||
|
self._get_lambdas_for_index((nonzero[0].max(), nonzero[1].max())))
|
||||||
|
|
||||||
|
borders = borders.flatten()
|
||||||
|
|
||||||
|
# increase borders by 1 lambda step from minimal dimensions
|
||||||
|
borders[0] -= self.cvs[0][2]
|
||||||
|
borders[1] -= self.cvs[1][2]
|
||||||
|
borders[2] += self.cvs[0][2]
|
||||||
|
borders[3] += self.cvs[1][2]
|
||||||
|
return flat
|
||||||
|
|
||||||
|
|
||||||
def run_wham2d(self, metafile_path, output_path):
|
def run_wham2d(self, metafile_path, output_path):
|
||||||
""" Runs wham-2d with the given parameters. See http://membrane.urmc.rochester.edu/sites/default/files/wham/doc.html """
|
""" Runs wham-2d with the given parameters. See http://membrane.urmc.rochester.edu/sites/default/files/wham/doc.html """
|
||||||
|
|
||||||
|
|
||||||
|
borders = self.get_wham_borders()
|
||||||
cmd = "{exec} Px={px} {min_x} {max_x} {frames_x} Py={py} {min_y} {max_y} {frames_y} {tol} 298 0 {metafile} {outfile} 0".format(
|
cmd = "{exec} Px={px} {min_x} {max_x} {frames_x} Py={py} {min_y} {max_y} {frames_y} {tol} 298 0 {metafile} {outfile} 0".format(
|
||||||
exec=self.WHAM_EXEC,
|
exec=self.WHAM_EXEC,
|
||||||
px=self.whamconfig['Px'],
|
px=self.whamconfig['Px'],
|
||||||
min_x=self.whamconfig['hist_min_x'],
|
min_x=borders[0],
|
||||||
max_x=self.whamconfig['hist_max_x'],
|
max_x=borders[2],
|
||||||
frames_x=self.whamconfig['num_bins_x'],
|
frames_x=self.whamconfig['num_bins_x'],
|
||||||
py=self.whamconfig['Py'],
|
py=self.whamconfig['Py'],
|
||||||
min_y=self.whamconfig['hist_min_y'],
|
min_y=borders[1],
|
||||||
max_y=self.whamconfig['hist_max_y'],
|
max_y=borders[3],
|
||||||
frames_y=self.whamconfig['num_bins_y'],
|
frames_y=self.whamconfig['num_bins_y'],
|
||||||
tol=self.whamconfig['tolerance'],
|
tol=self.whamconfig['tolerance'],
|
||||||
metafile=metafile_path,
|
metafile=metafile_path,
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ sed -i -e "s/LAMBDA1/${lambda1}/g" $FOLDER/plumed.dat
|
|||||||
sed -i -e "s/LAMBDA2/${lambda2}/g" $FOLDER/plumed.dat
|
sed -i -e "s/LAMBDA2/${lambda2}/g" $FOLDER/plumed.dat
|
||||||
|
|
||||||
cd $FOLDER
|
cd $FOLDER
|
||||||
source /usr/local/gromacs/bin/GMXRC
|
#source /usr/local/gromacs/bin/GMXRC
|
||||||
gmx --quiet mdrun -deffnm topol -plumed plumed.dat -nsteps 250000 2>&1
|
source /opt/gromacs-2018/bin/GMXRC
|
||||||
|
gmx --quiet mdrun -deffnm topol -plumed plumed.dat -nsteps 100000 2>&1
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,6 @@ runner.cvs_init = (0, 0)
|
|||||||
runner.E_min = 5
|
runner.E_min = 5
|
||||||
runner.E_max = 100
|
runner.E_max = 100
|
||||||
runner.E_incr = 10
|
runner.E_incr = 10
|
||||||
runner.max_iterations = 5
|
runner.max_iterations = 1
|
||||||
|
|
||||||
runner.run()
|
runner.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user