Adding Hydrogens to Nonstandard Molecules

Modeller.addHydrogens() can be used to add missing hydrogens to standard molecules, like proteins and nucleic acids. But what if you need to simulate something it doesn’t know about, such as a drug molecule or a non-natural amino acid? It can also handle this case, but you need to give it some help.

Start by creating an XML file describing the molecule or molecules. Here is an example of a file defining hydrogens for NLN, a modified ASN residue that is missing a hydrogen and can have a glycan bonded to it. (This example is taken from the glycam-hydrogens.xml file that is bundled with OpenMM. You would not actually need to define this particular residue yourself.)

<Residues>
  <Residue name="NLN">
    <H name="H" parent="N" terminal="-C"/>
    <H name="H1" parent="N" terminal="N"/>
    <H name="H2" parent="N" terminal="N"/>
    <H name="H3" parent="N" terminal="N"/>
    <H name="HA" parent="CA"/>
    <H name="HB2" parent="CB"/>
    <H name="HB3" parent="CB"/>
    <H name="HD21" parent="ND2"/>
  </Residue>
</Residues>

Here are the important things to note about the file.

  • There is one <Residue> tag for every residue you want to define.

  • It contains one <H> tag for every hydrogen that can appear in the residue.

  • parent is the name of the heavy atom the hydrogen is bonded to.

  • All atom and residue names must exactly match the names present in your Topology.

  • The optional terminal attribute indicates hydrogens that might or might not be present, depending on the residue’s position in the chain. It should contain one or more of the characters “N”, “C”, and “-”. “N” indicates the hydrogen should be added to N-terminal residues. “C” indicates it should be added to C-terminal ones. “-” indicates it should be added to residues that are not at either end of the chain.

Once you have created your file, you need to tell Modeller about it. Do this by invoking the static method

Modeller.loadHydrogenDefinitions('MyHydrogens.xml')

Once you call it, all subsequent calls to addHydrogens() will know about the new residues you defined and be able to add hydrogens to them.