A problem in my Lammps code of nanoindentation with a diamond indenter

Dear all,
I am trying to do nanoindentation using the diamond indenter on polycrystal and amorphous nickel, respectively. The eam potential for the Ni and L-J potential for the interaction between Ni and C. No force field parameters are set between C-C.
However, there seem to problem with my code. When the indenter contacts the metal surface, a very very large force is generated, it must be a wrong result.

In some places in the code, the use of symbols for calls would cause the published font to change, so I removed some of the call symbols.

This is the code:
units metal
boundary p p s
atom_style atomic
read_data model.data extra/atom/types 1

mass 2 12.01
lattice diamond 3.57
region 4 sphere 50 50 150 30 units box
create_atoms 2 region 4 units box
group indenter region 4
set group indenter type 2

mass 1 58.69 #Ni

pair_style hybrid eam/alloy lj/cut 10
pair_coeff * * eam/alloy Ni.eam Ni NULL
pair_coeff 1 2 lj/cut 0.0486 2.964 #Ni-C
pair_coeff 2 2 none

timestep 0.0005
neighbor 0.3 bin
neigh_modify delay 2

dump mini all custom 50 mini.dump id type x y z vx vy vz
minimize 1.0e-10 1.0e-10 10000 10000
undump mini
write_data opm.data

region 1 block INF INF INF INF INF 10 units box
group boundarylayer region 1
region 2 block INF INF INF INF 10 20 units box
group thermostatlayer region 2
region 3 block INF INF INF INF 20 100 units box
group newtonianlayer region 3
group mobile subtract all boundarylayer

fix 1 all nvt 300 300 0.1
velocity boundarylayer set 0 0 0
fix 2 boundarylayer setforce 0.0 0.0 0.0
velocity thermostatlayer create 300 5812775 temp thermostattemp
fix 3 thermostatlayer temp/rescale 10 300 300 10 1
fix_modify 3 temp thermostattemp
dump 1 all custom 1000 nvt.xyz id type x y z
run 60000
write_data relax.data

fix 1 thermostatlayer nvt temp 300 300 0.05
fix_modify 1 temp thermostattemp
fix 2 newtonianlayer nve
fix 3 boundarylayer setforce 0.0 0.0 0.0

displace_atoms ball move 0 0 -15 units box

variable depth equal 30
variable gap equal 5
variable load_step equal 35/0.5/0.0005

variable pos equal xcm(tool,z)
variable initial_pos equal ${pos}
variable depp equal -(v_pos-({initial_pos}))

compute forcez tool property/atom fz
compute f11 tool reduce sum c_forcez
variable loadz1 equal c_f11*1.603

dump 1 all custom 200 indent.xyz id type x y z

fix 4 tool move linear 0.0 0.0 0.5 units box
run ${load_step}

Thank you all for your help!

How do you know it must be a wrong result? What force are you expecting, and what force do you get instead?

Dear srtee,
Thank you for your reply.
In fact, I used to use virtual indenter and get a force of a few hundred. However, when I use diamond indenter, I get the values as shown in the figure. And the situation only during the indentation of amorphous and polycrystal, the parameters obtained for single crystals are correct.
Thank you for your reply again.
屏幕截图 2024-10-13 132112

Well, you will just have to compare the input files between the four different cases you’ve mentioned (“virtual indenter”, single crystal, amorphous, and polycrystal) to determine what changed between them that in turn caused your output results to change.

It is impossible to debug differences between those scripts without seeing them (and even if we did see them, there is a large volume of information involved in reading through four different scripts, which isn’t realistic for unpaid forum volunteers to look through).

Having said that, I am not even sure why the input script you’ve posted is incomplete – for example, there are multiple references to a thermostattemp compute that doesn’t appear in what you’ve pasted.

You also have a fix nvt trying to thermostat your whole box while including an immobile subset of atoms, and then a second thermostat attempting to thermalize the “thermostat layer” at the same time, during your relaxation (which as a result really can’t be considered a valid relaxation, at least not to 300 K).

I can understand that you may have simplified the script before posting it – but if the simplified script is substantially different from what you originally ran, then it can’t really help us understand how you got your original results.

One last note: you can use triple tildes,

```
!@#$   like this, !@#$
```

for “verbatim rendering” that will prevent any code symbols from affecting formatting.

Dear srtee,
Thank you for your reply and advice!
I’ll try to modify my code and run it again.