If you want an example using a loop here it is. I'm in a hurry and
I feel a little bit irresponsible posting this because I have not
tested it. (I adapted it from something else.) This example is
probably more complicated than it needs to be. Try it, and if it does
not work, please post a reply.
If you don't want the temperature to vary linearly, then modify the
formula for variable Ttarget. You will probably want to change the
"Tdamp" parameters ("100" and "2000" in the example below) to be
appropriate for your system.
Hopefully this gets you started
Cheers
Andrew
(Comment on Chang Woons suggestion: Remember to use the "unfix"
command after each run if you want to reuse the same fixID. There may
be mistakes with this post too.)
# ------ run section of input script with temp loop -----
# You may want to reduce your timestep with increasing temperature,
# but for now, just use a constant timestep
timestep 1.0
# You can specify all of your dump and thermo commands once
# beforehand, or you can put them in the loop, but remember
# to use "undump" and "dump_modify" each time if you do that.
#dump 1 all custom 20000 traj.lammpstrj id mol type x y z ix iy iz
#thermo_style custom step temp pe etotal press vol
#thermo_modify norm no
#thermo 1000
variable nloop1 loop 601
label loop1
# optional: I renamed the "step" variable to "time"
# I don't remember why. Not important.
variable time equal step
variable Ttarget equal \(601\-\(v\_time\)/5000\.0\)
\# This would probably also work:
\# variable Ttarget equal (601-(v_loop1))
# optional: Have a file containing temperature versus time
print "timestep = \{time\}, Ttarget = {Ttarget}" file Ttarget_vs_time.dat
# Tstart Tstop Tdamp
fix fxnvt all nvt \{Ttarget\} {Ttarget} 100.0
# If you use Langevin dynamics, try this way instead:
# http://lammps.sandia.gov/doc/fix_langevin.html
# Tstart Tstop tdamp randomseed
#fix fxlan all langevin \{Ttarget\} {Ttarget} 2000.0 ${time}
#fix fxnve all nve
run 5000
unfix fxnvt
#If you use langevin dynamics, do this instead:
# unfix fxlan
# unfix fxnve
next nloop1
jump SELF loop1