Page 1 of 1

Modeller with CHARMM with OpenMM 6.1

Posted: Thu Jun 11, 2015 9:27 am
by rnowling
Hi,

I'm trying to use the Modeller class to add explicit waters to a protein. I have PDB and PSF files for the protein and topology and parameter files for CHARMM. The addSolvent() method seems inconsistent as to what topology and forcefield should be but I could just be confused.

Code: Select all

psf = CharmmPsfFile(...)
pdb = PDBFile(...)
params = CharmmParameterSet(...)
This works:

Code: Select all

system = psf.createSystem(params, nonbondedCutoff=CutoffNonPeriodic)
This does not:

Code: Select all

modeller = Modeller(params, pdb.positions)
modeller.addSolvent(psf, boxSize=[5.0, 5.0, 5.0])

  File "prepare-water-box.py", line 31, in create_system
    modeller.addSolvent(psf, boxSize=[5.0, 5.0, 5.0])
  File "/usr/lib64/python2.7/site-packages/simtk/openmm/app/modeller.py", line 337, in addSolvent
    for chain in self.topology.chains():
AttributeError: 'CharmmParameterSet' object has no attribute 'chains'
When looking at the source for addSolvent(), I choose params for the topology and psf as the forcefield parameters based on this line in Modeller.addSolvent():

Code: Select all

system = forcefield.createSystem(self.topology)
Where am I going wrong? Thanks!

Re: Modeller with CHARMM with OpenMM 6.1

Posted: Thu Jun 11, 2015 10:10 am
by peastman
Hi RJ,

The first argument to Modeller is a Topology, not a CharmmParameterSet. I think you want to be calling

Code: Select all

modeller = Modeller(pdb.topology, pdb.positions)
Peter

Re: Modeller with CHARMM with OpenMM 6.1

Posted: Thu Jun 11, 2015 10:31 am
by rnowling
Hi Peter,

Thanks for the quick response!

Using pdb.topology, I get the following error:

Code: Select all

  File "prepare-water-box.py", line 31, in create_system
    modeller.addSolvent(psf, boxSize=[5.0, 5.0, 5.0])
  File "/usr/lib64/python2.7/site-packages/simtk/openmm/app/modeller.py", line 317, in addSolvent
    system = forcefield.createSystem(self.topology)
  File "/usr/lib64/python2.7/site-packages/simtk/openmm/app/charmmpsffile.py", line 953, in createSystem
    self.loadParameters(params.condense())
AttributeError: 'Topology' object has no attribute 'condense'
I get the same result if I pass psf.topology.

Re: Modeller with CHARMM with OpenMM 6.1

Posted: Thu Jun 11, 2015 11:13 am
by peastman
Same problem: you're passing the wrong type of object for an argument. The first argument to addSolvent() is a ForceField, not a CharmmPsfFile. See the API documentation at http://docs.openmm.org/6.2.0/api-python ... d890179435.

Peter

Re: Modeller with CHARMM with OpenMM 6.1

Posted: Thu Jun 11, 2015 5:51 pm
by rnowling
Thanks, Peter. I had been confusing the CharmmPsfFile with a Forcefield.

What I'm trying to do, in a nut shell, is read a protein structure, add water, and simulate using the CHARMM 22 forcefield.

OpenMM supports building a system and simulation from CHARMM files -- but I don't see a provided CHARMM .xml file. Is there an easy way to create a Forcefield object from a CharmmPsfFile? E.g., it would be nice if CharmmPsfFile had a .forcfield property :)

Re: Modeller with CHARMM with OpenMM 6.1

Posted: Fri Jun 12, 2015 10:10 am
by peastman
Unfortunately, we don't currently have any CHARMM force fields (except the polarizable one, which I assume isn't what you want). So you'll need to do all your modelling with the CHARMM tools, then construct your final system directly from the psf file.

Re: Modeller with CHARMM with OpenMM 6.1

Posted: Wed Jun 17, 2015 6:18 am
by rnowling
Thanks, Peter! Your help was invaluable as always. :)