Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
af31ef6
Update dependencies
May 1, 2026
68a6091
Add type information
May 3, 2026
1a4fc94
Add ENM base class
May 4, 2026
561496c
Eigenvalues and -vectors as class attributes
May 4, 2026
f68114f
Moved shared nma calls into ENM base class
May 4, 2026
4e6e697
Move adjacency calculation into ENM base class and Kirchhoff/Hessian
May 8, 2026
cdb82a3
Make ENM.eigen() be able to return number of zero eigenvalues
May 8, 2026
ea615ae
Boost test coverage for GNM and ANM
May 9, 2026
364f1a8
Make ForceField updatable
May 9, 2026
46a97f1
Fix ForceField test
May 10, 2026
aabd0c3
Add benchmark dependency
May 10, 2026
8925369
Fix inverse calculation
May 11, 2026
53855aa
Merge branch 'base-class' into perturbation
May 11, 2026
7b5881f
Add covariance perturbation for GNM
May 11, 2026
24a2be6
Fix covariance perturbation
May 12, 2026
c4d4a00
Restructure covariance perturbation
May 13, 2026
b658ad7
Further covariance perturbation restructuring and optimization
May 13, 2026
460417e
Initial ANM covariance perturbation
May 15, 2026
39d2795
Add cython setup for eigenvalue perturbation
May 17, 2026
c6ecc33
Sync changes with branches
May 17, 2026
077f84c
Use covariance matrix for msqf if available
May 17, 2026
fb18abf
ANM msqf tests
May 18, 2026
8c248d8
Add frequency perturbation
May 18, 2026
bc36226
Generalize modify_contact algorithm
May 21, 2026
6c9c060
Merge branch eigen-perturbation into perturbation; update to covariance
May 21, 2026
09dacde
Rework modify_atom
May 26, 2026
16708de
Merge branch 'perturbation' into base-class; upstream changes
May 26, 2026
0a6d5b1
Merge branch 'base-class' into perturbation; mean square fluctuation
May 26, 2026
01657f1
revert changes to interaction calculation
May 30, 2026
4443f9d
Make enm.eigen() return nb of zero eigenvalues instead of zero mask
May 30, 2026
435ddb7
Streamline msqf calculation and use covariance if possible
May 31, 2026
2f060f2
Merge branch 'base-class' into perturbation; eigen and msqf update
Jun 1, 2026
89ddfde
Fix tests
Jun 1, 2026
c5c0ea5
Interaction with higher precision and ForceField test with .cif file
Jun 1, 2026
fd55216
Remove duplicate test data
Jun 1, 2026
34db29e
Add msqf and bfactor one-rank perturbation
Jun 1, 2026
7330be5
Merge branch 'perturbation' into eigen-perturbation
Jun 2, 2026
99616d8
Add frequency perturbation
Jun 3, 2026
eb30109
Change functions names from '_pert' to _chng'
Jun 3, 2026
b341dfb
Add msqf and bfactor algorithm for subsets
Jun 3, 2026
9263a14
Rework dcc calculation and add dcc one-rank update
Jun 4, 2026
b6b0135
Function and variable renaming
Jun 4, 2026
1db6a98
Docstring corrections
Jun 4, 2026
872902b
Docstring overhaul
Jun 5, 2026
5c28bee
Update README and advanced documentation
Jun 5, 2026
7899877
github actions update
Jun 5, 2026
2d91503
Fix doc deploy env
Jun 6, 2026
9b15662
Fix githuib workflows
Jun 6, 2026
3382454
Workflow fix
Jun 6, 2026
80a508c
Update test.yml
Jun 6, 2026
a2c3efa
Change build system to hatch
Jun 7, 2026
b55a30e
Fix cython args and changes to deploy workflow
Jun 7, 2026
8cd643a
Update deploy.yml
Jun 7, 2026
46f5248
Update deploy.yml
Jun 7, 2026
0d0661b
Remove unnecessary hatch dev env and fix build-docs in deploy workflow
Jun 7, 2026
099b8c3
Update deploy.yml
Jun 7, 2026
df81110
Finalize deploy workflow
Jun 7, 2026
a165ae0
Fix to modify_contact
Jun 7, 2026
18e5d2a
Merge branch 'eigen-perturbation' into perturbation; NMA perturbation,
Jun 7, 2026
fcbd3b2
Merge branch 'perturbation' into base-class; numpy docstrings and hatch
Jun 8, 2026
c51e3d7
Prs test with cif
Jun 8, 2026
c87dda2
fix deploy workflow
Jun 8, 2026
38456cc
Remove unused import
Jun 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 45 additions & 51 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,54 @@ name: Building and deploying Springcraft

