openmm / pdbfixer

PDBFixer fixes problems in PDB files
Other
453 stars 114 forks source link

phosaa14SB.xml KeyError and Resolution #234

Closed jhmlam closed 2 years ago

jhmlam commented 2 years ago

Dear Team,

First of all, thank you for taking efforts in reproducing a forcefield for phosphorylation. When I try to access phosaa14SB.xml through the following commands, it throws a KeyError for "CX"


DIR_Openmmforcefield = 'openmmforcefields-master/'
from openmm.app import ForceField
forcefield = ForceField(
                        DIR_Openmmforcefield + 'amber/ffxml/phosaa14SB.xml'
)

The error seems to be resolved by defining the mass of the following atomtypes in the xml

    <Type element="C" name="CX" class="CX" mass="12.01"/>
    <Type element="C" name="2C" class="2C" mass="12.01"/>
    <Type element="C" name="3C" class="3C" mass="12.01"/>

Could you please confirm the correctness?

Thanks.

jchodera commented 2 years ago

Thanks for reporting this!

The phosaa14SB.xml force field is intended to be used with ff14SB.xml, which provides the CX and other atom types.

Can you try changing

forcefield = ForceField(
                        DIR_Openmmforcefield + 'amber/ffxml/phosaa14SB.xml'
)

to

forcefield = ForceField(
                        DIR_Openmmforcefield + 'amber/ffxml/ff14SB.xml',
                        DIR_Openmmforcefield + 'amber/ffxml/phosaa14SB.xml'
)

to see if that helps?

Also, you shouldn't need to specify the directory if you have installed openmmforcefields via the conda or Python package. If you have done so, this should work:

forcefield = ForceField('amber/ff14SB.xml', 'amber/phosaa14SB.xml')

since it should auto-search the paths using the plugin support.

jhmlam commented 2 years ago

Yes, it works. Thank you! (I should have used compatible ff14SB rather than ff99SB)