debugging the code by printing out some numerical data from .cpp files

Hi All,

I’m trying to add some lines in one of the .cpp files which in addition to printing the error message also print some numerical values which are the cause of error.

I’m making use of the of the below format from “neigh_bond.cpp” file (this file is located in src folder)

char str[128];
sprintf(str, "Bond atoms %d %d missing on proc %d at step " BIGINT_FORMAT, tag[i],bond_atom[i][m],me,update->ntimestep);

Based on the above three lines I have added the below three lines to the file fix_srd.cpp (this file is located in src/SRD folder)

char str[128];
sprintf(str,“FIX SRD: too many big particles in bin %d %d”,BIGINT_FORMAT, jbin, nbinbig[jbin]);

by replacing the line - error->one(FLERR,“Fix SRD: too many big particles in bin”); so that in addition to the error message the numerical values jbin and nbinbig[jbin] are printed to the screen.

But when I recompile lammps, I’m getting the error - “fix_srd.cpp”, The name lookup for “str” did not find a declaration.

Could anyone please help me in fixing this error.

Thanks much.

I think you'll have to figure out compiler errors yourself,
since it's complaining about the lines of code you added.
For starters, the string has 3 fields including BIGINT_FORMAT,
and you gave it 2 parameters, neither of which are bigints, BTW.