Skip to content

Commit ba96779

Browse files
author
Charlles Abreu
authored
Changes class name to CompositeRMSDForce (#8)
* Updated README.md * Changed class name * Updated docs
1 parent 8d20cee commit ba96779

14 files changed

+159
-104
lines changed

README.md

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,62 @@
11
OpenMM-CPP-Forces Plugin
22
========================
33

4-
[![Linux](https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Linux.yml/badge.svg)](https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Linux.yml)
5-
[![MacOS](https://github.com/craabreu/openmm-cpp-forces/actions/workflows/MacOS.yml/badge.svg)](https://github.com/craabreu/openmm-cpp-forces/actions/workflows/MacOS.yml)
6-
[![Docs](https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Docs.yml/badge.svg)](https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Docs.yml)
7-
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
8-
9-
[![Conda version](https://img.shields.io/conda/v/mdtools/openmm-cpp-forces.svg)](https://anaconda.org/mdtools/openmm-cpp-forces)
10-
[![Conda platforms](https://img.shields.io/conda/pn/mdtools/openmm-cpp-forces.svg)](https://anaconda.org/mdtools/openmm-cpp-forces)
11-
[![Conda downloads](https://img.shields.io/conda/dn/mdtools/openmm-cpp-forces.svg)](https://anaconda.org/mdtools/openmm-cpp-forces)
4+
[![Linux](
5+
https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Linux.yml/badge.svg
6+
)](
7+
https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Linux.yml
8+
)
9+
[![MacOS](
10+
https://github.com/craabreu/openmm-cpp-forces/actions/workflows/MacOS.yml/badge.svg
11+
)](
12+
https://github.com/craabreu/openmm-cpp-forces/actions/workflows/MacOS.yml
13+
)
14+
[![Docs](
15+
https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Docs.yml/badge.svg
16+
)](
17+
https://github.com/craabreu/openmm-cpp-forces/actions/workflows/Docs.yml
18+
)
19+
[![License: MIT](
20+
https://img.shields.io/badge/License-MIT-green.svg
21+
)](
22+
https://opensource.org/licenses/MIT
23+
)
24+
25+
[![Conda version](
26+
https://img.shields.io/conda/v/mdtools/openmm-cpp-forces.svg
27+
)](
28+
https://anaconda.org/mdtools/openmm-cpp-forces
29+
)
30+
[![Conda platforms](
31+
https://img.shields.io/conda/pn/mdtools/openmm-cpp-forces.svg
32+
)](
33+
https://anaconda.org/mdtools/openmm-cpp-forces
34+
)
35+
[![Conda downloads](
36+
https://img.shields.io/conda/dn/mdtools/openmm-cpp-forces.svg
37+
)](
38+
https://anaconda.org/mdtools/openmm-cpp-forces
39+
)
1240

1341
This [OpenMM] plugin provides Platform-agnostic Force classes.
1442

1543

16-
Available Forces
17-
================
44+
### Available Forces
1845

1946
The Force classes implemented in OpenMM-CPP-Forces are listed in the table below.
2047

21-
| Force | Description |
22-
|-------------------------|------------------------------------------------------------------|
23-
| [ConcertedRMSDForce] | RMSD of multiple structures constrained to rotate in tandem |
24-
48+
| Force / CV | Description |
49+
|------------------------|-------------------------------------------------------------------------|
50+
| [CompositeRMSDForce] | Deviation of multiple corotating bodies from their reference structures |
2551

26-
Documentation
27-
=============
52+
### Documentation
2853

29-
Documentation for this plugin is available at [Github Pages](https://craabreu.github.io/openmm-cpp-forces/).
54+
Documentation for this plugin is available at [Github Pages].
3055

3156

32-
Installation and Usage
33-
======================
57+
### Installation and Usage
3458

35-
OpenMM-CPP-Forces is available as a conda package on the
36-
[mdtools](https://anaconda.org/mdtools/openmm-cpp-forces) channel. To install it, run:
59+
OpenMM-CPP-Forces is available as a conda package on the [mdtools] channel. To install it, run:
3760

3861
```bash
3962
conda install -c conda-forge -c mdtools openmm-cpp-forces
@@ -51,6 +74,11 @@ To use OpenMM-CPP-Forces in your own Python script or Jupyter notebook, simply i
5174
import openmmcppforces
5275
```
5376

54-
55-
[OpenMM]: https://openmm.org
56-
[ConcertedRMSDForce]: https://craabreu.github.io/openmm-cpp-forces/pythonapi/ConcertedRMSDForce.html
77+
[CompositeRMSDForce]:
78+
https://craabreu.github.io/openmm-cpp-forces/pythonapi/CompositeRMSDForce.html
79+
[Github Pages]:
80+
https://craabreu.github.io/openmm-cpp-forces
81+
[mdtools]:
82+
https://anaconda.org/mdtools/openmm-cpp-forces
83+
[OpenMM]:
84+
https://openmm.org

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def create_rst_file(cls):
3535
])
3636

3737

38-
create_rst_file(openmmcppforces.ConcertedRMSDForce)
38+
create_rst_file(openmmcppforces.CompositeRMSDForce)
3939

4040
extensions = [
4141
'sphinx.ext.autodoc',

docs/pythonapi/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ To use the plugin from your Python script, you can do:
88
import openmm as mm
99
import openmmcppforces
1010
11-
force = openmmcppforces.ConcertedRMSDForce()
11+
force = openmmcppforces.CompositeRMSDForce()
1212
1313
This is the implemented subclass of :OpenMM:`Force`:
1414

1515
.. toctree::
1616
:titlesonly:
1717

18-
ConcertedRMSDForce
18+
CompositeRMSDForce
1919

2020

2121
.. testsetup::

openmmcppforces/include/ConcertedRMSDForce.h renamed to openmmcppforces/include/CompositeRMSDForce.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef OPENMM_CONCERTEDRMSDFORCE_H_
2-
#define OPENMM_CONCERTEDRMSDFORCE_H_
1+
#ifndef OPENMM_COMPOSITERMSDFORCE_H_
2+
#define OPENMM_COMPOSITERMSDFORCE_H_
33

44
/* -------------------------------------------------------------------------- *
55
* OpenMM CPP Forces *
@@ -36,17 +36,17 @@ namespace OpenMMCPPForces {
3636
* in the system.
3737
*/
3838

39-
class CUSTOM_CPP_FORCES_EXPORT ConcertedRMSDForce : public Force {
39+
class CUSTOM_CPP_FORCES_EXPORT CompositeRMSDForce : public Force {
4040
public:
4141
/**
42-
* Create an ConcertedRMSDForce.
42+
* Create an CompositeRMSDForce.
4343
*
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
4747
* used in computing the Concerted RMSD.
4848
*/
49-
explicit ConcertedRMSDForce(const vector<Vec3>& referencePositions);
49+
explicit CompositeRMSDForce(const vector<Vec3>& referencePositions);
5050
/**
5151
* Get the reference positions to compute the deviation from.
5252
*/
@@ -110,4 +110,4 @@ class CUSTOM_CPP_FORCES_EXPORT ConcertedRMSDForce : public Force {
110110

111111
} // namespace OpenMMCPPForces
112112

113-
#endif /*OPENMM_CONCERTEDRMSDFORCE_H_*/
113+
#endif /*OPENMM_COMPOSITERMSDFORCE_H_*/
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef OPENMM_CONCERTEDRMSDFORCEIMPL_H_
2-
#define OPENMM_CONCERTEDRMSDFORCEIMPL_H_
1+
#ifndef OPENMM_COMPOSITERMSDFORCEIMPL_H_
2+
#define OPENMM_COMPOSITERMSDFORCEIMPL_H_
33

44
/* -------------------------------------------------------------------------- *
55
* OpenMM CPP Forces *
@@ -11,7 +11,7 @@
1111
* https://github.com/craabreu/openmm-cpp-forces *
1212
* -------------------------------------------------------------------------- */
1313

14-
#include "ConcertedRMSDForce.h"
14+
#include "CompositeRMSDForce.h"
1515

1616
#include "openmm/internal/CustomCPPForceImpl.h"
1717
#include "openmm/internal/ContextImpl.h"
@@ -23,25 +23,25 @@ using namespace std;
2323
namespace OpenMMCPPForces {
2424

2525
/**
26-
* This is the internal implementation of ConcertedRMSDForce.
26+
* This is the internal implementation of CompositeRMSDForce.
2727
*/
2828

29-
class ConcertedRMSDForceImpl : public CustomCPPForceImpl {
29+
class CompositeRMSDForceImpl : public CustomCPPForceImpl {
3030
public:
31-
ConcertedRMSDForceImpl(const ConcertedRMSDForce& owner) : CustomCPPForceImpl(owner), owner(owner) {}
31+
CompositeRMSDForceImpl(const CompositeRMSDForce& owner) : CustomCPPForceImpl(owner), owner(owner) {}
3232
void initialize(ContextImpl& context);
3333
double computeForce(ContextImpl& context, const vector<Vec3>& positions, vector<Vec3>& forces);
34-
const ConcertedRMSDForce& getOwner() const {
34+
const CompositeRMSDForce& getOwner() const {
3535
return owner;
3636
}
3737
void updateParametersInContext(ContextImpl& context);
3838
private:
3939
void updateParameters(int systemSize);
40-
const ConcertedRMSDForce& owner;
40+
const CompositeRMSDForce& owner;
4141
vector<vector<int>> groups;
4242
vector<Vec3> referencePos;
4343
};
4444

4545
} // namespace OpenMMCPPForces
4646

47-
#endif /*OPENMM_CONCERTEDRMSDFORCEIMPL_H_*/
47+
#endif /*OPENMM_COMPOSITERMSDFORCEIMPL_H_*/

openmmcppforces/src/ConcertedRMSDForce.cpp renamed to openmmcppforces/src/CompositeRMSDForce.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,46 @@
88
* https://github.com/craabreu/openmm-cpp-forces *
99
* -------------------------------------------------------------------------- */
1010

11-
#include "ConcertedRMSDForce.h"
12-
#include "internal/ConcertedRMSDForceImpl.h"
11+
#include "CompositeRMSDForce.h"
12+
#include "internal/CompositeRMSDForceImpl.h"
1313

1414
#include "openmm/internal/AssertionUtilities.h"
1515

1616
using namespace OpenMMCPPForces;
1717
using namespace OpenMM;
1818
using namespace std;
1919

20-
ConcertedRMSDForce::ConcertedRMSDForce(const vector<Vec3>& referencePositions) :
20+
CompositeRMSDForce::CompositeRMSDForce(const vector<Vec3>& referencePositions) :
2121
referencePositions(referencePositions) {
2222
}
2323

24-
void ConcertedRMSDForce::setReferencePositions(const std::vector<Vec3>& positions) {
24+
void CompositeRMSDForce::setReferencePositions(const std::vector<Vec3>& positions) {
2525
referencePositions = positions;
2626
}
2727

28-
int ConcertedRMSDForce::addGroup(const vector<int>& particles) {
28+
int CompositeRMSDForce::addGroup(const vector<int>& particles) {
2929
groups.push_back(particles);
3030
return groups.size()-1;
3131
}
3232

33-
int ConcertedRMSDForce::getNumGroups() const {
33+
int CompositeRMSDForce::getNumGroups() const {
3434
return groups.size();
3535
}
3636

37-
const vector<int>& ConcertedRMSDForce::getGroup(int index) const {
37+
const vector<int>& CompositeRMSDForce::getGroup(int index) const {
3838
ASSERT_VALID_INDEX(index, groups);
3939
return groups[index];
4040
}
4141

42-
void ConcertedRMSDForce::setGroup(int index, const std::vector<int>& particles) {
42+
void CompositeRMSDForce::setGroup(int index, const std::vector<int>& particles) {
4343
ASSERT_VALID_INDEX(index, groups);
4444
groups[index] = particles;
4545
}
4646

47-
void ConcertedRMSDForce::updateParametersInContext(Context& context) {
48-
dynamic_cast<ConcertedRMSDForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
47+
void CompositeRMSDForce::updateParametersInContext(Context& context) {
48+
dynamic_cast<CompositeRMSDForceImpl&>(getImplInContext(context)).updateParametersInContext(getContextImpl(context));
4949
}
5050

51-
ForceImpl* ConcertedRMSDForce::createImpl() const {
52-
return new ConcertedRMSDForceImpl(*this);
51+
ForceImpl* CompositeRMSDForce::createImpl() const {
52+
return new CompositeRMSDForceImpl(*this);
5353
}

openmmcppforces/src/ConcertedRMSDForceImpl.cpp renamed to openmmcppforces/src/CompositeRMSDForceImpl.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* https://github.com/craabreu/openmm-cpp-forces *
99
* -------------------------------------------------------------------------- */
1010

11-
#include "internal/ConcertedRMSDForceImpl.h"
11+
#include "internal/CompositeRMSDForceImpl.h"
1212

1313
#include "openmm/internal/CustomCPPForceImpl.h"
1414
#include "openmm/internal/ContextImpl.h"
@@ -22,16 +22,16 @@ using namespace OpenMM;
2222
using namespace std;
2323

2424

25-
void ConcertedRMSDForceImpl::updateParameters(int systemSize) {
25+
void CompositeRMSDForceImpl::updateParameters(int systemSize) {
2626
// Check for errors in the specification of particles.
2727
if (owner.getReferencePositions().size() != systemSize)
2828
throw OpenMMException(
29-
"ConcertedRMSDForce: Number of reference positions does not equal number of particles in the System"
29+
"CompositeRMSDForce: Number of reference positions does not equal number of particles in the System"
3030
);
3131

3232
int numGroups = owner.getNumGroups();
3333
if (numGroups == 0)
34-
throw OpenMMException("ConcertedRMSDForce: No particle groups have been specified");
34+
throw OpenMMException("CompositeRMSDForce: No particle groups have been specified");
3535

3636
groups.resize(numGroups);
3737
for (int i = 0; i < numGroups; i++) {
@@ -48,12 +48,12 @@ void ConcertedRMSDForceImpl::updateParameters(int systemSize) {
4848
for (int i : groups[k]) {
4949
if (i < 0 || i >= systemSize) {
5050
stringstream msg;
51-
msg << "ConcertedRMSDForce: Illegal particle index " << i << " in group " << k;
51+
msg << "CompositeRMSDForce: Illegal particle index " << i << " in group " << k;
5252
throw OpenMMException(msg.str());
5353
}
5454
if (distinctParticles.find(i) != distinctParticles.end()) {
5555
stringstream msg;
56-
msg << "ConcertedRMSDForce: Duplicated particle index " << i << " in group " << k;
56+
msg << "CompositeRMSDForce: Duplicated particle index " << i << " in group " << k;
5757
throw OpenMMException(msg.str());
5858
}
5959
distinctParticles.insert(i);
@@ -71,12 +71,12 @@ void ConcertedRMSDForceImpl::updateParameters(int systemSize) {
7171
}
7272
}
7373

74-
void ConcertedRMSDForceImpl::initialize(ContextImpl& context) {
74+
void CompositeRMSDForceImpl::initialize(ContextImpl& context) {
7575
CustomCPPForceImpl::initialize(context);
7676
updateParameters(context.getSystem().getNumParticles());
7777
}
7878

79-
double ConcertedRMSDForceImpl::computeForce(ContextImpl& context, const vector<Vec3>& positions, vector<Vec3>& forces) {
79+
double CompositeRMSDForceImpl::computeForce(ContextImpl& context, const vector<Vec3>& positions, vector<Vec3>& forces) {
8080
// Compute the RMSD and its gradient using the algorithm described in Coutsias et al,
8181
// "Using quaternions to calculate RMSD" (doi: 10.1002/jcc.20110). First subtract
8282
// the centroid from the atom positions. The reference positions have already been centered.
@@ -173,7 +173,7 @@ double ConcertedRMSDForceImpl::computeForce(ContextImpl& context, const vector<V
173173
return rmsd;
174174
}
175175

176-
void ConcertedRMSDForceImpl::updateParametersInContext(ContextImpl& context) {
176+
void CompositeRMSDForceImpl::updateParametersInContext(ContextImpl& context) {
177177
updateParameters(context.getSystem().getNumParticles());
178178
context.systemChanged();
179179
}

0 commit comments

Comments
 (0)