Skip to content

Commit

Permalink
Fixed error arising in one-particle sims (#62)
Browse files Browse the repository at this point in the history
* Fixed error arising in one-particle sims

For one particle simulations, the index 1 does not exist so it threw an error when trying to retrieve mass of particle with index 1

* Jeremy's suggested fix

* Added fix of openmm error to readthedocs

* attempt to fix automatic documentation
  • Loading branch information
henrik-dahl-pinholt authored Feb 21, 2023
1 parent 79d005f commit b51362e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
pip install cython
pip install -r requirements.txt
pip install -e .
conda install -c conda-forge libstdcxx-ng=12
- name: Test with pytest
run: |
pytest
19 changes: 18 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,24 @@ Polychrom requires OpenMM, which can be installed through conda: ``conda install

CUDA is the fastest GPU-assisted backend to OpenMM. You would need to have the required version of CUDA, or install OpenMM compiled for your version of CUDA.

Other dependencies are simple, and are listed in requirements.txt. All but joblib are installable from either conda/pip, and joblib installs well with pip.
Other dependencies are simple, and are listed in requirements.txt. All but joblib are installable from either conda/pip, and joblib installs well with pip.

Installation errors and possible fixes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Error:
After installation, importing openmm or running polychrom code leads to the error:

.. code-block:: console
version GLIBCXX_3.4.30 not found
Fix:

.. code-block:: console
conda install -c conda-forge libstdcxx-ng=12
Structure
Expand Down
2 changes: 1 addition & 1 deletion polychrom/polymer_analyses.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Code written by: Maksim Imakaev (imakaev@mit.edu)
"""
Analyses of polymer conformations
=================================
------------------------------
This module presents a collection of utils to work with polymer conformations.
Expand Down
2 changes: 1 addition & 1 deletion polychrom/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def print_stats(self):
bonds = np.sqrt(np.sum(np.diff(pos, axis=0) ** 2, axis=1))
sbonds = np.sort(bonds)
vel = state.getVelocities()
mass = self.system.getParticleMass(1)
mass = self.system.getParticleMass(0)
vkT = np.array(vel / simtk.unit.sqrt(self.kT / mass), dtype=float)
self.velocs = vkT
EkPerParticle = 0.5 * np.sum(vkT**2, axis=1)
Expand Down

0 comments on commit b51362e

Please sign in to comment.