fix print at beginning of run

Hello,

I’m using fix print and I would like it to print at the beginning of the run. Right now it prints at the timestep specified in the fix:

variable sim_time equal time
variable pot_eng equal pe
fix fix_print all print 5000 “{sim_time}, {pot_eng}” &
file potential_energy.csv title “Sim Time (fs), Potential Eng (kcal/mol)”

The first output occurs at timestep 5000…how can I make the first output be on timestep 0? So basically once it initializes the system?

Thanks,
Stacey

fix print will print on timestep 0, but if you define fix print when the timestep is already larger than 0, it cannot do that.
you may need to use the reset_timestep command to reset it to 0, e.g. after a minimization.

axel.

Hi Axel,

I am using reset_timestep to reset to 0 and the first time it prints is on timestep 5000…

“”"
min_style sd
minimize 1e-5 1e-5 10000 10000

variable rn_seed equal 418531

variable shake_parms index “m 1.008000”
fix fix_shake all shake 1e-4 20 0 ${shake_parms}

reset_timestep 0

timestep 2.0

variable rep world 0 1 2 3
dump 1 all dcd 100 Trajectory_${rep}.dcd

variable t world 300.0 367.0 434.0 500.0
velocity all create t {rn_seed} dist gaussian mom yes rot yes

variable time_step equal step
variable sim_time equal time
variable pot_eng equal pe
variable cur_temp equal temp
fix print_fix all print 5000 “{time_step},{sim_time},{cur_temp},{pot_eng}” append pot_eng_${rep}.txt &
title “Timestep, Sim Time, Pot Eng, Temperature”

fix nvt_fix_1 all nvt temp $t $t 100.0

temper 500000 5000 t nvt_fix_1 {rn_seed} ${rn_seed}

“”"

it works for me. with the 21 July 2020 version of LAMMPS.
the last update to the code in fix print was in fall 2019.
so you may need to update your LAMMPS version.

axel.

Axel,

Needing to update my LAMMPS version is the problem. Thanks