[lammps-users] semi-grand canonical fix returning identical number of swaps for different values of chemical potential

Dear lammps users,

I am trying to do semi-grand canonical using the fix SGMC as described in the lammps-user manual.
The atomic system is of high entropy alloy CoCuCrFeNi. I am using mu values only for Co (Atom Type # 1) and Cr (Atom Type# 3). Keeping the mu value of Co fixed at 0.0, I varied the mu value of Cr. I was unable to get a limited number of swaps when I tried mu_Cr = 1.0. As such I tried another value or mu_Cr=2.0. I noticed that the trend for the number of swaps with timesteps was identical between the two simulations run with different mu_Cr values. The aim is to find a mu_Cr value that would return less than 100 swaps of Co atoms to Cr atoms or vice versa.

I subsequently tried more combinations with mu_Cr varying from -2.0 to 3.0. And I keep getting the same number of swaps with the number of timesteps, irrespective of the mu_Cr value.

I had previously done a similar simulation with swaps between Co and Cu (Atom Type# 2) in the same system by changing mu_Cu values and keeping mu_Co fixed at 0.0. That system worked very well and I was able to find the answer I was looking for.

I have tried clearing the cache and restarted the system as a precaution and that didn’t work.

Attached is the input deck I am using. Can someone please point me to what i might be doing wrong?

mu_calc_pure.in (2.91 KB)

Aidan may be able to comment.

To clarify you are using fix atom/swap with its semigrand option.


Hi Steve,

Yes. That is correct. I’m trying to use it on high entropy alloy system with 5 constituent elements.

Semigrand simulations using fix atom/swap can be difficult to equilibrate. I suggest proceeding with caution, starting with simpler systems to get a feel for the right simulation parameter ranges and the right simulation response. Well-equilibrated simulations will show expected changes in average chemical composition in response to changes in the chemical potential differences, but composition should not depend on the absolute values of the chemical potentials. The composition should also be insensitive to the initial conditions and other simulation parameters.

If you find evidence of an actual error in the documentation or in the code, please let us know.


Hi Nipun,

I took a look at the fix atom/swap code. There appears to be an undocumented restriction. The code assumes that the list of exchanged species corresponds one-to-one with LAMMPS atom types 1,…,nswaptypes, listed in the same order. Can you check if rearranging your LAMMPS types to conform to this requirement eliminates the problem?



Hi Aidan,

Thank you so much for looking into this.
The system we are trying to analyze is quinary high-entropy alloy. So 5 different elements. At any time, we are trying to have swaps between only 2 specific atom types out of the 5 that constitute the system.
In your comment below, did you mean that when using sgmc atom/swap in a quinary alloy, if i have to choose any 2 of the 5 atom types in the system, i should strictly attempt swaps between sequential atoms type like Type 1 and 2, or Types 3 and 4 etc, and avoid skipping atom types?
I tried that with type 1 and type 2, and it worked.
Is it possible to avoid the constraint you have mentioned? We are trying to determine the ideal delta mu values between different constituent elements and it has proven to be difficult finding equilibrium in some cases as we shared with you earlier. so we are hopeful that by attempting a different combination of elements for the swaps, we will be able to find the mu values we are looking for.
Please suggest.

Hi Nipun,

Yes, with the current code, if you want to exchange 2 of 5 LAMMPS types, then they must be listed like this:

fix SGMC all atom/swap 1 100 345 1.0 semi-grand yes types 1 2 mu 0.0 4.3

not like this:

fix SGMC all atom/swap 1 100 345 1.0 semi-grand yes types 2 3 mu 0.0 4.3

If you send me two small examples of these two use cases, I can use them to test some code modifications that I have made to correctly handle the second case. The examples should be constructed so that they will yield exactly identical evolution of energy, composition, etc. if the modified code is correct.


Hi Aidan,

I only have the quinary alloy system to share. At the link here, you will find the data file and the interatomic potential file we are using. You will also find two input decks.
I was able to find an equilibrium delta mu between atom type 1 (Cobalt) and atom type 5 (Nickel) as 0.045 with Cobalt at 0.045 and Nickel at 0.0. Refer input deck co0p045ni0p0.in
However, when I tried with a shift of 0.045 (input deck co0p0nim0p045.in), it did not return the same result.

I’ve also added you to the drive so you can make edits in that folder if needed. Please let me know if you have any trouble accessing the files.

Thank you so much for helping out with this.