I received an unusual error call on : "Must use 'kim init' command before the simulation box is defined (src/KIM/kim_init.cpp:89)."

Hello everyone,

I know this is my second question this week, but unfortunately, even after thoroughly reviewing the documentation, I couldn’t find the answer myself.

I was trying to create a loop to calculate the elastic constants for a range of alloy ratios. Initially, I ran the code without jump in.elastic2, and it executed without any errors. However, it wasn’t looping as expected. When I added the jump in.elastic2 lines to introduce the looping, the following error occurred:

next j
jump in.elastic2
next i
jump in.elastic2

Could someone help me understand why this error is happening and how to fix it?

Thank you!
in.elastic2 (4.5 KB)
edit : version lammps/stable_2Aug2023_update3


I think this is what’s happening. It’s kind of the opposite of the issue with ‘clear’ you had previously.

As the error message is suggesting, you are calling kim init while the simulation box a has already been defined. This is because you are just re-running the script from the top when you jump, with your simulation box and everything still existing. So this is the problem you need to solve. My first approach would be to jump not to the top of the file, but to a label that is declared below the kim init command (you also have two of them for some reason, you only need one): jump command — LAMMPS documentation

Not sure if this solution will work exactly, but hopefully understanding the issue will help you figure it out.

1 Like

Ah, I see what happened. I included the Jump SELF loop in the calculations for i, which caused another bug, but at least I managed to solve this issue. Thanks again for your help!

1 Like