espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo-users] Grand canonical thermostat


From: Axel Arnold
Subject: Re: [ESPResSo-users] Grand canonical thermostat
Date: Fri, 27 Feb 2015 07:02:00 +0100

Hi!

Am 26.02.2015 um 23:17 schrieb Salim Maduar <address@hidden>:

Hello, everyone
 
I want to use grand canonical thermostat in Espresso in order to fix the chemical potential of species. There is a possibility of using this thermostat through TCL interface.
However, if I have a lot of particles it gets very slow. Essentially because I have to add/delete particles in TCL every 10-20 integration steps.
It seems that there is no such Grand canonical thermostat in Espresso yet (?) which works at c-code level.
If there is such a thermostat, could anyone explain how to use it.

No, there isn’t.

 
If there is no such thermostat, then could anyone explain how to implement it in c-code. I think it would dramatically accelerate the simulation if it addition/deletion of particles will be implemented in c-code without returning frequently to TCL interface.

I don’t think so, actually. The reason is that adding/deleting particles in the Espresso structures is relatively expensive, because Espresso isn’t optimized for this use case. Espresso can only completely rebuild the Verlet list, which happens every time you add/delete a particle.  Also, we need to reallocate the ghost particle buffers, which we again can do only completely. This costs much more time than leaving to Tcl, and adapting the Verlet lists is a pretty complex thing that would require deep changes in the infrastructure of Espresso.

It would be helpful to know which files and perhaps functions I have to change in this case.
I think  that some of the existing thermostats should be modified so that before integration step it deletes or removes particles.

It is not that easy. The thermostats do their work during integration, i.e., when Espresso is running MPI-parallel. The C-routines for adding/deleting particles however need to be called only on the master node, because all nodes need to be aware that the number of particles changes when communicating ghosts. So, you need to decide on the master node only whether or not to add/delete a particle, and leave the integration loop on C-level. But again, the main cost is not leaving the C-level, but rather the full rebuild of communication buffers and Verlet lists, which is much more demanding to fix.

Note also that you need to be careful when adding particles so often. The Langevin thermostat needs a while to establish the desired temperature, namely roughly 1/gamma/dt time steps. So, for gamma=1 and dt=0.01 you need about 100 steps to “heal” the overall temperature. You can accelerate that by increasing gamma, however, also the product of gamma and dt can’t be too large. 20 time steps is already critical, and 10 time steps is from my experience not enough to get the temperature correct.

Best,
Axel

------------------------------------------------
Dr. Axel Arnold
ICP, Universität Stuttgart
Allmandring 3
70569 Stuttgart, Germany
Email: address@hidden
Phone: +49 711 685 67609


reply via email to

[Prev in Thread] Current Thread [Next in Thread]