From 7b8ba84a0cd8f0bc7b12a08165ca6ac3c324c7c9 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Thu, 24 Sep 2026 20:52:32 +0100 Subject: [PATCH] Backport fix from PR #488. [ci skip] --- corelib/src/libs/SireBase/countflops.cpp | 2 + corelib/src/libs/SireBase/pagecache.cpp | 14 +- corelib/src/libs/SireBase/process.cpp | 2 +- corelib/src/libs/SireBase/progressbar.cpp | 4 +- corelib/src/libs/SireCAS/CMakeLists.txt | 5 + corelib/src/libs/SireCAS/lambdaschedule.cpp | 4 +- corelib/src/libs/SireCAS/symbol.h | 7 + corelib/src/libs/SireCluster/node.cpp | 4 +- corelib/src/libs/SireCluster/nodes.cpp | 2 +- corelib/src/libs/SireIO/netcdffile.cpp | 2 +- .../src/libs/SireIO/perturbationslibrary.cpp | 12 +- .../src/libs/SireIO/third_party/xdrfile_trr.c | 2 +- corelib/src/libs/SireIO/tinker.cpp | 4 - corelib/src/libs/SireIO/zmatrixmaker.cpp | 4 +- corelib/src/libs/SireMM/anglerestraints.cpp | 5 +- corelib/src/libs/SireMM/cljatoms.cpp | 28 +- corelib/src/libs/SireMM/cljboxes.cpp | 2 +- corelib/src/libs/SireMM/cljworkspace.cpp | 10 +- corelib/src/libs/SireMM/cmapfunctions.cpp | 6 +- corelib/src/libs/SireMM/gridff.cpp | 39 +- corelib/src/libs/SireMM/gridff2.cpp | 30 - corelib/src/libs/SireMM/intragroupff.cpp | 4 +- corelib/src/libs/SireMM/multicljcomponent.cpp | 4 +- corelib/src/libs/SireMM/multicljcomponent.h | 4 +- corelib/src/libs/SireMaths/CMakeLists.txt | 5 + corelib/src/libs/SireMaths/linearap.cpp | 4 - corelib/src/libs/SireMaths/matrix.cpp | 4 +- corelib/src/libs/SireMaths/multifixed.cpp | 19 - corelib/src/libs/SireMaths/n4matrix.cpp | 4 +- corelib/src/libs/SireMaths/nmatrix.cpp | 2 + corelib/src/libs/SireMaths/rangenerator.cpp | 10 +- corelib/src/libs/SireMaths/sphere.cpp | 11 +- corelib/src/libs/SireMol/atomidx.h | 1 + corelib/src/libs/SireMol/cgidx.h | 1 + corelib/src/libs/SireMol/chainidx.h | 1 + corelib/src/libs/SireMol/connectivity.cpp | 18 +- corelib/src/libs/SireMol/iswater.cpp | 6 +- .../src/libs/SireMol/molgroupworkspace.cpp | 10 +- corelib/src/libs/SireMol/molgroupworkspace.h | 2 +- corelib/src/libs/SireMol/residx.h | 1 + corelib/src/libs/SireMol/segidx.h | 1 + corelib/src/libs/SireMol/select.cpp | 14 +- corelib/src/libs/SireMol/selectorm.hpp | 6 +- corelib/src/libs/SireMol/structureeditor.cpp | 4 +- corelib/src/libs/SireMol/trajectory.cpp | 24 +- corelib/src/libs/SireMove/CMakeLists.txt | 5 + corelib/src/libs/SireMove/hybridmc.h | 1 + .../src/libs/SireMove/openmmfrenergydt.cpp | 10 +- .../src/libs/SireMove/openmmfrenergyst.cpp | 37 +- corelib/src/libs/SireMove/openmmpmefep.cpp | 19 +- corelib/src/libs/SireMove/rigidbodymc.cpp | 4 +- corelib/src/libs/SireSystem/closemols.cpp | 20 +- .../src/libs/SireSystem/forcefieldinfo.cpp | 5 +- .../src/libs/SireSystem/systemtrajectory.cpp | 8 +- corelib/src/libs/SireVol/transformedspace.h | 2 + corelib/src/libs/Squire/mopac.h | 1 + pixi.toml | 4 +- tests/qm/test_qm.py | 40 +- wrapper/Convert/SireOpenMM/CMakeLists.txt | 5 + .../Convert/SireOpenMM/LambdaLever.pypp.cpp | 2 +- .../Convert/SireOpenMM/NullQMEngine.pypp.cpp | 50 +- .../PerturbableOpenMMMolecule.pypp.cpp | 850 +++++++----------- .../Convert/SireOpenMM/PyQMEngine.pypp.cpp | 2 +- wrapper/Convert/SireOpenMM/QMEngine.pypp.cpp | 52 +- .../Convert/SireOpenMM/TorchQMEngine.pypp.cpp | 2 +- wrapper/Convert/SireOpenMM/scanheaders.py | 33 +- wrapper/Convert/__init__.py | 15 +- 67 files changed, 663 insertions(+), 852 deletions(-) diff --git a/corelib/src/libs/SireBase/countflops.cpp b/corelib/src/libs/SireBase/countflops.cpp index 9a93fb224..46e27e21c 100644 --- a/corelib/src/libs/SireBase/countflops.cpp +++ b/corelib/src/libs/SireBase/countflops.cpp @@ -215,8 +215,10 @@ double FlopsMark::operator-(const FlopsMark &other) const return (1000.0 * dnflops) / dms; } +#ifdef SIRE_TIME_ROUTINES Q_GLOBAL_STATIC_WITH_ARGS(double, benchmarkSum, (0.0)) Q_GLOBAL_STATIC(QMutex, benchmarkMutex) +#endif /** Perform a simple benchmark to work out what the realistic maximum FLOPS count for this processor (compiled with this compiler) diff --git a/corelib/src/libs/SireBase/pagecache.cpp b/corelib/src/libs/SireBase/pagecache.cpp index 1db2ddc2a..9fce3a8d0 100644 --- a/corelib/src/libs/SireBase/pagecache.cpp +++ b/corelib/src/libs/SireBase/pagecache.cpp @@ -30,18 +30,18 @@ #include "SireError/errors.h" -#include "SireBase/parallel.h" -#include "SireBase/console.h" #include "SireBase/atexit.h" +#include "SireBase/console.h" +#include "SireBase/parallel.h" +#include #include -#include -#include #include #include -#include +#include #include -#include +#include +#include #include @@ -1074,7 +1074,7 @@ void CacheData::run() const unsigned int n_bytes = static_cast(data.size()); - if (n_bytes >= page_size) + if (n_bytes >= static_cast(page_size)) { // this is bigger than a page, so needs to have its // own page! diff --git a/corelib/src/libs/SireBase/process.cpp b/corelib/src/libs/SireBase/process.cpp index 529918545..0c9bd3d68 100644 --- a/corelib/src/libs/SireBase/process.cpp +++ b/corelib/src/libs/SireBase/process.cpp @@ -194,7 +194,7 @@ Process::Process(const Process &other) : d(other.d) /** Destructor */ Process::~Process() { - if (d.unique()) + if (d.use_count() == 1) { this->kill(); } diff --git a/corelib/src/libs/SireBase/progressbar.cpp b/corelib/src/libs/SireBase/progressbar.cpp index c15d27f39..7093442b8 100644 --- a/corelib/src/libs/SireBase/progressbar.cpp +++ b/corelib/src/libs/SireBase/progressbar.cpp @@ -28,9 +28,9 @@ #include "progressbar.h" +#include #include #include -#include #include @@ -450,7 +450,7 @@ namespace SireBase { QMutexLocker lkr(&mutex); - if (not bar.d.unique()) + if (bar.d.use_count() != 1) bar.d = bar.d->clone(); if (has_finished) diff --git a/corelib/src/libs/SireCAS/CMakeLists.txt b/corelib/src/libs/SireCAS/CMakeLists.txt index aa1fd4f99..aadd9b5e9 100644 --- a/corelib/src/libs/SireCAS/CMakeLists.txt +++ b/corelib/src/libs/SireCAS/CMakeLists.txt @@ -91,6 +91,11 @@ set ( SIRECAS_SOURCES ) +# NaN is used to mark missing values, so it must survive -ffast-math. +if (NOT MSVC) + set_source_files_properties(lambdaschedule.cpp PROPERTIES COMPILE_OPTIONS "-fno-finite-math-only") +endif() + add_library (SireCAS ${SIRECAS_SOURCES}) set_target_properties (SireCAS PROPERTIES diff --git a/corelib/src/libs/SireCAS/lambdaschedule.cpp b/corelib/src/libs/SireCAS/lambdaschedule.cpp index bcca60fa1..9d22dc6ae 100644 --- a/corelib/src/libs/SireCAS/lambdaschedule.cpp +++ b/corelib/src/libs/SireCAS/lambdaschedule.cpp @@ -185,8 +185,8 @@ LambdaSchedule::LambdaSchedule(const LambdaSchedule &other) lever_names(other.lever_names), stage_names(other.stage_names), default_equations(other.default_equations), stage_equations(other.stage_equations), - coupled_levers(other.coupled_levers), - stage_weights(other.stage_weights) + stage_weights(other.stage_weights), + coupled_levers(other.coupled_levers) { } diff --git a/corelib/src/libs/SireCAS/symbol.h b/corelib/src/libs/SireCAS/symbol.h index cb9d08070..bfb3ecc15 100644 --- a/corelib/src/libs/SireCAS/symbol.h +++ b/corelib/src/libs/SireCAS/symbol.h @@ -112,6 +112,13 @@ namespace SireCAS bool operator==(const ExBase &other) const; + /** Exact match so C++20 doesn't find this ambiguous with the + reversed Expression overload */ + bool operator==(const Symbol &other) const + { + return this->operator==(static_cast(other)); + } + bool operator<(const Symbol &other) const; bool operator>(const Symbol &other) const; bool operator<=(const Symbol &other) const; diff --git a/corelib/src/libs/SireCluster/node.cpp b/corelib/src/libs/SireCluster/node.cpp index b392c34f0..83ba4aedf 100644 --- a/corelib/src/libs/SireCluster/node.cpp +++ b/corelib/src/libs/SireCluster/node.cpp @@ -227,7 +227,7 @@ bool Node::release() d.reset(); - return my_d.unique(); + return my_d.use_count() == 1; } /** Force the release of this node. This aborts any running @@ -243,7 +243,7 @@ void Node::forceRelease() d.reset(); - if (my_d.unique()) + if (my_d.use_count() == 1) { // just reset this pointer, and we are ok my_d.reset(); diff --git a/corelib/src/libs/SireCluster/nodes.cpp b/corelib/src/libs/SireCluster/nodes.cpp index e78b7a886..3c74cca08 100644 --- a/corelib/src/libs/SireCluster/nodes.cpp +++ b/corelib/src/libs/SireCluster/nodes.cpp @@ -180,7 +180,7 @@ Nodes::Nodes(const Nodes &other) : d(other.d) /** Destructor */ Nodes::~Nodes() { - if (d.unique()) + if (d.use_count() == 1) { this->removeAll(); } diff --git a/corelib/src/libs/SireIO/netcdffile.cpp b/corelib/src/libs/SireIO/netcdffile.cpp index 16fc548ee..4556fd7a6 100644 --- a/corelib/src/libs/SireIO/netcdffile.cpp +++ b/corelib/src/libs/SireIO/netcdffile.cpp @@ -779,7 +779,7 @@ NetCDFDataInfo::NetCDFDataInfo(const NetCDFDataInfo &other, const NetCDFHyperSla for (int i = 0; i < dim_sizes.count(); ++i) { - if (slab.starts()[i] < 0 or slab.starts()[i] + slab.counts()[i] > dim_sizes[i]) + if (slab.starts()[i] + slab.counts()[i] > static_cast(dim_sizes[i])) { throw SireError::invalid_index(QObject::tr( "The slab for dimension %1 has the wrong shape (%2, %3) when the " diff --git a/corelib/src/libs/SireIO/perturbationslibrary.cpp b/corelib/src/libs/SireIO/perturbationslibrary.cpp index 0835f3a58..893e850ea 100644 --- a/corelib/src/libs/SireIO/perturbationslibrary.cpp +++ b/corelib/src/libs/SireIO/perturbationslibrary.cpp @@ -1191,7 +1191,7 @@ Molecule PerturbationsLibrary::applyTemplate(const Molecule &molecule) const SireUnits::Dimension::Charge icharge = pert.getInitCharge(iname); atom.setProperty(initial_charge_property, icharge); } - catch (const SireError::invalid_key) + catch (const SireError::invalid_key &) { continue; } @@ -1200,7 +1200,7 @@ Molecule PerturbationsLibrary::applyTemplate(const Molecule &molecule) const SireUnits::Dimension::Charge fcharge = pert.getFinalCharge(iname); atom.setProperty(final_charge_property, fcharge); } - catch (const SireError::invalid_key) + catch (const SireError::invalid_key &) { continue; } @@ -1210,7 +1210,7 @@ Molecule PerturbationsLibrary::applyTemplate(const Molecule &molecule) const LJParameter ilj = pert.getInitLJ(iname); atom.setProperty(initial_LJ_property, ilj); } - catch (const SireError::invalid_key) + catch (const SireError::invalid_key &) { continue; } @@ -1219,7 +1219,7 @@ Molecule PerturbationsLibrary::applyTemplate(const Molecule &molecule) const LJParameter flj = pert.getFinalLJ(iname); atom.setProperty(final_LJ_property, flj); } - catch (const SireError::invalid_key) + catch (const SireError::invalid_key &) { continue; } @@ -1229,7 +1229,7 @@ Molecule PerturbationsLibrary::applyTemplate(const Molecule &molecule) const QString iatype = pert.getInitType(iname); atom.setProperty(initial_ambertype_property, iatype); } - catch (const SireError::invalid_key) + catch (const SireError::invalid_key &) { continue; } @@ -1238,7 +1238,7 @@ Molecule PerturbationsLibrary::applyTemplate(const Molecule &molecule) const QString fatype = pert.getFinalType(iname); atom.setProperty(final_ambertype_property, fatype); } - catch (const SireError::invalid_key) + catch (const SireError::invalid_key &) { continue; } diff --git a/corelib/src/libs/SireIO/third_party/xdrfile_trr.c b/corelib/src/libs/SireIO/third_party/xdrfile_trr.c index ba07da5e0..03e0d61d2 100644 --- a/corelib/src/libs/SireIO/third_party/xdrfile_trr.c +++ b/corelib/src/libs/SireIO/third_party/xdrfile_trr.c @@ -481,7 +481,7 @@ int read_trr_natoms(char *fn, int *natoms) int write_trr(XDRFILE *xd, int natoms, int step, float t, float lambda, matrix box, rvec *x, rvec *v, rvec *f) { - int *plcholder; + int *plcholder = NULL; return do_trn(xd, 0, &step, &t, &lambda, box, &natoms, x, v, f, plcholder); } diff --git a/corelib/src/libs/SireIO/tinker.cpp b/corelib/src/libs/SireIO/tinker.cpp index a2aa3e54e..3f9356b90 100644 --- a/corelib/src/libs/SireIO/tinker.cpp +++ b/corelib/src/libs/SireIO/tinker.cpp @@ -482,12 +482,8 @@ void Tinker::loadParameters(const QString &prmfile) QTextStream ts(&f); - int linenum = -1; - while (not ts.atEnd()) { - ++linenum; - QString line = ts.readLine().simplified(); if (line.isEmpty() or line.startsWith("#")) diff --git a/corelib/src/libs/SireIO/zmatrixmaker.cpp b/corelib/src/libs/SireIO/zmatrixmaker.cpp index f0b3b0c6a..5ad1cc1fd 100644 --- a/corelib/src/libs/SireIO/zmatrixmaker.cpp +++ b/corelib/src/libs/SireIO/zmatrixmaker.cpp @@ -217,7 +217,7 @@ void ZmatrixTemplate::setDihedralDelta(const QString &atom, const QString &bond, // Implementation of ZmatrixResidue // -ZmatrixResidue::ZmatrixResidue(const QString &name) : ZmatrixTemplate(name) +ZmatrixResidue::ZmatrixResidue(const QString &name) : ZmatrixTemplate(name), rotate(0), translate(0) { } @@ -593,7 +593,7 @@ Molecule ZmatrixMaker::applyTemplates(Molecule &molecule) { linetemplate = restemplate.getZmatrixLineTemplate(atom.name().value()); } - catch (SireError::invalid_key) + catch (const SireError::invalid_key &) { /** If this fails, look also in the matching backbone zmatrix*/ ZmatrixTemplate chain = restemplate.getChain(position); diff --git a/corelib/src/libs/SireMM/anglerestraints.cpp b/corelib/src/libs/SireMM/anglerestraints.cpp index a12978fc4..70f22b904 100644 --- a/corelib/src/libs/SireMM/anglerestraints.cpp +++ b/corelib/src/libs/SireMM/anglerestraints.cpp @@ -85,7 +85,7 @@ QDataStream &operator>>(QDataStream &ds, AngleRestraint &angrest) /** Null constructor */ AngleRestraint::AngleRestraint() : ConcreteProperty(), - _ktheta(0), _theta0(0) + _theta0(0), _ktheta(0) { } @@ -253,8 +253,7 @@ QDataStream &operator>>(QDataStream &ds, AngleRestraints &angrests) { SharedDataStream sds(ds); - sds >> angrests.r >> angrests.use_pbc - >> static_cast(angrests); + sds >> angrests.r >> angrests.use_pbc >> static_cast(angrests); } else throw version_error(v, "1,2", r_angrests, CODELOC); diff --git a/corelib/src/libs/SireMM/cljatoms.cpp b/corelib/src/libs/SireMM/cljatoms.cpp index fbdd0281d..501ca1043 100644 --- a/corelib/src/libs/SireMM/cljatoms.cpp +++ b/corelib/src/libs/SireMM/cljatoms.cpp @@ -1638,13 +1638,13 @@ void CLJAtoms::append(const CLJAtoms &other, int n) if (n_whole > 0) { - std::memcpy(&(_x[start_idx]), &(other._x[0]), n_whole * sizeof(MultiFloat)); - std::memcpy(&(_y[start_idx]), &(other._y[0]), n_whole * sizeof(MultiFloat)); - std::memcpy(&(_z[start_idx]), &(other._z[0]), n_whole * sizeof(MultiFloat)); - std::memcpy(&(_q[start_idx]), &(other._q[0]), n_whole * sizeof(MultiFloat)); - std::memcpy(&(_sig[start_idx]), &(other._sig[0]), n_whole * sizeof(MultiFloat)); - std::memcpy(&(_eps[start_idx]), &(other._eps[0]), n_whole * sizeof(MultiFloat)); - std::memcpy(&(_id[start_idx]), &(other._id[0]), n_whole * sizeof(MultiInt)); + std::memcpy(static_cast(&(_x[start_idx])), &(other._x[0]), n_whole * sizeof(MultiFloat)); + std::memcpy(static_cast(&(_y[start_idx])), &(other._y[0]), n_whole * sizeof(MultiFloat)); + std::memcpy(static_cast(&(_z[start_idx])), &(other._z[0]), n_whole * sizeof(MultiFloat)); + std::memcpy(static_cast(&(_q[start_idx])), &(other._q[0]), n_whole * sizeof(MultiFloat)); + std::memcpy(static_cast(&(_sig[start_idx])), &(other._sig[0]), n_whole * sizeof(MultiFloat)); + std::memcpy(static_cast(&(_eps[start_idx])), &(other._eps[0]), n_whole * sizeof(MultiFloat)); + std::memcpy(static_cast(&(_id[start_idx])), &(other._id[0]), n_whole * sizeof(MultiInt)); } if (n_partial > 0) @@ -1888,13 +1888,13 @@ void CLJAtoms::copyIn(const CLJAtoms &other) const int nelements = other._x.count(); - std::memcpy(_x.data(), other._x.constData(), nelements * sizeof(MultiFloat)); - std::memcpy(_y.data(), other._y.constData(), nelements * sizeof(MultiFloat)); - std::memcpy(_z.data(), other._z.constData(), nelements * sizeof(MultiFloat)); - std::memcpy(_q.data(), other._q.constData(), nelements * sizeof(MultiFloat)); - std::memcpy(_sig.data(), other._sig.constData(), nelements * sizeof(MultiFloat)); - std::memcpy(_eps.data(), other._eps.constData(), nelements * sizeof(MultiFloat)); - std::memcpy(_id.data(), other._id.constData(), nelements * sizeof(MultiInt)); + std::memcpy(static_cast(_x.data()), other._x.constData(), nelements * sizeof(MultiFloat)); + std::memcpy(static_cast(_y.data()), other._y.constData(), nelements * sizeof(MultiFloat)); + std::memcpy(static_cast(_z.data()), other._z.constData(), nelements * sizeof(MultiFloat)); + std::memcpy(static_cast(_q.data()), other._q.constData(), nelements * sizeof(MultiFloat)); + std::memcpy(static_cast(_sig.data()), other._sig.constData(), nelements * sizeof(MultiFloat)); + std::memcpy(static_cast(_eps.data()), other._eps.constData(), nelements * sizeof(MultiFloat)); + std::memcpy(static_cast(_id.data()), other._id.constData(), nelements * sizeof(MultiInt)); } /** Return a copy of these CLJAtoms where the charge and LJ epsilon parameters diff --git a/corelib/src/libs/SireMM/cljboxes.cpp b/corelib/src/libs/SireMM/cljboxes.cpp index ecfb49668..28df96dd1 100644 --- a/corelib/src/libs/SireMM/cljboxes.cpp +++ b/corelib/src/libs/SireMM/cljboxes.cpp @@ -116,7 +116,7 @@ void CLJBox::findGaps() const QVector &ids = atms.ID(); - const quint32 dummy_id = CLJAtoms::idOfDummy()[0]; + const qint32 dummy_id = CLJAtoms::idOfDummy()[0]; for (int i = ids.count() - 1; i >= 0; --i) { diff --git a/corelib/src/libs/SireMM/cljworkspace.cpp b/corelib/src/libs/SireMM/cljworkspace.cpp index ff545bafb..b067acd1a 100644 --- a/corelib/src/libs/SireMM/cljworkspace.cpp +++ b/corelib/src/libs/SireMM/cljworkspace.cpp @@ -108,7 +108,7 @@ namespace SireMM { // loop over the old and new atoms { - const QVector &ids = deltas.constData()[i].newAtoms().ID(); + const QVector ids = deltas.constData()[i].newAtoms().ID(); for (int j = 0; j < ids.count(); ++j) { @@ -131,7 +131,7 @@ namespace SireMM // loop over the old and new atoms { - const QVector &ids = deltas.constData()[i].oldAtoms().ID(); + const QVector ids = deltas.constData()[i].oldAtoms().ID(); for (int j = 0; j < ids.count(); ++j) { @@ -516,7 +516,7 @@ void CLJWorkspace::returnToMemoryPool() if (d.get() == 0) return; - if (not d.unique()) + if (d.use_count() != 1) { d.reset(); return; @@ -541,7 +541,7 @@ void CLJWorkspace::createFromMemoryPool() { if (d.get() != 0) { - if (d.unique()) + if (d.use_count() == 1) { d->clear(); return; @@ -694,7 +694,7 @@ void CLJWorkspace::detach() { if (d.get() != 0) { - if (not d.unique()) + if (d.use_count() != 1) { std::shared_ptr d2 = d; d.reset(); diff --git a/corelib/src/libs/SireMM/cmapfunctions.cpp b/corelib/src/libs/SireMM/cmapfunctions.cpp index a42ca4b8a..1e15a324c 100644 --- a/corelib/src/libs/SireMM/cmapfunctions.cpp +++ b/corelib/src/libs/SireMM/cmapfunctions.cpp @@ -32,11 +32,11 @@ #include "SireBase/console.h" +#include "SireMol/atommapping.h" #include "SireMol/atommatcher.h" #include "SireMol/atomselection.h" -#include "SireMol/moleculeinfodata.h" #include "SireMol/moleculedata.h" -#include "SireMol/atommapping.h" +#include "SireMol/moleculeinfodata.h" #include "SireError/errors.h" @@ -365,7 +365,7 @@ void CMAPFunctions::set(AtomIdx atom0, AtomIdx atom1, AtomIdx atom2, quint32 atm3 = atom3.map(info().nAtoms()); quint32 atm4 = atom4.map(info().nAtoms()); - if (atm0 == atm1 or atm0 == atm2 or atm0 == atm3 or atm0 == atom4 or + if (atm0 == atm1 or atm0 == atm2 or atm0 == atm3 or atm0 == atm4 or atm1 == atm2 or atm1 == atm3 or atm1 == atm4 or atm2 == atm3 or atm2 == atm4 or atm3 == atm4) throw SireMol::duplicate_atom(QObject::tr("You cannot add a function that acts between the same atoms! " diff --git a/corelib/src/libs/SireMM/gridff.cpp b/corelib/src/libs/SireMM/gridff.cpp index 0abb08395..9a0eac556 100644 --- a/corelib/src/libs/SireMM/gridff.cpp +++ b/corelib/src/libs/SireMM/gridff.cpp @@ -808,9 +808,9 @@ void GridFF::addToGrid(const QVector &coords_and_charges) } #else { - int i = 0; - int j = 0; - int k = 0; + quint32 i = 0; + quint32 j = 0; + quint32 k = 0; double gx = minpoint.x(); double gy = minpoint.y(); @@ -1031,9 +1031,9 @@ void GridFF::addToGrid(const QVector &coords_and_charges) } #else { - int i = 0; - int j = 0; - int k = 0; + quint32 i = 0; + quint32 j = 0; + quint32 k = 0; double gx = minpoint.x(); double gy = minpoint.y(); @@ -1244,9 +1244,9 @@ void GridFF::addToGrid(const QVector &coords_and_charges) } #else { - int i = 0; - int j = 0; - int k = 0; + quint32 i = 0; + quint32 j = 0; + quint32 k = 0; double gx = minpoint.x(); double gy = minpoint.y(); @@ -1487,9 +1487,6 @@ void GridFF::rebuildGrid() QVector far_mols; - int atomcount = 0; - int gridcount = 0; - closemols_coords.reserve(cljmols.count() + (fixedatoms_coords.count() / 2)); closemols_params.reserve(cljmols.count() + (fixedatoms_coords.count() / 2)); @@ -1515,7 +1512,6 @@ void GridFF::rebuildGrid() // only explicitly evaluate points within the LJ cutoff of the grid if (dist < lj_cutoff) { - atomcount += 1; closemols_coords.append(coords); closemols_params.append(params); } @@ -1529,7 +1525,6 @@ void GridFF::rebuildGrid() if (far_mols.count() > 1023) { addToGrid(far_mols); - gridcount += far_mols.count(); far_mols.clear(); // qDebug() << "Added" << i+1 << "of" << fixedatoms_coords.count() // << "fixed atoms to the grid..."; @@ -1539,18 +1534,13 @@ void GridFF::rebuildGrid() } addToGrid(far_mols); - gridcount += far_mols.count(); far_mols.clear(); } if (not cljmols.isEmpty()) { - int nmols = 0; - for (ChunkedVector::const_iterator it = cljmols.constBegin(); it != cljmols.constEnd(); ++it) { - nmols += 1; - const CLJMolecule &cljmol = *it; // loop through each CutGroup of this molecule @@ -1585,7 +1575,6 @@ void GridFF::rebuildGrid() // only explicitly evaluate points within the LJ cutoff of the grid if (dist < lj_cutoff) { - atomcount += 1; closemols_coords.append(coords); closemols_params.append(params); } @@ -1599,7 +1588,6 @@ void GridFF::rebuildGrid() if (far_mols.count() > 1023) { addToGrid(far_mols); - gridcount += far_mols.count(); far_mols.clear(); } } @@ -1609,7 +1597,6 @@ void GridFF::rebuildGrid() } addToGrid(far_mols); - gridcount += far_mols.count(); far_mols.clear(); } @@ -2349,15 +2336,9 @@ void GridFF::recalculateEnergy() if (must_recalculate) { - QElapsedTimer t; - t.start(); - this->mustNowRecalculateFromScratch(); this->rebuildGrid(); - qint64 ns = t.nsecsElapsed(); - t.restart(); - double total_cnrg(0); double total_ljnrg(0); @@ -2408,8 +2389,6 @@ void GridFF::recalculateEnergy() total_ljnrg += ljnrg; } - ns = t.nsecsElapsed(); - this->components().setEnergy(*this, CLJEnergy(total_cnrg, total_ljnrg)); } else diff --git a/corelib/src/libs/SireMM/gridff2.cpp b/corelib/src/libs/SireMM/gridff2.cpp index 29f41ebf9..6bb740ba3 100644 --- a/corelib/src/libs/SireMM/gridff2.cpp +++ b/corelib/src/libs/SireMM/gridff2.cpp @@ -923,9 +923,6 @@ void GridFF2::rebuildGrid() far_mols_z.reserve(1024); far_mols_q.reserve(1024); - int atomcount = 0; - int gridcount = 0; - const double image_cutoff = coul_cutoff + gridbox.halfExtents().length(); if (fixedatoms_coords.count() > 0) @@ -949,7 +946,6 @@ void GridFF2::rebuildGrid() // only explicitly evaluate points within the LJ cutoff of the grid if (dist < lj_cutoff) { - atomcount += 1; cmols_x.append(c.x()); cmols_y.append(c.y()); cmols_z.append(c.z()); @@ -971,7 +967,6 @@ void GridFF2::rebuildGrid() if (far_mols_x.count() > 1023) { addToGrid(far_mols_x, far_mols_y, far_mols_z, far_mols_q); - gridcount += far_mols_x.count(); far_mols_x.clear(); far_mols_y.clear(); far_mols_z.clear(); @@ -985,7 +980,6 @@ void GridFF2::rebuildGrid() } addToGrid(far_mols_x, far_mols_y, far_mols_z, far_mols_q); - gridcount += far_mols_x.count(); far_mols_x.clear(); far_mols_y.clear(); far_mols_z.clear(); @@ -994,12 +988,8 @@ void GridFF2::rebuildGrid() if (not cljmols.isEmpty()) { - int nmols = 0; - for (ChunkedVector::const_iterator it = cljmols.constBegin(); it != cljmols.constEnd(); ++it) { - nmols += 1; - const CLJMolecule &cljmol = *it; // loop through each CutGroup of this molecule @@ -1034,7 +1024,6 @@ void GridFF2::rebuildGrid() // only explicitly evaluate points within the LJ cutoff of the grid if (dist < lj_cutoff) { - atomcount += 1; cmols_x.append(c.x()); cmols_y.append(c.y()); cmols_z.append(c.z()); @@ -1056,7 +1045,6 @@ void GridFF2::rebuildGrid() if (far_mols_x.count() > 1023) { addToGrid(far_mols_x, far_mols_y, far_mols_z, far_mols_q); - gridcount += far_mols_x.count(); far_mols_x.clear(); far_mols_y.clear(); far_mols_z.clear(); @@ -1070,7 +1058,6 @@ void GridFF2::rebuildGrid() } addToGrid(far_mols_x, far_mols_y, far_mols_z, far_mols_q); - gridcount += far_mols_x.count(); far_mols_x.clear(); far_mols_y.clear(); far_mols_z.clear(); @@ -1092,15 +1079,6 @@ void GridFF2::rebuildGrid() close_mols_sig[i] = close_mols_sig[i].sqrt(); close_mols_eps[i] = close_mols_eps[i].sqrt(); } - - { - double grid_sum = 0; - - for (int ipt = 0; ipt < (dimx * dimy * dimz); ++ipt) - { - grid_sum += gridpot.at(ipt); - } - } } GridFF2::CLJAtoms::CLJAtoms() @@ -1566,15 +1544,9 @@ void GridFF2::recalculateEnergy() if (must_recalculate) { - QElapsedTimer t; - t.start(); - this->mustNowRecalculateFromScratch(); this->rebuildGrid(); - qint64 ns = t.nsecsElapsed(); - t.restart(); - double total_cnrg(0); double total_ljnrg(0); @@ -1625,8 +1597,6 @@ void GridFF2::recalculateEnergy() total_ljnrg += ljnrg; } - ns = t.nsecsElapsed(); - this->components().setEnergy(*this, CLJEnergy(total_cnrg, total_ljnrg)); } else diff --git a/corelib/src/libs/SireMM/intragroupff.cpp b/corelib/src/libs/SireMM/intragroupff.cpp index 11b9482a3..4c4ce6787 100644 --- a/corelib/src/libs/SireMM/intragroupff.cpp +++ b/corelib/src/libs/SireMM/intragroupff.cpp @@ -154,7 +154,7 @@ namespace SireMM /** Whether or not this group needs accepting */ bool needs_accepting; - IntraGroupFFMolData() : RefCountData(), connectivity_version(0), intrascale_version(0), needs_energy_calc(false), needs_accepting(false) + IntraGroupFFMolData() : RefCountData(), intrascale_version(0), connectivity_version(0), needs_energy_calc(false), needs_accepting(false) { } @@ -188,8 +188,8 @@ namespace SireMM : RefCountData(), cljgroup0(other.cljgroup0), cljgroup1(other.cljgroup1), cljfuncs(other.cljfuncs), cty(other.cty), excl_pairs(other.excl_pairs), nrg(other.nrg), connectivity_property(other.connectivity_property), intrascale_property(other.intrascale_property), - connectivity_version(other.connectivity_version), intrascale_version(other.intrascale_version), + connectivity_version(other.connectivity_version), needs_energy_calc(other.needs_energy_calc), needs_accepting(other.needs_accepting) { diff --git a/corelib/src/libs/SireMM/multicljcomponent.cpp b/corelib/src/libs/SireMM/multicljcomponent.cpp index d35c37762..f665f10b6 100644 --- a/corelib/src/libs/SireMM/multicljcomponent.cpp +++ b/corelib/src/libs/SireMM/multicljcomponent.cpp @@ -112,7 +112,7 @@ QDataStream &operator>>(QDataStream &ds, MultiCLJEnergy &nrg) void MultiCLJEnergy::assertValidCoulombIndex(quint32 i) const { - if (i >= cnrgs.count()) + if (i >= static_cast(cnrgs.count())) throw SireError::invalid_index( QObject::tr("There is no CoulombEnergy at index '%1'. Number of energies equals %2.") .arg(i) @@ -122,7 +122,7 @@ void MultiCLJEnergy::assertValidCoulombIndex(quint32 i) const void MultiCLJEnergy::assertValidLJIndex(quint32 i) const { - if (i >= ljnrgs.count()) + if (i >= static_cast(ljnrgs.count())) throw SireError::invalid_index( QObject::tr("There is no LJEnergy at index '%1'. Number of energies equals %2.").arg(i).arg(ljnrgs.count()), CODELOC); diff --git a/corelib/src/libs/SireMM/multicljcomponent.h b/corelib/src/libs/SireMM/multicljcomponent.h index 3739cbd29..23b80bc3f 100644 --- a/corelib/src/libs/SireMM/multicljcomponent.h +++ b/corelib/src/libs/SireMM/multicljcomponent.h @@ -298,7 +298,7 @@ namespace SireMM return CLJEnergy::coulomb(); else { - if (i >= cnrgs.count()) + if (i >= static_cast(cnrgs.count())) assertValidCoulombIndex(i); return cnrgs.at(i); @@ -311,7 +311,7 @@ namespace SireMM return CLJEnergy::lj(); else { - if (i >= ljnrgs.count()) + if (i >= static_cast(ljnrgs.count())) assertValidLJIndex(i); return ljnrgs.at(i); diff --git a/corelib/src/libs/SireMaths/CMakeLists.txt b/corelib/src/libs/SireMaths/CMakeLists.txt index 1adae5e93..c878c703c 100644 --- a/corelib/src/libs/SireMaths/CMakeLists.txt +++ b/corelib/src/libs/SireMaths/CMakeLists.txt @@ -101,6 +101,11 @@ set ( SIREMATHS_SOURCES ${SIREMATHS_HEADERS} ) +# NaN is used to mark missing values, so it must survive -ffast-math. +if (NOT MSVC) + set_source_files_properties(energytrajectory.cpp PROPERTIES COMPILE_OPTIONS "-fno-finite-math-only") +endif() + add_library (SireMaths ${SIREMATHS_SOURCES}) set_target_properties (SireMaths PROPERTIES diff --git a/corelib/src/libs/SireMaths/linearap.cpp b/corelib/src/libs/SireMaths/linearap.cpp index 9dc7e2906..9e79a3154 100644 --- a/corelib/src/libs/SireMaths/linearap.cpp +++ b/corelib/src/libs/SireMaths/linearap.cpp @@ -946,14 +946,10 @@ namespace SireMaths if (check_result) { - // calculate optimal cost. - double total_cost = 0; - for (int i = 0; i < dim; ++i) { int j = rows_to_columns[i]; u[i] = costs(i, j) - v[j]; - total_cost += costs(i, j); } // qDebug() << "\n(final) rows_to_columns" << rows_to_columns; diff --git a/corelib/src/libs/SireMaths/matrix.cpp b/corelib/src/libs/SireMaths/matrix.cpp index f23b31be8..43e8744da 100644 --- a/corelib/src/libs/SireMaths/matrix.cpp +++ b/corelib/src/libs/SireMaths/matrix.cpp @@ -177,9 +177,9 @@ Matrix::Matrix(const gsl_matrix *m) for (int i = 0; i < 9; ++i) array[i] = 0; - for (int i = 0; i < m->size1; ++i) + for (size_t i = 0; i < m->size1; ++i) { - for (int j = 0; j < m->size2; ++j) + for (size_t j = 0; j < m->size2; ++j) { this->operator()(i, j) = gsl_matrix_get(m, i, j); } diff --git a/corelib/src/libs/SireMaths/multifixed.cpp b/corelib/src/libs/SireMaths/multifixed.cpp index 8a0ca09de..707ecae3b 100644 --- a/corelib/src/libs/SireMaths/multifixed.cpp +++ b/corelib/src/libs/SireMaths/multifixed.cpp @@ -35,25 +35,6 @@ using namespace SireMaths; #define DOUBLE64 double -const DOUBLE64 double_magic = double(6755399441055744.0); // 2^(52-16) * 1.5 - // as double has 52 bits of mantissa - -static QString toBinary(qint64 value) -{ - QStringList vals; - - const unsigned char *c = reinterpret_cast(&(value)); - - QString val("0x"); - - for (unsigned int j = 0; j < sizeof(qint64); ++j) - { - val.append(QString("%1").arg((unsigned short)(c[j]), 2, 16, QChar('0'))); - } - - return val; -} - static const double SCALE_TO_FIXED = 2LL << 32; static const double SCALE_FROM_FIXED = double(1) / SCALE_TO_FIXED; diff --git a/corelib/src/libs/SireMaths/n4matrix.cpp b/corelib/src/libs/SireMaths/n4matrix.cpp index faa371291..a3fdeb311 100644 --- a/corelib/src/libs/SireMaths/n4matrix.cpp +++ b/corelib/src/libs/SireMaths/n4matrix.cpp @@ -156,9 +156,9 @@ N4Matrix::N4Matrix(const SireBase::Array2D &array4d) const NMatrix *array4d_data = array4d.constData(); - for (uint i = 0; i < array4d.nRows(); ++i) + for (int i = 0; i < array4d.nRows(); ++i) { - for (uint j = 0; j < array4d.nColumns(); ++j) + for (int j = 0; j < array4d.nColumns(); ++j) { int idx = array4d.map(i, j); diff --git a/corelib/src/libs/SireMaths/nmatrix.cpp b/corelib/src/libs/SireMaths/nmatrix.cpp index 1aa182a64..0458c1d13 100644 --- a/corelib/src/libs/SireMaths/nmatrix.cpp +++ b/corelib/src/libs/SireMaths/nmatrix.cpp @@ -750,6 +750,8 @@ NVector NMatrix::operator*(const Vector &vector) const { sum += vector[j] * d[offset(i, j)]; } + + v[i] = sum; } return v; diff --git a/corelib/src/libs/SireMaths/rangenerator.cpp b/corelib/src/libs/SireMaths/rangenerator.cpp index b7e0c51c4..7e04c0ca9 100644 --- a/corelib/src/libs/SireMaths/rangenerator.cpp +++ b/corelib/src/libs/SireMaths/rangenerator.cpp @@ -316,7 +316,7 @@ RanGenerator::~RanGenerator() /** Detach from shared storage */ void RanGenerator::detach() { - if (not d.unique()) + if (d.use_count() != 1) { d.reset(new RanGeneratorPvt(*d)); } @@ -352,7 +352,7 @@ RanGeneratorPvt &RanGenerator::nonconst_d() const this explicitly shared copy of the generator */ void RanGenerator::seed() { - if (d.unique()) + if (d.use_count() == 1) d->seed(); else d.reset(new RanGeneratorPvt()); @@ -362,7 +362,7 @@ void RanGenerator::seed() this explicitly shared copy of the generator */ void RanGenerator::seed(quint32 s) { - if (d.unique()) + if (d.use_count() == 1) d->seed(s); else d.reset(new RanGeneratorPvt(s)); @@ -372,7 +372,7 @@ void RanGenerator::seed(quint32 s) this explicitly shared copy of the generator */ void RanGenerator::seed(const QVector &s) { - if (d.unique()) + if (d.use_count() == 1) d->seed(s); else d.reset(new RanGeneratorPvt(s)); @@ -894,7 +894,7 @@ QVector RanGenerator::getState() const */ void RanGenerator::setState(const QVector &state) { - if (d.unique()) + if (d.use_count() == 1) { d->loadState(state); } diff --git a/corelib/src/libs/SireMaths/sphere.cpp b/corelib/src/libs/SireMaths/sphere.cpp index b1ae31b33..4dd2eaa5f 100644 --- a/corelib/src/libs/SireMaths/sphere.cpp +++ b/corelib/src/libs/SireMaths/sphere.cpp @@ -199,11 +199,12 @@ double Sphere::intersectionVolume(const Sphere &other) const // h0 is the cap distance for sphere 0, h1 is the cap distance for sphere 1, // and d is the distance between the center of the spheres - // O O - // r0 / | x x | \ r1 - // / | | \ - // O----O O----O - // r0-h0 r1-h1 + /* O O + r0 / | x x | \ r1 + / | | \ + O----O O----O + r0-h0 r1-h1 + */ // this gives us three equations with three unknowns (x, h0 and h1) // diff --git a/corelib/src/libs/SireMol/atomidx.h b/corelib/src/libs/SireMol/atomidx.h index 43a0c1e58..a742c088c 100644 --- a/corelib/src/libs/SireMol/atomidx.h +++ b/corelib/src/libs/SireMol/atomidx.h @@ -103,6 +103,7 @@ namespace SireMol using SireID::Index_T_::operator--; using SireID::Index_T_::map; + using AtomID::map; QList map(const MolInfo &molinfo) const; }; diff --git a/corelib/src/libs/SireMol/cgidx.h b/corelib/src/libs/SireMol/cgidx.h index 2978ee3c3..619c4c21f 100644 --- a/corelib/src/libs/SireMol/cgidx.h +++ b/corelib/src/libs/SireMol/cgidx.h @@ -107,6 +107,7 @@ namespace SireMol using SireID::Index_T_::operator--; using SireID::Index_T_::map; + using CGID::map; QList map(const MolInfo &molinfo) const; }; diff --git a/corelib/src/libs/SireMol/chainidx.h b/corelib/src/libs/SireMol/chainidx.h index da93e4646..26c276867 100644 --- a/corelib/src/libs/SireMol/chainidx.h +++ b/corelib/src/libs/SireMol/chainidx.h @@ -102,6 +102,7 @@ namespace SireMol using SireID::Index_T_::operator--; using SireID::Index_T_::map; + using ChainID::map; QList map(const MolInfo &molinfo) const; }; diff --git a/corelib/src/libs/SireMol/connectivity.cpp b/corelib/src/libs/SireMol/connectivity.cpp index 0f927c374..d503d8960 100644 --- a/corelib/src/libs/SireMol/connectivity.cpp +++ b/corelib/src/libs/SireMol/connectivity.cpp @@ -30,6 +30,7 @@ #include +#include "atomidxmapping.h" #include "atommatcher.h" #include "atomselection.h" #include "connectivity.h" @@ -37,7 +38,6 @@ #include "moleculeinfo.h" #include "moleculeinfodata.h" #include "moleculeview.h" -#include "atomidxmapping.h" #include "angleid.h" #include "bondid.h" @@ -46,8 +46,8 @@ #include "SireMol/errors.h" -#include "SireBase/errors.h" #include "SireBase/console.h" +#include "SireBase/errors.h" #include "SireBase/parallel.h" #include "SireError/errors.h" @@ -400,7 +400,7 @@ PropertyPtr ConnectivityBase::_pvt_makeCompatibleWith(const MoleculeInfoData &mo // remove any bond properties that refer to atoms that no longer exist for (auto it = ret.bond_props.begin(); it != ret.bond_props.end();) { - if (it.key().atom0 >= nats or it.key().atom1 >= nats) + if (it.key().atom0 >= static_cast(nats) or it.key().atom1 >= static_cast(nats)) { it = ret.bond_props.erase(it); } @@ -2414,7 +2414,7 @@ QList _getBonds(const QVector> &connectio QList my_bonds; my_bonds.reserve(4 * (r.end() - r.begin())); - for (quint32 i = r.begin(); i < r.end(); ++i) + for (quint32 i = r.begin(); i < static_cast(r.end()); ++i) { for (const AtomIdx &j_idx : connections_array[i]) { @@ -2435,7 +2435,7 @@ QList _getBonds(const QVector> &connectio } else { - for (quint32 i = 0; i < nats; ++i) + for (quint32 i = 0; i < static_cast(nats); ++i) { for (const AtomIdx &j_idx : connections_array[i]) { @@ -2664,7 +2664,7 @@ QList _getAngles(const QVector> &connec QList my_angs; my_angs.reserve(3 * (r.end() - r.begin())); - for (quint32 i = r.begin(); i < r.end(); ++i) + for (quint32 i = r.begin(); i < static_cast(r.end()); ++i) { for (const AtomIdx &j_idx : connections_array[i]) { @@ -2688,7 +2688,7 @@ QList _getAngles(const QVector> &connec } else { - for (quint32 i = 0; i < nats; ++i) + for (quint32 i = 0; i < static_cast(nats); ++i) { for (const auto &j_idx : connections_array[i]) { @@ -2833,7 +2833,7 @@ QList _getDihedrals(const QVector> &conne QList my_dihs; my_dihs.reserve(3 * (r.end() - r.begin())); - for (quint32 i = r.begin(); i < r.end(); ++i) + for (quint32 i = r.begin(); i < static_cast(r.end()); ++i) { for (const auto &j_idx : connections_array[i]) { @@ -2862,7 +2862,7 @@ QList _getDihedrals(const QVector> &conne } else { - for (quint32 i = 0; i < nats; ++i) + for (quint32 i = 0; i < static_cast(nats); ++i) { for (const auto &j_idx : connections_array[i]) { diff --git a/corelib/src/libs/SireMol/iswater.cpp b/corelib/src/libs/SireMol/iswater.cpp index 5c8829b21..ea439e1fa 100644 --- a/corelib/src/libs/SireMol/iswater.cpp +++ b/corelib/src/libs/SireMol/iswater.cpp @@ -120,7 +120,8 @@ namespace SireMol { for (int i = r.begin(); i < r.end(); ++i) { - const auto &moldata = molecules[i].data(); + const auto mol = molecules[i]; + const auto &moldata = mol.data(); if (moldata.info().nAtoms() <= 6 and moldata.hasProperty(element_property)) { @@ -132,7 +133,8 @@ namespace SireMol { for (int i = 0; i < molecules.count(); ++i) { - const auto &moldata = molecules[i].data(); + const auto mol = molecules[i]; + const auto &moldata = mol.data(); if (moldata.info().nAtoms() <= 6 and moldata.hasProperty(element_property)) { diff --git a/corelib/src/libs/SireMol/molgroupworkspace.cpp b/corelib/src/libs/SireMol/molgroupworkspace.cpp index 8ed69241a..84c29ac3b 100644 --- a/corelib/src/libs/SireMol/molgroupworkspace.cpp +++ b/corelib/src/libs/SireMol/molgroupworkspace.cpp @@ -171,7 +171,7 @@ void MolGroupWorkspace::returnToMemoryPool() if (d.get() == 0) return; - if (not d.unique()) + if (d.use_count() != 1) { d.reset(); return; @@ -224,7 +224,7 @@ void MolGroupWorkspace::detach() { if (d.get() != 0) { - if (not d.unique()) + if (d.use_count() != 1) { std::shared_ptr d2 = d; @@ -429,12 +429,14 @@ void MolGroupWorkspace::setVersion(const MajorMinorVersion &version) } /** Return the version of the current workspace */ -MajorMinorVersion MolGroupWorkspace::version() const +const MajorMinorVersion &MolGroupWorkspace::version() const { + static const MajorMinorVersion null_version; + if (d.get()) return d->version(); else - return MajorMinorVersion(); + return null_version; } /** Increment the major version */ diff --git a/corelib/src/libs/SireMol/molgroupworkspace.h b/corelib/src/libs/SireMol/molgroupworkspace.h index 6cda55846..aee798b49 100644 --- a/corelib/src/libs/SireMol/molgroupworkspace.h +++ b/corelib/src/libs/SireMol/molgroupworkspace.h @@ -98,7 +98,7 @@ namespace SireMol void clear(); - MajorMinorVersion version() const; + const MajorMinorVersion &version() const; void incrementMinor(); void incrementMajor(); diff --git a/corelib/src/libs/SireMol/residx.h b/corelib/src/libs/SireMol/residx.h index 4a7e61af3..d0aee9a9b 100644 --- a/corelib/src/libs/SireMol/residx.h +++ b/corelib/src/libs/SireMol/residx.h @@ -101,6 +101,7 @@ namespace SireMol using SireID::Index_T_::operator--; using SireID::Index_T_::map; + using ResID::map; QList map(const MolInfo &molinfo) const; }; diff --git a/corelib/src/libs/SireMol/segidx.h b/corelib/src/libs/SireMol/segidx.h index 8ecb1ccca..3bbb93dfe 100644 --- a/corelib/src/libs/SireMol/segidx.h +++ b/corelib/src/libs/SireMol/segidx.h @@ -101,6 +101,7 @@ namespace SireMol using SireID::Index_T_::operator--; using SireID::Index_T_::map; + using SegID::map; QList map(const MolInfo &molinfo) const; }; diff --git a/corelib/src/libs/SireMol/select.cpp b/corelib/src/libs/SireMol/select.cpp index a0ce49e1b..e11289d17 100644 --- a/corelib/src/libs/SireMol/select.cpp +++ b/corelib/src/libs/SireMol/select.cpp @@ -26,11 +26,11 @@ \*********************************************/ #include "SireMol/select.h" +#include "SireMol/atommatch.h" #include "SireMol/moleculegroup.h" #include "SireMol/molecules.h" -#include "SireMol/parser.h" -#include "SireMol/atommatch.h" #include "SireMol/mover_metaid.h" +#include "SireMol/parser.h" #include "SireMol/core.h" @@ -474,6 +474,12 @@ QString Select::objectType() const return QObject::tr("atoms"); case SireMol::parser::SelectEngine::BOND: return QObject::tr("bonds"); + case SireMol::parser::SelectEngine::ANGLE: + return QObject::tr("angles"); + case SireMol::parser::SelectEngine::DIHEDRAL: + return QObject::tr("dihedrals"); + case SireMol::parser::SelectEngine::IMPROPER: + return QObject::tr("impropers"); case SireMol::parser::SelectEngine::CUTGROUP: return QObject::tr("cutgroups"); case SireMol::parser::SelectEngine::RESIDUE: @@ -484,6 +490,10 @@ QString Select::objectType() const return QObject::tr("segments"); case SireMol::parser::SelectEngine::MOLECULE: return QObject::tr("molecules"); + case SireMol::parser::SelectEngine::MATCH: + return QObject::tr("atom matches"); + case SireMol::parser::SelectEngine::VIEW: + return QObject::tr("views"); } return QObject::tr("nothing"); diff --git a/corelib/src/libs/SireMol/selectorm.hpp b/corelib/src/libs/SireMol/selectorm.hpp index 94eeb6ecf..6d06078f8 100644 --- a/corelib/src/libs/SireMol/selectorm.hpp +++ b/corelib/src/libs/SireMol/selectorm.hpp @@ -33,8 +33,8 @@ #include "core.h" #include "SireBase/booleanproperty.h" -#include "SireBase/parallel.h" #include "SireBase/lazyevaluator.h" +#include "SireBase/parallel.h" #include "SireMol/errors.h" @@ -547,7 +547,7 @@ namespace SireMol } } } - } // end of namespace detail + } // end of namespace detail #endif // GCCXML_PARSE template @@ -1442,7 +1442,7 @@ namespace SireMol { SelectorM ret(*this); - for (const auto vw : other.vws) + for (const auto &vw : other.vws) { ret._append(vw); } diff --git a/corelib/src/libs/SireMol/structureeditor.cpp b/corelib/src/libs/SireMol/structureeditor.cpp index 0452b4e8e..a3cdb548d 100644 --- a/corelib/src/libs/SireMol/structureeditor.cpp +++ b/corelib/src/libs/SireMol/structureeditor.cpp @@ -74,8 +74,8 @@ #include "resproperty.hpp" #include "segproperty.hpp" -#include "SireBase/properties.h" #include "SireBase/console.h" +#include "SireBase/properties.h" #include "tostring.h" @@ -4731,7 +4731,7 @@ void StructureEditor::convertToSingleCutGroupMolecule() return; } - for (quint32 i = 0; i < this->nAtomsInMolecule(); ++i) + for (int i = 0; i < this->nAtomsInMolecule(); ++i) { this->reparentAtom(i, CGIdx(0)); } diff --git a/corelib/src/libs/SireMol/trajectory.cpp b/corelib/src/libs/SireMol/trajectory.cpp index 64ab37e37..b12d1ea73 100644 --- a/corelib/src/libs/SireMol/trajectory.cpp +++ b/corelib/src/libs/SireMol/trajectory.cpp @@ -26,8 +26,8 @@ \*********************************************/ #include "trajectory.h" -#include "trajectoryaligner.h" #include "atomidxmapping.h" +#include "trajectoryaligner.h" #include "SireID/index.h" @@ -40,17 +40,17 @@ #include "SireUnits/dimensions.h" #include "SireUnits/units.h" +#include "SireBase/console.h" #include "SireBase/generalunitproperty.h" #include "SireBase/lazyevaluator.h" -#include "SireBase/console.h" #include "SireBase/slice.h" #include "SireError/errors.h" #include "SireStream/datastream.h" -#include "SireStream/shareddatastream.h" #include "SireStream/magic_error.h" +#include "SireStream/shareddatastream.h" using namespace SireMol; using namespace SireVol; @@ -1494,7 +1494,7 @@ Frame Frame::fromByteArray(const QByteArray &data) } coords.resize(val); - std::memcpy(coords.data(), data_ptr, val * sizeof(Vector)); + std::memcpy(static_cast(coords.data()), data_ptr, val * sizeof(Vector)); data_ptr += val * sizeof(Vector); } @@ -1518,7 +1518,7 @@ Frame Frame::fromByteArray(const QByteArray &data) } vels.resize(val); - std::memcpy(vels.data(), data_ptr, val * sizeof(Velocity3D)); + std::memcpy(static_cast(vels.data()), data_ptr, val * sizeof(Velocity3D)); data_ptr += val * sizeof(Velocity3D); } @@ -1542,7 +1542,7 @@ Frame Frame::fromByteArray(const QByteArray &data) } frcs.resize(val); - std::memcpy(frcs.data(), data_ptr, val * sizeof(Force3D)); + std::memcpy(static_cast(frcs.data()), data_ptr, val * sizeof(Force3D)); data_ptr += val * sizeof(Force3D); } @@ -2107,17 +2107,17 @@ Frame Frame::join(const QVector &frames, const int start_idx = start_idxs_data[i]; if (have_coords and frame.hasCoordinates()) - std::memcpy(coords_data + start_idx, + std::memcpy(static_cast(coords_data + start_idx), frame.coordinates().constData(), frame.nAtoms() * sizeof(Vector)); if (have_vels and frame.hasVelocities()) - std::memcpy(vels_data + start_idx, + std::memcpy(static_cast(vels_data + start_idx), frame.velocities().constData(), frame.nAtoms() * sizeof(Velocity3D)); if (have_frcs and frame.hasForces()) - std::memcpy(frcs_data + start_idx, + std::memcpy(static_cast(frcs_data + start_idx), frame.forces().constData(), frame.nAtoms() * sizeof(Force3D)); } }); @@ -2130,17 +2130,17 @@ Frame Frame::join(const QVector &frames, const int start_idx = start_idxs_data[i]; if (have_coords and frame.hasCoordinates()) - std::memcpy(coords_data + start_idx, + std::memcpy(static_cast(coords_data + start_idx), frame.coordinates().constData(), frame.nAtoms() * sizeof(Vector)); if (have_vels and frame.hasVelocities()) - std::memcpy(vels_data + start_idx, + std::memcpy(static_cast(vels_data + start_idx), frame.velocities().constData(), frame.nAtoms() * sizeof(Velocity3D)); if (have_frcs and frame.hasForces()) - std::memcpy(frcs_data + start_idx, + std::memcpy(static_cast(frcs_data + start_idx), frame.forces().constData(), frame.nAtoms() * sizeof(Force3D)); } diff --git a/corelib/src/libs/SireMove/CMakeLists.txt b/corelib/src/libs/SireMove/CMakeLists.txt index 96fc2ec54..f73dba3fc 100644 --- a/corelib/src/libs/SireMove/CMakeLists.txt +++ b/corelib/src/libs/SireMove/CMakeLists.txt @@ -161,6 +161,11 @@ else() set ( SIRE_OPENMM_LIBRARIES "" ) endif() +# The NaN/inf input checks must not be optimised away by -ffast-math. +if (NOT MSVC) + set_source_files_properties(rigidbodymc.cpp PROPERTIES COMPILE_OPTIONS "-fno-finite-math-only") +endif() + add_library (SireMove ${SIREMOVE_SOURCES}) diff --git a/corelib/src/libs/SireMove/hybridmc.h b/corelib/src/libs/SireMove/hybridmc.h index 551519b88..20c7cb32c 100644 --- a/corelib/src/libs/SireMove/hybridmc.h +++ b/corelib/src/libs/SireMove/hybridmc.h @@ -83,6 +83,7 @@ namespace SireMove /** Generate the velocites in the passed MD object, returning the biasing factor for the HMC algorithm */ virtual double generate(const System &system, MolecularDynamics &md) = 0; + using VelocityGenerator::generate; /** Return the bias for the velocities in the passed MD object */ virtual double getBias(const MolecularDynamics &md) = 0; diff --git a/corelib/src/libs/SireMove/openmmfrenergydt.cpp b/corelib/src/libs/SireMove/openmmfrenergydt.cpp index a22e8faf8..8d9281bed 100644 --- a/corelib/src/libs/SireMove/openmmfrenergydt.cpp +++ b/corelib/src/libs/SireMove/openmmfrenergydt.cpp @@ -74,7 +74,7 @@ #include /* include */ #include -#include +#include using namespace SireMove; using namespace SireSystem; @@ -528,7 +528,7 @@ void OpenMMFrEnergyDT::initialise() const double surface_Tension = 0; OpenMM::MonteCarloMembraneBarostat::XYMode xymode = OpenMM::MonteCarloMembraneBarostat::XYIsotropic; OpenMM::MonteCarloMembraneBarostat::ZMode zmode = OpenMM::MonteCarloMembraneBarostat::ZFree; - OpenMM::MonteCarloMembraneBarostat * barostat = new OpenMM::MonteCarloMembraneBarostat(converted_Pressure, surface_Tension, converted_Temperature, xymode, zmode, MCBarostat_frequency); + OpenMM::MonteCarloMembraneBarostat *barostat = new OpenMM::MonteCarloMembraneBarostat(converted_Pressure, surface_Tension, converted_Temperature, xymode, zmode, MCBarostat_frequency); system_openmm->addForce(barostat); } else @@ -1105,7 +1105,7 @@ void OpenMMFrEnergyDT::integrate(IntegratorWorkspace &workspace, const Symbol &n bool Debug = false; - QTime timer; + QElapsedTimer timer; timer.start(); @@ -1822,13 +1822,13 @@ bool OpenMMFrEnergyDT::getMCBarostat(void) /** Set Monte Carlo membrane Barostat on/off */ void OpenMMFrEnergyDT::setMCBarostat_membrane(bool MCBarostat_membrane) { - MCBarostat_membrane_flag = MCBarostat_membrane; + MCBarostat_membrane_flag = MCBarostat_membrane; } bool OpenMMFrEnergyDT::getMCBarostat_membrane(void) { - return MCBarostat_membrane_flag; + return MCBarostat_membrane_flag; } /** Get the Monte Carlo Barostat frequency in time speps */ diff --git a/corelib/src/libs/SireMove/openmmfrenergyst.cpp b/corelib/src/libs/SireMove/openmmfrenergyst.cpp index de5ad371c..709f2f280 100644 --- a/corelib/src/libs/SireMove/openmmfrenergyst.cpp +++ b/corelib/src/libs/SireMove/openmmfrenergyst.cpp @@ -184,7 +184,7 @@ OpenMMFrEnergyST::OpenMMFrEnergyST(bool frequent_save) Temperature(300.0 * kelvin), platform_type("Reference"), Restraint_flag(false), CMMremoval_frequency(0), buffer_frequency(0), energy_frequency(100), device_index("0"), precision("single"), Alchemical_value(0.5), coulomb_power(0), shift_delta(2.0), delta_alchemical(0.001), alchemical_array(), finite_diff_gradients(), - pot_energies(), perturbed_energies(), reduced_perturbed_energies(), forward_Metropolis(), backward_Metropolis(), + pot_energies(), forward_Metropolis(), backward_Metropolis(), reduced_perturbed_energies(), perturbed_energies(), Integrator_type("leapfrogverlet"), friction(1.0 / picosecond), integration_tol(0.001), timeskip(0.0 * picosecond), reinitialise_context(false), Debug(false) { @@ -203,7 +203,7 @@ OpenMMFrEnergyST::OpenMMFrEnergyST(const MoleculeGroup &molecule_group, const Mo Temperature(300.0 * kelvin), platform_type("Reference"), Restraint_flag(false), CMMremoval_frequency(0), buffer_frequency(0), energy_frequency(100), device_index("0"), precision("single"), Alchemical_value(0.5), coulomb_power(0), shift_delta(2.0), delta_alchemical(0.001), alchemical_array(), finite_diff_gradients(), - pot_energies(), perturbed_energies(), reduced_perturbed_energies(), forward_Metropolis(), backward_Metropolis(), + pot_energies(), forward_Metropolis(), backward_Metropolis(), reduced_perturbed_energies(), perturbed_energies(), Integrator_type("leapfrogverlet"), friction(1.0 / picosecond), integration_tol(0.001), timeskip(0.0 * picosecond), reinitialise_context(false), Debug(false) { @@ -225,8 +225,8 @@ OpenMMFrEnergyST::OpenMMFrEnergyST(const OpenMMFrEnergyST &other) Alchemical_value(other.Alchemical_value), coulomb_power(other.coulomb_power), shift_delta(other.shift_delta), delta_alchemical(other.delta_alchemical), alchemical_array(other.alchemical_array), finite_diff_gradients(other.finite_diff_gradients), pot_energies(other.pot_energies), - perturbed_energies(other.perturbed_energies), reduced_perturbed_energies(other.reduced_perturbed_energies), forward_Metropolis(other.forward_Metropolis), backward_Metropolis(other.backward_Metropolis), + reduced_perturbed_energies(other.reduced_perturbed_energies), perturbed_energies(other.perturbed_energies), Integrator_type(other.Integrator_type), friction(other.friction), integration_tol(other.integration_tol), timeskip(other.timeskip), reinitialise_context(other.reinitialise_context), Debug(other.Debug) { @@ -1248,9 +1248,9 @@ void OpenMMFrEnergyST::initialise() const double surface_Tension = 0; OpenMM::MonteCarloMembraneBarostat::XYMode xymode = OpenMM::MonteCarloMembraneBarostat::XYIsotropic; OpenMM::MonteCarloMembraneBarostat::ZMode zmode = OpenMM::MonteCarloMembraneBarostat::ZFree; - OpenMM::MonteCarloMembraneBarostat * barostat = new OpenMM::MonteCarloMembraneBarostat(converted_Pressure, surface_Tension, converted_Temperature, xymode, zmode, MCBarostat_frequency); + OpenMM::MonteCarloMembraneBarostat *barostat = new OpenMM::MonteCarloMembraneBarostat(converted_Pressure, surface_Tension, converted_Temperature, xymode, zmode, MCBarostat_frequency); - //Set The random seed + // Set The random seed barostat->setRandomNumberSeed(random_seed); system_openmm->addForce(barostat); @@ -2932,6 +2932,8 @@ void OpenMMFrEnergyST::initialise() sigma_avg_end = Sigend_p1 * Sigend_p2; sigma_avg_mix = Sigend_p1 * Sigstart_p2 + Sigstart_p1 * Sigend_p2; } + else + throw SireError::program_bug(QObject::tr("Unknown combining rules."), CODELOC); epsilon_avg_start = Epstart_p1 * Epstart_p2 * LennardJones14Scale_tmp * LennardJones14Scale_tmp; epsilon_avg_end = Epend_p1 * Epend_p2 * LennardJones14Scale_tmp * LennardJones14Scale_tmp; @@ -3156,7 +3158,7 @@ void OpenMMFrEnergyST::initialise() } } // end of loop over molecules in system - } // end of bond link flag + } // end of bond link flag bool UseBoresch_flag = true; @@ -4148,32 +4150,33 @@ boost::tuples::tuple OpenMMFrEnergyST::calculateGradient { double double_increment = incr_plus - incr_minus; double gradient = 0; - double potential_energy_lambda_plus_delta; - double potential_energy_lambda_minus_delta; double forward_m; double backward_m; - if (incr_plus < 1.0) - { - potential_energy_lambda_plus_delta = getPotentialEnergyAtLambda(incr_plus); - } - if (incr_minus > 0.0) - { - potential_energy_lambda_minus_delta = getPotentialEnergyAtLambda(incr_minus); - } if (incr_minus < 0.0) { + if (incr_plus > 1.0) + throw SireError::invalid_arg(QObject::tr("The lambda increment is too large to compute a gradient."), + CODELOC); + + double potential_energy_lambda_plus_delta = getPotentialEnergyAtLambda(incr_plus); + gradient = (potential_energy_lambda_plus_delta - p_energy_lambda) * 2 / double_increment; backward_m = exp(beta * (potential_energy_lambda_plus_delta - p_energy_lambda)); forward_m = exp(-beta * (potential_energy_lambda_plus_delta - p_energy_lambda)); } else if (incr_plus > 1.0) { + double potential_energy_lambda_minus_delta = getPotentialEnergyAtLambda(incr_minus); + gradient = -(potential_energy_lambda_minus_delta - p_energy_lambda) * 2 / double_increment; backward_m = exp(-beta * (potential_energy_lambda_minus_delta - p_energy_lambda)); forward_m = exp(beta * (potential_energy_lambda_minus_delta - p_energy_lambda)); } else { + double potential_energy_lambda_plus_delta = getPotentialEnergyAtLambda(incr_plus); + double potential_energy_lambda_minus_delta = getPotentialEnergyAtLambda(incr_minus); + gradient = (potential_energy_lambda_plus_delta - potential_energy_lambda_minus_delta) / double_increment; backward_m = exp(-beta * (potential_energy_lambda_minus_delta - p_energy_lambda)); @@ -4194,7 +4197,7 @@ QVector OpenMMFrEnergyST::computeReducedPerturbedEnergies(double beta) { for (i = perturbed.begin(); i != perturbed.end(); i++) { - qDebug() << "bias is: " << *i << endl; + qDebug() << "bias is: " << *i << Qt::endl; } } return perturbed; diff --git a/corelib/src/libs/SireMove/openmmpmefep.cpp b/corelib/src/libs/SireMove/openmmpmefep.cpp index 268bdf8fa..237eafdc0 100644 --- a/corelib/src/libs/SireMove/openmmpmefep.cpp +++ b/corelib/src/libs/SireMove/openmmpmefep.cpp @@ -395,7 +395,7 @@ void OpenMMPMEFEP::addMCBarostat(OpenMM::System &system) OpenMM::MonteCarloMembraneBarostat::ZMode zmode = OpenMM::MonteCarloMembraneBarostat::ZFree; auto barostat = new OpenMM::MonteCarloMembraneBarostat(converted_Pressure, surface_Tension, converted_Temperature, xymode, zmode, MCBarostat_frequency); - //Set The random seed + // Set The random seed barostat->setRandomNumberSeed(random_seed); system.addForce(barostat); @@ -880,8 +880,8 @@ void OpenMMPMEFEP::initialise(bool fullPME) /*** BOND LINK FORCE FIELD ***/ /* FC 12/21 CustomBondForce now (OpenMM 7.4.0) allows application of PBC checks*/ - OpenMM::CustomBondForce * custom_link_bond = new OpenMM::CustomBondForce("delta(min(0, r_eff))*(lamrest^5)*kl*r_eff^2;" - "r_eff=abs(r-reql)-dl"); + OpenMM::CustomBondForce *custom_link_bond = new OpenMM::CustomBondForce("delta(min(0, r_eff))*(lamrest^5)*kl*r_eff^2;" + "r_eff=abs(r-reql)-dl"); custom_link_bond->addPerBondParameter("reql"); custom_link_bond->addPerBondParameter("kl"); custom_link_bond->addPerBondParameter("dl"); @@ -1049,7 +1049,7 @@ void OpenMMPMEFEP::initialise(bool fullPME) system_index = system_index + 1; } // end of loop on atoms in molecule - } // end of loop on molecules in workspace + } // end of loop on molecules in workspace int num_atoms_till_i = 0; @@ -1960,7 +1960,7 @@ void OpenMMPMEFEP::initialise(bool fullPME) } } // end if (pert.isA()) - } // end for perturbations + } // end for perturbations } // end solute molecule perturbation @@ -2373,6 +2373,8 @@ void OpenMMPMEFEP::initialise(bool fullPME) sigma_avg_end = Sigend_p1 * Sigend_p2; sigma_avg_mix = Sigend_p1 * Sigstart_p2 + Sigstart_p1 * Sigend_p2; } + else + throw SireError::program_bug(QObject::tr("Unknown combining rules."), CODELOC); epsilon_avg_start = Epstart_p1 * Epstart_p2 * LennardJones14Scale_tmp * LennardJones14Scale_tmp; epsilon_avg_end = Epend_p1 * Epend_p2 * LennardJones14Scale_tmp * LennardJones14Scale_tmp; @@ -2592,10 +2594,9 @@ void OpenMMPMEFEP::initialise(bool fullPME) } } // if (!fullPME) - if (turn_on_restraints_mode) { - perturbed_energies_tmp[9] = true; //Lambda will be used to turn on the receptor-ligand restraints + perturbed_energies_tmp[9] = true; // Lambda will be used to turn on the receptor-ligand restraints if (Debug) qDebug() << "Added Perturbed Receptor-Ligand Restraint energy term"; } @@ -2981,7 +2982,7 @@ void OpenMMPMEFEP::createContext(IntegratorWorkspace &workspace, SireUnits::Dime // TriclinicBox else if (ptr_sys.property(space_property).isA()) { - TriclinicBox space = ptr_sys.property(space_property).asA(); + TriclinicBox space = ptr_sys.property(space_property).asA(); // Make sure the box is in reduced form. This is necessary since SOMD reads // the box vectors from fixed precision AMBER RST7 files. The OpenMM C++ API @@ -3682,7 +3683,7 @@ void OpenMMPMEFEP::updateOpenMMContextLambda(double lambda) // RECEPTOR-LIGAND RESTRAINTS if (perturbed_energies[9]) - openmm_context->setParameter("lamrest", lambda); //Receptor-ligand restraints + openmm_context->setParameter("lamrest", lambda); // Receptor-ligand restraints // lambda for the offsets (linear scaling) of the charges in // reciprocal space diff --git a/corelib/src/libs/SireMove/rigidbodymc.cpp b/corelib/src/libs/SireMove/rigidbodymc.cpp index a006b640f..3fc6c9bc5 100644 --- a/corelib/src/libs/SireMove/rigidbodymc.cpp +++ b/corelib/src/libs/SireMove/rigidbodymc.cpp @@ -122,7 +122,7 @@ QDataStream &operator>>(QDataStream &ds, RigidBodyMC &rbmc) else rbmc.mol_reflectors.clear(); - for (int i = 0; i < nreflect; ++i) + for (quint32 i = 0; i < nreflect; ++i) { MolNum molnum; Vector center; @@ -156,7 +156,7 @@ QDataStream &operator>>(QDataStream &ds, RigidBodyMC &rbmc) else rbmc.mol_reflectors.clear(); - for (int i = 0; i < nreflect; ++i) + for (quint32 i = 0; i < nreflect; ++i) { MolNum molnum; Vector center; diff --git a/corelib/src/libs/SireSystem/closemols.cpp b/corelib/src/libs/SireSystem/closemols.cpp index 93bb0b967..5bdffe766 100644 --- a/corelib/src/libs/SireSystem/closemols.cpp +++ b/corelib/src/libs/SireSystem/closemols.cpp @@ -158,7 +158,7 @@ bool CloseMols::recalculate() for (Molecules::const_iterator it = molecules.constBegin(); it != molecules.constEnd(); ++it) { // just get the center of the whole molecule - const Vector ¢er = it->data().property(coords_property).asA().array().aaBox().center(); + const Vector center = it->data().property(coords_property).asA().array().aaBox().center(); const double dist = space.calcDist(point, center); close_mols.insert(it.key(), dist); @@ -176,7 +176,7 @@ bool CloseMols::recalculate() for (Molecules::const_iterator it = molecules.constBegin(); it != molecules.constEnd(); ++it) { // just get the center of the whole molecule - const Vector ¢er = it->data().property(coords_property).asA().array().aaBox().center(); + const Vector center = it->data().property(coords_property).asA().array().aaBox().center(); const double dist2 = space.calcDist2(point, center); @@ -235,7 +235,7 @@ bool CloseMols::recalculate(MolNum changed_mol) const PropertyName &coords_property = map["coordinates"]; // calculate the distance from the new molecule to the point - const Vector ¢er = it->data().property(coords_property).asA().array().aaBox().center(); + const Vector center = it->data().property(coords_property).asA().array().aaBox().center(); const double dist2 = space.calcDist2(point, center); @@ -311,13 +311,13 @@ bool CloseMols::recalculate(const Molecules &changed_mols) continue; // calculate the distance from the new molecule to the point - const Vector ¢er = molecules.constFind(changed_mol) - ->data() - .property(coords_property) - .asA() - .array() - .aaBox() - .center(); + const Vector center = molecules.constFind(changed_mol) + ->data() + .property(coords_property) + .asA() + .array() + .aaBox() + .center(); const double dist2 = space.calcDist2(point, center); diff --git a/corelib/src/libs/SireSystem/forcefieldinfo.cpp b/corelib/src/libs/SireSystem/forcefieldinfo.cpp index 7d6bb5c5a..683f44f6d 100644 --- a/corelib/src/libs/SireSystem/forcefieldinfo.cpp +++ b/corelib/src/libs/SireSystem/forcefieldinfo.cpp @@ -30,9 +30,9 @@ #include "SireSystem/system.h" +#include "SireMol/core.h" #include "SireMol/molecule.h" #include "SireMol/selectormol.h" -#include "SireMol/core.h" #include "SireVol/cartesian.h" @@ -298,7 +298,8 @@ ForceFieldInfo::ForceFieldInfo(const SireMol::SelectorMol &mols, // use the first space found from the molecule for (int i = 0; i < mols.count(); ++i) { - const auto &moldata = mols[i].data(); + const auto mol = mols[i]; + const auto &moldata = mol.data(); if (moldata.hasProperty(space_prop.source())) { diff --git a/corelib/src/libs/SireSystem/systemtrajectory.cpp b/corelib/src/libs/SireSystem/systemtrajectory.cpp index 1c57da68b..8f03ef023 100644 --- a/corelib/src/libs/SireSystem/systemtrajectory.cpp +++ b/corelib/src/libs/SireSystem/systemtrajectory.cpp @@ -31,8 +31,8 @@ #include "SireMol/errors.h" #include "SireBase/lazyevaluator.h" -#include "SireBase/parallel.h" #include "SireBase/pagecache.h" +#include "SireBase/parallel.h" #include "SireStream/datastream.h" #include "SireStream/shareddatastream.h" @@ -464,7 +464,7 @@ void SystemFrames::saveFrame(const Molecules &mols, return; } - std::memcpy(coordinates_data + start_atom, coords.constData(CGIdx(0)), + std::memcpy(static_cast(coordinates_data + start_atom), coords.constData(CGIdx(0)), nats * sizeof(Vector)); } catch (...) @@ -483,7 +483,7 @@ void SystemFrames::saveFrame(const Molecules &mols, return; } - std::memcpy(velocities_data + start_atom, vels.constData(CGIdx(0)), + std::memcpy(static_cast(velocities_data + start_atom), vels.constData(CGIdx(0)), nats * sizeof(Velocity3D)); } catch (...) @@ -502,7 +502,7 @@ void SystemFrames::saveFrame(const Molecules &mols, return; } - std::memcpy(forces_data + start_atom, frcs.constData(CGIdx(0)), + std::memcpy(static_cast(forces_data + start_atom), frcs.constData(CGIdx(0)), nats * sizeof(Force3D)); } catch (...) diff --git a/corelib/src/libs/SireVol/transformedspace.h b/corelib/src/libs/SireVol/transformedspace.h index 3887283ea..c2d475afa 100644 --- a/corelib/src/libs/SireVol/transformedspace.h +++ b/corelib/src/libs/SireVol/transformedspace.h @@ -124,6 +124,8 @@ namespace SireVol double minimumDistance(const Vector &p, const AABox &box) const; + using Space::minimumDistance; + Vector getRandomPoint(const Vector ¢er, const RanGenerator &generator) const; Vector getBoxCenter(const Vector &p) const; diff --git a/corelib/src/libs/Squire/mopac.h b/corelib/src/libs/Squire/mopac.h index 4b60d0685..096e043c6 100644 --- a/corelib/src/libs/Squire/mopac.h +++ b/corelib/src/libs/Squire/mopac.h @@ -121,6 +121,7 @@ namespace Squire AtomCharges calculateCharges(const Molecule &molecule, const PropertyMap &map) const; protected: + using QMProgram::calculateEnergy; double calculateEnergy(const QMPotential::Molecules &molecules, int ntries = 5) const; QString energyCommandFile(const QMPotential::Molecules &molecules) const; diff --git a/pixi.toml b/pixi.toml index 99a68f992..cdb539a20 100644 --- a/pixi.toml +++ b/pixi.toml @@ -153,7 +153,9 @@ pytorch = "*" torchani = "*" xtb-python = "*" -# EMLE has no Windows-specific deps (ambertools, pytorch etc. excluded on Windows) +[feature.emle.target.win-64.dependencies] +pytorch = "*" +# ambertools, deepmd-kit, nnpops not available on Windows # ============================================================================= # Test feature diff --git a/tests/qm/test_qm.py b/tests/qm/test_qm.py index c21866b22..0d5f3d104 100644 --- a/tests/qm/test_qm.py +++ b/tests/qm/test_qm.py @@ -479,10 +479,44 @@ def callback(numbers_qm, charges_mm, xyz_qm, xyz_mm, cell=None, idx_mm=None): # Same lambda again: qmff lambda is unchanged, so not changed. ctx.set_lambda(0.5) - assert not lever.was_force_changed( - "qmff" - ), "qmff should not be changed when lambda is repeated" + assert not lever.was_force_changed("qmff"), ( + "qmff should not be changed when lambda is repeated" + ) # Different lambda: qmff lambda changes again. ctx.set_lambda(1.0) assert lever.was_force_changed("qmff"), "qmff should be changed when lambda changes" + + +def test_property_bases(ala_mols): + """ + Make sure that the SireOpenMM property classes are exposed as + SireBase::Property, so that they can be stored and retrieved as properties. + """ + + from sire.legacy.Base import Properties, Property + from sire.legacy.Convert._SireOpenMM import NullQMEngine, PyQMEngine, QMEngine + + def callback(numbers_qm, charges_mm, xyz_qm, xyz_mm, cell=None, idx_mm=None): + return (0.0, xyz_qm, xyz_mm) + + mols = ala_mols.clone() + qm_mols, engine = sr.qm.create_engine(mols, mols[0], callback, callback=None) + + props = Properties() + + for name, obj, cls in [ + ("null", NullQMEngine(), NullQMEngine), + ("py", engine, PyQMEngine), + ]: + assert isinstance(obj, QMEngine) + assert isinstance(obj, Property) + props.set_property(name, obj) + assert isinstance(props.property(name), cls) + + d = qm_mols.dynamics( + timestep="1fs", constraint="none", qm_engine=engine, platform="cpu" + ) + + lever = d._d._omm_mols.get_lambda_lever() + assert isinstance(lever, Property) diff --git a/wrapper/Convert/SireOpenMM/CMakeLists.txt b/wrapper/Convert/SireOpenMM/CMakeLists.txt index 60e89f928..30c108c81 100644 --- a/wrapper/Convert/SireOpenMM/CMakeLists.txt +++ b/wrapper/Convert/SireOpenMM/CMakeLists.txt @@ -80,6 +80,11 @@ if (${SIRE_USE_OPENMM}) # Create the library that holds all of the class wrappers add_library (SireOpenMM ${SIREOPENMM_SOURCES}) + # MSVC needs C++20 to compile the libtorch headers. + if (MSVC AND TORCH_FOUND) + set_target_properties(SireOpenMM PROPERTIES CXX_STANDARD 20) + endif() + set_target_properties(SireOpenMM PROPERTIES VERSION ${SIRE_VERSION} diff --git a/wrapper/Convert/SireOpenMM/LambdaLever.pypp.cpp b/wrapper/Convert/SireOpenMM/LambdaLever.pypp.cpp index 42c029f54..ae2b25352 100644 --- a/wrapper/Convert/SireOpenMM/LambdaLever.pypp.cpp +++ b/wrapper/Convert/SireOpenMM/LambdaLever.pypp.cpp @@ -64,7 +64,7 @@ void register_LambdaLever_class() { { //::SireOpenMM::LambdaLever - typedef bp::class_ LambdaLever_exposer_t; + typedef bp::class_> LambdaLever_exposer_t; LambdaLever_exposer_t LambdaLever_exposer = LambdaLever_exposer_t("LambdaLever", "This is a lever that is used to change the parameters in an OpenMM\ncontext according to a lambda value. This is actually a collection\nof levers, each of which is controlled by the main lever.\n\nYou can use SireCAS expressions to control how each lever changes\neach parameter\n", bp::init<>("")); bp::scope LambdaLever_scope(LambdaLever_exposer); LambdaLever_exposer.def(bp::init((bp::arg("other")), "")); diff --git a/wrapper/Convert/SireOpenMM/NullQMEngine.pypp.cpp b/wrapper/Convert/SireOpenMM/NullQMEngine.pypp.cpp index 990175cda..4eb7560ff 100644 --- a/wrapper/Convert/SireOpenMM/NullQMEngine.pypp.cpp +++ b/wrapper/Convert/SireOpenMM/NullQMEngine.pypp.cpp @@ -2,8 +2,8 @@ // (C) Christopher Woods, GPL >= 3 License -#include "boost/python.hpp" #include "NullQMEngine.pypp.hpp" +#include "boost/python.hpp" namespace bp = boost::python; @@ -19,39 +19,31 @@ namespace bp = boost::python; #include "Helpers/release_gil_policy.hpp" -void register_NullQMEngine_class(){ +void register_NullQMEngine_class() +{ { //::SireOpenMM::NullQMEngine - typedef bp::class_< SireOpenMM::NullQMEngine, bp::bases< SireOpenMM::QMEngine >, boost::noncopyable > NullQMEngine_exposer_t; - NullQMEngine_exposer_t NullQMEngine_exposer = NullQMEngine_exposer_t( "NullQMEngine", "" ); - bp::scope NullQMEngine_scope( NullQMEngine_exposer ); + typedef bp::class_, boost::noncopyable> NullQMEngine_exposer_t; + NullQMEngine_exposer_t NullQMEngine_exposer = NullQMEngine_exposer_t("NullQMEngine", ""); + bp::scope NullQMEngine_scope(NullQMEngine_exposer); { //::SireOpenMM::NullQMEngine::typeName - - typedef char const * ( *typeName_function_type )( ); - typeName_function_type typeName_function_value( &::SireOpenMM::NullQMEngine::typeName ); - - NullQMEngine_exposer.def( - "typeName" - , typeName_function_value - , bp::release_gil_policy() - , "Get the name of the QM engine." ); - + + typedef char const *(*typeName_function_type)(); + typeName_function_type typeName_function_value(&::SireOpenMM::NullQMEngine::typeName); + + NullQMEngine_exposer.def( + "typeName", typeName_function_value, bp::release_gil_policy(), "Get the name of the QM engine."); } { //::SireOpenMM::NullQMEngine::what - - typedef char const * ( ::SireOpenMM::NullQMEngine::*what_function_type)( ) const; - what_function_type what_function_value( &::SireOpenMM::NullQMEngine::what ); - - NullQMEngine_exposer.def( - "what" - , what_function_value - , bp::release_gil_policy() - , "Get the name of the QM engine." ); - + + typedef char const *(::SireOpenMM::NullQMEngine::*what_function_type)() const; + what_function_type what_function_value(&::SireOpenMM::NullQMEngine::what); + + NullQMEngine_exposer.def( + "what", what_function_value, bp::release_gil_policy(), "Get the name of the QM engine."); } - NullQMEngine_exposer.staticmethod( "typeName" ); - NullQMEngine_exposer.def( "__str__", &__str__< ::SireOpenMM::NullQMEngine > ); - NullQMEngine_exposer.def( "__repr__", &__str__< ::SireOpenMM::NullQMEngine > ); + NullQMEngine_exposer.staticmethod("typeName"); + NullQMEngine_exposer.def("__str__", &__str__<::SireOpenMM::NullQMEngine>); + NullQMEngine_exposer.def("__repr__", &__str__<::SireOpenMM::NullQMEngine>); } - } diff --git a/wrapper/Convert/SireOpenMM/PerturbableOpenMMMolecule.pypp.cpp b/wrapper/Convert/SireOpenMM/PerturbableOpenMMMolecule.pypp.cpp index 7622c75f3..0f91d61f4 100644 --- a/wrapper/Convert/SireOpenMM/PerturbableOpenMMMolecule.pypp.cpp +++ b/wrapper/Convert/SireOpenMM/PerturbableOpenMMMolecule.pypp.cpp @@ -2,8 +2,8 @@ // (C) Christopher Woods, GPL >= 3 License -#include "boost/python.hpp" #include "PerturbableOpenMMMolecule.pypp.hpp" +#include "boost/python.hpp" namespace bp = boost::python; @@ -111,7 +111,7 @@ namespace bp = boost::python; #include -SireOpenMM::PerturbableOpenMMMolecule __copy__(const SireOpenMM::PerturbableOpenMMMolecule &other){ return SireOpenMM::PerturbableOpenMMMolecule(other); } +SireOpenMM::PerturbableOpenMMMolecule __copy__(const SireOpenMM::PerturbableOpenMMMolecule &other) { return SireOpenMM::PerturbableOpenMMMolecule(other); } #include "Helpers/copy.hpp" @@ -119,647 +119,437 @@ SireOpenMM::PerturbableOpenMMMolecule __copy__(const SireOpenMM::PerturbableOpen #include "Helpers/release_gil_policy.hpp" -void register_PerturbableOpenMMMolecule_class(){ +void register_PerturbableOpenMMMolecule_class() +{ { //::SireOpenMM::PerturbableOpenMMMolecule - typedef bp::class_< SireOpenMM::PerturbableOpenMMMolecule > PerturbableOpenMMMolecule_exposer_t; - PerturbableOpenMMMolecule_exposer_t PerturbableOpenMMMolecule_exposer = PerturbableOpenMMMolecule_exposer_t( "PerturbableOpenMMMolecule", "This class holds all of the information of an OpenMM molecule\nthat can be perturbed using a LambdaSchedule. The data is held\nin easy-to-access arrays, with guarantees that the arrays are\ncompatible and the data is aligned.\n", bp::init< >("Null constructor") ); - bp::scope PerturbableOpenMMMolecule_scope( PerturbableOpenMMMolecule_exposer ); - PerturbableOpenMMMolecule_exposer.def( bp::init< SireOpenMM::OpenMMMolecule const &, bp::optional< SireBase::PropertyMap const & > >(( bp::arg("mol"), bp::arg("map")=SireBase::PropertyMap() ), "Construct from the passed OpenMMMolecule") ); - PerturbableOpenMMMolecule_exposer.def( bp::init< SireMol::Molecule const &, int, bp::optional< SireBase::PropertyMap const & > >(( bp::arg("mol"), bp::arg("map")=SireBase::PropertyMap() ), "Construct from a passed molecule and map") ); - PerturbableOpenMMMolecule_exposer.def( bp::init< SireOpenMM::PerturbableOpenMMMolecule const & >(( bp::arg("other") ), "Copy constructor") ); + typedef bp::class_> PerturbableOpenMMMolecule_exposer_t; + PerturbableOpenMMMolecule_exposer_t PerturbableOpenMMMolecule_exposer = PerturbableOpenMMMolecule_exposer_t("PerturbableOpenMMMolecule", "This class holds all of the information of an OpenMM molecule\nthat can be perturbed using a LambdaSchedule. The data is held\nin easy-to-access arrays, with guarantees that the arrays are\ncompatible and the data is aligned.\n", bp::init<>("Null constructor")); + bp::scope PerturbableOpenMMMolecule_scope(PerturbableOpenMMMolecule_exposer); + PerturbableOpenMMMolecule_exposer.def(bp::init>((bp::arg("mol"), bp::arg("map") = SireBase::PropertyMap()), "Construct from the passed OpenMMMolecule")); + PerturbableOpenMMMolecule_exposer.def(bp::init>((bp::arg("mol"), bp::arg("map") = SireBase::PropertyMap()), "Construct from a passed molecule and map")); + PerturbableOpenMMMolecule_exposer.def(bp::init((bp::arg("other")), "Copy constructor")); { //::SireOpenMM::PerturbableOpenMMMolecule::angles - - typedef ::QList< SireMM::Angle > ( ::SireOpenMM::PerturbableOpenMMMolecule::*angles_function_type)( ) const; - angles_function_type angles_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::angles ); - - PerturbableOpenMMMolecule_exposer.def( - "angles" - , angles_function_value - , bp::release_gil_policy() - , "Return the angles which are perturbed, in the order they are\n set in this perturbation\n" ); - + + typedef ::QList (::SireOpenMM::PerturbableOpenMMMolecule::*angles_function_type)() const; + angles_function_type angles_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::angles); + + PerturbableOpenMMMolecule_exposer.def( + "angles", angles_function_value, bp::release_gil_policy(), "Return the angles which are perturbed, in the order they are\n set in this perturbation\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::atoms - - typedef ::QList< SireMol::Atom > ( ::SireOpenMM::PerturbableOpenMMMolecule::*atoms_function_type)( ) const; - atoms_function_type atoms_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::atoms ); - - PerturbableOpenMMMolecule_exposer.def( - "atoms" - , atoms_function_value - , bp::release_gil_policy() - , "Return the atoms which are perturbed, in the order they are\n set in this perturbation\n" ); - + + typedef ::QList (::SireOpenMM::PerturbableOpenMMMolecule::*atoms_function_type)() const; + atoms_function_type atoms_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::atoms); + + PerturbableOpenMMMolecule_exposer.def( + "atoms", atoms_function_value, bp::release_gil_policy(), "Return the atoms which are perturbed, in the order they are\n set in this perturbation\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::bonds - - typedef ::QList< SireMM::Bond > ( ::SireOpenMM::PerturbableOpenMMMolecule::*bonds_function_type)( ) const; - bonds_function_type bonds_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::bonds ); - - PerturbableOpenMMMolecule_exposer.def( - "bonds" - , bonds_function_value - , bp::release_gil_policy() - , "Return the bonds which are perturbed, in the order they are\n set in this perturbation\n" ); - + + typedef ::QList (::SireOpenMM::PerturbableOpenMMMolecule::*bonds_function_type)() const; + bonds_function_type bonds_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::bonds); + + PerturbableOpenMMMolecule_exposer.def( + "bonds", bonds_function_value, bp::release_gil_policy(), "Return the bonds which are perturbed, in the order they are\n set in this perturbation\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getAlphas0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getAlphas0_function_type)( ) const; - getAlphas0_function_type getAlphas0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getAlphas0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getAlphas0" - , getAlphas0_function_value - , bp::release_gil_policy() - , "Return the alpha parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getAlphas0_function_type)() const; + getAlphas0_function_type getAlphas0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getAlphas0); + + PerturbableOpenMMMolecule_exposer.def( + "getAlphas0", getAlphas0_function_value, bp::release_gil_policy(), "Return the alpha parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getAlphas1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getAlphas1_function_type)( ) const; - getAlphas1_function_type getAlphas1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getAlphas1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getAlphas1" - , getAlphas1_function_value - , bp::release_gil_policy() - , "Return the alpha parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getAlphas1_function_type)() const; + getAlphas1_function_type getAlphas1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getAlphas1); + + PerturbableOpenMMMolecule_exposer.def( + "getAlphas1", getAlphas1_function_value, bp::release_gil_policy(), "Return the alpha parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getAngleKs0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getAngleKs0_function_type)( ) const; - getAngleKs0_function_type getAngleKs0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getAngleKs0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getAngleKs0" - , getAngleKs0_function_value - , bp::release_gil_policy() - , "Return the angle k parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getAngleKs0_function_type)() const; + getAngleKs0_function_type getAngleKs0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getAngleKs0); + + PerturbableOpenMMMolecule_exposer.def( + "getAngleKs0", getAngleKs0_function_value, bp::release_gil_policy(), "Return the angle k parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getAngleKs1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getAngleKs1_function_type)( ) const; - getAngleKs1_function_type getAngleKs1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getAngleKs1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getAngleKs1" - , getAngleKs1_function_value - , bp::release_gil_policy() - , "Return the angle k parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getAngleKs1_function_type)() const; + getAngleKs1_function_type getAngleKs1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getAngleKs1); + + PerturbableOpenMMMolecule_exposer.def( + "getAngleKs1", getAngleKs1_function_value, bp::release_gil_policy(), "Return the angle k parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getAngleSizes0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getAngleSizes0_function_type)( ) const; - getAngleSizes0_function_type getAngleSizes0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getAngleSizes0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getAngleSizes0" - , getAngleSizes0_function_value - , bp::release_gil_policy() - , "Return the angle size parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getAngleSizes0_function_type)() const; + getAngleSizes0_function_type getAngleSizes0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getAngleSizes0); + + PerturbableOpenMMMolecule_exposer.def( + "getAngleSizes0", getAngleSizes0_function_value, bp::release_gil_policy(), "Return the angle size parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getAngleSizes1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getAngleSizes1_function_type)( ) const; - getAngleSizes1_function_type getAngleSizes1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getAngleSizes1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getAngleSizes1" - , getAngleSizes1_function_value - , bp::release_gil_policy() - , "Return the angle size parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getAngleSizes1_function_type)() const; + getAngleSizes1_function_type getAngleSizes1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getAngleSizes1); + + PerturbableOpenMMMolecule_exposer.def( + "getAngleSizes1", getAngleSizes1_function_value, bp::release_gil_policy(), "Return the angle size parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getBondKs0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getBondKs0_function_type)( ) const; - getBondKs0_function_type getBondKs0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getBondKs0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getBondKs0" - , getBondKs0_function_value - , bp::release_gil_policy() - , "Return the bond k parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getBondKs0_function_type)() const; + getBondKs0_function_type getBondKs0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getBondKs0); + + PerturbableOpenMMMolecule_exposer.def( + "getBondKs0", getBondKs0_function_value, bp::release_gil_policy(), "Return the bond k parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getBondKs1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getBondKs1_function_type)( ) const; - getBondKs1_function_type getBondKs1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getBondKs1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getBondKs1" - , getBondKs1_function_value - , bp::release_gil_policy() - , "Return the bond k parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getBondKs1_function_type)() const; + getBondKs1_function_type getBondKs1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getBondKs1); + + PerturbableOpenMMMolecule_exposer.def( + "getBondKs1", getBondKs1_function_value, bp::release_gil_policy(), "Return the bond k parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getBondLengths0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getBondLengths0_function_type)( ) const; - getBondLengths0_function_type getBondLengths0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getBondLengths0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getBondLengths0" - , getBondLengths0_function_value - , bp::release_gil_policy() - , "Return the bond length parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getBondLengths0_function_type)() const; + getBondLengths0_function_type getBondLengths0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getBondLengths0); + + PerturbableOpenMMMolecule_exposer.def( + "getBondLengths0", getBondLengths0_function_value, bp::release_gil_policy(), "Return the bond length parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getBondLengths1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getBondLengths1_function_type)( ) const; - getBondLengths1_function_type getBondLengths1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getBondLengths1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getBondLengths1" - , getBondLengths1_function_value - , bp::release_gil_policy() - , "Return the bond length parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getBondLengths1_function_type)() const; + getBondLengths1_function_type getBondLengths1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getBondLengths1); + + PerturbableOpenMMMolecule_exposer.def( + "getBondLengths1", getBondLengths1_function_value, bp::release_gil_policy(), "Return the bond length parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getChargeScales0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getChargeScales0_function_type)( ) const; - getChargeScales0_function_type getChargeScales0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getChargeScales0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getChargeScales0" - , getChargeScales0_function_value - , bp::release_gil_policy() - , "Return the coulomb intramolecular scale factors of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getChargeScales0_function_type)() const; + getChargeScales0_function_type getChargeScales0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getChargeScales0); + + PerturbableOpenMMMolecule_exposer.def( + "getChargeScales0", getChargeScales0_function_value, bp::release_gil_policy(), "Return the coulomb intramolecular scale factors of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getChargeScales1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getChargeScales1_function_type)( ) const; - getChargeScales1_function_type getChargeScales1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getChargeScales1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getChargeScales1" - , getChargeScales1_function_value - , bp::release_gil_policy() - , "Return the coulomb intramolecular scale factors of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getChargeScales1_function_type)() const; + getChargeScales1_function_type getChargeScales1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getChargeScales1); + + PerturbableOpenMMMolecule_exposer.def( + "getChargeScales1", getChargeScales1_function_value, bp::release_gil_policy(), "Return the coulomb intramolecular scale factors of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getCharges0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getCharges0_function_type)( ) const; - getCharges0_function_type getCharges0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getCharges0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getCharges0" - , getCharges0_function_value - , bp::release_gil_policy() - , "Return the atom charges of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getCharges0_function_type)() const; + getCharges0_function_type getCharges0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getCharges0); + + PerturbableOpenMMMolecule_exposer.def( + "getCharges0", getCharges0_function_value, bp::release_gil_policy(), "Return the atom charges of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getCharges1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getCharges1_function_type)( ) const; - getCharges1_function_type getCharges1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getCharges1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getCharges1" - , getCharges1_function_value - , bp::release_gil_policy() - , "Return the atom charges of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getCharges1_function_type)() const; + getCharges1_function_type getCharges1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getCharges1); + + PerturbableOpenMMMolecule_exposer.def( + "getCharges1", getCharges1_function_value, bp::release_gil_policy(), "Return the atom charges of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getConstraintIndicies - - typedef ::QVector< int > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getConstraintIndicies_function_type)( ) const; - getConstraintIndicies_function_type getConstraintIndicies_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getConstraintIndicies ); - - PerturbableOpenMMMolecule_exposer.def( - "getConstraintIndicies" - , getConstraintIndicies_function_value - , bp::release_gil_policy() - , "Return the indicies of the perturbable constraints" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getConstraintIndicies_function_type)() const; + getConstraintIndicies_function_type getConstraintIndicies_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getConstraintIndicies); + + PerturbableOpenMMMolecule_exposer.def( + "getConstraintIndicies", getConstraintIndicies_function_value, bp::release_gil_policy(), "Return the indicies of the perturbable constraints"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getEpsilons0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getEpsilons0_function_type)( ) const; - getEpsilons0_function_type getEpsilons0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getEpsilons0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getEpsilons0" - , getEpsilons0_function_value - , bp::release_gil_policy() - , "Return the LJ epsilon parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getEpsilons0_function_type)() const; + getEpsilons0_function_type getEpsilons0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getEpsilons0); + + PerturbableOpenMMMolecule_exposer.def( + "getEpsilons0", getEpsilons0_function_value, bp::release_gil_policy(), "Return the LJ epsilon parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getEpsilons1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getEpsilons1_function_type)( ) const; - getEpsilons1_function_type getEpsilons1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getEpsilons1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getEpsilons1" - , getEpsilons1_function_value - , bp::release_gil_policy() - , "Return the LJ epsilon parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getEpsilons1_function_type)() const; + getEpsilons1_function_type getEpsilons1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getEpsilons1); + + PerturbableOpenMMMolecule_exposer.def( + "getEpsilons1", getEpsilons1_function_value, bp::release_gil_policy(), "Return the LJ epsilon parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getExceptionAtoms - - typedef ::QVector< boost::tuples::tuple< int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type > > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getExceptionAtoms_function_type)( ) const; - getExceptionAtoms_function_type getExceptionAtoms_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getExceptionAtoms ); - - PerturbableOpenMMMolecule_exposer.def( - "getExceptionAtoms" - , getExceptionAtoms_function_value - , bp::release_gil_policy() - , "Return the indices of the atoms in the exceptions" ); - + + typedef ::QVector> (::SireOpenMM::PerturbableOpenMMMolecule::*getExceptionAtoms_function_type)() const; + getExceptionAtoms_function_type getExceptionAtoms_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getExceptionAtoms); + + PerturbableOpenMMMolecule_exposer.def( + "getExceptionAtoms", getExceptionAtoms_function_value, bp::release_gil_policy(), "Return the indices of the atoms in the exceptions"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getExceptionIndicies - - typedef ::QVector< boost::tuples::tuple< int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type > > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getExceptionIndicies_function_type)( ::QString const & ) const; - getExceptionIndicies_function_type getExceptionIndicies_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getExceptionIndicies ); - - PerturbableOpenMMMolecule_exposer.def( - "getExceptionIndicies" - , getExceptionIndicies_function_value - , ( bp::arg("name") ) - , bp::release_gil_policy() - , "Return the global indexes of the exceptions in the non-bonded and\n ghost-14 forces\n" ); - + + typedef ::QVector> (::SireOpenMM::PerturbableOpenMMMolecule::*getExceptionIndicies_function_type)(::QString const &) const; + getExceptionIndicies_function_type getExceptionIndicies_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getExceptionIndicies); + + PerturbableOpenMMMolecule_exposer.def( + "getExceptionIndicies", getExceptionIndicies_function_value, (bp::arg("name")), bp::release_gil_policy(), "Return the global indexes of the exceptions in the non-bonded and\n ghost-14 forces\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getFromGhostIdxs - - typedef ::QSet< int > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getFromGhostIdxs_function_type)( ) const; - getFromGhostIdxs_function_type getFromGhostIdxs_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getFromGhostIdxs ); - - PerturbableOpenMMMolecule_exposer.def( - "getFromGhostIdxs" - , getFromGhostIdxs_function_value - , bp::release_gil_policy() - , "Return the indexes of the atoms that were ghosts in the\n reference state\n" ); - + + typedef ::QSet (::SireOpenMM::PerturbableOpenMMMolecule::*getFromGhostIdxs_function_type)() const; + getFromGhostIdxs_function_type getFromGhostIdxs_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getFromGhostIdxs); + + PerturbableOpenMMMolecule_exposer.def( + "getFromGhostIdxs", getFromGhostIdxs_function_value, bp::release_gil_policy(), "Return the indexes of the atoms that were ghosts in the\n reference state\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getKappas0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getKappas0_function_type)( ) const; - getKappas0_function_type getKappas0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getKappas0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getKappas0" - , getKappas0_function_value - , bp::release_gil_policy() - , "Return the kappa parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getKappas0_function_type)() const; + getKappas0_function_type getKappas0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getKappas0); + + PerturbableOpenMMMolecule_exposer.def( + "getKappas0", getKappas0_function_value, bp::release_gil_policy(), "Return the kappa parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getKappas1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getKappas1_function_type)( ) const; - getKappas1_function_type getKappas1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getKappas1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getKappas1" - , getKappas1_function_value - , bp::release_gil_policy() - , "Return the kappa parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getKappas1_function_type)() const; + getKappas1_function_type getKappas1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getKappas1); + + PerturbableOpenMMMolecule_exposer.def( + "getKappas1", getKappas1_function_value, bp::release_gil_policy(), "Return the kappa parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getLJScales0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getLJScales0_function_type)( ) const; - getLJScales0_function_type getLJScales0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getLJScales0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getLJScales0" - , getLJScales0_function_value - , bp::release_gil_policy() - , "Return the LJ intramolecular scale factors of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getLJScales0_function_type)() const; + getLJScales0_function_type getLJScales0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getLJScales0); + + PerturbableOpenMMMolecule_exposer.def( + "getLJScales0", getLJScales0_function_value, bp::release_gil_policy(), "Return the LJ intramolecular scale factors of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getLJScales1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getLJScales1_function_type)( ) const; - getLJScales1_function_type getLJScales1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getLJScales1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getLJScales1" - , getLJScales1_function_value - , bp::release_gil_policy() - , "Return the LJ intramolecular scale factors of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getLJScales1_function_type)() const; + getLJScales1_function_type getLJScales1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getLJScales1); + + PerturbableOpenMMMolecule_exposer.def( + "getLJScales1", getLJScales1_function_value, bp::release_gil_policy(), "Return the LJ intramolecular scale factors of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getPerturbableConstraints - - typedef ::boost::tuples::tuple< QVector< int >, QVector< double >, QVector< double >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getPerturbableConstraints_function_type)( ) const; - getPerturbableConstraints_function_type getPerturbableConstraints_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getPerturbableConstraints ); - - PerturbableOpenMMMolecule_exposer.def( - "getPerturbableConstraints" - , getPerturbableConstraints_function_value - , bp::release_gil_policy() - , "Return three arrays containing the constraint indexes, and the\n reference and perturbed values of the constraint lengths\n" ); - + + typedef ::boost::tuples::tuple, QVector, QVector, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> (::SireOpenMM::PerturbableOpenMMMolecule::*getPerturbableConstraints_function_type)() const; + getPerturbableConstraints_function_type getPerturbableConstraints_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getPerturbableConstraints); + + PerturbableOpenMMMolecule_exposer.def( + "getPerturbableConstraints", getPerturbableConstraints_function_value, bp::release_gil_policy(), "Return three arrays containing the constraint indexes, and the\n reference and perturbed values of the constraint lengths\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getPerturbableConstraintsWithAtoms - - typedef ::QVector< boost::tuples::tuple< int, int, double, double, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type > > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getPerturbableConstraintsWithAtoms_function_type)( ) const; - getPerturbableConstraintsWithAtoms_function_type getPerturbableConstraintsWithAtoms_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getPerturbableConstraintsWithAtoms ); - - PerturbableOpenMMMolecule_exposer.def( - "getPerturbableConstraintsWithAtoms" - , getPerturbableConstraintsWithAtoms_function_value - , bp::release_gil_policy() - , "Return the atom indexes of all of the constraints, with\n the constraint lengths at the two end states, in the order\n they appear in this molecule\n" ); - + + typedef ::QVector> (::SireOpenMM::PerturbableOpenMMMolecule::*getPerturbableConstraintsWithAtoms_function_type)() const; + getPerturbableConstraintsWithAtoms_function_type getPerturbableConstraintsWithAtoms_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getPerturbableConstraintsWithAtoms); + + PerturbableOpenMMMolecule_exposer.def( + "getPerturbableConstraintsWithAtoms", getPerturbableConstraintsWithAtoms_function_value, bp::release_gil_policy(), "Return the atom indexes of all of the constraints, with\n the constraint lengths at the two end states, in the order\n they appear in this molecule\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getSigmas0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getSigmas0_function_type)( ) const; - getSigmas0_function_type getSigmas0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getSigmas0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getSigmas0" - , getSigmas0_function_value - , bp::release_gil_policy() - , "Return the LJ sigma parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getSigmas0_function_type)() const; + getSigmas0_function_type getSigmas0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getSigmas0); + + PerturbableOpenMMMolecule_exposer.def( + "getSigmas0", getSigmas0_function_value, bp::release_gil_policy(), "Return the LJ sigma parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getSigmas1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getSigmas1_function_type)( ) const; - getSigmas1_function_type getSigmas1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getSigmas1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getSigmas1" - , getSigmas1_function_value - , bp::release_gil_policy() - , "Return the LJ sigma parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getSigmas1_function_type)() const; + getSigmas1_function_type getSigmas1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getSigmas1); + + PerturbableOpenMMMolecule_exposer.def( + "getSigmas1", getSigmas1_function_value, bp::release_gil_policy(), "Return the LJ sigma parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getToGhostIdxs - - typedef ::QSet< int > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getToGhostIdxs_function_type)( ) const; - getToGhostIdxs_function_type getToGhostIdxs_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getToGhostIdxs ); - - PerturbableOpenMMMolecule_exposer.def( - "getToGhostIdxs" - , getToGhostIdxs_function_value - , bp::release_gil_policy() - , "Return the indexes of the atoms that are to be ghosted in the\n perturbed state\n" ); - + + typedef ::QSet (::SireOpenMM::PerturbableOpenMMMolecule::*getToGhostIdxs_function_type)() const; + getToGhostIdxs_function_type getToGhostIdxs_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getToGhostIdxs); + + PerturbableOpenMMMolecule_exposer.def( + "getToGhostIdxs", getToGhostIdxs_function_value, bp::release_gil_policy(), "Return the indexes of the atoms that are to be ghosted in the\n perturbed state\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getTorsionKs0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionKs0_function_type)( ) const; - getTorsionKs0_function_type getTorsionKs0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getTorsionKs0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getTorsionKs0" - , getTorsionKs0_function_value - , bp::release_gil_policy() - , "Return the torsion k parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionKs0_function_type)() const; + getTorsionKs0_function_type getTorsionKs0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getTorsionKs0); + + PerturbableOpenMMMolecule_exposer.def( + "getTorsionKs0", getTorsionKs0_function_value, bp::release_gil_policy(), "Return the torsion k parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getTorsionKs1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionKs1_function_type)( ) const; - getTorsionKs1_function_type getTorsionKs1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getTorsionKs1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getTorsionKs1" - , getTorsionKs1_function_value - , bp::release_gil_policy() - , "Return the torsion k parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionKs1_function_type)() const; + getTorsionKs1_function_type getTorsionKs1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getTorsionKs1); + + PerturbableOpenMMMolecule_exposer.def( + "getTorsionKs1", getTorsionKs1_function_value, bp::release_gil_policy(), "Return the torsion k parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPeriodicities0 - - typedef ::QVector< signed char > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPeriodicities0_function_type)( ) const; - getTorsionPeriodicities0_function_type getTorsionPeriodicities0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPeriodicities0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getTorsionPeriodicities0" - , getTorsionPeriodicities0_function_value - , bp::release_gil_policy() - , "Return the torsion periodicity parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPeriodicities0_function_type)() const; + getTorsionPeriodicities0_function_type getTorsionPeriodicities0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPeriodicities0); + + PerturbableOpenMMMolecule_exposer.def( + "getTorsionPeriodicities0", getTorsionPeriodicities0_function_value, bp::release_gil_policy(), "Return the torsion periodicity parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPeriodicities1 - - typedef ::QVector< signed char > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPeriodicities1_function_type)( ) const; - getTorsionPeriodicities1_function_type getTorsionPeriodicities1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPeriodicities1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getTorsionPeriodicities1" - , getTorsionPeriodicities1_function_value - , bp::release_gil_policy() - , "Return the torsion periodicity parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPeriodicities1_function_type)() const; + getTorsionPeriodicities1_function_type getTorsionPeriodicities1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPeriodicities1); + + PerturbableOpenMMMolecule_exposer.def( + "getTorsionPeriodicities1", getTorsionPeriodicities1_function_value, bp::release_gil_policy(), "Return the torsion periodicity parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPhases0 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPhases0_function_type)( ) const; - getTorsionPhases0_function_type getTorsionPhases0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPhases0 ); - - PerturbableOpenMMMolecule_exposer.def( - "getTorsionPhases0" - , getTorsionPhases0_function_value - , bp::release_gil_policy() - , "Return the torsion phase parameters of the reference state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPhases0_function_type)() const; + getTorsionPhases0_function_type getTorsionPhases0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPhases0); + + PerturbableOpenMMMolecule_exposer.def( + "getTorsionPhases0", getTorsionPhases0_function_value, bp::release_gil_policy(), "Return the torsion phase parameters of the reference state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPhases1 - - typedef ::QVector< double > ( ::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPhases1_function_type)( ) const; - getTorsionPhases1_function_type getTorsionPhases1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPhases1 ); - - PerturbableOpenMMMolecule_exposer.def( - "getTorsionPhases1" - , getTorsionPhases1_function_value - , bp::release_gil_policy() - , "Return the torsion phase parameters of the perturbed state" ); - + + typedef ::QVector (::SireOpenMM::PerturbableOpenMMMolecule::*getTorsionPhases1_function_type)() const; + getTorsionPhases1_function_type getTorsionPhases1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getTorsionPhases1); + + PerturbableOpenMMMolecule_exposer.def( + "getTorsionPhases1", getTorsionPhases1_function_value, bp::release_gil_policy(), "Return the torsion phase parameters of the perturbed state"); } { //::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGrids0 - typedef ::QVector< double > const & ( ::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPGrids0_function_type)( ) const; - getCMAPGrids0_function_type getCMAPGrids0_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGrids0 ); + typedef ::QVector const &(::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPGrids0_function_type)() const; + getCMAPGrids0_function_type getCMAPGrids0_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGrids0); PerturbableOpenMMMolecule_exposer.def( - "getCMAPGrids0" - , getCMAPGrids0_function_value - , bp::return_value_policy< bp::copy_const_reference >() - , "Return the flat concatenated CMAP grid values (column-major, kJ/mol) " - "for the reference state. Grid k has getCMAPGridSizes()[k]^2 entries." ); - + "getCMAPGrids0", getCMAPGrids0_function_value, bp::return_value_policy(), "Return the flat concatenated CMAP grid values (column-major, kJ/mol) " + "for the reference state. Grid k has getCMAPGridSizes()[k]^2 entries."); } { //::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGrids1 - typedef ::QVector< double > const & ( ::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPGrids1_function_type)( ) const; - getCMAPGrids1_function_type getCMAPGrids1_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGrids1 ); + typedef ::QVector const &(::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPGrids1_function_type)() const; + getCMAPGrids1_function_type getCMAPGrids1_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGrids1); PerturbableOpenMMMolecule_exposer.def( - "getCMAPGrids1" - , getCMAPGrids1_function_value - , bp::return_value_policy< bp::copy_const_reference >() - , "Return the flat concatenated CMAP grid values (column-major, kJ/mol) " - "for the perturbed state. Grid k has getCMAPGridSizes()[k]^2 entries." ); - + "getCMAPGrids1", getCMAPGrids1_function_value, bp::return_value_policy(), "Return the flat concatenated CMAP grid values (column-major, kJ/mol) " + "for the perturbed state. Grid k has getCMAPGridSizes()[k]^2 entries."); } { //::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGridSizes - typedef ::QVector< int > const & ( ::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPGridSizes_function_type)( ) const; - getCMAPGridSizes_function_type getCMAPGridSizes_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGridSizes ); + typedef ::QVector const &(::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPGridSizes_function_type)() const; + getCMAPGridSizes_function_type getCMAPGridSizes_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getCMAPGridSizes); PerturbableOpenMMMolecule_exposer.def( - "getCMAPGridSizes" - , getCMAPGridSizes_function_value - , bp::return_value_policy< bp::copy_const_reference >() - , "Return the grid dimension N for each CMAP torsion (grid is N x N). " - "Entries correspond to the grids in getCMAPGrids0/1." ); - + "getCMAPGridSizes", getCMAPGridSizes_function_value, bp::return_value_policy(), "Return the grid dimension N for each CMAP torsion (grid is N x N). " + "Entries correspond to the grids in getCMAPGrids0/1."); } { //::SireOpenMM::PerturbableOpenMMMolecule::getCMAPAtoms - typedef ::QVector< boost::tuples::tuple< int, int, int, int, int, - boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, - boost::tuples::null_type, boost::tuples::null_type > > - ( ::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPAtoms_function_type)( ) const; - getCMAPAtoms_function_type getCMAPAtoms_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::getCMAPAtoms ); + typedef ::QVector> (::SireOpenMM::PerturbableOpenMMMolecule::*getCMAPAtoms_function_type)() const; + getCMAPAtoms_function_type getCMAPAtoms_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::getCMAPAtoms); PerturbableOpenMMMolecule_exposer.def( - "getCMAPAtoms" - , getCMAPAtoms_function_value - , bp::release_gil_policy() - , "Return the molecule-local 5-atom indices for each CMAP torsion, " - "in the same order as getCMAPGridSizes(). Used for REST2 scaling." ); - + "getCMAPAtoms", getCMAPAtoms_function_value, bp::release_gil_policy(), "Return the molecule-local 5-atom indices for each CMAP torsion, " + "in the same order as getCMAPGridSizes(). Used for REST2 scaling."); } { //::SireOpenMM::PerturbableOpenMMMolecule::isGhostAtom - typedef bool ( ::SireOpenMM::PerturbableOpenMMMolecule::*isGhostAtom_function_type)( int ) const; - isGhostAtom_function_type isGhostAtom_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::isGhostAtom ); - - PerturbableOpenMMMolecule_exposer.def( - "isGhostAtom" - , isGhostAtom_function_value - , ( bp::arg("atom") ) - , bp::release_gil_policy() - , "Return true if the atom is a ghost atom in the\n referenece or perturbed states" ); - + typedef bool (::SireOpenMM::PerturbableOpenMMMolecule::*isGhostAtom_function_type)(int) const; + isGhostAtom_function_type isGhostAtom_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::isGhostAtom); + + PerturbableOpenMMMolecule_exposer.def( + "isGhostAtom", isGhostAtom_function_value, (bp::arg("atom")), bp::release_gil_policy(), "Return true if the atom is a ghost atom in the\n referenece or perturbed states"); } { //::SireOpenMM::PerturbableOpenMMMolecule::isNull - - typedef bool ( ::SireOpenMM::PerturbableOpenMMMolecule::*isNull_function_type)( ) const; - isNull_function_type isNull_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::isNull ); - - PerturbableOpenMMMolecule_exposer.def( - "isNull" - , isNull_function_value - , bp::release_gil_policy() - , "Return whether or not this is null" ); - - } - PerturbableOpenMMMolecule_exposer.def( bp::self != bp::self ); + + typedef bool (::SireOpenMM::PerturbableOpenMMMolecule::*isNull_function_type)() const; + isNull_function_type isNull_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::isNull); + + PerturbableOpenMMMolecule_exposer.def( + "isNull", isNull_function_value, bp::release_gil_policy(), "Return whether or not this is null"); + } + PerturbableOpenMMMolecule_exposer.def(bp::self != bp::self); { //::SireOpenMM::PerturbableOpenMMMolecule::operator= - - typedef ::SireOpenMM::PerturbableOpenMMMolecule & ( ::SireOpenMM::PerturbableOpenMMMolecule::*assign_function_type)( ::SireOpenMM::PerturbableOpenMMMolecule const & ) ; - assign_function_type assign_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::operator= ); - - PerturbableOpenMMMolecule_exposer.def( - "assign" - , assign_function_value - , ( bp::arg("other") ) - , bp::return_self< >() - , "" ); - - } - PerturbableOpenMMMolecule_exposer.def( bp::self == bp::self ); + + typedef ::SireOpenMM::PerturbableOpenMMMolecule &(::SireOpenMM::PerturbableOpenMMMolecule::*assign_function_type)(::SireOpenMM::PerturbableOpenMMMolecule const &); + assign_function_type assign_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::operator=); + + PerturbableOpenMMMolecule_exposer.def( + "assign", assign_function_value, (bp::arg("other")), bp::return_self<>(), ""); + } + PerturbableOpenMMMolecule_exposer.def(bp::self == bp::self); { //::SireOpenMM::PerturbableOpenMMMolecule::setConstraintIndicies - - typedef void ( ::SireOpenMM::PerturbableOpenMMMolecule::*setConstraintIndicies_function_type)( ::QVector< int > const & ) ; - setConstraintIndicies_function_type setConstraintIndicies_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::setConstraintIndicies ); - - PerturbableOpenMMMolecule_exposer.def( - "setConstraintIndicies" - , setConstraintIndicies_function_value - , ( bp::arg("constraint_idxs") ) - , bp::release_gil_policy() - , "Set the indexes of perturbable constraints in the System" ); - + + typedef void (::SireOpenMM::PerturbableOpenMMMolecule::*setConstraintIndicies_function_type)(::QVector const &); + setConstraintIndicies_function_type setConstraintIndicies_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::setConstraintIndicies); + + PerturbableOpenMMMolecule_exposer.def( + "setConstraintIndicies", setConstraintIndicies_function_value, (bp::arg("constraint_idxs")), bp::release_gil_policy(), "Set the indexes of perturbable constraints in the System"); } { //::SireOpenMM::PerturbableOpenMMMolecule::setExceptionIndicies - - typedef void ( ::SireOpenMM::PerturbableOpenMMMolecule::*setExceptionIndicies_function_type)( ::QString const &,::QVector< boost::tuples::tuple< int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type > > const & ) ; - setExceptionIndicies_function_type setExceptionIndicies_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::setExceptionIndicies ); - - PerturbableOpenMMMolecule_exposer.def( - "setExceptionIndicies" - , setExceptionIndicies_function_value - , ( bp::arg("name"), bp::arg("exception_idxs") ) - , bp::release_gil_policy() - , "Set the global indexes of the exceptions in the non-bonded and\n ghost-14 forces\n" ); - + + typedef void (::SireOpenMM::PerturbableOpenMMMolecule::*setExceptionIndicies_function_type)(::QString const &, ::QVector> const &); + setExceptionIndicies_function_type setExceptionIndicies_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::setExceptionIndicies); + + PerturbableOpenMMMolecule_exposer.def( + "setExceptionIndicies", setExceptionIndicies_function_value, (bp::arg("name"), bp::arg("exception_idxs")), bp::release_gil_policy(), "Set the global indexes of the exceptions in the non-bonded and\n ghost-14 forces\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::toString - - typedef ::QString ( ::SireOpenMM::PerturbableOpenMMMolecule::*toString_function_type)( ) const; - toString_function_type toString_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::toString ); - - PerturbableOpenMMMolecule_exposer.def( - "toString" - , toString_function_value - , bp::release_gil_policy() - , "" ); - + + typedef ::QString (::SireOpenMM::PerturbableOpenMMMolecule::*toString_function_type)() const; + toString_function_type toString_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::toString); + + PerturbableOpenMMMolecule_exposer.def( + "toString", toString_function_value, bp::release_gil_policy(), ""); } { //::SireOpenMM::PerturbableOpenMMMolecule::torsions - - typedef ::QList< SireMM::Dihedral > ( ::SireOpenMM::PerturbableOpenMMMolecule::*torsions_function_type)( ) const; - torsions_function_type torsions_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::torsions ); - - PerturbableOpenMMMolecule_exposer.def( - "torsions" - , torsions_function_value - , bp::release_gil_policy() - , "Return the torsions which are perturbed, in the order they are\n set in this perturbation. Note that this include both the\n normal dihedrals and the improper torsions (openmm internally\n treats them the same)\n" ); - + + typedef ::QList (::SireOpenMM::PerturbableOpenMMMolecule::*torsions_function_type)() const; + torsions_function_type torsions_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::torsions); + + PerturbableOpenMMMolecule_exposer.def( + "torsions", torsions_function_value, bp::release_gil_policy(), "Return the torsions which are perturbed, in the order they are\n set in this perturbation. Note that this include both the\n normal dihedrals and the improper torsions (openmm internally\n treats them the same)\n"); } { //::SireOpenMM::PerturbableOpenMMMolecule::typeName - - typedef char const * ( *typeName_function_type )( ); - typeName_function_type typeName_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::typeName ); - - PerturbableOpenMMMolecule_exposer.def( - "typeName" - , typeName_function_value - , bp::release_gil_policy() - , "" ); - + + typedef char const *(*typeName_function_type)(); + typeName_function_type typeName_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::typeName); + + PerturbableOpenMMMolecule_exposer.def( + "typeName", typeName_function_value, bp::release_gil_policy(), ""); } { //::SireOpenMM::PerturbableOpenMMMolecule::what - - typedef char const * ( ::SireOpenMM::PerturbableOpenMMMolecule::*what_function_type)( ) const; - what_function_type what_function_value( &::SireOpenMM::PerturbableOpenMMMolecule::what ); - - PerturbableOpenMMMolecule_exposer.def( - "what" - , what_function_value - , bp::release_gil_policy() - , "" ); - - } - PerturbableOpenMMMolecule_exposer.staticmethod( "typeName" ); - PerturbableOpenMMMolecule_exposer.def( "__copy__", &__copy__); - PerturbableOpenMMMolecule_exposer.def( "__deepcopy__", &__copy__); - PerturbableOpenMMMolecule_exposer.def( "clone", &__copy__); - PerturbableOpenMMMolecule_exposer.def( "__str__", &__str__< ::SireOpenMM::PerturbableOpenMMMolecule > ); - PerturbableOpenMMMolecule_exposer.def( "__repr__", &__str__< ::SireOpenMM::PerturbableOpenMMMolecule > ); - } + typedef char const *(::SireOpenMM::PerturbableOpenMMMolecule::*what_function_type)() const; + what_function_type what_function_value(&::SireOpenMM::PerturbableOpenMMMolecule::what); + + PerturbableOpenMMMolecule_exposer.def( + "what", what_function_value, bp::release_gil_policy(), ""); + } + PerturbableOpenMMMolecule_exposer.staticmethod("typeName"); + PerturbableOpenMMMolecule_exposer.def("__copy__", &__copy__); + PerturbableOpenMMMolecule_exposer.def("__deepcopy__", &__copy__); + PerturbableOpenMMMolecule_exposer.def("clone", &__copy__); + PerturbableOpenMMMolecule_exposer.def("__str__", &__str__<::SireOpenMM::PerturbableOpenMMMolecule>); + PerturbableOpenMMMolecule_exposer.def("__repr__", &__str__<::SireOpenMM::PerturbableOpenMMMolecule>); + } } diff --git a/wrapper/Convert/SireOpenMM/PyQMEngine.pypp.cpp b/wrapper/Convert/SireOpenMM/PyQMEngine.pypp.cpp index 37308fa66..50a6dfd06 100644 --- a/wrapper/Convert/SireOpenMM/PyQMEngine.pypp.cpp +++ b/wrapper/Convert/SireOpenMM/PyQMEngine.pypp.cpp @@ -61,7 +61,7 @@ void register_PyQMEngine_class() { { //::SireOpenMM::PyQMEngine - typedef bp::class_> PyQMEngine_exposer_t; + typedef bp::class_> PyQMEngine_exposer_t; PyQMEngine_exposer_t PyQMEngine_exposer = PyQMEngine_exposer_t("PyQMEngine", "", bp::init<>("Default constructor.")); bp::scope PyQMEngine_scope(PyQMEngine_exposer); PyQMEngine_exposer.def(bp::init>((bp::arg("arg0"), bp::arg("method") = "", bp::arg("cutoff") = 7.5 * SireUnits::angstrom, bp::arg("neighbour_list_frequency") = (int)(0), bp::arg("is_mechanical") = (bool)(false), bp::arg("lambda") = 1.), "Constructor\nPar:am py_object\nA Python object.\n\nPar:am name\nThe name of the callback method. If empty, then the object is\nassumed to be a callable.\n\nPar:am cutoff\nThe ML cutoff distance.\n\nPar:am neighbour_list_frequency\nThe frequency at which the neighbour list is updated. (Number of steps.)\nIf zero, then no neighbour list is used.\n\nPar:am is_mechanical\nA flag to indicate if mechanical embedding is being used.\n\nPar:am lambda\nThe lambda weighting factor. This can be used to interpolate between\npotentials for end-state correction calculations.\n")); diff --git a/wrapper/Convert/SireOpenMM/QMEngine.pypp.cpp b/wrapper/Convert/SireOpenMM/QMEngine.pypp.cpp index d1656fbb5..8a52ceaa3 100644 --- a/wrapper/Convert/SireOpenMM/QMEngine.pypp.cpp +++ b/wrapper/Convert/SireOpenMM/QMEngine.pypp.cpp @@ -2,8 +2,8 @@ // (C) Christopher Woods, GPL >= 3 License -#include "boost/python.hpp" #include "QMEngine.pypp.hpp" +#include "boost/python.hpp" namespace bp = boost::python; @@ -19,40 +19,32 @@ namespace bp = boost::python; #include "Helpers/release_gil_policy.hpp" -void register_QMEngine_class(){ +void register_QMEngine_class() +{ { //::SireOpenMM::QMEngine - typedef bp::class_< SireOpenMM::QMEngine, boost::noncopyable > QMEngine_exposer_t; - QMEngine_exposer_t QMEngine_exposer = QMEngine_exposer_t( "QMEngine", "", bp::no_init ); - bp::scope QMEngine_scope( QMEngine_exposer ); + typedef bp::class_, boost::noncopyable> QMEngine_exposer_t; + QMEngine_exposer_t QMEngine_exposer = QMEngine_exposer_t("QMEngine", "", bp::no_init); + bp::scope QMEngine_scope(QMEngine_exposer); { //::SireOpenMM::QMEngine::null - - typedef ::SireOpenMM::NullQMEngine const & ( *null_function_type )( ); - null_function_type null_function_value( &::SireOpenMM::QMEngine::null ); - - QMEngine_exposer.def( - "null" - , null_function_value - , bp::return_value_policy< bp::copy_const_reference >() - , "Get a null QM engine." ); - + + typedef ::SireOpenMM::NullQMEngine const &(*null_function_type)(); + null_function_type null_function_value(&::SireOpenMM::QMEngine::null); + + QMEngine_exposer.def( + "null", null_function_value, bp::return_value_policy(), "Get a null QM engine."); } { //::SireOpenMM::QMEngine::typeName - - typedef char const * ( *typeName_function_type )( ); - typeName_function_type typeName_function_value( &::SireOpenMM::QMEngine::typeName ); - - QMEngine_exposer.def( - "typeName" - , typeName_function_value - , bp::release_gil_policy() - , "" ); - + + typedef char const *(*typeName_function_type)(); + typeName_function_type typeName_function_value(&::SireOpenMM::QMEngine::typeName); + + QMEngine_exposer.def( + "typeName", typeName_function_value, bp::release_gil_policy(), ""); } - QMEngine_exposer.staticmethod( "null" ); - QMEngine_exposer.staticmethod( "typeName" ); - QMEngine_exposer.def( "__str__", &__str__< ::SireOpenMM::QMEngine > ); - QMEngine_exposer.def( "__repr__", &__str__< ::SireOpenMM::QMEngine > ); + QMEngine_exposer.staticmethod("null"); + QMEngine_exposer.staticmethod("typeName"); + QMEngine_exposer.def("__str__", &__str__<::SireOpenMM::QMEngine>); + QMEngine_exposer.def("__repr__", &__str__<::SireOpenMM::QMEngine>); } - } diff --git a/wrapper/Convert/SireOpenMM/TorchQMEngine.pypp.cpp b/wrapper/Convert/SireOpenMM/TorchQMEngine.pypp.cpp index b40473582..90c14079f 100644 --- a/wrapper/Convert/SireOpenMM/TorchQMEngine.pypp.cpp +++ b/wrapper/Convert/SireOpenMM/TorchQMEngine.pypp.cpp @@ -49,7 +49,7 @@ void register_TorchQMEngine_class() { { //::SireOpenMM::TorchQMEngine - typedef bp::class_> TorchQMEngine_exposer_t; + typedef bp::class_> TorchQMEngine_exposer_t; TorchQMEngine_exposer_t TorchQMEngine_exposer = TorchQMEngine_exposer_t("TorchQMEngine", "", bp::init<>("Default constructor.")); bp::scope TorchQMEngine_scope(TorchQMEngine_exposer); TorchQMEngine_exposer.def(bp::init>((bp::arg("arg0"), bp::arg("cutoff") = 7.5 * SireUnits::angstrom, bp::arg("neighbour_list_frequency") = (int)(0), bp::arg("is_mechanical") = (bool)(false), bp::arg("lambda") = 1.), "Constructor\nPar:am module_path\nThe path to the serialised TorchScript module.\n\nPar:am cutoff\nThe ML cutoff distance.\n\nPar:am neighbour_list_frequency\nThe frequency at which the neighbour list is updated. (Number of steps.)\nIf zero, then no neighbour list is used.\n\nPar:am is_mechanical\nA flag to indicate if mechanical embedding is being used.\n\nPar:am lambda\nThe lambda weighting factor. This can be used to interpolate between\npotentials for end-state correction calculations.\n")); diff --git a/wrapper/Convert/SireOpenMM/scanheaders.py b/wrapper/Convert/SireOpenMM/scanheaders.py index 6dbb008b2..c48a896ac 100644 --- a/wrapper/Convert/SireOpenMM/scanheaders.py +++ b/wrapper/Convert/SireOpenMM/scanheaders.py @@ -6,11 +6,8 @@ # be exposed in Python # -import sys -import os import re import pickle -import string from glob import glob @@ -202,15 +199,15 @@ def add_doc(function, docs, db): i += 1 - if not cls in db: + if cls not in db: db[cls] = {} - if not nam in db[cls]: + if nam not in db[cls]: db[cls][nam] = {} nargs = len(args) - if not nargs in db[cls][nam]: + if nargs not in db[cls][nam]: db[cls][nam][nargs] = [] db[cls][nam][nargs].append((args, docs)) @@ -487,12 +484,34 @@ def scanFiles( return exposed_classes +def scanCorelibClasses(root): + """Return the classes exposed by the corelib, so that create_wrappers.py + keeps them as bases (e.g. SireBase::Property)""" + + classes = [] + + for header in glob("%s/*/*.h" % root) + glob("%s/*/*.hpp" % root): + text = open(header, "r").read() + + for m in re.finditer(match_class, text): + classes.append(m.groups()[0].strip()) + + for m in re.finditer(match_alias, text): + classes.append(m.groups()[0].strip()) + + return classes + + if __name__ == "__main__": siredir = "." outdir = "." + corelib = "../../../corelib/src/libs" exposed_classes = {} + for clas in scanCorelibClasses(corelib): + exposed_classes[clas] = 1 + atom_properties = Properties() cg_properties = Properties() res_properties = Properties() @@ -504,7 +523,7 @@ def scanFiles( print("Module SireOpenMM", file=FILE) print("Source SireOpenMM", file=FILE) - print("Root ../../../corelib/src/libs", file=FILE) + print("Root %s" % corelib, file=FILE) FILE.close() diff --git a/wrapper/Convert/__init__.py b/wrapper/Convert/__init__.py index ae90aa618..f573ad24e 100644 --- a/wrapper/Convert/__init__.py +++ b/wrapper/Convert/__init__.py @@ -24,6 +24,8 @@ "TorchQMEngine", ] +import warnings as _warnings + try: from ._SireRDKit import ( sire_to_rdkit, @@ -138,8 +140,7 @@ def openmm_to_sire(mols, map): if type(mols) is not openmm.Context: raise TypeError( - "You can only convert an openmm.Context to sire, not " - f"a {type(mols)}." + f"You can only convert an openmm.Context to sire, not a {type(mols)}." ) # Need to be sure that 'mols' is an openmm.System or else @@ -148,8 +149,7 @@ def openmm_to_sire(mols, map): if type(system) is not openmm.System: raise TypeError( - "You can only convert an openmm.System to sire, not " - f"a {type(system)}" + f"You can only convert an openmm.System to sire, not a {type(system)}" ) sire_mols = _openmm_system_to_sire(system, map) @@ -181,8 +181,7 @@ def sire_to_openmm(mols, map): if not timestep.has_same_units(femtosecond): raise TypeError( - "The timestep should be in units of time. You cannot use " - f"'{timestep}'" + f"The timestep should be in units of time. You cannot use '{timestep}'" ) timestep_in_fs = timestep.to(femtosecond) @@ -242,7 +241,7 @@ def sire_to_openmm(mols, map): if integrator == "verlet" or integrator == "leapfrog": if not ensemble.is_nve(): raise ValueError( - "You cannot use a verlet integrator with the " f"{ensemble}" + f"You cannot use a verlet integrator with the {ensemble}" ) integrator = openmm.VerletIntegrator(timestep) @@ -565,6 +564,8 @@ def minimise_openmm_context( except Exception as e: _openmm_import_exception = e + _warnings.warn(f"Unable to load the Sire OpenMM plugin: {e}") + # OpenMM support is not available def _no_openmm(): print(_openmm_import_exception)