Skip to content

Conversation

thomasloux
Copy link
Contributor

@thomasloux thomasloux commented Sep 25, 2025

Summary

Adding a big feature to compute free energy for crystal phases.

  1. Forward TI with Einstein reference:
    • Compute Einstein model frequencies from NVT simulation of reference model
    • Run multiple forward TI trajectories from Einstein model to target model
    • Compute free energy difference using Jarzynski equality
      Reference:
  1. Forward-backward TI:
    • Run forward TI from model_a to model_b
    • Equilibrate at model_b
    • Run backward TI from model_b to model_a (with reverse=True)
    • Compute free energy using Jarzynski equality and adiabatic switching method
      Reference:
  • de Koning, Maurice, and A. Antonelli.
    "Adiabatic switching applied to realistic crystalline solids: Vacancy-formation
    free energy in copper." Physical Review B 55.2 (1997): 735.

Inspiration and sources:

Note: I need to add the pipeline to see the results for different simulation lengths, for different temperatures and the actual evaluation to find the temperature of transition of titanium from HCP to BCC. I try to reproduce https://calorine.materialsmodeling.org/get_started/free_energy_tutorial.html
The code is a somewhat direct application of LAMMPS implementation.

What is lacking?

  • It's only either Helmholtz free energy, or Gibbs free energy as Pressure=0, but normally I simply need to add the PV term in the computation.
  • The computation of the cell parameters at varying temperature. In my current implementation, not in this first draft PR, I use IsotropicMTKNPT, but current TorchSim NPT should be fine as I think they are also isotropic.
  • Tests: will add them later.
  • A good documentation and full working example

What can evolve?

  • The current reimplementation of MDState and Langevin integrator to add the energy_difference does not seem optimal I think that we should be able to add arbitrary information in MDState and possible save everything that is returned by an MLIP in MDState.

Checklist

Before a pull request can be merged, the following items must be checked:

  • Doc strings have been added in the Google docstring format.
  • Run ruff on your code.
  • Tests have been added for any new functionality or bug fixes.
  • I have read and agree to the Contributor's Certification in CONTRIBUTING.md.

We highly recommended installing the pre-commit hooks running in CI locally to speedup the development process. Simply run pip install pre-commit && pre-commit install to install the hooks which will check your code before each commit.

@orionarcher
Copy link
Collaborator

orionarcher commented Sep 26, 2025

Thanks for this contribution! Convert out of draft when you want a review, happy to take a look.

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