Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MD progress bar with class #444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

k-harris27
Copy link
Contributor

@k-harris27 k-harris27 commented Feb 24, 2025

Resolves #405

Reworks the progress bar approach to extend rich.progress.Progress, just providing default formatting. This way, we can access all of the features of the progress bar, rather than just the iterator mode. Previous progress bars for phonons and single-point calculations still work in essentially the same way.

The MD progress bar reads the number of completed steps each time it is updated, ensuring it remains accurate. The iterator mode with Progress.track was unstable in the case of e.g. an MD run of length 0. The frequency of updates of the progress bar can be chosen with the progress_bar_update_every argument.

e.g. 30 steps of temperature ramp, 7 steps of MD:
image

@k-harris27 k-harris27 force-pushed the md-progress-bar-class branch from 28628d2 to b7a6376 Compare February 24, 2025 09:59
@alinelena alinelena requested review from ElliottKasoar and oerc0122 and removed request for ElliottKasoar February 24, 2025 10:05
@ElliottKasoar ElliottKasoar added the enhancement New/improved feature or request label Feb 24, 2025
@k-harris27 k-harris27 mentioned this pull request Feb 24, 2025
Copy link
Member

@ElliottKasoar ElliottKasoar left a comment

Choose a reason for hiding this comment

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

I'm not sure this is quite working as expected to, e.g. if I run

janus md --ensemble nvt --temp-time 20 --temp-start 0 --temp-end 20 --temp-step 10 --traj-every 1 --stats-every 1 --struct tests/data/NaCl.cif --steps 50

This pauses at 40/110 and seems to end at 90/110.

Ah, this is probably a quirk of how we treat a ramp starting at 0K, so not a general issue, but still something to handle.

I do also wonder if we ought to separate out heating and MD, and maybe even different stages of heating?

@k-harris27
Copy link
Contributor Author

k-harris27 commented Feb 25, 2025

Ah, this is probably a quirk of how we treat a ramp starting at 0K, so not a general issue, but still something to handle.

Ah thanks, I had missed that 0K steps were skipped. This should be handled properly now.

I do also wonder if we ought to separate out heating and MD, and maybe even different stages of heating?

I felt like there should be an overall progress bar so that a user can get an estimate of the remaining total simulation time. I've added a second progress bar that tracks the current temperature step if applicable. Let me know what you think, I'm happy to adjust it of course.

This pauses at 40/110

Also, I never managed to reproduce anything like this. Let me know if you're still seeing it and I can have another look.

@k-harris27 k-harris27 force-pushed the md-progress-bar-class branch from ce7b4b1 to 938447d Compare February 25, 2025 14:23
Copy link
Member

@ElliottKasoar ElliottKasoar left a comment

Choose a reason for hiding this comment

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

Looks good!

In terms of the specific format of the bars, perhaps we should discuss it tomorrow. My inclination would be a new bar for each stage, rather than a total bar and a current bar that changes what it's referring to, which is what I think it currently does.

Also, I never managed to reproduce anything like this. Let me know if you're still seeing it and I can have another look.

Ah, so I think the pause was the switch from the heat ramp to the MD, which was correctly as step 40, and then the 50 MD steps took it to 90, so it was just the total that was wrong, as it included 20 steps at 0K.

@k-harris27
Copy link
Contributor Author

This will need rebasing and checking once #453 is merged. I'm happy to do that, even if it's sometime next week.

@k-harris27 k-harris27 force-pushed the md-progress-bar-class branch from bc0725e to 73910d0 Compare February 28, 2025 17:17
@k-harris27 k-harris27 force-pushed the md-progress-bar-class branch from 73910d0 to 45bb06d Compare February 28, 2025 17:20
@ElliottKasoar
Copy link
Member

ElliottKasoar commented Feb 28, 2025

I'm not sure this quite works for a simulation that is only heating.

E.g. `janus md --ensemble nvt --temp-time 200 --temp-start 10 --temp-end 20 --temp-step 10  --struct tests/data/NaCl.cif

initially shows 0/400, and 0/200 correctly, but doesn't update, then finally updates to 400/400 and 0/0.

Another fun issue: if we cool to 0K, we have the same problem that it includes steps.

We probably ought to test:

  • Pure MD
  • Pure heating
  • MD + heating
  • Cooling (to 0K)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New/improved feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use progress bar for MD
2 participants