# How to set the temperature of system following the cubic equation as function of time?

Dear all,
I model the diamond system which containts 1020 carbon atoms by LAMMPS. I want the temperature of system, T, following the cubic equation, T=at+bt^2+ct^3, t is the simulation time. The temperature profile should be like the para-curve.
I can use the NVT or NVE ensemble, but I do not know how to set the Tstart and Tstop, Could you give me some suggestions?

Liu Qingkang

Dear all,
I model the diamond system which containts 1020 carbon atoms by
LAMMPS. I want the temperature of system, T, following the cubic equation,
T=a*t+b*t^2+ct^3, t is the simulation time. The temperature profile should
be like the para-curve.
I can use the NVT or NVE ensemble, but I do not know how to set the
Tstart and Tstop, Could you give me some suggestions?

​the temperature ramp in LAMMPS can only be linear. so you have to
approximate your cubic ramp with chunks of linear ramps and for that
compute your Tstart and T​stop from the time step using equal style
variables. you can do this as an explicit loop or use the "every" keyword
to the run command for that.

​axel.​

Dear Axel,
Thanks, I will try your method.
I will let you know if I get problem.
Thanks a lots.

Liu Qinkang

If you use a different thermostat, like fix langevin, you

can specify the target termperature as a variable, and

the equal-style variable can be a function of time, like your

equation:

T=at+bt^2+ct^3

Steve

Dear Steve,
You mean if I use the NVE ensemble with Langevin thermostat, the Tstop could be a variable which equal T=at+bt^2+ct^3.
So how about the NVT ensemble with Nose-Hoover or Berendsen thermostat?
Could you give me some suggestions?
Thanks
Liu Qingkang

Dear Steve,
You mean if I use the NVE ensemble with Langevin thermostat, the Tstop
could be a variable which equal T=a*t+b*t^2+ct^3.

langevin does support using an equal style variable, but for Tstart, not
Tstop. Tstop is ignored in that case.​

So how about the NVT ensemble with Nose-Hoover or Berendsen thermostat?

​fix temp/berendsen also supports using an equal style variable for Tstart.

fix nvt, i.e. nose-hoover does not. it doesn't mention ​allowing the use of
a variable, and that means, it is not supported. however, the partwise
linear ramp can be used with any of them, and considering that typical
system sizes for MD have significant temperature fluctuations and also,
thermostats have a delay due to the associated time constant, this partwise
linearization isn't really a bad approximation. using the equal style
variable is primarily beneficial due to its convenient use.

Could you give me some suggestions?