Skip to content

Add Equilibration Layer#608

Merged
lilyminium merged 28 commits intomainfrom
add-equilibration-layer
Mar 25, 2025
Merged

Add Equilibration Layer#608
lilyminium merged 28 commits intomainfrom
add-equilibration-layer

Conversation

@lilyminium
Copy link
Contributor

@lilyminium lilyminium commented Jan 21, 2025

Description

Fixes #607
Fixes #616
Fixes #609

This peels off code from #603.
It relies on additions in #602 and #606 to work.

Adds:

  • StoredEquilibrationData (for data storage)
  • EquilibrationDataQuery (for data retrieval)
  • EquilibrationProperty (for convergence)
  • EquilibrationSchema, EquilibrationLayer, base classes
  • additional convergence conditions for multi-property convergence and any/all specification
  • allowing UNDEFINED properties to store data

To do:

  • add tests for requiring a number of uncorrelated samples

@lilyminium lilyminium mentioned this pull request Jan 23, 2025
1 task
@mattwthompson mattwthompson added this to the 0.4.11 milestone Jan 28, 2025
@mattwthompson mattwthompson mentioned this pull request Jan 28, 2025
lilyminium and others added 17 commits January 29, 2025 10:59
* add easy way to create new substances

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add new conditions and tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add nobatch

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 24.10.0 → 25.1.0](psf/black@24.10.0...25.1.0)
- [github.com/PyCQA/isort: 5.13.2 → 6.0.0](PyCQA/isort@5.13.2...6.0.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add failing test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add __init__ method

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Automatically strip out `openmm.CMMotionRemover` force internally

* More consistently strip force
* add nobatch

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add fix

* add helper test functions

* add test data

* Revert "add fix"

This reverts commit 3d9f043.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert "Revert "add fix""

This reverts commit 79a8bea.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Matthew W. Thompson <mattwthompson@protonmail.com>
@codecov
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.59%. Comparing base (c5c5292) to head (f0b9322).
Report is 21 commits behind head on main.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jaclark5 jaclark5 assigned jaclark5 and unassigned jaclark5 Mar 10, 2025
@lilyminium
Copy link
Contributor Author

Installing a new dev environment from the conda env file caused an equilibration on Slurm to hang for me. Changing the below helped:

  • dask 2024.2.1 -> 2024.12.1
  • installing OpenEye

I'm not sure which one of these resulted in the fix; maybe charge assignment was hanging? Just a note to self in case this should be looked into.

if isinstance(data_object.force_field_id, PlaceholderValue):
data_object.force_field_id = batch.force_field_id
if isinstance(data_object.source_calculation_id, PlaceholderValue):
data_object.source_calculation_id = batch.id
data_object.calculation_layer = layer_name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has effects for previously stored simulation data, although hopefully not large ones.

if returned_output.physical_property == UNDEFINED:
if (
returned_output.physical_property == UNDEFINED
or returned_output.physical_property.value == UNDEFINED
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not sure the first condition in this if statement (the one originally present) would have ever triggered; for an empty result, it's the .value that's UNDEFINED. Nevertheless could have unforeseen effects

Comment on lines +199 to +207
if workflow_result.value != UNDEFINED:
physical_property.value = workflow_result.value.value
physical_property.uncertainty = workflow_result.value.error

if len(workflow_result.gradients) > 0:
physical_property.gradients = workflow_result.gradients
else:
physical_property.value = UNDEFINED
physical_property.uncertainty = UNDEFINED
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, I think this was a real bug where physical properties that couldn't be computed would just run into an error here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems likely to me!

@@ -60,7 +64,11 @@ def validate(self, attribute_type=None):
assert all(isinstance(x, EvaluatorException) for x in self.exceptions)


class CalculationLayerSchema(AttributeClass):
class BaseCalculationLayerSchema(AttributeClass):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few base classes... I think this was early on and the code may have actually evolved to never use these, but it seems useful to have a base "this is Evaluator" flag that doesn't contain actual code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like base classes

return return_object
# EquilibrationDataExistsException actually represents
# a "successful" short-circuit
if "EquilibrationDataExistsException" not in str(protocol_results):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat hacky but specific enough that it shouldn't be raised in the general case.


# TODO: should this be hardcoded?
# TODO: it is hardcoded in protocols already
if key == "component_data":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See todos -- not sure this should be hardcoded, but it is in the protocols already (and for the existing reweighting layer too)

@lilyminium lilyminium marked this pull request as ready for review March 18, 2025 21:44
@lilyminium
Copy link
Contributor Author

lilyminium commented Mar 18, 2025

There's a lot of test files here, we should maybe re-visit tarballing files and I should have a look at what should be removed? I was a bit 50/50 on how useful these were as a record of "this is what you can expect during a run" vs whether all these files should be cluttering up the repo. I think most of the files necessary are just the jsons and maybe pdbs and xmls.

Copy link
Member

@mattwthompson mattwthompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agreed on the path forward

  1. Merge this approximately as-is (@lilyminium gets to press the button!)
  2. Lily has a follow-up PR soon in the works
  3. Tag a beta release
  4. Run some re-fit(s)
  5. (somewhat ambiguously) go from there

@mattwthompson
Copy link
Member

Oh, and leaving test files as-is but (later) looking into zipping them

@lilyminium
Copy link
Contributor Author

Thanks for the review and summary @mattwthompson! I'll merge into main and build off it for the next PR.

@lilyminium lilyminium merged commit ac87073 into main Mar 25, 2025
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have EquilibrationLayer not return "unsuccessful" properties Add check for existing equilibrated boxes Add EquilibrationLayer

3 participants