HOOMD npt MD simulation failing to keep temperature and pressure constant.

128 views
Skip to first unread message

Callum Ward

unread,
May 14, 2021, 1:18:10 PM5/14/21
to hoomd-users
Hello everyone, I am trying to accomplish a simple MD simulation of a two-atom Lennard-Jones system. The variables of temperature and pressure remain constant during an NVT equilibration but the moment it switches to NVT it starts to fluctuate wildly. Excerpt of code:
def MD_Simulation (Temp, file_name, log, system_name):
    
    all = hoomd.group.all()
    
    quantities=['volume','lx','ly','lz','potential_energy','kinetic_energy','temperature','pressure']
    hoomd.analyze.log(filename=log,
                  quantities=quantities,
                  period=100,
                  overwrite=False) # keep appending the existing file
    d = hoomd.dump.dcd(file_name, period=100, group=all, overwrite=True, unwrap_full=False);
    
    hoomd.md.integrate.mode_standard(dt=0.005);
    
    nvt = hoomd.md.integrate.langevin(group=all, kT=0.8, seed=10)
    nvt.set_params(kT=Temp)
    
    npt = hoomd.md.integrate.npt(group=all, kT=Temp, tau=5.0, P=0.1, tauP = 5.0, couple="xyz")
    npt.set_params(P=0.3)
    
    npt.disable()
    
    hoomd.run(5000)
    
    nvt.disable()
    npt.enable()
    
    hoomd.run(15000)
    
    npt.disable()
    
    ase.io.write(system_name, current_config)

This is being looped through with temperatures ranging between 0.8 and 1.5
Capture.PNG
Any ideas on what's causing this issue?

Eric Jankowski

unread,
May 14, 2021, 2:57:34 PM5/14/21
to hoomd...@googlegroups.com
It's hard to say without more simulation information, but if N=2 and those two particles are close enough to interact (wiggling about 1.12 diameters) then the thermostat and barostat will have a hard time keeping T and P constant, as you can see in your simulations: As kinetic energy (T) is converted into potential energy as the atoms smoosh together, T drops and the thermostat says "Whoa! better scale those velocities up!" and overshoots, and the behavior is similar for the pressure. Depending on what you're trying to understand, the NPT integrator might be an inappropriate choice. NVE for just two atoms, or Langevin for two beads in a bath are two possibly OK choices.

Eric Jankowski PhD | he/him/his
Associate Professor | Micron School of Materials Science & Engineering
Boise State University | 1910 W University Dr. | Boise, ID 83725-2090


--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/ec945c29-12bc-4847-b64e-7700fc07a739n%40googlegroups.com.

Joshua Anderson

unread,
May 17, 2021, 7:53:26 AM5/17/21
to hoomd...@googlegroups.com
Callum,

Eric makes a number of good points. I will add that kinetic temperature is NOT constant in an NVT ensemble, only the average temperature in the thermodynamic limit. Fluctuations in the kinetic temperature scale with 1/sqrt(N) so with small N you should expect large fluctuations.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
> <Capture.PNG>
> Any ideas on what's causing this issue?
>
>
> --
> You received this message because you are subscribed to the Google Groups "hoomd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/ec945c29-12bc-4847-b64e-7700fc07a739n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "hoomd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CAFeXqm5VGYUXJQW-2C%2B%3DwVyY6qFBzLGTOuFN%2BvE2iMAirPR19Q%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages