Conversation
Codex-generated pull request Improves documentation to adhere to style guidelines.
|
The code is slightly longer than strictly necessary, as I had to test it with limited computational resources and therefore implemented checkpointing etc. I am happy to remove these parts if preferred. I could also add the input files to the repository. They are around 300 KB in total, so it might be worth considering whether they should instead be hosted externally. Currently, I only generate a parity plot of the density. If it would be of interest, I could also include additional plots, such as density or excess volume as a function of ethanol concentration. I would need to check how. |
| def add_shorter_d3_calculator(model, calcs): | ||
| """ | ||
| Add D3 dispersion to calculator(s). | ||
|
|
||
| Parameters | ||
| ---------- | ||
| model | ||
| Model to add the dispersion. | ||
| calcs | ||
| Calculator, or list of calculators, to add D3 dispersion to via a | ||
| SumCalculator. | ||
|
|
||
| Returns | ||
| ------- | ||
| SumCalculator | Calculator | ||
| Calculator(s) with D3 dispersion added, or the original calculator when | ||
| the model is already trained with D3 corrections. | ||
| """ | ||
| if model.trained_on_d3: | ||
| return calcs | ||
| from ase import units | ||
| from ase.calculators.mixing import SumCalculator | ||
| import torch | ||
| from torch_dftd.torch_dftd3_calculator import TorchDFTD3Calculator | ||
|
|
||
| if not isinstance(calcs, list): | ||
| calcs = [calcs] | ||
|
|
||
| d3_calc = TorchDFTD3Calculator( | ||
| device=model.d3_kwargs.get("device", "cpu"), | ||
| damping=model.d3_kwargs.get("damping", "bj"), | ||
| xc=model.d3_kwargs.get("xc", "pbe"), | ||
| dtype=getattr(torch, model.d3_kwargs.get("dtype", "float32")), | ||
| cutoff=model.d3_kwargs.get( | ||
| "cutoff", 25.0 * units.Bohr | ||
| ), # shortened to make run more manageable. | ||
| ) | ||
| calcs.append(d3_calc) | ||
|
|
||
| return SumCalculator(calcs) |
There was a problem hiding this comment.
if you want to edit the d3 kwargs for testing, this can be done by specifying d3 kwargs in the models.yml file, like we've done for the r2scan model, so hopefully more simple!
|
Hey @arnon-1, thanks for the PR and its looking good overall! would you be able to remove some of the dummy data etc for testing so i see what the test would look like in practice? dont worry about running it, i will take care of that. thanks! also, would you be able to streamline some of the code into single calc or analysis files where possible? let me know if you want to discuss anything! |
Pre-review checklist for PR author
PR author must check the checkboxes below when creating the PR.
Summary
Benchmark of the density of water-ethanol mixtures using NPT MD, compare to experiment.
Linked issue
Resolves #352
Progress
Testing
Tested on mace-mp-0b3 using lower cost simulation settings.
(reduced dispersion cutoff, shorter time, etc.)
New decorators/callbacks
None (yet)