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

Add CheckSpecies module #366

Merged
merged 17 commits into from Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -209,6 +209,7 @@ set(BASIC_LINK_LIBS
calculatesdfmodule
calibrationmodule
checksmodule
checkspeciesmodule
datatestmodule
energymodule
epsrmodule
Expand Down
8 changes: 7 additions & 1 deletion src/classes/species.h
Expand Up @@ -191,6 +191,8 @@ class Species : public ListItem<Species>, public ObjectStore<Species>
bool hasAngle(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k) const;
// Return the SpeciesAngle between the specified SpeciesAtoms
OptionalReferenceWrapper<SpeciesAngle> getAngle(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k);
// Return the SpeciesAngle between the specified SpeciesAtom indices
OptionalReferenceWrapper<SpeciesAngle> getAngle(int i, int j, int k);
// Add new SpeciesTorsion definition (from SpeciesAtom*)
SpeciesTorsion &addTorsion(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l);
// Add new SpeciesTorsion definition
Expand All @@ -205,6 +207,8 @@ class Species : public ListItem<Species>, public ObjectStore<Species>
bool hasTorsion(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l) const;
// Return the SpeciesTorsion between the specified SpeciesAtoms
OptionalReferenceWrapper<SpeciesTorsion> getTorsion(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l);
// Return the SpeciesTorsion between the specified SpeciesAtom indices
OptionalReferenceWrapper<SpeciesTorsion> getTorsion(int i, int j, int k, int l);
// Add new SpeciesImproper definition (from SpeciesAtom*)
SpeciesImproper &addImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l);
// Add new SpeciesImproper definition
Expand All @@ -218,7 +222,9 @@ class Species : public ListItem<Species>, public ObjectStore<Species>
// Return whether SpeciesImproper between SpeciesAtoms exists
bool hasImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l) const;
// Return the SpeciesImproper between the specified SpeciesAtoms (if it exists)
OptionalReferenceWrapper<SpeciesImproper> improper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l);
OptionalReferenceWrapper<SpeciesImproper> getImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l);
// Return the SpeciesImproper between the specified SpeciesAtom indices
OptionalReferenceWrapper<SpeciesImproper> getImproper(int i, int j, int k, int l);
// Return whether the attached atoms lists have been created
bool attachedAtomListsGenerated() const;
// Generate attached Atom lists for all intramolecular terms
Expand Down
38 changes: 28 additions & 10 deletions src/classes/species_intra.cpp
Expand Up @@ -277,15 +277,10 @@ OptionalReferenceWrapper<SpeciesAngle> Species::getAngle(SpeciesAtom *i, Species
return *it;
}

// Return the SpeciesTorsion between the specified SpeciesAtoms
OptionalReferenceWrapper<SpeciesTorsion> Species::getTorsion(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l)
// Return the SpeciesAngle between the specified SpeciesAtom indic
OptionalReferenceWrapper<SpeciesAngle> Species::getAngle(int i, int j, int k)
{
auto it =
std::find_if(torsions_.begin(), torsions_.end(), [i, j, k, l](auto &torsion) { return torsion.matches(i, j, k, l); });
if (it == torsions_.end())
return {};

return *it;
return getAngle(atoms_[i], atoms_[j], atoms_[k]);
}

// Add new SpeciesTorsion definition (from supplied SpeciesAtom pointers)
Expand Down Expand Up @@ -331,6 +326,23 @@ bool Species::hasTorsion(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, Species
return it != torsions_.end();
}

// Return the SpeciesTorsion between the specified SpeciesAtoms
OptionalReferenceWrapper<SpeciesTorsion> Species::getTorsion(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l)
{
auto it =
std::find_if(torsions_.begin(), torsions_.end(), [i, j, k, l](auto &torsion) { return torsion.matches(i, j, k, l); });
if (it == torsions_.end())
return {};

return *it;
}

// Return the SpeciesTorsion between the specified SpeciesAtom indices
OptionalReferenceWrapper<SpeciesTorsion> Species::getTorsion(int i, int j, int k, int l)
{
return getTorsion(atoms_[i], atoms_[j], atoms_[k], atoms_[l]);
}

// Add new SpeciesImproper definition (from SpeciesAtom*)
SpeciesImproper &Species::addImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l)
{
Expand All @@ -340,7 +352,7 @@ SpeciesImproper &Species::addImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAto
Messenger::warn("Refused to add a new Improper between atoms {}, {}, {} and {} in Species '{}' since it "
"already exists.\n",
i->userIndex(), j->userIndex(), k->userIndex(), l->userIndex(), name_);
return *improper(i, j, k, l);
return *getImproper(i, j, k, l);
}

// OK to add new improper
Expand Down Expand Up @@ -378,7 +390,7 @@ bool Species::hasImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, Specie
}

