Gallicchio-Lab / AToM-OpenMM

OpenMM-based framework for absolute and relative binding free energy calculations with the Alchemical Transfer Method
Other
105 stars 30 forks source link

Failed to run ATM with mm/nnp #79

Open RenlingHu opened 4 months ago

RenlingHu commented 4 months ago

Hi, I recently tried to use this package to run ATM calculations based on the MM/NNP force field. The input comes from https://github.com/compsciencelab/ATM_benchmark/tree/main/ATM_With_NNPs/CDK2/complexes/CDK2_m01_m10. When I performed rbfe_structprep.py CDK2_m01_m10_asyncre.cntl, I get the following error. When I deleted "NNP_MODEL = 'ani2x'" and only used the MM force field, everything ran fine and could be called by the CUDA platform. I am struggling to solve this problem but have no idea about that. Looking forward to your kind reply, thanks.

Traceback (most recent call last): File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/bin/rbfe_structprep.py", line 4, in import('pkg_resources').run_script('async-re==3.3.0', 'rbfe_structprep.py') File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/lib/python3.8/site-packages/pkg_resources/init.py", line 672, in run_script self.require(requires)[0].run_script(script_name, ns) File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/lib/python3.8/site-packages/pkg_resources/init.py", line 1472, in run_script exec(code, namespace, namespace) File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/lib/python3.8/site-packages/async_re-3.3.0-py3.8.egg/EGG-INFO/scripts/rbfe_structprep.py", line 421, in do_mintherm(keywords, logger) File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/lib/python3.8/site-packages/async_re-3.3.0-py3.8.egg/EGG-INFO/scripts/rbfe_structprep.py", line 85, in do_mintherm simulation = Simulation(syst.topology, syst.system, syst.integrator, platform, platform_properties) File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/lib/python3.8/site-packages/openmm/app/simulation.py", line 103, in init self.context = mm.Context(self.system, self.integrator, platform, platformProperties) File "/home/renling/softwares/anaconda3/envs/mmnnp-8.0.0/lib/python3.8/site-packages/openmm/openmm.py", line 2694, in init _openmm.Context_swiginit(self, _openmm.new_Context(*args)) openmm.OpenMMException: Specified a Platform for a Context which does not support all required kernels

qsabanes commented 4 months ago

Hey! I'll answer this since you used my inputs. Have you installed the necessary fork of AToM to run NNP? At this point I believe is the only option to run ATM with NNPs: https://github.com/compsciencelab/AToM-OpenMM

It is explained in the Readme from the benchmark.

EDIT: You'll also need nnpops and openmm-ml

RenlingHu commented 4 months ago

Thanks for your reply! Yes, I have installed your AToM, nnpops and openmm-ml in my conda environment.

And I just tested the code, this error comes from: simulation = Simulation(prmtop.topology, system, integrator,platform, properties).

This also means I didn't get errors when running through these codes: from openmmml import MLPotential nnp = MLPotential("ani2x") nnp_atoms = list(map(int,lig1_atoms+lig2_atoms)) system = nnp.createMixedSystem(prmtop.topology, system, nnp_atoms, removeConstraints=False)

Do you have any other ideas about that?

qsabanes commented 4 months ago

Could you please try to run with an older OpenMM version? Are you using 8? Can you try with OpenMM 7.7? I belive it is due to some incompatability with the openmm-atmmetaforce-plugin

RenlingHu commented 4 months ago

Thanks! It is due to some imcompatability with openmm-plugins.

I found the reason. When I checked it with python -c 'from simtk.openmm import *;print(pluginLoadedLibNames);print(Platform.getPluginLoadFailures())', I found that it was because the openmm-plugins library files could not be loaded. Mainly because some of my plugins were compiled from source code and others were installed by mamba. Their paths are different.

I solved this problem through ln -s.

After the CUDA platform was detected, a new error appeared:

segmentation fault

This is an error about memory access, which still exists after I have enough available memory. Have you ever encountered this problem?

qsabanes commented 4 months ago

No, unfortunately we have never encountered a segmentation fault error with ATM calculations. Which GPU are you using? Take into account that NNP runs will take more VRAM than classical ones.