Skip to content

bugfix-ncycles-computed#80

Open
Roy-Haolin-Du wants to merge 3 commits intomichellab:mainfrom
Roy-Haolin-Du:main
Open

bugfix-ncycles-computed#80
Roy-Haolin-Du wants to merge 3 commits intomichellab:mainfrom
Roy-Haolin-Du:main

Conversation

@Roy-Haolin-Du
Copy link
Member

Description

Added nmoves as a configurable field and changed ncycles to a computed property

Todos

Added nmoves as a configurable field and changed ncycles to a computed property in engine_config.py to prevent memory overflow from single-cycle runtimes.

Status

  • Ready to go

@Roy-Haolin-Du
Copy link
Member Author

Fixes #79 - Adds ncycles support to prevent memory errors.

ncycles_int = round(float(ncycles))

if ncycles_int < 1:
raise ValueError(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this was done before for timestep and runtime, but I think it might be better to validate all of this stuff in a validator, rather than in the property. Then, an error will be raised on instantiation/ assignment (we've set it to validate on assignment) rather than later when the user tries to call the property. The property can then just compute ncycles.

"""
Make sure runtime is a multiple of timestep
Calculate number of cycles from runtime, nmoves and timestep.
Formula: runtime = nmoves × ncycles × timestep
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might not be remembering how these settings work, but my main comment is: do we know if this will work with adaptive computations where the assigned times may be pretty short? 25000 * 4 fs = 100 ps which is a fairly large smallest runtime. Have you tried this with the adaptive runs?

A simple way to make this more flexible would be to replace nmoves with max_nmoves. This would modify the behaviour of the previous nmoves property so that the behaviour stays as it was unless runtime > max_nmoves * timestep, in which case the nmoves gets e.g. halved and ncycles doubled or something similar. We'll need to be careful to make sure you get a valid nmoves and ncycles in this case (easiest way might be to enforce that runtime must be a multiple of 2 * timestep).

@fjclark
Copy link
Collaborator

fjclark commented Feb 28, 2026

Thanks Roy! Mainly looks good but have left a couple of comments.

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.

2 participants