update citation output to more closely resemble what had been proposed
This commit is contained in:
@ -17,20 +17,23 @@
|
|||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
static const char cite_header[] =
|
|
||||||
"This LAMMPS simulation made specific use of work described in the\n"
|
|
||||||
"following references. See https://lammps.sandia.gov/cite.html\n"
|
|
||||||
"for details.\n\n";
|
|
||||||
|
|
||||||
static const char cite_nagline[] = "Please see the log.cite file "
|
|
||||||
"for references relevant to this simulation\n\n";
|
|
||||||
|
|
||||||
static const char cite_seefile[] = "Please see the citation file "
|
|
||||||
"for references relevant to this simulation\n\n";
|
|
||||||
|
|
||||||
static const char cite_separator[] =
|
static const char cite_separator[] =
|
||||||
"\nCITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE\n\n";
|
"\nCITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE\n\n";
|
||||||
|
|
||||||
|
static const char cite_nagline[] =
|
||||||
|
"Your LAMMPS simulation uses code contributions which should be cited.\n"
|
||||||
|
"Please see https://lammps.sandia.gov/doc/Intro_citing.html for more\n"
|
||||||
|
"information on citing LAMMPS itself.\n";
|
||||||
|
|
||||||
|
static const char cite_short[] =
|
||||||
|
"A short list of the features is given below.\n\n";
|
||||||
|
|
||||||
|
static const char cite_full[] =
|
||||||
|
"Below is a list of the full references in BibTeX format.\n\n";
|
||||||
|
|
||||||
|
static const char cite_file[] = "Please see the {} {} "
|
||||||
|
"for detailed references in BibTeX format.\n";
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
CiteMe::CiteMe(LAMMPS *lmp, int _screen, int _logfile, const char *_file)
|
CiteMe::CiteMe(LAMMPS *lmp, int _screen, int _logfile, const char *_file)
|
||||||
@ -45,12 +48,14 @@ CiteMe::CiteMe(LAMMPS *lmp, int _screen, int _logfile, const char *_file)
|
|||||||
logbuffer.clear();
|
logbuffer.clear();
|
||||||
|
|
||||||
if (_file && universe->me == 0) {
|
if (_file && universe->me == 0) {
|
||||||
|
citefile = _file;
|
||||||
fp = fopen(_file,"w");
|
fp = fopen(_file,"w");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
fputs(cite_header,fp);
|
fputs(cite_nagline,fp);
|
||||||
|
fputs(cite_full,fp);
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
} else {
|
} else {
|
||||||
utils::logmesg(lmp, "Unable to open citation file '" + std::string(_file)
|
utils::logmesg(lmp, "Unable to open citation file '" + citefile
|
||||||
+ "': " + utils::getsyserror() + "\n");
|
+ "': " + utils::getsyserror() + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,13 +90,25 @@ void CiteMe::add(const char *ref)
|
|||||||
|
|
||||||
if (scrbuffer.empty()) {
|
if (scrbuffer.empty()) {
|
||||||
scrbuffer += cite_separator;
|
scrbuffer += cite_separator;
|
||||||
if (screen_flag == VERBOSE) scrbuffer += cite_header;
|
scrbuffer += cite_nagline;
|
||||||
if (screen_flag == TERSE) scrbuffer += cite_nagline;
|
if (!citefile.empty()) scrbuffer += fmt::format(cite_file,"file",citefile);
|
||||||
|
if (screen_flag == VERBOSE) scrbuffer += cite_full;
|
||||||
|
if (screen_flag == TERSE) {
|
||||||
|
if (logfile_flag == VERBOSE)
|
||||||
|
scrbuffer += fmt::format(cite_file,"log","file");
|
||||||
|
scrbuffer += cite_short;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (logbuffer.empty()) {
|
if (logbuffer.empty()) {
|
||||||
logbuffer += cite_separator;
|
logbuffer += cite_separator;
|
||||||
if (logfile_flag == VERBOSE) logbuffer += cite_header;
|
logbuffer += cite_nagline;
|
||||||
if (logfile_flag == TERSE) logbuffer += cite_nagline;
|
if (!citefile.empty()) logbuffer += fmt::format(cite_file,"file",citefile);
|
||||||
|
if (logfile_flag == VERBOSE) logbuffer += cite_full;
|
||||||
|
if (logfile_flag == TERSE) {
|
||||||
|
if (screen_flag == VERBOSE)
|
||||||
|
scrbuffer += fmt::format(cite_file,"screen","output");
|
||||||
|
logbuffer += cite_short;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string reference = ref;
|
std::string reference = ref;
|
||||||
@ -111,7 +128,7 @@ void CiteMe::flush()
|
|||||||
if (screen) fputs(scrbuffer.c_str(),screen);
|
if (screen) fputs(scrbuffer.c_str(),screen);
|
||||||
scrbuffer.clear();
|
scrbuffer.clear();
|
||||||
}
|
}
|
||||||
if (!scrbuffer.empty()) {
|
if (!logbuffer.empty()) {
|
||||||
logbuffer += cite_separator;
|
logbuffer += cite_separator;
|
||||||
if (logfile) fputs(logbuffer.c_str(),logfile);
|
if (logfile) fputs(logbuffer.c_str(),logfile);
|
||||||
logbuffer.clear();
|
logbuffer.clear();
|
||||||
|
|||||||
@ -29,6 +29,7 @@ class CiteMe : protected Pointers {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FILE *fp; // explicit citation file pointer or NULL
|
FILE *fp; // explicit citation file pointer or NULL
|
||||||
|
std::string citefile; // name of the explicit citation file.
|
||||||
int screen_flag; // determine whether verbose or terse output
|
int screen_flag; // determine whether verbose or terse output
|
||||||
int logfile_flag; // determine whether verbose or terse output
|
int logfile_flag; // determine whether verbose or terse output
|
||||||
std::string scrbuffer; // output buffer for screen
|
std::string scrbuffer; // output buffer for screen
|
||||||
|
|||||||
@ -1142,7 +1142,8 @@ void _noopt LAMMPS::help()
|
|||||||
"-kokkos on/off ... : turn KOKKOS mode on or off (-k)\n"
|
"-kokkos on/off ... : turn KOKKOS mode on or off (-k)\n"
|
||||||
"-log none/filename : where to send log output (-l)\n"
|
"-log none/filename : where to send log output (-l)\n"
|
||||||
"-mpicolor color : which exe in a multi-exe mpirun cmd (-m)\n"
|
"-mpicolor color : which exe in a multi-exe mpirun cmd (-m)\n"
|
||||||
"-nocite : disable writing log.cite file (-nc)\n"
|
"-cite : select citation reminder style (-c)\n"
|
||||||
|
"-nocite : disable citation reminder (-nc)\n"
|
||||||
"-package style ... : invoke package command (-pk)\n"
|
"-package style ... : invoke package command (-pk)\n"
|
||||||
"-partition size1 size2 ... : assign partition sizes (-p)\n"
|
"-partition size1 size2 ... : assign partition sizes (-p)\n"
|
||||||
"-plog basename : basename for partition logs (-pl)\n"
|
"-plog basename : basename for partition logs (-pl)\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user