semi grand canonical simulation using fix atom/swap

Hello everyone,

I am new to LAMMPS and attempting semi grand canonical simulations in Fe bulk with 0.1% phosphorus impurity, at 600K. The input script looks as follows

variable T equal 600
units metal
dimension 3
boundary p p p
atom_style atomic
read_data Fe-P_bulk.lmp # 0.1 % P with total of 16000 atoms (Fe+P)
pair_style meam
pair_coeff * * FeP.library.meam Fe P FePparameter.meam Fe P
fix 1 all box/relax iso 0.0001 vmax 0.1 nreset 10
thermo 10
thermo_style custom step temp pxx pyy pzz press pe etotal lx ly lz
minimize 1.0e-12 1.0e-12 100000 100000
unfix 1
velocity all create $T 825577 mom yes rot no
reset_timestep 0
fix 2 all npt temp $T $T 0.1 iso 0.0 0.0 0.1
run 100000
unfix 2
fix 3 all nvt temp $T $T 0.1
run 100000
unfix 3
dump 2 all custom 10 dump.semiGC id type xu yu zu
dump_modify 2 append yes
reset_timestep 0
timestep 0.001
fix 4 all atom/swap 1 2000 12345 $T semi-grand yes types 1 2 mu 0.75 0.0
run 10000

I repeat this simulation for different Δmu values at 600K. But all simulations show that the number of P atoms (P at. concentration) remains unchanged. In fact plot of at.% of P vs Δmu is supposed to be linear. Anything wrong with my input script? Can anyone here please help me? Thank you in advance.


Lund, Sweden

please always report the LAMMPS version in use and the platform you
are running on.
it may also be helpful to review the messages about fixed bugs here:
or on the equivalent pages for previous years, if you are using an
older version of LAMMPS.