Skip to content

Commit

Permalink
Merge branch 'main' into pytorch
Browse files Browse the repository at this point in the history
  • Loading branch information
b-butler committed Jan 9, 2024
2 parents 1a6b0c3 + 5a94ee8 commit 2a39172
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 32 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
rev: 'v4.5.0'
hooks:
- id: end-of-file-fixer
exclude: 'setup.cfg'
Expand All @@ -16,19 +16,19 @@ repos:
- id: debug-statements
- id: requirements-txt-fixer
- repo: https://github.com/asottile/pyupgrade
rev: 'v3.13.0'
rev: 'v3.15.0'
hooks:
- id: pyupgrade
args:
- --py38-plus
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
rev: '5.13.2'
hooks:
- id: isort
args:
- --profile=black
- repo: https://github.com/psf/black
rev: '23.9.1'
rev: '23.12.1'
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -38,7 +38,7 @@ repos:
args:
- --max-line-length=100
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.7.1
hooks:
- id: nbqa-pyupgrade
args:
Expand Down
2 changes: 1 addition & 1 deletion notebooks/signac_301_Aggregation_Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"\n",
"Aggregation allows a **signac-flow** operation to act on multiple jobs, rather than one job at a time.\n",
"\n",
"An aggregate is defined as a subset of the jobs in a **signac** project. Aggregates are generated when the `@flow.aggregator` decorator is applied to an operation.\n",
"An aggregate is defined as a subset of the jobs in a **signac** project. Aggregates are generated when a `flow.aggregator` object is provided to the `FlowProject.operation` decorator.\n",
"\n",
"Please refer to the [documentation](https://docs.signac.io/en/latest/aggregation.html) for detailed instructions on how to use aggregation."
]
Expand Down
4 changes: 2 additions & 2 deletions projects/flow.2D-random-walk/src/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
logger.setLevel(logging.ERROR)

# The standard deviations to use for generating random walk moves
STANDARD_DEVIATIONS = np.linspace(start=0.1, stop=1, num=20)
STANDARD_DEVIATIONS = np.linspace(start=0.1, stop=1, num=5)
NUMBER_REPLICAS = 100
RUN_STEPS = 5_000
RUN_STEPS = 10_000
MAX_SEED = 2**32 - 1


Expand Down
3 changes: 2 additions & 1 deletion projects/flow.2D-random-walk/src/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def plot_mean_squared_displacement(job):

@agg_analyze_and_plot
@RandomWalkProject.pre(all_simulated)
@RandomWalkProject.post.true("msd_analyzed")
@RandomWalkProject.pre(lambda *jobs: "squared_displacement" in jobs[0].data)
@RandomWalkProject.post(lambda *jobs: jobs[0].doc.get("msd_analyzed"))
@RandomWalkProject.operation(aggregator=std_aggregator)
def compute_mean_squared_displacement(*jobs):
"""Compute and store the mean squared displacement for all std."""
Expand Down
33 changes: 14 additions & 19 deletions projects/flow.gmx-lysozyme-in-water/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from flow import FlowProject

gmx_exec = "gmx" # or use gmx_mpi if available
mpi_exec = "mpirun"

"""Define file level constants."""

Expand Down Expand Up @@ -84,16 +83,10 @@ def _grompp_str(op_name, gro_name, checkpoint_file=None):
return cmd


