Print computed energy


I wish to simply compute the potential energy of the current configuration of the atoms using some interatomic potential and then simply print/output it. However, when i tried with the following input script:

#----------------------- INITIATION-----------------------------------------------
kim init    Tersoff_LAMMPS_Tersoff_1988_C__MO_579868029681_003 metal

#units		metal
dimension 	3
boundary 	f f f #X-periodic Y-periodic Z-periodic
atom_style 	full
newton		on

#---------------------- ATOM DATA-------------------------------------------------

read_data 	mytube_200-2.txt

#---------------------- FORCE FIELD-----------------------------------------------

#pair_style 	airebo 3.0 1 1 
#pair_coeff 	* * CH.airebo C 
#pair_style      tersoff
#pair_coeff      * * 1989_SiC.tersoff C
kim_interactions C
neighbor 	1.0 bin

#---------------------- GROUP DEFINITION------------------------------------------

region  	lower block INF INF INF INF INF 5 units box
region  	upper block INF INF INF INF 220 INF units box

group   	upper region upper
group  		lower region lower
group 		boundary union upper lower
group   	mobile subtract all upper lower

fix 		1 all nve
dump		1 all atom 100 dump.min
thermo		1
thermo_style custom step temp pe etotal fnorm fmax
compute     1 all pe
variable pe equal pe
print       ${pe} append energy.txt screen no

However, i get the following error:

LAMMPS (23 Jun 2022 - Update 1)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
  using 1 OpenMP thread(s) per MPI task
Reading data file ...
  orthogonal box = (-50 -50 -300.61401) to (50 50 744.99079)
  1 by 1 by 1 MPI processor grid
  reading atoms ...
  3899 atoms
Finding 1-2 1-3 1-4 neighbors ...
  special bond factors lj:    0        0        0       
  special bond factors coul:  0        0        0       
     0 = max # of 1-2 neighbors
     0 = max # of 1-3 neighbors
     0 = max # of 1-4 neighbors
     1 = max # of special neighbors
  special bonds CPU = 0.001 seconds
  read_data CPU = 0.013 seconds

WARNING: 'kim_<command>' has been renamed to 'kim <command>'. Please update your input.

399 atoms in group upper
80 atoms in group lower
479 atoms in group boundary
3420 atoms in group mobile
ERROR: Energy was not tallied on needed timestep (src/thermo.cpp:1132)
Last command: print       ${pe} append energy.txt screen no

Why am i getting this error and how to fix it?

Did you have a look at this previous post and tried all the suggestions ?

Yes i did go through it. As i understand, the fix print command is to print the values between MD simulation. Here, i am not performing any simulation. I am simply computing the energy at the given configuration and potential and wish to output/print it. I am not sure how i can implement the suggestion given in that post for my problem.

No. It prints data during a run.

There is no computing of the potential energy and that is why LAMMPS is complaining.
Energies are only computed, if you have a “minimize” or “run” command which trigger computing forces and energies and energies are only tallied if something actually outputs energies.

1 Like