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 final restart files, and fixed heating file stems #116

Merged
merged 12 commits into from
Apr 26, 2024

Conversation

harveydevereux
Copy link
Collaborator

The desired behaviour introduced is to produce a restart file (.xyz) at the end of a heating cycle or md run. As discussed in #108 the user specified restart frequency may not align with the final time step, and this results in a predictable file name for use in automated meta-workflows.

Schematically the file stems will be (NPT is currently no working in this PR),

# NVT/NVE, not heating
[ENSEMBLE]-[TEMPERATURE]-[STEP]-res
[ENSEMBLE]-[TEMPERATURE]-final
# heating, where TEMPERATURE is dynamically updated as heating progresses
[ENSEMBLE]-[TEMPERATURE]-[STEP]-res
[ENSEMBLE]-[TEMPERATURE]-final
[ENSEMBLE]-[TEMPERATURE_START]-[TEMPERATURE_END]-stats
[ENSEMBLE]-[TEMPERATURE_START]-[TEMPERATURE_END]-traj
# NPT also has pressure, after termperature, e.g.
[ENSEMBLE]-[TEMPERATURE]-[PRESSURE]-final
[ENSEMBLE]-[TEMPERATURE_START]-[TEMPERATURE_END]-[PRESSURE]-stats

@ElliottKasoar One point that definitely needs addressing is what is desired when we do a heating run and md run, in the same janus run? Does there need to be some indication the md run is post heating for example?

This PR Closes #115

@harveydevereux
Copy link
Collaborator Author

One thought maybe instead of -final we put the final timestep [FINAL_STEP]-res?

@alinelena
Copy link
Member

can be but be careful cause STEP and FINAL_STEP may be the same and you do not want to write twice...

@harveydevereux
Copy link
Collaborator Author

can be but be careful cause STEP and FINAL_STEP may be the same and you do not want to write twice...

true it could cause overwriting to happen, I'll leave as final for now

@alinelena
Copy link
Member

you can have a check to write it only if it does not exist already

@harveydevereux
Copy link
Collaborator Author

Tests now pass, with some modifications since pressure and temperature have been permuted, and also since restart now adds temperature.

Will add tests for the heating and final restart files next

@harveydevereux harveydevereux marked this pull request as ready for review April 18, 2024 13:47
@alinelena alinelena added the enhancement New feature or request label Apr 18, 2024
@ElliottKasoar
Copy link
Member

The desired behaviour introduced is to produce a restart file (.xyz) at the end of a heating cycle or md run. As discussed in #108 the user specified restart frequency may not align with the final time step, and this results in a predictable file name for use in automated meta-workflows.

Schematically the file stems will be (NPT is currently no working in this PR),

# NVT/NVE, not heating
[ENSEMBLE]-[TEMPERATURE]-[STEP]-res
[ENSEMBLE]-[TEMPERATURE]-final
# heating, where TEMPERATURE is dynamically updated as heating progresses
[ENSEMBLE]-[TEMPERATURE]-[STEP]-res
[ENSEMBLE]-[TEMPERATURE]-final
[ENSEMBLE]-[TEMPERATURE_START]-[TEMPERATURE_END]-stats
[ENSEMBLE]-[TEMPERATURE_START]-[TEMPERATURE_END]-traj
# NPT also has pressure, after termperature, e.g.
[ENSEMBLE]-[TEMPERATURE]-[PRESSURE]-final
[ENSEMBLE]-[TEMPERATURE_START]-[TEMPERATURE_END]-[PRESSURE]-stats

@ElliottKasoar One point that definitely needs addressing is what is desired when we do a heating run and md run, in the same janus run? Does there need to be some indication the md run is post heating for example?

This PR Closes #115

At the moment these changes seems to output the "final" structure at every temperature in the ramp, not just at the end of heating? Was this intended?

@alinelena
Copy link
Member

At the moment these changes seems to output the "final" structure at every temperature in the ramp, not just at the end of heating? Was this intended?
yes, I have asked for it. we may consider to make it optional but for the moment I will say keep it like that.

@ElliottKasoar
Copy link
Member

