Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
chryswoods committed Jan 2, 2024
2 parents 5e3937a + 64edfe8 commit 1e1b416
Show file tree
Hide file tree
Showing 37 changed files with 466 additions and 327 deletions.
26 changes: 13 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ Installation
The easiest way to install Sire is using our `conda channel <https://anaconda.org/openbiosim/repo>`__.
Sire is built using dependencies from `conda-forge <https://conda-forge.org/>`__,
so please ensure that the channel takes strict priority. We recommend using
`mambaforge <https://github.com/conda-forge/miniforge#mambaforge>`__.
`miniforge3 <https://github.com/conda-forge/miniforge#miniforge3>`__.

To create a new environment:

.. code-block:: bash
mamba create -n openbiosim "python<3.11"
mamba activate openbiosim
mamba install -c conda-forge -c openbiosim sire
conda create -n openbiosim "python<3.12"
conda activate openbiosim
conda install -c conda-forge -c openbiosim sire
To install the latest development version you can use:

.. code-block:: bash
mamba create -n openbiosim-dev "python<3.11"
mamba activate openbiosim-dev
mamba install -c conda-forge -c openbiosim/label/dev sire
conda create -n openbiosim-dev "python<3.12"
conda activate openbiosim-dev
conda install -c conda-forge -c openbiosim/label/dev sire
However, as you are here, it is likely you want to download the latest,
greatest version of the code, which you will need to compile. To compile
Expand All @@ -65,32 +65,32 @@ First, you need to create and activate a conda environment, e.g.

.. code-block:: bash
mamba create -n openbiosim-dev "python<3.11"
mamba activate openbiosim-dev
conda create -n openbiosim-dev "python<3.12"
conda activate openbiosim-dev
Next, you need to install the Sire build dependencies.

.. code-block:: bash
mamba install cmake pip-requirements-parser
conda install cmake pip-requirements-parser
You will also need to install compilers, e.g. on Linux use

.. code-block:: bash
mamba install gcc gxx
conda install gcc gxx
on MacOS use

.. code-block:: bash
mamba install clang clangxx
conda install clang clangxx
and on Windows use

.. code-block:: bash
mamba install conda-build
conda install conda-build
Next, you can clone the sire source code and compile and install sire::

Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

As we have limited resource, we only support the latest major release
of sire with security updates. For example, if the current version
is 2023.1.0, then only versions 2023.1.0 to 2023.1.X wil have updates,
which will be released as 2023.1.X+1.
is 2023.5.0, then only versions 2023.5.0 to 2023.5.X wil have updates,
which will be released as 2023.5.X+1.

| Version | Supported |
| ------- | ------------------ |
| 2023.1.x | :white_check_mark: |
| < 2023.1.x| :x: |
| 2023.5.x | :white_check_mark: |
| < 2023.5.x| :x: |

## Reporting a Vulnerability

Expand Down
96 changes: 74 additions & 22 deletions corelib/src/libs/SireCAS/lambdaschedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ QDataStream &operator<<(QDataStream &ds, const LambdaSchedule &schedule)
return ds;
}

Symbol LambdaSchedule::lambda_symbol("λ");
Symbol LambdaSchedule::initial_symbol("initial");
Symbol LambdaSchedule::final_symbol("final");

Expression LambdaSchedule::default_morph_equation = (1.0 - LambdaSchedule::lam()) * LambdaSchedule::initial() +
LambdaSchedule::lam() * LambdaSchedule::final();

QDataStream &operator>>(QDataStream &ds, LambdaSchedule &schedule)
{
VersionID v = readHeader(ds, r_schedule);
Expand All @@ -68,6 +75,21 @@ QDataStream &operator>>(QDataStream &ds, LambdaSchedule &schedule)
schedule.lever_names >> schedule.stage_names >>
schedule.default_equations >> schedule.stage_equations >>
static_cast<Property &>(schedule);

for (auto &expression : schedule.default_equations)
{
if (expression == LambdaSchedule::default_morph_equation)
expression = LambdaSchedule::default_morph_equation;
}

for (auto &stage_equations : schedule.stage_equations)
{
for (auto &expression : stage_equations)
{
if (expression == LambdaSchedule::default_morph_equation)
expression = LambdaSchedule::default_morph_equation;
}
}
}
else
throw version_error(v, "1", r_schedule, CODELOC);
Expand Down Expand Up @@ -203,10 +225,6 @@ LambdaSchedule LambdaSchedule::charge_scaled_morph(double scale)
return l;
}

Symbol LambdaSchedule::lambda_symbol("λ");
Symbol LambdaSchedule::initial_symbol("initial");
Symbol LambdaSchedule::final_symbol("final");

