diff --git a/modules/mol/mm/src/topology_creator.cc b/modules/mol/mm/src/topology_creator.cc index dede191f8951e744d8402669ba513ba5e6b3a4ec..00ba0738d68f5730d362097d0eee446d4ccef39b 100644 --- a/modules/mol/mm/src/topology_creator.cc +++ b/modules/mol/mm/src/topology_creator.cc @@ -164,6 +164,21 @@ TopologyPtr TopologyCreator::Create(ost::mol::EntityHandle& ent, if(hc){ hc->ApplyOnBuildingBlock(block); hc->ApplyOnResidue(*i,ed); + // hack for AMBER forcefield + // GROMACS hijacks the hydrogen constructor to construct terminal oxygens + // in the case of the AMBER forcefield, their elements are thus set to H. + // Forcefields in general don't care about elements, they just care for + // atom types and their respective masses. There is no easy way to tell + // the hydrogen constructor that the element is not H. I just hardcode the + // AMBER case here. Please forgive me... + ost::mol::AtomHandle at = i->FindAtom("OC1"); + if(at.IsValid()) { + at.SetElement("O"); + } + at = i->FindAtom("OC2"); + if(at.IsValid()) { + at.SetElement("O"); + } } //check for n terminus if(i->HasProp("n_ter")){