lab-cosmo / i-pi-dev_archive

Development version of i-PI
21 stars 12 forks source link

ThermoDFL: Langevin for inherently dissipative forces (+ Update to ThermoNFL/Example) #205

Closed Ithanil closed 6 years ago

Ithanil commented 6 years ago

Pretty much for the sake of completeness I also added the counterpart to ThermoNFL. While in ThermoNFL additional damping is added to compensate for inherent noise from the forces, in ThermoDFL additional noise is added to compensate for forces with inherent dissipative effect (as for example in https://arxiv.org/pdf/cond-mat/0610552.pdf).

The full Langevin noise term of this Thermostat is calculated from the product of Langevin dissipation T (LDT) and inherent dissipation T (IDT):

S = sqrt(kb temp (1.0 - (LDT * IDT)*2)) , where LDT = exp(-0.5 dt / tau) and IDT = exp(-0.5 * dt / idtau). tau is the usual Langevin damping time scale and idtau is the estimated equivalent for the inherent dissipation.

Like in ThermoNFL this parameter idtau may be adjusted automatically. Another parameter named 'apat' (automatic parameter adjustment time) controls the time scale of that adjustment. This parameter is now also used to control ThermoNFL's adjustment.

I added and integrated a CP2K example with enabled ThermoDFL into examples/cp2k . It is built from a CP2K regression test concerning the ASPC predictor-corrector scheme, which results in a dissipative effect (for example see above paper). This thermostat was also tested with my oscillator toy system and explicit dissipative forces.

Furthermore this PR contains a minor update to the HswfQMC/ThermoNFL example.

I probably won't be able to respond this evening, but certainly will tomorrow. Also I will provide an update to the feature list entry at http://ipi-code.org/about/features/ .

Best, Jan

ceriottm commented 6 years ago

Could this be implemented in a more general way so there is just one Thermo??L object that does both? I'm just thinking of code maintainability, this seems to imply a lot of duplication. If not easily mergeable, then it can go in as it is here - just trying to get things done as cleanly as possible

Ithanil commented 6 years ago

Good point. Initially my plan was to implement both functionalities into the same thermostat, but then I figured that the adjustment algorithm would work only for either DFL or NFL, not both at the same time. So I went on the also otherwise easier route of creating separate thermostats. However, now that I'm done with that it is pretty clear to me how to merge them. Only "regression" is that the adjustment will only apply if only one of both parameters (invar and idtau) is set. Also initially you have to set exactly one of them to a value != 0 for automatic adjustment. Which helps to accelerate the adjustment anyway... I will get to implement it later today and then probably want some testing, so you can expect to hear again from me tomorrow.

Ithanil commented 6 years ago

OK I'm done with merging the thermostats and testing. Also updated all relevant examples accordingly. The merge resulted (imo) in an improvement of the ThermoNFL functionality, because it now also uses a time scale parameter resembling the normal 'tau' to control the additional damping. Seems more clean to me like that.
Also you can now in principle compensate for noise and dissipation at the same time, even if it does not really make much sense. BTW if the parameters 'intau' and 'idtau' are equal, you get back a normal Langevin thermostat with time scale intau=idtau (assuming tau=0).

I hope you like it!

Ithanil commented 6 years ago

Oh and the merged thermostat name is ThermoCL for Compensating Langevin. Not very creative, I know...

ceriottm commented 6 years ago

So if you're happy with the state of this PR go ahead and merge, I have no concerns. Just one thing: to get credit and take the maintenance burden, it would be good if the docstring for ThermoCL included your mail address as a point of contact for bugs :-)

Ithanil commented 6 years ago

Added the line containg my name and mail address. Now ready to be merged. Also here is the updated feature list entry: ThermoCL_feature.txt