openmm / openmm-plumed

OpenMM plugin to interface with PLUMED
55 stars 23 forks source link

Can import openmmplumed but cannot run simulation #40

Closed yuvrajsingh24 closed 3 years ago

yuvrajsingh24 commented 3 years ago

Hi,

I've been trying to run a simulation using the openmmplumed plugin. With some help I was able to create a new python environment and compile and install the plugin. I am able to import the openmmplumed PlumedForce and add it to my system but it does not let me run the simulation. Below is my code and the error message I got

import numpy as np from simtk.openmm.app import from simtk.openmm import from simtk.unit import * from sys import stdout from openmmplumed import PlumedForce

Load the input files

prmtop = AmberPrmtopFile('input.prmtop') inpcrd = AmberInpcrdFile('input.inpcrd')

set up system

system = prmtop.createSystem(implicitSolvent=OBC2, soluteDielectric=1.0, solventDielectric=80.0)

load PLUMED file and apply to system

system.addForce(PlumedForce('pull_plumed.dat'))

integrator = LangevinIntegrator(300kelvin, 1/picosecond, 0.002picoseconds)

set up simulation

simulation = Simulation(prmtop.topology, system, integrator) simulation.context.setPositions(inpcrd.positions) if inpcrd.boxVectors is not None: simulation.context.setPeriodicBoxVectors(*inpcrd.boxVectors)

Minimization

simulation.minimizeEnergy()

Output specifications

simulation.reporters.append(PDBReporter('output_implicit.pdb', 1000)) simulation.reporters.append(StateDataReporter('data_implicit.txt', 1000, step=True, potentialEnergy=True, temperature=True, volume=True, totalSteps=1000000, speed=True, separator=' '))

Run the simulation

simulation.step(1000000)

The error message I get is Screenshot from 2020-10-20 19-00-46

Any suggestions to help solve this would be very helpful. Thank you in advance!

Yuvraj

peastman commented 3 years ago

It looks like some of the plugins aren't getting loaded. You can see all plugins that have gotten loaded with

print(pluginLoadedLibNames)

Also, if there were any plugins that couldn't be loaded because of errors, you can print those with

print(Platform.getPluginLoadFailures())

Hopefully that will reveal what's going wrong: either it's getting an error trying to load the Plumed plugins, or else they've been installed in the wrong directory.

yuvrajsingh24 commented 3 years ago

So after directing to the directory I want to load the plugins from, I type the print(Platform.getPluginLoadFailures()) and get the following Screenshot from 2020-10-23 10-56-19 I am not sure if this means I have to reinstall or is this some other type of error.

peastman commented 3 years ago

You're pointing it at the wrong directory. That's your build directory, not the install directory. Try this:

print(version.openmm_library_path)

That prints out where OpenMM is installed. The plugins should get installed into the plugins subdirectory inside it. For example, on my computer it prints /usr/local/openmm/lib, and plugins get loaded from /usr/local/openmm/lib/plugins.

raimis commented 3 years ago

We already provide a conda package (https://github.com/openmm/openmm-plumed#installing-the-plugin). The regular users should no longer need to build the plugin from the source code and face similar issues.