LAMMPS Hanging

Hi all,

I am using a self compiled version of lammps where I included the commands from this paper:
https://doi.org/10.1016/j.cpc.2019.106862
for fast defect counting for some simulations. I had to go back and use the March2020 version to compile but everything was fine RE the benchmark code.

I am now wanting to loop through some of my own simulations where I have modified their code before going on to my unique system (to check some functionality) but the code seems to ‘hang’ when I run it, usually around the second loop. Does anyone else have experience of this? According to the documentation it could be to do with openmpi settings related to the buffer sizes, but I am unsure how to set those and what are the optimum settings! I am running on 24 cores but no threading (I wasn’t sure if this would make a difference apart from to performance!)
This is the documentation page:
https://docs.lammps.org/Errors_common.html

Thanks in advance and please let me know if more details would help. This is my first post so I can’t upload the code but I will write it below.
Emre

Note: my definition of hanging here is that the code is ‘running’ as per the HPC cluster but the simulation seems to have stopped with no error.

code:

# This file should reproduce the cascade shown in Figures 1 and 2 if run on from compute frenkel paper: https://doi.org/10.1016/j.cpc.2019.106862

# The potential used here is a /correct/ implementation of
# G. J. Ackland et al., J. Phys. Condens. Matter 16 (2004) S2629-S2642.
# Modified from original paper for practice by E. Yildirim

atom_modify map array
units metal
lattice bcc 2.8665 # adjust lattice constant for your metal
region simbox block 0 30 0 30 0 30 # set size accordingly
create_box 1 simbox
create_atoms 1 box
variable l loop 10

# replace with appropriate potentials for the system being studied
pair_style eam/fs
pair_coeff * * Fe-Ackland2004.eam.fs Fe
# set mass, if necessary (pair_style eam/fs does set this for you)
mass 1 55.845

# Initialize velocities and achieve thermal equilibrium
velocity all create 300 131478174 # change seed and temperature
thermo_style custom step time temp press etotal
thermo 100
thermo_modify flush yes
velocity all create 300 2758482 dist gaussian
fix 1 all nve
fix 2 all temp/rescale 27 300 300 1.0 1.0
run 10000
unfix 2
run 2500
unfix 1
reset_timestep 0

# set up Frenkel styles
compute defects all frenkel
dump 1 all frenkel 200 dump.frenkel_distance
dump_modify 1 compute defects method distance dr 0.86
dump 2 all frenkel 200 dump.frenkel_cell
dump_modify 2 compute defects method cell
dump 3 all custom 1000 dump.frenkel_mindist id type xs ys zs c_defects
dump 4 all local 200 dump.frenkel_clusters c_defects[1] c_defects[2] &
    c_defects[3] c_defects[4] c_defects[5]

region PKA sphere 3 3 3 0.3 # must be kept outside of the loop
# This where we can loop from as it is where the PKA is inputted
label loop

print """
######################################################################################################################################
######################################################################################################################################
######################################################################################################################################

                           ######                #################### #################### ####################
                           ######                #################### #################### ####################
                           ######                #################### #################### #######      #######
                           ######                #################### #################### #######      #######
                           ######                #######      ####### #######      ####### #######      #######
                           ######                #######      ####### #######      ####### #######      #######
                           ######                #######      ####### #######      ####### ####################
                           ######                #######      ####### #######      ####### ####################
                           ######                #######      ####### #######      ####### #######
                           ######                #################### #################### #######
                           ##################### #################### #################### #######
                           ##################### #################### #################### #######
                           ##################### #################### #################### #######

######################################################################################################################################
######################################################################################################################################
######################################################################################################################################
"""
print "Loop count is $l"

# set up cascade
group everything union all

delete_atoms region PKA
create_atoms 1 single 3 3 3
group PKA subtract all everything

# the following two lines mean the PKA atom is ALWAYS
# written to the dump file, assuming it's not later added
# to the "everything" group
dump_modify 2 frenkelgroup everything
dump_modify 1 frenkelgroup everything

