Skip to content

No platform for requested kernels #72

@jgninterline

Description

@jgninterline

Hi,

I'm trying to get a non-standard module working in plumed so it looks like I need to compile both plumed and openmm-plumed from source and link them to openmm. I'm using the conda distribution of openmm 8 and installing the other codes in its env. I can run openmm without plumed just fine using the resulting code, but when I try to add in a plumed force, I get this error:

$ python test.py
Warning: importing 'simtk.openmm' is deprecated.  Import 'openmm' instead.
Traceback (most recent call last):
  File "/home/gnelson/Projects/ITGAM/Path_Determination/tst/test.py", line 25, in <module>
    simulation = Simulation(prmtop.topology, system, integrator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gnelson/miniconda3/envs/plumed/lib/python3.11/site-packages/openmm/app/simulation.py", line 99, in __init__
    self.context = mm.Context(self.system, self.integrator)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gnelson/miniconda3/envs/plumed/lib/python3.11/site-packages/openmm/openmm.py", line 9037, in __init__
    _openmm.Context_swiginit(self, _openmm.new_Context(*args))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
openmm.OpenMMException: No Platform supports all the requested kernels

Here is test.py:

from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout
from openmmplumed import PlumedForce

Platform.loadPluginsFromDirectory('/full/path/to/miniconda3/envs/plumed/lib/plugins')

prmtop = AmberPrmtopFile('amber.parm7')
inpcrd = AmberInpcrdFile('amber.rst7')
system = prmtop.createSystem(nonbondedMethod=PME, nonbondedCutoff=1*nanometer, constraints=HBonds)
plmd="""
PATHMSD REFERENCE=path-forward-models.pdb LAMBDA=51250 NEIGH_STRIDE=4 NEIGH_SIZE=8 LABEL=path
CUSTOM ARG=path.zzz FUNC=sqrt(x) PERIODIC=NO LABEL=path_z
DRR ARG=path.sss,path_z KAPPA=250,2.5e6 FULLSAMPLES=500 GRID_MIN=2,0.0 GRID_MAX=27,0.045 GRID_SPACING=0.1,0.001 TEMP=310 FRICTION=8.0,8.0 TAU=0.5,0.5 TEXTOUTPUT OUTPUTFREQ=1000 HISTORYFREQ=1000 LABEL=drr
METAD ARG=drr.path.sss_fict,drr.path_z_fict SIGMA=0.5,0.005 HEIGHT=1.5 PACE=500 GRID_MIN=0,-0.02 GRID_MAX=29,0.06 GRID_SPACING=0.1,0.001 BIASFACTOR=20 TEMP=310 FILE=HILLS LABEL=metad
CUSTOM ARG=path_z FUNC=(0.05-x)^-1 PERIODIC=NO LABEL=custom_z
BIASVALUE ARG=custom_z LABEL=z_wall
LOWER_WALLS ARG=path.sss AT=3 OFFSET=0.0 KAPPA=100 EPS=1.0 LABEL=lwall_s
UPPER_WALLS ARG=path.sss AT=26 OFFSET=0.0 KAPPA=100 EPS=1.0 LABEL=uwall_s
PRINT ARG STRIDE=10 FILE=plumed-force2.log FMT=%12.4f
FLUSH STRIDE=100"""
system.addForce(PlumedForce(plmd))
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.002*picoseconds)
simulation = Simulation(prmtop.topology, system, integrator)
simulation.context.setPositions(inpcrd.positions)
if inpcrd.boxVectors is not None:
        simulation.context.setPeriodicBoxVectors(*inpcrd.boxVectors)
simulation.minimizeEnergy()
simulation.reporters.append(PDBReporter('output.pdb', 1000))
simulation.reporters.append(StateDataReporter(stdout, 1000, step=True, potentialEnergy=True, temperature=True))
simulation.step(10000)

I added "Platform.loadPluginsFromDirectory" based on the comments in this thread: #10 (comment), but I still get the error.

The plugin directory does appear to contain the correct plugins:

$ ls /full/path/to/miniconda3/envs/plumed/lib/plugins
libOpenMMAmoebaCUDA.so libOpenMMAmoebaOpenCL.so libOpenMMAmoebaReference.so libOpenMMCPU.so libOpenMMCUDA.so libOpenMMCudaCompiler.so libOpenMMDrudeCUDA.so libOpenMMDrudeOpenCL.so libOpenMMDrudeReference.so libOpenMMOpenCL.so libOpenMMPME.so libOpenMMPlumedCUDA.so libOpenMMPlumedOpenCL.so libOpenMMPlumedReference.so libOpenMMRPMDCUDA.so libOpenMMRPMDOpenCL.so libOpenMMRPMDReference.so

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions