2006-09-28 03:51:33 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
2007-01-30 08:22:05 +08:00
|
|
|
http://lammps.sandia.gov, Sandia National Laboratories
|
|
|
|
Steve Plimpton, sjplimp@sandia.gov
|
2006-09-28 03:51:33 +08:00
|
|
|
|
|
|
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
|
|
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
2012-06-07 06:47:51 +08:00
|
|
|
certain rights in this software. This software is distributed under
|
2006-09-28 03:51:33 +08:00
|
|
|
the GNU General Public License.
|
|
|
|
|
|
|
|
See the README file in the top-level LAMMPS directory.
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2015-10-31 04:04:06 +08:00
|
|
|
#include <mpi.h>
|
2018-04-28 05:41:04 +08:00
|
|
|
#include <cstring>
|
|
|
|
#include <cctype>
|
2006-09-28 03:51:33 +08:00
|
|
|
#include "lammps.h"
|
2011-08-23 23:22:08 +08:00
|
|
|
#include "style_angle.h"
|
|
|
|
#include "style_atom.h"
|
|
|
|
#include "style_bond.h"
|
|
|
|
#include "style_command.h"
|
|
|
|
#include "style_compute.h"
|
|
|
|
#include "style_dihedral.h"
|
|
|
|
#include "style_dump.h"
|
|
|
|
#include "style_fix.h"
|
|
|
|
#include "style_improper.h"
|
|
|
|
#include "style_integrate.h"
|
|
|
|
#include "style_kspace.h"
|
|
|
|
#include "style_minimize.h"
|
|
|
|
#include "style_pair.h"
|
|
|
|
#include "style_region.h"
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "universe.h"
|
|
|
|
#include "input.h"
|
2018-05-10 01:06:34 +08:00
|
|
|
#include "info.h"
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "atom.h"
|
|
|
|
#include "update.h"
|
|
|
|
#include "neighbor.h"
|
|
|
|
#include "comm.h"
|
2014-05-13 23:23:13 +08:00
|
|
|
#include "comm_brick.h"
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "domain.h"
|
|
|
|
#include "force.h"
|
|
|
|
#include "modify.h"
|
|
|
|
#include "group.h"
|
|
|
|
#include "output.h"
|
2013-07-31 03:52:46 +08:00
|
|
|
#include "citeme.h"
|
2014-02-11 08:09:44 +08:00
|
|
|
#include "accelerator_kokkos.h"
|
2013-02-09 01:12:58 +08:00
|
|
|
#include "accelerator_omp.h"
|
2007-01-30 08:22:05 +08:00
|
|
|
#include "timer.h"
|
2017-04-12 09:22:30 +08:00
|
|
|
#include "python.h"
|
2011-08-23 23:22:08 +08:00
|
|
|
#include "memory.h"
|
2016-11-08 06:10:12 +08:00
|
|
|
#include "version.h"
|
2011-08-23 23:22:08 +08:00
|
|
|
#include "error.h"
|
2007-01-30 08:22:05 +08:00
|
|
|
|
|
|
|
using namespace LAMMPS_NS;
|
|
|
|
|
2016-11-08 06:10:12 +08:00
|
|
|
static void print_style(FILE *fp, const char *str, int &pos);
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
start up LAMMPS
|
|
|
|
allocate fundamental classes (memory, error, universe, input)
|
|
|
|
parse input switches
|
|
|
|
initialize communicators, screen & logfile output
|
|
|
|
input is allocated at end after MPI info is setup
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|
|
|
{
|
|
|
|
memory = new Memory(this);
|
|
|
|
error = new Error(this);
|
|
|
|
universe = new Universe(this,communicator);
|
2008-01-18 01:01:57 +08:00
|
|
|
output = NULL;
|
2017-04-12 09:22:30 +08:00
|
|
|
python = NULL;
|
2007-01-30 08:22:05 +08:00
|
|
|
|
2008-12-13 08:47:23 +08:00
|
|
|
screen = NULL;
|
|
|
|
logfile = NULL;
|
2014-04-11 22:46:49 +08:00
|
|
|
infile = NULL;
|
2008-12-13 08:47:23 +08:00
|
|
|
|
2015-07-17 06:41:28 +08:00
|
|
|
initclock = MPI_Wtime();
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// parse input switches
|
|
|
|
|
|
|
|
int inflag = 0;
|
|
|
|
int screenflag = 0;
|
|
|
|
int logflag = 0;
|
2011-06-16 01:51:07 +08:00
|
|
|
int partscreenflag = 0;
|
|
|
|
int partlogflag = 0;
|
2014-06-04 23:34:48 +08:00
|
|
|
int kokkosflag = 0;
|
2013-11-23 01:14:39 +08:00
|
|
|
int restartflag = 0;
|
2014-06-15 05:25:49 +08:00
|
|
|
int restartremapflag = 0;
|
2013-07-31 03:52:46 +08:00
|
|
|
int citeflag = 1;
|
2011-08-18 23:03:14 +08:00
|
|
|
int helpflag = 0;
|
2013-07-31 03:52:46 +08:00
|
|
|
|
2014-08-15 00:30:03 +08:00
|
|
|
suffix = suffix2 = NULL;
|
2011-06-01 06:36:53 +08:00
|
|
|
suffix_enable = 0;
|
2016-11-11 02:28:32 +08:00
|
|
|
if (arg) exename = arg[0];
|
2016-11-11 03:12:02 +08:00
|
|
|
else exename = NULL;
|
2015-10-22 02:51:09 +08:00
|
|
|
packargs = NULL;
|
|
|
|
num_package = 0;
|
2013-11-23 01:14:39 +08:00
|
|
|
char *rfile = NULL;
|
|
|
|
char *dfile = NULL;
|
2013-11-26 01:17:50 +08:00
|
|
|
int wdfirst,wdlast;
|
2014-02-11 08:09:44 +08:00
|
|
|
int kkfirst,kklast;
|
2011-05-20 23:25:36 +08:00
|
|
|
|
2014-09-11 03:39:31 +08:00
|
|
|
int npack = 0;
|
|
|
|
int *pfirst = NULL;
|
|
|
|
int *plast = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
int iarg = 1;
|
|
|
|
while (iarg < narg) {
|
2012-06-07 06:47:51 +08:00
|
|
|
if (strcmp(arg[iarg],"-partition") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-p") == 0) {
|
2009-08-19 02:43:28 +08:00
|
|
|
universe->existflag = 1;
|
2012-06-07 06:47:51 +08:00
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2007-01-30 08:22:05 +08:00
|
|
|
iarg++;
|
|
|
|
while (iarg < narg && arg[iarg][0] != '-') {
|
2012-06-07 06:47:51 +08:00
|
|
|
universe->add_world(arg[iarg]);
|
|
|
|
iarg++;
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-in") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-i") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2007-01-30 08:22:05 +08:00
|
|
|
inflag = iarg + 1;
|
|
|
|
iarg += 2;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-screen") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-sc") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2007-01-30 08:22:05 +08:00
|
|
|
screenflag = iarg + 1;
|
|
|
|
iarg += 2;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-log") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-l") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2007-01-30 08:22:05 +08:00
|
|
|
logflag = iarg + 1;
|
|
|
|
iarg += 2;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-var") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-v") == 0) {
|
|
|
|
if (iarg+3 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2011-10-10 22:58:50 +08:00
|
|
|
iarg += 3;
|
2011-02-05 03:13:14 +08:00
|
|
|
while (iarg < narg && arg[iarg][0] != '-') iarg++;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-echo") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-e") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2007-01-30 08:22:05 +08:00
|
|
|
iarg += 2;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-pscreen") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-ps") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2011-06-16 01:51:07 +08:00
|
|
|
partscreenflag = iarg + 1;
|
|
|
|
iarg += 2;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-plog") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-pl") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2011-06-16 01:51:07 +08:00
|
|
|
partlogflag = iarg + 1;
|
|
|
|
iarg += 2;
|
2014-02-11 08:09:44 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-kokkos") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-k") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
|
|
|
if (strcmp(arg[iarg+1],"on") == 0) kokkosflag = 1;
|
|
|
|
else if (strcmp(arg[iarg+1],"off") == 0) kokkosflag = 0;
|
|
|
|
else error->universe_all(FLERR,"Invalid command-line argument");
|
|
|
|
iarg += 2;
|
|
|
|
// delimit any extra args for the Kokkos instantiation
|
|
|
|
kkfirst = iarg;
|
|
|
|
while (iarg < narg && arg[iarg][0] != '-') iarg++;
|
|
|
|
kklast = iarg;
|
2014-09-11 03:39:31 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-package") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-pk") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
|
|
|
memory->grow(pfirst,npack+1,"lammps:pfirst");
|
|
|
|
memory->grow(plast,npack+1,"lammps:plast");
|
|
|
|
// delimit args for package command invocation
|
|
|
|
// any package arg with leading "-" will be followed by numeric digit
|
|
|
|
iarg++;
|
|
|
|
pfirst[npack] = iarg;
|
|
|
|
while (iarg < narg) {
|
|
|
|
if (arg[iarg][0] != '-') iarg++;
|
|
|
|
else if (isdigit(arg[iarg][1])) iarg++;
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
plast[npack++] = iarg;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-suffix") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-sf") == 0) {
|
|
|
|
if (iarg+2 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2011-06-02 01:34:26 +08:00
|
|
|
delete [] suffix;
|
2015-10-05 23:20:06 +08:00
|
|
|
delete [] suffix2;
|
2015-10-23 06:06:49 +08:00
|
|
|
suffix2 = NULL;
|
2011-06-02 01:34:26 +08:00
|
|
|
suffix_enable = 1;
|
2015-10-05 23:20:06 +08:00
|
|
|
// hybrid option to set fall-back for suffix2
|
|
|
|
if (strcmp(arg[iarg+1],"hybrid") == 0) {
|
|
|
|
if (iarg+4 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2018-03-17 00:28:13 +08:00
|
|
|
int n = strlen(arg[iarg+2]) + 1;
|
|
|
|
suffix = new char[n];
|
|
|
|
strcpy(suffix,arg[iarg+2]);
|
|
|
|
n = strlen(arg[iarg+3]) + 1;
|
|
|
|
suffix2 = new char[n];
|
|
|
|
strcpy(suffix2,arg[iarg+3]);
|
|
|
|
iarg += 4;
|
2015-10-05 23:20:06 +08:00
|
|
|
} else {
|
2018-03-17 00:28:13 +08:00
|
|
|
int n = strlen(arg[iarg+1]) + 1;
|
|
|
|
suffix = new char[n];
|
|
|
|
strcpy(suffix,arg[iarg+1]);
|
|
|
|
iarg += 2;
|
2015-10-05 23:20:06 +08:00
|
|
|
}
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-reorder") == 0 ||
|
2013-11-23 01:14:39 +08:00
|
|
|
strcmp(arg[iarg],"-ro") == 0) {
|
2012-06-07 06:47:51 +08:00
|
|
|
if (iarg+3 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2011-12-10 06:45:19 +08:00
|
|
|
if (universe->existflag)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->universe_all(FLERR,"Cannot use -reorder after -partition");
|
2011-12-13 23:57:18 +08:00
|
|
|
universe->reorder(arg[iarg+1],arg[iarg+2]);
|
|
|
|
iarg += 3;
|
2013-11-23 01:14:39 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-restart") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-r") == 0) {
|
|
|
|
if (iarg+3 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
|
|
|
restartflag = 1;
|
|
|
|
rfile = arg[iarg+1];
|
|
|
|
dfile = arg[iarg+2];
|
2014-06-15 05:25:49 +08:00
|
|
|
// check for restart remap flag
|
|
|
|
if (strcmp(dfile,"remap") == 0) {
|
|
|
|
if (iarg+4 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
|
|
|
restartremapflag = 1;
|
|
|
|
dfile = arg[iarg+3];
|
|
|
|
iarg++;
|
|
|
|
}
|
2013-11-23 01:14:39 +08:00
|
|
|
iarg += 3;
|
2013-11-26 01:17:50 +08:00
|
|
|
// delimit any extra args for the write_data command
|
|
|
|
wdfirst = iarg;
|
|
|
|
while (iarg < narg && arg[iarg][0] != '-') iarg++;
|
|
|
|
wdlast = iarg;
|
2013-07-31 03:52:46 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-nocite") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-nc") == 0) {
|
|
|
|
citeflag = 0;
|
|
|
|
iarg++;
|
2012-06-07 06:47:51 +08:00
|
|
|
} else if (strcmp(arg[iarg],"-help") == 0 ||
|
|
|
|
strcmp(arg[iarg],"-h") == 0) {
|
|
|
|
if (iarg+1 > narg)
|
|
|
|
error->universe_all(FLERR,"Invalid command-line argument");
|
2011-08-18 23:03:14 +08:00
|
|
|
helpflag = 1;
|
2014-04-11 22:46:49 +08:00
|
|
|
citeflag = 0;
|
2011-08-18 23:03:14 +08:00
|
|
|
iarg += 1;
|
2011-09-24 02:06:55 +08:00
|
|
|
} else error->universe_all(FLERR,"Invalid command-line argument");
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
|
2011-12-10 00:46:31 +08:00
|
|
|
// if no partition command-line switch, universe is one world with all procs
|
2007-01-30 08:22:05 +08:00
|
|
|
|
2009-08-19 02:43:28 +08:00
|
|
|
if (universe->existflag == 0) universe->add_world(NULL);
|
2007-01-30 08:22:05 +08:00
|
|
|
|
|
|
|
// sum of procs in all worlds must equal total # of procs
|
|
|
|
|
|
|
|
if (!universe->consistent())
|
2015-01-28 07:55:36 +08:00
|
|
|
error->universe_all(FLERR,"Processor partitions do not match "
|
|
|
|
"number of allocated processors");
|
2007-01-30 08:22:05 +08:00
|
|
|
|
2009-08-19 02:43:28 +08:00
|
|
|
// universe cannot use stdin for input file
|
2007-01-30 08:22:05 +08:00
|
|
|
|
2009-08-19 02:43:28 +08:00
|
|
|
if (universe->existflag && inflag == 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->universe_all(FLERR,"Must use -in switch with multiple partitions");
|
2007-01-30 08:22:05 +08:00
|
|
|
|
2011-06-16 01:51:07 +08:00
|
|
|
// if no partition command-line switch, cannot use -pscreen option
|
|
|
|
|
|
|
|
if (universe->existflag == 0 && partscreenflag)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->universe_all(FLERR,"Can only use -pscreen with multiple partitions");
|
2011-06-16 01:51:07 +08:00
|
|
|
|
|
|
|
// if no partition command-line switch, cannot use -plog option
|
|
|
|
|
|
|
|
if (universe->existflag == 0 && partlogflag)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->universe_all(FLERR,"Can only use -plog with multiple partitions");
|
2011-06-16 01:51:07 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// set universe screen and logfile
|
|
|
|
|
|
|
|
if (universe->me == 0) {
|
|
|
|
if (screenflag == 0)
|
|
|
|
universe->uscreen = stdout;
|
|
|
|
else if (strcmp(arg[screenflag],"none") == 0)
|
|
|
|
universe->uscreen = NULL;
|
|
|
|
else {
|
|
|
|
universe->uscreen = fopen(arg[screenflag],"w");
|
2012-06-07 06:47:51 +08:00
|
|
|
if (universe->uscreen == NULL)
|
|
|
|
error->universe_one(FLERR,"Cannot open universe screen file");
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
if (logflag == 0) {
|
2013-11-21 02:47:02 +08:00
|
|
|
if (helpflag == 0) {
|
|
|
|
universe->ulogfile = fopen("log.lammps","w");
|
|
|
|
if (universe->ulogfile == NULL)
|
|
|
|
error->universe_warn(FLERR,"Cannot open log.lammps for writing");
|
|
|
|
}
|
2007-01-30 08:22:05 +08:00
|
|
|
} else if (strcmp(arg[logflag],"none") == 0)
|
|
|
|
universe->ulogfile = NULL;
|
|
|
|
else {
|
|
|
|
universe->ulogfile = fopen(arg[logflag],"w");
|
2012-06-07 06:47:51 +08:00
|
|
|
if (universe->ulogfile == NULL)
|
|
|
|
error->universe_one(FLERR,"Cannot open universe log file");
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (universe->me > 0) {
|
|
|
|
if (screenflag == 0) universe->uscreen = stdout;
|
|
|
|
else universe->uscreen = NULL;
|
|
|
|
universe->ulogfile = NULL;
|
|
|
|
}
|
|
|
|
|
2011-12-10 00:46:31 +08:00
|
|
|
// make universe and single world the same, since no partition switch
|
|
|
|
// world inherits settings from universe
|
2007-01-30 08:22:05 +08:00
|
|
|
// set world screen, logfile, communicator, infile
|
|
|
|
// open input script if from file
|
|
|
|
|
2009-08-19 02:43:28 +08:00
|
|
|
if (universe->existflag == 0) {
|
2007-01-30 08:22:05 +08:00
|
|
|
screen = universe->uscreen;
|
|
|
|
logfile = universe->ulogfile;
|
|
|
|
world = universe->uworld;
|
|
|
|
|
|
|
|
if (universe->me == 0) {
|
|
|
|
if (inflag == 0) infile = stdin;
|
|
|
|
else infile = fopen(arg[inflag],"r");
|
|
|
|
if (infile == NULL) {
|
2012-06-07 06:47:51 +08:00
|
|
|
char str[128];
|
|
|
|
sprintf(str,"Cannot open input script %s",arg[inflag]);
|
|
|
|
error->one(FLERR,str);
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (universe->me == 0) {
|
|
|
|
if (screen) fprintf(screen,"LAMMPS (%s)\n",universe->version);
|
|
|
|
if (logfile) fprintf(logfile,"LAMMPS (%s)\n",universe->version);
|
|
|
|
}
|
|
|
|
|
2011-12-10 00:46:31 +08:00
|
|
|
// universe is one or more worlds, as setup by partition switch
|
|
|
|
// split universe communicator into separate world communicators
|
2007-01-30 08:22:05 +08:00
|
|
|
// set world screen, logfile, communicator, infile
|
|
|
|
// open input script
|
|
|
|
|
|
|
|
} else {
|
|
|
|
int me;
|
|
|
|
MPI_Comm_split(universe->uworld,universe->iworld,0,&world);
|
|
|
|
MPI_Comm_rank(world,&me);
|
|
|
|
|
2011-06-16 01:51:07 +08:00
|
|
|
if (me == 0)
|
|
|
|
if (partscreenflag == 0)
|
|
|
|
if (screenflag == 0) {
|
|
|
|
char str[32];
|
|
|
|
sprintf(str,"screen.%d",universe->iworld);
|
|
|
|
screen = fopen(str,"w");
|
2011-09-24 02:06:55 +08:00
|
|
|
if (screen == NULL) error->one(FLERR,"Cannot open screen file");
|
2011-06-16 01:51:07 +08:00
|
|
|
} else if (strcmp(arg[screenflag],"none") == 0)
|
|
|
|
screen = NULL;
|
|
|
|
else {
|
|
|
|
char str[128];
|
|
|
|
sprintf(str,"%s.%d",arg[screenflag],universe->iworld);
|
|
|
|
screen = fopen(str,"w");
|
2011-09-24 02:06:55 +08:00
|
|
|
if (screen == NULL) error->one(FLERR,"Cannot open screen file");
|
2011-06-16 01:51:07 +08:00
|
|
|
}
|
|
|
|
else if (strcmp(arg[partscreenflag],"none") == 0)
|
2012-06-07 06:47:51 +08:00
|
|
|
screen = NULL;
|
2007-01-30 08:22:05 +08:00
|
|
|
else {
|
2012-06-07 06:47:51 +08:00
|
|
|
char str[128];
|
|
|
|
sprintf(str,"%s.%d",arg[partscreenflag],universe->iworld);
|
|
|
|
screen = fopen(str,"w");
|
|
|
|
if (screen == NULL) error->one(FLERR,"Cannot open screen file");
|
2011-06-16 01:51:07 +08:00
|
|
|
} else screen = NULL;
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-06-16 01:51:07 +08:00
|
|
|
if (me == 0)
|
|
|
|
if (partlogflag == 0)
|
|
|
|
if (logflag == 0) {
|
|
|
|
char str[32];
|
|
|
|
sprintf(str,"log.lammps.%d",universe->iworld);
|
|
|
|
logfile = fopen(str,"w");
|
2011-09-24 02:06:55 +08:00
|
|
|
if (logfile == NULL) error->one(FLERR,"Cannot open logfile");
|
2011-06-16 01:51:07 +08:00
|
|
|
} else if (strcmp(arg[logflag],"none") == 0)
|
|
|
|
logfile = NULL;
|
|
|
|
else {
|
|
|
|
char str[128];
|
|
|
|
sprintf(str,"%s.%d",arg[logflag],universe->iworld);
|
|
|
|
logfile = fopen(str,"w");
|
2011-09-24 02:06:55 +08:00
|
|
|
if (logfile == NULL) error->one(FLERR,"Cannot open logfile");
|
2011-06-16 01:51:07 +08:00
|
|
|
}
|
|
|
|
else if (strcmp(arg[partlogflag],"none") == 0)
|
2012-06-07 06:47:51 +08:00
|
|
|
logfile = NULL;
|
2007-01-30 08:22:05 +08:00
|
|
|
else {
|
2012-06-07 06:47:51 +08:00
|
|
|
char str[128];
|
|
|
|
sprintf(str,"%s.%d",arg[partlogflag],universe->iworld);
|
|
|
|
logfile = fopen(str,"w");
|
|
|
|
if (logfile == NULL) error->one(FLERR,"Cannot open logfile");
|
2011-06-16 01:51:07 +08:00
|
|
|
} else logfile = NULL;
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
if (me == 0) {
|
|
|
|
infile = fopen(arg[inflag],"r");
|
|
|
|
if (infile == NULL) {
|
2012-06-07 06:47:51 +08:00
|
|
|
char str[128];
|
|
|
|
sprintf(str,"Cannot open input script %s",arg[inflag]);
|
|
|
|
error->one(FLERR,str);
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
} else infile = NULL;
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// screen and logfile messages for universe and world
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
if (universe->me == 0) {
|
|
|
|
if (universe->uscreen) {
|
2012-06-07 06:47:51 +08:00
|
|
|
fprintf(universe->uscreen,"LAMMPS (%s)\n",universe->version);
|
|
|
|
fprintf(universe->uscreen,"Running on %d partitions of processors\n",
|
|
|
|
universe->nworlds);
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
if (universe->ulogfile) {
|
2012-06-07 06:47:51 +08:00
|
|
|
fprintf(universe->ulogfile,"LAMMPS (%s)\n",universe->version);
|
|
|
|
fprintf(universe->ulogfile,"Running on %d partitions of processors\n",
|
|
|
|
universe->nworlds);
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
}
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
if (me == 0) {
|
|
|
|
if (screen) {
|
2012-06-07 06:47:51 +08:00
|
|
|
fprintf(screen,"LAMMPS (%s)\n",universe->version);
|
|
|
|
fprintf(screen,"Processor partition = %d\n",universe->iworld);
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
if (logfile) {
|
2012-06-07 06:47:51 +08:00
|
|
|
fprintf(logfile,"LAMMPS (%s)\n",universe->version);
|
|
|
|
fprintf(logfile,"Processor partition = %d\n",universe->iworld);
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-23 01:44:32 +08:00
|
|
|
// check consistency of datatype settings in lmptype.h
|
2011-01-05 08:29:35 +08:00
|
|
|
|
2011-01-08 05:42:19 +08:00
|
|
|
if (sizeof(smallint) != sizeof(int))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Smallint setting in lmptype.h is invalid");
|
2014-01-15 00:17:20 +08:00
|
|
|
if (sizeof(imageint) < sizeof(smallint))
|
|
|
|
error->all(FLERR,"Imageint setting in lmptype.h is invalid");
|
2011-01-08 05:42:19 +08:00
|
|
|
if (sizeof(tagint) < sizeof(smallint))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Tagint setting in lmptype.h is invalid");
|
2014-01-18 02:43:09 +08:00
|
|
|
if (sizeof(bigint) < sizeof(imageint) || sizeof(bigint) < sizeof(tagint))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Bigint setting in lmptype.h is invalid");
|
2011-01-05 08:29:35 +08:00
|
|
|
|
|
|
|
int mpisize;
|
2014-01-23 01:44:32 +08:00
|
|
|
MPI_Type_size(MPI_LMP_TAGINT,&mpisize);
|
|
|
|
if (mpisize != sizeof(tagint))
|
|
|
|
error->all(FLERR,"MPI_LMP_TAGINT and tagint in "
|
|
|
|
"lmptype.h are not compatible");
|
2011-01-07 07:23:37 +08:00
|
|
|
MPI_Type_size(MPI_LMP_BIGINT,&mpisize);
|
2011-01-08 05:42:19 +08:00
|
|
|
if (mpisize != sizeof(bigint))
|
2014-01-15 00:17:20 +08:00
|
|
|
error->all(FLERR,"MPI_LMP_BIGINT and bigint in "
|
|
|
|
"lmptype.h are not compatible");
|
2011-01-05 08:29:35 +08:00
|
|
|
|
2011-08-19 04:50:27 +08:00
|
|
|
#ifdef LAMMPS_SMALLBIG
|
2015-10-31 04:04:06 +08:00
|
|
|
if (sizeof(smallint) != 4 || sizeof(imageint) != 4 ||
|
2014-01-15 00:17:20 +08:00
|
|
|
sizeof(tagint) != 4 || sizeof(bigint) != 8)
|
2014-01-18 02:43:09 +08:00
|
|
|
error->all(FLERR,"Small to big integers are not sized correctly");
|
2011-08-19 04:50:27 +08:00
|
|
|
#endif
|
|
|
|
#ifdef LAMMPS_BIGBIG
|
2015-10-31 04:04:06 +08:00
|
|
|
if (sizeof(smallint) != 4 || sizeof(imageint) != 8 ||
|
2014-01-15 00:17:20 +08:00
|
|
|
sizeof(tagint) != 8 || sizeof(bigint) != 8)
|
2014-01-18 02:43:09 +08:00
|
|
|
error->all(FLERR,"Small to big integers are not sized correctly");
|
2011-08-19 04:50:27 +08:00
|
|
|
#endif
|
|
|
|
#ifdef LAMMPS_SMALLSMALL
|
2015-10-31 04:04:06 +08:00
|
|
|
if (sizeof(smallint) != 4 || sizeof(imageint) != 4 ||
|
2014-01-15 00:17:20 +08:00
|
|
|
sizeof(tagint) != 4 || sizeof(bigint) != 4)
|
2014-01-18 02:43:09 +08:00
|
|
|
error->all(FLERR,"Small to big integers are not sized correctly");
|
2011-08-19 04:50:27 +08:00
|
|
|
#endif
|
|
|
|
|
2014-02-11 08:09:44 +08:00
|
|
|
// create Kokkos class if KOKKOS installed, unless explicitly switched off
|
|
|
|
// instantiation creates dummy Kokkos class if KOKKOS is not installed
|
|
|
|
// add args between kkfirst and kklast to Kokkos instantiation
|
|
|
|
|
2014-06-04 23:34:48 +08:00
|
|
|
kokkos = NULL;
|
|
|
|
if (kokkosflag == 1) {
|
2014-02-11 08:09:44 +08:00
|
|
|
kokkos = new KokkosLMP(this,kklast-kkfirst,&arg[kkfirst]);
|
|
|
|
if (!kokkos->kokkos_exists)
|
|
|
|
error->all(FLERR,"Cannot use -kokkos on without KOKKOS installed");
|
|
|
|
}
|
|
|
|
|
2013-07-31 03:52:46 +08:00
|
|
|
// allocate CiteMe class if enabled
|
|
|
|
|
|
|
|
if (citeflag) citeme = new CiteMe(this);
|
|
|
|
else citeme = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// allocate input class now that MPI is fully setup
|
|
|
|
|
|
|
|
input = new Input(this,narg,arg);
|
|
|
|
|
2015-10-22 02:51:09 +08:00
|
|
|
// copy package cmdline arguments
|
|
|
|
if (npack > 0) {
|
|
|
|
num_package = npack;
|
|
|
|
packargs = new char**[npack];
|
|
|
|
for (int i=0; i < npack; ++i) {
|
|
|
|
int n = plast[i] - pfirst[i];
|
|
|
|
packargs[i] = new char*[n+1];
|
|
|
|
for (int j=0; j < n; ++j)
|
|
|
|
packargs[i][j] = strdup(arg[pfirst[i]+j]);
|
|
|
|
packargs[i][n] = NULL;
|
|
|
|
}
|
|
|
|
memory->destroy(pfirst);
|
|
|
|
memory->destroy(plast);
|
|
|
|
}
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
// allocate top-level classes
|
|
|
|
|
|
|
|
create();
|
2015-10-22 02:51:09 +08:00
|
|
|
post_create();
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2015-09-11 22:49:37 +08:00
|
|
|
// if helpflag set, print help and quit with "success" status
|
2011-08-18 23:03:14 +08:00
|
|
|
|
|
|
|
if (helpflag) {
|
2013-11-21 23:43:36 +08:00
|
|
|
if (universe->me == 0 && screen) help();
|
2015-09-11 22:49:37 +08:00
|
|
|
error->done(0);
|
2011-08-18 23:03:14 +08:00
|
|
|
}
|
2013-11-23 01:14:39 +08:00
|
|
|
|
2014-02-11 08:09:44 +08:00
|
|
|
// if restartflag set, invoke 2 commands and quit
|
|
|
|
// add args between wdfirst and wdlast to write_data command
|
2013-12-03 07:49:46 +08:00
|
|
|
// also add "noinit" to prevent write_data from doing system init
|
2013-11-23 01:14:39 +08:00
|
|
|
|
|
|
|
if (restartflag) {
|
|
|
|
char cmd[128];
|
|
|
|
sprintf(cmd,"read_restart %s\n",rfile);
|
2014-06-15 05:25:49 +08:00
|
|
|
if (restartremapflag) strcat(cmd," remap\n");
|
2013-11-23 01:14:39 +08:00
|
|
|
input->one(cmd);
|
2013-11-26 01:17:50 +08:00
|
|
|
sprintf(cmd,"write_data %s",dfile);
|
|
|
|
for (iarg = wdfirst; iarg < wdlast; iarg++)
|
|
|
|
sprintf(&cmd[strlen(cmd)]," %s",arg[iarg]);
|
2013-12-03 07:49:46 +08:00
|
|
|
strcat(cmd," noinit\n");
|
2013-11-23 01:14:39 +08:00
|
|
|
input->one(cmd);
|
2015-09-11 22:49:37 +08:00
|
|
|
error->done(0);
|
2013-11-23 01:14:39 +08:00
|
|
|
}
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
shutdown LAMMPS
|
|
|
|
delete top-level classes
|
|
|
|
close screen and log files in world and universe
|
|
|
|
output files were already closed in destroy()
|
|
|
|
delete fundamental classes
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
LAMMPS::~LAMMPS()
|
|
|
|
{
|
2015-08-31 21:32:05 +08:00
|
|
|
const int me = comm->me;
|
2007-01-30 08:22:05 +08:00
|
|
|
|
2015-08-31 21:32:05 +08:00
|
|
|
destroy();
|
2013-07-31 03:52:46 +08:00
|
|
|
delete citeme;
|
|
|
|
|
2015-10-22 02:51:09 +08:00
|
|
|
if (num_package) {
|
|
|
|
for (int i = 0; i < num_package; i++) {
|
|
|
|
for (char **ptr = packargs[i]; *ptr != NULL; ++ptr)
|
|
|
|
free(*ptr);
|
|
|
|
delete[] packargs[i];
|
|
|
|
}
|
|
|
|
delete[] packargs;
|
|
|
|
}
|
|
|
|
num_package = 0;
|
|
|
|
packargs = NULL;
|
|
|
|
|
2015-08-29 07:41:05 +08:00
|
|
|
double totalclock = MPI_Wtime() - initclock;
|
|
|
|
if ((me == 0) && (screen || logfile)) {
|
|
|
|
char outtime[128];
|
|
|
|
int seconds = fmod(totalclock,60.0);
|
|
|
|
totalclock = (totalclock - seconds) / 60.0;
|
|
|
|
int minutes = fmod(totalclock,60.0);
|
|
|
|
int hours = (totalclock - minutes) / 60.0;
|
|
|
|
sprintf(outtime,"Total wall time: "
|
|
|
|
"%d:%02d:%02d\n", hours, minutes, seconds);
|
|
|
|
if (screen) fputs(outtime,screen);
|
|
|
|
if (logfile) fputs(outtime,logfile);
|
|
|
|
}
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
if (universe->nworlds == 1) {
|
2014-04-11 22:46:49 +08:00
|
|
|
if (screen && screen != stdout) fclose(screen);
|
2007-01-30 08:22:05 +08:00
|
|
|
if (logfile) fclose(logfile);
|
2014-04-11 22:46:49 +08:00
|
|
|
logfile = NULL;
|
|
|
|
if (screen != stdout) screen = NULL;
|
2007-01-30 08:22:05 +08:00
|
|
|
} else {
|
|
|
|
if (screen && screen != stdout) fclose(screen);
|
|
|
|
if (logfile) fclose(logfile);
|
|
|
|
if (universe->ulogfile) fclose(universe->ulogfile);
|
2014-04-11 22:46:49 +08:00
|
|
|
logfile = NULL;
|
|
|
|
if (screen != stdout) screen = NULL;
|
2007-01-30 08:22:05 +08:00
|
|
|
}
|
|
|
|
|
2014-04-11 22:46:49 +08:00
|
|
|
if (infile && infile != stdin) fclose(infile);
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
if (world != universe->uworld) MPI_Comm_free(&world);
|
|
|
|
|
2017-04-12 09:22:30 +08:00
|
|
|
delete python;
|
2014-02-11 08:09:44 +08:00
|
|
|
delete kokkos;
|
2011-06-01 06:36:53 +08:00
|
|
|
delete [] suffix;
|
2014-08-15 00:30:03 +08:00
|
|
|
delete [] suffix2;
|
2011-05-20 23:25:36 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete input;
|
|
|
|
delete universe;
|
|
|
|
delete error;
|
|
|
|
delete memory;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
allocate single instance of top-level classes
|
|
|
|
fundamental classes are allocated in constructor
|
2011-06-01 06:36:53 +08:00
|
|
|
some classes have package variants
|
2007-01-30 08:22:05 +08:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void LAMMPS::create()
|
2006-09-28 03:51:33 +08:00
|
|
|
{
|
2016-06-08 23:41:00 +08:00
|
|
|
force = NULL; // Domain->Lattice checks if Force exists
|
|
|
|
|
2013-03-08 01:32:03 +08:00
|
|
|
// Comm class must be created before Atom class
|
2013-03-08 00:16:01 +08:00
|
|
|
// so that nthreads is defined when create_avec invokes grow()
|
2011-05-20 23:25:36 +08:00
|
|
|
|
2016-06-01 00:20:32 +08:00
|
|
|
if (kokkos) comm = new CommKokkos(this);
|
2014-05-13 23:23:13 +08:00
|
|
|
else comm = new CommBrick(this);
|
2011-05-20 23:25:36 +08:00
|
|
|
|
2016-06-01 00:20:32 +08:00
|
|
|
if (kokkos) neighbor = new NeighborKokkos(this);
|
2013-03-08 00:16:01 +08:00
|
|
|
else neighbor = new Neighbor(this);
|
|
|
|
|
2016-06-01 00:20:32 +08:00
|
|
|
if (kokkos) domain = new DomainKokkos(this);
|
2013-02-09 01:12:58 +08:00
|
|
|
#ifdef LMP_USER_OMP
|
|
|
|
else domain = new DomainOMP(this);
|
|
|
|
#else
|
2011-05-20 23:25:36 +08:00
|
|
|
else domain = new Domain(this);
|
2013-02-09 01:12:58 +08:00
|
|
|
#endif
|
2011-05-20 23:25:36 +08:00
|
|
|
|
2014-02-12 08:34:30 +08:00
|
|
|
if (kokkos) atom = new AtomKokkos(this);
|
|
|
|
else atom = new Atom(this);
|
2016-03-18 22:50:28 +08:00
|
|
|
|
|
|
|
if (kokkos)
|
|
|
|
atom->create_avec("atomic/kk",0,NULL,1);
|
|
|
|
else
|
|
|
|
atom->create_avec("atomic",0,NULL,1);
|
2013-03-07 23:50:09 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
group = new Group(this);
|
|
|
|
force = new Force(this); // must be after group, to create temperature
|
2011-05-20 23:25:36 +08:00
|
|
|
|
2016-06-01 00:20:32 +08:00
|
|
|
if (kokkos) modify = new ModifyKokkos(this);
|
2011-05-20 23:25:36 +08:00
|
|
|
else modify = new Modify(this);
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
output = new Output(this); // must be after group, so "all" exists
|
|
|
|
// must be after modify so can create Computes
|
|
|
|
update = new Update(this); // must be after output, force, neighbor
|
|
|
|
timer = new Timer(this);
|
2017-04-12 09:22:30 +08:00
|
|
|
|
|
|
|
python = new Python(this);
|
2006-09-28 03:51:33 +08:00
|
|
|
}
|
|
|
|
|
2011-12-02 01:37:10 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
2014-08-15 04:07:39 +08:00
|
|
|
check suffix consistency with installed packages
|
2014-09-10 06:30:16 +08:00
|
|
|
invoke package-specific deafult package commands
|
2014-08-15 04:07:39 +08:00
|
|
|
only invoke if suffix is set and enabled
|
|
|
|
also check if suffix2 is set
|
2011-12-02 05:19:42 +08:00
|
|
|
called from LAMMPS constructor and after clear() command
|
2014-09-10 06:30:16 +08:00
|
|
|
so that package-specific core classes have been instantiated
|
2011-12-02 01:37:10 +08:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2015-10-22 02:51:09 +08:00
|
|
|
void LAMMPS::post_create()
|
2011-12-02 01:37:10 +08:00
|
|
|
{
|
2016-06-01 00:20:32 +08:00
|
|
|
// default package command triggered by "-k on"
|
2014-09-11 00:40:17 +08:00
|
|
|
|
|
|
|
if (kokkos && kokkos->kokkos_exists) input->one("package kokkos");
|
2014-08-15 04:07:39 +08:00
|
|
|
|
2014-08-15 23:35:51 +08:00
|
|
|
// suffix will always be set if suffix_enable = 1
|
2016-06-01 00:20:32 +08:00
|
|
|
// check that KOKKOS package classes were instantiated
|
2014-09-11 00:40:17 +08:00
|
|
|
// check that GPU, INTEL, USER-OMP fixes were compiled with LAMMPS
|
|
|
|
|
|
|
|
if (!suffix_enable) return;
|
2014-08-15 23:35:51 +08:00
|
|
|
|
2014-08-15 04:07:39 +08:00
|
|
|
if (strcmp(suffix,"gpu") == 0 && !modify->check_package("GPU"))
|
|
|
|
error->all(FLERR,"Using suffix gpu without GPU package installed");
|
2014-09-10 06:30:16 +08:00
|
|
|
if (strcmp(suffix,"intel") == 0 && !modify->check_package("INTEL"))
|
2014-08-15 04:07:39 +08:00
|
|
|
error->all(FLERR,"Using suffix intel without USER-INTEL package installed");
|
2015-10-31 04:04:06 +08:00
|
|
|
if (strcmp(suffix,"kk") == 0 &&
|
2014-09-10 06:30:16 +08:00
|
|
|
(kokkos == NULL || kokkos->kokkos_exists == 0))
|
|
|
|
error->all(FLERR,"Using suffix kk without KOKKOS package enabled");
|
2014-08-15 04:07:39 +08:00
|
|
|
if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP"))
|
|
|
|
error->all(FLERR,"Using suffix omp without USER-OMP package installed");
|
|
|
|
|
2015-08-31 21:32:05 +08:00
|
|
|
if (strcmp(suffix,"gpu") == 0) input->one("package gpu 1");
|
|
|
|
if (strcmp(suffix,"intel") == 0) input->one("package intel 1");
|
|
|
|
if (strcmp(suffix,"omp") == 0) input->one("package omp 0");
|
|
|
|
|
2014-08-15 00:30:03 +08:00
|
|
|
if (suffix2) {
|
2015-10-05 23:20:06 +08:00
|
|
|
if (strcmp(suffix2,"gpu") == 0) input->one("package gpu 1");
|
|
|
|
if (strcmp(suffix2,"intel") == 0) input->one("package intel 1");
|
2015-08-31 21:32:05 +08:00
|
|
|
if (strcmp(suffix2,"omp") == 0) input->one("package omp 0");
|
2011-12-02 01:37:10 +08:00
|
|
|
}
|
2014-09-11 03:39:31 +08:00
|
|
|
|
|
|
|
// invoke any command-line package commands
|
|
|
|
|
2015-10-22 02:51:09 +08:00
|
|
|
if (num_package) {
|
|
|
|
char str[256];
|
|
|
|
for (int i = 0; i < num_package; i++) {
|
2014-09-11 03:39:31 +08:00
|
|
|
strcpy(str,"package");
|
2015-10-22 02:51:09 +08:00
|
|
|
for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) {
|
|
|
|
if (strlen(str) + strlen(*ptr) + 2 > 256)
|
2014-09-11 03:39:31 +08:00
|
|
|
error->all(FLERR,"Too many -pk arguments in command line");
|
|
|
|
strcat(str," ");
|
2015-10-22 02:51:09 +08:00
|
|
|
strcat(str,*ptr);
|
2014-09-11 03:39:31 +08:00
|
|
|
}
|
|
|
|
input->one(str);
|
|
|
|
}
|
|
|
|
}
|
2011-12-02 01:37:10 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
initialize top-level classes
|
2011-12-09 01:56:37 +08:00
|
|
|
do not initialize Timer class, other classes like Run() do that explicitly
|
2007-01-30 08:22:05 +08:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void LAMMPS::init()
|
|
|
|
{
|
|
|
|
update->init();
|
2009-08-15 04:54:10 +08:00
|
|
|
force->init(); // pair must come after update due to minimizer
|
2007-01-30 08:22:05 +08:00
|
|
|
domain->init();
|
2011-03-08 06:47:03 +08:00
|
|
|
atom->init(); // atom must come after force and domain
|
2007-01-30 08:22:05 +08:00
|
|
|
// atom deletes extra array
|
|
|
|
// used by fix shear_history::unpack_restart()
|
2016-10-14 06:55:53 +08:00
|
|
|
// when force->pair->gran_history creates fix
|
2011-03-08 06:47:03 +08:00
|
|
|
// atom_vec init uses deform_vremap
|
2007-10-17 02:08:31 +08:00
|
|
|
modify->init(); // modify must come after update, force, atom, domain
|
2007-06-30 01:11:02 +08:00
|
|
|
neighbor->init(); // neighbor must come after force, modify
|
2011-04-14 05:40:14 +08:00
|
|
|
comm->init(); // comm must come after force, modify, neighbor, atom
|
2007-01-30 08:22:05 +08:00
|
|
|
output->init(); // output must come after domain, force, modify
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
delete single instance of top-level classes
|
|
|
|
fundamental classes are deleted in destructor
|
|
|
|
------------------------------------------------------------------------- */
|
2006-09-28 03:51:33 +08:00
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
void LAMMPS::destroy()
|
2006-09-28 03:51:33 +08:00
|
|
|
{
|
2007-01-30 08:22:05 +08:00
|
|
|
delete update;
|
2015-08-29 07:41:05 +08:00
|
|
|
update = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete neighbor;
|
2015-08-29 07:41:05 +08:00
|
|
|
neighbor = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete comm;
|
2015-08-29 07:41:05 +08:00
|
|
|
comm = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete force;
|
2015-08-29 07:41:05 +08:00
|
|
|
force = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete group;
|
2015-08-29 07:41:05 +08:00
|
|
|
group = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete output;
|
2015-08-29 07:41:05 +08:00
|
|
|
output = NULL;
|
|
|
|
|
2007-01-30 08:22:05 +08:00
|
|
|
delete modify; // modify must come after output, force, update
|
|
|
|
// since they delete fixes
|
2015-08-29 07:41:05 +08:00
|
|
|
modify = NULL;
|
|
|
|
|
2010-01-14 08:33:02 +08:00
|
|
|
delete domain; // domain must come after modify
|
|
|
|
// since fix destructors access domain
|
2015-08-29 07:41:05 +08:00
|
|
|
domain = NULL;
|
|
|
|
|
2007-06-30 01:11:02 +08:00
|
|
|
delete atom; // atom must come after modify, neighbor
|
2007-01-30 08:22:05 +08:00
|
|
|
// since fixes delete callbacks in atom
|
2015-08-29 07:41:05 +08:00
|
|
|
atom = NULL;
|
2013-07-25 04:10:57 +08:00
|
|
|
|
2015-08-29 07:41:05 +08:00
|
|
|
delete timer;
|
|
|
|
timer = NULL;
|
2017-04-12 09:22:30 +08:00
|
|
|
|
|
|
|
delete python;
|
|
|
|
python = NULL;
|
2006-09-28 03:51:33 +08:00
|
|
|
}
|
2011-08-18 23:03:14 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
2013-11-21 23:43:36 +08:00
|
|
|
help message for command line options and styles present in executable
|
2011-08-18 23:03:14 +08:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2013-11-21 23:43:36 +08:00
|
|
|
void LAMMPS::help()
|
2011-08-18 23:03:14 +08:00
|
|
|
{
|
2016-11-08 06:10:12 +08:00
|
|
|
FILE *fp = screen;
|
|
|
|
const char *pager = NULL;
|
|
|
|
|
|
|
|
// if output is "stdout", use a pipe to a pager for paged output.
|
|
|
|
// this will avoid the most important help text to rush past the
|
|
|
|
// user. scrollback buffers are often not large enough. this is most
|
|
|
|
// beneficial to windows users, who are not used to command line.
|
|
|
|
|
|
|
|
if (fp == stdout) {
|
|
|
|
pager = getenv("PAGER");
|
|
|
|
if (pager == NULL) pager = "more";
|
|
|
|
#if defined(_WIN32)
|
|
|
|
fp = _popen(pager,"w");
|
|
|
|
#else
|
|
|
|
fp = popen(pager,"w");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// reset to original state, if pipe command failed
|
|
|
|
if (fp == NULL) {
|
|
|
|
fp = stdout;
|
|
|
|
pager = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// general help message about command line and flags
|
|
|
|
|
|
|
|
fprintf(fp,
|
|
|
|
"\nLarge-scale Atomic/Molecular Massively Parallel Simulator - "
|
|
|
|
LAMMPS_VERSION "\n\n"
|
|
|
|
"Usage example: %s -var t 300 -echo screen -in in.alloy\n\n"
|
|
|
|
"List of command line options supported by this LAMMPS executable:\n\n"
|
2013-11-21 23:43:36 +08:00
|
|
|
"-echo none/screen/log/both : echoing of input script (-e)\n"
|
|
|
|
"-help : print this help message (-h)\n"
|
2014-09-11 03:39:31 +08:00
|
|
|
"-in filename : read input from file, not stdin (-i)\n"
|
2014-02-11 08:09:44 +08:00
|
|
|
"-kokkos on/off ... : turn KOKKOS mode on or off (-k)\n"
|
2013-11-21 23:43:36 +08:00
|
|
|
"-log none/filename : where to send log output (-l)\n"
|
|
|
|
"-nocite : disable writing log.cite file (-nc)\n"
|
2014-09-11 03:39:31 +08:00
|
|
|
"-package style ... : invoke package command (-pk)\n"
|
2013-11-21 23:43:36 +08:00
|
|
|
"-partition size1 size2 ... : assign partition sizes (-p)\n"
|
|
|
|
"-plog basename : basename for partition logs (-pl)\n"
|
|
|
|
"-pscreen basename : basename for partition screens (-ps)\n"
|
2015-10-31 04:04:06 +08:00
|
|
|
"-restart rfile dfile ... : convert restart to data file (-r)\n"
|
2013-11-21 23:43:36 +08:00
|
|
|
"-reorder topology-specs : processor reordering (-r)\n"
|
|
|
|
"-screen none/filename : where to send screen output (-sc)\n"
|
2016-06-01 00:20:32 +08:00
|
|
|
"-suffix gpu/intel/opt/omp : style suffix to apply (-sf)\n"
|
2016-11-08 06:10:12 +08:00
|
|
|
"-var varname value : set index style variable (-v)\n\n",
|
|
|
|
exename);
|
2015-10-31 04:04:06 +08:00
|
|
|
|
2018-05-10 01:06:34 +08:00
|
|
|
|
|
|
|
print_config(fp);
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"List of style options included in this LAMMPS executable\n\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
int pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Atom styles:\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
#define ATOM_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define AtomStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-19 08:31:34 +08:00
|
|
|
#include "style_atom.h"
|
|
|
|
#undef ATOM_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Integrate styles:\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
#define INTEGRATE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define IntegrateStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-19 08:31:34 +08:00
|
|
|
#include "style_integrate.h"
|
|
|
|
#undef INTEGRATE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Minimize styles:\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
#define MINIMIZE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define MinimizeStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-19 08:31:34 +08:00
|
|
|
#include "style_minimize.h"
|
|
|
|
#undef MINIMIZE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Pair styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define PAIR_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define PairStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_pair.h"
|
|
|
|
#undef PAIR_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Bond styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define BOND_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define BondStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_bond.h"
|
|
|
|
#undef BOND_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Angle styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define ANGLE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define AngleStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_angle.h"
|
|
|
|
#undef ANGLE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Dihedral styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define DIHEDRAL_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define DihedralStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_dihedral.h"
|
|
|
|
#undef DIHEDRAL_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Improper styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define IMPROPER_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define ImproperStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_improper.h"
|
|
|
|
#undef IMPROPER_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* KSpace styles:\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
#define KSPACE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define KSpaceStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-19 08:31:34 +08:00
|
|
|
#include "style_kspace.h"
|
|
|
|
#undef KSPACE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Fix styles\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define FIX_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define FixStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_fix.h"
|
|
|
|
#undef FIX_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Compute styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define COMPUTE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define ComputeStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_compute.h"
|
|
|
|
#undef COMPUTE_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Region styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define REGION_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define RegionStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_region.h"
|
|
|
|
#undef REGION_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Dump styles:\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
#define DUMP_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define DumpStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-18 23:03:14 +08:00
|
|
|
#include "style_dump.h"
|
|
|
|
#undef DUMP_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
2011-08-18 23:03:14 +08:00
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 80;
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"* Command styles\n");
|
2011-08-19 08:31:34 +08:00
|
|
|
#define COMMAND_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
#define CommandStyle(key,Class) print_style(fp,#key,pos);
|
2011-08-19 08:31:34 +08:00
|
|
|
#include "style_command.h"
|
|
|
|
#undef COMMAND_CLASS
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n\n");
|
|
|
|
|
|
|
|
// close pipe to pager, if active
|
|
|
|
|
|
|
|
if (pager != NULL) pclose(fp);
|
2011-08-18 23:03:14 +08:00
|
|
|
}
|
2013-11-21 02:47:02 +08:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
print style names in columns
|
2013-11-21 23:28:53 +08:00
|
|
|
skip any style that starts with upper-case letter, since internal
|
2013-11-21 02:47:02 +08:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
2016-11-08 06:10:12 +08:00
|
|
|
void print_style(FILE *fp, const char *str, int &pos)
|
2013-11-21 02:47:02 +08:00
|
|
|
{
|
2013-11-21 23:28:53 +08:00
|
|
|
if (isupper(str[0])) return;
|
|
|
|
|
2013-11-21 02:47:02 +08:00
|
|
|
int len = strlen(str);
|
2015-10-31 04:04:06 +08:00
|
|
|
if (pos+len > 80) {
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"\n");
|
2013-11-21 02:47:02 +08:00
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len < 16) {
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"%-16s",str);
|
2013-11-21 02:47:02 +08:00
|
|
|
pos += 16;
|
|
|
|
} else if (len < 32) {
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"%-32s",str);
|
2013-11-21 02:47:02 +08:00
|
|
|
pos += 32;
|
|
|
|
} else if (len < 48) {
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"%-48s",str);
|
2013-11-21 02:47:02 +08:00
|
|
|
pos += 48;
|
|
|
|
} else if (len < 64) {
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"%-64s",str);
|
2013-11-21 02:47:02 +08:00
|
|
|
pos += 64;
|
|
|
|
} else {
|
2016-11-08 06:10:12 +08:00
|
|
|
fprintf(fp,"%-80s",str);
|
2013-11-21 02:47:02 +08:00
|
|
|
pos += 80;
|
|
|
|
}
|
|
|
|
}
|
2018-05-10 01:06:34 +08:00
|
|
|
|
2018-05-10 05:37:24 +08:00
|
|
|
#define lmp_str(s) #s
|
|
|
|
#define lmp_xstr(s) lmp_str(s)
|
|
|
|
|
2018-05-10 01:06:34 +08:00
|
|
|
static const char lammps_config_options[]
|
2018-05-10 01:28:40 +08:00
|
|
|
= "LAMMPS compile time settings:\n\n"
|
2018-05-10 09:45:58 +08:00
|
|
|
"MPI library setting : "
|
2018-05-10 05:37:24 +08:00
|
|
|
#if defined(MPI_STUBS)
|
|
|
|
"Serial version using STUBS"
|
|
|
|
#elif defined(MPICH_VERSION)
|
|
|
|
"Parallel version using MPICH " MPICH_VERSION
|
|
|
|
#elif defined(OPEN_MPI)
|
|
|
|
"Parallel version using OpenMPI "
|
|
|
|
lmp_xstr(OMPI_MAJOR_VERSION) "."
|
|
|
|
lmp_xstr(OMPI_MINOR_VERSION) "."
|
|
|
|
lmp_xstr(OMPI_RELEASE_VERSION)
|
|
|
|
#else
|
|
|
|
"Parallel version using unknown MPI library"
|
|
|
|
#endif
|
2018-05-10 09:45:58 +08:00
|
|
|
"\nInteger sizes setting : "
|
2018-05-10 01:06:34 +08:00
|
|
|
#if defined(LAMMPS_SMALLSMALL)
|
2018-05-10 09:45:58 +08:00
|
|
|
"-DLAMMPS_SMALLSMALL"
|
2018-05-10 01:06:34 +08:00
|
|
|
#elif defined(LAMMPS_SMALLBIG)
|
2018-05-10 09:45:58 +08:00
|
|
|
"-DLAMMPS_SMALLBIG"
|
2018-05-10 01:06:34 +08:00
|
|
|
#elif defined(LAMMPS_BIGBIG)
|
2018-05-10 09:45:58 +08:00
|
|
|
"-DLAMMPS_BIGBIG"
|
2018-05-10 01:06:34 +08:00
|
|
|
#else
|
2018-05-10 09:45:58 +08:00
|
|
|
"(unkown)"
|
2018-05-10 01:06:34 +08:00
|
|
|
#endif
|
2018-05-10 09:45:58 +08:00
|
|
|
"\nExternal commands support :"
|
2018-05-10 01:06:34 +08:00
|
|
|
#if defined(LAMMPS_GZIP)
|
|
|
|
" -DLAMMPS_GZIP"
|
|
|
|
#endif
|
|
|
|
#if defined(LAMMPS_FFMPEG)
|
|
|
|
" -DLAMMPS_FFMPEG"
|
|
|
|
#endif
|
2018-05-10 09:45:58 +08:00
|
|
|
"\nImage library support :"
|
2018-05-10 01:06:34 +08:00
|
|
|
#if defined(LAMMPS_JPEG)
|
|
|
|
" -DLAMMPS_JPEG"
|
|
|
|
#endif
|
|
|
|
#if defined(LAMMPS_PNG)
|
|
|
|
" -DLAMMPS_PNG"
|
|
|
|
#endif
|
2018-05-10 09:45:58 +08:00
|
|
|
"\nFFT library support :"
|
2018-05-10 01:06:34 +08:00
|
|
|
#if defined(FFT_SINGLE)
|
|
|
|
" -DFFT_SINGLE"
|
|
|
|
#endif
|
|
|
|
#if defined(FFT_FFTW) || defined(FFT_FFTW3)
|
|
|
|
" -DFFT_FFTW3"
|
|
|
|
#elif defined(FFT_FFTW2)
|
|
|
|
" -DFFT_FFTW2"
|
|
|
|
#elif defined(FFT_MKL)
|
|
|
|
" -DFFT_MKL"
|
|
|
|
#else
|
|
|
|
" -DFFT_KISSFFT"
|
2018-05-10 11:28:29 +08:00
|
|
|
#endif
|
|
|
|
"\n3d-FFT data packing :"
|
|
|
|
#if defined(PACK_POINTER)
|
|
|
|
" -DPACK_POINTER"
|
|
|
|
#elif defined(PACK_MEMCPY)
|
|
|
|
" -DPACK_MEMCPY"
|
|
|
|
#else
|
|
|
|
" -DPACK_ARRAY"
|
2018-05-10 01:06:34 +08:00
|
|
|
#endif
|
2018-05-10 09:45:58 +08:00
|
|
|
"\nMemory alignment :"
|
2018-05-10 01:06:34 +08:00
|
|
|
#if defined(LAMMPS_MEMALIGN)
|
|
|
|
" -DLAMMPS_MEMALIGN=" lmp_xstr(LAMMPS_MEMALIGN)
|
|
|
|
#else
|
|
|
|
" (default)"
|
|
|
|
#endif
|
|
|
|
|
2018-05-10 09:45:58 +08:00
|
|
|
"\nException support :"
|
2018-05-10 01:06:34 +08:00
|
|
|
#if defined(LAMMPS_EXCEPTIONS)
|
|
|
|
" -DLAMMPS_EXCEPTIONS\n"
|
|
|
|
#else
|
|
|
|
" (not enabled)\n"
|
|
|
|
#endif
|
|
|
|
"\n";
|
|
|
|
|
2018-05-10 03:49:47 +08:00
|
|
|
#include "lmpinstalledpkgs.h"
|
2018-05-10 01:34:10 +08:00
|
|
|
|
2018-05-10 01:06:34 +08:00
|
|
|
void LAMMPS::print_config(FILE *fp)
|
|
|
|
{
|
|
|
|
fputs(lammps_config_options,fp);
|
2018-05-10 03:49:47 +08:00
|
|
|
fprintf(fp,"Installed packages:%s\n\n",lammps_installed_packages);
|
2018-05-10 01:06:34 +08:00
|
|
|
}
|