// Return the SpeciesImproper between the specified SpeciesAtoms (if it exists)
OptionalReferenceWrapper<SpeciesImproper> Species::improper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l)
OptionalReferenceWrapper<SpeciesImproper> Species::getImproper(SpeciesAtom *i, SpeciesAtom *j, SpeciesAtom *k, SpeciesAtom *l)
{
auto it = std::find_if(impropers_.begin(), impropers_.end(),
[i, j, k, l](auto &improper) { return improper.matches(i, j, k, l); });
Expand All @@ -388,6 +400,12 @@ OptionalReferenceWrapper<SpeciesImproper> Species::improper(SpeciesAtom *i, Spec
return *it;
}

// Return the SpeciesImproper between the specified SpeciesAtom indices
OptionalReferenceWrapper<SpeciesImproper> Species::getImproper(int i, int j, int k, int l)
{
return getImproper(atoms_[i], atoms_[j], atoms_[k], atoms_[l]);
}

// Return whether the attached atoms lists have been created
bool Species::attachedAtomListsGenerated() const { return attachedAtomListsGenerated_; }

Expand Down
2 changes: 1 addition & 1 deletion src/data/ff.cpp
Expand Up @@ -515,7 +515,7 @@ bool Forcefield::assignIntramolecular(Species *sp, int flags) const
const ForcefieldImproperTerm &term = *optTerm;
// Check to see if the Species already has an improper definition - if
// not create one
auto improper = sp->improper(i, j, k, l);
auto improper = sp->getImproper(i, j, k, l);
if (!improper)
improper = sp->addImproper(i, j, k, l);

Expand Down
9 changes: 5 additions & 4 deletions src/data/ff/oplsaa2005/atomtypes.cpp
Expand Up @@ -29,6 +29,7 @@
* Notes:
* Epsilon values have been converted from kcal to kJ.
* Any inconsistencies between the forcefield as implemented here and the original work are the sole responsibility of TGAY.
* Atom types containing '*' (e.g. 'C*', 'N*') are renamed to use '^' as '*' represents a wildcard match in the name.
*
* References:
* W. L. Jorgensen, D. S. Maxwell, and J. Tirado-Rives, J. Am. Chem. Soc. 118, 11225-11236 (1996).
Expand Down Expand Up @@ -527,7 +528,7 @@ OptionalReferenceWrapper<const ForcefieldAtomType> OPLSAA2005BaseForcefield::opl
{this, ELEMENT_O, 497, "OY_a", "", "sulfoxide - all atom", -0.420000, 1.171520, 2.930000},
{this, ELEMENT_C, 498, "CT", "", "CH3 all-atom C: sulfoxide", -0.035000, 0.276144, 3.500000},
{this, ELEMENT_C, 499, "CT", "", "CH2 all-atom C: sulfoxide", 0.025000, 0.276144, 3.500000},
{this, ELEMENT_C, 500, "Cstar", "", "CG in TRP", 0.075000, 0.292880, 3.550000},
{this, ELEMENT_C, 500, "C^", "", "CG in TRP", 0.075000, 0.292880, 3.550000},
{this, ELEMENT_C, 501, "CB", "", "CD C in TRP", -0.055000, 0.292880, 3.550000},
{this, ELEMENT_C, 502, "CN", "", "CE C in TRP", 0.130000, 0.292880, 3.550000},
{this, ELEMENT_N, 503, "NA", "", "NE in TRP", -0.570000, 0.711280, 3.250000},
Expand Down Expand Up @@ -855,9 +856,9 @@ OptionalReferenceWrapper<const ForcefieldAtomType> OPLSAA2005BaseForcefield::opl
{this, ELEMENT_C, 933, "CO", "", "C1' of (ura, thy) by Deping", 0.510000, 0.276144, 3.500000},
{this, ELEMENT_O, 934, "OH_a", "", "O5' by Deping", -0.655000, 0.711280, 3.120000},
{this, ELEMENT_H, 935, "HO", "", "H(3') OH by Deping", 0.390000, 0.000000, 0.000000},
{this, ELEMENT_N, 936, "N*", "", "Adenine N9 Guanine nucleosides", -0.500000, 0.711280, 3.250000},
{this, ELEMENT_N, 937, "N*", "", "Cytosine N1 nucleoside", -0.560000, 0.711280, 3.250000},
{this, ELEMENT_N, 938, "N*", "", "Uracil N1 Thymine nucleosides", -0.600000, 0.711280, 3.250000},
{this, ELEMENT_N, 936, "N^", "", "Adenine N9 Guanine nucleosides", -0.500000, 0.711280, 3.250000},
{this, ELEMENT_N, 937, "N^", "", "Cytosine N1 nucleoside", -0.560000, 0.711280, 3.250000},
{this, ELEMENT_N, 938, "N^", "", "Uracil N1 Thymine nucleosides", -0.600000, 0.711280, 3.250000},
{this, ELEMENT_C, 939, "CZ_a", "", "alkyne RC%CR - only did MC for MeCCMe", 0.000000, 0.878640, 3.300000},
{this, ELEMENT_N, 940, "N3", "", "N (R3NH+)", -0.100000, 0.711280, 3.250000},
{this, ELEMENT_H, 941, "H3", "", "H (R3NH+)", 0.290000, 0.000000, 0.000000},
Expand Down