From 44ce0e7cee9d2ed3d8a296fbfe13ae76f5f8df6d Mon Sep 17 00:00:00 2001 From: Christopher Woods Date: Sun, 2 Jun 2024 18:32:11 +0100 Subject: [PATCH 1/6] Added code that excludes the to_ghost / from_ghost non-bonded interactions. --- doc/source/changelog.rst | 7 ++ wrapper/Convert/SireOpenMM/openmmmolecule.cpp | 33 +++++-- wrapper/Convert/SireOpenMM/openmmmolecule.h | 3 + .../SireOpenMM/sire_to_openmm_system.cpp | 99 +++++++++++++++++-- 4 files changed, 126 insertions(+), 16 deletions(-) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 610a343d8..e420840de 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -16,6 +16,7 @@ organisation on `GitHub `__. ----------------------------------------------------------------------------------------- * Correctly set the ``element1`` property in ``sire.morph.create_from_pertfile``. + * Added mising :meth:`~sire.vol.TriclinicBox.maximum_cutoff` method so that the cutoff is set correctly when creating a :obj:`~sire.system.ForceFieldInfo` object. @@ -42,6 +43,12 @@ organisation on `GitHub `__. standard trajectory save functions, e.g. ``sire.save(mols.trajectory(), "output", format=["PRMTOP", "RST"])``. +* Added code that automatically excludes non-bonded interactions between + from_ghost and to_ghost atoms in the OpenMM layer. This is to prevent + crashes caused by poor interactions between from_ghost atoms appearing + over the top of to_ghost atoms during a perturbation where one group + is grown over another. + * Ignore BioSimSpace format position restraint include directives when parsing GROMACS topology files. diff --git a/wrapper/Convert/SireOpenMM/openmmmolecule.cpp b/wrapper/Convert/SireOpenMM/openmmmolecule.cpp index ceedf8e6f..36e16e3da 100644 --- a/wrapper/Convert/SireOpenMM/openmmmolecule.cpp +++ b/wrapper/Convert/SireOpenMM/openmmmolecule.cpp @@ -1193,15 +1193,22 @@ void OpenMMMolecule::alignInternals(const PropertyMap &map) { if (is_ghost(clj0)) { - from_ghost_idxs.insert(i); + // ghost atoms are only ghosts is they are real in at + // least one end state (cannot be both a to_ghost and + // a from_ghost atom - this is also implicitly tested + // for above in the clj0 != clj1) + if (not is_ghost(clj1)) + { + from_ghost_idxs.insert(i); - // alpha is 1 for the reference state for ghost atoms - // (and will be 0 for the perturbed state) - this->alphas[i] = 1.0; + // alpha is 1 for the reference state for ghost atoms + // (and will be 0 for the perturbed state) + this->alphas[i] = 1.0; - // kappa is 1 for both end states for ghost atoms - this->kappas[i] = 1.0; - this->perturbed->kappas[i] = 1.0; + // kappa is 1 for both end states for ghost atoms + this->kappas[i] = 1.0; + this->perturbed->kappas[i] = 1.0; + } } else if (is_ghost(clj1)) { @@ -1795,6 +1802,18 @@ void OpenMMMolecule::copyInCoordsAndVelocities(OpenMM::Vec3 *c, OpenMM::Vec3 *v) } } +/** Return the number of atoms in this molecule */ +int OpenMMMolecule::nAtoms() const +{ + return this->coords.count(); +} + +/** Return the number of ghost atoms (sum of to_ghosts and from_ghosts) */ +int OpenMMMolecule::nGhostAtoms() const +{ + return from_ghost_idxs.count() + to_ghost_idxs.count(); +} + /** Return the alpha parameters of all atoms in atom order for * this molecule */ diff --git a/wrapper/Convert/SireOpenMM/openmmmolecule.h b/wrapper/Convert/SireOpenMM/openmmmolecule.h index 39dd5e905..f21c44746 100644 --- a/wrapper/Convert/SireOpenMM/openmmmolecule.h +++ b/wrapper/Convert/SireOpenMM/openmmmolecule.h @@ -79,6 +79,9 @@ namespace SireOpenMM bool isGhostAtom(int atom) const; + int nAtoms() const; + int nGhostAtoms() const; + boost::tuple getException(int atom0, int atom1, int start_index, diff --git a/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp b/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp index e3a0c59ff..03e2ad242 100644 --- a/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp +++ b/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp @@ -547,6 +547,31 @@ _set_box_vectors(OpenMM::System &system, return boxvecs; } +class IndexPair +{ +public: + IndexPair(int atom0 = 0, int atom1 = 0) : _atom0(atom0), _atom1(atom1) + { + if (atom1 < atom0) + { + std::swap(_atom0, _atom1); + } + } + + bool operator==(const IndexPair &other) const + { + return _atom0 == other._atom0 and _atom1 == other._atom1; + } + + int _atom0; + int _atom1; +}; + +uint qHash(const IndexPair &pair) +{ + return qHash(pair._atom0) ^ qHash(pair._atom1); +} + /** This is the (monster) function that converts a passed set of Sire @@ -1082,13 +1107,32 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, std::vector custom_params = {0.0, 0.0, 0.0, 0.0, 0.0}; // the sets of particle indexes for the ghost atoms and non-ghost atoms - std::set ghost_atoms; - std::set non_ghost_atoms; + QVector ghost_atoms; + QVector non_ghost_atoms; + + // count the number of atoms and ghost atoms + int n_atoms = 0; + int n_ghost_atoms = 0; + + for (int i = 0; i < nmols; ++i) + { + const auto &mol = openmm_mols_data[i]; + n_atoms += mol.nAtoms(); + n_ghost_atoms += mol.nGhostAtoms(); + } + + // there's probably lots of optimisations we can make if the + // number of ghost atoms is zero... + ghost_atoms.reserve(n_ghost_atoms); + non_ghost_atoms.reserve(n_atoms - n_ghost_atoms); // the set of all ghost atoms, with the value // indicating if this is a from-ghost (true) or // a to-ghost (false) - QHash ghost_is_from; + QVector from_ghost_idxs; + QVector to_ghost_idxs; + from_ghost_idxs.reserve(n_ghost_atoms); + to_ghost_idxs.reserve(n_ghost_atoms); // loop over every molecule and add them one by one for (int i = 0; i < nmols; ++i) @@ -1218,8 +1262,16 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, // this is a ghost atom! We need to record this // fact and make sure that we don't calculate // the LJ energy using the standard cljff - ghost_atoms.insert(atom_index); - ghost_is_from.insert(atom_index, is_from_ghost); + ghost_atoms.append(atom_index); + + if (is_from_ghost) + { + from_ghost_idxs.append(atom_index); + } + else + { + to_ghost_idxs.append(atom_index); + } // don't include the LJ energy as this will be // calculated using the ghost forcefields @@ -1233,7 +1285,7 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, // just add it to the standard cljff as normal cljff->addParticle(charge, boost::get<1>(clj), boost::get<2>(clj)); - non_ghost_atoms.insert(atom_index); + non_ghost_atoms.append(atom_index); } } } @@ -1279,7 +1331,7 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, custom_params[4] = 0.0; ghost_ghostff->addParticle(custom_params); ghost_nonghostff->addParticle(custom_params); - non_ghost_atoms.insert(atom_index); + non_ghost_atoms.append(atom_index); } } } @@ -1340,8 +1392,10 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, { // set up the interaction groups - ghost / non-ghost // ghost / ghost - ghost_ghostff->addInteractionGroup(ghost_atoms, ghost_atoms); - ghost_nonghostff->addInteractionGroup(ghost_atoms, non_ghost_atoms); + std::set ghost_atoms_set(ghost_atoms.begin(), ghost_atoms.end()); + std::set non_ghost_atoms_set(non_ghost_atoms.begin(), non_ghost_atoms.end()); + ghost_ghostff->addInteractionGroup(ghost_atoms_set, ghost_atoms_set); + ghost_nonghostff->addInteractionGroup(ghost_atoms_set, non_ghost_atoms_set); } // see if we want to remove COM motion @@ -1373,6 +1427,11 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, /// /// We will also add all of the perturbable constraints here /// + /// (we need to remember which ghost-ghost interactions we have + /// excluded, so that we don't double-exclude them later) + QSet excluded_ghost_pairs; + excluded_ghost_pairs.reserve((n_ghost_atoms * n_ghost_atoms) / 2); + for (int i = 0; i < nmols; ++i) { int start_index = start_indexes[i]; @@ -1468,6 +1527,12 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, params14); } } + + if (atom0_is_ghost and atom1_is_ghost) + { + // remember that this ghost-ghost interaction is already excluded + excluded_ghost_pairs.insert(IndexPair(boost::get<0>(p), boost::get<1>(p))); + } } else { @@ -1507,6 +1572,22 @@ OpenMMMetaData SireOpenMM::sire_to_openmm_system(OpenMM::System &system, } } + // go through all of the ghost atoms and exclude interactions + // between from_ghosts and to_ghosts + for (const auto &from_ghost_idx : from_ghost_idxs) + { + for (const auto &to_ghost_idx : to_ghost_idxs) + { + if (not excluded_ghost_pairs.contains(IndexPair(from_ghost_idx, to_ghost_idx))) + { + ghost_ghostff->addExclusion(from_ghost_idx, to_ghost_idx); + ghost_nonghostff->addExclusion(from_ghost_idx, to_ghost_idx); + cljff->addException(from_ghost_idx, to_ghost_idx, + 0.0, 1e-9, 1e-9, true); + } + } + } + // Stage 6 is complete. We have set up all of the exceptions. The // total energy / force calculated for the system should now be // correct. From e92b1dd890b47b66c689091eab95904057ae44f2 Mon Sep 17 00:00:00 2001 From: Christopher Woods Date: Sun, 2 Jun 2024 19:24:20 +0100 Subject: [PATCH 2/6] Added paper citation and removed mamba build --- .github/workflows/devel.yaml | 8 +++----- .github/workflows/main.yaml | 8 +++----- .github/workflows/pr.yaml | 8 +++----- README.rst | 28 ++++++++++++++++++++++++++-- doc/source/index.rst | 24 ++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 17 deletions(-) diff --git a/.github/workflows/devel.yaml b/.github/workflows/devel.yaml index e63e5072a..830e22773 100644 --- a/.github/workflows/devel.yaml +++ b/.github/workflows/devel.yaml @@ -50,14 +50,12 @@ jobs: python-version: ${{ matrix.python-version }} activate-environment: sire_build miniforge-version: latest - miniforge-variant: Mambaforge - use-mamba: true # - name: Clone the devel branch (push to devel) run: git clone https://github.com/${{ env.REPO }} sire # - name: Setup Conda - run: mamba install -y -c conda-forge boa anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py @@ -65,8 +63,8 @@ jobs: - name: Prepare build location run: mkdir ${{ github.workspace }}/build # - - name: Build Conda package using mamba build - run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire + - name: Build Conda package using conda build + run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire # - name: Upload Conda package # Maybe add the logic here that this is a dev package? diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 76732f2ec..cff88bd43 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -50,14 +50,12 @@ jobs: python-version: ${{ matrix.python-version }} activate-environment: sire_build miniforge-version: latest - miniforge-variant: Mambaforge - use-mamba: true # - name: Clone the main branch (push to main) run: git clone -b main https://github.com/openbiosim/sire sire # - name: Setup Conda - run: mamba install -y -c conda-forge boa anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py @@ -65,8 +63,8 @@ jobs: - name: Prepare build location run: mkdir ${{ github.workspace }}/build # - - name: Build Conda package using mamba build - run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire + - name: Build Conda package using conda build + run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire # - name: Upload Conda package # upload to the 'test' channel diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e1a45542b..7834f1541 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -52,14 +52,12 @@ jobs: python-version: ${{ matrix.python-version }} activate-environment: sire_build miniforge-version: latest - miniforge-variant: Mambaforge - use-mamba: true # - name: Clone the feature branch (pull request to devel) run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} sire # - name: Setup Conda - run: mamba install -y -c conda-forge boa anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py @@ -67,5 +65,5 @@ jobs: - name: Prepare build location run: mkdir ${{ github.workspace }}/build # - - name: Build Conda package using mamba build - run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire + - name: Build Conda package using conda build + run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire diff --git a/README.rst b/README.rst index 4689732d8..f4c3220dc 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,8 @@ `Sire `__ ====================================== -.. image:: https://github.com/openbiosim/sire/workflows/Build/badge.svg - :target: https://github.com/openbiosim/sire/actions?query=workflow%3ABuild +.. image:: https://github.com/OpenBioSim/sire/actions/workflows/devel.yaml/badge.svg + :target: https://github.com/OpenBioSim/sire/actions/workflows/devel.yaml :alt: Build status .. image:: https://anaconda.org/openbiosim/sire/badges/downloads.svg @@ -14,6 +14,30 @@ :target: https://www.gnu.org/licenses/gpl-3.0.en.html :alt: License +Citation +======== + +If you use sire in your work, please cite the +`following paper `__: + +.. code-block:: bibtex + + @article{10.1063/5.0200458, + author = {Woods, Christopher J. and Hedges, Lester O. and Mulholland, Adrian J. and Malaisree, Maturos and Tosco, Paolo and Loeffler, Hannes H. and Suruzhon, Miroslav and Burman, Matthew and Bariami, Sofia and Bosisio, Stefano and Calabro, Gaetano and Clark, Finlay and Mey, Antonia S. J. S. and Michel, Julien}, + title = "{Sire: An interoperability engine for prototyping algorithms and exchanging information between molecular simulation programs}", + journal = {The Journal of Chemical Physics}, + volume = {160}, + number = {20}, + pages = {202503}, + year = {2024}, + month = {05}, + abstract = "{Sire is a Python/C++ library that is used both to prototype new algorithms and as an interoperability engine for exchanging information between molecular simulation programs. It provides a collection of file parsers and information converters that together make it easier to combine and leverage the functionality of many other programs and libraries. This empowers researchers to use sire to write a single script that can, for example, load a molecule from a PDBx/mmCIF file via Gemmi, perform SMARTS searches via RDKit, parameterize molecules using BioSimSpace, run GPU-accelerated molecular dynamics via OpenMM, and then display the resulting dynamics trajectory in a NGLView Jupyter notebook 3D molecular viewer. This functionality is built on by BioSimSpace, which uses sire’s molecular information engine to interconvert with programs such as GROMACS, NAMD, Amber, and AmberTools for automated molecular parameterization and the running of molecular dynamics, metadynamics, and alchemical free energy workflows. Sire comes complete with a powerful molecular information search engine, plus trajectory loading and editing, analysis, and energy evaluation engines. This, when combined with an in-built computer algebra system, gives substantial flexibility to researchers to load, search for, edit, and combine molecular information from multiple sources and use that to drive novel algorithms by combining functionality from other programs. Sire is open source (GPL3) and is available via conda and at a free Jupyter notebook server at https://try.openbiosim.org. Sire is supported by the not-for-profit OpenBioSim community interest company.}", + issn = {0021-9606}, + doi = {10.1063/5.0200458}, + url = {https://doi.org/10.1063/5.0200458}, + eprint = {https://pubs.aip.org/aip/jcp/article-pdf/doi/10.1063/5.0200458/19969848/202503\_1\_5.0200458.pdf}, + } + About ===== diff --git a/doc/source/index.rst b/doc/source/index.rst index ce6e90c6a..f5577315a 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -9,6 +9,30 @@ It is used as a key component of `BioSimSpace `__, and is distributed and supported as an open source community project by `OpenBioSim `__. +Citation +======== + +If you use sire in your work, please cite the +`following paper `__: + +.. code-block:: bibtex + + @article{10.1063/5.0200458, + author = {Woods, Christopher J. and Hedges, Lester O. and Mulholland, Adrian J. and Malaisree, Maturos and Tosco, Paolo and Loeffler, Hannes H. and Suruzhon, Miroslav and Burman, Matthew and Bariami, Sofia and Bosisio, Stefano and Calabro, Gaetano and Clark, Finlay and Mey, Antonia S. J. S. and Michel, Julien}, + title = "{Sire: An interoperability engine for prototyping algorithms and exchanging information between molecular simulation programs}", + journal = {The Journal of Chemical Physics}, + volume = {160}, + number = {20}, + pages = {202503}, + year = {2024}, + month = {05}, + abstract = "{Sire is a Python/C++ library that is used both to prototype new algorithms and as an interoperability engine for exchanging information between molecular simulation programs. It provides a collection of file parsers and information converters that together make it easier to combine and leverage the functionality of many other programs and libraries. This empowers researchers to use sire to write a single script that can, for example, load a molecule from a PDBx/mmCIF file via Gemmi, perform SMARTS searches via RDKit, parameterize molecules using BioSimSpace, run GPU-accelerated molecular dynamics via OpenMM, and then display the resulting dynamics trajectory in a NGLView Jupyter notebook 3D molecular viewer. This functionality is built on by BioSimSpace, which uses sire’s molecular information engine to interconvert with programs such as GROMACS, NAMD, Amber, and AmberTools for automated molecular parameterization and the running of molecular dynamics, metadynamics, and alchemical free energy workflows. Sire comes complete with a powerful molecular information search engine, plus trajectory loading and editing, analysis, and energy evaluation engines. This, when combined with an in-built computer algebra system, gives substantial flexibility to researchers to load, search for, edit, and combine molecular information from multiple sources and use that to drive novel algorithms by combining functionality from other programs. Sire is open source (GPL3) and is available via conda and at a free Jupyter notebook server at https://try.openbiosim.org. Sire is supported by the not-for-profit OpenBioSim community interest company.}", + issn = {0021-9606}, + doi = {10.1063/5.0200458}, + url = {https://doi.org/10.1063/5.0200458}, + eprint = {https://pubs.aip.org/aip/jcp/article-pdf/doi/10.1063/5.0200458/19969848/202503\_1\_5.0200458.pdf}, + } + Quick Start =========== From f1fa9dc7283c6b43f1f0e0682e7ee47b87c34bd9 Mon Sep 17 00:00:00 2001 From: Christopher Woods Date: Sun, 2 Jun 2024 19:26:32 +0100 Subject: [PATCH 3/6] Removed badges as they don't render well --- README.rst | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/README.rst b/README.rst index f4c3220dc..8d1aa9ce2 100644 --- a/README.rst +++ b/README.rst @@ -2,18 +2,6 @@ `Sire `__ ====================================== -.. image:: https://github.com/OpenBioSim/sire/actions/workflows/devel.yaml/badge.svg - :target: https://github.com/OpenBioSim/sire/actions/workflows/devel.yaml - :alt: Build status - -.. image:: https://anaconda.org/openbiosim/sire/badges/downloads.svg - :target: https://anaconda.org/openbiosim/sire - :alt: Downloads - -.. image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg - :target: https://www.gnu.org/licenses/gpl-3.0.en.html - :alt: License - Citation ======== From 3ddca08ce40de7e3a89d5f5e29bea86e37e21cbe Mon Sep 17 00:00:00 2001 From: Christopher Woods Date: Sun, 2 Jun 2024 19:28:52 +0100 Subject: [PATCH 4/6] Workflow update --- .github/workflows/devel.yaml | 2 +- .github/workflows/main.yaml | 2 +- .github/workflows/pr.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/devel.yaml b/.github/workflows/devel.yaml index 830e22773..7c603c15a 100644 --- a/.github/workflows/devel.yaml +++ b/.github/workflows/devel.yaml @@ -55,7 +55,7 @@ jobs: run: git clone https://github.com/${{ env.REPO }} sire # - name: Setup Conda - run: conda install -y -c conda-forge anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index cff88bd43..ee70f5118 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -55,7 +55,7 @@ jobs: run: git clone -b main https://github.com/openbiosim/sire sire # - name: Setup Conda - run: conda install -y -c conda-forge anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7834f1541..5840e5009 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -57,7 +57,7 @@ jobs: run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} sire # - name: Setup Conda - run: conda install -y -c conda-forge anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py From a662bfb3c55a88e248b5b55674af6dbc8c0399d9 Mon Sep 17 00:00:00 2001 From: Christopher Woods Date: Sun, 2 Jun 2024 19:40:37 +0100 Subject: [PATCH 5/6] Removed mamba from everything --- .github/workflows/choose_branch.yaml | 8 +++----- .github/workflows/devel.yaml | 2 +- .github/workflows/main.yaml | 2 +- .github/workflows/pr.yaml | 2 +- src/sire/utils/_try_import.py | 28 +++++++--------------------- wrapper/__init__.py | 22 ++++------------------ 6 files changed, 17 insertions(+), 47 deletions(-) diff --git a/.github/workflows/choose_branch.yaml b/.github/workflows/choose_branch.yaml index 534742c71..41541f42d 100644 --- a/.github/workflows/choose_branch.yaml +++ b/.github/workflows/choose_branch.yaml @@ -55,14 +55,12 @@ jobs: python-version: ${{ matrix.python-version }} activate-environment: sire_build miniforge-version: latest - miniforge-variant: Mambaforge - use-mamba: true # - name: Clone the desired branch run: git clone https://github.com/${{ env.REPO }} -b ${{ github.event.inputs.branch }} sire # - name: Setup Conda - run: mamba install -y -c conda-forge boa anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build boa anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py @@ -70,8 +68,8 @@ jobs: - name: Prepare build location run: mkdir ${{ github.workspace }}/build # - - name: Build Conda package using mamba build - run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire + - name: Build Conda package using conda build + run: conda build -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/sire/recipes/sire # - name: Upload Conda package # Maybe add the logic here that this is a dev package? diff --git a/.github/workflows/devel.yaml b/.github/workflows/devel.yaml index 7c603c15a..9f623d3e2 100644 --- a/.github/workflows/devel.yaml +++ b/.github/workflows/devel.yaml @@ -55,7 +55,7 @@ jobs: run: git clone https://github.com/${{ env.REPO }} sire # - name: Setup Conda - run: conda install -y -c conda-forge conda-build anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build boa anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ee70f5118..0b2c9ad5e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -55,7 +55,7 @@ jobs: run: git clone -b main https://github.com/openbiosim/sire sire # - name: Setup Conda - run: conda install -y -c conda-forge conda-build anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build boa anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 5840e5009..a49c5cc71 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -57,7 +57,7 @@ jobs: run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} sire # - name: Setup Conda - run: conda install -y -c conda-forge conda-build anaconda-client packaging pip-requirements-parser + run: conda install -y -c conda-forge conda-build boa anaconda-client packaging pip-requirements-parser # - name: Update Conda recipe run: python ${{ github.workspace }}/sire/actions/update_recipe.py diff --git a/src/sire/utils/_try_import.py b/src/sire/utils/_try_import.py index 2b7060718..b6a927f92 100644 --- a/src/sire/utils/_try_import.py +++ b/src/sire/utils/_try_import.py @@ -40,15 +40,7 @@ def _find_conda(): ) return None - if conda.endswith(".exe"): - m = os.path.join(os.path.dirname(conda), "mamba.exe") - else: - m = os.path.join(os.path.dirname(conda), "mamba") - - if os.path.exists(m): - return m - else: - return conda + return conda def _install_package(name, package_registry, version=None): @@ -98,10 +90,7 @@ def _install_package(name, package_registry, version=None): except Exception: pass - print( - "\nWARNING: Unable to install '%s' from package '%s'\n" - % (name, package) - ) + print("\nWARNING: Unable to install '%s' from package '%s'\n" % (name, package)) class _ModuleStub: @@ -109,7 +98,7 @@ def __init__(self, name: str, install_command: str = None): self._name = name if install_command is None: - self._install_command = f"mamba install {name}" + self._install_command = f"conda install {name}" else: self._install_command = install_command @@ -135,7 +124,7 @@ def try_import(name, package_registry=_module_to_package, version=None): the package to install using "package_registry" (or if this is not available, using just the name of the module). This will then be installed using - "mamba", then "conda" (first one that works will return). + "conda" (first one that works will return). For example, use this via @@ -176,9 +165,7 @@ def try_import(name, package_registry=_module_to_package, version=None): return _ModuleStub(name) -def try_import_from( - name, fromlist, package_registry=_module_to_package, version=None -): +def try_import_from(name, fromlist, package_registry=_module_to_package, version=None): """Try to import from the module called 'name' the passed symbol (or list of symbols) contained in 'fromlist', returning the symbol (or list of symbols). @@ -224,15 +211,14 @@ def try_import_from( return try_import_from(name, fromlist, package_registry=None) else: m = " ".join(fromlist) - return _ModuleStub(name, f"mamba install {m}") + return _ModuleStub(name, f"conda install {m}") if nsyms == 1: try: return getattr(mod, fromlist[0]) except Exception: raise ImportError( - "Cannot find the symbol '%s' in module '%s'" - % (fromlist[0], name) + "Cannot find the symbol '%s' in module '%s'" % (fromlist[0], name) ) else: ret = [] diff --git a/wrapper/__init__.py b/wrapper/__init__.py index 5124caf4b..6eec87f6d 100644 --- a/wrapper/__init__.py +++ b/wrapper/__init__.py @@ -85,15 +85,7 @@ def _find_conda(): ) return None - if conda.endswith(".exe"): - m = os.path.join(os.path.dirname(conda), "mamba.exe") - else: - m = os.path.join(os.path.dirname(conda), "mamba") - - if os.path.exists(m): - return m - else: - return conda + return conda def _install_package(name, package_registry, version=None): @@ -143,10 +135,7 @@ def _install_package(name, package_registry, version=None): except Exception: pass - print( - "\nWARNING: Unable to install '%s' from package '%s'\n" - % (name, package) - ) + print("\nWARNING: Unable to install '%s' from package '%s'\n" % (name, package)) def try_import(name, package_registry=_module_to_package, version=None): @@ -187,9 +176,7 @@ def try_import(name, package_registry=_module_to_package, version=None): raise ImportError("Failed to install module %s" % name) -def try_import_from( - name, fromlist, package_registry=_module_to_package, version=None -): +def try_import_from(name, fromlist, package_registry=_module_to_package, version=None): """Try to import from the module called 'name' the passed symbol (or list of symbols) contained in 'fromlist', returning the symbol (or list of symbols). @@ -242,8 +229,7 @@ def try_import_from( return getattr(mod, fromlist[0]) except Exception: raise ImportError( - "Cannot find the symbol '%s' in module '%s'" - % (fromlist[0], name) + "Cannot find the symbol '%s' in module '%s'" % (fromlist[0], name) ) else: ret = [] From 082bc1a8937de736035717846098bb177d31560d Mon Sep 17 00:00:00 2001 From: Christopher Woods Date: Sat, 22 Jun 2024 17:30:59 +0100 Subject: [PATCH 6/6] Changed mirror ghost sigma test to <=1e-9, added more detail to the changelog and defined QT_NO_SIGNALS_SLOTS_KEYWORDS at the gccxml level when generating headers. [ci skip] --- doc/source/changelog.rst | 4 ++-- wrapper/AutoGenerate/create_wrappers.py | 2 ++ wrapper/Convert/SireOpenMM/openmmmolecule.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index e420840de..6af579eef 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -52,8 +52,8 @@ organisation on `GitHub `__. * Ignore BioSimSpace format position restraint include directives when parsing GROMACS topology files. -* Add a map option to prevent perturbation of the Lennard-Jones sigma - parameter for ghost atoms during alchemical free energy simulations. +* Added a map option (fix_perturbable_zero_sigmas) to prevent perturbation of + the Lennard-Jones sigma parameter for ghost atoms during alchemical free energy simulations. * Please add an item to this changelog when you create your PR diff --git a/wrapper/AutoGenerate/create_wrappers.py b/wrapper/AutoGenerate/create_wrappers.py index 9f719bfdc..40a27bbe0 100644 --- a/wrapper/AutoGenerate/create_wrappers.py +++ b/wrapper/AutoGenerate/create_wrappers.py @@ -828,6 +828,7 @@ def fixMB(mb): define_symbols=[ "GCCXML_PARSE", "__PIC__", + "QT_NO_SIGNALS_SLOTS_KEYWORDS=1", "SIRE_ALWAYS_INLINE=inline", "SIRE_SKIP_INLINE_FUNCTIONS", "SIREN_SKIP_INLINE_FUNCTIONS", @@ -854,6 +855,7 @@ def fixMB(mb): define_symbols=[ "GCCXML_PARSE", "__PIC__", + "QT_NO_SIGNALS_SLOTS_KEYWORDS=1", "SIRE_USE_OPENMM", "SIRE_ALWAYS_INLINE=inline", "SIRE_SKIP_INLINE_FUNCTIONS", diff --git a/wrapper/Convert/SireOpenMM/openmmmolecule.cpp b/wrapper/Convert/SireOpenMM/openmmmolecule.cpp index 36e16e3da..40979610d 100644 --- a/wrapper/Convert/SireOpenMM/openmmmolecule.cpp +++ b/wrapper/Convert/SireOpenMM/openmmmolecule.cpp @@ -2222,12 +2222,12 @@ PerturbableOpenMMMolecule::PerturbableOpenMMMolecule(const OpenMMMolecule &mol, for (int i = 0; i < nats; ++i) { - if (std::abs(sig0_data[i]) < 1e-9) + if (std::abs(sig0_data[i]) <= 1e-9) { sig0[i] = sig1_data[i]; sig0_data = sig0.constData(); } - else if (std::abs(sig1_data[i] < 1e-9)) + else if (std::abs(sig1_data[i] <= 1e-9)) { sig1[i] = sig0_data[i]; sig1_data = sig1.constData();