At the moment these changes seems to output the "final" structure at every temperature in the ramp, not just at the end of heating? Was this intended?

yes, I have asked for it. we may consider to make it optional but for the moment I will say keep it like that.

What's the benefit in all of these extra files, in addition to the periodic restart files (and trajectory)?

I see the benefit in storing a final structure at the end of whatever simulation has run, as that might be missed from outputs due to when things happen to line up with frequencies, but for anything intermediate, what's the advantage to storing these in addition to the restart files?

@alinelena
Copy link
Member

yes, I have asked for it. we may consider to make it optional but for the moment I will say keep it like that.

What's the benefit in all of these extra files, in addition to the periodic restart files (and trajectory)?

I see the benefit in storing a final structure at the end of whatever simulation has run, as that might be missed from outputs due to when things happen to line up with frequencies, but for anything intermediate, what's the advantage to storing these in addition to the restart files?

if you want to do a campaign and simulate systems at various T you want configurations consistent with that T. final, shall be saved only if the restart does not coincide with the step at which is write a restart file.

@ElliottKasoar
Copy link
Member

if you want to do a campaign and simulate systems at various T you want configurations consistent with that T.

Ah ok, so the purpose isn't really a restart file in the same sense as we had previously. I think that makes sense though, although I'm not sure it should necessarily be the default behaviour.

final, shall be saved only if the restart does not coincide with the step at which is write a restart file.

I don't think we currently prevent this?

Also worth noting that the final and restart files currently store the data with slightly different formats (e.g. final seems to include spacegroup_kinds).

janus_core/md.py Outdated Show resolved Hide resolved
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.

Can you update the README with the changes to the output files?

janus_core/md.py Outdated Show resolved Hide resolved
@harveydevereux
Copy link
Collaborator Author

Can you update the README with the changes to the output files?

will do

janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
tests/test_md.py Outdated Show resolved Hide resolved
tests/test_md.py Outdated Show resolved Hide resolved
tests/test_md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
janus_core/md.py Outdated Show resolved Hide resolved
@harveydevereux
Copy link
Collaborator Author

harveydevereux commented Apr 25, 2024

Can you update the README with the changes to the output files?

I need to re-update the docs now I have swapped the pressure back again

Edit: done

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.

This will need rebasing now that #120 is merged, sorry for the inconvenience.

@harveydevereux
Copy link
Collaborator Author

This will need rebasing now that #120 is merged, sorry for the inconvenience.

Just done a rebase

_write_restart now takes bool (default False)
to handle the case of the final dump.

Modifies some tests since pressure now before
temperature
_parameter_prefix inplace of passing pressure

sync README with new file names

both temp range and MD temp in stats and traj

test to verify new heating and MD stems
  when running both.
heating_md_files and heating_md test the default file names and contents

with and without the md run, now both using the Stats object
tests/test_md.py Outdated Show resolved Hide resolved
Fixes typos in test_heating_files docstring

Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
tests/test_md.py Outdated Show resolved Hide resolved
janus_core/calculations/md.py Outdated Show resolved Hide resolved
janus_core/calculations/md.py Outdated Show resolved Hide resolved
harveydevereux and others added 2 commits April 25, 2024 18:07
use +=

Co-authored-by: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com>
remove ending as line length is no
longer not an issue
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 think at some point this module may need to be refactored, so we may revisit some of the interactions e.g. between NPT and NVT_NH, but I think for now this looks good, and particularly having (mostly) settled on the file naming convention we want is perhaps the most important thing.

Thanks, @harveydevereux!

@harveydevereux
Copy link
Collaborator Author

I think at some point this module may need to be refactored, so we may revisit some of the interactions e.g. between NPT and NVT_NH, but I think for now this looks good, and particularly having (mostly) settled on the file naming convention we want is perhaps the most important thing.

Thanks, @harveydevereux!

No problem, thanks for keeping my code in check. Refactoring may be a good idea, also for the file length

@ElliottKasoar ElliottKasoar mentioned this pull request Apr 26, 2024
@ElliottKasoar ElliottKasoar merged commit 75953ae into stfc:main Apr 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add final restart file at terminal heating points/ md runs
4 participants