I am fairly new to LAMMPS and my understanding of C++ is fairly limited, but I noticed that there was a slight change to Line 27 in ntopo_bond_all.cpp in the source code.
In the 2023 version of LAMMPS, Line 27 was: #define DELTA 10000
But in the 2024 version of LAMMPS, Line 27 is: static constexpr int DELTA = 10000
My main question is, what was the reason for the swap? I ran a simulation and obtained “Bond atoms missing” for the 2024 version but everything ran smoothly for the 2023 version, which is strange, so I am working through the source code to see why the results are different.
I also copied Line 27 from 2023 ntopo_bond_all.cpp file and replaced Line 27 in the 2024 LAMMPS ntopo_bond_all.cpp file, and recompiled. After running the simulation with the modified 2024 LAMMPS file, the simulation completed without the “bond atoms missing” error.
Thank you for your time, and I appreciate the discussions that will follow.
The “#define” line uses the C/C++ pre-processor to to apply a text replacement. There are no checks on that.
With static constexpr the exact same effect is achieved, but now within the C++ programming language (contstexpr designates a compile constant expressions) which allows for additional diagnostics like warnings if the constant is not used or if there are type mismatches.
This cannot be related to this specific change. It just indicates that your “bond atom missing” error is marginal and thus will only show up randomly. The various causes for bond atom missing errors are well documented and discussed here in the forum many, many times and you can find a summary here 11.2. Errors and warnings details — LAMMPS documentation
The solution to your problem is not in the source code. It is caused by your input. You only get lucky when the error doesn’t show.
Thank you for the input! Yes, I wanted some confidence that this was possibly a “garbage in - garbage out” scenario and the result was purely luck. My colleague and I were incredibly confused when my 2024-compiled version ran with errors while the 2023 version did not. I will definitely look into the settings to troubleshoot from my end.