Skip to content

Commit

Permalink
big linting pass
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemhenry committed Feb 16, 2024
1 parent c18c89f commit 19b0c2f
Show file tree
Hide file tree
Showing 168 changed files with 5,548 additions and 5,646 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We are happy to get you started in using our software.
## Issues

If you think you have encountered a software issue, please raise this on the "Issues" tab in Github.
In general the more details you can provide the better,
In general the more details you can provide the better,
we recommend reading section 3.3 of [this article](https://livecomsjournal.org/index.php/livecoms/article/view/v3i1e1473)
to understand the problem solving process.

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ jobs:
# we only want to upload a slow report if
# 1) it isn't a schedule run
# 2) it wasn't from a PR (we don't run slow tests on PRs)
if: ${{ github.repository == 'OpenFreeEnergy/openfe'
&& github.event_name != 'schedule'
&& github.event_name != 'pull_request' }}
if: ${{ github.repository == 'OpenFreeEnergy/openfe'
&& github.event_name != 'schedule'
&& github.event_name != 'pull_request' }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/clean_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
micromamba list
- name: "Lint with mypy"
run: mypy
run: mypy
2 changes: 1 addition & 1 deletion Code_of_Conduct.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Code of Conduct ##

This project is dedicated to providing a welcoming and supportive environment for all people, regardless of background or identity. Members do not tolerate harassment for any reason, but especially harassment based on gender, sexual orientation, disability, physical appearance, body size, race, nationality, sex, color, ethnic or social origin, pregnancy, citizenship, familial status, veteran status, genetic information, religion or belief, political or any other opinion, membership of a national minority, property, age, or preference of text editor.
This project is dedicated to providing a welcoming and supportive environment for all people, regardless of background or identity. Members do not tolerate harassment for any reason, but especially harassment based on gender, sexual orientation, disability, physical appearance, body size, race, nationality, sex, color, ethnic or social origin, pregnancy, citizenship, familial status, veteran status, genetic information, religion or belief, political or any other opinion, membership of a national minority, property, age, or preference of text editor.


### Expected Behavior ###
Expand Down
63 changes: 23 additions & 40 deletions devtools/data/gen-serialized-results.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,32 @@
- MDProtocol_json_results.gz
- used in md_json fixture
"""

import gzip
import json
import logging
import pathlib
import tempfile
from openff.toolkit import (
Molecule, RDKitToolkitWrapper, AmberToolsToolkitWrapper
)
from openff.toolkit.utils.toolkit_registry import (
toolkit_registry_manager, ToolkitRegistry
)
from openff.units import unit
from kartograf.atom_aligner import align_mol_shape
from kartograf import KartografAtomMapper

import gufe
from gufe.tokenization import JSON_HANDLER
from kartograf import KartografAtomMapper
from kartograf.atom_aligner import align_mol_shape
from openff.toolkit import AmberToolsToolkitWrapper, Molecule, RDKitToolkitWrapper
from openff.toolkit.utils.toolkit_registry import ToolkitRegistry, toolkit_registry_manager
from openff.units import unit

import openfe
from openfe.protocols.openmm_md.plain_md_methods import PlainMDProtocol
from openfe.protocols.openmm_afe import AbsoluteSolvationProtocol
from openfe.protocols.openmm_md.plain_md_methods import PlainMDProtocol
from openfe.protocols.openmm_rfe import RelativeHybridTopologyProtocol


logger = logging.getLogger(__name__)

LIGA = "[H]C([H])([H])C([H])([H])C(=O)C([H])([H])C([H])([H])[H]"
LIGB = "[H]C([H])([H])C(=O)C([H])([H])C([H])([H])C([H])([H])[H]"

amber_rdkit = ToolkitRegistry(
[RDKitToolkitWrapper(), AmberToolsToolkitWrapper()]
)
amber_rdkit = ToolkitRegistry([RDKitToolkitWrapper(), AmberToolsToolkitWrapper()])


def get_molecule(smi, name):
Expand All @@ -58,21 +54,18 @@ def execute_and_serialize(dag, protocol, simname):
shared_basedir=workdir,
scratch_basedir=workdir,
keep_shared=False,
n_retries=3
n_retries=3,
)
protres = protocol.gather([dagres])

outdict = {
"estimate": protres.get_estimate(),
"uncertainty": protres.get_uncertainty(),
"protocol_result": protres.to_dict(),
"unit_results": {
unit.key: unit.to_keyed_dict()
for unit in dagres.protocol_unit_results
}
"unit_results": {unit.key: unit.to_keyed_dict() for unit in dagres.protocol_unit_results},
}

with gzip.open(f"{simname}_json_results.gz", 'wt') as zipfile:
with gzip.open(f"{simname}_json_results.gz", "wt") as zipfile:
json.dump(outdict, zipfile, cls=JSON_HANDLER.encoder)


Expand All @@ -95,27 +88,19 @@ def generate_ahfe_json(smc):
settings.solvent_simulation_settings.production_length = 500 * unit.picosecond
settings.vacuum_simulation_settings.equilibration_length = 10 * unit.picosecond
settings.vacuum_simulation_settings.production_length = 1000 * unit.picosecond
settings.lambda_settings.lambda_elec = [0.0, 0.25, 0.5, 0.75, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0]
settings.lambda_settings.lambda_vdw = [0.0, 0.0, 0.0, 0.0, 0.0, 0.12, 0.24,
0.36, 0.48, 0.6, 0.7, 0.77, 0.85,
1.0]
settings.lambda_settings.lambda_elec = [0.0, 0.25, 0.5, 0.75, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
settings.lambda_settings.lambda_vdw = [0.0, 0.0, 0.0, 0.0, 0.0, 0.12, 0.24, 0.36, 0.48, 0.6, 0.7, 0.77, 0.85, 1.0]
settings.protocol_repeats = 3
settings.solvent_simulation_settings.n_replicas = 14
settings.vacuum_simulation_settings.n_replicas = 14
settings.solvent_simulation_settings.early_termination_target_error = 0.12 * unit.kilocalorie_per_mole
settings.vacuum_simulation_settings.early_termination_target_error = 0.12 * unit.kilocalorie_per_mole
settings.vacuum_engine_settings.compute_platform = 'CPU'
settings.solvent_engine_settings.compute_platform = 'CUDA'
settings.vacuum_engine_settings.compute_platform = "CPU"
settings.solvent_engine_settings.compute_platform = "CUDA"

protocol = AbsoluteSolvationProtocol(settings=settings)
sysA = openfe.ChemicalSystem(
{"ligand": smc, "solvent": openfe.SolventComponent()}
)
sysB = openfe.ChemicalSystem(
{"solvent": openfe.SolventComponent()}
)
sysA = openfe.ChemicalSystem({"ligand": smc, "solvent": openfe.SolventComponent()})
sysB = openfe.ChemicalSystem({"solvent": openfe.SolventComponent()})

dag = protocol.create(stateA=sysA, stateB=sysB, mapping=None)

Expand All @@ -133,15 +118,13 @@ def generate_rfe_json(smcA, smcB):
mapper = KartografAtomMapper(atom_map_hydrogens=True)
mapping = next(mapper.suggest_mappings(smcA, a_smcB))

systemA = openfe.ChemicalSystem({'ligand': smcA})
systemB = openfe.ChemicalSystem({'ligand': a_smcB})
systemA = openfe.ChemicalSystem({"ligand": smcA})
systemB = openfe.ChemicalSystem({"ligand": a_smcB})

dag = protocol.create(
stateA=systemA, stateB=systemB, mapping=mapping
)
dag = protocol.create(stateA=systemA, stateB=systemB, mapping=mapping)

execute_and_serialize(dag, protocol, "RHFEProtocol")


if __name__ == "__main__":
molA = get_molecule(LIGA, "ligandA")
Expand Down
7 changes: 1 addition & 6 deletions docs/_ext/sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
from pathlib import Path
from typing import Optional, Union


import sass
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
from sphinx.util import logging


logger = logging.getLogger(__name__)


Expand All @@ -44,10 +42,7 @@ def get_targets(app: Sphinx) -> dict[Path, Path]:
if isinstance(app.config.sass_targets, dict):
targets = app.config.sass_targets
else:
targets = {
path: path.relative_to(src_dir).with_suffix(".css")
for path in src_dir.glob("**/[!_]*.s[ca]ss")
}
targets = {path: path.relative_to(src_dir).with_suffix(".css") for path in src_dir.glob("**/[!_]*.s[ca]ss")}

return {src_dir / src: dst_dir / dst for src, dst in targets.items()}

Expand Down
4 changes: 2 additions & 2 deletions docs/_sass/deflist-flowchart.scss
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ ul.deflist-flowchart {
margin-left: 0;
}
}

dl {
display: flex;
flex-direction: row-reverse;
Expand Down Expand Up @@ -394,4 +394,4 @@ ul.deflist-flowchart {
}
}
}
}
}
2 changes: 1 addition & 1 deletion docs/_static/API.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/CLI.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/Cookbook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/Download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 19b0c2f

Please sign in to comment.