Skip to content

Commit 9a2d331

Browse files
authored
Merge pull request #246 from OpenBioSim/release_2024.3.0
Release 2024.3.0
2 parents d93f2c2 + 9ea6ea8 commit 9a2d331

File tree

111 files changed

+11875
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+11875
-194
lines changed

.github/workflows/choose_branch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
env:
4747
SIRE_DONT_PHONEHOME: 1
4848
SIRE_SILENT_PHONEHOME: 1
49+
SIRE_EMLE: 1
4950
REPO: "${{ github.repository }}"
5051
steps:
5152
#

.github/workflows/devel.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
env:
4242
SIRE_DONT_PHONEHOME: 1
4343
SIRE_SILENT_PHONEHOME: 1
44+
SIRE_EMLE: 1
4445
REPO: "${{ github.repository }}"
4546
steps:
4647
#

.github/workflows/main.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
exclude:
3333
- platform:
3434
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
35-
python-version: "3.12" # MacOS can't run 3.12 yet...
35+
python-version: "3.12" # MacOS can't run 3.12 yet...
3636
environment:
3737
name: sire-build
3838
defaults:
@@ -41,6 +41,7 @@ jobs:
4141
env:
4242
SIRE_DONT_PHONEHOME: 1
4343
SIRE_SILENT_PHONEHOME: 1
44+
SIRE_EMLE: 1
4445
REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}"
4546
steps:
4647
#

.github/workflows/pr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
env:
4444
SIRE_DONT_PHONEHOME: 1
4545
SIRE_SILENT_PHONEHOME: 1
46+
SIRE_EMLE: 1
4647
REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}"
4748
steps:
4849
#

actions/update_recipe.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
from parse_requirements import parse_requirements
1111

12+
# Check whether we are building a sire-emle package.
13+
is_emle = os.environ.get("SIRE_EMLE", "False")
14+
1215
# has the user supplied an environment.yml file?
1316
if len(sys.argv) > 1:
1417
from pathlib import Path
@@ -46,6 +49,11 @@
4649
print(run_reqs)
4750
bss_reqs = parse_requirements(os.path.join(srcdir, "requirements_bss.txt"))
4851
print(bss_reqs)
52+
if is_emle:
53+
emle_reqs = parse_requirements(os.path.join(srcdir, "requirements_emle.txt"))
54+
print(emle_reqs)
55+
else:
56+
emle_reqs = []
4957
test_reqs = parse_requirements(os.path.join(srcdir, "requirements_test.txt"))
5058

5159

@@ -222,6 +230,7 @@ def check_reqs(reqs0, reqs1):
222230

223231
build_reqs = dep_lines(check_reqs(build_reqs, env_reqs))
224232
host_reqs = combine(host_reqs, bss_reqs)
233+
host_reqs = combine(host_reqs, emle_reqs)
225234
host_reqs = dep_lines(combine(host_reqs, env_reqs))
226235
run_reqs = dep_lines(check_reqs(run_reqs, env_reqs))
227236
test_reqs = dep_lines(check_reqs(test_reqs, env_reqs))

