Problem regarding fix atom/swap

Dear LAMMPS Community,

I am currently trying to perform a hybrid MD-MC simulation for a polydisperse LJ liquid. To achieve this, I am using the “sphere” atom type, allowing me to input the radius of the particles. The corresponding pair is computed using the pair_modify command, and for MD, I employ the pair_style lj/cut/sphere. Additionally, I use the fix atom/swap command for MC.

While the MD part works as expected, I encounter a segmentation fault when I introduce the fix atom/swap command. Unfortunately, I am not able to figure out the problem.

Your help on this matter would be greatly appreciated.

Below, I have attached a sample input file. I am using lammps August 2023 version.

log logfile

variable i equal 1

variable T equal 1.00
variable rho equal 1.3
variable seed3 equal (82367+$i*10000)

dimension 3
boundary p p p

units lj
atom_style sphere

read_data init_poly.dat

pair_style lj/cut/sphere 2.5

pair_coeff 1 1 1.0 2.5
pair_coeff 2 2 0.5 2.5
pair_modify mix arithmetic
pair_modify shift no

timestep 0.005

neighbor 0.3 bin
neigh_modify every 20 delay 0 check no

velocity all create T {seed3}

fix 2 all nvt temp $T $T 0.1

fix mc all atom/swap 1 1 ${seed3} 1.0 ke no types 1 2

run 10

unfix 2

unfix mc

The algorithm implemented by fix atom/swap requires per-atom-type masses and thus is not compatible with your system. You would have to reprogram parts of the algorithm in the fix source code to rescale the atom velocities by the square root of the ratio of their their individual masses instead of using the pre-computed per-atom-type ratios.

We will add a check so that the fix will print an error message instead of crashing with a segmentation fault.

Sorry.

Thank you for your prompt response. I will try to implement your suggestions in the source code, specifically in the fix_atom_swap.cpp file.

Good luck with that. If you are successful, please consider contributing your changes back to the LAMMPS repository so that others trying the same kind of studies can benefit from it. 3. Modifying & extending LAMMPS — LAMMPS documentation

Thanks a lot. I will give it a shot for my situation. If it works out and can be useful more widely, I will include the modified code.

Following up on this thread with a similar issue, but with an atom style that defines per-type masses, which should work. It looks like this is an issue with the way the Buckingham is implemented in the pair hybrid/overlay. Removing the Buckingham and using the same input file modified for only two atoms runs fine. Am I not able to swap an eam atom for a Buckingham atom? Below are excerpts from my input file, along with the segmentation fault error. Thanks!

units metal
atom_style charge
atom_modify sort 0 0.0
atom_modify map array
dielectric 1.0
boundary p p p
variable tem equal 1500

variable lattpar equal 5.4
lattice fcc ${lattpar}
region box block 0 14 0 14 0 14 units lattice
create_box 3 box
create_atoms 3 box

#Setting the variables to elements as they are assigned in the input structure file

variable O equal 1
variable Gd equal 2
variable U equal 3

#Group Types

group Uranium type {U} group Gadolinium type {Gd}
group Oxygen type ${O}

set type {O} charge -1.110400 set type {Gd} charge 1.6656
set type ${U} charge 2.220800

kspace_style pppm 1.0e-5
variable SR_CUTOFF equal 11.0

pair_style hybrid/overlay buck {SR_CUTOFF} coul/long {SR_CUTOFF} eam/alloy
pair_coeff * * coul/long
pair_coeff * * eam/alloy /home/beelbw/lammps_work/potentials/CeThUNpPuAmCmO.eam.alloy O NULL U
pair_coeff 1 2 buck 37562.031393379206 0.19377082164993292 0

mass 3 238.02861
mass 1 15.9994
mass 2 157.25

------- big jump -----

set type 3 type/ratio 2 0.5 97543

fix 1 all npt temp {tem} {tem} 0.1 iso 0.0 0.0 0.5
timestep 0.0005

fix center all recenter INIT INIT INIT

fix 44 all atom/swap 5 1 97531 1500 types 2 3

run 5000


On trying to do the atom/swap:

YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

Please have a look at the forum guidelines and follow them more closely. What you should learn from that is that

  1. You should post a new topic with your question. Even if there is some similarity, appending a discussion or a discussion that had a different cause (and resolution) is a bad idea and makes it difficult for people in the future that want to look up the discussion because they have the same issue. Currently they have to read through two discussions.
  2. You should correctly quote text files in your input. Just look at your post! Does it read correctly for you?