Hello,
I have implemented THB1 potential for an earlier version of LAMMPS (lammps-5Sep14), I later tried to make few modification to the pair_style file, to debug I used fprintf(screen/logfile, ) command.
The code compiles without error but I am unable to see the data printed either in screen or logfile.
But I found the fprintf command works perfectly for LAMMPS default pair_styles (eg. lj/cut).
Am I missing something ?? Kindly help
Thank you,
Regards,
Srinivasan Mahendran
Hello,
I have implemented THB1 potential for an earlier version of LAMMPS
(lammps-5Sep14), I later tried to make few modification to the pair_style
file, to debug I used fprintf(screen/logfile, ) command.
The code compiles without error but I am unable to see the data printed
either in screen or logfile.
But I found the fprintf command works perfectly for LAMMPS default
pair_styles (eg. lj/cut).
Am I missing something ?? Kindly help
fprintf() is a function of the C library and thus will behave exactly the
same everywhere, if used correctly.
axel.
Yes I accept it’s a library function whereas,
For example I used the following fprintf command
fprintf(screen,"\n TEST \n");
in pair_lj_cut.cpp and also in the pair_style_x.cpp file I created and compile
when I called these pairs styles from a input file to minimize, when pair_lj_cut.cpp is called from the input file TEST prints every time the sub routine is called
whereas it does not print when pair_style_x.cpp is called from the input file.
Sri
Yes I accept it's a library function whereas,
For example I used the following fprintf command
fprintf(screen,"\n TEST \n");
in pair_lj_cut.cpp and also in the pair_style_x.cpp file I created and
compile
when I called these pairs styles from a input file to minimize, when
pair_lj_cut.cpp is called from the input file TEST prints every time the
sub routine is called
whereas it does not print when pair_style_x.cpp is called from the input
file.
i see no reason why it should not unless you print out something right
before your code is crashing. the print is still working, but you won't see
it, because
file i/o is by default block buffered. in that case i/o won't be committed
to file unless you modify the settings to do line buffered i/o or
explicitly flush the file pointer.
at any rate, this is not a LAMMPS issue, but C-programming 101 and thus
very off-topic for this list.
axel.