Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove water topology naming restriction required by SOMD #287

Open
lohedges opened this issue Aug 13, 2019 · 0 comments
Open

Remove water topology naming restriction required by SOMD #287

lohedges opened this issue Aug 13, 2019 · 0 comments

Comments

@lohedges
Copy link
Member

Currently SOMD requires an exact AMBER water topology naming convention. This is down to the way that it applies constraints, e.g. from openmmfrenergyst.cpp:

  if (flag_constraint == NONE)
            {
                //JM 10/16 If constraint water flag is on and if molecule is a water molecule then apply constraint
                if (flag_constraint_water and molfirstresname == ResName("WAT"))
                    system_openmm->addConstraint(idx0, idx1, r0 * OpenMM::NmPerAngstrom);
                else
                    bondStretch_openmm->addBond(idx0, idx1, r0 * OpenMM::NmPerAngstrom, k * 2.0 * OpenMM::KJPerKcal * OpenMM::AngstromsPerNm * OpenMM::AngstromsPerNm);

              //cout << "\nBOND ADDED TO "<< atom0.toStdString() << " AND " << atom1.toStdString() << "\n";
            }
            else if (flag_constraint == ALLBONDS || flag_constraint == HANGLES)
            {
                system_openmm->addConstraint(idx0, idx1, r0 * OpenMM::NmPerAngstrom);
                //cout << "\nALLBONDS or HANGLES ADDED BOND CONSTRAINT TO " << atom0.toStdString() << " AND " << atom1.toStdString() << "\n";
            }
            else if (flag_constraint == HBONDS)
            {

                if ((atom0[6] == 'H') || (atom1[6] == 'H'))
                {
                    system_openmm->addConstraint(idx0, idx1, r0 * OpenMM::NmPerAngstrom);
                    //cout << "\nHBONDS ADDED BOND CONSTRAINT TO " << atom0.toStdString() << " AND " << atom1.toStdString() << "\n";
                }
                else
                {
                    bondStretch_openmm->addBond(idx0, idx1, r0 * OpenMM::NmPerAngstrom, k * 2.0 * OpenMM::KJPerKcal * OpenMM::AngstromsPerNm * OpenMM::AngstromsPerNm);
                    //cout << "\nHBONDS ADDED BOND TO " << atom0.toStdString() << " AND " << atom1.toStdString() << "\n";
                }
            }

Note that the water molecules require ResName("WAT") and the atoms are identified by a character in the string representing their name, e.g. if ((atom0[6] == 'H') || (atom1[6] == 'H')) (not sure why the element property isn't checked so that any name can be used).

This restriction causes problems for BioSimSpace, see, e.g. here, since we need to know the exact water topology in order to convert it to the correct format required by SOMD. Removing this naming restriction should hopefully be easy since there is now built in functionality within Sire to be able to search for water molecules within a system, e.g. system.search("water") returns a Sire.Mol._Mol.SelectResult object containing all of the water molecules in the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants