Skip to content

Commit 65a9b94

Browse files
author
Charlles Abreu
authored
Includes doctest for CompositeRMSDForce (#10)
* Removed doxygen as dependency * Fixed python docstrings * Fixed force implementation * Fixed comments * Completed doctest * Updated Docs * Included test dependencies for GH Actions
1 parent 90869ca commit 65a9b94

18 files changed

+220
-186
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
9191

9292
# Build the Python API
9393

94-
FIND_PROGRAM(DOXYGEN_EXECUTABLE doxygen)
9594
FIND_PROGRAM(PYTHON_EXECUTABLE python REQUIRED)
9695
FIND_PROGRAM(SWIG_EXECUTABLE swig REQUIRED)
9796
SET(PLUGIN_BUILD_PYTHON_WRAPPERS ON CACHE BOOL "Build wrappers for Python")

devtools/conda-envs/build-docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pip >=22.2
1010
- pytest
1111
- python
12-
- doxygen
1312
- swig =4.0
1413
- sysroot_linux-64 2.17
1514
- numpy

devtools/conda-envs/build-macos-latest.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ name: build
22
channels:
33
- conda-forge
44
dependencies:
5-
- cmake
65
- compilers
6+
- cmake
77
- make
8+
- numpy
89
- openmm
910
- pip >=22.2
10-
- pytest
1111
- python
1212
- swig =4.0
13-
- numpy
13+
14+
# Test dependencies
15+
- openmmtools
16+
- pytest

devtools/conda-envs/build-ubuntu-latest.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ dependencies:
55
- cmake
66
- gxx_linux-64
77
- make
8+
- numpy
89
- openmm
910
- pip >=22.2
10-
- pytest
1111
- python
12-
- doxygen
1312
- swig =4.0
1413
- sysroot_linux-64 2.17
15-
- numpy
14+
15+
# Test dependencies
16+
- openmmtools
17+
- pytest

devtools/conda-recipes/anaconda/meta.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ requirements:
1414
build:
1515
- python
1616
- swig <4.1
17-
- doxygen
1817
- openmm >=8.1
1918
- {{ compiler('cxx') }}
2019
- cmake

docs/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def create_rst_file(cls):
5858
source_suffix = '.rst'
5959
master_doc = 'index'
6060

61-
project = 'OpenMM OpenMM CPP Forces'
61+
project = 'OpenMM CPP Forces'
6262
copyright = ('2024, Charlles Abreu. Project based on OpenMM')
6363
author = 'Charlles Abreu'
6464

@@ -83,8 +83,6 @@ def create_rst_file(cls):
8383
html_theme = 'alabaster'
8484
html_static_path = ['_static']
8585
html_theme_options = {
86-
'logo': 'logo_small.png',
87-
'logo_name': True,
8886
'github_button': False,
8987
'github_user': 'craabreu',
9088
'github_repo': 'openmmcppforces',

docs/overview.rst

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,29 @@
22
Overview
33
========
44

5-
This OpenMM_ plugin is a laboratory for low-level code implementation.
5+
This `OpenMM`_ plugin provides Platform-agnostic Force classes.
66

7-
Building the Plugin
8-
===================
7+
Installation and Usage
8+
======================
99

10-
This project uses CMake_ for its build system. To build it, follow these steps:
10+
OpenMM-CPP-Forces is available as a conda package on the `mdtools`_ channel. To install it, run:
1111

12-
#. Create a directory in which to build the plugin.
13-
#. Run the CMake GUI or ccmake, specifying your new directory as the build directory and the top level directory of this project as the source directory.
14-
#. Press "Configure".
15-
#. Set OPENMM_DIR to point to the directory where OpenMM is installed. This is needed to locate the OpenMM header files and libraries.
16-
#. Set CMAKE_INSTALL_PREFIX to the directory where the plugin should be installed. Usually, this will be the same as OPENMM_DIR, so the plugin will be added to your OpenMM installation.
17-
#. If you plan to build the OpenCL platform, make sure that OPENCL_INCLUDE_DIR and OPENCL_LIBRARY are set correctly, and that PLUGIN_BUILD_OPENCL_LIB is selected.
18-
#. If you plan to build the CUDA platform, make sure that CUDA_TOOLKIT_ROOT_DIR is set correctly and that PLUGIN_BUILD_CUDA_LIB is selected.
19-
#. Press "Configure" again if necessary, then press "Generate".
20-
#. Use the build system you selected to build and install the plugin. For example, if you selected Unix Makefiles, type `make install`.
12+
.. code-block:: bash
2113
22-
Python Wrapper
23-
==============
14+
conda install -c conda-forge -c mdtools openmm-cpp-forces
2415
25-
As OpenMM_, this project uses SWIG_ to generate its Python API. SWIG takes an "interface
26-
file", which is essentially a C++ header file with some extra annotations added, as its input.
27-
It then generates a Python extension module exposing the C++ API in Python.
16+
Or:
2817

29-
To build and install the Python API, build the `PythonInstall` target, for example by typing
30-
`make PythonInstall` (if you are installing into the system Python, you may need to use sudo).
18+
.. code-block:: bash
3119
32-
Test Cases
33-
==========
20+
mamba install -c mdtools openmm-cpp-forces
3421
35-
To run the C++ test cases, build the "test" target, for example by typing `make test`.
22+
To use OpenMM-CPP-Forces in your own Python script or Jupyter notebook, simply import it as follows:
3623

37-
To run the Python test cases, build the "PythonTest" target by typing `make PythonTest`.
24+
.. code-block:: python
3825
26+
import openmmcppforces
3927
40-
.. _CMake: http://www.cmake.org
41-
.. _OpenMM: https://openmm.org
42-
.. _SWIG: http://www.swig.org
28+
29+
.. _OpenMM: https://openmm.org
30+
.. _mdtools: https://anaconda.org/mdtools/openmm-cpp-forces

docs/pythonapi/index.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ To use the plugin from your Python script, you can do:
55

66
.. code-block:: python
77
8-
import openmm as mm
98
import openmmcppforces
109
11-
force = openmmcppforces.CompositeRMSDForce()
12-
13-
This is the implemented subclass of :OpenMM:`Force`:
10+
These are the implemented subclasses of :OpenMM:`Force`:
1411

1512
.. toctree::
1613
:titlesonly:

openmmcppforces/include/CompositeRMSDForce.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* A plugin for distributing platform-agnostic OpenMM Forces *
99
* *
1010
* Copyright (c) 2024 Charlles Abreu *
11-
* https://github.com/craabreu/openmm-cpp-forces *
11+
* https://github.com/craabreu/openmm-cpp-forces *
1212
* -------------------------------------------------------------------------- */
1313

1414
#include "internal/windowsExportOpenMMCPPForces.h"
@@ -44,7 +44,7 @@ class CUSTOM_CPP_FORCES_EXPORT CompositeRMSDForce : public Force {
4444
* @param referencePositions the reference positions to compute the deviation from.
4545
* The length of this vector must equal the number of
4646
* particles in the system, even if not all particles are
47-
* used in computing the Concerted RMSD.
47+
* used in computing the Composite RMSD.
4848
*/
4949
explicit CompositeRMSDForce(const vector<Vec3>& referencePositions);
5050
/**
@@ -59,29 +59,29 @@ class CUSTOM_CPP_FORCES_EXPORT CompositeRMSDForce : public Force {
5959
* @param positions the reference positions to compute the deviation from.
6060
* The length of this vector must equal the number of
6161
* particles in the system, even if not all particles are
62-
* used in computing the concerted RMSD.
62+
* used in computing the composite RMSD.
6363
*/
6464
void setReferencePositions(const vector<Vec3>& positions);
6565
/**
66-
* Add a group of particles to be included in the concerted RMSD calculation.
66+
* Add a group of particles to be included in the composite RMSD calculation.
6767
*
6868
* @param particles the indices of the particles to include
6969
*
7070
* @return the index of the group that was added
7171
*/
7272
int addGroup(const vector<int>& particles);
7373
/**
74-
* Get the number of particle groups included in the concerted RMSD calculation.
74+
* Get the number of particle groups included in the composite RMSD calculation.
7575
*/
7676
int getNumGroups() const;
7777
/**
78-
* Get the particles of a group included in the concerted RMSD calculation.
78+
* Get the particles of a group included in the composite RMSD calculation.
7979
*
8080
* @param index the index of the group whose particles are to be retrieved
8181
*/
8282
const vector<int>& getGroup(int index) const;
8383
/**
84-
* Set the particles of a group included in the concerted RMSD calculation.
84+
* Set the particles of a group included in the composite RMSD calculation.
8585
*/
8686
void setGroup(int index, const vector<int>& particles);
8787
/**

openmmcppforces/include/internal/CompositeRMSDForceImpl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* A plugin for distributing platform-agnostic OpenMM Forces *
99
* *
1010
* Copyright (c) 2024 Charlles Abreu *
11-
* https://github.com/craabreu/openmm-cpp-forces *
11+
* https://github.com/craabreu/openmm-cpp-forces *
1212
* -------------------------------------------------------------------------- */
1313

1414
#include "CompositeRMSDForce.h"
@@ -40,6 +40,7 @@ class CompositeRMSDForceImpl : public CustomCPPForceImpl {
4040
const CompositeRMSDForce& owner;
4141
vector<vector<int>> groups;
4242
vector<Vec3> referencePos;
43+
double sumRefPosSquared;
4344
};
4445

4546
} // namespace OpenMMCPPForces

0 commit comments

Comments
 (0)