lumol-org / lumol

Universal extensible molecular simulation engine
http://lumol.org/
BSD 3-Clause "New" or "Revised" License
190 stars 18 forks source link

Get the number of degrees of freedom from the propagator #225

Closed Luthaf closed 6 years ago

Luthaf commented 6 years ago

Here is my take on #79 !

The diff is pretty bad now, because this is based on #224. Once it is merged, I'll rebase here.

The idea here is to ask the propagator how many degrees of freedom are simulated, and then use this to compute the pressure/stress/temperature of the system.

This is marked as WIP because I want to add more MC tests using it and check that the original issue is actually solved.

Luthaf commented 6 years ago

So, more explanations on what is going on here.

The main commits are 999d4a6, 3d5841b and bd09417. The number of simulated degrees of freedom are taken from the propagator as the DegreesOfFreedom enum, and the corresponding MCDeegresOfFreedom enum for MC Moves.

The other commits are Yak shaving: I needed the molecular composition (cb22b56) to send warnings here, but then computing the molecular types every time starts to be expensive, so I added a cache for them (790c982 ), and fixed a bug in the process (89cb3dc).

Concerning the Composition, maybe we don't want to put atomic and molecular composition together: we never need both of them at the same time. So it might make sense to obtain them from different function, to remove a bit of work in tight loops.