def _mdrun_str(op_name, np=1, nt=None, verbose=False):
def _mdrun_str(op_name, nt=None, verbose=False):
"""Helper function, returns mdrun command string for operation."""
num_threads = 1 if nt is None else nt
num_nodes = np // num_threads
cmd = (
"OMP_NUM_THREADS={num_threads} {mpi_exec} -n {np} {gmx} "
"mdrun -ntomp {num_threads} {verbose} -deffnm {op}"
).format(
np=num_nodes,
mpi_exec=mpi_exec,
cmd = ("{gmx} mdrun -ntomp {num_threads} {verbose} -deffnm {op}").format(
gmx=gmx_exec,
num_threads=num_threads,
op=op_name,
Expand Down Expand Up @@ -165,7 +158,7 @@ def solvate(job):
@MyProject.post.isfile(ionization_config)
@MyProject.operation(cmd=True, with_job=True)
def grompp_add_ions(job):
return _grompp_str("ions", solvated_file)
return _grompp_str("ions", solvated_file).format(job)


@MyProject.pre.after(grompp_add_ions)
Expand Down Expand Up @@ -197,58 +190,60 @@ def ionize(job):
@MyProject.post.isfile(em_op + ".tpr")
@MyProject.operation(cmd=True, with_job=True)
def grompp_minim(job):
return _grompp_str("minim", ionized_file)
return _grompp_str("minim", ionized_file).format(job)


@MyProject.pre.after(grompp_minim)
@MyProject.post.isfile(em_file)
@MyProject.operation(cmd=True, with_job=True)
def minim(job):
return _mdrun_str("minim")
return _mdrun_str("minim").format(job)


# Equilibration: NVT then NPT
@MyProject.pre.after(minim)
@MyProject.post.isfile(nvt_op + ".tpr")
@MyProject.operation(cmd=True, with_job=True)
def grompp_nvt(job):
return _grompp_str("nvt", em_file)
return _grompp_str("nvt", em_file).format(job)


@MyProject.pre.after(grompp_nvt)
@MyProject.post.isfile(nvt_file)
@MyProject.operation(cmd=True, directives={"np": 16}, with_job=True)
def nvt(job):
return _mdrun_str("nvt")
return _mdrun_str("nvt").format(job)


@MyProject.pre.after(nvt)
@MyProject.post.isfile(npt_op + ".tpr")
@MyProject.operation(cmd=True, with_job=True)
def grompp_npt(job):
return _grompp_str("npt", nvt_file)
return _grompp_str("npt", nvt_file).format(job)


@MyProject.pre.isfile(npt_op + ".tpr")
@MyProject.post.isfile(npt_file)
@MyProject.operation(cmd=True, directives={"np": 16}, with_job=True)
def npt(job):
return _mdrun_str("npt")
return _mdrun_str("npt").format(job)


# Final run
@MyProject.pre.isfile(npt_file)
@MyProject.post.isfile(production_op + ".tpr")
@MyProject.operation(cmd=True, with_job=True)
def grompp_md(job):
return _grompp_str("md", npt_file)
return _grompp_str("md", npt_file).format(job)


@MyProject.pre.after(grompp_md)
@MyProject.post(finished)
@MyProject.operation(cmd=True, directives={"np": 16}, with_job=True)
@MyProject.operation(
cmd=True, directives={"nranks": 4, "omp_num_threads": 4}, with_job=True
)
def md(job):
return _mdrun_str("md")
return _mdrun_str("md", nt=4).format(job)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions projects/flow.gmx-mtools/src/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ def initialize(job):
@MyProject.post(minimized)
@MyProject.operation(cmd=True, with_job=True)
def em(job):
return gromacs_command(name="em", gro="init", sys="init")
return gromacs_command(name="em", gro="init", sys="init").format(job)


@MyProject.pre(minimized)
@MyProject.post(equilibrated)
@MyProject.operation(cmd=True, with_job=True)
def equil(job):
return gromacs_command(name="equil", gro="em", sys="init")
return gromacs_command(name="equil", gro="em", sys="init").format(job)


@MyProject.pre(equilibrated)
@MyProject.post(sampled)
@MyProject.operation(cmd=True, with_job=True)
def sample(job):
return gromacs_command(name="sample", gro="equil", sys="init")
return gromacs_command(name="sample", gro="equil", sys="init").format(job)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion projects/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for PROJECT in `ls -d */`; do
cat ${REQUIREMENTS_FILE}
mamba install --yes --file ${REQUIREMENTS_FILE} --quiet
fi
python flow-test.py ${PROJECT} -vv --timeout=600 $@
python flow-test.py ${PROJECT} -v --timeout=600 $@
if [[ "$CI" ]]; then
echo "::endgroup::"
fi
Expand Down

0 comments on commit 2a39172

Please sign in to comment.