Accessing temperature through MDModules

Hi Devs,

I’m trying to create an access to the ensemble temperature (introduced in #3089) in the MDModules framework. This will be needed for various usages (colvars, lambda dynamics, AWH).

From what I understand, I can do it in 2 ways:

  • through a new setupNotifier like the SimulationTimeStep or the PbcType. In this case, a MDModule will retrieve the value at the beginning at the simulation. But in cases where the temperature changes during simulation (simulated annealing or simulated tempering), the MDModule will not have the current temperature of the system.

  • through a new parameter in the ForceProviderInput. This solve the previous point about Simulated annealing but in most cases, this ensemble temperature will be a constant and we will keep creating at each step a ForceProviderInput with a constant value.

I’m not sure what is the best option here.
Do you have any suggestions?


How many algorithms can handle a variable temperature? I would think not many. Also the notion of ensemble can get problematic when the temperature changes.

If we only give access to the constant ensemble temperature we could still use both approaches. We would also need to signal if the ensemble temperature is available. This could be done through a std::optional return value, but I don’t know if that’s the best solution.

Yes, I think not so many either.
I’ll use the constant ensemble temperature and see how to retrieve it correctly.
I think the notification approach seems the best option.