corelib/src/libs/SireIO/amber.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,7 +2151,7 @@ tuple<MoleculeGroup, SpacePtr> Amber::readCrdTop(const QString &crdfile, const Q
21512151
// Now the box information
21522152
SpacePtr spce;
21532153

2154-
if (pointers[IFBOX] == 1)
2154+
if (pointers[IFBOX] == 1 or pointers[IFBOX] == 2 or pointers[IFBOX] == 3)
21552155
{
21562156
/** Rectangular box, dimensions read from the crd file */
21572157
Vector dimensions(crd_box[0], crd_box[1], crd_box[2]);
@@ -2173,12 +2173,6 @@ tuple<MoleculeGroup, SpacePtr> Amber::readCrdTop(const QString &crdfile, const Q
21732173
// spce = PeriodicBox( Vector ( crdBox[0], crdBox[1], crdBox[2] ) ).asA<Space>() ;
21742174
// qDebug() << " periodic box " << spce.toString() ;
21752175
}
2176-
else if (pointers[IFBOX] == 2)
2177-
{
2178-
/** Truncated Octahedral box*/
2179-
throw SireError::incompatible_error(QObject::tr("Sire does not yet support a truncated octahedral box"),
2180-
CODELOC);
2181-
}
21822176
else
21832177
{
21842178
/** Default is a non periodic system */

corelib/src/libs/SireIO/amberprm.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,16 @@ QStringList toLines(const QVector<AmberParams> &params, const Space &space, int
21812181

21822182
if (has_periodic_box)
21832183
{
2184-
pointers[27] = 1;
2184+
// Orthorhombic box.
2185+
if (space.isA<PeriodicBox>())
2186+
{
2187+
pointers[27] = 1;
2188+
}
2189+
// General triclinic box.
2190+
else if (space.isA<TriclinicBox>())
2191+
{
2192+
pointers[27] = 3;
2193+
}
21852194
}
21862195

21872196
// here is the number of solvent molecules, and the index of the last

corelib/src/libs/SireIO/biosimspace.cpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,68 @@ namespace SireIO
15891589
return retval;
15901590
}
15911591

1592+
Molecule createSodiumIon(const Vector &coords, const QString model, const PropertyMap &map)
1593+
{
1594+
// Strip all whitespace from the model name and convert to upper case.
1595+
auto _model = model.simplified().replace(" ", "").toUpper();
1596+
1597+
// Create a hash between the allowed model names and their templace files.
1598+
QHash<QString, QString> models;
1599+
models["TIP3P"] = getShareDir() + "/templates/ions/na_tip3p";
1600+
models["TIP4P"] = getShareDir() + "/templates/ions/na_tip4p";
1601+
1602+
// Make sure the user has passed a valid water model.
1603+
if (not models.contains(_model))
1604+
{
1605+
throw SireError::incompatible_error(QObject::tr("Unsupported AMBER ion model '%1'").arg(model), CODELOC);
1606+
}
1607+
1608+
// Extract the water model template path.
1609+
auto path = models[_model];
1610+
1611+
// Load the ion template.
1612+
auto ion_template = MoleculeParser::read(path + ".prm7", map);
1613+
1614+
// Extract the ion the template.
1615+
auto ion = ion_template[MolIdx(0)].molecule();
1616+
1617+
// Set the coordinates of the ion.
1618+
ion = ion.edit().atom(AtomIdx(0)).setProperty(map["coordinates"], coords).molecule().commit();
1619+
1620+
return ion;
1621+
}
1622+
1623+
Molecule createChlorineIon(const Vector &coords, const QString model, const PropertyMap &map)
1624+
{
1625+
// Strip all whitespace from the model name and convert to upper case.
1626+
auto _model = model.simplified().replace(" ", "").toUpper();
1627+
1628+
// Create a hash between the allowed model names and their templace files.
1629+
QHash<QString, QString> models;
1630+
models["TIP3P"] = getShareDir() + "/templates/ions/cl_tip3p";
1631+
models["TIP4P"] = getShareDir() + "/templates/ions/cl_tip4p";
1632+
1633+
// Make sure the user has passed a valid water model.
1634+
if (not models.contains(_model))
1635+
{
1636+
throw SireError::incompatible_error(QObject::tr("Unsupported AMBER ion model '%1'").arg(model), CODELOC);
1637+
}
1638+
1639+
// Extract the water model template path.
1640+
auto path = models[_model];
1641+
1642+
// Load the ion template.
1643+
auto ion_template = MoleculeParser::read(path + ".prm7");
1644+
1645+
// Extract the ion the template.
1646+
auto ion = ion_template[MolIdx(0)].molecule();
1647+
1648+
// Set the coordinates of the ion.
1649+
ion = ion.edit().atom(AtomIdx(0)).setProperty(map["coordinates"], coords).molecule().commit();
1650+
1651+
return ion;
1652+
}
1653+
15921654
Vector cross(const Vector &v0, const Vector &v1)
15931655
{
15941656
double nx = v0.y() * v1.z() - v0.z() * v1.y();

corelib/src/libs/SireIO/biosimspace.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,38 @@ namespace SireIO
319319
const QHash<MolIdx, MolIdx> &molecule_mapping, const bool is_lambda1 = false,
320320
const PropertyMap &map0 = PropertyMap(), const PropertyMap &map1 = PropertyMap());
321321

322+
//! Create a sodium ion at the specified position.
323+
/*! \param position
324+
The position of the sodium ion.
325+
326+
\param model
327+
The name of the water model.
328+
329+
\param map
330+
A dictionary of user-defined molecular property names.
331+
332+
\retval sodium
333+
The sodium ion.
334+
*/
335+
SIREIO_EXPORT Molecule createSodiumIon(
336+
const Vector &coords, const QString model, const PropertyMap &map = PropertyMap());
337+
338+
//! Create a chlorine ion at the specified position.
339+
/*! \param position
340+
The position of the chlorine ion.
341+
342+
\param model
343+
The name of the water model.
344+
345+
\param map
346+
A dictionary of user-defined molecular property names.
347+
348+
\retval chlorine
349+
The chlorine ion.
350+
*/
351+
SIREIO_EXPORT Molecule createChlorineIon(
352+
const Vector &coords, const QString model, const PropertyMap &map = PropertyMap());
353+
322354
Vector cross(const Vector &v0, const Vector &v1);
323355
} // namespace SireIO
324356

@@ -332,6 +364,8 @@ SIRE_EXPOSE_FUNCTION(SireIO::setAmberWater)
332364
SIRE_EXPOSE_FUNCTION(SireIO::setGromacsWater)
333365
SIRE_EXPOSE_FUNCTION(SireIO::updateAndPreserveOrder)
334366
SIRE_EXPOSE_FUNCTION(SireIO::updateCoordinatesAndVelocities)
367+
SIRE_EXPOSE_FUNCTION(SireIO::createSodiumIon)
368+
SIRE_EXPOSE_FUNCTION(SireIO::createChlorineIon)
335369

336370
SIRE_END_HEADER
337371

corelib/src/libs/SireIO/grotop.cpp

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,6 +2869,7 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
28692869

28702870
QString particle_type = "A"; // A is for Atom
28712871

2872+
// This is a dummy atom.
28722873
if (elem.nProtons() == 0 and lj.isDummy())
28732874
{
28742875
if (is_perturbable)
@@ -2877,6 +2878,9 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
28772878
// Only label dummies for regular simulations.
28782879
else if (not was_perturbable)
28792880
particle_type = "D";
2881+
2882+
// Flag that we need to update the atoms.
2883+
update_atoms0 = true;
28802884
}
28812885

28822886
// This is a new atom type.
@@ -2893,6 +2897,15 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
28932897

28942898
// Hash the atom type against its parameter string, minus the type.
28952899
param_hash.insert(atomtypes[atomtype].mid(6), atomtype);
2900+
2901+
if (update_atoms0)
2902+
{
2903+
// Set the type.
2904+
atom.setAtomType(atomtype);
2905+
2906+
// Update the atoms in the vector.
2907+
atoms[i] = atom;
2908+
}
28962909
}
28972910
// This type has been seen before.
28982911
else
@@ -2977,6 +2990,17 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
29772990
update_atoms0 = true;
29782991
}
29792992
}
2993+
else
2994+
{
2995+
if (update_atoms0)
2996+
{
2997+
// Set the type.
2998+
atom.setAtomType(atomtype);
2999+
3000+
// Update the atoms in the vector.
3001+
atoms[i] = atom;
3002+
}
3003+
}
29803004
}
29813005
}
29823006