# set PKA direction (randomly)
variable U equal 0.2466279819442322 # replace with random number
variable V equal 0.38704059085699904 # replace with another random number
variable phi equal 2*PI*v_U
variable theta equal acos(2*v_V-1)
variable v equal 800.1692 # 2 keV iron; set according to your kinetic energy
variable vx equal $v*cos(v_phi)*sin(v_theta)
variable vy equal $v*sin(v_phi)*sin(v_theta)
variable vz equal $v*cos(v_theta)

velocity PKA set v_vx v_vy v_vz units box
velocity all zero linear # zero out the linear momentum of the center of mass

# output standard thermodynamic data, then the number of vacancies, then
# the number of vacancy clusters of size 1,2,...,19, then those of 20 or
# greater; then the number of interstitials and clusters of 1-19 and 20+;
# then the number of "irregular" defects
thermo_style custom step time dt temp press etotal c_defects[1] &
    c_defects[1][1] c_defects[1][2] c_defects[1][3] c_defects[1][4] &
    c_defects[1][5] c_defects[1][6] c_defects[1][7] c_defects[1][8] &
    c_defects[1][9] c_defects[1][10] c_defects[1][11] c_defects[1][12] &
    c_defects[1][13] c_defects[1][14] c_defects[1][15] c_defects[1][16] &
    c_defects[1][17] c_defects[1][18] c_defects[1][19] c_defects[1][20] &
    c_defects[2] &
    c_defects[2][1] c_defects[2][2] c_defects[2][3] c_defects[2][4] &
    c_defects[2][5] c_defects[2][6] c_defects[2][7] c_defects[2][8] &
    c_defects[2][9] c_defects[2][10] c_defects[2][11] c_defects[2][12] &
    c_defects[2][13] c_defects[2][14] c_defects[2][15] c_defects[2][16] &
    c_defects[2][17] c_defects[2][18] c_defects[2][19] c_defects[2][20] &
    c_defects[3]
# This changes the width of each field so output fits on the screen better
thermo_modify format float "%G" format 2 "%12.8G" format 3 "%8G" &
    format 4 "%12.8G" format 5 "%12.8G" format 6 "%12.8G" format 7 "%GV" &
    format 28 "%GI" &
    format 49 "%Gi"
thermo 100
restart 400000 file.restart # saves after each loop so the system is recoverable!

fix 1 all nve
fix 2 all dt/reset 10 1.0E-8 1.0E-3 0.00025 units box # variable time step
run 100000 # some simulation length (not linear with time!)
fix 2 all dt/reset 10 1.0E-8 1.0E-3 0.0005 units box
run 100000
fix 2 all dt/reset 10 1.0E-8 1.0E-3 0.001 units box
run 100000
fix 2 all dt/reset 10 1.0E-8 1.0E-3 0.005 units box
run 75000
fix 2 all dt/reset 10 1.0E-8 1.0E-3 0.01 units box
run 25000
# note that setting a single value of the dt/reset displacement (last numerical
# field) is generally not sufficient, as the energy and force are not linear
# with distance (and thus moving very fast requires much smaller time steps
# than moving just slightly slower).



next l
jump in.example loop

Since you are including custom code that is not part of the LAMMPS distribution, you first need to confirm if you have the same “hang” without those custom commands. If not, then the problem is likely in the added code.

I suspect this is referring to the same code that is mentioned here: [Feature Request] Add compute/dump functionality to identify defects · Issue #3452 · lammps/lammps · GitHub
If that is the case, @karlh may be able to comment.

Please also note that the LAMMPS documentation has information about required changes to port source code written for older versions of LAMMPS to the current source distribution: 4.9. Notes for updating code written for older LAMMPS versions — LAMMPS documentation

Hiya,

Thanks for getting back so fast! Yes that is the exact one! It looks there there have been some additions too to compile with the latest versions so that can also be an option.

I will have a go without and update the thread, thank you again!

To update, without the added computes it ran fine on my build so it may just be those, I will recompile with the latest files and update this thread.

Thanks again for your help!

@emy Before you invest too much time into changing source code, I suggest you contact the developer of the added code and coordinate what changes are made with him. He is usually very responsive and helpful, so it should be worth your time to reach out to him. He may already have updated sources so that you could save some time and effort.