MD / MC hybrid simulation of grain boundary atom segregation in metallic materials

Hello everyone, I now want to use MD / MC hybrid simulation to calculate the number of solute atoms at the grain boundary of Mg-4 % Ca alloy, using the fix atom / swap command to carry out, but found that the calculated number of solute atoms at the grain boundary fluctuates greatly, sometimes more and sometimes less, what is the cause of this situation, what is the wrong parameter setting ,Thank you. Here is my in file:

#-------------Initial Variable--------------#
variable etol equal 1e-15
variable ftol equal 1e-15
variable maxiter equal 5000
variable maxeval equal 1e4

units metal
boundary p p p
atom_style atomic
timestep 0.0025
read_data polycrystal13.lmp
mass 1 24.305 # Mg
mass 2 40.078 # Ca

region upper block INF INF 0 62 INF INF units box
group upper region upper
region lower block INF INF 62 124 INF INF units box
group lower region lower

set type 1 type/ratio 2 0.04 23985

group solute type 2
group body type 1

region mid block INF INF 59 65 INF INF units box
group mid dynamic all region mid every 10
region left block INF INF 43 49 INF INF units box
group left dynamic all region left every 10
region right block INF INF 75 81 INF INF units box
group right dynamic all region right every 10
write_data Mg.data

pair_style meam/c
pair_coeff * * library.meam Ca Mg CaMg.meam Mg Ca
neighbor 2.0 bin
neigh_modify delay 10 check yes

#---------Run minimize for tx and tz------
thermo 10000
thermo_style custom step pe lx ly lz press pxx pyy pzz
min_style cg
minimize {etol} {ftol} {maxiter} {maxeval}

compute Pe_atom all pe/atom
compute mytemp all temp
compute_modify mytemp dynamic/dof yes
compute_modify thermo_temp dynamic yes

variable N3 equal count(mid)
variable N4 equal count(left)
variable N5 equal count(right)
variable N6 equal count(solute,mid)
variable N7 equal count(solute,left)
variable N8 equal count(solute,right)
variable N equal v_N6-v_N3v_N7/v_N4
variable M equal v_N6-v_N3
v_N8/v_N5
variable O equal v_N6/v_N3
variable P equal v_N7/v_N4
variable Q equal v_N8/v_N5
variable R equal v_N6
variable S equal v_N7
variable istep equal step

dump 1 all custom 10000 wending.dump id type x y z vx vy vz
fix 1 all npt temp 873 873 0.1 iso 0.0 0.0 1000
run 400000
undump 1
reset_timestep 0
unfix 1

dump 1 all custom 1000 static.dump id type x y z vx vy vz
fix 1 all npt temp 873 873 0.1 iso 0.0 0.0 1000
fix_modify 1 temp mytemp
fix 3 all print 1000 “{istep} {N} {M} {O} {P} {Q} {R} {S}” file N-static.txt screen no
fix SGMC all atom/swap 20 240 29494 873 semi-grand yes types 1 2 mu 0 -0.7

run 1200000
write_data Mg3.data

How do you know that what you see is incorrect?
And assuming that the behavior is not correct, how do you know that some single parameter is the cause and not your entire simulation geometry/setup?

Thank you for your reply. It is found that the number of solute atoms in each region has been changing, so the feeling is somewhat problematic. I think the number of solute atoms in each region tends to a stable value, but I have not yet found a specific reason.

So, in other words, you don’t have an idea, just a hunch. You cannot do science based on hunches.

Here is my “counter-hunch”:
Properties in atomistic simulations often have large fluctuations because the number of particles is rather small and so are the volumes. So if some displacements happen due to thermal fluctuations they can cause rather large relative changes. For most thermodynamic data, people rely on the fact that a system in equilibrium samples the same phase space over time and thus perform time averaging in addition to averaging over the volume or number of particles.
This actually can be quantified as you can find explained in text books on statistical mechanics and thermodynamics.

Thank you very much for your reply, very professional

I have another question to ask, is the number of atoms exchanged by MC is the total number of solute atoms in the model?Thank you

None of the MC fixes knows anything about whether an atom is part of the solute or not. They just operate on the fix group atoms.

More generally speaking, in MC you provide the number of exchange attempts and the exchange acceptance criterion as input parameters. Please have a closer look into a text book on simulations that explains how MC simulations work.

Thank you for your reply.Is there a standard for the choice of the number of exchange atoms, or is there an empirical number?

This is not a LAMMPS question, but a question of the science. Please consult a suitable text book and / or your adviser or tutor or experienced colleagues.

Okay, I see. Thank you very much for your warm reply.