@@ -3019,9 +3043,15 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
30193043

30203044
QString particle_type = "A"; // A is for Atom
30213045

3046+
// This is a dummy atom.
30223047
if (elem.nProtons() == 0 and lj.isDummy())
3048+
{
30233049
atomtype += "_du";
30243050

3051+
// Flag that we need to update the atoms.
3052+
update_atoms1 = true;
3053+
}
3054+
30253055
// This is a new atom type.
30263056
if (not atomtypes.contains(atomtype))
30273057
{
@@ -3036,6 +3066,15 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
30363066

30373067
// Hash the atom type against its parameter string, minus the type.
30383068
param_hash.insert(atomtypes[atomtype].mid(6), atomtype);
3069+
3070+
if (update_atoms1)
3071+
{
3072+
// Set the type.
3073+
atom.setAtomType(atomtype);
3074+
3075+
// Update the atoms in the vector.
3076+
atoms[i] = atom;
3077+
}
30393078
}
30403079

30413080
// This type has been seen before.
@@ -3121,6 +3160,17 @@ static QStringList writeAtomTypes(QMap<QPair<int, QString>, GroMolType> &moltyps
31213160
update_atoms1 = true;
31223161
}
31233162
}
3163+
else
3164+
{
3165+
if (update_atoms1)
3166+
{
3167+
// Set the type.
3168+
atom.setAtomType(atomtype);
3169+
3170+
// Update the atoms in the vector.
3171+
atoms[i] = atom;
3172+
}
3173+
}
31243174
}
31253175
}
31263176

@@ -3217,14 +3267,6 @@ static QStringList writeMolType(const QString &name, const GroMolType &moltype,
32173267
elem1 = Element::elementWithMass(mol.property("mass1").asA<AtomMasses>()[cgatomidx]);
32183268
}
32193269

3220-
// Update the atom types.
3221-
3222-
if (elem0.nProtons() == 0)
3223-
atomtype0 += "_du";
3224-
3225-
if (elem1.nProtons() == 0)
3226-
atomtype1 += "_du";
3227-
32283270
QString resnum = QString::number(atom0.residueNumber().value());
32293271

32303272
if (not atom0.chainName().isNull())

0 commit comments

Comments
 (0)