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
41 changes: 20 additions & 21 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Publish release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+'
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
jobs:
publish-release:
runs-on: ubuntu-22.04
env:
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: pip install -e '.[dev]'
- run: python -m build
- name: Publish
run:
twine upload
-u ${{ secrets.PYPI_USERNAME }}
-p ${{ secrets.PYPI_PASSWORD }}
dist/*
publish-release:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- run: pip install -e '.[dev]'
- run: python -m build
- name: Publish
run: twine upload
-u ${{ secrets.PYPI_USERNAME }}
-p ${{ secrets.PYPI_PASSWORD }}
dist/*
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
jobs:
ruff:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -18,7 +18,7 @@ jobs:
- run: ruff check .

mypy:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -29,7 +29,7 @@ jobs:
- run: mypy src examples

ruff-format:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -41,7 +41,7 @@ jobs:

pytest:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
Expand All @@ -67,7 +67,7 @@ jobs:

example-tests:
# https://ericmjl.github.io/blog/2021/12/30/better-conda-environments-on-github-actions/
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
Expand All @@ -92,7 +92,7 @@ jobs:
run: python examples/testable_example.py

doctest:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
Expand Down
20 changes: 10 additions & 10 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "mambaforge-latest"
os: "ubuntu-lts-latest"
tools:
python: "mambaforge-latest"

sphinx:
configuration: "docs/source/conf.py"
configuration: "docs/source/conf.py"

conda:
environment: "docs/environment.yml"
environment: "docs/environment.yml"

python:
install:
- method: pip
path: .
extra_requirements:
- dev
install:
- method: pip
path: .
extra_requirements:
- dev
25 changes: 21 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,34 @@ Some optional dependencies are only available through conda:

.. code-block:: bash

# for OpenMM and espaloma charge
# note the temporary issue with rdkit versions and conda will overwrite pip
# installed software
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

With OpenMM
-----------

To get ``stko`` and use ``OpenMM``, we had some installation issues. The
current solution is to first, in a new environment, install the ``OpenMM``
requirements:

.. code-block:: bash

# for OpenMM and espaloma charge
# note the temporary issue with rdkit versions and conda will overwrite pip
# installed software
mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge

Then install ``stko`` with pip:

.. code-block:: bash

pip install stko


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

Expand Down
24 changes: 20 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,33 @@ Some optional dependencies are only available through conda:

.. code-block:: bash

# for OpenMM and espaloma charge
# note the temporary issue with rdkit versions and conda will overwrite pip
# installed software
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

With OpenMM
-----------

To get :mod:`.stko` and use ``OpenMM``, we had some installation issues. The
current solution is to first, in a new environment, install the ``OpenMM``
requirements:

.. code-block:: bash

# for OpenMM and espaloma charge
# note the temporary issue with rdkit versions and conda will overwrite pip
# installed software
mamba install -c conda-forge pytorch==2.3.1 torchdata==0.7.1 openff-toolkit openmm openmmtools dgl rdkit==2024.3.4 espaloma_charge

Then install :mod:`.stko` with pip:

.. code-block:: bash

pip install stko

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

Expand Down
4 changes: 3 additions & 1 deletion examples/cage_analysis_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

import stko

logger = logging.getLogger(__name__)


def main() -> None:
"""Run the example."""
logging.warning(
logger.warning(
"This code is only present in the latest versions of stko that "
"require Python 3.11!"
)
Expand Down
8 changes: 5 additions & 3 deletions examples/cage_openmm_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import stko

logger = logging.getLogger(__name__)


def integrator(
*,
Expand Down Expand Up @@ -118,14 +120,14 @@ def main() -> None:
),
),
)
logging.info("starting calculations...")
logger.info("starting calculations...")
st = time.time()
optimised_cage = optimisation_sequence.optimize(cage)
et = time.time()
logging.info("calculations done!")
logger.info("calculations done!")

optimised_cage.write(output_directory / "opt_cage.mol")
logging.info(
logger.info(
"cage energy: %s kJmol-1 in %s s",
stko.OpenMMEnergy(
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
Expand Down
10 changes: 5 additions & 5 deletions examples/intermediates_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import stko

logger = logging.getLogger(__name__)


def main() -> None:
"""Run the example."""
Expand All @@ -23,16 +25,14 @@ def main() -> None:
cage_graphs = stko.topology_functions.UnreactedTopologyGraph(
stk.cage.FourPlusSix((bb1, bb2))
)
logging.info(
logger.info(
"there are %s possible reactions",
len(cage_graphs.get_available_reactions()),
)

# With up to N reactions performed.
intermediate_pool = cage_graphs.get_named_intermediates(n=4)
logging.info(
"there are %s structures with n=%s", len(intermediate_pool), 4
)
logger.info("there are %s structures with n=%s", len(intermediate_pool), 4)
for named_intermediate in intermediate_pool.intermediates:
named_intermediate.molecule.write(
examples_output / f"{named_intermediate.intermediate_name}.mol"
Expand All @@ -41,7 +41,7 @@ def main() -> None:
# Now iterate over all possible reactions with varying amounts of
# completeness and get their smiles.
all_possible_smiles = cage_graphs.get_reacted_smiles()
logging.info("there are %s unique smiles", len(all_possible_smiles))
logger.info("there are %s unique smiles", len(all_possible_smiles))


if __name__ == "__main__":
Expand Down
8 changes: 5 additions & 3 deletions examples/openmm_hg_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

import stko

logger = logging.getLogger(__name__)


def integrator(
*,
Expand Down Expand Up @@ -116,14 +118,14 @@ def main() -> None:
),
),
)
logging.info("starting calculations...")
logger.info("starting calculations...")
st = time.time()
optimised_complex = optimisation_sequence.optimize(hg_complex)
et = time.time()
logging.info("calculations done!")
logger.info("calculations done!")

optimised_complex.write(output / "opt_complex.mol")
logging.info(
logger.info(
"hgcomplex energy: %s kJmol-1 in %s s",
stko.OpenMMEnergy(
force_field=ForceField("openff_unconstrained-2.1.0.offxml"),
Expand Down
2 changes: 2 additions & 0 deletions examples/optwrite_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import stko

logger = logging.getLogger(__name__)


def main() -> None:
"""Run the example."""
Expand Down
4 changes: 3 additions & 1 deletion examples/testable_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

from stko import WrapperNotInstalledError

logger = logging.getLogger(__name__)


def main() -> None:
"""Run the example."""
Expand All @@ -43,7 +45,7 @@ def main() -> None:
torsion_example.main()
zmatrix_example.main()
optwrite_example.main()
logging.info("all examples ran, at least!")
logger.info("all examples ran, at least!")

finally:
os.chdir(init_dir)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ maintainers = [
{ name = "Lukas Turcani", email = "lukasturcani93@gmail.com" },
]
dependencies = [
"numpy",
"numpy<2",
# Pinned while rdkit changes stk results.
"rdkit == 2024.3.4",
"stk",
Expand Down
10 changes: 5 additions & 5 deletions src/stko/_internal/optimizers/xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def _run_optimizations(
# case, exit optimization loop and warn.
self.incomplete.add(mol)
msg = f"Small negative frequencies present in {mol}."
logging.warning(msg)
logger.warning(msg)
return mol, opt_complete
else:
# Optimization is complete.
Expand Down Expand Up @@ -482,7 +482,7 @@ def optimize(self, mol: MoleculeT) -> MoleculeT:
if not complete:
self.incomplete.add(mol)
msg = f"Optimization is incomplete for {mol}."
logging.warning(msg)
logger.warning(msg)

return mol

Expand Down Expand Up @@ -881,7 +881,7 @@ def optimize(self, mol: MoleculeT) -> MoleculeT:

if not complete:
msg = f"CREST run is incomplete for {mol}."
logging.warning(msg)
logger.warning(msg)

return mol

Expand Down Expand Up @@ -1122,7 +1122,7 @@ def optimize(self, mol: MoleculeT) -> MoleculeT:

if not complete:
msg = f"Optimization is incomplete for {mol}."
logging.warning(msg)
logger.warning(msg)

return mol

Expand Down Expand Up @@ -1473,6 +1473,6 @@ def optimize(self, mol: MoleculeT) -> MoleculeT:

if not complete:
msg = f"CREST run is incomplete for {mol}."
logging.warning(msg)
logger.warning(msg)

return mol
Loading