Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to create mixed system #6

Open
victorprincipe opened this issue Mar 15, 2021 · 0 comments
Open

Error when trying to create mixed system #6

victorprincipe opened this issue Mar 15, 2021 · 0 comments

Comments

@victorprincipe
Copy link

Hi,

I've been trying to use ANI-2x to model the ligand during the simulation of a protein-ligand complex. I've been using the code below to set up the system.

prmtop = AmberPrmtopFile(prmtop_file)
inpcrd = AmberInpcrdFile(crd_file)

potential = MLPotential('ani2x')
ml_atoms  = [atom.index for atom in prmtop.topology.atoms() if atom.residue.name == "MOL"]
mm_system = prmtop.createSystem(nonbondedMethod=PME,
nonbondedCutoff=1.0*unit.nanometers, constraints=HBonds, rigidWater=True,
ewaldErrorTolerance=0.0005)
ml_system = potential.createMixedSystem(prmtop.topology, mm_system, ml_atoms)

The last line in the code raises the following error:

Traceback (most recent call last):
  File "/Users/victorprincipe/Local/project2021/local_tests/openmm_ani_test/md_ani.py", line 26, in <module>
    ml_system = potential.createMixedSystem(prmtop.topology, mm_system, ml_atoms)
  File "/Users/victorprincipe/miniconda3/envs/openmmani/lib/python3.9/site-packages/openmmml-1.0-py3.9.egg/openmmml/mlpotential.py", line 278, in createMixedSystem
    self._impl.addForces(topology, newSystem, atomList, forceGroup, **args)
  File "/Users/victorprincipe/miniconda3/envs/openmmani/lib/python3.9/site-packages/openmmml-1.0-py3.9.egg/openmmml/models/anipotential.py", line 85, in addForces
    species = model.species_to_tensor(elements).unsqueeze(0)
  File "/Users/victorprincipe/miniconda3/envs/openmmani/lib/python3.9/site-packages/torchani/models.py", line 165, in species_to_tensor
    return self._species_to_tensor(*args, **kwargs) \
  File "/Users/victorprincipe/miniconda3/envs/openmmani/lib/python3.9/site-packages/torchani/utils.py", line 237, in __call__
    rev = [self.rev_species[s] for s in species]
  File "/Users/victorprincipe/miniconda3/envs/openmmani/lib/python3.9/site-packages/torchani/utils.py", line 237, in <listcomp>
    rev = [self.rev_species[s] for s in species]
KeyError: 'l'

I'm not sure why this is occurring, so any help would be greatly appreciated. I've also attached the prmtop and inpcrd files below. Thanks in advance!

system_files.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant