[lammps-users] Regarding set type/fraction for alloy making

Hi all,
Using Lammps (15 Apr 2020) to generate a Ti-20Ta-20Nb-20Zr-20Mo alloy. Here fractions for the Ta, Nb, Nb, and Zr are in Wt. %. For this I used set type/fraction like below
variable fTa equal 20
variable fNb equal 20
variable fZr equal 20
variable fMo equal 20
create_box 5 box
create_atoms 1 box
set type 1 type/fraction 2 ((v_fTa+v_fNb+v_fZr+v_fMo)/100) 1734536 set type 2 type/fraction 3 (v_fNb/(v_fTa+v_fNb+v_fZr+v_fMo)) 1734535
set type 2 type/fraction 4 (v_fZr/(v_fTa+v_fNb+v_fZr+v_fMo)) 1734534 set type 2 type/fraction 5 (v_fMo/(v_fTa+v_fNb+v_fZr+v_fMo)) 1734533
group gTi type 1
group gTa type 2
group gNb type 3
group gZr type 4
group gMo type 5
print “type 1 percent: (100.0-v_fTa-v_fNb-v_fZr-v_fMo) vs (count(gTi)/atoms100.0)"
print "type 2 percent: {fTa} vs (count(gTa)/atoms
100.0)”
print “type 3 percent: {fNb} vs (count(gNb)/atoms100.0)"
print "type 4 percent: {fZr} vs (count(gZr)/atoms
100.0)”
print “type 5 percent: {fMo} vs (count(gMo)/atoms*100.0)”

After running the input file I am getting a different weight fraction in the output file.

**output file**
print "type 1 percent: $(100.0-v_fTa-v_fNb-v_fZr-v_fMo) vs $(count(gTi)/atoms*100.0)"
type 1 percent: 20 vs 20.179253754996391734
print "type 2 percent: ${fTa} vs $(count(gTa)/atoms*100.0)"
type 2 percent: 20 vs 33.544047472310758451
print "type 3 percent: ${fNb} vs $(count(gNb)/atoms*100.0)"
type 3 percent: 20 vs 20.084168266098501476
print "type 4 percent: ${fZr} vs $(count(gZr)/atoms*100.0)"
type 4 percent: 20 vs 14.953073550386505985
print "type 5 percent: ${fMo} vs $(count(gMo)/atoms*100.0)"
type 5 percent: 20 vs 11.239456956207849458

Why these fractions are not matching with the input values? How can

I get the same fractions in output file like in input file. 



you don’t get the expected “exact” percentages of the total because a) that is not what you are asking for and because b) type/fraction is only using a fast approximation, use type/ratio if you want a more precise ratio.

please look at your commands:
create_atoms 1 box

set type 1 type/fraction 2 ((v_fTa+v_fNb+v_fZr+v_fMo)/100) 1734536 set type 2 type/fraction 3 (v_fNb/(v_fTa+v_fNb+v_fZr+v_fMo)) 1734535
set type 2 type/fraction 4 (v_fZr/(v_fTa+v_fNb+v_fZr+v_fMo)) 1734534 set type 2 type/fraction 5 (v_fMo/(v_fTa+v_fNb+v_fZr+v_fMo)) 1734533

  • first you create all atoms as type 1 atoms
  • then you convert 80% of type 1 atoms to type 2
  • then you convert 25% of type 2 atoms to type 3
  • then you convert 25% of the remaining type 2 atoms to type 4
  • then you convert 25% of the remaining type 2 atoms to type 5

assuming that you have 100 atoms of type 1 in the beginning then you have:

  • 20 atoms of type 1 and 80 atoms of type 2 after the first set command
  • 20 atoms of type 1, 60 atoms of type 2 and 20 atoms of type 3 after the second set command
  • after the third set command you have 15 atoms of type 4 and 45 atoms of type 2 (60*0.25=15)
  • after the final set command you have 11 atoms of type 4 and 34 atoms of type 2 (45*0.25=11.25)

so the problem is in your math.

axel.

Thank you for the clarification