-
Notifications
You must be signed in to change notification settings - Fork 2
Description
I'm running a 2D Metadynamics simulation using OpenMM and CVPack (0.12.2) with two collective variables:
-
The z-coordinate of the center of mass of a small molecule
-
The radius of gyration of the same molecule
The system consists of a small molecule and a lipid bilayer. I’m running multiple walkers in parallel using the Metadynamics class from openmm.app. All of the walkers are started from the same system. Some of the walkers fail with the following error:
We instead now recommend building your command line and invoking it directly
with the subprocess module.
warnings.warn(
Traceback (most recent call last):
File "/mnt/forli/group/abarkdull/Ligand_Bilayer_MD/production/metadynamics.py", line 115, in <module>
main()
File "/mnt/forli/group/abarkdull/Ligand_Bilayer_MD/production/metadynamics.py", line 96, in main
md_sim.run2D(
File "/gpfs/home/abarkdull/micromamba/envs/autopath/lib/python3.11/site-packages/autopath/metadynamics.py", line 541, in run2D
meta.step(simulation, self.record_CV)
File "/gpfs/home/abarkdull/micromamba/envs/autopath/lib/python3.11/site-packages/openmm/app/metadynamics.py", line 179, in step
self._syncWithDisk()
File "/gpfs/home/abarkdull/micromamba/envs/autopath/lib/python3.11/site-packages/openmm/app/metadynamics.py", line 255, in _syncWithDisk
data = np.load(os.path.join(self.biasDir, filename))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs/home/abarkdull/micromamba/envs/autopath/lib/python3.11/site-packages/numpy/lib/npyio.py", line 456, in load
return format.read_array(fid, allow_pickle=allow_pickle,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/gpfs/home/abarkdull/micromamba/envs/autopath/lib/python3.11/site-packages/numpy/lib/format.py", line 839, in read_array
array.shape = shape
^^^^^^^^^^^
ValueError: cannot reshape array of size 8176 into shape (250,249)
I am using OpenMM version: 8.2
NumPy version: 1.26.4
This issue only occurs intermittently across walkers — some walkers complete successfully while others crash with the error above.
Below is the relevant function used to set up the CVs:
groups = [self.ligand_atoms]
COM_Z = cvpack.CentroidFunction(
f"z1",
openmmunit.nanometers,
groups,
weighByMass=False,
pbc=True,
)
grid_width_A = hill_width_A / 5
grid_min_A, grid_max_A = grid_dimensions_A
grid_A = int(abs(grid_min_A - grid_max_A) / grid_width_A)
com_cv = BiasVariable(
COM_Z,
minValue=grid_min_A,
maxValue=grid_max_A,
biasWidth=hill_width_A,
periodic=False,
gridWidth=grid_A,
)
grid_width_B = hill_width_B / 5
grid_min_B, grid_max_B = grid_dimensions_B
grid_B = int(abs(grid_min_B - grid_max_B) / grid_width_B)
rg = cvpack.RadiusOfGyration(self.ligand_atoms)
rg_cv = BiasVariable(
rg,
minValue=grid_min_B,
maxValue=grid_max_B,
biasWidth=hill_width_B,
periodic=False,
gridWidth=grid_B,
)
##############################################################
meta = Metadynamics(
system,
[com_cv, rg_cv],
self.temperature,
bias_factor,
hill_height,
frequency=bias_frequency,
saveFrequency=saveFrequency,
biasDir=self.out_dir,
)
simulation.context.reinitialize(preserveState=True)
meta.step(simulation, mMD_steps)
I am also attaching the xml/prmtop/pdb and ligand sdf files necessary to reproduce the simulation and am happy to provide more details about the system setup if it would be helpful. Thank you very much for your time and support!