Skip to content

Commit

Permalink
Merge pull request #214 from michellab/devel
Browse files Browse the repository at this point in the history
Merging devel into master for the 2018.2.0 release

[ci skip]
  • Loading branch information
chryswoods authored Jul 12, 2018
2 parents 2cb9cd9 + 4970350 commit 0d3c66a
Show file tree
Hide file tree
Showing 116 changed files with 11,985 additions and 3,084 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ SIRE changelog

devel branch:

[2018.2.0] July 2018 - Improvements to the Gromacs topology reader/writer,
addition of code to improve matching of atoms in proteins,
fixing compile issues on modern Ubuntu, bugfixes for crashes
in the AmberPrm reader, added in text-based searching for
atoms, residues etc. from Systems, MoleculeGroups, Molecules,
etc. based on boost::spirit, updated boost to latest version,
bugfixes for quantomm infinite rotation bug for ions,
general bugfixes.

[2018.1.1] May 2018 - Small bug fixes to allow single-atom solutes
and also to fix small issues with some parsers for BioSimSpace

Expand Down
2 changes: 1 addition & 1 deletion compile_sire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ esac

# Set the version of miniconda to use. Choose "latest" for the latest
# miniconda, or set a specific version here
MINICONDA_VERSION="4.2.12"
MINICONDA_VERSION="4.5.4"
#MINICONDA_VERSION="latest"

if [ -z "$INSTALL_SIRE_DIR" ]; then
Expand Down
5 changes: 3 additions & 2 deletions corelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
################################

set (S_VERSION_MAJOR "2018")
set (S_VERSION_MINOR "1")
set (S_VERSION_PATCH "1")
set (S_VERSION_MINOR "2")
set (S_VERSION_PATCH "0")

set (SIRE_VERSION "${S_VERSION_MAJOR}.${S_VERSION_MINOR}.${S_VERSION_PATCH}")

Expand Down Expand Up @@ -161,6 +161,7 @@ message( STATUS "Sire will be compiled and installed to directory ${CMAKE_INSTAL

# Absolutely can't run cmake in the source directory!
if ( CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR )
message( STATUS "${CMAKE_BINARY_DIR} | ${CMAKE_SOURCE_DIR}" )
message( FATAL_ERROR "You must run CMake in a different directory to the source!" )
endif()

Expand Down
Binary file modified corelib/src/bundled/boost_headers.tar.gz
Binary file not shown.
17 changes: 8 additions & 9 deletions corelib/src/libs/SireCAS/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ friend QDataStream& ::operator>>(QDataStream&, Expression&);
Expression squared() const;
Expression cubed() const;

Expression pow(const Rational &n) const;
Expression pow(double n) const;
Expression pow(const Complex &n) const;
Expression pow(const Rational &n) const;
Expression pow(const Expression &n) const;

Expression root(int n) const;
Expand Down Expand Up @@ -204,10 +204,10 @@ Expression operator/(double val, const Expression &ex);
Expression operator/(const Expression &ex, const Complex &val);
Expression operator/(const Complex &val, const Expression &ex);
Expression pow(const Expression &ex0, int n);
Expression pow(const Expression &ex0, const SireMaths::Rational &n);
Expression pow(const Expression &ex0, double n);
Expression pow(const Expression &ex0, const Expression &n);
Expression pow(const Expression &ex0, const Complex &n);
Expression pow(const Expression &ex0, const Rational &n);
Expression root(const Expression &ex0, int n);
Expression sqrt(const Expression &ex0);
Expression cbrt(const Expression &ex0);
Expand Down Expand Up @@ -387,13 +387,6 @@ inline Expression pow(const Expression &ex0, int n)
return ex0.pow(n);
}

/** Raise an expression to a rational power */
inline Expression pow(const Expression &ex0,
const SireMaths::Rational &n)
{
return ex0.pow(n);
}

/** Raise an expression to a real power */
inline Expression pow(const Expression &ex0, double n)
{
Expand All @@ -413,6 +406,12 @@ inline Expression pow(const Expression &ex0, const Complex &n)
return ex0.pow(n);
}

/** Raise an expression to a rational power */
inline Expression pow(const Expression &ex0, const Rational &n)
{
return ex0.pow(n);
}

/** Take the nth root of an expression */
inline Expression root(const Expression &ex0, int n)
{
Expand Down
3 changes: 3 additions & 0 deletions corelib/src/libs/SireError/getbacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

#include "getbacktrace.h"

#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED 1
#include <boost/stacktrace.hpp>

#include <QObject>
#include <QString>
#include <QRegExp>
Expand Down
58 changes: 52 additions & 6 deletions corelib/src/libs/SireIO/amberprm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,9 @@ QVector<QString> getAtomTreeChains(const AmberParams &params)
}