/** Return the symbol used to represent the :lambda: coordinate.
* This symbol is used to represent the per-stage :lambda:
* variable that goes from 0.0-1.0 within that stage.
Expand Down Expand Up @@ -438,8 +456,7 @@ void LambdaSchedule::clear()
*/
void LambdaSchedule::addMorphStage(const QString &name)
{
this->addStage(name, (this->lam() * this->final()) +
((1 - this->lam()) * this->initial()));
this->addStage(name, default_morph_equation);
}

/** Append a morph stage onto this schedule. The morph stage is a
Expand Down Expand Up @@ -501,9 +518,14 @@ void LambdaSchedule::addChargeScaleStages(double scale)
void LambdaSchedule::prependStage(const QString &name,
const SireCAS::Expression &equation)
{
auto e = equation;

if (e == default_morph_equation)
e = default_morph_equation;

if (this->nStages() == 0)
{
this->appendStage(name, equation);
this->appendStage(name, e);
return;
}

Expand All @@ -514,7 +536,7 @@ void LambdaSchedule::prependStage(const QString &name,
CODELOC);

this->stage_names.prepend(name);
this->default_equations.prepend(equation);
this->default_equations.prepend(e);
this->stage_equations.prepend(QHash<QString, Expression>());
}

Expand All @@ -532,8 +554,13 @@ void LambdaSchedule::appendStage(const QString &name,
.arg(name),
CODELOC);

auto e = equation;

if (e == default_morph_equation)
e = default_morph_equation;

this->stage_names.append(name);
this->default_equations.append(equation);
this->default_equations.append(e);
this->stage_equations.append(QHash<QString, Expression>());
}

Expand All @@ -546,14 +573,19 @@ void LambdaSchedule::insertStage(int i,
const QString &name,
const SireCAS::Expression &equation)
{
auto e = equation;

if (e == default_morph_equation)
e = default_morph_equation;

if (i == 0)
{
this->prependStage(name, equation);
this->prependStage(name, e);
return;
}
else if (i >= this->nStages())
{
this->appendStage(name, equation);
this->appendStage(name, e);
return;
}

Expand All @@ -564,7 +596,7 @@ void LambdaSchedule::insertStage(int i,
CODELOC);

this->stage_names.insert(i, name);
this->default_equations.insert(i, equation);
this->default_equations.insert(i, e);
this->stage_equations.insert(i, QHash<QString, Expression>());
}

Expand Down Expand Up @@ -605,7 +637,12 @@ int LambdaSchedule::find_stage(const QString &stage) const
void LambdaSchedule::setDefaultEquation(const QString &stage,
const Expression &equation)
{
this->default_equations[this->find_stage(stage)] = equation;
auto e = equation;

if (e == default_morph_equation)
e = default_morph_equation;

this->default_equations[this->find_stage(stage)] = e;
}

/** Set the custom equation used to control the specified
Expand All @@ -617,12 +654,17 @@ void LambdaSchedule::setEquation(const QString &stage,
const QString &lever,
const Expression &equation)
{
auto e = equation;

if (e == default_morph_equation)
e = default_morph_equation;

auto &lever_expressions = this->stage_equations[this->find_stage(stage)];

if (not this->lever_names.contains(lever))
this->addLever(lever);

lever_expressions[lever] = equation;
lever_expressions[lever] = e;
}

/** Remove the custom equation for the specified `lever` at the
Expand Down Expand Up @@ -875,21 +917,31 @@ QVector<double> LambdaSchedule::morph(const QString &lever_name,
const auto equation = this->stage_equations[stage].value(
lever_name, this->default_equations[stage]);

Values input_values = this->constant_values;
input_values.set(this->lam(), std::get<1>(resolved));

QVector<double> morphed(nparams);

auto morphed_data = morphed.data();
const auto initial_data = initial.constData();
const auto final_data = final.constData();

for (int i = 0; i < nparams; ++i)
if (equation == default_morph_equation)
{
input_values.set(this->initial(), initial_data[i]);
input_values.set(this->final(), final_data[i]);
for (int i = 0; i < nparams; ++i)
{
morphed_data[i] = (1.0 - lambda_value) * initial_data[i] +
lambda_value * final_data[i];
}
}
else
{
Values input_values = this->constant_values;
input_values.set(this->lam(), std::get<1>(resolved));

for (int i = 0; i < nparams; ++i)
{
input_values.set(this->initial(), initial_data[i]);
input_values.set(this->final(), final_data[i]);

morphed_data[i] = equation(input_values);
morphed_data[i] = equation(input_values);
}
}

return morphed;
Expand Down
3 changes: 3 additions & 0 deletions corelib/src/libs/SireCAS/lambdaschedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ namespace SireCAS

/** The symbol used to represent the final value */
static SireCAS::Symbol final_symbol;

