Skip to content

Commit

Permalink
Release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
reiher-research-group committed Aug 26, 2024
1 parent 9223ffc commit d5f94ff
Show file tree
Hide file tree
Showing 66 changed files with 736 additions and 508 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

Release 2.1.0
-------------
- rework non-bonded interaction calculation to increase memory efficiency.

Release 2.0.0
-------------
- enable electrostatic embedding QM/MM with Turbomole and xtb as QM calculators
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.9)
# tree must then provide a properly namespaced target with the same name as
# your project.
project(Swoose
VERSION 2.0.0
VERSION 2.1.0
DESCRIPTION "This is the SCINE module Swoose."
)

Expand Down
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ K.-S. Csizi, M. Reiher, "Automated preparation of nanoscopic structures: Graph-b
sequence analysis, mismatch detection, and pH-consistent protonation with uncertainty estimates"
*J. Comput. Chem*, **2024**, *45*, 761-776.

K.-S. Csizi, M. Steiner, M. Reiher, "Quantum Magnifying Glass for Chemistry at the Nanoscale",
*chemRxiv", **2023**, DOI 10.26434/chemrxiv-2023-t10sc.
K.-S. Csizi, M. Steiner, M. Reiher, "Nanoscale chemical reaction exploration with a quantum magnifying glass",
*Nat. Commun.*, **2024**, 15, 5320.

Furthermore, when publishing results obtained with any SCINE module, please cite the following paper:

T. Weymuth, J. P. Unsleber, P. L. Türtscher, M. Steiner, J.-G. Sobez, C. H. Müller, M. Mörchen,
V. Klasovita, S. A. Grimmel, M. Eckhoff, K.-S. Csizi, F. Bosia, M. Bensberg, M. Reiher,
"SCINE—Software for chemical interaction networks", *J. Chem. Phys.*, **2024**, *160*, 222501
(DOI `10.1063/5.0206974 <https://doi.org/10.1063/5.0206974>`_).

Support and Contact
-------------------
Expand Down
8 changes: 4 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class ScineSwooseConan(ScineConan):
name = "scine_swoose"
version = "2.0.0"
version = "2.1.0"
url = "https://github.com/qcscine/swoose"
description = """
Treat large molecular systems with self-parametrizing system-focused atomistic
Expand All @@ -22,8 +22,8 @@ class ScineSwooseConan(ScineConan):
exports_sources = ["dev/cmake/*", "src/*", "CMakeLists.txt", "README.rst",
"LICENSE.txt", "dev/conan/hook.cmake", "dev/conan/glue/*"]
requires = ["yaml-cpp/0.6.3",
"scine_utilities/[==9.0.0]",
"scine_molassembler/[==2.0.1]"]
"scine_utilities/10.0.0",
"scine_molassembler/3.0.0"]
cmake_name = "Swoose"

def requirements(self):
Expand All @@ -32,7 +32,7 @@ def requirements(self):
}

if self.options.get_safe("database"):
self.requires("scine_database/[==1.3.0]")
self.requires("scine_database/1.4.0")

if hasattr(super(), "requirements"):
super().requirements()
12 changes: 6 additions & 6 deletions manual/swoose_manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

%%
% Book metadata
\title[SCINE Swoose manual]{User Manual \vskip 0.5em {\setlength{\parindent}{0pt} \Huge SCINE Swoose 2.0.0}}
\author[The SCINE Swoose Developers]{\noindent Christoph Brunken, Katja-Sophia Csizi, Miguel Steiner, Thomas Weymuth, and Markus Reiher}
\title[SCINE Swoose manual]{User Manual \vskip 0.5em {\setlength{\parindent}{0pt} \Huge SCINE Swoose 2.1.0}}
\author[The SCINE Swoose Developers]{\noindent Moritz Bensberg, Christoph Brunken, Katja-Sophia Csizi, Miguel Steiner, Thomas Weymuth, and Markus Reiher}
\publisher{ETH Z\"urich}

%%
Expand Down Expand Up @@ -276,7 +276,7 @@ \section{Conan package}

\begin{mdframed}[backgroundcolor=LightSteelBlue!25, linewidth=0pt]
\begin{verbatim}
conan install scine_swoose/2.0.0@
conan install scine_swoose/2.1.0@
\end{verbatim}
\end{mdframed}

Expand All @@ -286,7 +286,7 @@ \section{Conan package}

\begin{mdframed}[backgroundcolor=LightSteelBlue!25, userdefinedwidth=12cm, linewidth=0pt]
\begin{verbatim}
conan install -o scine_swoose:python=True scine_swoose/2.0.0@
conan install -o scine_swoose:python=True scine_swoose/2.1.0@
\end{verbatim}
\end{mdframed}

Expand All @@ -302,7 +302,7 @@ \section{Conan package}

\begin{mdframed}[backgroundcolor=LightSteelBlue!25, linewidth=0pt]
\begin{verbatim}
conan install scine_swoose/2.0.0@ -g virtualrunenv
conan install scine_swoose/2.1.0@ -g virtualrunenv
\end{verbatim}
\end{mdframed}

Expand All @@ -321,7 +321,7 @@ \section{Conan package}
\begin{mdframed}[backgroundcolor=LightSteelBlue!25, linewidth=0pt]
\begin{verbatim}
[requires]
scine_swoose/[>=2.0.0]@
scine_swoose/[>=2.1.0]@
scine_sparrow/[>=5.0.0]@
scine_xtb_wrapper/[>=3.0.0]@
Expand Down
65 changes: 60 additions & 5 deletions src/Swoose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,57 @@ if(SCINE_BUILD_PYTHON_BINDINGS)
import_pybind11()
set(PYBIND11_PYTHON_VERSION ${PYTHONVERSION})

# Figure out which targets the python bindings are going to need copied
include(TargetLibName)
set(_py_targets_to_copy Swoose)
target_lib_type(Scine::UtilsOS _utils_libtype)
if(_utils_libtype STREQUAL "SHARED_LIBRARY")
list(APPEND _py_targets_to_copy Scine::UtilsOS)
endif()
unset(_utils_libtype)

# Generate generator expressions for each targets and figure out filenames
# for the python setup file
set(swoose_PY_DEPS "")
foreach(target ${_py_targets_to_copy})
list(APPEND _py_target_gen_exprs "\$<TARGET_FILE:${target}>")
target_lib_filename(${target} _target_filename)
string(APPEND swoose_PY_DEPS ", \"${_target_filename}\"")
endforeach()
message(STATUS "Targets to copy for Python bindings: ${_py_targets_to_copy}")
unset(_py_targets_to_copy)

add_custom_command(TARGET Swoose POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${_py_target_gen_exprs} ${CMAKE_CURRENT_BINARY_DIR}/scine_swoose
COMMENT "Copying required shared libraries into Python package directory"
)
unset(_py_target_gen_exprs)

# Utils python dependency
include(FindPythonModule)
if(scine-utils-os_BINARY_DIR)
set(UTILS_PYTHONPATH ${scine-utils-os_BINARY_DIR}/src/Utils)
else()
find_python_module(scine_utilities)
if(PY_SCINE_UTILITIES)
set(UTILS_PYTHONPATH ${PY_SCINE_UTILITIES})
else()
message(WARNING "Utilities Python module not found. Cannot test Python module or generate stubs")
endif()
endif()

# Molassembler python dependency
if(molassembler_BINARY_DIR)
set(MASM_PYTHONPATH ${scine-utils-os_BINARY_DIR}/src/Utils)
else()
find_python_module(scine_molassembler)
if(PY_SCINE_MOLASSEMBLER)
set(MASM_PYTHONPATH ${PY_SCINE_MOLASSEMBLER})
else()
message(WARNING "Molassembler Python module not found. Cannot test Python module or generate stubs")
endif()
endif()

# Python module
pybind11_add_module(scine_swoose
${SWOOSE_PYTHON_FILES}
Expand Down Expand Up @@ -238,15 +289,19 @@ if(SCINE_BUILD_PYTHON_BINDINGS)
endif()

# Typing stubs
include(FindPythonModule)
find_python_module(pybind11_stubgen)
if(PY_PYBIND11_STUBGEN)
if(PY_PYBIND11_STUBGEN AND UTILS_PYTHONPATH AND MASM_PYTHONPATH)
add_custom_command(TARGET scine_swoose POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} -m pybind11_stubgen -o . --root-module-suffix \"\" --no-setup-py --bare-numpy-ndarray scine_swoose
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${UTILS_PYTHONPATH}:$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} -m pybind11_stubgen -o . --root-module-suffix \"\" --no-setup-py --bare-numpy-ndarray scine_swoose
COMMENT "Generating python package typechecking stubs with pybind11-stubgen"
)
else()
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/scine_swoose/__init__.pyi
)
elseif(UTILS_PYTHONPATH AND MASM_PYTHONPATH)
message(STATUS "Not generating typechecking stubs for python package as pybind11-stubgen was not found")
elseif(UTILS_PYTHONPATH)
message(STATUS "Not generating typechecking stubs for Python package as SCINE Molassembler dependency was not found")
else()
message(STATUS "Not generating typechecking stubs for Python package as SCINE Utilities dependency was not found")
endif()

# Add setuptools file
Expand Down
8 changes: 4 additions & 4 deletions src/Swoose/Files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ set(SWOOSE_MODULE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/GAFF/GaffCalculatorSettings.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/GAFF/GaffMolecularMechanicsCalculator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/GAFF/GaffMolecularMechanicsCalculator.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/InteractionExclusion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/InteractionExclusion.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/ScaledInteractions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/ScaledInteractions.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/MMExceptions.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/MMParameters.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/MMParameters.h
Expand All @@ -24,8 +28,6 @@ set(SWOOSE_MODULE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/SFAM/SfamAtomTypeIdentifier.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/Electrostatic.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/Electrostatic.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/ElectrostaticTerm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/ElectrostaticTerm.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/ElectrostaticEvaluator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/ElectrostaticEvaluator.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/Repulsion.cpp
Expand Down Expand Up @@ -75,8 +77,6 @@ set(SWOOSE_MODULE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/LennardJones.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/LennardJonesEvaluator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/LennardJonesEvaluator.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/LennardJonesTerm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/LennardJonesTerm.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/HydrogenBond.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/HydrogenBond.h
${CMAKE_CURRENT_SOURCE_DIR}/Swoose/MolecularMechanics/Interactions/HydrogenBondTerm.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/Swoose/Python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os

# Read README.rst for the long description
with open("README.rst", "r") as fh:
with open("README.rst", "r", encoding="utf-8") as fh:
long_description = fh.read()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Scine {

namespace Core {
class Log;
struct Log;
} // namespace Core

namespace MMParametrization {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace Scine {

namespace Core {
class Log;
struct Log;
} // namespace Core

namespace MMParametrization {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ double TitrationHelper::getPkaOfTrainingMolecule(std::string dataDirectory) {
}

double TitrationHelper::getEnergyOfDeprotonationForTrainingMolecule(std::string dataDirectory) {
(void)dataDirectory;
return 0.0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace Scine {

namespace Core {
class Log;
struct Log;
} // namespace Core

namespace Utils {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ Eigen::MatrixXd MolecularMachineLearningModel::getSingleForceFeatures(int atomIn
}

Eigen::MatrixXd MolecularMachineLearningModel::getSingleForceTargets(int atomIndex) {
int nDataPoints = forcesFeatures_.size();
const size_t nDataPoints = forcesFeatures_.size();
Eigen::MatrixXd targets(nDataPoints, 3);
for (long unsigned int j = 0; j < nDataPoints; ++j) {
for (size_t j = 0; j < nDataPoints; ++j) {
targets.row(j) = refForces_[j].row(atomIndex);
}
return targets;
Expand Down
4 changes: 2 additions & 2 deletions src/Swoose/Swoose/MolecularMechanics/AtomTypesHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AtomTypesHolder {
/**
* @brief Getter for the atom type for an atom with a certain index.
*/
std::string getAtomType(int index) const;
const std::string& getAtomType(unsigned int index) const;

/**
* @brief Returns the number of atom types stored in this object.
Expand All @@ -42,7 +42,7 @@ class AtomTypesHolder {
inline AtomTypesHolder::AtomTypesHolder(std::vector<std::string> atomTypes) : atomTypes_(std::move(atomTypes)) {
}

inline std::string AtomTypesHolder::getAtomType(int index) const {
inline const std::string& AtomTypesHolder::getAtomType(unsigned int index) const {
return atomTypes_.at(index);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ const Utils::Results& GaffMolecularMechanicsCalculator::calculate(std::string de
const Utils::Results& GaffMolecularMechanicsCalculator::calculateImpl(std::string description) {
int nAtoms = structure_.size();
double energy = 0.0;

// Initialize the atomic derivatives container
Utils::AtomicSecondDerivativeCollection derivativesForBondedInteractions(nAtoms);
derivativesForBondedInteractions.setZero();
Expand All @@ -119,9 +118,10 @@ const Utils::Results& GaffMolecularMechanicsCalculator::calculateImpl(std::strin
int nAtomsInitialization = 0;
if (!onlyCalculateBondedContribution_)
nAtomsInitialization = nAtoms;
Utils::FullSecondDerivativeCollection fullDerivatives(nAtomsInitialization);
fullDerivatives.setZero();
const unsigned int derivativeOrder = (requiredProperties_.containsSubSet(Utils::Property::Hessian)) ? 2 : 1;

Utils::DerivativeCollection fullDerivatives(nAtomsInitialization, derivativeOrder);
fullDerivatives.setZero();
double energyBonds = bondsEvaluator_->evaluate(derivativesForBondedInteractions);
energy += energyBonds;
double energyAngles = anglesEvaluator_->evaluate(derivativesForBondedInteractions);
Expand All @@ -130,7 +130,6 @@ const Utils::Results& GaffMolecularMechanicsCalculator::calculateImpl(std::strin
energy += energyDihedrals;
double energyImproperDihedrals = improperDihedralsEvaluator_->evaluate(derivativesForBondedInteractions);
energy += energyImproperDihedrals;

double energyLennardJones = 0.0;
double energyElectro = 0.0;
if (!onlyCalculateBondedContribution_) {
Expand Down Expand Up @@ -218,7 +217,6 @@ void GaffMolecularMechanicsCalculator::generatePotentialTerms(const std::string&
GaffAtomTypeIdentifier atomTypeGenerator(structure_.getElements().size(), structure_.getElements(), listsOfNeighbors_,
atomTypesFile_);
auto atomTypes = atomTypeGenerator.getAtomTypes();

if (!parametersHaveBeenSetInternally_ || parameterFilePathHasBeenChanged_) {
if (parameterPath.empty()) {
GaffParameterDefaultsProvider parameterProvider;
Expand All @@ -234,7 +232,8 @@ void GaffMolecularMechanicsCalculator::generatePotentialTerms(const std::string&
parametersHaveBeenSetInternally_ = true;
parameterFilePathHasBeenChanged_ = false;
}

lennardJonesEvaluator_->setAtomTypesHolder(std::make_shared<AtomTypesHolder>(atomTypes));
lennardJonesEvaluator_->setParameters(std::make_shared<GaffParameters>(parameters_));
generatePotentialTerms(parameters_, topology, atomTypes);
}

Expand All @@ -256,15 +255,24 @@ void GaffMolecularMechanicsCalculator::generatePotentialTerms(const GaffParamete

// Generate the potential terms
GaffPotentialTermsGenerator generator(structure_.size(), atomTypes, topology, parameters, structure_.getPositions(),
nonCovalentCutoffRadius_, this->getLog());
this->getLog());

bondsEvaluator_->setBondTerms(generator.getBondedTerms());
anglesEvaluator_->setAngleTerms(generator.getAngleTerms());
dihedralsEvaluator_->setDihedralTerms(generator.getDihedralTerms());
improperDihedralsEvaluator_->setDihedralTerms(generator.getImproperDihedralTerms());
if (!onlyCalculateBondedContribution_) {
lennardJonesEvaluator_->setLennardJonesTerms(generator.getLennardJonesTerms(applyCutoffDuringInitialization_));
electrostaticEvaluator_->setElectrostaticTerms(generator.getElectrostaticTerms(applyCutoffDuringInitialization_));
lennardJonesEvaluator_->setCutOffRadius(std::make_shared<double>(nonCovalentCutoffRadius_));
lennardJonesEvaluator_->resetExclusions(structure_.size());
lennardJonesEvaluator_->addExclusions(topology);
lennardJonesEvaluator_->resetScaledInteractions(structure_.size());
lennardJonesEvaluator_->addScaledInteractionPairs(topology);

electrostaticEvaluator_->setCutOffRadius(std::make_shared<double>(nonCovalentCutoffRadius_));
electrostaticEvaluator_->resetExclusions(structure_.size());
electrostaticEvaluator_->addExclusions(topology);
electrostaticEvaluator_->resetScaledInteractions(structure_.size());
electrostaticEvaluator_->addScaledInteractionPairs(topology);
}
}

Expand All @@ -289,7 +297,6 @@ void GaffMolecularMechanicsCalculator::initialize() {
SwooseUtilities::TopologyUtils::generateListsOfNeighborsFromBondOrderMatrix(structure_.size(), bondOrders, 0.5);
}
}

generatePotentialTerms(parameterFilePath_);
}

Expand Down
Loading

0 comments on commit d5f94ff

Please sign in to comment.