Adding an atom onto a surface while using fix wall/region

I’m busy with a research project in materials science and I’m using LAMMPS for my simulations. My goal is to find the energy required for an atom to bind to the 111 surface of an fcc metal surface. I’ve successfully achieved this using periodic boundary conditions, but I need to obtain similar results using fixed boundary conditions as well.
During minimization, some degree of (expected) deformation occurs around the edges of the simulated particle. To avoid this I’m using the fix wall/region command to fix the x and y surfaces in place. This works really well until I create the atom on the z surface. The atom is created but remains in the same position even after the “run 1” and “minimize” command. Without the fix wall command, the atom successfully bonds to the surface after minimization. Why won’t my atom move to the surface when I use the fix wall command? My script is as follows.

--------------- INITIALIZATION ------------------

label loop2
variable CCT1 loop 0 20
variable CCT equal {CCT1}/20 variable Conc equal {CCT}*100
variable ao index 3.615 3.647 3.678 3.708 3.737 3.764 3.790 3.815 3.840 3.863 3.886 3.908 3.929 3.950 3.971 3.991 4.011 4.031 4.050 4.070 4.090

label loop1100 # loop_1_(100)
variable LP1100 loop 1 25

clear
units metal
dimension 3
boundary f f f
atom_style atomic

dump 1 all custom 1000 simbox.lammpstrj id type x y z

------------------ ATOM DEFINITION -------------------

lattice fcc ${ao} orient x 1 1 -2 orient y -1 1 0 orient z 1 1 1 # for (111) orientation

region box block -8 8 -8 8 -8 8 units lattice

create_box 2 box

region cube block -3.01 3.01 -3.51 3.51 -2.01 2.01 units lattice
region bound block -3.01 3.01 -3.51 3.51 INF INF units lattice

create_atoms 1 region cube

group Cu type 1
group Ag type 2

mass 1 63.546
mass 2 107.868

set group all type/fraction 2 ${CCT} 56584

------------------------ FORCE FIELDS -----------------------

pair_style eam/alloy
pair_coeff * * CuAg.eam.alloy Cu Ag
neighbor 2.0 bin
neigh_modify every 1 delay 0 check yes

#---------------------------Settings----------------------------

compute csym all centro/atom fcc
compute eng all pe/atom
compute eatoms all reduce sum c_eng

#----------------------Run Minimization-------------------------

#reset_timestep 0

thermo 1000
thermo_style custom step pe lx ly lz press pxx pyy pzz c_eatoms

fix wall all wall/region bound lj93 1.0 1.0 2.5

min_style cg
minimize 1e-25 1e-25 5000 10000

run 1

variable N equal count(all)
variable No equal $N

variable Up equal “c_eatoms”
variable Uperfect equal ${Up}

#--------------------------------PYTHON------------------------------------------

python xcoordinate &
return v_xcor &
format f &
here “”"
def xcoordinate():
import random
return round(random.uniform(-2, 2), 2)
“”"

variable xcor python xcoordinate
print “-------------------------------x-coordinate = ${xcor}-----------------------”

python ycoordinate &
return v_ycor &
format f &
here “”"
def ycoordinate():
import random
return round(random.uniform(-2.5, 2.5), 2)
“”"

variable ycor python ycoordinate
print “-------------------------------y-coordinate = ${ycor}--------------------------”

#--------------------------Add 1 atom on surface-------------------------------------

create_atoms 1 single {xcor} {ycor} 2.5 units lattice

run 1

#------------------------Run Minimization---------------------------------------

min_style cg
minimize 1e-25 1e-25 5000 10000

run 1

variable Us equal “c_eatoms”
variable Usurface equal {Us} variable Esurface equal {Usurface}-${Uperfect}

undump 1

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

SIMULATION DONE

#print “All done”
#print “Total number of atoms = {No}" #print "Total Initial energy of atoms = {Uperfect}”
#print “Total Energy after adatom = {Usurface}" #print "Surface energy = {Esurface}”
#print{xcor} {ycor} {No} {Uperfect} {Usurface} {Esurface}” append SBEl_Cu_${Conc}Ag(111)Cu.txt screen no

#next LP1100
#jump SELF loop1100

#next CCT1
#next ao
#jump SELF loop2

First off, please have a look at your post. Can you read your quoted input file well?
Please have a look at this post with suggestions and guidelines for posting in this forum, which also explains how to quote files correctly so that the forum software does not try to interpret symbols as markup.

This does not make sense to me. If you don’t want surface reconstruction, then don’t have a surface. Where is the value in trying to force a system into a state that it does not “want” to be in and then extract data from it?

That said, why use a wall potential? Why not just wipe out the forces on those atoms with fix setforce (after selecting them through defining regions and a group) from that? The wall potential would be like placing your system into a vise. Is that what you want to model?

Why the (complex) python commands? Why not just use equal style variables?