Writing a restart file at certain steps during a run

Hi!

My simulation consists in an NPT fix going from 50K to 2500K spanning over 2000000 timesteps. I would want to have two restart files written, one when the temperature from the ramp reaches approximately 300K and one when it reaches approximately 1300K. How could I achieve this?

According to a linear regression, like the temperature would normally evolve in this NPT fix, I’d reach approximately 300K at 205000 steps and 1300K at 1020500 steps.

What I’ve tried was defining the different fixes I’m using, then a run 205000 with a write_restart *_name.restart, followed by another run 1020500, another write_restart […], following a run (2000000 - 205000 - 1020500), using a variable. However it ends up in LAMMPS doing 3 runs going from 50K to 2500K, with all restart files written at a temperature of 2500K.

Is there a way to do what I’m aiming for?

Thanks a lot!
Antoine.

Hi Antoine,
It is difficult to directly debug your script without having a condensed version of the input script with the relevant sections. In general the help you get in the mailing list will be much more prompt and much more accurate if you provide this. However, it sounds like the problem the you are having is that you need to unfix your thermostat and refix it starting at the systems current temperature after every time you run. It should look something like

50 x (at the end of this run you get to temperature x)
x y (at the end of this run you get to temperature y)
y 2500 (at the end of this run you get to 2500)

The amount of time you run for is going to dictate the heating rate so take care to make sure it is constant if that is what you want.

Feel free to respond with a condensed copy of your input script; otherwise, I hope this helps.

Best,
Dylan

Thanks, it actually helps a lot! I hadn’t included my input script to make the original email lighter, under this is the updated version of the script, I’ll try it out!

variable iterations equal 2000000

variable iterationsfix1 equal 205000
variable iterationsfix2 equal 1020500
variable iterationsfin equal “v_iterations - v_iterationsfix1 - v_iterationsfix2”

variable thermooutput equal “v_iterations/5000”
variable resultsoutput equal “v_iterations/100000”
variable rdfoutput equal “v_iterations/100”

timestep 0.001
thermo ${thermooutput}
thermo_style custom step temp enthalpy etotal pe ke press vol cella cellb cellc
thermo_modify norm no

compute LIQUIDE all rdf 50 * *
fix 1 all npt temp {temperature1} 325 (100*dt) iso {pression} {pression} (1000*dt) fix 2 all ave/time {rdfoutput} 1 {rdfoutput} c_LIQUIDE[*] file FixAveTime_{foldernum}_{testnum}_{subtest}.rdf mode vector

#dump mydump all xyz 200000 EffetNb_{foldernum}_{testnum}.xyz

variable iteration equal “step”
variable tempe equal “temp”
variable enth equal “enthalpy”
variable etot equal “etotal”
variable potential equal “pe”
variable kinetic equal “ke”
variable pressure equal “press”
variable volume equal “vol”
variable cellulea equal “cella”
variable celluleb equal “cellb”
variable cellulec equal “cellc”

fix 3 all print {resultsoutput} "{iteration} {tempe} {enth} {etot} {potential} {kinetic} {pressure} {volume} {cellulea} {celluleb} {cellulec}" file EffetNb_{foldernum}_{testnum}_${subtest}.results screen no title “step temp enthalpy etotal pe ke press vol cella cellb cellc”

run ${iterationsfix1}

write_restart EffetNb{foldernum}_{testnum}.restart
unfix 1
fix 1 all npt temp 325 1325 (100*dt) iso {pression} {pression} (1000
dt)
run ${iterationsfix2}

write_restart EffetNb{foldernum}_{testnum}.restart
unfix 1
fix 1 all npt temp 1325 {temperature2} (100
dt) iso {pression} {pression} (1000*dt) run {iterationsfin}

please have a look at the “start” and “stop” option of the run command. that allows you to have a single temperature ramp distributed across multiple runs.

axel.

please also keep in mind, that a nose-hoover thermostat is not well equipped to transfer a large amount of kinetic energy to a system at any given rate. you’d be much better off using a dissipative thermostat like fix langevin, temp/csld, gld, gle and so on.

Alright thanks a bunch for the precision, I’ll keep this in mind for this and my future works as well! It’s much appreciated!

Have a great day!
Antoine.