Is it possible to create two simulation systems in LAMMPS and they can exchange particles?

Hello all,

I was just wondering is it possible to create a two systems in LAMMPS? For example, one system contains water molecules or salt ions and it can exchange water molecules or ions with other system because of chemical potential difference and osmotic pressure.

If it is possible how can I can achieve that?

Thank you.

Muzaffar

Yes and no. It cannot be done out of the box, but with some significant programming, it could be done: you would have to set up two LAMMPS instances and then write a fix style, that communicates the exchange of atoms and molecules. Half of that exists in fix gcmc or scgmc where the exchange is with some hypothetical large reservoir. The two LAMMPS instances would typically be handled by different groups of MPI processes, similar to how NEB, or parallel tempering are implemented. 6.2. Package details — LAMMPS documentation

A more high-level setup can be done through “coupling”. While typical examples describe coupling of LAMMPS with some other software, it is also possible to couple LAMMPS with LAMMPS itself. That the two instances have to exchange particles or molecules is a bit of a complication, though. 8.1.6. Coupling LAMMPS to other codes — LAMMPS documentation

Please see my recent post demonstrating how to run multiple LAMMPS instances, both side-by-side and alternately. This uses Python, but the same can be easily done in C++. Of course that simplified example had no connection between the LAMMPS instances. Writing the source code to make that coupling happen would be the specific challenge to realize such a project.

1 Like

Could also use a “membrane”, https://doi.org/10.1016/S0378-3812(01)00734-8

1 Like