Menu

debug-practice

Shun Sakuraba Nobuyuki MATUBAYASI

Debugging practice for the reference-solvent calculation

When some modification is made for the program, it is a common practice that same inputs are fed to the programs before and after the modification.
If the modification of the program is not meant to change the results from those inputs, this practice is useful to detect a possible bug.

This practice works readily for the soln system.
When the directories of soln_old and soln_new have the results from the programs before and after the modification, respectively,

diff soln_old soln_new

tests the differences of all the output files at once, and no difference is supposed to be seen for the erdst outputs if the modification is correct.

For the refs run, in contrast, a similar procedure does not work at the default setting.
This is because the seed of the random number used for insertion is generated randomly in the default setting.
Even when everything else is common, two refs runs provide different results if the random-number seed is different.
It is not convenient for debugging.

For the debugging purpose, a convenient scheme is to fix the random-number seed.
It is enough to open the parameters_er file and add a line of

iseed = (any non-zero number within 18 digits, e.g., 123456789),

in the &ene_param section.
With this setting, when the same parameters_er file as well as the same ones of the other files are fed to the erdst programs before and after the modification, the sequence of the random numbers is the same and the outputs are supposed to be the same.

diff refs_old refs_new

is then convenient to test the differences all at once, where refs_old and refs_new are the directories for the results from the ermod runs before and after the modification, respectively.


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.