openmm / openmmforcefields

CHARMM and AMBER forcefields for OpenMM (with small molecule support)
http://openmm.org
Other
257 stars 81 forks source link

System generator not adding CustomGBForce #113

Open aclyde11 opened 4 years ago

aclyde11 commented 4 years ago

Hi,

This could totally be an issue of me learning the wizarding world of forces/forcefields...

When I parameterize a protein/ligand ahead of time with amber, I can get the implicit solvent working with

rmtop = app.AmberPrmtopFile(f'{filepath}.prmtop')
    inpcrd = app.AmberInpcrdFile(f'{filepath}.inpcrd')
    print(f'{filepath}.prmtop')
    system = prmtop.createSystem(implicitSolvent=app.GBn2,
                                 nonbondedMethod=app.CutoffNonPeriodic,
                                 nonbondedCutoff=1.0*unit.nanometers,
                                 constraints=app.HBonds,
                                 rigidWater=True,
                                 ewaldErrorTolerance=0.0005)

I see in the forces a CustomGBForce.

Now as I am trying to use SystemGenerator, I am not getting the CustomGBForce set up.

 self.params['implicitSolvent'] = app.GBn2
 self.params['ewaldErrorTolerance'] =0.0005
 protein_forcefield = 'amber14/protein.ff14SB.xml'
 small_molecule_forcefield = 'openff-1.1.0'
 forcefields = [protein_forcefield]

        openmm_system_generator = SystemGenerator(forcefields=forcefields,
                                                  forcefield_kwargs=self.params,
                                                  nonperiodic_forcefield_kwargs=self.params,
                                                  molecules=[self.mol],
                                                  small_molecule_forcefield=small_molecule_forcefield,
                                                  )

self.topology, self.positions = self.pdb.topology, self.pdb.positions
modeller = app.Modeller(self.topology, self.positions)
self.system = openmm_system_generator.create_system(modeller.topology)
 self.topology, self.positions = modeller.topology, modeller.positions
aclyde11 commented 4 years ago

I've tried a bunch of random things like changing the forcefields to

forcefields = ['amber99sb.xml', 'amber99_obc.xml']

but then

ValueError: GBSAOBCForce: No parameters defined for atom type [H]c1c(c(c2c(c1[H])nc(c(n2)C3=C(N(N=C3[H])C4(C(C(N(C(C4([H])[H])([H])[H])[H])([H])[H])([H])[H])[H])[H])[H])c5c(c(c(c(c5[H])F)C([H])([H])N6C(C(OC(C6([H])[H])([H])[H])([H])[H])([H])[H])F)[H])[H]$C1#0
jchodera commented 4 years ago

Shoot, GBSA is not supported for small molecules yet: https://github.com/openmm/openmmforcefields/issues/84

If you need this urgently, we can probably prioritize fixing #84!

aclyde11 commented 4 years ago

Got it--not urgent, I just have to use the uglier hand written code we have from other things

https://github.com/inspiremd/Model-generation/blob/7fc9c2a6d5f4d84da4ae9a1631015b44a7bbe3f7/impress_md/interface_functions.py#L74