diff --git a/corelib/src/libs/SireMM/CMakeLists.txt b/corelib/src/libs/SireMM/CMakeLists.txt index 3b923c3de..5849e3942 100644 --- a/corelib/src/libs/SireMM/CMakeLists.txt +++ b/corelib/src/libs/SireMM/CMakeLists.txt @@ -71,6 +71,7 @@ set ( SIREMM_HEADERS intragroupff.h intraljff.h intrasoftcljff.h + inversebondrestraints.h lj1264parameter.h ljfunction.h ljpair.h @@ -167,6 +168,7 @@ set ( SIREMM_SOURCES intragroupff.cpp intraljff.cpp intrasoftcljff.cpp + inversebondrestraints.cpp lj1264parameter.cpp ljpair.cpp ljparameter.cpp diff --git a/corelib/src/libs/SireMM/anglerestraints.cpp b/corelib/src/libs/SireMM/anglerestraints.cpp index 5eaf82fc1..a12978fc4 100644 --- a/corelib/src/libs/SireMM/anglerestraints.cpp +++ b/corelib/src/libs/SireMM/anglerestraints.cpp @@ -227,11 +227,11 @@ static const RegisterMetaType r_angrests; QDataStream &operator<<(QDataStream &ds, const AngleRestraints &angrests) { - writeHeader(ds, r_angrests, 1); + writeHeader(ds, r_angrests, 2); SharedDataStream sds(ds); - sds << angrests.r + sds << angrests.r << angrests.use_pbc << static_cast(angrests); return ds; @@ -249,8 +249,15 @@ QDataStream &operator>>(QDataStream &ds, AngleRestraints &angrests) sds >> angrests.r >> static_cast(angrests); } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> angrests.r >> angrests.use_pbc + >> static_cast(angrests); + } else - throw version_error(v, "1", r_angrests, CODELOC); + throw version_error(v, "1,2", r_angrests, CODELOC); return ds; } @@ -303,7 +310,7 @@ AngleRestraints::AngleRestraints(const QString &name, } AngleRestraints::AngleRestraints(const AngleRestraints &other) - : ConcreteProperty(other), r(other.r) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) { } @@ -318,6 +325,7 @@ AngleRestraints &AngleRestraints::operator=(const AngleRestraints &other) { Restraints::operator=(other); r = other.r; + use_pbc = other.use_pbc; } return *this; @@ -325,7 +333,7 @@ AngleRestraints &AngleRestraints::operator=(const AngleRestraints &other) bool AngleRestraints::operator==(const AngleRestraints &other) const { - return r == other.r and Restraints::operator==(other); + return r == other.r and Restraints::operator==(other) and use_pbc == other.use_pbc; } bool AngleRestraints::operator!=(const AngleRestraints &other) const @@ -379,9 +387,10 @@ QString AngleRestraints::toString() const } } - return QObject::tr("AngleRestraints( name=%1, size=%2\n%3\n )") + return QObject::tr("AngleRestraints( name=%1, size=%2, use_pbc=%3\n%4\n )") .arg(this->name()) .arg(n) + .arg(this->use_pbc ? "true" : "false") .arg(parts.join("\n")); } @@ -477,3 +486,15 @@ AngleRestraints AngleRestraints::operator+(const AngleRestraints &restraints) co ret += restraints; return *this; } + +/** Set whether or not periodic boundary conditions are to be used */ +void AngleRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool AngleRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/anglerestraints.h b/corelib/src/libs/SireMM/anglerestraints.h index b34de4822..bf0f7fc9e 100644 --- a/corelib/src/libs/SireMM/anglerestraints.h +++ b/corelib/src/libs/SireMM/anglerestraints.h @@ -161,9 +161,15 @@ namespace SireMM AngleRestraints operator+(const AngleRestraint &restraint) const; AngleRestraints operator+(const AngleRestraints &restraints) const; + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + private: /** List of restraints */ QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = false; }; } diff --git a/corelib/src/libs/SireMM/bondrestraints.cpp b/corelib/src/libs/SireMM/bondrestraints.cpp index 11e91057e..ff63cd678 100644 --- a/corelib/src/libs/SireMM/bondrestraints.cpp +++ b/corelib/src/libs/SireMM/bondrestraints.cpp @@ -350,11 +350,11 @@ static const RegisterMetaType r_bndrests; QDataStream &operator<<(QDataStream &ds, const BondRestraints &bndrests) { - writeHeader(ds, r_bndrests, 1); + writeHeader(ds, r_bndrests, 2); SharedDataStream sds(ds); - sds << bndrests.r + sds << bndrests.r << bndrests.use_pbc << static_cast(bndrests); return ds; @@ -370,8 +370,15 @@ QDataStream &operator>>(QDataStream &ds, BondRestraints &bndrests) sds >> bndrests.r >> static_cast(bndrests); } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> bndrests.r >> bndrests.use_pbc + >> static_cast(bndrests); + } else - throw version_error(v, "1", r_bndrests, CODELOC); + throw version_error(v, "1,2", r_bndrests, CODELOC); return ds; } @@ -424,7 +431,7 @@ BondRestraints::BondRestraints(const QString &name, } BondRestraints::BondRestraints(const BondRestraints &other) - : ConcreteProperty(other), r(other.r) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) { } @@ -435,13 +442,14 @@ BondRestraints::~BondRestraints() BondRestraints &BondRestraints::operator=(const BondRestraints &other) { r = other.r; + use_pbc = other.use_pbc; Restraints::operator=(other); return *this; } bool BondRestraints::operator==(const BondRestraints &other) const { - return r == other.r and Restraints::operator==(other); + return r == other.r and Restraints::operator==(other) and use_pbc == other.use_pbc; } bool BondRestraints::operator!=(const BondRestraints &other) const @@ -495,7 +503,11 @@ QString BondRestraints::toString() const } } - return QObject::tr("BondRestraints( name=%1, size=%2\n%3\n)").arg(this->name()).arg(n).arg(parts.join("\n")); + return QObject::tr("BondRestraints( name=%1, size=%2, use_pbc=$3\n%4\n)") + .arg(this->name()) + .arg(n) + .arg(this->use_pbc ? "true" : "false") + .arg(parts.join("\n")); } /** Return whether or not this is empty */ @@ -678,3 +690,15 @@ BondRestraints BondRestraints::operator+(const BondRestraints &restraints) const ret += restraints; return *this; } + +/** Set whether or not periodic boundary conditions are to be used */ +void BondRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool BondRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/bondrestraints.h b/corelib/src/libs/SireMM/bondrestraints.h index ccf534de9..312452a88 100644 --- a/corelib/src/libs/SireMM/bondrestraints.h +++ b/corelib/src/libs/SireMM/bondrestraints.h @@ -191,9 +191,15 @@ namespace SireMM BondRestraints operator+(const BondRestraint &restraint) const; BondRestraints operator+(const BondRestraints &restraints) const; + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + private: /** The actual list of restraints*/ QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = false; }; } diff --git a/corelib/src/libs/SireMM/boreschrestraints.cpp b/corelib/src/libs/SireMM/boreschrestraints.cpp index be5981a9e..25be2ebf6 100644 --- a/corelib/src/libs/SireMM/boreschrestraints.cpp +++ b/corelib/src/libs/SireMM/boreschrestraints.cpp @@ -74,7 +74,9 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraint &borrest) { SharedDataStream sds(ds); - sds >> borrest.receptor_atms >> borrest.ligand_atms >> borrest._r0 >> borrest._theta0 >> borrest._phi0 >> borrest._kr >> borrest._ktheta >> borrest._kphi >> static_cast(borrest); + sds >> borrest.receptor_atms >> borrest.ligand_atms >> borrest._r0 + >> borrest._theta0 >> borrest._phi0 >> borrest._kr >> borrest._ktheta + >> borrest._kphi >> static_cast(borrest); } else throw version_error(v, "1", r_borrest, CODELOC); @@ -343,11 +345,11 @@ static const RegisterMetaType r_borrests; QDataStream &operator<<(QDataStream &ds, const BoreschRestraints &borrests) { - writeHeader(ds, r_borrests, 1); + writeHeader(ds, r_borrests, 2); SharedDataStream sds(ds); - sds << borrests.r + sds << borrests.r << borrests.use_pbc << static_cast(borrests); return ds; @@ -363,8 +365,15 @@ QDataStream &operator>>(QDataStream &ds, BoreschRestraints &borrests) sds >> borrests.r >> static_cast(borrests); } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> borrests.r >> borrests.use_pbc + >> static_cast(borrests); + } else - throw version_error(v, "1", r_borrests, CODELOC); + throw version_error(v, "1,2", r_borrests, CODELOC); return ds; } @@ -417,7 +426,7 @@ BoreschRestraints::BoreschRestraints(const QString &name, } BoreschRestraints::BoreschRestraints(const BoreschRestraints &other) - : ConcreteProperty(other), r(other.r) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) { } @@ -428,13 +437,15 @@ BoreschRestraints::~BoreschRestraints() BoreschRestraints &BoreschRestraints::operator=(const BoreschRestraints &other) { r = other.r; + use_pbc = other.use_pbc; Restraints::operator=(other); return *this; } bool BoreschRestraints::operator==(const BoreschRestraints &other) const { - return r == other.r and Restraints::operator==(other); + return r == other.r and Restraints::operator==(other) and + use_pbc == other.use_pbc; } bool BoreschRestraints::operator!=(const BoreschRestraints &other) const @@ -488,7 +499,11 @@ QString BoreschRestraints::toString() const } } - return QObject::tr("BoreschRestraints( name=%1, size=%2\n%3\n)").arg(this->name()).arg(n).arg(parts.join("\n")); + return QObject::tr("BoreschRestraints( name=%1, size=%2, use_pbc=%3\n%4\n)") + .arg(this->name()) + .arg(n) + .arg(this->use_pbc ? "true" : "false") + .arg(parts.join("\n")); } /** Return whether or not this is empty */ @@ -583,3 +598,15 @@ BoreschRestraints BoreschRestraints::operator+(const BoreschRestraints &restrain ret += restraints; return *this; } + +/** Set whether or not periodic boundary conditions are to be used */ +void BoreschRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool BoreschRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/boreschrestraints.h b/corelib/src/libs/SireMM/boreschrestraints.h index 963e9e423..7592daf5f 100644 --- a/corelib/src/libs/SireMM/boreschrestraints.h +++ b/corelib/src/libs/SireMM/boreschrestraints.h @@ -194,9 +194,15 @@ namespace SireMM BoreschRestraints operator+(const BoreschRestraint &restraint) const; BoreschRestraints operator+(const BoreschRestraints &restraints) const; + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + private: /** The actual list of restraints*/ QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = false; }; } diff --git a/corelib/src/libs/SireMM/dihedralrestraints.cpp b/corelib/src/libs/SireMM/dihedralrestraints.cpp index 70054b34c..8ef7b254b 100644 --- a/corelib/src/libs/SireMM/dihedralrestraints.cpp +++ b/corelib/src/libs/SireMM/dihedralrestraints.cpp @@ -225,11 +225,11 @@ static const RegisterMetaType r_dihrests; QDataStream &operator<<(QDataStream &ds, const DihedralRestraints &dihrests) { - writeHeader(ds, r_dihrests, 1); + writeHeader(ds, r_dihrests, 2); SharedDataStream sds(ds); - sds << dihrests.r + sds << dihrests.r << dihrests.use_pbc << static_cast(dihrests); return ds; @@ -247,8 +247,15 @@ QDataStream &operator>>(QDataStream &ds, DihedralRestraints &dihrests) sds >> dihrests.r >> static_cast(dihrests); } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> dihrests.r >> dihrests.use_pbc + >> static_cast(dihrests); + } else - throw version_error(v, "1", r_dihrests, CODELOC); + throw version_error(v, "1,2", r_dihrests, CODELOC); return ds; } @@ -301,7 +308,7 @@ DihedralRestraints::DihedralRestraints(const QString &name, } DihedralRestraints::DihedralRestraints(const DihedralRestraints &other) - : ConcreteProperty(other), r(other.r) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) { } @@ -316,6 +323,7 @@ DihedralRestraints &DihedralRestraints::operator=(const DihedralRestraints &othe { Restraints::operator=(other); r = other.r; + use_pbc = other.use_pbc; } return *this; @@ -323,7 +331,8 @@ DihedralRestraints &DihedralRestraints::operator=(const DihedralRestraints &othe bool DihedralRestraints::operator==(const DihedralRestraints &other) const { - return r == other.r and Restraints::operator==(other); + return r == other.r and Restraints::operator==(other) and + use_pbc == other.use_pbc; } bool DihedralRestraints::operator!=(const DihedralRestraints &other) const @@ -377,9 +386,10 @@ QString DihedralRestraints::toString() const } } - return QObject::tr("DihedralRestraints( name=%1, size=%2\n%3\n )") + return QObject::tr("DihedralRestraints( name=%1, size=%2, use_pbc=%3\n%4\n )") .arg(this->name()) .arg(n) + .arg(this->use_pbc ? "true" : "false") .arg(parts.join("\n")); } @@ -474,4 +484,16 @@ DihedralRestraints DihedralRestraints::operator+(const DihedralRestraints &restr DihedralRestraints ret(*this); ret += restraints; return *this; -} \ No newline at end of file +} + +/** Set whether or not periodic boundary conditions are to be used */ +void DihedralRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool DihedralRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/dihedralrestraints.h b/corelib/src/libs/SireMM/dihedralrestraints.h index f40b03e0c..a2cb22a2d 100644 --- a/corelib/src/libs/SireMM/dihedralrestraints.h +++ b/corelib/src/libs/SireMM/dihedralrestraints.h @@ -161,9 +161,15 @@ namespace SireMM DihedralRestraints operator+(const DihedralRestraint &restraint) const; DihedralRestraints operator+(const DihedralRestraints &restraints) const; + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + private: /** List of restraints */ QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = false; }; } @@ -174,4 +180,4 @@ SIRE_EXPOSE_CLASS(SireMM::DihedralRestraint) SIRE_EXPOSE_CLASS(SireMM::DihedralRestraints) SIRE_END_HEADER -#endif \ No newline at end of file +#endif diff --git a/corelib/src/libs/SireMM/inversebondrestraints.cpp b/corelib/src/libs/SireMM/inversebondrestraints.cpp new file mode 100644 index 000000000..f88acc3fe --- /dev/null +++ b/corelib/src/libs/SireMM/inversebondrestraints.cpp @@ -0,0 +1,704 @@ +/********************************************\ + * + * Sire - Molecular Simulation Framework + * + * Copyright (C) 2023 Christopher Woods + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For full details of the license please see the COPYING file + * that should have come with this distribution. + * + * You can contact the authors via the website + * at https://sire.openbiosim.org + * +\*********************************************/ + +#include "inversebondrestraints.h" + +#include "SireUnits/units.h" + +#include "SireID/index.h" + +#include "SireError/errors.h" + +#include "SireStream/datastream.h" +#include "SireStream/shareddatastream.h" + +#include + +using namespace SireMM; +using namespace SireMaths; +using namespace SireBase; +using namespace SireUnits; +using namespace SireUnits::Dimension; +using namespace SireStream; + +/////// +/////// Implementation of InverseBondRestraint +/////// + +static const RegisterMetaType r_bndrest; + +QDataStream &operator<<(QDataStream &ds, const InverseBondRestraint &bndrest) +{ + writeHeader(ds, r_bndrest, 1); + + SharedDataStream sds(ds); + + sds << bndrest.atms0 << bndrest.atms1 << bndrest._k << bndrest._r0 + << static_cast(bndrest); + + return ds; +} + +QDataStream &operator>>(QDataStream &ds, InverseBondRestraint &bndrest) +{ + VersionID v = readHeader(ds, r_bndrest); + + if (v == 1) + { + SharedDataStream sds(ds); + + sds >> bndrest.atms0 >> bndrest.atms1 >> bndrest._k >> bndrest._r0 >> static_cast(bndrest); + } + else + throw version_error(v, "1", r_bndrest, CODELOC); + + return ds; +} + +/** Null constructor */ +InverseBondRestraint::InverseBondRestraint() + : ConcreteProperty(), + _k(0), _r0(0) +{ +} + +/** Construct to restrain the atom at index 'atom' to the specified position + * using the specified force constant and flat-bottom well-width + */ +InverseBondRestraint::InverseBondRestraint(qint64 atom0, qint64 atom1, + const SireUnits::Dimension::HarmonicBondConstant &k, + const SireUnits::Dimension::Length &r0) + : ConcreteProperty(), + _k(k), _r0(r0) +{ + if (atom0 == atom1) + throw SireError::invalid_arg(QObject::tr( + "You cannot create a bond restraint between identical atoms! %1-%2") + .arg(atom0) + .arg(atom1), + CODELOC); + + atms0 = QVector(1, atom0); + atms0.squeeze(); + + atms1 = QVector(1, atom1); + atms1.squeeze(); +} + +/** Construct to restrain the centroid of the atoms whose indicies are + * in 'atoms' to the specified position using the specified force constant + * and flat-bottom well width + */ +InverseBondRestraint::InverseBondRestraint(const QList &atoms0, + const QList &atoms1, + const SireUnits::Dimension::HarmonicBondConstant &k, + const SireUnits::Dimension::Length &r0) + : ConcreteProperty(), + _k(k), _r0(r0) +{ + if (atoms0.isEmpty() or atoms1.isEmpty()) + return; + + // remove duplicates + atms0.reserve(atoms0.count()); + + auto sorted = atoms0; + std::sort(sorted.begin(), sorted.end()); + + atms0.append(sorted.at(0)); + + for (const auto &atom : sorted) + { + if (atom != atms0.last()) + atms0.append(atom); + } + + atms0.squeeze(); + + // now the same for atoms1 + atms1.reserve(atoms1.count()); + + sorted = atoms1; + std::sort(sorted.begin(), sorted.end()); + + if (atms0.indexOf(sorted.at(0)) != -1) + throw SireError::invalid_arg(QObject::tr( + "You cannot have an overlap in atoms between the two groups. Atom " + "%1 appears in both!") + .arg(sorted.at(0)), + CODELOC); + + atms1.append(sorted.at(0)); + + for (const auto &atom : sorted) + { + if (atom != atms1.last()) + { + if (atms0.indexOf(atom) != -1) + throw SireError::invalid_arg(QObject::tr( + "You cannot have an overlap in atoms between the two groups. Atom " + "%1 appears in both!") + .arg(sorted.at(0)), + CODELOC); + + atms1.append(atom); + } + + atms1.squeeze(); + } +} + +/** Copy constructor */ +InverseBondRestraint::InverseBondRestraint(const InverseBondRestraint &other) + : ConcreteProperty(other), + atms0(other.atms0), atms1(other.atms1), _k(other._k), _r0(other._r0) +{ +} + +InverseBondRestraint::~InverseBondRestraint() +{ +} + +InverseBondRestraint &InverseBondRestraint::operator=(const InverseBondRestraint &other) +{ + if (this != &other) + { + atms0 = other.atms0; + atms1 = other.atms1; + _k = other._k; + _r0 = other._r0; + } + + return *this; +} + +bool InverseBondRestraint::operator==(const InverseBondRestraint &other) const +{ + return atms0 == other.atms0 and atms1 == other.atms1 and + _k == other._k and _r0 == other._r0; +} + +bool InverseBondRestraint::operator!=(const InverseBondRestraint &other) const +{ + return not operator==(other); +} + +InverseBondRestraints InverseBondRestraint::operator+(const InverseBondRestraint &other) const +{ + return InverseBondRestraints(*this) + other; +} + +InverseBondRestraints InverseBondRestraint::operator+(const InverseBondRestraints &other) const +{ + return InverseBondRestraints(*this) + other; +} + +const char *InverseBondRestraint::typeName() +{ + return QMetaType::typeName(qMetaTypeId()); +} + +const char *InverseBondRestraint::what() const +{ + return InverseBondRestraint::typeName(); +} + +InverseBondRestraint *InverseBondRestraint::clone() const +{ + return new InverseBondRestraint(*this); +} + +bool InverseBondRestraint::isNull() const +{ + return atms0.isEmpty() or atms1.isEmpty(); +} + +QString InverseBondRestraint::toString() const +{ + if (this->isNull()) + return QObject::tr("InverseBondRestraint::null"); + + else if (this->isAtomRestraint()) + { + return QString("InverseBondRestraint( %1 <=> %2, k=%3 : r0=%4 )") + .arg(this->atom0()) + .arg(this->atom1()) + .arg(_k.toString()) + .arg(_r0.toString()); + } + else + { + QStringList a0, a1; + + for (const auto &atom : atms0) + { + a0.append(QString::number(atom)); + } + + for (const auto &atom : atms1) + { + a1.append(QString::number(atom)); + } + + return QString("InverseBondRestraint( [%1] <=> [%2], k=%3 : r0=%4 )") + .arg(a0.join(", ")) + .arg(a1.join(", ")) + .arg(_k.toString()) + .arg(_r0.toString()); + } +} + +/** Return whether this is a single-atom restraint */ +bool InverseBondRestraint::isAtomRestraint() const +{ + return atms0.count() == 1 and atms1.count() == 1; +} + +/** Return whether this restraint acts on the centroid of a group + * of atoms */ +bool InverseBondRestraint::isCentroidRestraint() const +{ + return atms0.count() > 1 or atms1.count() > 1; +} + +/** Return the index of the atom if this is a single-atom restraint */ +qint64 InverseBondRestraint::atom0() const +{ + if (not this->isAtomRestraint()) + throw SireError::incompatible_error(QObject::tr( + "You cannot get the atom when this isn't a single-atom restraint!"), + CODELOC); + + return this->atms0.at(0); +} + +/** Return the index of the atom if this is a single-atom restraint */ +qint64 InverseBondRestraint::atom1() const +{ + if (not this->isAtomRestraint()) + throw SireError::incompatible_error(QObject::tr( + "You cannot get the atom when this isn't a single-atom restraint!"), + CODELOC); + + return this->atms1.at(0); +} + +/** Return the indexes of the atoms whose centroid is to be restrained */ +QVector InverseBondRestraint::atoms0() const +{ + if (not this->isCentroidRestraint()) + throw SireError::incompatible_error(QObject::tr( + "You cannot get the atoms when this isn't a centroid restraint!"), + CODELOC); + + return this->atms0; +} + +/** Return the indexes of the atoms whose centroid is to be restrained */ +QVector InverseBondRestraint::atoms1() const +{ + if (not this->isCentroidRestraint()) + throw SireError::incompatible_error(QObject::tr( + "You cannot get the atoms when this isn't a centroid restraint!"), + CODELOC); + + return this->atms1; +} + +/** Return the force constant for the restraint */ +SireUnits::Dimension::HarmonicBondConstant InverseBondRestraint::k() const +{ + return this->_k; +} + +/** Return the width of the harmonic bond. */ +SireUnits::Dimension::Length InverseBondRestraint::r0() const +{ + return this->_r0; +} + +/////// +/////// Implementation of InverseBondRestraints +/////// + +static const RegisterMetaType r_bndrests; + +QDataStream &operator<<(QDataStream &ds, const InverseBondRestraints &bndrests) +{ + writeHeader(ds, r_bndrests, 2); + + SharedDataStream sds(ds); + + sds << bndrests.r << bndrests.use_pbc + << static_cast(bndrests); + + return ds; +} + +QDataStream &operator>>(QDataStream &ds, InverseBondRestraints &bndrests) +{ + VersionID v = readHeader(ds, r_bndrests); + + if (v == 1) + { + SharedDataStream sds(ds); + + sds >> bndrests.r >> static_cast(bndrests); + } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> bndrests.r >> bndrests.use_pbc + >> static_cast(bndrests); + } + else + throw version_error(v, "1", r_bndrests, CODELOC); + + return ds; +} + +/** Null constructor */ +InverseBondRestraints::InverseBondRestraints() + : ConcreteProperty() +{ +} + +InverseBondRestraints::InverseBondRestraints(const QString &name) + : ConcreteProperty(name) +{ +} + +InverseBondRestraints::InverseBondRestraints(const InverseBondRestraint &restraint) + : ConcreteProperty() +{ + if (not restraint.isNull()) + r.append(restraint); +} + +InverseBondRestraints::InverseBondRestraints(const QList &restraints) + : ConcreteProperty() +{ + for (const auto &restraint : restraints) + { + if (not restraint.isNull()) + r.append(restraint); + } +} + +InverseBondRestraints::InverseBondRestraints(const QString &name, + const InverseBondRestraint &restraint) + : ConcreteProperty(name) +{ + if (not restraint.isNull()) + r.append(restraint); +} + +InverseBondRestraints::InverseBondRestraints(const QString &name, + const QList &restraints) + : ConcreteProperty(name) +{ + for (const auto &restraint : restraints) + { + if (not restraint.isNull()) + r.append(restraint); + } +} + +InverseBondRestraints::InverseBondRestraints(const InverseBondRestraints &other) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) +{ +} + +InverseBondRestraints::~InverseBondRestraints() +{ +} + +InverseBondRestraints &InverseBondRestraints::operator=(const InverseBondRestraints &other) +{ + r = other.r; + use_pbc = other.use_pbc; + Restraints::operator=(other); + return *this; +} + +bool InverseBondRestraints::operator==(const InverseBondRestraints &other) const +{ + return r == other.r and Restraints::operator==(other); +} + +bool InverseBondRestraints::operator!=(const InverseBondRestraints &other) const +{ + return not operator==(other); +} + +const char *InverseBondRestraints::typeName() +{ + return QMetaType::typeName(qMetaTypeId()); +} + +const char *InverseBondRestraints::what() const +{ + return InverseBondRestraints::typeName(); +} + +InverseBondRestraints *InverseBondRestraints::clone() const +{ + return new InverseBondRestraints(*this); +} + +QString InverseBondRestraints::toString() const +{ + if (this->isEmpty()) + return QObject::tr("InverseBondRestraints::null"); + + QStringList parts; + + const auto n = this->count(); + + if (n <= 10) + { + for (int i = 0; i < n; ++i) + { + parts.append(QObject::tr("%1: %2").arg(i).arg(this->r.at(i).toString())); + } + } + else + { + for (int i = 0; i < 5; ++i) + { + parts.append(QObject::tr("%1: %2").arg(i).arg(this->r.at(i).toString())); + } + + parts.append("..."); + + for (int i = n - 5; i < n; ++i) + { + parts.append(QObject::tr("%1: %2").arg(i).arg(this->r.at(i).toString())); + } + } + + return QObject::tr("InverseBondRestraints( name=%1, size=%2, use_pbc=%3\n%4\n)") + .arg(this->name()) + .arg(n) + .arg(this->use_pbc ? "true" : "false") + .arg(parts.join("\n")); +} + +/** Return whether or not this is empty */ +bool InverseBondRestraints::isEmpty() const +{ + return this->r.isEmpty(); +} + +/** Return whether or not this is empty */ +bool InverseBondRestraints::isNull() const +{ + return this->isEmpty(); +} + +/** Return the number of restraints */ +int InverseBondRestraints::nRestraints() const +{ + return this->r.count(); +} + +/** Return the number of restraints */ +int InverseBondRestraints::count() const +{ + return this->nRestraints(); +} + +/** Return the number of restraints */ +int InverseBondRestraints::size() const +{ + return this->nRestraints(); +} + +/** Return the number of atom restraints */ +int InverseBondRestraints::nAtomRestraints() const +{ + int n = 0; + + for (const auto &restraint : this->r) + { + n += int(restraint.isAtomRestraint()); + } + + return n; +} + +/** Return the number of centroid restraints */ +int InverseBondRestraints::nCentroidRestraints() const +{ + int n = 0; + + for (const auto &restraint : this->r) + { + n += int(restraint.isCentroidRestraint()); + } + + return n; +} + +/** Return whether or not there are any atom restraints */ +bool InverseBondRestraints::hasAtomRestraints() const +{ + for (const auto &restraint : this->r) + { + if (restraint.isAtomRestraint()) + return true; + } + + return false; +} + +/** Return whether or not there are any centroid restraints */ +bool InverseBondRestraints::hasCentroidRestraints() const +{ + for (const auto &restraint : this->r) + { + if (restraint.isCentroidRestraint()) + return true; + } + + return false; +} + +/** Return the ith restraint */ +const InverseBondRestraint &InverseBondRestraints::at(int i) const +{ + i = SireID::Index(i).map(this->r.count()); + + return this->r.at(i); +} + +/** Return the ith restraint */ +const InverseBondRestraint &InverseBondRestraints::operator[](int i) const +{ + return this->at(i); +} + +/** Return all of the restraints */ +QList InverseBondRestraints::restraints() const +{ + return this->r; +} + +/** Return all of the atom restraints */ +QList InverseBondRestraints::atomRestraints() const +{ + if (this->hasCentroidRestraints()) + { + QList ar; + + for (const auto &restraint : this->r) + { + if (restraint.isAtomRestraint()) + ar.append(restraint); + } + + return ar; + } + else + return this->restraints(); +} + +/** Return all of the centroid restraints */ +QList InverseBondRestraints::centroidRestraints() const +{ + if (this->hasAtomRestraints()) + { + QList cr; + + for (const auto &restraint : this->r) + { + if (restraint.isCentroidRestraint()) + cr.append(restraint); + } + + return cr; + } + else + return this->restraints(); +} + +/** Add a restraint onto the list */ +void InverseBondRestraints::add(const InverseBondRestraint &restraint) +{ + if (not restraint.isNull()) + this->r.append(restraint); +} + +/** Add a restraint onto the list */ +void InverseBondRestraints::add(const InverseBondRestraints &restraints) +{ + this->r += restraints.r; +} + +/** Add a restraint onto the list */ +InverseBondRestraints &InverseBondRestraints::operator+=(const InverseBondRestraint &restraint) +{ + this->add(restraint); + return *this; +} + +/** Add a restraint onto the list */ +InverseBondRestraints InverseBondRestraints::operator+(const InverseBondRestraint &restraint) const +{ + InverseBondRestraints ret(*this); + ret += restraint; + return *this; +} + +/** Add restraints onto the list */ +InverseBondRestraints &InverseBondRestraints::operator+=(const InverseBondRestraints &restraints) +{ + this->add(restraints); + return *this; +} + +/** Add restraints onto the list */ +InverseBondRestraints InverseBondRestraints::operator+(const InverseBondRestraints &restraints) const +{ + InverseBondRestraints ret(*this); + ret += restraints; + return *this; +} + +/** Set whether or not periodic boundary conditions are to be used */ +void InverseBondRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool InverseBondRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/inversebondrestraints.h b/corelib/src/libs/SireMM/inversebondrestraints.h new file mode 100644 index 000000000..1e47c06e9 --- /dev/null +++ b/corelib/src/libs/SireMM/inversebondrestraints.h @@ -0,0 +1,215 @@ +/********************************************\ + * + * Sire - Molecular Simulation Framework + * + * Copyright (C) 2023 Christopher Woods + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For full details of the license please see the COPYING file + * that should have come with this distribution. + * + * You can contact the authors via the website + * at https://sire.openbiosim.org + * +\*********************************************/ + +#ifndef SIREMM_INVERSEBONDRESTRAINTS_H +#define SIREMM_INVERSEBONDRESTRAINTS_H + +#include "restraints.h" + +#include "SireUnits/dimensions.h" +#include "SireUnits/generalunit.h" + +SIRE_BEGIN_HEADER + +namespace SireMM +{ + class InverseBondRestraint; + class InverseBondRestraints; +} + +SIREMM_EXPORT QDataStream &operator<<(QDataStream &, const SireMM::InverseBondRestraint &); +SIREMM_EXPORT QDataStream &operator>>(QDataStream &, SireMM::InverseBondRestraint &); + +SIREMM_EXPORT QDataStream &operator<<(QDataStream &, const SireMM::InverseBondRestraints &); +SIREMM_EXPORT QDataStream &operator>>(QDataStream &, SireMM::InverseBondRestraints &); + +namespace SireMM +{ + + /** This class represents a single bond restraint between any two + * atoms in a system (or between the centroids of any two groups + * of atoms in a system) + */ + class SIREMM_EXPORT InverseBondRestraint + : public SireBase::ConcreteProperty + { + friend QDataStream & ::operator<<(QDataStream &, const SireMM::InverseBondRestraint &); + friend QDataStream & ::operator>>(QDataStream &, SireMM::InverseBondRestraint &); + + public: + InverseBondRestraint(); + InverseBondRestraint(qint64 atom0, qint64 atom1, + const SireUnits::Dimension::HarmonicBondConstant &k, + const SireUnits::Dimension::Length &r0); + + InverseBondRestraint(const QList &atoms0, + const QList &atoms1, + const SireUnits::Dimension::HarmonicBondConstant &k, + const SireUnits::Dimension::Length &r0); + + InverseBondRestraint(const InverseBondRestraint &other); + + ~InverseBondRestraint(); + + InverseBondRestraint &operator=(const InverseBondRestraint &other); + + bool operator==(const InverseBondRestraint &other) const; + bool operator!=(const InverseBondRestraint &other) const; + + InverseBondRestraints operator+(const InverseBondRestraint &other) const; + InverseBondRestraints operator+(const InverseBondRestraints &other) const; + + static const char *typeName(); + const char *what() const; + + InverseBondRestraint *clone() const; + + QString toString() const; + + bool isNull() const; + + bool isAtomRestraint() const; + bool isCentroidRestraint() const; + + qint64 atom0() const; + qint64 atom1() const; + + QVector atoms0() const; + QVector atoms1() const; + + SireUnits::Dimension::HarmonicBondConstant k() const; + SireUnits::Dimension::Length r0() const; + + private: + /** The first set of atoms involved in the restraint */ + QVector atms0; + + /** The second set of atoms involved in the restraint */ + QVector atms1; + + /** The force constant */ + SireUnits::Dimension::HarmonicBondConstant _k; + + /** The equilibrium distance for the restraint */ + SireUnits::Dimension::Length _r0; + }; + + /** This class provides the information for a collection of bond + * restraints that can be added to a collection of molecues. Each + * restraint can act on a pair of particles or a pair of the + * centroids of two collections of particles. + * The restaints are spherically symmetric, and + * are simple harmonic potentials + */ + class SIREMM_EXPORT InverseBondRestraints + : public SireBase::ConcreteProperty + { + friend QDataStream & ::operator<<(QDataStream &, const SireMM::InverseBondRestraints &); + friend QDataStream & ::operator>>(QDataStream &, SireMM::InverseBondRestraints &); + + public: + InverseBondRestraints(); + InverseBondRestraints(const QString &name); + + InverseBondRestraints(const InverseBondRestraint &restraint); + InverseBondRestraints(const QList &restraints); + + InverseBondRestraints(const QString &name, + const InverseBondRestraint &restraint); + + InverseBondRestraints(const QString &name, + const QList &restraints); + + InverseBondRestraints(const InverseBondRestraints &other); + + ~InverseBondRestraints(); + + InverseBondRestraints &operator=(const InverseBondRestraints &other); + + bool operator==(const InverseBondRestraints &other) const; + bool operator!=(const InverseBondRestraints &other) const; + + static const char *typeName(); + const char *what() const; + + InverseBondRestraints *clone() const; + + QString toString() const; + + bool isEmpty() const; + bool isNull() const; + + int count() const; + int size() const; + int nRestraints() const; + + int nAtomRestraints() const; + int nCentroidRestraints() const; + + bool hasAtomRestraints() const; + bool hasCentroidRestraints() const; + + const InverseBondRestraint &at(int i) const; + const InverseBondRestraint &operator[](int i) const; + + QList restraints() const; + + QList atomRestraints() const; + QList centroidRestraints() const; + + void add(const InverseBondRestraint &restraint); + void add(const InverseBondRestraints &restraints); + + InverseBondRestraints &operator+=(const InverseBondRestraint &restraint); + InverseBondRestraints &operator+=(const InverseBondRestraints &restraints); + + InverseBondRestraints operator+(const InverseBondRestraint &restraint) const; + InverseBondRestraints operator+(const InverseBondRestraints &restraints) const; + + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + + private: + /** The actual list of restraints*/ + QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = false; + }; + +} + +Q_DECLARE_METATYPE(SireMM::InverseBondRestraint) +Q_DECLARE_METATYPE(SireMM::InverseBondRestraints) + +SIRE_EXPOSE_CLASS(SireMM::InverseBondRestraint) +SIRE_EXPOSE_CLASS(SireMM::InverseBondRestraints) + +SIRE_END_HEADER + +#endif diff --git a/corelib/src/libs/SireMM/morsepotentialrestraints.cpp b/corelib/src/libs/SireMM/morsepotentialrestraints.cpp index 78e28d887..1322e08b1 100644 --- a/corelib/src/libs/SireMM/morsepotentialrestraints.cpp +++ b/corelib/src/libs/SireMM/morsepotentialrestraints.cpp @@ -362,11 +362,11 @@ static const RegisterMetaType r_morsepotentialrests; QDataStream &operator<<(QDataStream &ds, const MorsePotentialRestraints &morser_morsepotentialrests) { - writeHeader(ds, r_morsepotentialrests, 1); + writeHeader(ds, r_morsepotentialrests, 2); SharedDataStream sds(ds); - sds << morser_morsepotentialrests.r + sds << morser_morsepotentialrests.r << morser_morsepotentialrests.use_pbc << static_cast(morser_morsepotentialrests); return ds; @@ -382,8 +382,15 @@ QDataStream &operator>>(QDataStream &ds, MorsePotentialRestraints &morser_morsep sds >> morser_morsepotentialrests.r >> static_cast(morser_morsepotentialrests); } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> morser_morsepotentialrests.r >> morser_morsepotentialrests.use_pbc + >> static_cast(morser_morsepotentialrests); + } else - throw version_error(v, "1", r_morsepotentialrests, CODELOC); + throw version_error(v, "1,2", r_morsepotentialrests, CODELOC); return ds; } @@ -436,7 +443,7 @@ MorsePotentialRestraints::MorsePotentialRestraints(const QString &name, } MorsePotentialRestraints::MorsePotentialRestraints(const MorsePotentialRestraints &other) - : ConcreteProperty(other), r(other.r) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) { } @@ -447,13 +454,14 @@ MorsePotentialRestraints::~MorsePotentialRestraints() MorsePotentialRestraints &MorsePotentialRestraints::operator=(const MorsePotentialRestraints &other) { r = other.r; + use_pbc = other.use_pbc; Restraints::operator=(other); return *this; } bool MorsePotentialRestraints::operator==(const MorsePotentialRestraints &other) const { - return r == other.r and Restraints::operator==(other); + return r == other.r and Restraints::operator==(other) and use_pbc == other.use_pbc; } bool MorsePotentialRestraints::operator!=(const MorsePotentialRestraints &other) const @@ -507,7 +515,11 @@ QString MorsePotentialRestraints::toString() const } } - return QObject::tr("MorsePotentialRestraints( name=%1, size=%2\n%3\n)").arg(this->name()).arg(n).arg(parts.join("\n")); + return QObject::tr("MorsePotentialRestraints( name=%1, size=%2, use_pbc=%3\n%4\n)") + .arg(this->name()) + .arg(n) + .arg(this->use_pbc ? "use_pbc=True" : "use_pbc=False") + .arg(parts.join("\n")); } /** Return whether or not this is empty */ @@ -689,4 +701,16 @@ MorsePotentialRestraints MorsePotentialRestraints::operator+(const MorsePotentia MorsePotentialRestraints ret(*this); ret += restraints; return *this; -} \ No newline at end of file +} + +/** Set whether or not periodic boundary conditions are to be used */ +void MorsePotentialRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool MorsePotentialRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/morsepotentialrestraints.h b/corelib/src/libs/SireMM/morsepotentialrestraints.h index 49add6127..858b5396f 100644 --- a/corelib/src/libs/SireMM/morsepotentialrestraints.h +++ b/corelib/src/libs/SireMM/morsepotentialrestraints.h @@ -193,9 +193,15 @@ namespace SireMM MorsePotentialRestraints operator+(const MorsePotentialRestraint &restraint) const; MorsePotentialRestraints operator+(const MorsePotentialRestraints &restraints) const; + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + private: /** The actual list of restraints*/ QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = false; }; } diff --git a/corelib/src/libs/SireMM/positionalrestraints.cpp b/corelib/src/libs/SireMM/positionalrestraints.cpp index 13a53f989..101ce0f57 100644 --- a/corelib/src/libs/SireMM/positionalrestraints.cpp +++ b/corelib/src/libs/SireMM/positionalrestraints.cpp @@ -289,11 +289,11 @@ static const RegisterMetaType r_posrests; QDataStream &operator<<(QDataStream &ds, const PositionalRestraints &posrests) { - writeHeader(ds, r_posrests, 1); + writeHeader(ds, r_posrests, 2); SharedDataStream sds(ds); - sds << posrests.r + sds << posrests.r << posrests.use_pbc << static_cast(posrests); return ds; @@ -309,8 +309,15 @@ QDataStream &operator>>(QDataStream &ds, PositionalRestraints &posrests) sds >> posrests.r >> static_cast(posrests); } + else if (v == 2) + { + SharedDataStream sds(ds); + + sds >> posrests.r >> posrests.use_pbc + >> static_cast(posrests); + } else - throw version_error(v, "1", r_posrests, CODELOC); + throw version_error(v, "1,2", r_posrests, CODELOC); return ds; } @@ -363,7 +370,7 @@ PositionalRestraints::PositionalRestraints(const QString &name, } PositionalRestraints::PositionalRestraints(const PositionalRestraints &other) - : ConcreteProperty(other), r(other.r) + : ConcreteProperty(other), r(other.r), use_pbc(other.use_pbc) { } @@ -374,13 +381,14 @@ PositionalRestraints::~PositionalRestraints() PositionalRestraints &PositionalRestraints::operator=(const PositionalRestraints &other) { r = other.r; + use_pbc = other.use_pbc; Restraints::operator=(other); return *this; } bool PositionalRestraints::operator==(const PositionalRestraints &other) const { - return r == other.r and Restraints::operator==(other); + return r == other.r and Restraints::operator==(other) and use_pbc == other.use_pbc; } bool PositionalRestraints::operator!=(const PositionalRestraints &other) const @@ -434,7 +442,11 @@ QString PositionalRestraints::toString() const } } - return QObject::tr("PositionalRestraints( name=%1, size=%2\n%3\n)").arg(this->name()).arg(n).arg(parts.join("\n")); + return QObject::tr("PositionalRestraints( name=%1, size=%2, use_pbc=%3\n%4\n)") + .arg(this->name()) + .arg(n) + .arg(this->use_pbc ? "true" : "false") + .arg(parts.join("\n")); } /** Return whether or not this is empty */ @@ -617,3 +629,15 @@ PositionalRestraints PositionalRestraints::operator+(const PositionalRestraints ret += restraints; return *this; } + +/** Set whether or not periodic boundary conditions are to be used */ +void PositionalRestraints::setUsesPbc(bool use_pbc) +{ + this->use_pbc = use_pbc; +} + +/** Return whether or not periodic boundary conditions are to be used */ +bool PositionalRestraints::usesPbc() const +{ + return this->use_pbc; +} diff --git a/corelib/src/libs/SireMM/positionalrestraints.h b/corelib/src/libs/SireMM/positionalrestraints.h index abda2d9d7..6aa6f550b 100644 --- a/corelib/src/libs/SireMM/positionalrestraints.h +++ b/corelib/src/libs/SireMM/positionalrestraints.h @@ -191,9 +191,15 @@ namespace SireMM PositionalRestraints operator+(const PositionalRestraint &restraint) const; PositionalRestraints operator+(const PositionalRestraints &restraints) const; + void setUsesPbc(bool use_pbc); + bool usesPbc() const; + private: /** The actual list of restraints*/ QList r; + + /** Whether the restraints use periodic boundary conditions */ + bool use_pbc = true; }; } diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 2d225b595..1e23da33a 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -38,6 +38,12 @@ organisation on `GitHub `__. * Add support for writing trajectory frames to user-defined file names. +* Add inverse distance restraint to keep atoms apart during OpenMM dyanmics. + +* Allow user to specify whether OpenMM restraints use periodic boundary conditions. + +* Allow user to specify the OpenCL platform index when creating an OpenMM context. + `2025.2.0 `__ - October 2025 -------------------------------------------------------------------------------------------- diff --git a/doc/source/cheatsheet/openmm.rst b/doc/source/cheatsheet/openmm.rst index 4f27fccbc..9f46bdd04 100644 --- a/doc/source/cheatsheet/openmm.rst +++ b/doc/source/cheatsheet/openmm.rst @@ -168,6 +168,9 @@ Available keys and allowable values are listed below. | lambda | The λ-value at which to set up the system (assuming this | | | contains any perturbable molecules or restraints) | +------------------------------+----------------------------------------------------------+ +| opencl_platform_index | The OpenCL platform index to use if the multiple OpenCL | +| | implementations are available. | ++------------------------------+----------------------------------------------------------+ | perturbable_constraint | The constraint to use for perturbable molecules. These | | | are the same options as ``constraint``, and will | | | override that choice for perturbable molecules if this | diff --git a/doc/source/tutorial/part06/03_restraints.rst b/doc/source/tutorial/part06/03_restraints.rst index 8b4c0766f..7a43feeea 100644 --- a/doc/source/tutorial/part06/03_restraints.rst +++ b/doc/source/tutorial/part06/03_restraints.rst @@ -20,6 +20,12 @@ needs to be passed to OpenMM to add the restraints to the system. ``k`` values supplied to the restraints functions are half the value of the force constants. +.. note:: + + Where appropriate, whether periodic boundary conditions are applied to the restraints + can be controlled via the ``use_pbc`` keyword argument. By default, this is set to + ``True`` for positional and distance restraints, and ``False`` for all bonded restraints. + Positional Restraints --------------------- @@ -156,7 +162,7 @@ SireMol::SelectorM( size=358 ) RMSD Restraints ---------------------- +--------------- RMSD restraints are similar to positional restraints, but rather than atoms being restrained with respect to fixed positions in space, they are restrained relative diff --git a/src/sire/mm/__init__.py b/src/sire/mm/__init__.py index 1f68451ae..de5dec3ca 100644 --- a/src/sire/mm/__init__.py +++ b/src/sire/mm/__init__.py @@ -9,6 +9,8 @@ "Bond", "BondRestraint", "BondRestraints", + "InverseBondRestraint", + "InverseBondRestraints", "CMAPParameter", "Dihedral", "Improper", @@ -46,6 +48,9 @@ BondRestraint = _MM.BondRestraint BondRestraints = _MM.BondRestraints +InverseBondRestraint = _MM.InverseBondRestraint +InverseBondRestraints = _MM.InverseBondRestraints + BoreschRestraint = _MM.BoreschRestraint BoreschRestraints = _MM.BoreschRestraints diff --git a/src/sire/restraints/__init__.py b/src/sire/restraints/__init__.py index 7322319cb..834f33080 100644 --- a/src/sire/restraints/__init__.py +++ b/src/sire/restraints/__init__.py @@ -1,12 +1,14 @@ __all__ = [ "angle", "positional", - "rmsd", "bond", "dihedral", "distance", - "morse_potential", "boresch", + "inverse_bond", + "inverse_distance", + "rmsd", + "morse_potential", "get_standard_state_correction", ] @@ -16,6 +18,8 @@ boresch, dihedral, distance, + inverse_bond, + inverse_distance, positional, morse_potential, rmsd, diff --git a/src/sire/restraints/_restraints.py b/src/sire/restraints/_restraints.py index b20f5f782..cc443facc 100644 --- a/src/sire/restraints/_restraints.py +++ b/src/sire/restraints/_restraints.py @@ -4,6 +4,8 @@ "bond", "dihedral", "distance", + "inverse_bond", + "inverse_distance", "morse_potential", "positional", "rmsd", @@ -22,7 +24,7 @@ def _to_atoms(mols, atoms): return selection_to_atoms(mols, atoms) -def angle(mols, atoms, theta0=None, ktheta=None, name=None, map=None): +def angle(mols, atoms, theta0=None, ktheta=None, use_pbc=None, name=None, map=None): """ Create a set of angle restraints from all of the atoms in 'atoms' where all atoms are contained in the container 'mols', using the @@ -52,6 +54,10 @@ def angle(mols, atoms, theta0=None, ktheta=None, name=None, map=None): will be measured from the current coordinates of the atoms. Default is None. + use_pbc : bool, optional + Whether to use periodic boundary conditions when calculating + the angle. Default is None. + Returns ------- AngleRestraints : SireMM::AngleRestraints @@ -67,8 +73,15 @@ def angle(mols, atoms, theta0=None, ktheta=None, name=None, map=None): map_dict = map.to_dict() ktheta = ktheta if ktheta is not None else map_dict.get("ktheta", None) theta0 = theta0 if theta0 is not None else map_dict.get("theta0", None) + use_pbc = use_pbc if use_pbc is not None else map_dict.get("use_pbc", None) name = name if name is not None else map_dict.get("name", None) + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = False + atoms = _to_atoms(mols, atoms) if len(atoms) != 3: @@ -109,6 +122,10 @@ def angle(mols, atoms, theta0=None, ktheta=None, name=None, map=None): restraints = AngleRestraints(name=name) restraints.add(AngleRestraint(mols.find(atoms), theta0, ktheta)) + + # Set the use_pbc flag. + restraints.set_uses_pbc(use_pbc) + return restraints @@ -122,6 +139,7 @@ def boresch( r0=None, theta0=None, phi0=None, + use_pbc=None, name=None, map=None, temperature=u("298 K"), @@ -196,6 +214,10 @@ def boresch( list, then this should be a list of length 3 containing the equilibrium angles for the three torsion restraints. Default is None. + use_pbc : bool, optional + Whether to use periodic boundary conditions when calculating + the distance, angles, and torsions. Default is None. + name : str, optional The name of the restraint. If None, then a default name will be used. Default is None. @@ -250,6 +272,7 @@ def boresch( r0 = r0 if r0 is not None else map_dict.get("r0", None) theta0 = theta0 if theta0 is not None else map_dict.get("theta0", None) phi0 = phi0 if phi0 is not None else map_dict.get("phi0", None) + use_pbc = use_pbc if use_pbc is not None else map_dict.get("use_pbc", None) name = name if name is not None else map_dict.get("name", None) temperature = ( temperature if temperature is not None else map_dict.get("temperature", None) @@ -267,6 +290,12 @@ def boresch( f"ligand atoms were provided." ) + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = False + from .. import measure default_distance_k = u("5 kcal mol-1 A-2") @@ -413,9 +442,14 @@ def boresch( ) if name is None: - return BoreschRestraints(b) + b = BoreschRestraints(b) else: - return BoreschRestraints(name, b) + b = BoreschRestraints(name, b) + + # Set the use_pbc flag. + b._use_pbc = use_pbc + + return b def _check_stability_boresch_restraint(restraint_components, temperature=u("298 K")): @@ -471,7 +505,7 @@ def _check_stability_boresch_restraint(restraint_components, temperature=u("298 ) -def dihedral(mols, atoms, phi0=None, kphi=None, name=None, map=None): +def dihedral(mols, atoms, phi0=None, kphi=None, use_pbc=None, name=None, map=None): """ Create a set of dihedral restraints from all of the atoms in 'atoms' where all atoms are contained in the container 'mols', using the @@ -501,6 +535,10 @@ def dihedral(mols, atoms, phi0=None, kphi=None, name=None, map=None): will be measured from the current coordinates of the atoms. Default is None. + use_pbc : bool, optional + Whether to use periodic boundary conditions when calculating + the dihedral. Default is None. + Returns ------- DihedralRestraints : SireMM::DihedralRestraints @@ -516,6 +554,7 @@ def dihedral(mols, atoms, phi0=None, kphi=None, name=None, map=None): map_dict = map.to_dict() kphi = kphi if kphi is not None else map_dict.get("kphi", None) phi0 = phi0 if phi0 is not None else map_dict.get("phi0", None) + use_pbc = use_pbc if use_pbc is not None else map_dict.get("use_pbc", None) name = name if name is not None else map_dict.get("name", None) atoms = _to_atoms(mols, atoms) @@ -526,6 +565,12 @@ def dihedral(mols, atoms, phi0=None, kphi=None, name=None, map=None): f"whereas {len(atoms)} atoms were provided." ) + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = False + from .. import measure if kphi is None: @@ -558,10 +603,14 @@ def dihedral(mols, atoms, phi0=None, kphi=None, name=None, map=None): restraints = DihedralRestraints(name=name) restraints.add(DihedralRestraint(mols.find(atoms), phi0, kphi)) + + # Set the use_pbc flag. + restraints.set_uses_pbc(use_pbc) + return restraints -def distance(mols, atoms0, atoms1, r0=None, k=None, name=None, map=None): +def distance(mols, atoms0, atoms1, r0=None, k=None, use_pbc=None, name=None, map=None): """ Create a set of distance restraints from all of the atoms in 'atoms0' to all of the atoms in 'atoms1' where all atoms are @@ -598,6 +647,12 @@ def distance(mols, atoms0, atoms1, r0=None, k=None, name=None, map=None): atoms0 = _to_atoms(mols, atoms0) atoms1 = _to_atoms(mols, atoms1) + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = True + if atoms0.is_empty() or atoms1.is_empty(): raise ValueError("We need at least one atom in each group") @@ -662,6 +717,9 @@ def distance(mols, atoms0, atoms1, r0=None, k=None, name=None, map=None): restraints.add(BondRestraint(idxs0[0], idxs1[0], ik, ir0)) + # Set the use_pbc flag. + restraints.set_uses_pbc(use_pbc) + return restraints @@ -672,6 +730,7 @@ def morse_potential( r0=None, k=None, de=None, + use_pbc=None, name=None, auto_parametrise=False, map=None, @@ -719,6 +778,10 @@ def morse_potential( The well depth (dissociation energy) for the Morse potential. Default is 100 kcal mol-1. + use_pbc : bool, optional + Whether to use periodic boundary conditions when calculating + the distance. Default is None. + name : str, optional The name of the restraint. Default is None. @@ -749,6 +812,12 @@ def morse_potential( map = create_map(map) + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = False + if auto_parametrise is False: if atoms0 is None or atoms1 is None: raise ValueError( @@ -898,18 +967,146 @@ def morse_potential( restraints.add(MorsePotentialRestraint(idxs0[0], idxs1[0], ik, ir0, de)) + # Set the use_pbc flag. + restraints.set_uses_pbc(use_pbc) + return restraints -def bond(*args, **kwargs): +def bond(*args, use_pbc=False, **kwargs): """ Synonym for distance(), as a bond restraint is treated the same as a distance restraint """ - return distance(*args, **kwargs) + return distance(*args, use_pbc=use_pbc, **kwargs) -def positional(mols, atoms, k=None, r0=None, position=None, name=None, map=None): +def inverse_distance( + mols, atoms0, atoms1, r0=None, k=None, use_pbc=None, name=None, map=None +): + """ + Create a set of inverse distance restraints from all of the atoms in 'atoms0' + to all of the atoms in 'atoms1' where all atoms are + contained in the container 'mols', using the + passed values of 'k' and radius r0. + Note that 'k' corresponds to half the force constant, because + the restraint energy is defined as k*(r - r0)**2 (hence the force is + defined as 2*k*(r-r0)). + + These restraints will be per atom-atom distance. If a list of k and/or r0 + values are passed, then different values could be used for + different atom-atom distances (assuming the same number as the number of + atom-atom distances). Otherwise, all atom-atom distances will use the + same parameters. + + If r0 is None, then the current atom-atom distance for + each atom-atom pair will be used as the equilibium value. + + If k is None, then a default value of 150 kcal mol-1 A-2 will be used + """ + from .. import u + from ..base import create_map + from ..mm import InverseBondRestraint, InverseBondRestraints + + map = create_map(map) + + if k is None: + k = [u("150 kcal mol-1 A-2")] + elif type(k) is list: + k = [u(x) for x in k] + else: + k = [u(k)] + + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = True + + atoms0 = _to_atoms(mols, atoms0) + atoms1 = _to_atoms(mols, atoms1) + + if atoms0.is_empty() or atoms1.is_empty(): + raise ValueError("We need at least one atom in each group") + + while len(atoms0) < len(atoms1): + atoms0 += atoms0[-1] + + while len(atoms1) < len(atoms0): + atoms1 += atoms1[-1] + + if r0 is None: + # calculate all of the current distances + from .. import measure + + r0 = [] + for atom0, atom1 in zip(atoms0, atoms1): + r0.append(measure(atom0, atom1)) + elif type(r0) is list: + r0 = [u(x) for x in r0] + else: + r0 = [u(r0)] + + mols = mols.atoms() + + if name is None: + restraints = InverseBondRestraints() + else: + restraints = InverseBondRestraints(name=name) + + for i, (atom0, atom1) in enumerate(zip(atoms0, atoms1)): + idxs0 = mols.find(atom0) + idxs1 = mols.find(atom1) + + if type(idxs0) is int: + idxs0 = [idxs0] + + if type(idxs1) is int: + idxs1 = [idxs1] + + if len(idxs0) == 0: + raise KeyError( + f"Could not find atom {atom0} in the molecules. Please ensure " + "that 'mols' contains all of that atoms, or else we can't " + "add the positional restraints." + ) + + if len(idxs1) == 0: + raise KeyError( + f"Could not find atom {atom1} in the molecules. Please ensure " + "that 'mols' contains all of that atoms, or else we can't " + "add the positional restraints." + ) + + if i < len(k): + ik = k[i] + else: + ik = k[-1] + + if i < len(r0): + ir0 = r0[i] + else: + ir0 = r0[-1] + + restraints.add(InverseBondRestraint(idxs0[0], idxs1[0], ik, ir0)) + + # Set the use_pbc flag. + restraints.set_uses_pbc(use_pbc) + + return restraints + + +def inverse_bond(*args, use_pbc=False, **kwargs): + """ + Synonym for distance(), as a bond restraint is treated the same + as a distance restraint + """ + return inverse_distance(*args, use_pbc=use_pbc, **kwargs) + + +def positional( + mols, atoms, k=None, r0=None, position=None, use_pbc=None, name=None, map=None +): """ Create a set of position restraints for the atoms specified in 'atoms' that are contained in the container 'mols', using the @@ -950,6 +1147,12 @@ def positional(mols, atoms, k=None, r0=None, position=None, name=None, map=None) else: r0 = [u(r0)] + if use_pbc is not None: + if not isinstance(use_pbc, bool): + raise ValueError("'use_pbc' must be of type 'bool'") + else: + use_pbc = True + atoms = _to_atoms(mols, atoms) mols = mols.atoms() @@ -999,6 +1202,9 @@ def positional(mols, atoms, k=None, r0=None, position=None, name=None, map=None) else: restraints.add(PositionalRestraint(idxs[0], position[i], ik, ir0)) + # Set the use_pbc flag. + restraints.set_uses_pbc(use_pbc) + return restraints diff --git a/tests/convert/test_openmm_restraints.py b/tests/convert/test_openmm_restraints.py index c7dcd8bf7..f8bcd1aeb 100644 --- a/tests/convert/test_openmm_restraints.py +++ b/tests/convert/test_openmm_restraints.py @@ -60,7 +60,8 @@ def test_openmm_distance_restraints(ala_mols, openmm_platform): # check that we get the same result using bond restraints restraints2 = sr.restraints.bond( - mols, atoms0=mols[0][0], atoms1=mols[-1][0], r0="5A" + mols, atoms0=mols[0][0], atoms1=mols[-1][0], r0="5A", + use_pbc=True ) assert len(restraints2) == 1 @@ -247,3 +248,64 @@ def test_openmm_named_restraints(ala_mols, openmm_platform): d.set_lambda(2.0 / 3.0) assert d.current_potential_energy().value() == pytest.approx(nrg_0.value(), 1e-6) + + +@pytest.mark.skipif( + "openmm" not in sr.convert.supported_formats(), + reason="openmm support is not available", +) +@pytest.mark.parametrize( + "restraint,default_pbc", + [ + ("distance", True), + ("bond", False), + ], +) +def test_openmm_restraints_pbc(ala_mols, restraint, default_pbc, openmm_platform): + mols = ala_mols + + # get the restraint class + restraint_class = getattr(sr.restraints, restraint) + + # create a distance restraint between the first and last atom + restraints = restraint_class( + mols, + atoms0=mols[0][0], + atoms1=mols[-1][0], + r0="5A", + ) + + # make sure the _use_pbc flag is set to the default value + assert restraints.uses_pbc() == default_pbc + + # create a dynamics object + d = mols.dynamics(restraints=restraints, platform=openmm_platform) + + # find the restraint force + for force in d.context().getSystem().getForces(): + if force.getName() == "BondRestraintForce": + restraint_force = force + break + + # check that the force is using periodic boundary conditions + assert restraint_force.usesPeriodicBoundaryConditions() == default_pbc + + # now create a distance restraint with use_pbc set to the non-default value + restraints = restraint_class( + mols, atoms0=mols[0][0], atoms1=mols[-1][0], r0="5A", use_pbc=not default_pbc + ) + + # make sure the _use_pbc flag is set to False + assert restraints.uses_pbc() == (not default_pbc) + + # create a dynamics object + d = mols.dynamics(restraints=restraints, platform=openmm_platform) + + # find the restraint force + for force in d.context().getSystem().getForces(): + if force.getName() == "BondRestraintForce": + restraint_force = force + break + + # check that the force is not using periodic boundary conditions + assert restraint_force.usesPeriodicBoundaryConditions() == (not default_pbc) diff --git a/tests/io/test_pdb2.py b/tests/io/test_pdb2.py index f5188caa3..526268aae 100644 --- a/tests/io/test_pdb2.py +++ b/tests/io/test_pdb2.py @@ -2,6 +2,7 @@ import sire as sr import tempfile + def test_pdb_space(): """ Test that we can parse CRYST1 records in a PDB file and that they diff --git a/wrapper/Convert/SireOpenMM/lambdalever.cpp b/wrapper/Convert/SireOpenMM/lambdalever.cpp index 4eea6f279..8651e2951 100644 --- a/wrapper/Convert/SireOpenMM/lambdalever.cpp +++ b/wrapper/Convert/SireOpenMM/lambdalever.cpp @@ -2088,9 +2088,9 @@ void _update_restraint_in_context(OpenMM::CustomCVForce *ff, double rho, // First global param corresponds to rho. double current_rho = context.getParameter(rho_name); if (current_rho == rho) - return; + return; - // Update the value of rho + // Update the value of rho context.setParameter(rho_name, rho); ff->updateParametersInContext(context); @@ -2104,7 +2104,10 @@ void LambdaLever::updateRestraintInContext(OpenMM::Force &ff, double rho, // what is the type of this force...? const auto ff_type = ff.getName(); - if (ff_type == "BondRestraintForce" or ff_type == "PositionalRestraintForce" or ff_type == "MorsePotentialRestraintForce") + if (ff_type == "BondRestraintForce" or + ff_type == "PositionalRestraintForce" or + ff_type == "MorsePotentialRestraintForce" or + ff_type == "InverseBondRestraintForce") { _update_restraint_in_context( dynamic_cast(&ff), diff --git a/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp b/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp index 85d79657f..23c75b7f2 100644 --- a/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp +++ b/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp @@ -24,6 +24,7 @@ #include "SireMM/anglerestraints.h" #include "SireMM/atomljs.h" #include "SireMM/bondrestraints.h" +#include "SireMM/inversebondrestraints.h" #include "SireMM/boreschrestraints.h" #include "SireMM/dihedralrestraints.h" #include "SireMM/morsepotentialrestraints.h" @@ -133,7 +134,7 @@ void _add_boresch_restraints(const SireMM::BoreschRestraints &restraints, restraintff->addPerBondParameter("kphi_C"); restraintff->addPerBondParameter("phi0_C"); - restraintff->setUsesPeriodicBoundaryConditions(true); + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); lambda_lever.addRestraintIndex(restraints.name(), system.addForce(restraintff)); @@ -220,7 +221,7 @@ void _add_bond_restraints(const SireMM::BondRestraints &restraints, restraintff->addPerBondParameter("k"); restraintff->addPerBondParameter("r0"); - restraintff->setUsesPeriodicBoundaryConditions(true); + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); lambda_lever.addRestraintIndex(restraints.name(), system.addForce(restraintff)); @@ -259,6 +260,74 @@ void _add_bond_restraints(const SireMM::BondRestraints &restraints, } } +void _add_inverse_bond_restraints(const SireMM::InverseBondRestraints &restraints, + OpenMM::System &system, LambdaLever &lambda_lever, + int natoms) +{ + if (restraints.isEmpty()) + return; + + if (restraints.hasCentroidRestraints()) + { + throw SireError::unsupported(QObject::tr( + "Centroid bond restraints aren't yet supported..."), + CODELOC); + } + + const auto energy_expression = QString( + "rho*k*delta*delta*step;" + "delta=(r-r0);" + "step=max(0,min(1,(r0 - r)))") + .toStdString(); + + auto *restraintff = new OpenMM::CustomBondForce(energy_expression); + restraintff->setName("InverseBondRestraintForce"); + + restraintff->addPerBondParameter("rho"); + restraintff->addPerBondParameter("k"); + restraintff->addPerBondParameter("r0"); + + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); + + lambda_lever.addRestraintIndex(restraints.name(), + system.addForce(restraintff)); + + const auto atom_restraints = restraints.atomRestraints(); + + const double internal_to_nm = (1 * SireUnits::angstrom).to(SireUnits::nanometer); + const double internal_to_k = (1 * SireUnits::kcal_per_mol / (SireUnits::angstrom2)).to(SireUnits::kJ_per_mol / (SireUnits::nanometer2)); + + auto cljff = lambda_lever.getForce("clj", system); + + std::vector custom_params = {1.0, 0.0, 0.0}; + + for (const auto &restraint : atom_restraints) + { + int atom0_index = restraint.atom0(); + int atom1_index = restraint.atom1(); + + if (atom0_index < 0 or atom0_index >= natoms) + throw SireError::invalid_index(QObject::tr( + "Invalid particle index! %1 from %2") + .arg(atom0_index) + .arg(natoms), + CODELOC); + + if (atom1_index < 0 or atom1_index >= natoms) + throw SireError::invalid_index(QObject::tr( + "Invalid particle index! %1 from %2") + .arg(atom1_index) + .arg(natoms), + CODELOC); + + custom_params[0] = 1.0; // rho - always equal to 1 (scaled by lever) + custom_params[1] = restraint.k().value() * internal_to_k; // k + custom_params[2] = restraint.r0().value() * internal_to_nm; // rb + + restraintff->addBond(atom0_index, atom1_index, custom_params); + } +} + /** Add all of the morse potential restraints from 'restraints' to the passed * system, which is acted on by the passed LambdaLever. */ @@ -296,7 +365,7 @@ void _add_morse_potential_restraints(const SireMM::MorsePotentialRestraints &res restraintff->addPerBondParameter("r0"); restraintff->addPerBondParameter("de"); - restraintff->setUsesPeriodicBoundaryConditions(true); + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); lambda_lever.addRestraintIndex(restraints.name(), system.addForce(restraintff)); @@ -370,7 +439,7 @@ void _add_positional_restraints(const SireMM::PositionalRestraints &restraints, restraintff->addPerBondParameter("k"); restraintff->addPerBondParameter("rb"); - restraintff->setUsesPeriodicBoundaryConditions(true); + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); lambda_lever.addRestraintIndex(restraints.name(), system.addForce(restraintff)); @@ -600,7 +669,7 @@ void _add_angle_restraints(const SireMM::AngleRestraints &restraints, restraintff->addPerAngleParameter("k"); restraintff->addPerAngleParameter("theta0"); - restraintff->setUsesPeriodicBoundaryConditions(true); + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); lambda_lever.addRestraintIndex(restraints.name(), system.addForce(restraintff)); @@ -663,7 +732,7 @@ void _add_dihedral_restraints(const SireMM::DihedralRestraints &restraints, restraintff->addPerTorsionParameter("k"); restraintff->addPerTorsionParameter("theta0"); - restraintff->setUsesPeriodicBoundaryConditions(true); + restraintff->setUsesPeriodicBoundaryConditions(restraints.usesPbc()); lambda_lever.addRestraintIndex(restraints.name(), system.addForce(restraintff)); @@ -2057,6 +2126,11 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, _add_bond_restraints(prop.read().asA(), system, lambda_lever, start_index); } + else if (prop.read().isA()) + { + _add_inverse_bond_restraints(prop.read().asA(), + system, lambda_lever, start_index); + } else if (prop.read().isA()) { _add_boresch_restraints(prop.read().asA(), @@ -2064,6 +2138,31 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, } } } + if (map.specified("coalchemical_restraints")) + { + // All restraints are provided via the "coalchemical_restraints" key in the map. + // This should either be a single Restraints object, or a + // PropertyList - the easiest thing is to turn this into a + // PropertyList first + auto all_restraints = map["coalchemical_restraints"].value().asAnArray(); + + // loop over all of the restraints groups and add them + for (const auto &prop : all_restraints.toList()) + { + if (not prop.read().isA()) + throw SireError::invalid_cast(QObject::tr( + "Cannot convert an object of type %1 to a SireMM::Restraints") + .arg(prop.read().what()), + CODELOC); + + // we now need to choose what to do based on the type of restraint... + if (prop.read().isA()) + { + _add_inverse_bond_restraints(prop.read().asA(), + system, lambda_lever, start_index); + } + } + } /// /// Stage 8 - Copy across the coordinates and velocities diff --git a/wrapper/Convert/__init__.py b/wrapper/Convert/__init__.py index 34e706248..a68325e20 100644 --- a/wrapper/Convert/__init__.py +++ b/wrapper/Convert/__init__.py @@ -471,6 +471,20 @@ def sire_to_openmm(mols, map): usecpu = int(map["cpu_pme"].value().as_boolean()) platform.setPropertyDefaultValue("UseCpuPme", str(usecpu).lower()) + if "OpenCLPlatformIndex" in supported_properties and map.specified( + "opencl_platform_index" + ): + try: + opencl_platform_index = ( + map["opencl_platform_index"].value().as_integer() + ) + except Exception: + opencl_platform_index = map["opencl_platform_index"].source() + + platform.setPropertyDefaultValue( + "OpenCLPlatformIndex", str(opencl_platform_index) + ) + try: from ._sommcontext import SOMMContext diff --git a/wrapper/MM/AngleRestraints.pypp.cpp b/wrapper/MM/AngleRestraints.pypp.cpp index 13bb30886..23f5c6b08 100644 --- a/wrapper/MM/AngleRestraints.pypp.cpp +++ b/wrapper/MM/AngleRestraints.pypp.cpp @@ -98,6 +98,18 @@ void register_AngleRestraints_class(){ , bp::release_gil_policy() , "Return the number of restraints" ); + } + { //::SireMM::AngleRestraints::usesPbc + + typedef bool ( ::SireMM::AngleRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::AngleRestraints::usesPbc ); + + AngleRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::AngleRestraints::isEmpty @@ -176,6 +188,19 @@ void register_AngleRestraints_class(){ , bp::release_gil_policy() , "Return all of the restraints" ); + } + { //::SireMM::AngleRestraints::setUsesPbc + + typedef void ( ::SireMM::AngleRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::AngleRestraints::setUsesPbc ); + + AngleRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::AngleRestraints::size diff --git a/wrapper/MM/BondRestraints.pypp.cpp b/wrapper/MM/BondRestraints.pypp.cpp index 1e3cfbde4..2327e6cb9 100644 --- a/wrapper/MM/BondRestraints.pypp.cpp +++ b/wrapper/MM/BondRestraints.pypp.cpp @@ -122,6 +122,18 @@ void register_BondRestraints_class(){ , bp::release_gil_policy() , "Return the number of restraints" ); + } + { //::SireMM::BondRestraints::usesPbc + + typedef bool ( ::SireMM::BondRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::BondRestraints::usesPbc ); + + BondRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::BondRestraints::hasAtomRestraints @@ -248,6 +260,19 @@ void register_BondRestraints_class(){ , bp::release_gil_policy() , "Return all of the restraints" ); + } + { //::SireMM::BondRestraints::setUsesPbc + + typedef void ( ::SireMM::BondRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::BondRestraints::setUsesPbc ); + + BondRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::BondRestraints::size diff --git a/wrapper/MM/BoreschRestraints.pypp.cpp b/wrapper/MM/BoreschRestraints.pypp.cpp index 09ca8e9ad..da907dcd9 100644 --- a/wrapper/MM/BoreschRestraints.pypp.cpp +++ b/wrapper/MM/BoreschRestraints.pypp.cpp @@ -98,6 +98,18 @@ void register_BoreschRestraints_class(){ , bp::release_gil_policy() , "Return the number of restraints" ); + } + { //::SireMM::BoreschRestraints::usesPbc + + typedef bool ( ::SireMM::BoreschRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::BoreschRestraints::usesPbc ); + + BoreschRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::BoreschRestraints::isEmpty @@ -176,6 +188,19 @@ void register_BoreschRestraints_class(){ , bp::release_gil_policy() , "Return all of the restraints" ); + } + { //::SireMM::BoreschRestraints::setUsesPbc + + typedef void ( ::SireMM::BoreschRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::BoreschRestraints::setUsesPbc ); + + BoreschRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::BoreschRestraints::size diff --git a/wrapper/MM/CMakeAutogenFile.txt b/wrapper/MM/CMakeAutogenFile.txt index 39d516818..73369fa99 100644 --- a/wrapper/MM/CMakeAutogenFile.txt +++ b/wrapper/MM/CMakeAutogenFile.txt @@ -1,226 +1,228 @@ # WARNING - AUTOGENERATED FILE - CONTENTS WILL BE OVERWRITTEN! set ( PYPP_SOURCES - InterCLJFF.pypp.cpp - InterGroupCLJFFBase.pypp.cpp - TwoAtomPerturbation.pypp.cpp - IntraFF.pypp.cpp - IntraLJFFBase.pypp.cpp - CoulombProbe.pypp.cpp - BoreschRestraints.pypp.cpp - AngleParameterName.pypp.cpp - SelectorMAngle.pypp.cpp - LJParameterName.pypp.cpp - SelectorAngle.pypp.cpp - UreyBradleyComponent.pypp.cpp - LJNBPairs.pypp.cpp - Restraints.pypp.cpp - RMSDRestraints.pypp.cpp - DihedralRestraint.pypp.cpp + InterCoulombFF.pypp.cpp InternalParameters3D.pypp.cpp - Mover_Dihedral_.pypp.cpp - CLJWorkspace.pypp.cpp - UreyBradleyParameterName.pypp.cpp + InterLJFFBase.pypp.cpp + CLJPotentialInterface_InterCLJPotential_.pypp.cpp + GridFF2.pypp.cpp + BondRestraints.pypp.cpp + CLJSoftRFFunction.pypp.cpp + SoftCLJComponent.pypp.cpp + CLJBoxIndex.pypp.cpp + GromacsAngle.pypp.cpp + IntraGroupCLJFFBase.pypp.cpp + CLJSoftIntraRFFunction.pypp.cpp + CLJFunction.pypp.cpp + AngleParameterName.pypp.cpp + TripleDistanceRestraint.pypp.cpp + GroupInternalParameters.pypp.cpp + InternalSymbols.pypp.cpp + ThreeAtomFunctions.pypp.cpp + Intra14Component.pypp.cpp + InterGroupSoftCLJFFBase.pypp.cpp + InverseBondRestraints.pypp.cpp + CLJIntraRFFunction.pypp.cpp + TwoAtomFunctions.pypp.cpp CLJNBPairs.pypp.cpp - IntraLJFF.pypp.cpp - ImproperSymbols.pypp.cpp - InternalSymbolsBase.pypp.cpp - BondSymbols.pypp.cpp - LJProbe.pypp.cpp + InterGroupCoulombFFBase.pypp.cpp + ChargeParameterName.pypp.cpp + RestraintComponent.pypp.cpp + LJPotentialInterface_InterLJPotential_.pypp.cpp CLJIntraFunction.pypp.cpp - GridFF.pypp.cpp - Intra14LJComponent.pypp.cpp - CLJRFFunction.pypp.cpp - StretchBendTorsionSymbols.pypp.cpp - CHARMMSwitchingFunction.pypp.cpp - BoreschRestraint.pypp.cpp - ScaledLJParameterNames3D.pypp.cpp - ChargeParameterName3D.pypp.cpp - IntraCLJFFBase.pypp.cpp - Mover_SelectorAngle_.pypp.cpp - AmberParams.pypp.cpp - StretchStretchParameterName.pypp.cpp - CLJComponent.pypp.cpp SoftCLJPotentialInterface_IntraSoftCLJPotential_.pypp.cpp - ImproperParameterName.pypp.cpp - CLJSoftShiftFunction.pypp.cpp - Mover_SelectorImproper_.pypp.cpp - LJExceptionID.pypp.cpp - PositionalRestraints.pypp.cpp - Mover_Improper_.pypp.cpp + IntraCLJFF.pypp.cpp + CLJDelta.pypp.cpp + ScaledCLJParameterNames3D.pypp.cpp + StretchBendComponent.pypp.cpp + InterGroupSoftCLJFF.pypp.cpp + RestraintFF.pypp.cpp GromacsBond.pypp.cpp - ThreeAtomFunction.pypp.cpp - AngleSymbols.pypp.cpp - LJException.pypp.cpp - InterSoftCLJFFBase.pypp.cpp - InternalFF.pypp.cpp - InterFF.pypp.cpp - StretchStretchSymbols.pypp.cpp - StretchBendSymbols.pypp.cpp - InternalSymbols.pypp.cpp - CLJAtoms.pypp.cpp - CLJPotentialInterface_IntraCLJPotential_.pypp.cpp + BoreschRestraints.pypp.cpp + IntraGroupLJFF.pypp.cpp + InterCLJFF.pypp.cpp + IntraFF.pypp.cpp + IntraLJFFBase.pypp.cpp + CLJ14Group.pypp.cpp + BondRestraint.pypp.cpp + SelectorMImproper.pypp.cpp CLJShiftFunction.pypp.cpp - InterGroupFF.pypp.cpp - TwoAtomFunction.pypp.cpp - CMAPFunctions.pypp.cpp - InterGroupSoftCLJFFBase.pypp.cpp + CLJCutoffFunction.pypp.cpp + InternalFF.pypp.cpp + CLJParameterNames3D.pypp.cpp + CLJParameterNames.pypp.cpp + IntraCLJFFBase.pypp.cpp + ImproperParameterName.pypp.cpp + AngleRestraint.pypp.cpp + InternalParameterNames3D.pypp.cpp + NoCutoff.pypp.cpp + Restraint.pypp.cpp + AmberBond.pypp.cpp + StretchStretchParameterName.pypp.cpp + InternalPerturbation.pypp.cpp + CMAPParameter.pypp.cpp + AmberAngle.pypp.cpp InterCoulombFFBase.pypp.cpp - AtomPairs_CLJScaleFactor_.pypp.cpp - InterGroupLJFFBase.pypp.cpp + SelectorMAngle.pypp.cpp + TestFF.pypp.cpp + CLJSoftIntraShiftFunction.pypp.cpp FourAtomPerturbation.pypp.cpp - Angle.pypp.cpp + ScaledChargeParameterNames3D.pypp.cpp + BoreschRestraint.pypp.cpp + InterGroupCLJFF.pypp.cpp + InterFF.pypp.cpp + PositionalRestraint.pypp.cpp + SelectorAngle.pypp.cpp IntraCoulombFF.pypp.cpp - StretchBendComponent.pypp.cpp - AmberDihedral.pypp.cpp - DihedralRestraints.pypp.cpp - DoubleDistanceRestraint.pypp.cpp - InternalPerturbation.pypp.cpp - CoulombPotentialInterface_IntraCoulombPotential_.pypp.cpp - TwoAtomFunctions.pypp.cpp - CoulombComponent.pypp.cpp - InternalParameters.pypp.cpp - CLJCalculator.pypp.cpp - MultiCLJComponent.pypp.cpp - CLJParameterNames3D.pypp.cpp - AngleRestraint.pypp.cpp + Improper.pypp.cpp + Bond.pypp.cpp + PositionalRestraints.pypp.cpp + CoulombProbe.pypp.cpp + AtomLJs.pypp.cpp + GromacsAtomType.pypp.cpp + DistanceRestraint.pypp.cpp + Mover_Angle_.pypp.cpp + ThreeAtomPerturbation.pypp.cpp + CLJPotentialInterface_IntraSoftCLJPotential_.pypp.cpp AngleComponent.pypp.cpp - Dihedral.pypp.cpp + GridFF.pypp.cpp + Intra14CoulombComponent.pypp.cpp + LJNBPairs.pypp.cpp + Restraints.pypp.cpp + LJComponent.pypp.cpp + InternalComponent.pypp.cpp + InterSoftCLJFF.pypp.cpp LJParameter.pypp.cpp - CLJGroup.pypp.cpp - CLJSoftIntraFunction.pypp.cpp + MultiCLJComponent.pypp.cpp + CLJIntraShiftFunction.pypp.cpp + RMSDRestraints.pypp.cpp BondParameterName.pypp.cpp - InterGroupCoulombFF.pypp.cpp - CLJSoftFunction.pypp.cpp - CLJGrid.pypp.cpp - AmberDihPart.pypp.cpp - RestraintComponent.pypp.cpp - StretchBendTorsionParameterName.pypp.cpp - SwitchingFunction.pypp.cpp - SoftCLJComponent.pypp.cpp - LJPotentialInterface_InterLJPotential_.pypp.cpp - ScaledChargeParameterNames3D.pypp.cpp - AtomPairs_CoulombScaleFactor_.pypp.cpp - ThreeAtomFunctions.pypp.cpp - InterSoftCLJFF.pypp.cpp - CMAPFunction.pypp.cpp - SelectorMBond.pypp.cpp - DihedralSymbols.pypp.cpp - ExcludedPairs.pypp.cpp - ScaledCLJParameterNames3D.pypp.cpp - Mover_Angle_.pypp.cpp - CLJPotentialInterface_InterCLJPotential_.pypp.cpp - CLJSoftIntraShiftFunction.pypp.cpp - BendBendComponent.pypp.cpp - SelectorDihedral.pypp.cpp - StretchStretchComponent.pypp.cpp - Restraint.pypp.cpp + CLJBoxDistance.pypp.cpp + CoulombPotentialInterface_IntraCoulombPotential_.pypp.cpp CLJProbe.pypp.cpp - InterGroupCLJFF.pypp.cpp - Mover_SelectorDihedral_.pypp.cpp - CLJBoxIndex.pypp.cpp - InternalParameterNames3D.pypp.cpp - StretchBendTorsionComponent.pypp.cpp - InterCLJFFBase.pypp.cpp - IntraSoftCLJFF.pypp.cpp - InterGroupLJFF.pypp.cpp - CLJExtractor.pypp.cpp - CLJSoftRFFunction.pypp.cpp - CLJFunction.pypp.cpp + Mover_SelectorImproper_.pypp.cpp SelectorBond.pypp.cpp - GridFF2.pypp.cpp - DihedralParameterName.pypp.cpp - IntraGroupCLJFFBase.pypp.cpp - RestraintFF.pypp.cpp + LJExceptionID.pypp.cpp + StretchBendTorsionComponent.pypp.cpp + StretchBendParameterName.pypp.cpp + Angle.pypp.cpp + InterSoftCLJFFBase.pypp.cpp + TwoAtomPerturbation.pypp.cpp + DoubleDistanceRestraint.pypp.cpp + InternalSymbolsBase.pypp.cpp + LJPerturbation.pypp.cpp + CLJGroup.pypp.cpp + InternalGroupFF.pypp.cpp + DihedralRestraints.pypp.cpp + MorsePotentialRestraints.pypp.cpp + StretchBendTorsionSymbols.pypp.cpp + HarmonicSwitchingFunction.pypp.cpp + MorsePotentialRestraint.pypp.cpp + CLJBoxes.pypp.cpp + Mover_SelectorAngle_.pypp.cpp + InterGroupCLJFFBase.pypp.cpp + LJParameterName3D.pypp.cpp + BendBendComponent.pypp.cpp + Mover_Bond_.pypp.cpp + ExcludedPairs.pypp.cpp + CLJAtom.pypp.cpp + StretchBendTorsionParameterName.pypp.cpp + CLJSoftShiftFunction.pypp.cpp SoftCLJPotentialInterface_InterSoftCLJPotential_.pypp.cpp - AmberAngle.pypp.cpp + IntraLJFF.pypp.cpp + UreyBradleyParameterName.pypp.cpp + StretchBendSymbols.pypp.cpp + InverseBondRestraint.pypp.cpp + DihedralRestraint.pypp.cpp + InterGroupLJFFBase.pypp.cpp + DihedralComponent.pypp.cpp + Mover_SelectorBond_.pypp.cpp IntraGroupFF.pypp.cpp - NoCutoff.pypp.cpp - InterCoulombFF.pypp.cpp - CLJAtom.pypp.cpp - HarmonicSwitchingFunction.pypp.cpp - CLJBoxDistance.pypp.cpp - GromacsAtomType.pypp.cpp - BondRestraint.pypp.cpp + CLJComponent.pypp.cpp + InterGroupLJFF.pypp.cpp + AngleRestraints.pypp.cpp + CLJExtractor.pypp.cpp + NullCLJFunction.pypp.cpp SelectorMDihedral.pypp.cpp - IntraGroupCoulombFF.pypp.cpp - TestFF.pypp.cpp - IntraGroupSoftCLJFFBase.pypp.cpp - CLJScaleFactor.pypp.cpp - InternalGroupFF.pypp.cpp - IntraGroupCoulombFFBase.pypp.cpp - ChargeParameterName.pypp.cpp - IntraCLJFF.pypp.cpp - IntraGroupLJFF.pypp.cpp + AtomPairs_LJScaleFactor_.pypp.cpp + AtomFunction.pypp.cpp + Mover_Improper_.pypp.cpp + ThreeAtomFunction.pypp.cpp + MMDetail.pypp.cpp + CLJPotentialInterface_InterSoftCLJPotential_.pypp.cpp + LJProbe.pypp.cpp + InterGroupCoulombFF.pypp.cpp + CLJWorkspace.pypp.cpp + CLJCalculator.pypp.cpp BendBendSymbols.pypp.cpp - StretchBendParameterName.pypp.cpp - GroupInternalParameters.pypp.cpp - SelectorImproper.pypp.cpp - AngleRestraints.pypp.cpp + CoulombScaleFactor.pypp.cpp + CoulombComponent.pypp.cpp + AtomPairs_CoulombScaleFactor_.pypp.cpp + LJPotentialInterface_IntraLJPotential_.pypp.cpp + Restraint3D.pypp.cpp + Mover_Dihedral_.pypp.cpp AtomFunctions.pypp.cpp - CLJIntraRFFunction.pypp.cpp - DihedralComponent.pypp.cpp - Intra14CoulombComponent.pypp.cpp - InternalComponent.pypp.cpp - InterLJFFBase.pypp.cpp - CLJPotentialInterface_IntraSoftCLJPotential_.pypp.cpp - InternalParameterNames.pypp.cpp - NullCLJFunction.pypp.cpp + BondComponent.pypp.cpp + TwoAtomFunction.pypp.cpp + GromacsDihedral.pypp.cpp + ImproperSymbols.pypp.cpp + AmberNB14.pypp.cpp + CLJPotentialInterface_IntraCLJPotential_.pypp.cpp + SwitchingFunction.pypp.cpp + CLJRFFunction.pypp.cpp ImproperComponent.pypp.cpp - GromacsAngle.pypp.cpp - CLJCutoffFunction.pypp.cpp - LJ1264Parameter.pypp.cpp - MorsePotentialRestraint.pypp.cpp - CoulombPotentialInterface_InterCoulombPotential_.pypp.cpp - ThreeAtomPerturbation.pypp.cpp - Mover_Bond_.pypp.cpp + UreyBradleyComponent.pypp.cpp + AtomPairs_CLJScaleFactor_.pypp.cpp + CLJSoftIntraFunction.pypp.cpp + InternalParameters.pypp.cpp + IntraGroupLJFFBase.pypp.cpp InterLJFF.pypp.cpp - FourAtomFunctions.pypp.cpp - TripleDistanceRestraint.pypp.cpp - CoulombScaleFactor.pypp.cpp - LJPerturbation.pypp.cpp + IntraGroupSoftCLJFF.pypp.cpp + CoulombPotentialInterface_InterCoulombPotential_.pypp.cpp + BendBendParameterName.pypp.cpp LJScaleFactor.pypp.cpp - CLJ14Group.pypp.cpp - CLJBoxes.pypp.cpp - IntraGroupCLJFF.pypp.cpp - CoulombNBPairs.pypp.cpp - InterGroupCoulombFFBase.pypp.cpp - Restraint3D.pypp.cpp - CLJDelta.pypp.cpp - CLJPotentialInterface_InterSoftCLJPotential_.pypp.cpp - RMSDRestraint.pypp.cpp - CLJSoftIntraRFFunction.pypp.cpp - IntraCoulombFFBase.pypp.cpp - Improper.pypp.cpp - IntraGroupLJFFBase.pypp.cpp - LJPotentialInterface_IntraLJPotential_.pypp.cpp - Bond.pypp.cpp - CLJParameterNames.pypp.cpp + IntraGroupCoulombFFBase.pypp.cpp + CLJAtoms.pypp.cpp + LJ1264Parameter.pypp.cpp + ChargeParameterName3D.pypp.cpp + CLJGrid.pypp.cpp + ScaledLJParameterNames3D.pypp.cpp CLJBox.pypp.cpp - LJParameterName3D.pypp.cpp - PositionalRestraint.pypp.cpp - IntraGroupSoftCLJFF.pypp.cpp - AmberNB14.pypp.cpp - Mover_SelectorBond_.pypp.cpp - DistanceRestraint.pypp.cpp - Intra14Component.pypp.cpp - SelectorMImproper.pypp.cpp - GromacsDihedral.pypp.cpp - MorsePotentialRestraints.pypp.cpp - AmberBond.pypp.cpp - NullRestraint.pypp.cpp - LJComponent.pypp.cpp - BondComponent.pypp.cpp + Mover_SelectorDihedral_.pypp.cpp + LJException.pypp.cpp + IntraCoulombFFBase.pypp.cpp + AmberDihedral.pypp.cpp + Intra14LJComponent.pypp.cpp + IntraGroupCoulombFF.pypp.cpp IntraSoftCLJFFBase.pypp.cpp - CLJIntraShiftFunction.pypp.cpp - MMDetail.pypp.cpp - AtomFunction.pypp.cpp - InterGroupSoftCLJFF.pypp.cpp - BendBendParameterName.pypp.cpp - CMAPParameter.pypp.cpp - AtomPairs_LJScaleFactor_.pypp.cpp - BondRestraints.pypp.cpp + RMSDRestraint.pypp.cpp + IntraGroupCLJFF.pypp.cpp + CMAPFunctions.pypp.cpp + CMAPFunction.pypp.cpp + IntraSoftCLJFF.pypp.cpp + AngleSymbols.pypp.cpp + SelectorDihedral.pypp.cpp + LJParameterName.pypp.cpp + FourAtomFunctions.pypp.cpp + AmberDihPart.pypp.cpp + SelectorMBond.pypp.cpp + InternalParameterNames.pypp.cpp + SelectorImproper.pypp.cpp + DihedralParameterName.pypp.cpp + AmberParams.pypp.cpp + CoulombNBPairs.pypp.cpp + CLJScaleFactor.pypp.cpp + InterGroupFF.pypp.cpp FourAtomFunction.pypp.cpp - AtomLJs.pypp.cpp + DihedralSymbols.pypp.cpp + NullRestraint.pypp.cpp + Dihedral.pypp.cpp + StretchStretchSymbols.pypp.cpp + IntraGroupSoftCLJFFBase.pypp.cpp + CHARMMSwitchingFunction.pypp.cpp + BondSymbols.pypp.cpp + StretchStretchComponent.pypp.cpp + CLJSoftFunction.pypp.cpp + InterCLJFFBase.pypp.cpp SireMM_containers.cpp SireMM_properties.cpp SireMM_registrars.cpp diff --git a/wrapper/MM/DihedralRestraints.pypp.cpp b/wrapper/MM/DihedralRestraints.pypp.cpp index ede6aafef..74ea2f5da 100644 --- a/wrapper/MM/DihedralRestraints.pypp.cpp +++ b/wrapper/MM/DihedralRestraints.pypp.cpp @@ -98,6 +98,18 @@ void register_DihedralRestraints_class(){ , bp::release_gil_policy() , "Return the number of restraints" ); + } + { //::SireMM::DihedralRestraints::usesPbc + + typedef bool ( ::SireMM::DihedralRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::DihedralRestraints::usesPbc ); + + DihedralRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::DihedralRestraints::isEmpty @@ -176,6 +188,19 @@ void register_DihedralRestraints_class(){ , bp::release_gil_policy() , "Return all of the restraints" ); + } + { //::SireMM::DihedralRestraints::setUsesPbc + + typedef void ( ::SireMM::DihedralRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::DihedralRestraints::setUsesPbc ); + + DihedralRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::DihedralRestraints::size diff --git a/wrapper/MM/InverseBondRestraint.pypp.cpp b/wrapper/MM/InverseBondRestraint.pypp.cpp new file mode 100644 index 000000000..7e84163fd --- /dev/null +++ b/wrapper/MM/InverseBondRestraint.pypp.cpp @@ -0,0 +1,219 @@ +// This file has been generated by Py++. + +// (C) Christopher Woods, GPL >= 3 License + +#include "boost/python.hpp" +#include "InverseBondRestraint.pypp.hpp" + +namespace bp = boost::python; + +#include "SireError/errors.h" + +#include "SireID/index.h" + +#include "SireStream/datastream.h" + +#include "SireStream/shareddatastream.h" + +#include "SireUnits/units.h" + +#include "inversebondrestraints.h" + +#include + +#include "inversebondrestraints.h" + +SireMM::InverseBondRestraint __copy__(const SireMM::InverseBondRestraint &other){ return SireMM::InverseBondRestraint(other); } + +#include "Helpers/copy.hpp" + +#include "Qt/qdatastream.hpp" + +#include "Helpers/str.hpp" + +#include "Helpers/release_gil_policy.hpp" + +void register_InverseBondRestraint_class(){ + + { //::SireMM::InverseBondRestraint + typedef bp::class_< SireMM::InverseBondRestraint, bp::bases< SireBase::Property > > InverseBondRestraint_exposer_t; + InverseBondRestraint_exposer_t InverseBondRestraint_exposer = InverseBondRestraint_exposer_t( "InverseBondRestraint", "This class represents a single bond restraint between any two\natoms in a system (or between the centroids of any two groups\nof atoms in a system)\n", bp::init< >("Null constructor") ); + bp::scope InverseBondRestraint_scope( InverseBondRestraint_exposer ); + InverseBondRestraint_exposer.def( bp::init< qint64, qint64, SireUnits::Dimension::HarmonicBondConstant const &, SireUnits::Dimension::Length const & >(( bp::arg("atom0"), bp::arg("atom1"), bp::arg("k"), bp::arg("r0") ), "Construct to restrain the atom at index atom to the specified position\n using the specified force constant and flat-bottom well-width\n") ); + InverseBondRestraint_exposer.def( bp::init< QList< long long > const &, QList< long long > const &, SireUnits::Dimension::HarmonicBondConstant const &, SireUnits::Dimension::Length const & >(( bp::arg("atoms0"), bp::arg("atoms1"), bp::arg("k"), bp::arg("r0") ), "Construct to restrain the centroid of the atoms whose indicies are\n in atoms to the specified position using the specified force constant\n and flat-bottom well width\n") ); + InverseBondRestraint_exposer.def( bp::init< SireMM::InverseBondRestraint const & >(( bp::arg("other") ), "Copy constructor") ); + { //::SireMM::InverseBondRestraint::atom0 + + typedef ::qint64 ( ::SireMM::InverseBondRestraint::*atom0_function_type)( ) const; + atom0_function_type atom0_function_value( &::SireMM::InverseBondRestraint::atom0 ); + + InverseBondRestraint_exposer.def( + "atom0" + , atom0_function_value + , bp::release_gil_policy() + , "Return the index of the atom if this is a single-atom restraint" ); + + } + { //::SireMM::InverseBondRestraint::atom1 + + typedef ::qint64 ( ::SireMM::InverseBondRestraint::*atom1_function_type)( ) const; + atom1_function_type atom1_function_value( &::SireMM::InverseBondRestraint::atom1 ); + + InverseBondRestraint_exposer.def( + "atom1" + , atom1_function_value + , bp::release_gil_policy() + , "Return the index of the atom if this is a single-atom restraint" ); + + } + { //::SireMM::InverseBondRestraint::atoms0 + + typedef ::QVector< long long > ( ::SireMM::InverseBondRestraint::*atoms0_function_type)( ) const; + atoms0_function_type atoms0_function_value( &::SireMM::InverseBondRestraint::atoms0 ); + + InverseBondRestraint_exposer.def( + "atoms0" + , atoms0_function_value + , bp::release_gil_policy() + , "Return the indexes of the atoms whose centroid is to be restrained" ); + + } + { //::SireMM::InverseBondRestraint::atoms1 + + typedef ::QVector< long long > ( ::SireMM::InverseBondRestraint::*atoms1_function_type)( ) const; + atoms1_function_type atoms1_function_value( &::SireMM::InverseBondRestraint::atoms1 ); + + InverseBondRestraint_exposer.def( + "atoms1" + , atoms1_function_value + , bp::release_gil_policy() + , "Return the indexes of the atoms whose centroid is to be restrained" ); + + } + { //::SireMM::InverseBondRestraint::isAtomRestraint + + typedef bool ( ::SireMM::InverseBondRestraint::*isAtomRestraint_function_type)( ) const; + isAtomRestraint_function_type isAtomRestraint_function_value( &::SireMM::InverseBondRestraint::isAtomRestraint ); + + InverseBondRestraint_exposer.def( + "isAtomRestraint" + , isAtomRestraint_function_value + , bp::release_gil_policy() + , "Return whether this is a single-atom restraint" ); + + } + { //::SireMM::InverseBondRestraint::isCentroidRestraint + + typedef bool ( ::SireMM::InverseBondRestraint::*isCentroidRestraint_function_type)( ) const; + isCentroidRestraint_function_type isCentroidRestraint_function_value( &::SireMM::InverseBondRestraint::isCentroidRestraint ); + + InverseBondRestraint_exposer.def( + "isCentroidRestraint" + , isCentroidRestraint_function_value + , bp::release_gil_policy() + , "Return whether this restraint acts on the centroid of a group\n of atoms" ); + + } + { //::SireMM::InverseBondRestraint::isNull + + typedef bool ( ::SireMM::InverseBondRestraint::*isNull_function_type)( ) const; + isNull_function_type isNull_function_value( &::SireMM::InverseBondRestraint::isNull ); + + InverseBondRestraint_exposer.def( + "isNull" + , isNull_function_value + , bp::release_gil_policy() + , "" ); + + } + { //::SireMM::InverseBondRestraint::k + + typedef ::SireUnits::Dimension::HarmonicBondConstant ( ::SireMM::InverseBondRestraint::*k_function_type)( ) const; + k_function_type k_function_value( &::SireMM::InverseBondRestraint::k ); + + InverseBondRestraint_exposer.def( + "k" + , k_function_value + , bp::release_gil_policy() + , "Return the force constant for the restraint" ); + + } + InverseBondRestraint_exposer.def( bp::self != bp::self ); + InverseBondRestraint_exposer.def( bp::self + bp::self ); + InverseBondRestraint_exposer.def( bp::self + bp::other< SireMM::InverseBondRestraints >() ); + { //::SireMM::InverseBondRestraint::operator= + + typedef ::SireMM::InverseBondRestraint & ( ::SireMM::InverseBondRestraint::*assign_function_type)( ::SireMM::InverseBondRestraint const & ) ; + assign_function_type assign_function_value( &::SireMM::InverseBondRestraint::operator= ); + + InverseBondRestraint_exposer.def( + "assign" + , assign_function_value + , ( bp::arg("other") ) + , bp::return_self< >() + , "" ); + + } + InverseBondRestraint_exposer.def( bp::self == bp::self ); + { //::SireMM::InverseBondRestraint::r0 + + typedef ::SireUnits::Dimension::Length ( ::SireMM::InverseBondRestraint::*r0_function_type)( ) const; + r0_function_type r0_function_value( &::SireMM::InverseBondRestraint::r0 ); + + InverseBondRestraint_exposer.def( + "r0" + , r0_function_value + , bp::release_gil_policy() + , "Return the width of the harmonic bond." ); + + } + { //::SireMM::InverseBondRestraint::toString + + typedef ::QString ( ::SireMM::InverseBondRestraint::*toString_function_type)( ) const; + toString_function_type toString_function_value( &::SireMM::InverseBondRestraint::toString ); + + InverseBondRestraint_exposer.def( + "toString" + , toString_function_value + , bp::release_gil_policy() + , "" ); + + } + { //::SireMM::InverseBondRestraint::typeName + + typedef char const * ( *typeName_function_type )( ); + typeName_function_type typeName_function_value( &::SireMM::InverseBondRestraint::typeName ); + + InverseBondRestraint_exposer.def( + "typeName" + , typeName_function_value + , bp::release_gil_policy() + , "" ); + + } + { //::SireMM::InverseBondRestraint::what + + typedef char const * ( ::SireMM::InverseBondRestraint::*what_function_type)( ) const; + what_function_type what_function_value( &::SireMM::InverseBondRestraint::what ); + + InverseBondRestraint_exposer.def( + "what" + , what_function_value + , bp::release_gil_policy() + , "" ); + + } + InverseBondRestraint_exposer.staticmethod( "typeName" ); + InverseBondRestraint_exposer.def( "__copy__", &__copy__); + InverseBondRestraint_exposer.def( "__deepcopy__", &__copy__); + InverseBondRestraint_exposer.def( "clone", &__copy__); + InverseBondRestraint_exposer.def( "__rlshift__", &__rlshift__QDataStream< ::SireMM::InverseBondRestraint >, + bp::return_internal_reference<1, bp::with_custodian_and_ward<1,2> >() ); + InverseBondRestraint_exposer.def( "__rrshift__", &__rrshift__QDataStream< ::SireMM::InverseBondRestraint >, + bp::return_internal_reference<1, bp::with_custodian_and_ward<1,2> >() ); + InverseBondRestraint_exposer.def_pickle(sire_pickle_suite< ::SireMM::InverseBondRestraint >()); + InverseBondRestraint_exposer.def( "__str__", &__str__< ::SireMM::InverseBondRestraint > ); + InverseBondRestraint_exposer.def( "__repr__", &__str__< ::SireMM::InverseBondRestraint > ); + } + +} diff --git a/wrapper/MM/InverseBondRestraint.pypp.hpp b/wrapper/MM/InverseBondRestraint.pypp.hpp new file mode 100644 index 000000000..6d5132e38 --- /dev/null +++ b/wrapper/MM/InverseBondRestraint.pypp.hpp @@ -0,0 +1,10 @@ +// This file has been generated by Py++. + +// (C) Christopher Woods, GPL >= 3 License + +#ifndef InverseBondRestraint_hpp__pyplusplus_wrapper +#define InverseBondRestraint_hpp__pyplusplus_wrapper + +void register_InverseBondRestraint_class(); + +#endif//InverseBondRestraint_hpp__pyplusplus_wrapper diff --git a/wrapper/MM/InverseBondRestraints.pypp.cpp b/wrapper/MM/InverseBondRestraints.pypp.cpp new file mode 100644 index 000000000..aa86830ec --- /dev/null +++ b/wrapper/MM/InverseBondRestraints.pypp.cpp @@ -0,0 +1,339 @@ +// This file has been generated by Py++. + +// (C) Christopher Woods, GPL >= 3 License + +#include "boost/python.hpp" +#include "Helpers/clone_const_reference.hpp" +#include "InverseBondRestraints.pypp.hpp" + +namespace bp = boost::python; + +#include "SireError/errors.h" + +#include "SireID/index.h" + +#include "SireStream/datastream.h" + +#include "SireStream/shareddatastream.h" + +#include "SireUnits/units.h" + +#include "inversebondrestraints.h" + +#include + +#include "inversebondrestraints.h" + +SireMM::InverseBondRestraints __copy__(const SireMM::InverseBondRestraints &other){ return SireMM::InverseBondRestraints(other); } + +#include "Helpers/copy.hpp" + +#include "Qt/qdatastream.hpp" + +#include "Helpers/str.hpp" + +#include "Helpers/release_gil_policy.hpp" + +#include "Helpers/len.hpp" + +void register_InverseBondRestraints_class(){ + + { //::SireMM::InverseBondRestraints + typedef bp::class_< SireMM::InverseBondRestraints, bp::bases< SireMM::Restraints, SireBase::Property > > InverseBondRestraints_exposer_t; + InverseBondRestraints_exposer_t InverseBondRestraints_exposer = InverseBondRestraints_exposer_t( "InverseBondRestraints", "This class provides the information for a collection of bond\nrestraints that can be added to a collection of molecues. Each\nrestraint can act on a pair of particles or a pair of the\ncentroids of two collections of particles.\nThe restaints are spherically symmetric, and\nare simple harmonic potentials\n", bp::init< >("Null constructor") ); + bp::scope InverseBondRestraints_scope( InverseBondRestraints_exposer ); + InverseBondRestraints_exposer.def( bp::init< QString const & >(( bp::arg("name") ), "") ); + InverseBondRestraints_exposer.def( bp::init< SireMM::InverseBondRestraint const & >(( bp::arg("restraint") ), "") ); + InverseBondRestraints_exposer.def( bp::init< QList< SireMM::InverseBondRestraint > const & >(( bp::arg("restraints") ), "") ); + InverseBondRestraints_exposer.def( bp::init< QString const &, SireMM::InverseBondRestraint const & >(( bp::arg("name"), bp::arg("restraint") ), "") ); + InverseBondRestraints_exposer.def( bp::init< QString const &, QList< SireMM::InverseBondRestraint > const & >(( bp::arg("name"), bp::arg("restraints") ), "") ); + InverseBondRestraints_exposer.def( bp::init< SireMM::InverseBondRestraints const & >(( bp::arg("other") ), "") ); + { //::SireMM::InverseBondRestraints::add + + typedef void ( ::SireMM::InverseBondRestraints::*add_function_type)( ::SireMM::InverseBondRestraint const & ) ; + add_function_type add_function_value( &::SireMM::InverseBondRestraints::add ); + + InverseBondRestraints_exposer.def( + "add" + , add_function_value + , ( bp::arg("restraint") ) + , bp::release_gil_policy() + , "Add a restraint onto the list" ); + + } + { //::SireMM::InverseBondRestraints::add + + typedef void ( ::SireMM::InverseBondRestraints::*add_function_type)( ::SireMM::InverseBondRestraints const & ) ; + add_function_type add_function_value( &::SireMM::InverseBondRestraints::add ); + + InverseBondRestraints_exposer.def( + "add" + , add_function_value + , ( bp::arg("restraints") ) + , bp::release_gil_policy() + , "Add a restraint onto the list" ); + + } + { //::SireMM::InverseBondRestraints::at + + typedef ::SireMM::InverseBondRestraint const & ( ::SireMM::InverseBondRestraints::*at_function_type)( int ) const; + at_function_type at_function_value( &::SireMM::InverseBondRestraints::at ); + + InverseBondRestraints_exposer.def( + "at" + , at_function_value + , ( bp::arg("i") ) + , bp::return_value_policy() + , "Return the ith restraint" ); + + } + { //::SireMM::InverseBondRestraints::atomRestraints + + typedef ::QList< SireMM::InverseBondRestraint > ( ::SireMM::InverseBondRestraints::*atomRestraints_function_type)( ) const; + atomRestraints_function_type atomRestraints_function_value( &::SireMM::InverseBondRestraints::atomRestraints ); + + InverseBondRestraints_exposer.def( + "atomRestraints" + , atomRestraints_function_value + , bp::release_gil_policy() + , "Return all of the atom restraints" ); + + } + { //::SireMM::InverseBondRestraints::centroidRestraints + + typedef ::QList< SireMM::InverseBondRestraint > ( ::SireMM::InverseBondRestraints::*centroidRestraints_function_type)( ) const; + centroidRestraints_function_type centroidRestraints_function_value( &::SireMM::InverseBondRestraints::centroidRestraints ); + + InverseBondRestraints_exposer.def( + "centroidRestraints" + , centroidRestraints_function_value + , bp::release_gil_policy() + , "Return all of the centroid restraints" ); + + } + { //::SireMM::InverseBondRestraints::count + + typedef int ( ::SireMM::InverseBondRestraints::*count_function_type)( ) const; + count_function_type count_function_value( &::SireMM::InverseBondRestraints::count ); + + InverseBondRestraints_exposer.def( + "count" + , count_function_value + , bp::release_gil_policy() + , "Return the number of restraints" ); + + } + { //::SireMM::InverseBondRestraints::usesPbc + + typedef bool ( ::SireMM::InverseBondRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::InverseBondRestraints::usesPbc ); + + InverseBondRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + + } + { //::SireMM::InverseBondRestraints::hasAtomRestraints + + typedef bool ( ::SireMM::InverseBondRestraints::*hasAtomRestraints_function_type)( ) const; + hasAtomRestraints_function_type hasAtomRestraints_function_value( &::SireMM::InverseBondRestraints::hasAtomRestraints ); + + InverseBondRestraints_exposer.def( + "hasAtomRestraints" + , hasAtomRestraints_function_value + , bp::release_gil_policy() + , "Return whether or not there are any atom restraints" ); + + } + { //::SireMM::InverseBondRestraints::hasCentroidRestraints + + typedef bool ( ::SireMM::InverseBondRestraints::*hasCentroidRestraints_function_type)( ) const; + hasCentroidRestraints_function_type hasCentroidRestraints_function_value( &::SireMM::InverseBondRestraints::hasCentroidRestraints ); + + InverseBondRestraints_exposer.def( + "hasCentroidRestraints" + , hasCentroidRestraints_function_value + , bp::release_gil_policy() + , "Return whether or not there are any centroid restraints" ); + + } + { //::SireMM::InverseBondRestraints::isEmpty + + typedef bool ( ::SireMM::InverseBondRestraints::*isEmpty_function_type)( ) const; + isEmpty_function_type isEmpty_function_value( &::SireMM::InverseBondRestraints::isEmpty ); + + InverseBondRestraints_exposer.def( + "isEmpty" + , isEmpty_function_value + , bp::release_gil_policy() + , "Return whether or not this is empty" ); + + } + { //::SireMM::InverseBondRestraints::isNull + + typedef bool ( ::SireMM::InverseBondRestraints::*isNull_function_type)( ) const; + isNull_function_type isNull_function_value( &::SireMM::InverseBondRestraints::isNull ); + + InverseBondRestraints_exposer.def( + "isNull" + , isNull_function_value + , bp::release_gil_policy() + , "Return whether or not this is empty" ); + + } + { //::SireMM::InverseBondRestraints::nAtomRestraints + + typedef int ( ::SireMM::InverseBondRestraints::*nAtomRestraints_function_type)( ) const; + nAtomRestraints_function_type nAtomRestraints_function_value( &::SireMM::InverseBondRestraints::nAtomRestraints ); + + InverseBondRestraints_exposer.def( + "nAtomRestraints" + , nAtomRestraints_function_value + , bp::release_gil_policy() + , "Return the number of atom restraints" ); + + } + { //::SireMM::InverseBondRestraints::nCentroidRestraints + + typedef int ( ::SireMM::InverseBondRestraints::*nCentroidRestraints_function_type)( ) const; + nCentroidRestraints_function_type nCentroidRestraints_function_value( &::SireMM::InverseBondRestraints::nCentroidRestraints ); + + InverseBondRestraints_exposer.def( + "nCentroidRestraints" + , nCentroidRestraints_function_value + , bp::release_gil_policy() + , "Return the number of centroid restraints" ); + + } + { //::SireMM::InverseBondRestraints::nRestraints + + typedef int ( ::SireMM::InverseBondRestraints::*nRestraints_function_type)( ) const; + nRestraints_function_type nRestraints_function_value( &::SireMM::InverseBondRestraints::nRestraints ); + + InverseBondRestraints_exposer.def( + "nRestraints" + , nRestraints_function_value + , bp::release_gil_policy() + , "Return the number of restraints" ); + + } + InverseBondRestraints_exposer.def( bp::self != bp::self ); + InverseBondRestraints_exposer.def( bp::self + bp::other< SireMM::InverseBondRestraint >() ); + InverseBondRestraints_exposer.def( bp::self + bp::self ); + { //::SireMM::InverseBondRestraints::operator= + + typedef ::SireMM::InverseBondRestraints & ( ::SireMM::InverseBondRestraints::*assign_function_type)( ::SireMM::InverseBondRestraints const & ) ; + assign_function_type assign_function_value( &::SireMM::InverseBondRestraints::operator= ); + + InverseBondRestraints_exposer.def( + "assign" + , assign_function_value + , ( bp::arg("other") ) + , bp::return_self< >() + , "" ); + + } + InverseBondRestraints_exposer.def( bp::self == bp::self ); + { //::SireMM::InverseBondRestraints::operator[] + + typedef ::SireMM::InverseBondRestraint const & ( ::SireMM::InverseBondRestraints::*__getitem___function_type)( int ) const; + __getitem___function_type __getitem___function_value( &::SireMM::InverseBondRestraints::operator[] ); + + InverseBondRestraints_exposer.def( + "__getitem__" + , __getitem___function_value + , ( bp::arg("i") ) + , bp::return_value_policy() + , "" ); + + } + { //::SireMM::InverseBondRestraints::restraints + + typedef ::QList< SireMM::InverseBondRestraint > ( ::SireMM::InverseBondRestraints::*restraints_function_type)( ) const; + restraints_function_type restraints_function_value( &::SireMM::InverseBondRestraints::restraints ); + + InverseBondRestraints_exposer.def( + "restraints" + , restraints_function_value + , bp::release_gil_policy() + , "Return all of the restraints" ); + + } + { //::SireMM::InverseBondRestraints::setUsesPbc + + typedef void ( ::SireMM::InverseBondRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::InverseBondRestraints::setUsesPbc ); + + InverseBondRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + + } + { //::SireMM::InverseBondRestraints::size + + typedef int ( ::SireMM::InverseBondRestraints::*size_function_type)( ) const; + size_function_type size_function_value( &::SireMM::InverseBondRestraints::size ); + + InverseBondRestraints_exposer.def( + "size" + , size_function_value + , bp::release_gil_policy() + , "Return the number of restraints" ); + + } + { //::SireMM::InverseBondRestraints::toString + + typedef ::QString ( ::SireMM::InverseBondRestraints::*toString_function_type)( ) const; + toString_function_type toString_function_value( &::SireMM::InverseBondRestraints::toString ); + + InverseBondRestraints_exposer.def( + "toString" + , toString_function_value + , bp::release_gil_policy() + , "" ); + + } + { //::SireMM::InverseBondRestraints::typeName + + typedef char const * ( *typeName_function_type )( ); + typeName_function_type typeName_function_value( &::SireMM::InverseBondRestraints::typeName ); + + InverseBondRestraints_exposer.def( + "typeName" + , typeName_function_value + , bp::release_gil_policy() + , "" ); + + } + { //::SireMM::InverseBondRestraints::what + + typedef char const * ( ::SireMM::InverseBondRestraints::*what_function_type)( ) const; + what_function_type what_function_value( &::SireMM::InverseBondRestraints::what ); + + InverseBondRestraints_exposer.def( + "what" + , what_function_value + , bp::release_gil_policy() + , "" ); + + } + InverseBondRestraints_exposer.staticmethod( "typeName" ); + InverseBondRestraints_exposer.def( "__copy__", &__copy__); + InverseBondRestraints_exposer.def( "__deepcopy__", &__copy__); + InverseBondRestraints_exposer.def( "clone", &__copy__); + InverseBondRestraints_exposer.def( "__rlshift__", &__rlshift__QDataStream< ::SireMM::InverseBondRestraints >, + bp::return_internal_reference<1, bp::with_custodian_and_ward<1,2> >() ); + InverseBondRestraints_exposer.def( "__rrshift__", &__rrshift__QDataStream< ::SireMM::InverseBondRestraints >, + bp::return_internal_reference<1, bp::with_custodian_and_ward<1,2> >() ); + InverseBondRestraints_exposer.def_pickle(sire_pickle_suite< ::SireMM::InverseBondRestraints >()); + InverseBondRestraints_exposer.def( "__str__", &__str__< ::SireMM::InverseBondRestraints > ); + InverseBondRestraints_exposer.def( "__repr__", &__str__< ::SireMM::InverseBondRestraints > ); + InverseBondRestraints_exposer.def( "__len__", &__len_size< ::SireMM::InverseBondRestraints > ); + } + +} diff --git a/wrapper/MM/InverseBondRestraints.pypp.hpp b/wrapper/MM/InverseBondRestraints.pypp.hpp new file mode 100644 index 000000000..0726c04ae --- /dev/null +++ b/wrapper/MM/InverseBondRestraints.pypp.hpp @@ -0,0 +1,10 @@ +// This file has been generated by Py++. + +// (C) Christopher Woods, GPL >= 3 License + +#ifndef InverseBondRestraints_hpp__pyplusplus_wrapper +#define InverseBondRestraints_hpp__pyplusplus_wrapper + +void register_InverseBondRestraints_class(); + +#endif//InverseBondRestraints_hpp__pyplusplus_wrapper diff --git a/wrapper/MM/MorsePotentialRestraint.pypp.cpp b/wrapper/MM/MorsePotentialRestraint.pypp.cpp index 9855c9561..d268d5403 100644 --- a/wrapper/MM/MorsePotentialRestraint.pypp.cpp +++ b/wrapper/MM/MorsePotentialRestraint.pypp.cpp @@ -39,7 +39,7 @@ void register_MorsePotentialRestraint_class(){ typedef bp::class_< SireMM::MorsePotentialRestraint, bp::bases< SireBase::Property > > MorsePotentialRestraint_exposer_t; MorsePotentialRestraint_exposer_t MorsePotentialRestraint_exposer = MorsePotentialRestraint_exposer_t( "MorsePotentialRestraint", "This class represents a single Morse restraint between any two\natoms in a system\n", bp::init< >("Null constructor") ); bp::scope MorsePotentialRestraint_scope( MorsePotentialRestraint_exposer ); - MorsePotentialRestraint_exposer.def( bp::init< qint64, qint64, SireUnits::Dimension::HarmonicBondConstant const &, SireUnits::Dimension::Length const &, SireUnits::Dimension::MolarEnergy const & >(( bp::arg("atom0"), bp::arg("atom1"), bp::arg("k"), bp::arg("r0"), bp::arg("de") ), "Construct to restrain the atom at index atom to the specified position\n using the specified force constant and flat-bottom well-width\n") ); + MorsePotentialRestraint_exposer.def( bp::init< qint64, qint64, SireUnits::Dimension::HarmonicBondConstant const &, SireUnits::Dimension::Length const &, SireUnits::Dimension::MolarEnergy const & >(( bp::arg("atom0"), bp::arg("atom1"), bp::arg("k"), bp::arg("r0"), bp::arg("de") ), "Construct to restrain the atom at index atom to the specified position\n using the specified force constant and well depth (dissociation energy)\n") ); MorsePotentialRestraint_exposer.def( bp::init< QList< long long > const &, QList< long long > const &, SireUnits::Dimension::HarmonicBondConstant const &, SireUnits::Dimension::Length const &, SireUnits::Dimension::MolarEnergy const & >(( bp::arg("atoms0"), bp::arg("atoms1"), bp::arg("k"), bp::arg("r0"), bp::arg("de") ), "Construct to restrain the atoms whose indicies are\n in atoms to the specified position using the specified force constant\n and dissociation energy\n") ); MorsePotentialRestraint_exposer.def( bp::init< SireMM::MorsePotentialRestraint const & >(( bp::arg("other") ), "Copy constructor") ); { //::SireMM::MorsePotentialRestraint::atom0 diff --git a/wrapper/MM/MorsePotentialRestraints.pypp.cpp b/wrapper/MM/MorsePotentialRestraints.pypp.cpp index bba601577..b03fc22e9 100644 --- a/wrapper/MM/MorsePotentialRestraints.pypp.cpp +++ b/wrapper/MM/MorsePotentialRestraints.pypp.cpp @@ -40,7 +40,7 @@ void register_MorsePotentialRestraints_class(){ { //::SireMM::MorsePotentialRestraints typedef bp::class_< SireMM::MorsePotentialRestraints, bp::bases< SireMM::Restraints, SireBase::Property > > MorsePotentialRestraints_exposer_t; - MorsePotentialRestraints_exposer_t MorsePotentialRestraints_exposer = MorsePotentialRestraints_exposer_t( "MorsePotentialRestraints", "This class provides the information for a collection of Moving Harmonic Restraints\nrestraints that can be added to a collection of molecules. Each\nrestraint can act on a pair of particles.\n", bp::init< >("Null constructor") ); + MorsePotentialRestraints_exposer_t MorsePotentialRestraints_exposer = MorsePotentialRestraints_exposer_t( "MorsePotentialRestraints", "This class provides the information for a collection of Morse potential\nrestraints that can be added to a collection of molecules. Each\nrestraint can act on a pair of particles.\n", bp::init< >("Null constructor") ); bp::scope MorsePotentialRestraints_scope( MorsePotentialRestraints_exposer ); MorsePotentialRestraints_exposer.def( bp::init< QString const & >(( bp::arg("name") ), "") ); MorsePotentialRestraints_exposer.def( bp::init< SireMM::MorsePotentialRestraint const & >(( bp::arg("restraint") ), "") ); @@ -122,6 +122,18 @@ void register_MorsePotentialRestraints_class(){ , bp::release_gil_policy() , "Return the number of restraints" ); + } + { //::SireMM::MorsePotentialRestraints::usesPbc + + typedef bool ( ::SireMM::MorsePotentialRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::MorsePotentialRestraints::usesPbc ); + + MorsePotentialRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::MorsePotentialRestraints::hasAtomRestraints @@ -248,6 +260,19 @@ void register_MorsePotentialRestraints_class(){ , bp::release_gil_policy() , "Return all of the restraints" ); + } + { //::SireMM::MorsePotentialRestraints::setUsesPbc + + typedef void ( ::SireMM::MorsePotentialRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::MorsePotentialRestraints::setUsesPbc ); + + MorsePotentialRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::MorsePotentialRestraints::size diff --git a/wrapper/MM/PositionalRestraints.pypp.cpp b/wrapper/MM/PositionalRestraints.pypp.cpp index 787f32e66..a179d8924 100644 --- a/wrapper/MM/PositionalRestraints.pypp.cpp +++ b/wrapper/MM/PositionalRestraints.pypp.cpp @@ -122,6 +122,18 @@ void register_PositionalRestraints_class(){ , bp::release_gil_policy() , "Return the number of restraints" ); + } + { //::SireMM::PositionalRestraints::usesPbc + + typedef bool ( ::SireMM::PositionalRestraints::*usesPbc_function_type)( ) const; + usesPbc_function_type usesPbc_function_value( &::SireMM::PositionalRestraints::usesPbc ); + + PositionalRestraints_exposer.def( + "usesPbc" + , usesPbc_function_value + , bp::release_gil_policy() + , "Return whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::PositionalRestraints::hasAtomRestraints @@ -248,6 +260,19 @@ void register_PositionalRestraints_class(){ , bp::release_gil_policy() , "Return all of the restraints" ); + } + { //::SireMM::PositionalRestraints::setUsesPbc + + typedef void ( ::SireMM::PositionalRestraints::*setUsesPbc_function_type)( bool ) ; + setUsesPbc_function_type setUsesPbc_function_value( &::SireMM::PositionalRestraints::setUsesPbc ); + + PositionalRestraints_exposer.def( + "setUsesPbc" + , setUsesPbc_function_value + , ( bp::arg("use_pbc") ) + , bp::release_gil_policy() + , "Set whether or not periodic boundary conditions are to be used" ); + } { //::SireMM::PositionalRestraints::size diff --git a/wrapper/MM/SireMM_properties.cpp b/wrapper/MM/SireMM_properties.cpp index 4939d13db..8728c6ce2 100644 --- a/wrapper/MM/SireMM_properties.cpp +++ b/wrapper/MM/SireMM_properties.cpp @@ -4,28 +4,6 @@ #include "Base/convertproperty.hpp" #include "SireMM_properties.h" -#include "SireBase/errors.h" -#include "SireBase/generalunitproperty.h" -#include "SireBase/lengthproperty.h" -#include "SireBase/numberproperty.h" -#include "SireBase/properties.h" -#include "SireBase/stringproperty.h" -#include "SireError/errors.h" -#include "SireMaths/multidouble.h" -#include "SireStream/datastream.h" -#include "SireStream/shareddatastream.h" -#include "SireVol/cartesian.h" -#include "SireVol/gridinfo.h" -#include "SireVol/periodicbox.h" -#include "SireVol/triclinicbox.h" -#include "cljboxes.h" -#include "cljfunction.h" -#include "switchingfunction.h" -#include "tbb/blocked_range.h" -#include "tbb/parallel_for.h" -#include "tostring.h" -#include -#include "cljfunction.h" #include "SireCAS/errors.h" #include "SireCAS/expression.h" #include "SireCAS/symbols.h" @@ -50,10 +28,32 @@ #include #include #include "switchingfunction.h" +#include "SireBase/errors.h" +#include "SireBase/generalunitproperty.h" +#include "SireBase/lengthproperty.h" +#include "SireBase/numberproperty.h" +#include "SireBase/properties.h" +#include "SireBase/stringproperty.h" +#include "SireError/errors.h" +#include "SireMaths/multidouble.h" +#include "SireStream/datastream.h" +#include "SireStream/shareddatastream.h" +#include "SireVol/cartesian.h" +#include "SireVol/gridinfo.h" +#include "SireVol/periodicbox.h" +#include "SireVol/triclinicbox.h" +#include "cljboxes.h" +#include "cljfunction.h" +#include "switchingfunction.h" +#include "tbb/blocked_range.h" +#include "tbb/parallel_for.h" +#include "tostring.h" +#include +#include "cljfunction.h" void register_SireMM_properties() { - register_property_container< SireMM::CLJFunctionPtr, SireMM::CLJFunction >(); register_property_container< SireMM::RestraintPtr, SireMM::Restraint >(); register_property_container< SireMM::Restraint3DPtr, SireMM::Restraint3D >(); register_property_container< SireMM::SwitchFuncPtr, SireMM::SwitchingFunction >(); + register_property_container< SireMM::CLJFunctionPtr, SireMM::CLJFunction >(); } diff --git a/wrapper/MM/SireMM_registrars.cpp b/wrapper/MM/SireMM_registrars.cpp index 0891d3f6c..5b7d1b0d4 100644 --- a/wrapper/MM/SireMM_registrars.cpp +++ b/wrapper/MM/SireMM_registrars.cpp @@ -3,121 +3,105 @@ #include "SireMM_registrars.h" -#include "cljrffunction.h" -#include "internalcomponent.h" -#include "threeatomfunctions.h" -#include "anglerestraints.h" -#include "gridff2.h" -#include "intergroupff.h" -#include "restraintff.h" -#include "lj1264parameter.h" -#include "interff.h" -#include "intersoftcljff.h" -#include "selectorbond.h" -#include "cljworkspace.h" -#include "internalparameters.h" +#include "multicljcomponent.h" +#include "intracoulombff.h" +#include "cljshiftfunction.h" +#include "cmapfunctions.h" +#include "gromacsparams.h" +#include "selectordihedral.h" #include "amberparams.h" -#include "selectorimproper.h" -#include "twoatomfunctions.h" -#include "ljpair.h" -#include "cmapparameter.h" -#include "ljparameter.h" -#include "cljboxes.h" -#include "cljgroup.h" -#include "excludedpairs.h" -#include "cljcomponent.h" -#include "atomljs.h" -#include "cljdelta.h" -#include "clj14group.h" -#include "intragroupff.h" -#include "positionalrestraints.h" #include "interljff.h" #include "cljatoms.h" -#include "mmdetail.h" -#include "bond.h" -#include "rmsdrestraints.h" -#include "cljgrid.h" -#include "intraff.h" -#include "internalgroupff.h" -#include "cljfunction.h" -#include "restraint.h" -#include "selectormangle.h" -#include "multicljcomponent.h" -#include "cmapfunctions.h" -#include "internalperturbation.h" -#include "cljprobe.h" +#include "ljperturbation.h" +#include "selectormdihedral.h" #include "boreschrestraints.h" -#include "cljparam.h" -#include "intercljff.h" +#include "intersoftcljff.h" #include "cljnbpairs.h" -#include "internalff.h" -#include "bondrestraints.h" -#include "intracljff.h" -#include "softcljcomponent.h" -#include "dihedralrestraints.h" -#include "intraljff.h" -#include "fouratomfunctions.h" -#include "restraintcomponent.h" -#include "morsepotentialrestraints.h" -#include "selectorangle.h" -#include "distancerestraint.h" -#include "selectordihedral.h" -#include "gridff.h" +#include "restraint.h" #include "cljextractor.h" -#include "ljperturbation.h" +#include "morsepotentialrestraints.h" #include "intercoulombff.h" +#include "switchingfunction.h" +#include "cljgroup.h" #include "selectormimproper.h" +#include "inversebondrestraints.h" +#include "cljdelta.h" +#include "cljprobe.h" +#include "internalcomponent.h" +#include "cmapparameter.h" +#include "dihedral.h" +#include "fouratomfunctions.h" +#include "internalff.h" #include "cljcalculator.h" +#include "cljfunction.h" +#include "dihedralrestraints.h" +#include "intercljff.h" +#include "bond.h" +#include "internalgroupff.h" +#include "rmsdrestraints.h" +#include "cljworkspace.h" +#include "softcljcomponent.h" +#include "ljparameter.h" +#include "lj1264parameter.h" #include "improper.h" -#include "gromacsparams.h" -#include "dihedral.h" -#include "selectormbond.h" +#include "selectorimproper.h" +#include "anglerestraints.h" +#include "selectorangle.h" +#include "intracljff.h" +#include "restraintff.h" +#include "distancerestraint.h" +#include "cljgrid.h" +#include "cljcomponent.h" +#include "internalparameters.h" +#include "atomljs.h" +#include "intergroupff.h" +#include "excludedpairs.h" +#include "ljpair.h" +#include "cljboxes.h" +#include "restraintcomponent.h" +#include "gridff.h" #include "intrasoftcljff.h" -#include "switchingfunction.h" +#include "selectormangle.h" +#include "intraljff.h" +#include "clj14group.h" #include "angle.h" -#include "selectormdihedral.h" -#include "cljshiftfunction.h" -#include "intracoulombff.h" +#include "selectorbond.h" +#include "selectormbond.h" +#include "interff.h" +#include "intragroupff.h" +#include "positionalrestraints.h" +#include "twoatomfunctions.h" +#include "intraff.h" +#include "gridff2.h" +#include "bondrestraints.h" +#include "mmdetail.h" +#include "internalperturbation.h" +#include "threeatomfunctions.h" +#include "cljparam.h" +#include "cljrffunction.h" #include "Helpers/objectregistry.hpp" void register_SireMM_objects() { - ObjectRegistry::registerConverterFor< SireMM::CLJRFFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CLJIntraRFFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CLJSoftRFFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CLJSoftIntraRFFunction >(); - ObjectRegistry::registerConverterFor< SireMM::BondComponent >(); - ObjectRegistry::registerConverterFor< SireMM::AngleComponent >(); - ObjectRegistry::registerConverterFor< SireMM::DihedralComponent >(); - ObjectRegistry::registerConverterFor< SireMM::ImproperComponent >(); - ObjectRegistry::registerConverterFor< SireMM::UreyBradleyComponent >(); - ObjectRegistry::registerConverterFor< SireMM::StretchStretchComponent >(); - ObjectRegistry::registerConverterFor< SireMM::StretchBendComponent >(); - ObjectRegistry::registerConverterFor< SireMM::BendBendComponent >(); - ObjectRegistry::registerConverterFor< SireMM::StretchBendTorsionComponent >(); - ObjectRegistry::registerConverterFor< SireMM::Intra14CoulombComponent >(); - ObjectRegistry::registerConverterFor< SireMM::Intra14LJComponent >(); - ObjectRegistry::registerConverterFor< SireMM::Intra14Component >(); - ObjectRegistry::registerConverterFor< SireMM::InternalComponent >(); - ObjectRegistry::registerConverterFor< SireMM::ThreeAtomFunctions >(); - ObjectRegistry::registerConverterFor< SireMM::AngleRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::AngleRestraints >(); - ObjectRegistry::registerConverterFor< SireMM::GridFF2 >(); - ObjectRegistry::registerConverterFor< SireMM::InterGroupFF >(); - ObjectRegistry::registerConverterFor< SireMM::RestraintFF >(); - ObjectRegistry::registerConverterFor< SireMM::LJ1264Parameter >(); - ObjectRegistry::registerConverterFor< SireMM::InterFF >(); - ObjectRegistry::registerConverterFor< SireMM::InterSoftCLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::InterSoftCLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::InterGroupSoftCLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::InterGroupSoftCLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorBond >(); - ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::CLJWorkspace >(); - ObjectRegistry::registerConverterFor< SireMM::InternalParameters >(); - ObjectRegistry::registerConverterFor< SireMM::InternalParameters3D >(); + ObjectRegistry::registerConverterFor< SireMM::MultiCLJComponent >(); + ObjectRegistry::registerConverterFor< SireMM::IntraCoulombFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::IntraCoulombFF >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupCoulombFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupCoulombFF >(); + ObjectRegistry::registerConverterFor< SireMM::CLJShiftFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJIntraShiftFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJSoftShiftFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJSoftIntraShiftFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CMAPFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CMAPFunctions >(); + ObjectRegistry::registerConverterFor< SireMM::GromacsAtomType >(); + ObjectRegistry::registerConverterFor< SireMM::GromacsBond >(); + ObjectRegistry::registerConverterFor< SireMM::GromacsAngle >(); + ObjectRegistry::registerConverterFor< SireMM::GromacsDihedral >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorDihedral >(); + ObjectRegistry::registerConverterFor< SireMol::Mover >(); ObjectRegistry::registerConverterFor< SireMM::AmberParams >(); ObjectRegistry::registerConverterFor< SireMM::AmberBond >(); ObjectRegistry::registerConverterFor< SireMM::AmberAngle >(); @@ -125,130 +109,149 @@ void register_SireMM_objects() ObjectRegistry::registerConverterFor< SireMM::AmberDihedral >(); ObjectRegistry::registerConverterFor< SireMM::AmberNB14 >(); ObjectRegistry::registerConverterFor< SireMM::AmberNBDihPart >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorImproper >(); - ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::TwoAtomFunctions >(); - ObjectRegistry::registerConverterFor< SireMM::LJPair >(); - ObjectRegistry::registerConverterFor< SireMM::CMAPParameter >(); - ObjectRegistry::registerConverterFor< SireMM::LJParameter >(); - ObjectRegistry::registerConverterFor< SireMM::CLJBox >(); - ObjectRegistry::registerConverterFor< SireMM::CLJBoxIndex >(); - ObjectRegistry::registerConverterFor< SireMM::CLJBoxes >(); - ObjectRegistry::registerConverterFor< SireMM::CLJBoxDistance >(); - ObjectRegistry::registerConverterFor< SireMM::CLJGroup >(); - ObjectRegistry::registerConverterFor< SireMM::ExcludedPairs >(); - ObjectRegistry::registerConverterFor< SireMM::CoulombComponent >(); - ObjectRegistry::registerConverterFor< SireMM::LJComponent >(); - ObjectRegistry::registerConverterFor< SireMM::CLJComponent >(); - ObjectRegistry::registerConverterFor< SireMM::AtomLJs >(); - ObjectRegistry::registerConverterFor< SireMM::LJException >(); - ObjectRegistry::registerConverterFor< SireMM::LJExceptionID >(); - ObjectRegistry::registerConverterFor< SireMM::CLJDelta >(); - ObjectRegistry::registerConverterFor< SireMM::CLJ14Group >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupFF >(); - ObjectRegistry::registerConverterFor< SireMM::PositionalRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::PositionalRestraints >(); ObjectRegistry::registerConverterFor< SireMM::InterLJFFBase >(); ObjectRegistry::registerConverterFor< SireMM::InterLJFF >(); ObjectRegistry::registerConverterFor< SireMM::InterGroupLJFFBase >(); ObjectRegistry::registerConverterFor< SireMM::InterGroupLJFF >(); ObjectRegistry::registerConverterFor< SireMM::CLJAtom >(); ObjectRegistry::registerConverterFor< SireMM::CLJAtoms >(); - ObjectRegistry::registerConverterFor< SireMM::MMDetail >(); - ObjectRegistry::registerConverterFor< SireMM::Bond >(); - ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::RMSDRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::RMSDRestraints >(); - ObjectRegistry::registerConverterFor< SireMM::CLJGrid >(); - ObjectRegistry::registerConverterFor< SireMM::IntraFF >(); - ObjectRegistry::registerConverterFor< SireMM::InternalGroupFF >(); - ObjectRegistry::registerConverterFor< SireMM::NullCLJFunction >(); - ObjectRegistry::registerConverterFor< SireMM::NullRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorMAngle >(); - ObjectRegistry::registerConverterFor< SireMM::MultiCLJComponent >(); - ObjectRegistry::registerConverterFor< SireMM::CMAPFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CMAPFunctions >(); - ObjectRegistry::registerConverterFor< SireMM::TwoAtomPerturbation >(); - ObjectRegistry::registerConverterFor< SireMM::ThreeAtomPerturbation >(); - ObjectRegistry::registerConverterFor< SireMM::FourAtomPerturbation >(); - ObjectRegistry::registerConverterFor< SireMM::CoulombProbe >(); - ObjectRegistry::registerConverterFor< SireMM::LJProbe >(); - ObjectRegistry::registerConverterFor< SireMM::CLJProbe >(); + ObjectRegistry::registerConverterFor< SireMM::LJPerturbation >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorMDihedral >(); ObjectRegistry::registerConverterFor< SireMM::BoreschRestraint >(); ObjectRegistry::registerConverterFor< SireMM::BoreschRestraints >(); - ObjectRegistry::registerConverterFor< SireMM::CLJParams >(); - ObjectRegistry::registerConverterFor< SireMM::CLJParamsArray >(); - ObjectRegistry::registerConverterFor< SireMM::InterCLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::InterCLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::InterGroupCLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::InterGroupCLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::InterSoftCLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::InterSoftCLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::InterGroupSoftCLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::InterGroupSoftCLJFF >(); ObjectRegistry::registerConverterFor< SireMM::CoulombScaleFactor >(); ObjectRegistry::registerConverterFor< SireMM::LJScaleFactor >(); ObjectRegistry::registerConverterFor< SireMM::CLJScaleFactor >(); ObjectRegistry::registerConverterFor< SireMM::CLJNBPairs >(); ObjectRegistry::registerConverterFor< SireMM::CoulombNBPairs >(); ObjectRegistry::registerConverterFor< SireMM::LJNBPairs >(); - ObjectRegistry::registerConverterFor< SireMM::InternalFF >(); - ObjectRegistry::registerConverterFor< SireMM::BondRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::BondRestraints >(); - ObjectRegistry::registerConverterFor< SireMM::IntraCLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::IntraCLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupCLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupCLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::SoftCLJComponent >(); - ObjectRegistry::registerConverterFor< SireMM::DihedralRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::DihedralRestraints >(); - ObjectRegistry::registerConverterFor< SireMM::IntraLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::IntraLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupLJFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::FourAtomFunctions >(); - ObjectRegistry::registerConverterFor< SireMM::RestraintComponent >(); + ObjectRegistry::registerConverterFor< SireMM::NullRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::CLJExtractor >(); ObjectRegistry::registerConverterFor< SireMM::MorsePotentialRestraint >(); ObjectRegistry::registerConverterFor< SireMM::MorsePotentialRestraints >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorAngle >(); - ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::DistanceRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::DoubleDistanceRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::TripleDistanceRestraint >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorDihedral >(); - ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::GridFF >(); - ObjectRegistry::registerConverterFor< SireMM::CLJExtractor >(); - ObjectRegistry::registerConverterFor< SireMM::LJPerturbation >(); ObjectRegistry::registerConverterFor< SireMM::InterCoulombFFBase >(); ObjectRegistry::registerConverterFor< SireMM::InterCoulombFF >(); ObjectRegistry::registerConverterFor< SireMM::InterGroupCoulombFFBase >(); ObjectRegistry::registerConverterFor< SireMM::InterGroupCoulombFF >(); + ObjectRegistry::registerConverterFor< SireMM::NoCutoff >(); + ObjectRegistry::registerConverterFor< SireMM::HarmonicSwitchingFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CHARMMSwitchingFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJGroup >(); ObjectRegistry::registerConverterFor< SireMM::SelectorMImproper >(); + ObjectRegistry::registerConverterFor< SireMM::InverseBondRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::InverseBondRestraints >(); + ObjectRegistry::registerConverterFor< SireMM::CLJDelta >(); + ObjectRegistry::registerConverterFor< SireMM::CoulombProbe >(); + ObjectRegistry::registerConverterFor< SireMM::LJProbe >(); + ObjectRegistry::registerConverterFor< SireMM::CLJProbe >(); + ObjectRegistry::registerConverterFor< SireMM::BondComponent >(); + ObjectRegistry::registerConverterFor< SireMM::AngleComponent >(); + ObjectRegistry::registerConverterFor< SireMM::DihedralComponent >(); + ObjectRegistry::registerConverterFor< SireMM::ImproperComponent >(); + ObjectRegistry::registerConverterFor< SireMM::UreyBradleyComponent >(); + ObjectRegistry::registerConverterFor< SireMM::StretchStretchComponent >(); + ObjectRegistry::registerConverterFor< SireMM::StretchBendComponent >(); + ObjectRegistry::registerConverterFor< SireMM::BendBendComponent >(); + ObjectRegistry::registerConverterFor< SireMM::StretchBendTorsionComponent >(); + ObjectRegistry::registerConverterFor< SireMM::Intra14CoulombComponent >(); + ObjectRegistry::registerConverterFor< SireMM::Intra14LJComponent >(); + ObjectRegistry::registerConverterFor< SireMM::Intra14Component >(); + ObjectRegistry::registerConverterFor< SireMM::InternalComponent >(); + ObjectRegistry::registerConverterFor< SireMM::CMAPParameter >(); + ObjectRegistry::registerConverterFor< SireMM::Dihedral >(); + ObjectRegistry::registerConverterFor< SireMol::Mover >(); + ObjectRegistry::registerConverterFor< SireMM::FourAtomFunctions >(); + ObjectRegistry::registerConverterFor< SireMM::InternalFF >(); ObjectRegistry::registerConverterFor< SireMM::CLJCalculator >(); + ObjectRegistry::registerConverterFor< SireMM::NullCLJFunction >(); + ObjectRegistry::registerConverterFor< SireMM::DihedralRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::DihedralRestraints >(); + ObjectRegistry::registerConverterFor< SireMM::InterCLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::InterCLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::InterGroupCLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::InterGroupCLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::Bond >(); + ObjectRegistry::registerConverterFor< SireMol::Mover >(); + ObjectRegistry::registerConverterFor< SireMM::InternalGroupFF >(); + ObjectRegistry::registerConverterFor< SireMM::RMSDRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::RMSDRestraints >(); + ObjectRegistry::registerConverterFor< SireMM::CLJWorkspace >(); + ObjectRegistry::registerConverterFor< SireMM::SoftCLJComponent >(); + ObjectRegistry::registerConverterFor< SireMM::LJParameter >(); + ObjectRegistry::registerConverterFor< SireMM::LJ1264Parameter >(); ObjectRegistry::registerConverterFor< SireMM::Improper >(); ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::GromacsAtomType >(); - ObjectRegistry::registerConverterFor< SireMM::GromacsBond >(); - ObjectRegistry::registerConverterFor< SireMM::GromacsAngle >(); - ObjectRegistry::registerConverterFor< SireMM::GromacsDihedral >(); - ObjectRegistry::registerConverterFor< SireMM::Dihedral >(); - ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorMBond >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorImproper >(); + ObjectRegistry::registerConverterFor< SireMol::Mover >(); + ObjectRegistry::registerConverterFor< SireMM::AngleRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::AngleRestraints >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorAngle >(); + ObjectRegistry::registerConverterFor< SireMol::Mover >(); + ObjectRegistry::registerConverterFor< SireMM::IntraCLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::IntraCLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupCLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupCLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::RestraintFF >(); + ObjectRegistry::registerConverterFor< SireMM::DistanceRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::DoubleDistanceRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::TripleDistanceRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::CLJGrid >(); + ObjectRegistry::registerConverterFor< SireMM::CoulombComponent >(); + ObjectRegistry::registerConverterFor< SireMM::LJComponent >(); + ObjectRegistry::registerConverterFor< SireMM::CLJComponent >(); + ObjectRegistry::registerConverterFor< SireMM::InternalParameters >(); + ObjectRegistry::registerConverterFor< SireMM::InternalParameters3D >(); + ObjectRegistry::registerConverterFor< SireMM::AtomLJs >(); + ObjectRegistry::registerConverterFor< SireMM::LJException >(); + ObjectRegistry::registerConverterFor< SireMM::LJExceptionID >(); + ObjectRegistry::registerConverterFor< SireMM::InterGroupFF >(); + ObjectRegistry::registerConverterFor< SireMM::ExcludedPairs >(); + ObjectRegistry::registerConverterFor< SireMM::LJPair >(); + ObjectRegistry::registerConverterFor< SireMM::CLJBox >(); + ObjectRegistry::registerConverterFor< SireMM::CLJBoxIndex >(); + ObjectRegistry::registerConverterFor< SireMM::CLJBoxes >(); + ObjectRegistry::registerConverterFor< SireMM::CLJBoxDistance >(); + ObjectRegistry::registerConverterFor< SireMM::RestraintComponent >(); + ObjectRegistry::registerConverterFor< SireMM::GridFF >(); ObjectRegistry::registerConverterFor< SireMM::IntraSoftCLJFFBase >(); ObjectRegistry::registerConverterFor< SireMM::IntraSoftCLJFF >(); ObjectRegistry::registerConverterFor< SireMM::IntraGroupSoftCLJFFBase >(); ObjectRegistry::registerConverterFor< SireMM::IntraGroupSoftCLJFF >(); - ObjectRegistry::registerConverterFor< SireMM::NoCutoff >(); - ObjectRegistry::registerConverterFor< SireMM::HarmonicSwitchingFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CHARMMSwitchingFunction >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorMAngle >(); + ObjectRegistry::registerConverterFor< SireMM::IntraLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::IntraLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupLJFFBase >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupLJFF >(); + ObjectRegistry::registerConverterFor< SireMM::CLJ14Group >(); ObjectRegistry::registerConverterFor< SireMM::Angle >(); ObjectRegistry::registerConverterFor< SireMol::Mover >(); - ObjectRegistry::registerConverterFor< SireMM::SelectorMDihedral >(); - ObjectRegistry::registerConverterFor< SireMM::CLJShiftFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CLJIntraShiftFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CLJSoftShiftFunction >(); - ObjectRegistry::registerConverterFor< SireMM::CLJSoftIntraShiftFunction >(); - ObjectRegistry::registerConverterFor< SireMM::IntraCoulombFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::IntraCoulombFF >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupCoulombFFBase >(); - ObjectRegistry::registerConverterFor< SireMM::IntraGroupCoulombFF >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorBond >(); + ObjectRegistry::registerConverterFor< SireMol::Mover >(); + ObjectRegistry::registerConverterFor< SireMM::SelectorMBond >(); + ObjectRegistry::registerConverterFor< SireMM::InterFF >(); + ObjectRegistry::registerConverterFor< SireMM::IntraGroupFF >(); + ObjectRegistry::registerConverterFor< SireMM::PositionalRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::PositionalRestraints >(); + ObjectRegistry::registerConverterFor< SireMM::TwoAtomFunctions >(); + ObjectRegistry::registerConverterFor< SireMM::IntraFF >(); + ObjectRegistry::registerConverterFor< SireMM::GridFF2 >(); + ObjectRegistry::registerConverterFor< SireMM::BondRestraint >(); + ObjectRegistry::registerConverterFor< SireMM::BondRestraints >(); + ObjectRegistry::registerConverterFor< SireMM::MMDetail >(); + ObjectRegistry::registerConverterFor< SireMM::TwoAtomPerturbation >(); + ObjectRegistry::registerConverterFor< SireMM::ThreeAtomPerturbation >(); + ObjectRegistry::registerConverterFor< SireMM::FourAtomPerturbation >(); + ObjectRegistry::registerConverterFor< SireMM::ThreeAtomFunctions >(); + ObjectRegistry::registerConverterFor< SireMM::CLJParams >(); + ObjectRegistry::registerConverterFor< SireMM::CLJParamsArray >(); + ObjectRegistry::registerConverterFor< SireMM::CLJRFFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJIntraRFFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJSoftRFFunction >(); + ObjectRegistry::registerConverterFor< SireMM::CLJSoftIntraRFFunction >(); } diff --git a/wrapper/MM/_MM.main.cpp b/wrapper/MM/_MM.main.cpp index 06560baae..28f418d1d 100644 --- a/wrapper/MM/_MM.main.cpp +++ b/wrapper/MM/_MM.main.cpp @@ -307,6 +307,10 @@ #include "IntraSoftCLJFFBase.pypp.hpp" +#include "InverseBondRestraint.pypp.hpp" + +#include "InverseBondRestraints.pypp.hpp" + #include "LJ1264Parameter.pypp.hpp" #include "LJComponent.pypp.hpp" @@ -788,6 +792,10 @@ BOOST_PYTHON_MODULE(_MM){ register_IntraGroupFF_class(); + register_InverseBondRestraint_class(); + + register_InverseBondRestraints_class(); + register_LJ1264Parameter_class(); register_LJComponent_class(); diff --git a/wrapper/MM/active_headers.h b/wrapper/MM/active_headers.h index ed4345abd..c4943414c 100644 --- a/wrapper/MM/active_headers.h +++ b/wrapper/MM/active_headers.h @@ -57,6 +57,7 @@ #include "intragroupff.h" #include "intraljff.h" #include "intrasoftcljff.h" +#include "inversebondrestraints.h" #include "lj1264parameter.h" #include "ljpair.h" #include "ljparameter.h"