Skip to content

Commit

Permalink
Changes conda host channel to mdtools (#34)
Browse files Browse the repository at this point in the history
* Added RDKit as dependency

* Initial implementation of VolumeOverlap CV

* Changes conda host channel to mdtools

* Revert "Initial implementation of VolumeOverlap CV"

This reverts commit 5726164.

* Revert "Added RDKit as dependency"

This reverts commit 12bbdc9.

* Fixed atomic_function doctest
  • Loading branch information
craabreu authored Dec 6, 2023
1 parent 323cd71 commit a195bc8
Show file tree
Hide file tree
Showing 5 changed files with 1,148 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Anaconda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
export CVPACK_VERSION=${{ github.ref_name }}
conda mambabuild . --no-anaconda-upload -c conda-forge --output-folder $outdir
echo "::endgroup::"
echo "::group::Uploading package to redesign-science conda channel"
echo "::group::Uploading package to mdtools conda channel"
PACKAGE=$(find $outdir -name *.tar.bz2 | head -1)
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
anaconda upload --user redesign-science --force --label main $PACKAGE
anaconda upload --user mdtools --force --label main $PACKAGE
echo "::endgroup::"
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Collective Variable Package
[![Documentation Status](https://github.com/RedesignScience/cvpack/workflows/Docs/badge.svg)](https://github.com/RedesignScience/cvpack/actions?query=workflow%3ADocs)
[![Coverage Report](https://redesignscience.github.io/cvpack/coverage/coverage.svg)](https://redesignscience.github.io/cvpack/coverage)

[![Conda cvpack version](https://img.shields.io/conda/v/redesign-science/cvpack.svg)](https://anaconda.org/redesign-science/cvpack)
[![Conda cvpack platforms](https://img.shields.io/conda/pn/redesign-science/cvpack.svg)](https://anaconda.org/redesign-science/cvpack)
[![Conda cvpack downloads](https://img.shields.io/conda/dn/redesign-science/cvpack.svg)](https://anaconda.org/redesign-science/cvpack)
[![Conda cvpack version](https://img.shields.io/conda/v/mdtools/cvpack.svg)](https://anaconda.org/mdtools/cvpack)
[![Conda cvpack platforms](https://img.shields.io/conda/pn/mdtools/cvpack.svg)](https://anaconda.org/mdtools/cvpack)
[![Conda cvpack downloads](https://img.shields.io/conda/dn/mdtools/cvpack.svg)](https://anaconda.org/mdtools/cvpack)

[![License](https://img.shields.io/badge/License-MIT-yellowgreen.svg?style=flat)](https://github.com/RedesignScience/cvpack/blob/main/LICENSE.md)
[![Twitter](https://badgen.net/badge/follow%20us/@RedesignScience?icon=twitter)](https://twitter.com/RedesignScience)
Expand Down Expand Up @@ -54,16 +54,16 @@ The CVs implemented in CVPack are listed in the table below.
### Installation and Usage

CVPack is available as a conda package on the
[redesign-science](https://anaconda.org/redesign-science/cvpack) channel. To install it, simply run:
[mdtools](https://anaconda.org/mdtools/cvpack) channel. To install it, run:

```bash
conda install -c conda-forge -c redesign-science cvpack
conda install -c conda-forge -c mdtools cvpack
```

Or, if you prefer to use [mamba](https://mamba.readthedocs.io/en/latest) instead of conda:
Or:

```bash
mamba install -c conda-forge -c redesign-science cvpack
mamba install -c mdtools cvpack
```

To use CVPack in your own Python script or Jupyter notebook, simply import it as follows:
Expand Down
28 changes: 16 additions & 12 deletions cvpack/atomic_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ def fromOpenMMForce(
Examples
--------
>>> import cvpack
>>> import numpy as np
>>> import openmm
>>> from collections import deque
>>> from cvpack import unit
>>> from openmm import app
>>> from openmmtools import testsystems
Expand All @@ -312,13 +312,15 @@ def fromOpenMMForce(
>>> mean_x = openmm.CustomExternalForce("x/num_atoms")
>>> mean_x.addGlobalParameter("num_atoms", num_atoms)
0
>>> deque(map(mean_x.addParticle, range(num_atoms), [[]] * num_atoms), maxlen=0)
deque([], maxlen=0)
>>> for i in range(num_atoms):
... _ = mean_x.addParticle(i, [])
>>> model.system.addForce(mean_x)
7
>>> forces = {force.getName(): force for force in model.system.getForces()}
>>> copies = {
... name: cvpack.AtomicFunction.fromOpenMMForce(force, unit.kilojoules_per_mole)
... name: cvpack.AtomicFunction.fromOpenMMForce(
... force, unit.kilojoules_per_mole
... )
... for name, force in forces.items()
... if name in [
... "HarmonicBondForce",
Expand All @@ -330,18 +332,20 @@ def fromOpenMMForce(
>>> copies["HelixTorsionContent"] = cvpack.AtomicFunction.fromOpenMMForce(
... helix_content, unit.dimensionless
... )
>>> [model.system.addForce(force) for force in copies.values()]
[8, 9, 10, 11, 12]
>>> indices = {}
>>> for index, (name, force) in enumerate(copies.items(), start=1):
... _ = model.system.addForce(force)
... force.setForceGroup(index)
... indices[name] = index
>>> platform = openmm.Platform.getPlatformByName('Reference')
>>> integrator = openmm.VerletIntegrator(0)
>>> context = openmm.Context(model.system, integrator, platform)
>>> context.setPositions(model.positions)
>>> for name, force in copies.items():
... forces[name].setForceGroup(1)
... state = context.getState(getEnergy=True, groups={1})
... value = state.getPotentialEnergy().value_in_unit(unit.kilojoules_per_mole)
... print(f"{name}: original={value:.6f}, copy={force.getValue(context, digits=6)}")
... forces[name].setForceGroup(0)
>>> for name in copies:
... state = context.getState(getEnergy=True, groups={indices[name]})
... value = state.getPotentialEnergy() / unit.kilojoules_per_mole
... copy_value = copies[name].getValue(context, digits=6)
... print(f"{name}: original={value:.6f}, copy={copy_value}")
HarmonicBondForce: original=2094.312483, copy=2094.312 kJ/mol
HarmonicAngleForce: original=3239.795215, copy=3239.795 kJ/mol
PeriodicTorsionForce: original=4226.051934, copy=4226.052 kJ/mol
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Installation

To install CVPack in a conda environment, run the following command::

conda install -c conda-forge -c redesign-science cvpack
conda install -c conda-forge -c mdtools cvpack

Or use mamba instead::

mamba install -c conda-forge -c redesign-science cvpack
mamba install -c mdtools cvpack

Usage
-----
Expand Down
Loading

0 comments on commit a195bc8

Please sign in to comment.