5 element equi-atomic system

Dear Lammps users,
I am trying to create 5 elements equiatomic system for my calculations. I am trying to have 20% of each atom for my calculations. But when I am using set command for substitution of the elements, I am not getting right proportion of atoms.
Please explain, How to get an equiatomic proportion of the atoms.
lattice fcc 3.571 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
region box block 0 40 0 40 0 40 units box
#create_box 3 box
#create_atoms 3 region box
variable fCr equal 20.0
variable fNi equal 20.0
variable fCo equal 20.0
variable fCu equal 20.0

create_box 3 box
create_atoms 1 box
set type 1 type/fraction 2 ((v_fCr+v_fNi+v_fCo+v_fCu)/100.0) 1734536* *set type 2 type/fraction 3 (v_fNi/(v_fCr+v_fNi+v_fCo+v_fCu)) 1734535
set type 3 type/fraction 4 (v_fCo/v_fNi) 1734534* *set type 4 type/fraction 5 (v_fCu/(v_fCr+v_fNi+v_fCo+v_fCu)) 1734533

group gFe type 1
group gCr type 2
group gNi type 3
group gCo type 4
group gCu type 5

print “type 1 percent: (100.0-v_fCr-v_fNi-v_fCo-v_fCu) vs (count(gFe)/atoms100.0)"
_print "type 2 percent: {fCr} vs (count(gCr)/atoms
100.0)”_
print “type 3 percent: {fNi} vs (count(gNi)/atoms*100.0)”
print “type 3 percent: {fCo} vs (count(gCo)/atoms*100.0)”
print “type 3 percent: {fCu} vs (count(gCu)/atoms*100.0)”

Thanks.

your math computing the fractions is not correct.

you need to use either something like this:

set type 1 type/fraction 2 (v_fCr/100.0) 73873645 set type 1 type/fraction 3 (v_fNi/(100.0-v_fCr)) 241325235
set type 1 type/fraction 4 (v_fCo/(100.0-v_fCr-v_fNi)) 4234234 set type 1 type/fraction 5 (v_fCu/(100.0-v_fCr-v_fNi-v_fCo)) 2344234

or something like this.

set type 1 type/fraction 2 ((v_fCr+v_fNi+v_fCo+v_fCu)/100.0) 73873645 set type 2 type/fraction 3 ((v_fNi+v_fCo+v_fCu)/(100.0-v_fCr)) 241325235
set type 3 type/fraction 4 ((v_fCo+v_fCu)/(100.0-v_fCr-v_fNi)) 4234234 set type 4 type/fraction 5 (v_fCu/(100.0-v_fCr-v_fNi-v_fCo)) 2344234

yours is in inconsistent mix of the two and thus cannot work as you expect it.

axel.

Thanks a lot Axel for your kind and timely response.

Sir,
I tried according to your method, but still, it is not working.
Input script is like that:-

*clear units metal dimension 3 boundary p p p atom_style atomic atom_modify
map array# ---------- Create Atoms --------------------- lattice
fcc 3.571 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1region box
block 0 40 0 40 0 40 units box#create_box 3
box#create_atoms 3 region boxvariable fCr equal 20.0variable fNi equal
20.0variable fCo equal 20.0variable fMn equal 20.0create_box 3
boxcreate_atoms 1 boxset type 1 type/fraction 2
\(\(v\_fCr\+v\_fNi\+v\_fCo\+v\_fMn\)/100\.0\) 73873645set type 2 type/fraction 3 ((v_fNi+v_fCo+v_fMn)/(100.0-v_fCr)) 241325235set type 3 type/fraction 4
\(\(v\_fCo\+v\_fMn\)/\(100\.0\-v\_fCr\-v\_fNi\)\) 4234234set type 4 type/fraction 5 (v_fMn/(100.0-v_fCr-v_fNi-v_fCo)) 2344234group gFe type 1group gCr type
2group gNi type 3group gMn type 4group gCo type 5print "type 1 percent:
\(100\.0\-v\_fCr\-v\_fNi\) vs (count(gFe)/atoms*100.0)"print "type 2 percent:
\{fCr\} vs (count(gCr)/atoms*100.0)"print "type 3 percent: \{fNi\} vs (count(gNi)/atoms*100.0)"print "type 4 percent: \{fMn\} vs (count(gMn)/atoms*100.0)"print "type 5 percent: \{fCo\} vs (count(gCo)/atoms*100.0)"################################## DEFINE
POTENTIAL#################################++# ---------- Define Interatomic
Potential --------------------- pair_style meam/cpair_coeff * *
library.meam Co Ni Cr Fe Mn CoNiCrFeMn.meam Co Ni Cr Fe Mn # ----------
Define Settings --------------------- compute eng all pe/atom compute
eatoms all reduce sum c_eng # ---------- Run Minimization
--------------------- reset_timestep 0 fix 1 all box/relax iso 0.0 vmax
0.001dump myDump all atom 100 dump.atomthermo 10 thermo_style custom step
pe lx ly lz press pxx pyy pzz c_eatoms min_style cg minimize 1e-25 1e-25
5000 10000 variable natoms equal "count(all)" variable teng equal
"c_eatoms"variable length equal "lx"variable ecoh equal
"v_teng/v_natoms"print "Total energy (eV) = \{teng\};"print "Number of atoms = {natoms};"print "Lattice constant (Angstoms) = \{length\};"print "Cohesive energy \(eV\) = {ecoh};"print "All done!" *
Error is:-

*ERROR: Invalid value in set command (../set.cpp:104)Last command: set type
3 type/fraction 4 $((v_fCo+v_fMn)/(100.0-v_fCr-v_fNi)) 4234234*

look at the error message and THINK.
you cannot assign an atom type 4, if you allow only 3 atom types.

the fractions are correctly computed. the error is elsewhere and rather obvious to fix.

axel.

Thanks, Axel,
I got the error.