openmmtools icon indicating copy to clipboard operation
openmmtools copied to clipboard

Wrong number or type of arguments for overloaded function 'new_AndersenThermostat'.

Open yuanqing-wang opened this issue 3 years ago • 0 comments

I encountered this error when using adapting this example script from perses: https://github.com/choderalab/perses/blob/master/perses/app/relative_point_mutation_setup.py

from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
def run():
    from pkg_resources import resource_filename
    protein_filename = "r.pdb"
    ligand_input = "l.pdb"

    from perses.app.relative_point_mutation_setup import PointMutationExecutor
    pm_delivery = PointMutationExecutor(
        protein_filename=protein_filename,
        mutation_chain_id="1",
        mutation_residue_id="23",
        proposed_residue="TRP",
        phase="complex",
        conduct_endstate_validation=False,
        ligand_input=ligand_input,
        forcefield_files=['amber14/protein.ff14SB.xml', 'amber14/tip3p.xml'],
        barostat=openmm.MonteCarloBarostat(1.0 * atmosphere, 300 * kelvin, 50),
        forcefield_kwargs={'removeCMMotion': False, 'ewaldErrorTolerance': 1e-4, 'constraints' : app.HBonds, 'hydrogenMass' : 4 * amus},
        periodic_forcefield_kwargs={'nonBondedMethod': app.PME,},
        small_molecule_forcefields='gaff-2.11'
    )

    complex_htf = pm_delivery.get_complex_htf()
    apo_htf = pm_delivery.get_apo_htf()

    # Now we can build the hybrid repex samplers
    from perses.annihilation.lambda_protocol import LambdaProtocol
    from openmmtools.multistate import MultiStateReporter
    from perses.samplers.multistate import HybridRepexSampler
    from openmmtools import mcmc

    suffix = 'run'; selection = 'not water'; checkpoint_interval = 10; n_states = 11; n_cycles = 5000

    for htf in [complex_htf, apo_htf]:
        lambda_protocol = LambdaProtocol(functions='default')
        reporter_file = 'reporter.nc'
        reporter = MultiStateReporter(reporter_file, analysis_particle_indices = htf.hybrid_topology.select(selection), checkpoint_interval = checkpoint_interval)
        hss = HybridRepexSampler(mcmc_moves=mcmc.LangevinSplittingDynamicsMove(timestep= 4.0 * femtoseconds,
                                                                              collision_rate=5.0 / picosecond,
                                                                              n_steps=250,
                                                                              reassign_velocities=False,
                                                                              n_restart_attempts=20,
                                                                              splitting="V R R R O R R R V",
                                                                              constraint_tolerance=1e-06),
                                                                              hybrid_factory=htf, online_analysis_interval=10)
        hss.setup(n_states=n_states, temperature=kelvin, storage_file=reporter, lambda_protocol=lambda_protocol, endstates=False)
        hss.extend(n_cycles)

Error:

Traceback (most recent call last):
  File "run.py", line 56, in <module>
    run()
  File "run.py", line 50, in run
    hss.setup(n_states=n_states, temperature=kelvin, storage_file=reporter, lambda_protocol=lambda_protocol, endstates=False)
  File "/home/wangy1/miniconda3/envs/yike/lib/python3.7/site-packages/perses-0.8.2.dev0-py3.7.egg/perses/samplers/multistate.py", line 45, in setup
    thermostate = ThermodynamicState(hybrid_system, temperature=temperature)
  File "/home/wangy1/miniconda3/envs/yike/lib/python3.7/site-packages/openmmtools-0.20.0+39.gbbf6c10-py3.7.egg/openmmtools/states.py", line 504, in __init__
    self._initialize(system, temperature, pressure, surface_tension)
  File "/home/wangy1/miniconda3/envs/yike/lib/python3.7/site-packages/openmmtools-0.20.0+39.gbbf6c10-py3.7.egg/openmmtools/states.py", line 1341, in _initialize
    self._set_system_temperature(system, temperature)
  File "/home/wangy1/miniconda3/envs/yike/lib/python3.7/site-packages/openmmtools-0.20.0+39.gbbf6c10-py3.7.egg/openmmtools/states.py", line 1890, in _set_system_temperature
    thermostat = openmm.AndersenThermostat(temperature, 1.0/unit.picosecond)
  File "/home/wangy1/miniconda3/envs/yike/lib/python3.7/site-packages/simtk/openmm/openmm.py", line 17324, in __init__
    _openmm.AndersenThermostat_swiginit(self, _openmm.new_AndersenThermostat(*args))
TypeError: Wrong number or type of arguments for overloaded function 'new_AndersenThermostat'.
  Possible C/C++ prototypes are:
    OpenMM::AndersenThermostat::AndersenThermostat(double,double)
    OpenMM::AndersenThermostat::AndersenThermostat(OpenMM::AndersenThermostat const &)

The l.pdb and r.pdb files are two chains from 1X8Y PDB, pre-processed using PDBFixer.

yuanqing-wang avatar Mar 09 '21 15:03 yuanqing-wang