My variable repeats itself multiple times before moving to the next index

I am currently calculating the bulk modulus for different chemical compositions of Cr and Ni. While I recognize that my current approach may seem somewhat “brute force,” it was the most feasible method for me after reviewing the documentation. However, I realize now that I may not have fully grasped the concept. Initially, the method skips the 0.08 value for Ni and jumps to 0.09, resulting in redundant output before moving to the next Ni variable.

I would greatly appreciate any suggestions for improvement or alternative methods. Thank you for your time.

Attached is the file in.elastic2 (5.9 KB), and I can provide excerpts from the output file if needed.

edit : Version stable_2Aug2023_update3

You are trying to achieve a double loop over two large numbers of values in a single input file. This is overengineering if you do not understand the loop and variable systems of LAMMPS which is quite specific, very powerful but source of many mistakes. Why make it complicated?

It would be easier to make a single input file, with variables you could pass as arguments, and make the double loop outside of LAMMPS using a scripting language easier to read/write. You lose nothing by making a directory per simulation and aggregate your results in a single file during post-processing.

If you really want to go into that way, please have a look at the next command, which is the correct way to iterate over index style variables. But the fact that you can make convoluted series of simulation in a single LAMMPS script does not mean you should.

2 Likes