Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #304 and #305 #307

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion corelib/src/libs/SireIO/grotop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6444,7 +6444,7 @@ QStringList GroTop::processDirectives(const QMap<int, QString> &taglocs, const Q
{

// could be residue_numberChain_name
const QRegularExpression re("(\\d+)([\\w\\d]*)");
const QRegularExpression re("(\\-?\\d+)([\\w\\d]*)");

auto m = re.match(words[2]);

Expand Down
2 changes: 1 addition & 1 deletion corelib/src/libs/SireMol/residentifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ ResNum::ResNum() : SireID::Number(), ResID()
{
}

ResNum::ResNum(quint32 num) : SireID::Number(num), ResID()
ResNum::ResNum(qint32 num) : SireID::Number(num), ResID()
{
}

Expand Down
2 changes: 1 addition & 1 deletion corelib/src/libs/SireMol/resnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace SireMol
public:
ResNum();

explicit ResNum(quint32 num);
explicit ResNum(qint32 num);

ResNum(const ResNum &other);

Expand Down
9 changes: 8 additions & 1 deletion corelib/src/libs/SireMove/openmmfrenergydt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,14 @@ void OpenMMFrEnergyDT::integrate(IntegratorWorkspace &workspace, const Symbol &n
// TriclinicBox.
else if (ptr_sys.property(space_property).isA<TriclinicBox>())
{
const TriclinicBox &space = ptr_sys.property(space_property).asA<TriclinicBox>();
TriclinicBox space = ptr_sys.property(space_property).asA<TriclinicBox>();

// 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
// checks the that the vectors are reduced to "exact" numerical precision,
// which may no longer be the case due to rounding errors from the precision
// loss.
space.reduce();

// Get the three triclinic box vectors.
const auto v0 = space.vector0();
Expand Down
9 changes: 8 additions & 1 deletion corelib/src/libs/SireMove/openmmfrenergyst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3475,7 +3475,14 @@ void OpenMMFrEnergyST::createContext(IntegratorWorkspace &workspace, SireUnits::
// TriclinicBox.
else if (ptr_sys.property(space_property).isA<TriclinicBox>())
{
const TriclinicBox &space = ptr_sys.property(space_property).asA<TriclinicBox>();
TriclinicBox space = ptr_sys.property(space_property).asA<TriclinicBox>();

// 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
// checks the that the vectors are reduced to "exact" numerical precision,
// which may no longer be the case due to rounding errors from the precision
// loss.
space.reduce();

// Get the three triclinic box vectors.
const auto v0 = space.vector0();
Expand Down
9 changes: 8 additions & 1 deletion corelib/src/libs/SireMove/openmmmdintegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,14 @@ void OpenMMMDIntegrator::createContext(IntegratorWorkspace &workspace, SireUnits
// TriclinicBox.
else if (ptr_sys.property(space_property).isA<TriclinicBox>())
{
const TriclinicBox &space = ptr_sys.property(space_property).asA<TriclinicBox>();
TriclinicBox space = ptr_sys.property(space_property).asA<TriclinicBox>();

// 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
// checks the that the vectors are reduced to "exact" numerical precision,
// which may no longer be the case due to rounding errors from the precision
// loss.
space.reduce();

// Get the three triclinic box vectors.
const auto v0 = space.vector0();
Expand Down
10 changes: 8 additions & 2 deletions corelib/src/libs/SireMove/openmmpmefep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2981,10 +2981,16 @@ void OpenMMPMEFEP::createContext(IntegratorWorkspace &workspace, SireUnits::Dime
// TriclinicBox
else if (ptr_sys.property(space_property).isA<TriclinicBox>())
{
const TriclinicBox &space = ptr_sys.property(space_property).asA<TriclinicBox>();
TriclinicBox space = ptr_sys.property(space_property).asA<TriclinicBox>();

// 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
// checks the that the vectors are reduced to "exact" numerical precision,
// which may no longer be the case due to rounding errors from the precision
// loss.
space.reduce();

// Get the three triclinic box vectors.
// FIXME: not good practice of using auto here
const auto v0 = space.vector0();
const auto v1 = space.vector1();
const auto v2 = space.vector2();
Expand Down
2 changes: 2 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ organisation on `GitHub <https://github.com/openbiosim/sire>`__.
* Handle missing velocity data for ``AMBER`` RST7 files with only a few atoms.
* Preserve SDF metadata when converting to ``RDKIt`` format.
* Fixed unbound local variable when simulation lambda value is not in ``lambda_windows`` array.
* Allow negative residue numbers.
* Make sure box vectors are in reduced form before setting via the ``OpenMM`` C++ API.

`2024.4.0 <https://github.com/openbiosim/sire/compare/2024.3.1...2024.4.0>`__ - Feb 2025
----------------------------------------------------------------------------------------
Expand Down
26 changes: 22 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ def conda_install(
dependencies_to_skip = []

for dependency in dependencies:
# remove any quotes from the dependency
dependency = dependency.replace("\"", "")

if dependency == "python" or is_installed(dependency, conda_exe):
# no need to install again
continue
Expand All @@ -399,10 +402,8 @@ def conda_install(
continue

# remove duplicates
dep = f'"{dependency}"'

if dep not in deps:
deps.append(dep)
if dependency not in deps:
deps.append(dependency)

dependencies = deps

Expand Down Expand Up @@ -465,6 +466,23 @@ def install_requires(install_bss_reqs=False, install_emle_reqs=False, yes=True):
print("Run `conda install -c conda-forge pip-requirements-parser\n\n")
raise e

try:
import pkg_resources
except Exception:
# this didn't import - we are missing setuptools
print("Installing setuptools")
conda_install(
["setuptools"],
install_bss_reqs,
install_emle_reqs=False,
yes=yes)
try:
import pkg_resources
except Exception:
print("\n\n[ERROR] ** You need to install setuptools")
print("Run 'conda install -c conda-forge setuptools\n\n")
raise e

reqs = parse_requirements("requirements_host.txt")
build_reqs = parse_requirements("requirements_build.txt")

Expand Down
2 changes: 1 addition & 1 deletion wrapper/Mol/ResNum.pypp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void register_ResNum_class(){
typedef bp::class_< SireMol::ResNum, bp::bases< SireMol::ResID, SireID::ID, SireID::Number > > ResNum_exposer_t;
ResNum_exposer_t ResNum_exposer = ResNum_exposer_t( "ResNum", "This ID number is used to identify a CutGroup by the user-supplied\nnumber\n\nAuthor: Christopher Woods\n", bp::init< >("") );
bp::scope ResNum_scope( ResNum_exposer );
ResNum_exposer.def( bp::init< quint32 >(( bp::arg("num") ), "") );
ResNum_exposer.def( bp::init< qint32 >(( bp::arg("num") ), "") );
ResNum_exposer.def( bp::init< SireMol::ResNum const & >(( bp::arg("other") ), "") );
{ //::SireMol::ResNum::hash

Expand Down
Loading