Skip to content

ethanol-water density curves#353

Open
arnon-1 wants to merge 24 commits intoddmms:mainfrom
arnon-1:main
Open

ethanol-water density curves#353
arnon-1 wants to merge 24 commits intoddmms:mainfrom
arnon-1:main

Conversation

@arnon-1
Copy link

@arnon-1 arnon-1 commented Feb 7, 2026

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

  • Calculations (may need cleanup)
  • Analysis
  • Application
  • Documentation

Testing

Tested on mace-mp-0b3 using lower cost simulation settings.
(reduced dispersion cutoff, shorter time, etc.)

New decorators/callbacks

None (yet)

@ElliottKasoar ElliottKasoar added the new benchmark Proposals and suggestions for new benchmarks label Feb 9, 2026
@arnon-1
Copy link
Author

arnon-1 commented Feb 27, 2026

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.

@arnon-1 arnon-1 marked this pull request as ready for review February 27, 2026 23:37
Comment on lines +39 to +78
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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

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!

@joehart2001
Copy link
Collaborator

joehart2001 commented Mar 16, 2026

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new benchmark Proposals and suggestions for new benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ethanol-water density curves

3 participants