/** The default morph equation */
static SireCAS::Expression default_morph_equation;
};

}
Expand Down
6 changes: 3 additions & 3 deletions corelib/src/libs/SireIO/pdbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ PDBx::PDBx(const SireSystem::System &system, const PropertyMap &map) : ConcreteP
throw SireError::unsupported(
"No PDBx writer function has been registered. You need to "
"install a library to write PDBx/mmCIF files, e.g. gemmi. "
"Do this by running 'mamba install -c conda-forge gemmi' "
"Do this by running 'conda install -c conda-forge gemmi' "
"and then re-running this script.",
CODELOC);

Expand Down Expand Up @@ -274,7 +274,7 @@ QVector<QString> PDBx::toLines() const
throw SireError::unsupported(
"No PDBx writer function has been registered. You need to "
"install a library to write PDBx/mmCIF files, e.g. gemmi. "
"Do this by running 'mamba install -c conda-forge gemmi' "
"Do this by running 'conda install -c conda-forge gemmi' "
"and then re-running this script.",
CODELOC);

Expand Down Expand Up @@ -321,7 +321,7 @@ void PDBx::parseLines(const PropertyMap &map)
throw SireError::unsupported(
"No PDBx reader function has been registered. You need to "
"install a library to read PDBx/mmCIF files, e.g. gemmi. "
"Do this by running 'mamba install -c conda-forge gemmi' "
"Do this by running 'conda install -c conda-forge gemmi' "
"and then re-running this script.",
CODELOC);

Expand Down
4 changes: 2 additions & 2 deletions doc/source/acknowledgements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ does not affect :mod:`sire`. CMake is excellent. You can read more about it
Anaconda
---------

:mod:`sire` uses Anaconda Python (specifically mambaforge and conda-forge) to
:mod:`sire` uses Anaconda Python (specifically miniforge and conda-forge) to
simplify the management and installation of Python and the various
modules on which :mod:`sire` depends.

Anaconda (and miniconda) are distributed as
Anaconda (and miniforge) are distributed as
`open source projects <https://www.continuum.io/open-source-core-modern-software>`__.
As :mod:`sire` does not explicitly link with them, the license is not an issue.
You can find out more about Anaconda `from here <https://www.continuum.io/>`__.
Expand Down
20 changes: 17 additions & 3 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ Development was migrated into the
`OpenBioSim <https://github.com/openbiosim>`__
organisation on `GitHub <https://github.com/openbiosim/sire>`__.

`2023.5.1 <https://github.com/openbiosim/sire/compare/2023.5.0...2023.5.1>`__ - January 2024
--------------------------------------------------------------------------------------------

* Added a ``.dynamics().step(num_steps)`` function to make it easier to quickly run
steps of OpenMM dynamics with minimal overhead (this directly called ``Integrator.step()``)

* Some optimisations to the OpenMM layer that make full use of the
experimental "updateSomeParametersInContext" functions.

* Updated gemmi to 0.6.4, so that it can be default-enabled on all supported platforms.
As part of this, had to change the version of the compilers used on Windows and Linux
to make the conda packages. Windows now uses Visual Studio 2022 instead of 2017,
and Linux now uses GCC 12.3.0 instead of GCC 13.

`2023.5.0 <https://github.com/openbiosim/sire/compare/2023.4.2...2023.5.0>`__ - December 2023
---------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -918,14 +932,14 @@ Here is the changelog for this stage of development.
only pythonize the C++ layer, and avoid the circular dependencies
that were causing random import errors (particularly on Windows).

[2023.0.2] December 2023: Fix multiple distance restraint bug in SOMD
[2023.0.2] December 2022: Fix multiple distance restraint bug in SOMD
(@fjclark). Add support for PME FEP with SOMD and fix
associated bugs (@halx, @jmichel80). Fix CI issues so that
PRs use the correct URL when triggered by external forks.
Exclude dummy atoms when repartitioning hydrogen masses.
Deprecate py37.

[2023.0.1] November 2023: Improve handling of HETATM and TER records in
[2023.0.1] November 2022: Improve handling of HETATM and TER records in
PDB files. Fix SOMD selection issues following update to the
2023 API. Fix writing of steps to SOMD simfile.dat (@fjclark).
Throw exception when CHAMBER format AMBER topology files are
Expand All @@ -940,7 +954,7 @@ Here is the changelog for this stage of development.
order. Ensure Sire is built against packages with the "dev"
label.

[2023.0.0] July 2023 - Updated Sire's API to a more pythonic style.
[2023.0.0] July 2022 - Updated Sire's API to a more pythonic style.
Module names are in lower case, e.g. `import Sire` becomes
`import sire`, or `import sire as sr`. Functions are in
underscore_case. This change is not backwards compatible. To
Expand Down
Loading

0 comments on commit 1e1b416

Please sign in to comment.