Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
219 changes: 109 additions & 110 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,118 +1,117 @@
name: Tests
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
ruff:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install '.[dev]'"
- run: ruff check .
ruff:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install '.[dev]'"
- run: ruff check .

mypy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: mypy src examples
mypy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: mypy src examples

ruff-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: ruff format --check .
ruff-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: "pip install -e '.[dev]'"
- run: ruff format --check .

pytest:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge,defaults
python-version: 3.11
activate-environment: pytest
use-mamba: true
- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
conda install -c conda-forge mdanalysis openbabel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
- run: pytest
pytest:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}

example-tests:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge,defaults
python-version: 3.11
activate-environment: pytest
use-mamba: true
- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
conda install -c conda-forge mdanalysis openbabel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
- name: Run script
run: python examples/testable_example.py
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3

doctest:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge,defaults
python-version: 3.11
activate-environment: pytest
use-mamba: true
- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
conda install -c conda-forge mdanalysis openbabel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
- run: make -C docs doctest
with:
miniforge-version: latest
python-version: 3.11
activate-environment: pytest

- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
conda install -c conda-forge mdanalysis openbabel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
- run: pytest

example-tests:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3

with:
miniforge-version: latest
python-version: 3.11
activate-environment: pytest

- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
conda install -c conda-forge mdanalysis openbabel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
- name: Run script
run: python examples/testable_example.py

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

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3

with:
miniforge-version: latest
python-version: 3.11
activate-environment: pytest

- name: Build environment
run: |
conda activate pytest
conda install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
conda install -c conda-forge mdanalysis openbabel
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install -e '.[dev]'
- run: make -C docs doctest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ tests/failures.txt
/examples/.model.pt

/examples/*/md_optimisation
.model.pt
20 changes: 19 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,32 @@ Some optional dependencies are only available through conda:
# for OpenMM and espaloma charge
# note the temporary issue with rdkit versions and conda will overwrite pip
# installed software
mamba install -c conda-forge openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
# for xtb
mamba install xtb
# for openbabel
mamba install openbabel
# for mdanalysis
mamba install mdanalysis

Developer Setup
---------------

1. Install `just`_.
2. In a new virtual environment run:

.. code-block:: bash

just dev

3. Run code checks:

.. code-block:: bash

just check

.. _`just`: https://github.com/casey/just

Examples
========

Expand Down
4 changes: 2 additions & 2 deletions docs/source/cage_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ We can get measures of pore size and cage geometry.
.. testcode:: analysing-cage
:hide:

assert analyser.get_min_centroid_distance(apdcage) == 6.612215150137052
assert np.isclose(analyser.get_min_centroid_distance(apdcage), 6.612215150137052)

Giving:

Expand All @@ -274,4 +274,4 @@ Giving:

import shutil

shutil.rmtree('cage_output')
shutil.rmtree('cage_output')
21 changes: 19 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
Welcome to stko's documentation!
================================

GitHub: https://github.com/JelfsMaterialsGroup/stko
| GitHub: https://github.com/JelfsMaterialsGroup/stko
| Discord: https://discord.gg/zbCUzuxe2B

.. tip::

⭐ Star us on `GitHub <https://github.com/JelfsMaterialsGroup/stko>`_! ⭐

Install
=======
Expand All @@ -42,14 +46,27 @@ Some optional dependencies are only available through conda:
# for OpenMM and espaloma charge
# note the temporary issue with rdkit versions and conda will overwrite pip
# installed software
mamba install -c conda-forge openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge
# for xtb
mamba install xtb
# for openbabel
mamba install openbabel
# for mdanalysis
mamba install mdanalysis

Developer Setup
---------------

#. Install `just`_.
#. In a new virtual environment run::

$ just dev

#. Run code checks::

$ just check

.. _`just`: https://github.com/casey/just

Dependencies
------------
Expand Down
10 changes: 10 additions & 0 deletions docs/source/molecular.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ Atoms, Functional Groups and Molecules
ThreeSiteFactory <_autosummary/stko.functional_groups.ThreeSiteFactory>


Molecular utilities
-------------------

.. toctree::
:maxdepth: 1

separate_molecule <_autosummary/stko.molecular_utilities.separate_molecule>
merge_stk_molecules <_autosummary/stko.molecular_utilities.merge_stk_molecules>
update_stk_from_rdkit_conformer <_autosummary/stko.molecular_utilities.update_stk_from_rdkit_conformer>

Molecular Analysis
------------------

Expand Down
16 changes: 5 additions & 11 deletions examples/cage_analysis_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,14 @@ def main() -> None:
# Distance between binders in the organic linkers?
print(f"avg. binder distance: {np.mean(ligand_dict['binder_dist'])}")
# How twisted is the molecule, or aligned are the binding groups?
print(
"avg. binder binder angle: " f"{np.mean(ligand_dict['binder_binder'])}"
)
print(f"avg. binder binder angle: {np.mean(ligand_dict['binder_binder'])}")
# How twisted is the molecule, or what is the torsion between
# the binding groups?
print(
"avg. binder adjacent torsion: " f"{np.mean(ligand_dict['torsion'])}"
)
print(f"avg. binder adjacent torsion: {np.mean(ligand_dict['torsion'])}")
# What is the angle made by the binders?
print(f"avg. binder angles: {np.mean(ligand_dict['binder_angle'])}")
# And the resultant bite-angle [caution!]?
print(
"avg. bite angle [caution]: " f"{np.mean(ligand_dict['bite_angle'])}"
)
print(f"avg. bite angle [caution]: {np.mean(ligand_dict['bite_angle'])}")

# Get the centroid and atom ids of distinct building blocks.
# This is similar to the above, but does not perform any disconnections
Expand Down Expand Up @@ -133,11 +127,11 @@ def main() -> None:
# And some geometrical measures.
print(
f"avg. N-Pd bond length:"
f' {np.mean(analyser.calculate_bonds(apdcage)[("N", "Pd")])}'
f" {np.mean(analyser.calculate_bonds(apdcage)[('N', 'Pd')])}"
)
print(
f"N-Pd-N angles: "
f'{analyser.calculate_angles(apdcage)[("N", "Pd", "N")]}'
f"{analyser.calculate_angles(apdcage)[('N', 'Pd', 'N')]}"
)


Expand Down
2 changes: 1 addition & 1 deletion examples/obabel_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def main() -> None:

# Define spacer building block.
bb3 = stk.BuildingBlock(
smiles=("C1=CC(C2=CC=C(Br)C=C2)=C" "C=C1Br"),
smiles=("C1=CC(C2=CC=C(Br)C=C2)=CC=C1Br"),
functional_groups=[stk.BromoFactory()],
)

Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ docs:
# Install development environment.
dev:
pip install -e '.[dev]'
mamba install -y -c conda-forge openff-toolkit openmm openmmtools rdkit==2024.3.4 dgl espaloma_charge
mamba install -y -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools rdkit!=2024.3.5 dgl espaloma_charge
mamba install -y xtb
mamba install -y openbabel
mamba install -y mdanalysis
Expand Down
Loading
Loading