on:
release:
types:
- published
types:
- published
workflow_dispatch: {}

jobs:
build-distribution:
name: Building distribution

build-dist:
name: Build distribution
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
activate-environment: springcraft-dev
auto-update-conda: true
python-version:"3.12"
- name: Installing dependencies
run: conda install -c conda-forge poetry
- name: Building distributions
run: poetry build
- uses: actions/upload-artifact@v4
python-version: "3.12"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install hatch
run: pip install hatch
- name: Build dist
run: hatch build
- uses: actions/upload-artifact@v7
with:
name: Springcraft distribution
name: release-dist
path: dist/*
if-no-files-found: error


build-doc:

build-docs:
name: Building documentation
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
- uses: actions/checkout@v6
- uses: conda-incubator/setup-miniconda@v4
with:
activate-environment: springcraft-dev
auto-update-conda: true
python-version:"3.12"
miniforge-version: latest
environment-file: environment.yml
activate-environment: springcraft-docs
mamba-version: "*"
- name: Installing Springcraft
run: pip install .
run: pip install .[docs]
- name: Building documentation
run: sphinx-build ./doc ./build/doc
run: sphinx-build doc build/doc
- name: Zipping documentation
run: cd ./build; zip -r doc.zip doc; cd ..
- uses: actions/upload-artifact@v4
run: cd build; zip -r doc.zip doc; cd ..
- uses: actions/upload-artifact@v7
with:
name: Springcraft documentation
name: release-doc
path: build/doc.zip
if-no-files-found: error

Expand All @@ -67,25 +59,27 @@ jobs:
contents: write
id-token: write
needs:
- lint
- test
- build-dist
- build-docs
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/project/springcraft/
steps:
- uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
path: dist
- name: List distributions to be uploaded
run: ls dist
- name: Upload to GitHub Releases
uses: softprops/action-gh-release@v2.0.5
if: github.event_name == 'release' && github.event.action == 'published'
with:
files: dist/*
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && github.event.action == 'published'
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
pattern: release-*
merge-multiple: true
path: dist
- name: List distributions to be uploaded
run: ls dist
- name: Upload to GitHub Releases
if: github.event_name == 'release' && github.event.action == 'published'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} dist/* --clobber
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release' && github.event.action == 'published'
50 changes: 23 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
name: Testing Springcraft

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
lint:
name: Check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install ruff
run: pip install ruff==0.5.2
- name: Check code formatting
run: ruff format --diff
- name: Lint code base
run: ruff check
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install Hatch
run: pip install hatch
- name: Run linting
run: hatch run lint:run

test:
name: Testing

runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
activate-environment: springcraft-dev
auto-update-conda: true
python-version: "3.12"
- name: Installing dependencies
run: conda install -c conda-forge poetry pytest
- name: Building distribution
run: poetry build -f wheel
- name: Installing distribution
run: pip install ./dist/*.whl
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install Hatch
run: pip install hatch
- name: Testing code
run: pytest
run: hatch run test:run
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ __pycache__/
*$py.class

# C extensions
*.c
*.cpp
*.so

# Autogenerated example gallery
Expand Down Expand Up @@ -139,6 +141,9 @@ dmypy.json
.vscode/*
profile.json

# Zed
.zed/*

# Temporarily disable freezing of dependency versions
poetry.lock

Expand Down
65 changes: 58 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Installation

$ pip install springcraft

or
or

.. code-block:: console

Expand All @@ -41,12 +41,63 @@ via *pip*:
$ git clone https://github.com/biotite-dev/springcraft.git
$ pip install ./springcraft

A development conda environment with all required dependencies for testing
can be installed from `environment.yml`
Development
-----------

Scripts to generate reference files for tests are stored in tests/data;
a separate environment to rerun these locally can be found in `test_create_data_env.yml`.
BioPhysConnectoR has to be installed separately.
Conda Environment
~~~~~~~~~~~~~~~~~

You can use conda's optimized libraries for development by creating the provided
conda enviroment in `environment.yml` and than installing the project in editable
mode. This creates symlinks from conda environment to your project files so that
changes are synced directly.

.. code-block:: console

$ mamba env create -f environment.yml
$ mamba activate springcraft-dev
$ pip install -e .

Linting is done by `ruff` and tests are resolved by `pytest`. After installing the
dependencies into the conda env you can run them by

.. code-block:: console

$ pip install -e .[lint,test]
$ ruff check . # run linter
$ pytest # run test
$ pytest --cov=springcraft --cov-report=html --cov-branch # run test with coverage

You can lint the numpy docstrings using `numpydoc` and built the documentation with
`sphinx-build` like this

.. code-block:: console

$ pip install -e .[docs]
$ python -m numpydoc lint src/springcraft/*.py
$ sphinx-build doc build/doc

Hatch Virtual Environment
~~~~~~~~~~~~~~~~~~~~~~~~~

You can also Hatch's virtual environment system. After installing `hatch` all further
dependency management will be done by `hatch` itself. Dependencies will be installed
into a virtual environment. Just run the following:

.. code-block:: console

$ hatch run lint:run # run linter
$ hatch run test:run # run tests
$ hatch run docs:lint # run linter on docstrings

Building the documentation does not work using hatch. Use the conda env instead.

Generate test files
~~~~~~~~~~~~~~~~~~~

Scripts to generate reference files for tests are stored in tests/data;
a separate environment to rerun these locally can be found in `environment-test-data.yml`.
BioPhysConnectoR has to be installed separately.

Example
=======
Expand Down Expand Up @@ -91,4 +142,4 @@ Output:
[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. 0. 0. 0. -1. 4. -1. -1. 0.]
[ 0. 0. 0. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. -1. 5. -1. -1.]
[ 0. -1. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. -1. 5. -1.]
[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. -1. 2.]]
[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. -1. 2.]]
12 changes: 7 additions & 5 deletions doc/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Advanced usage
Adding or removing contacts between atoms
-----------------------------------------
Altering the contacts between two atom can be achieved using the
:class:`PatchedForceField`.
It wraps another :class:`ForceField` and applied custom changes to it.
As example the contact between the first and second residue should be removed.
:class:`PatchedForceField` or by modifying the model directly.

The :class:`PatchedForceField` wraps another :class:`ForceField` and applied
custom changes to it. As example the contact between the first and second
residue should be removed.

.. code-block:: python
Expand Down Expand Up @@ -62,10 +64,10 @@ For the purpose of an example a chimeric force field is created
self._type_ff(atom_i, atom_j, sq_distance) *
self._dist_ff(atom_i, atom_j, sq_distance)
)
@property
def natoms(self):
return self._type_ff.natoms
ff = ChimericForceField(atoms)
ff = ChimericForceField(atoms)
38 changes: 33 additions & 5 deletions doc/apidoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,47 @@ API Reference
:depth: 3


Network models
Network Models
--------------

.. autoclass:: GNM
:members:

Normal Mode Analysis
~~~~~~~~~~~~~~~~~~~~
.. automethod:: frequencies
.. automethod:: mean_square_fluctuation
.. automethod:: bfactor
.. automethod:: dcc

|

.. autoclass:: ANM
:members:


Normal Mode Analysis
~~~~~~~~~~~~~~~~~~~~
.. automethod:: frequencies
.. automethod:: mean_square_fluctuation
.. automethod:: bfactor
.. automethod:: dcc

|

.. autoclass:: springcraft.enm.ENM

.. automethod:: eigen


Normal Mode Analysis
--------------------

.. autofunction:: springcraft.nma.frequencies

.. autofunction:: springcraft.nma.mean_square_fluctuation

.. autofunction:: springcraft.nma.bfactor

.. autofunction:: springcraft.nma.dcc


Force Fields
------------
Expand Down Expand Up @@ -56,4 +84,4 @@ Miscellaneous

.. autofunction:: compute_kirchhoff

.. autofunction:: compute_hessian
.. autofunction:: compute_hessian
Loading