/** Internal function used to get the amber atom types of each atom */
QVector<QString> getAmberTypes(const AmberParams &params)
QVector<QString> getAmberTypes(const AmberParams &params,
QHash<QString,int> &unique_names,
QMutex &name_mutex)
{
const auto info = params.info();

Expand All @@ -1091,7 +1093,48 @@ QVector<QString> getAmberTypes(const AmberParams &params)

for (int i=0; i<info.nAtoms(); ++i)
{
ambtyps[i] = t[ info.cgAtomIdx(AtomIdx(i)) ];
auto atomtype = t[ info.cgAtomIdx(AtomIdx(i)) ];

if (atomtype.length() > 4)
{
//we need to shorten the atom type name to 4 characters. Do this by
//creating a unique name...
QMutexLocker lkr(&name_mutex);

int index = 0;

if (unique_names.contains(atomtype))
{
index = unique_names[atomtype];
}
else
{
//find the highest index used so far
int highest = 0;

for (auto it = unique_names.constBegin(); it != unique_names.constEnd(); ++it)
{
if (it.value() > highest)
highest = it.value();
}

highest += 1;
unique_names.insert(atomtype, highest);

index = highest;
}

if (index < 1000)
atomtype = QString("X%1").arg(index);
else if (index < 10000)
atomtype = QString("%1").arg(index);
else
throw SireError::incompatible_error( QObject::tr(
"Cannot write an Amber file as the number of atom types with string "
"lengths greater than 4 is greater than 9999"), CODELOC );
}

ambtyps[i] = atomtype;
}

return ambtyps;
Expand Down Expand Up @@ -2131,22 +2174,25 @@ QStringList toLines(const QVector<AmberParams> &params,
{
QVector< QVector<QString> > amber_types(params.count());

QHash<QString,int> unique_types;
QMutex unique_mutex;

if (use_parallel)
{
tbb::parallel_for( tbb::blocked_range<int>(0,params.count()),
[&](const tbb::blocked_range<int> r)
{
for (int i=r.begin(); i<r.end(); ++i)
{
amber_types[i] = getAmberTypes(params[i]);
amber_types[i] = getAmberTypes(params[i], unique_types, unique_mutex);
}
});
}
else
{
for (int i=0; i<params.count(); ++i)
{
amber_types[i] = getAmberTypes(params[i]);
amber_types[i] = getAmberTypes(params[i], unique_types, unique_mutex);
}
}

Expand Down Expand Up @@ -3133,7 +3179,7 @@ AmberPrm::AmberPrm(const System &system, const PropertyMap &map)
{
throw SireIO::parse_error( QObject::tr(
"Errors converting the system to a Amber Parm format...\n%1")
.arg(lines.join("\n")), CODELOC );
.arg(errors.join("\n")), CODELOC );
}

//we don't need params any more, so free the memory
Expand Down Expand Up @@ -3614,7 +3660,7 @@ MolStructureEditor AmberPrm::getMolStructure(int start_idx, int natoms,

if (res_idx+1 == res_pointers.count())
{
res_end_atom = res_start_atom + natoms - 1;
res_end_atom = res_pointers[res_start_idx] + natoms - 1;
}
else
{
Expand Down
12 changes: 6 additions & 6 deletions corelib/src/libs/SireIO/charmmpsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ CharmmPSF::CharmmPSF(const SireSystem::System &system, const PropertyMap &map) :
try
{
// Extract the existing parameters from the system.
QString params = system.property(map["charmm-params"]).asA<StringProperty>().value();
QString params = system.property(map["charmm_params"]).asA<StringProperty>().value();

// Convert into a list.
charmm_params = params.split("\n");
Expand Down Expand Up @@ -3019,9 +3019,9 @@ void CharmmPSF::parseMolecule(
QString segment = QString("M%1").arg(imol+1);

// Extract the existing molecule name.
if (sire_mol.hasProperty(map["mol-name"]))
if (sire_mol.hasProperty(map["mol_name"]))
{
segment = sire_mol.property(map["mol-name"]).toString().simplified().toUpper();
segment = sire_mol.property(map["mol_name"]).toString().simplified().toUpper();
}

if (usesParallel())
Expand Down Expand Up @@ -3570,8 +3570,8 @@ System CharmmPSF::startSystem(const QVector<QString> &param_lines, const Propert
else param_format = "X-PLOR";

// Add the CHARMM parameters as a property.
system.setProperty(map["charmm-params"].source(), StringProperty(params_string));
system.setProperty(map["param-format"].source(), StringProperty(param_format));
system.setProperty(map["charmm_params"].source(), StringProperty(params_string));
system.setProperty(map["param_format"].source(), StringProperty(param_format));

// Add the periodic box property.
if (has_box_params)
Expand Down Expand Up @@ -3819,7 +3819,7 @@ MolEditor CharmmPSF::getMolecule(int imol, const PropertyMap &map) const
auto mol = this->getMolStructure(imol, map["cutting"]).commit().edit();

// Set the molecule name.
mol.setProperty(map["mol-name"], StringProperty(atoms[molecules[imol][0]].getSegment()));
mol.setProperty(map["mol_name"], StringProperty(atoms[molecules[imol][0]].getSegment()));

// Get the info object that can map between AtomNum to AtomIdx etc.
const auto molinfo = mol.info();
Expand Down
8 changes: 4 additions & 4 deletions corelib/src/libs/SireIO/gro87.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1600,10 +1600,10 @@ int Gro87::findAtom(const MoleculeInfoData &molinfo, int atmidx, int hint,
return partial_matches.last();
}
else
throw SireMol::missing_atom( QObject::tr(
"Cannot find the atom %1(%2) : %3(%4) in the set of atoms loaded "
"from this .gro file.")
.arg(atmname).arg(atmnum).arg(resname).arg(resnum), CODELOC );
{
//we can't find the atom, so just go with the hint
return hint;
}
}

return match;
Expand Down
Loading

0 comments on commit 0d3c66a

Please sign in to comment.