[lammps-users] lammps question about fix nve and fix langevin

Hello every one
i have a small question regarding fix langevin and fix nve ,fix nve uses the verlet algorithm to solve the eqations of motion and verlet is a simplectic solver and such preserves energy but when you use fix langevin the energy does not preserve energy ,so when you apply the fix langevin does the algorithm change ?
and how does it solve the velocity ? i saw other poeple using a runge kuta integration for solving the ODE for velocity since the langevan equation adds a velocity term to the force and such it is not simplectic
thanks a lot in advance

Fix langevin adds a randomized force to each atom. Hence if you
run it with NVE you will not strictly conserve energy. However, that
is fine. No thermostat (e.g. NVT) will conserve energy, since thermostats
add/substract energy. You are doing things correctly.


Hi Steve
first thank you for the answers ,i got a few more questions
the langevin adds a random force but also a term which is velocity dependent i.e the -chi*v term
doesn’t this bother the integration scheme ?
also i understand that the thermostats doesn’t conserve energy but if i do multiple run and then average over them then the energy will ne more or less conserved no ?
again thanks a lot in advance for the kind answers
Steve Plimpton wrote:

Both the terms in Langevin will contribute to non-conservation
of energy. Langevin works fine with fix nve. If your system
is equilibrated and you hold it at a constant T with Langevin
then it will (on average) conserve energy.


1 Like