git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10491 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
72
src/citeme.cpp
Normal file
72
src/citeme.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "citeme.h"
|
||||||
|
#include "version.h"
|
||||||
|
#include "universe.h"
|
||||||
|
#include "error.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static const char cite_header[] =
|
||||||
|
"This LAMMPS simulation made specific use of work described in the\n"
|
||||||
|
"following references. See http://lammps.sandia.gov/cite.html\n"
|
||||||
|
"for details.\n\n";
|
||||||
|
|
||||||
|
static const char cite_nagline[] = "\nPlease see the log.cite file "
|
||||||
|
"for references relevant to this simulation\n\n";
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
CiteMe::CiteMe(LAMMPS *lmp) : Pointers(lmp)
|
||||||
|
{
|
||||||
|
fp = NULL;
|
||||||
|
cs = new citeset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
write out nag-line at the end of the regular output and clean up
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
CiteMe::~CiteMe()
|
||||||
|
{
|
||||||
|
if (universe->me) return;
|
||||||
|
if (cs->size() == 0) return;
|
||||||
|
|
||||||
|
if (screen) fprintf(screen,cite_nagline);
|
||||||
|
if (logfile) fprintf(logfile,cite_nagline);
|
||||||
|
|
||||||
|
delete cs;
|
||||||
|
if (fp) fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
write out and register a citation so it will be written only once
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void CiteMe::add(const char *ref)
|
||||||
|
{
|
||||||
|
if (universe->me) return;
|
||||||
|
if (cs->find(ref) != cs->end()) return;
|
||||||
|
cs->insert(ref);
|
||||||
|
|
||||||
|
if (!fp) {
|
||||||
|
fp = fopen("log.cite","w");
|
||||||
|
if (!fp) error->universe_one(FLERR,"Could not open log.cite file");
|
||||||
|
fprintf(fp,cite_header);
|
||||||
|
fflush(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fp,ref);
|
||||||
|
fflush(fp);
|
||||||
|
}
|
||||||
42
src/citeme.h
Normal file
42
src/citeme.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_CITEME_H
|
||||||
|
#define LMP_CITEME_H
|
||||||
|
|
||||||
|
#include "pointers.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class CiteMe : protected Pointers {
|
||||||
|
public:
|
||||||
|
CiteMe(class LAMMPS *);
|
||||||
|
virtual ~CiteMe();
|
||||||
|
void add(const char *); // print out and register publication
|
||||||
|
|
||||||
|
private:
|
||||||
|
FILE *fp; // opaque pointer to log.cite file object
|
||||||
|
typedef std::set<const char *> citeset;
|
||||||
|
citeset *cs; // registered set of publications
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
@ -39,6 +39,7 @@
|
|||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
#include "citeme.h"
|
||||||
#include "accelerator_cuda.h"
|
#include "accelerator_cuda.h"
|
||||||
#include "accelerator_omp.h"
|
#include "accelerator_omp.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
@ -73,7 +74,9 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
int partscreenflag = 0;
|
int partscreenflag = 0;
|
||||||
int partlogflag = 0;
|
int partlogflag = 0;
|
||||||
int cudaflag = -1;
|
int cudaflag = -1;
|
||||||
|
int citeflag = 1;
|
||||||
int helpflag = 0;
|
int helpflag = 0;
|
||||||
|
|
||||||
suffix = NULL;
|
suffix = NULL;
|
||||||
suffix_enable = 0;
|
suffix_enable = 0;
|
||||||
|
|
||||||
@ -156,6 +159,10 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
error->universe_all(FLERR,"Cannot use -reorder after -partition");
|
error->universe_all(FLERR,"Cannot use -reorder after -partition");
|
||||||
universe->reorder(arg[iarg+1],arg[iarg+2]);
|
universe->reorder(arg[iarg+1],arg[iarg+2]);
|
||||||
iarg += 3;
|
iarg += 3;
|
||||||
|
} else if (strcmp(arg[iarg],"-nocite") == 0 ||
|
||||||
|
strcmp(arg[iarg],"-nc") == 0) {
|
||||||
|
citeflag = 0;
|
||||||
|
iarg++;
|
||||||
} else if (strcmp(arg[iarg],"-help") == 0 ||
|
} else if (strcmp(arg[iarg],"-help") == 0 ||
|
||||||
strcmp(arg[iarg],"-h") == 0) {
|
strcmp(arg[iarg],"-h") == 0) {
|
||||||
if (iarg+1 > narg)
|
if (iarg+1 > narg)
|
||||||
@ -393,6 +400,11 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
MPI_Comm_rank(world,&me);
|
MPI_Comm_rank(world,&me);
|
||||||
if (cuda && me == 0) error->message(FLERR,"USER-CUDA mode is enabled");
|
if (cuda && me == 0) error->message(FLERR,"USER-CUDA mode is enabled");
|
||||||
|
|
||||||
|
// allocate CiteMe class if enabled
|
||||||
|
|
||||||
|
if (citeflag) citeme = new CiteMe(this);
|
||||||
|
else citeme = NULL;
|
||||||
|
|
||||||
// allocate input class now that MPI is fully setup
|
// allocate input class now that MPI is fully setup
|
||||||
|
|
||||||
input = new Input(this,narg,arg);
|
input = new Input(this,narg,arg);
|
||||||
@ -422,6 +434,8 @@ LAMMPS::~LAMMPS()
|
|||||||
{
|
{
|
||||||
destroy();
|
destroy();
|
||||||
|
|
||||||
|
delete citeme;
|
||||||
|
|
||||||
if (universe->nworlds == 1) {
|
if (universe->nworlds == 1) {
|
||||||
if (logfile) fclose(logfile);
|
if (logfile) fclose(logfile);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* ----------------------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
http://lammps.sandia.gov, Sandia National Laboratories
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
Steve Plimpton, sjplimp@sandia.gov
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
@ -44,8 +44,11 @@ class LAMMPS {
|
|||||||
|
|
||||||
char *suffix; // suffix to add to input script style names
|
char *suffix; // suffix to add to input script style names
|
||||||
int suffix_enable; // 1 if suffix enabled, 0 if disabled
|
int suffix_enable; // 1 if suffix enabled, 0 if disabled
|
||||||
|
int cite_enable; // 1 if generating log.cite, 0 if disabled
|
||||||
class Cuda *cuda; // CUDA accelerator class
|
class Cuda *cuda; // CUDA accelerator class
|
||||||
|
|
||||||
|
class CiteMe *citeme; // citation info
|
||||||
|
|
||||||
LAMMPS(int, char **, MPI_Comm);
|
LAMMPS(int, char **, MPI_Comm);
|
||||||
~LAMMPS();
|
~LAMMPS();
|
||||||
void create();
|
void create();
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "respa.h"
|
#include "respa.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
#include "citeme.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
@ -51,6 +52,19 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
enum{NSQ,BIN,MULTI}; // also in neigh_list.cpp
|
enum{NSQ,BIN,MULTI}; // also in neigh_list.cpp
|
||||||
|
|
||||||
|
static const char cite_neigh_multi[] =
|
||||||
|
"neighbor multi command:\n\n"
|
||||||
|
"@Article{intveld08,\n"
|
||||||
|
" author = {P.{\\,}J.~in{\\,}'t~Veld and S.{\\,}J.~Plimpton"
|
||||||
|
" and G.{\\,}S.~Grest},\n"
|
||||||
|
" title = {Accurate and Efficient Methods for Modeling Colloidal\n"
|
||||||
|
" Mixtures in an Explicit Solvent using Molecular Dynamics},\n"
|
||||||
|
" journal = {Comp.~Phys.~Comm.},\n"
|
||||||
|
" year = 2008,\n"
|
||||||
|
" volume = 179,\n"
|
||||||
|
" pages = {320--329}\n"
|
||||||
|
"}\n\n";
|
||||||
|
|
||||||
//#define NEIGH_LIST_DEBUG 1
|
//#define NEIGH_LIST_DEBUG 1
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -1644,6 +1658,8 @@ void Neighbor::set(int narg, char **arg)
|
|||||||
else if (strcmp(arg[1],"bin") == 0) style = BIN;
|
else if (strcmp(arg[1],"bin") == 0) style = BIN;
|
||||||
else if (strcmp(arg[1],"multi") == 0) style = MULTI;
|
else if (strcmp(arg[1],"multi") == 0) style = MULTI;
|
||||||
else error->all(FLERR,"Illegal neighbor command");
|
else error->all(FLERR,"Illegal neighbor command");
|
||||||
|
|
||||||
|
if (style == MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user