Share 
Follow 
AboutDownloadsDocumentsForumsWikiIssuesNews
Date:
2022-11-03 01:41
Priority:
3
State:
Open
Submitted by:
Nobody
Assigned to:
Nobody (None)
Resolution:
none
Summary:
openmm.OpenMMException: Particle coordinate is nan

Detailed description
Hello, here is my code. I don't know how to solve this problem. Is it because I simulated too many steps? Maybe the parameter settings are wrong? This system is not easy to balance, at least 100ns. I think I should set more steps. I have not found a solution yet, and I am seeking your help.

#####################ERROR
Warning: importing 'simtk.openmm' is deprecated. Import 'openmm' instead.
Traceback (most recent call last):
File "*/trail2/cal-molecule-dynamic.py", line 43, in <module>
simulation.step(1000000)
File "*/envs/*/lib/python3.10/site-packages/openmm/app/simulation.py", line 141, in step
self._simulate(endStep=self.currentStep+steps)
File "*/miniconda3/envs/*/lib/python3.10/site-packages/openmm/app/simulation.py", line 206, in _simulate
self.integrator.step(10) # Only take 10 steps at a time, to give Python more chances to respond to a control-c.
File "*/miniconda3/envs/*/lib/python3.10/site-packages/openmm/openmm.py", line 6145, in step
return _openmm.LangevinMiddleIntegrator_step(self, steps)
openmm.OpenMMException: Particle coordinate is nan

###############code
from openmm.app import *
from openmm import *
from openmm.unit import *
from sys import stdout
import time
from parmed.openmm import NetCDFReporter


prmtop = AmberPrmtopFile('trail2-complex.prmtop')
inpcrd = AmberInpcrdFile('trail2-complex.inpcrd')
system = prmtop.createSystem(nonbondedMethod=PME, nonbondedCutoff=1*nanometer,
constraints=HBonds)
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)

platform = Platform.getPlatformByName('CUDA')
prop = dict(CudaPrecision='mixed',DeviceIndex='1')

simulation = Simulation(prmtop.topology, system, integrator,platform,prop)
simulation.context.setPositions(inpcrd.positions)
if inpcrd.boxVectors is not None:
simulation.context.setPeriodicBoxVectors(*inpcrd.boxVectors)
simulation.minimizeEnergy(maxIterations=60000)
with open("trail2-complex-minimize.pdb", "w") as pdb_file:
app.PDBFile.writeFile(
simulation.topology,
simulation.context.getState(getPositions=True, enforcePeriodicBox=True).getPositions(),
file=pdb_file,
keepIds=True,
)

simulation.context.setVelocitiesToTemperature(300*openmm.unit.kelvin)
simulation.step(1000000)

simulation.reporters.append(NetCDFReporter('trail1-complex_output.nc', 5000))
simulation.reporters.append(StateDataReporter(stdout, 5000, step=True,
potentialEnergy=True, temperature=True))
simulation.step(50000000)

Add A Comment: Notepad

Message  ↓
Date: 2022-11-03 16:39
Sender: Peter Eastman

See https://github.com/openmm/openmm/wiki/Frequently-Asked-Questions#nan for advice on dealing with problems of this sort.

One change I would suggest is added the argument hydrogenMass=1.5*amu to the call to createSystem(). When using a 4 fs time step, a little bit of mass repartitioning is sometimes necessary to maintain stability.

No Changes Have Been Made to This Item

Feedback