# Material %age in HEA

Hi! I’m new here & trying to run a few tests on High Entropy Alloys using Lammps. But I’m struggling to write the code to define percentages. The following code generates a simulation cell with massive blank spaces in between scattered particles. Any help would be greatly appreciated.

region HEA block 0 5 0 5 0 5
create_box 5 HEA

lattice bcc 3.94 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
create_atoms 1 region HEA
set region HEA type/fraction 2 .15 1479
set region HEA type/fraction 3 .10 1479
set region HEA type/fraction 4 .10 1479
set region HEA type/fraction 5 .05 1479

Well, do the math of what you are doing and you should see how to do it better. The problem is that you are expecting the LAMMPS software to act as a human being and understand context, but it is a computed program and will do exactly to the letter of what you are asking.

This will convert 15% of any of the atoms in the HEA region to type 2. Since all atoms are of type 1 you will end up with 15% type 2 atoms.

This will convert 10% of any of the atoms in the HEA region to type 3. Since now the atoms are a mix of type 1 and type 2 you will end up with 10% of the type 3 atoms, but no longer have 15% of type 2. In fact, because you are using the same random number seed you will get the same sequence of random numbers for lattice sited and thus likely convert only type 2 atoms to type 3.

What you have to do with the `set type/fraction` command is the following (please see below for an alternative):

• compute how many atoms of the total are 15, 10, and 5 percent
• when converting to a different type you should use `set type 1 type/fraction ...`
• after the first set command, you have to look at how many atoms you have left and then compute what is the percentage of the remaining type 1 atoms that gives you 10% of the total in type 3 atoms.
• repeat this for types 4 and 5

This has been explained multiple times in the past, so if you need a better understand, please search through the archives for those older discussions.

What most of those older discussions are missing, however, is the rather recent `type/subset` option of the set command. With that you can make the process easier:

• compute how many atoms of the total are 15, 10, and 5 percent
• when converting to a different type you should use `set type 1 type/subset ...`
• now for each new type just use the precomputed numbers to a subset of atoms of type 1 to the new type. The final count should match the desired ratios

P.S.: please post LAMMPS questions in one of the LAMMPS categories and not in unrelated places like the Materials Project.

1 Like

@akohlmey Thanks a lot. I calculated the percentages and used the type/fraction command as you instructed. The structure has the intended percentages of all 5 materials. However, the blank space problem is still persisting. The blank volume isn’t much but I believe this is causing a few problems for my DXA. I think it may have been caused by the imperfect fractions (as the fractions do not add up to full 100% and thus a few particles go missing) but I can not find any way around it. Can you share some relevant threads or just let me know in the reply what to do about it? Thanks again for your time

Try putting the lattice command first.
Also try,

create_atoms 1 box

1 Like