2011-06-09 06:00:31 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
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
|
2012-06-07 06:47:51 +08:00
|
|
|
certain rights in this software. This software is distributed under
|
2011-06-09 06:00:31 +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 <math.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2011-06-09 06:00:31 +08:00
|
|
|
#include "dump_image.h"
|
2011-12-23 05:47:52 +08:00
|
|
|
#include "image.h"
|
2011-06-09 06:00:31 +08:00
|
|
|
#include "atom.h"
|
2016-01-15 06:33:46 +08:00
|
|
|
#include "atom_vec_line.h"
|
|
|
|
#include "atom_vec_tri.h"
|
2015-12-18 07:05:20 +08:00
|
|
|
#include "atom_vec_body.h"
|
|
|
|
#include "body.h"
|
2014-01-26 06:46:08 +08:00
|
|
|
#include "molecule.h"
|
2011-06-09 06:00:31 +08:00
|
|
|
#include "domain.h"
|
|
|
|
#include "group.h"
|
|
|
|
#include "force.h"
|
|
|
|
#include "comm.h"
|
2016-07-15 03:42:39 +08:00
|
|
|
#include "modify.h"
|
|
|
|
#include "fix.h"
|
2011-06-09 06:00:31 +08:00
|
|
|
#include "input.h"
|
|
|
|
#include "variable.h"
|
2011-10-20 08:11:49 +08:00
|
|
|
#include "math_const.h"
|
2016-01-15 06:33:46 +08:00
|
|
|
#include "math_extra.h"
|
2011-06-09 06:00:31 +08:00
|
|
|
#include "error.h"
|
|
|
|
#include "memory.h"
|
|
|
|
|
|
|
|
using namespace LAMMPS_NS;
|
2011-10-20 08:11:49 +08:00
|
|
|
using namespace MathConst;
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2013-10-17 00:54:58 +08:00
|
|
|
#define BIG 1.0e20
|
|
|
|
|
2011-12-23 08:22:59 +08:00
|
|
|
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
|
2016-07-15 03:42:39 +08:00
|
|
|
enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes
|
2011-06-09 06:00:31 +08:00
|
|
|
enum{STATIC,DYNAMIC};
|
|
|
|
enum{NO,YES};
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
2012-06-07 06:47:51 +08:00
|
|
|
DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
2016-11-07 22:56:47 +08:00
|
|
|
DumpCustom(lmp, narg, arg), thetastr(NULL), phistr(NULL), cxstr(NULL),
|
|
|
|
cystr(NULL), czstr(NULL), upxstr(NULL), upystr(NULL), upzstr(NULL),
|
|
|
|
zoomstr(NULL), perspstr(NULL), diamtype(NULL), diamelement(NULL),
|
|
|
|
bdiamtype(NULL), colortype(NULL), colorelement(NULL), bcolortype(NULL),
|
|
|
|
avec_line(NULL), avec_tri(NULL), avec_body(NULL), fixptr(NULL), image(NULL),
|
|
|
|
chooseghost(NULL), bufcopy(NULL)
|
2011-06-09 06:00:31 +08:00
|
|
|
{
|
2011-09-24 02:06:55 +08:00
|
|
|
if (binary || multiproc) error->all(FLERR,"Invalid dump image filename");
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2013-07-30 01:32:29 +08:00
|
|
|
// force binary flag on to avoid corrupted output on Windows
|
|
|
|
|
|
|
|
binary = 1;
|
2013-11-06 00:10:30 +08:00
|
|
|
multifile_override = 0;
|
2013-07-30 01:32:29 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
// set filetype based on filename suffix
|
|
|
|
|
|
|
|
int n = strlen(filename);
|
|
|
|
if (strlen(filename) > 4 && strcmp(&filename[n-4],".jpg") == 0)
|
|
|
|
filetype = JPG;
|
2013-10-30 23:03:13 +08:00
|
|
|
else if (strlen(filename) > 4 && strcmp(&filename[n-4],".JPG") == 0)
|
|
|
|
filetype = JPG;
|
2011-06-09 06:00:31 +08:00
|
|
|
else if (strlen(filename) > 5 && strcmp(&filename[n-5],".jpeg") == 0)
|
|
|
|
filetype = JPG;
|
2013-10-30 23:03:13 +08:00
|
|
|
else if (strlen(filename) > 5 && strcmp(&filename[n-5],".JPEG") == 0)
|
|
|
|
filetype = JPG;
|
|
|
|
else if (strlen(filename) > 4 && strcmp(&filename[n-4],".png") == 0)
|
|
|
|
filetype = PNG;
|
|
|
|
else if (strlen(filename) > 4 && strcmp(&filename[n-4],".PNG") == 0)
|
|
|
|
filetype = PNG;
|
2011-06-09 06:00:31 +08:00
|
|
|
else filetype = PPM;
|
|
|
|
|
|
|
|
#ifndef LAMMPS_JPEG
|
2013-10-30 23:03:13 +08:00
|
|
|
if (filetype == JPG)
|
|
|
|
error->all(FLERR,"Support for writing images in JPEG format not included");
|
|
|
|
#endif
|
|
|
|
#ifndef LAMMPS_PNG
|
|
|
|
if (filetype == PNG)
|
|
|
|
error->all(FLERR,"Support for writing images in PNG format not included");
|
2011-06-09 06:00:31 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// atom color,diameter settings
|
|
|
|
|
2011-09-24 02:06:55 +08:00
|
|
|
if (nfield != 2) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
acolor = ATTRIBUTE;
|
|
|
|
if (strcmp(arg[5],"type") == 0) acolor = TYPE;
|
|
|
|
else if (strcmp(arg[5],"element") == 0) acolor = ELEMENT;
|
|
|
|
|
|
|
|
adiam = ATTRIBUTE;
|
|
|
|
if (strcmp(arg[6],"type") == 0) adiam = TYPE;
|
|
|
|
else if (strcmp(arg[6],"element") == 0) adiam = ELEMENT;
|
|
|
|
|
2013-10-15 07:22:02 +08:00
|
|
|
// create Image class with single colormap for atoms
|
2012-01-12 05:27:57 +08:00
|
|
|
// change defaults for 2d
|
2011-12-23 05:47:52 +08:00
|
|
|
|
2013-10-15 07:22:02 +08:00
|
|
|
image = new Image(lmp,1);
|
2011-12-23 05:47:52 +08:00
|
|
|
|
2012-01-12 05:27:57 +08:00
|
|
|
if (domain->dimension == 2) {
|
|
|
|
image->theta = 0.0;
|
|
|
|
image->phi = 0.0;
|
|
|
|
image->up[0] = 0.0; image->up[1] = 1.0; image->up[2] = 0.0;
|
|
|
|
}
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
// set defaults for optional args
|
|
|
|
|
|
|
|
atomflag = YES;
|
2016-07-15 03:42:39 +08:00
|
|
|
lineflag = triflag = bodyflag = fixflag = NO;
|
2011-06-09 06:00:31 +08:00
|
|
|
if (atom->nbondtypes == 0) bondflag = NO;
|
|
|
|
else {
|
|
|
|
bondflag = YES;
|
|
|
|
bcolor = ATOM;
|
|
|
|
bdiam = NUMERIC;
|
|
|
|
bdiamvalue = 0.5;
|
|
|
|
}
|
2016-07-15 03:42:39 +08:00
|
|
|
char *fixID = NULL;
|
2011-12-23 05:47:52 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
thetastr = phistr = NULL;
|
|
|
|
cflag = STATIC;
|
|
|
|
cx = cy = cz = 0.5;
|
|
|
|
cxstr = cystr = czstr = NULL;
|
2011-12-23 05:47:52 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
upxstr = upystr = upzstr = NULL;
|
|
|
|
zoomstr = NULL;
|
|
|
|
perspstr = NULL;
|
|
|
|
boxflag = YES;
|
|
|
|
boxdiam = 0.02;
|
|
|
|
axesflag = NO;
|
2014-08-02 07:40:44 +08:00
|
|
|
subboxflag = NO;
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
// parse optional args
|
|
|
|
|
|
|
|
int iarg = ioptional;
|
|
|
|
while (iarg < narg) {
|
2016-01-15 06:33:46 +08:00
|
|
|
if (strcmp(arg[iarg],"atom") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strcmp(arg[iarg+1],"yes") == 0) atomflag = YES;
|
|
|
|
else if (strcmp(arg[iarg+1],"no") == 0) atomflag = NO;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 2;
|
|
|
|
|
2016-01-15 06:33:46 +08:00
|
|
|
} else if (strcmp(arg[iarg],"adiam") == 0) {
|
|
|
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
|
|
|
adiam = NUMERIC;
|
|
|
|
adiamvalue = force->numeric(FLERR,arg[iarg+1]);
|
|
|
|
if (adiamvalue <= 0.0) error->all(FLERR,"Illegal dump image command");
|
|
|
|
iarg += 2;
|
2015-12-18 07:05:20 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (strcmp(arg[iarg],"bond") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (atom->nbondtypes == 0)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Dump image bond not allowed with no bond types");
|
2011-06-09 06:00:31 +08:00
|
|
|
bondflag = YES;
|
|
|
|
if (strcmp(arg[iarg+1],"none") == 0) bondflag = NO;
|
|
|
|
else if (strcmp(arg[iarg+1],"atom") == 0) bcolor = ATOM;
|
|
|
|
else if (strcmp(arg[iarg+1],"type") == 0) bcolor = TYPE;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!islower(arg[iarg+2][0])) {
|
2012-06-07 06:47:51 +08:00
|
|
|
bdiam = NUMERIC;
|
2013-06-29 03:00:58 +08:00
|
|
|
bdiamvalue = force->numeric(FLERR,arg[iarg+2]);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (bdiamvalue <= 0.0) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (strcmp(arg[iarg+2],"atom") == 0) bdiam = ATOM;
|
|
|
|
else if (strcmp(arg[iarg+2],"type") == 0) bdiam = TYPE;
|
|
|
|
else if (strcmp(arg[iarg+2],"none") == 0) bondflag = NO;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 3;
|
|
|
|
|
2016-01-15 06:33:46 +08:00
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"line") == 0) {
|
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
|
|
|
lineflag = YES;
|
|
|
|
if (strcmp(arg[iarg+1],"type") == 0) lcolor = TYPE;
|
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
|
|
|
ldiam = NUMERIC;
|
|
|
|
ldiamvalue = force->numeric(FLERR,arg[iarg+2]);
|
|
|
|
iarg += 3;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"tri") == 0) {
|
2016-01-28 04:33:55 +08:00
|
|
|
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
|
2016-01-15 06:33:46 +08:00
|
|
|
triflag = YES;
|
|
|
|
if (strcmp(arg[iarg+1],"type") == 0) tcolor = TYPE;
|
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2016-01-28 04:33:55 +08:00
|
|
|
tstyle = force->inumeric(FLERR,arg[iarg+2]);
|
|
|
|
tdiamvalue = force->numeric(FLERR,arg[iarg+3]);
|
|
|
|
iarg += 4;
|
2016-01-15 06:33:46 +08:00
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"body") == 0) {
|
|
|
|
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
|
|
|
|
bodyflag = YES;
|
|
|
|
if (strcmp(arg[iarg+1],"type") == 0) bodycolor = TYPE;
|
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
|
|
|
bodyflag1 = force->numeric(FLERR,arg[iarg+2]);
|
|
|
|
bodyflag2 = force->numeric(FLERR,arg[iarg+3]);
|
|
|
|
iarg += 4;
|
|
|
|
|
2016-07-15 03:42:39 +08:00
|
|
|
} else if (strcmp(arg[iarg],"fix") == 0) {
|
|
|
|
if (iarg+5 > narg) error->all(FLERR,"Illegal dump image command");
|
|
|
|
fixflag = YES;
|
|
|
|
fixID = arg[iarg+1];
|
|
|
|
if (strcmp(arg[iarg+2],"type") == 0) fixcolor = TYPE;
|
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
|
|
|
fixflag1 = force->numeric(FLERR,arg[iarg+3]);
|
|
|
|
fixflag2 = force->numeric(FLERR,arg[iarg+4]);
|
|
|
|
iarg += 5;
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (strcmp(arg[iarg],"size") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
2013-06-29 03:00:58 +08:00
|
|
|
int width = force->inumeric(FLERR,arg[iarg+1]);
|
|
|
|
int height = force->inumeric(FLERR,arg[iarg+2]);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
error->all(FLERR,"Illegal dump image command");
|
2011-12-23 05:47:52 +08:00
|
|
|
image->width = width;
|
|
|
|
image->height = height;
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 3;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"view") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+1][2]) + 1;
|
|
|
|
thetastr = new char[n];
|
|
|
|
strcpy(thetastr,&arg[iarg+1][2]);
|
2011-06-09 06:00:31 +08:00
|
|
|
} else {
|
2013-06-29 03:00:58 +08:00
|
|
|
double theta = force->numeric(FLERR,arg[iarg+1]);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (theta < 0.0 || theta > 180.0)
|
|
|
|
error->all(FLERR,"Invalid dump image theta value");
|
|
|
|
theta *= MY_PI/180.0;
|
|
|
|
image->theta = theta;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
2011-08-07 06:51:50 +08:00
|
|
|
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+2][2]) + 1;
|
|
|
|
phistr = new char[n];
|
|
|
|
strcpy(phistr,&arg[iarg+2][2]);
|
2011-06-09 06:00:31 +08:00
|
|
|
} else {
|
2013-06-29 03:00:58 +08:00
|
|
|
double phi = force->numeric(FLERR,arg[iarg+2]);
|
2012-06-07 06:47:51 +08:00
|
|
|
phi *= MY_PI/180.0;
|
|
|
|
image->phi = phi;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
iarg += 3;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"center") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+5 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strcmp(arg[iarg+1],"s") == 0) cflag = STATIC;
|
|
|
|
else if (strcmp(arg[iarg+1],"d") == 0) cflag = DYNAMIC;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+2][2]) + 1;
|
|
|
|
cxstr = new char[n];
|
|
|
|
strcpy(cxstr,&arg[iarg+2][2]);
|
|
|
|
cflag = DYNAMIC;
|
2013-06-29 03:00:58 +08:00
|
|
|
} else cx = force->numeric(FLERR,arg[iarg+2]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+3][2]) + 1;
|
|
|
|
cystr = new char[n];
|
|
|
|
strcpy(cystr,&arg[iarg+3][2]);
|
|
|
|
cflag = DYNAMIC;
|
2013-06-29 03:00:58 +08:00
|
|
|
} else cy = force->numeric(FLERR,arg[iarg+3]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+4][2]) + 1;
|
|
|
|
czstr = new char[n];
|
|
|
|
strcpy(czstr,&arg[iarg+4][2]);
|
|
|
|
cflag = DYNAMIC;
|
2013-06-29 03:00:58 +08:00
|
|
|
} else cz = force->numeric(FLERR,arg[iarg+4]);
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 5;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"up") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+1][2]) + 1;
|
|
|
|
upxstr = new char[n];
|
|
|
|
strcpy(upxstr,&arg[iarg+1][2]);
|
2013-06-29 03:00:58 +08:00
|
|
|
} else image->up[0] = force->numeric(FLERR,arg[iarg+1]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+2][2]) + 1;
|
|
|
|
upystr = new char[n];
|
|
|
|
strcpy(upystr,&arg[iarg+2][2]);
|
2013-06-29 03:00:58 +08:00
|
|
|
} else image->up[1] = force->numeric(FLERR,arg[iarg+2]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+3][2]) + 1;
|
|
|
|
upzstr = new char[n];
|
|
|
|
strcpy(upzstr,&arg[iarg+3][2]);
|
2013-06-29 03:00:58 +08:00
|
|
|
} else image->up[2] = force->numeric(FLERR,arg[iarg+3]);
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 4;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"zoom") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+1][2]) + 1;
|
|
|
|
zoomstr = new char[n];
|
|
|
|
strcpy(zoomstr,&arg[iarg+1][2]);
|
2011-06-09 06:00:31 +08:00
|
|
|
} else {
|
2013-06-29 03:00:58 +08:00
|
|
|
double zoom = force->numeric(FLERR,arg[iarg+1]);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (zoom <= 0.0) error->all(FLERR,"Illegal dump image command");
|
|
|
|
image->zoom = zoom;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
iarg += 2;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"persp") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Dump image persp option is not yet supported");
|
|
|
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) {
|
2012-06-07 06:47:51 +08:00
|
|
|
int n = strlen(&arg[iarg+1][2]) + 1;
|
|
|
|
perspstr = new char[n];
|
|
|
|
strcpy(perspstr,&arg[iarg+1][2]);
|
2011-06-09 06:00:31 +08:00
|
|
|
} else {
|
2013-06-29 03:00:58 +08:00
|
|
|
double persp = force->numeric(FLERR,arg[iarg+1]);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (persp < 0.0) error->all(FLERR,"Illegal dump image command");
|
|
|
|
image->persp = persp;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
iarg += 2;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"box") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strcmp(arg[iarg+1],"yes") == 0) boxflag = YES;
|
|
|
|
else if (strcmp(arg[iarg+1],"no") == 0) boxflag = NO;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2013-06-29 03:00:58 +08:00
|
|
|
boxdiam = force->numeric(FLERR,arg[iarg+2]);
|
2011-09-24 02:06:55 +08:00
|
|
|
if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 3;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"axes") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (strcmp(arg[iarg+1],"yes") == 0) axesflag = YES;
|
|
|
|
else if (strcmp(arg[iarg+1],"no") == 0) axesflag = NO;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2013-06-29 03:00:58 +08:00
|
|
|
axeslen = force->numeric(FLERR,arg[iarg+2]);
|
|
|
|
axesdiam = force->numeric(FLERR,arg[iarg+3]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (axeslen < 0.0 || axesdiam < 0.0)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 4;
|
|
|
|
|
2014-08-02 07:40:44 +08:00
|
|
|
} else if (strcmp(arg[iarg],"subbox") == 0) {
|
|
|
|
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
|
|
|
|
if (strcmp(arg[iarg+1],"yes") == 0) subboxflag = YES;
|
|
|
|
else if (strcmp(arg[iarg+1],"no") == 0) subboxflag = NO;
|
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
|
|
|
subboxdiam = force->numeric(FLERR,arg[iarg+2]);
|
|
|
|
if (subboxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
|
|
|
|
iarg += 3;
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (strcmp(arg[iarg],"shiny") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
|
2013-06-29 03:00:58 +08:00
|
|
|
double shiny = force->numeric(FLERR,arg[iarg+1]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (shiny < 0.0 || shiny > 1.0)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Illegal dump image command");
|
2011-12-23 05:47:52 +08:00
|
|
|
image->shiny = shiny;
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 2;
|
|
|
|
|
|
|
|
} else if (strcmp(arg[iarg],"ssao") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[iarg+1],"yes") == 0) image->ssao = YES;
|
|
|
|
else if (strcmp(arg[iarg+1],"no") == 0) image->ssao = NO;
|
2011-09-24 02:06:55 +08:00
|
|
|
else error->all(FLERR,"Illegal dump image command");
|
2013-06-29 03:00:58 +08:00
|
|
|
int seed = force->inumeric(FLERR,arg[iarg+2]);
|
2011-09-24 02:06:55 +08:00
|
|
|
if (seed <= 0) error->all(FLERR,"Illegal dump image command");
|
2011-12-23 05:47:52 +08:00
|
|
|
image->seed = seed;
|
2013-06-29 03:00:58 +08:00
|
|
|
double ssaoint = force->numeric(FLERR,arg[iarg+3]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (ssaoint < 0.0 || ssaoint > 1.0)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Illegal dump image command");
|
2011-12-23 05:47:52 +08:00
|
|
|
image->ssaoint = ssaoint;
|
2011-06-09 06:00:31 +08:00
|
|
|
iarg += 4;
|
|
|
|
|
2011-09-24 02:06:55 +08:00
|
|
|
} else error->all(FLERR,"Illegal dump image command");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
2016-07-15 03:42:39 +08:00
|
|
|
// error checks and setup for lineflag, triflag, bodyflag, fixflag
|
2015-12-18 07:05:20 +08:00
|
|
|
|
2016-01-15 06:33:46 +08:00
|
|
|
if (lineflag) {
|
|
|
|
avec_line = (AtomVecLine *) atom->style_match("line");
|
|
|
|
if (!avec_line)
|
|
|
|
error->all(FLERR,"Dump image line requires atom style line");
|
|
|
|
}
|
|
|
|
if (triflag) {
|
|
|
|
avec_tri = (AtomVecTri *) atom->style_match("tri");
|
|
|
|
if (!avec_tri)
|
|
|
|
error->all(FLERR,"Dump image tri requires atom style tri");
|
|
|
|
}
|
2015-12-18 07:05:20 +08:00
|
|
|
if (bodyflag) {
|
2016-01-15 06:33:46 +08:00
|
|
|
avec_body = (AtomVecBody *) atom->style_match("body");
|
|
|
|
if (!avec_body)
|
|
|
|
error->all(FLERR,"Dump image body yes requires atom style body");
|
2015-12-18 07:05:20 +08:00
|
|
|
}
|
|
|
|
|
2016-01-15 06:33:46 +08:00
|
|
|
extraflag = 0;
|
|
|
|
if (lineflag || triflag || bodyflag) extraflag = 1;
|
|
|
|
|
2016-07-15 03:42:39 +08:00
|
|
|
if (fixflag) {
|
|
|
|
int ifix = modify->find_fix(fixID);
|
|
|
|
if (ifix < 0) error->all(FLERR,"Fix ID for dump image does not exist");
|
|
|
|
fixptr = modify->fix[ifix];
|
|
|
|
}
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
// allocate image buffer now that image size is known
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
image->buffers();
|
|
|
|
|
|
|
|
// communication neede for bonds colored by atoms
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
if (bondflag) {
|
|
|
|
if (bcolor == ATOM || bdiam == ATOM) comm_forward = 3;
|
|
|
|
else comm_forward = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// additional defaults for dump_modify options
|
|
|
|
|
|
|
|
diamtype = new double[ntypes+1];
|
|
|
|
diamelement = new double[ntypes+1];
|
|
|
|
colortype = new double*[ntypes+1];
|
|
|
|
colorelement = new double*[ntypes+1];
|
|
|
|
|
|
|
|
for (int i = 1; i <= ntypes; i++) {
|
|
|
|
diamtype[i] = 1.0;
|
2011-12-23 05:47:52 +08:00
|
|
|
if (i % 6 == 1) colortype[i] = image->color2rgb("red");
|
|
|
|
else if (i % 6 == 2) colortype[i] = image->color2rgb("green");
|
|
|
|
else if (i % 6 == 3) colortype[i] = image->color2rgb("blue");
|
|
|
|
else if (i % 6 == 4) colortype[i] = image->color2rgb("yellow");
|
|
|
|
else if (i % 6 == 5) colortype[i] = image->color2rgb("aqua");
|
|
|
|
else if (i % 6 == 0) colortype[i] = image->color2rgb("cyan");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bondflag) {
|
|
|
|
bdiamtype = new double[atom->nbondtypes+1];
|
|
|
|
bcolortype = new double*[atom->nbondtypes+1];
|
|
|
|
for (int i = 1; i <= atom->nbondtypes; i++) {
|
|
|
|
bdiamtype[i] = 0.5;
|
2011-12-23 05:47:52 +08:00
|
|
|
if (i % 6 == 1) bcolortype[i] = image->color2rgb("red");
|
|
|
|
else if (i % 6 == 2) bcolortype[i] = image->color2rgb("green");
|
|
|
|
else if (i % 6 == 3) bcolortype[i] = image->color2rgb("blue");
|
|
|
|
else if (i % 6 == 4) bcolortype[i] = image->color2rgb("yellow");
|
|
|
|
else if (i % 6 == 5) bcolortype[i] = image->color2rgb("aqua");
|
|
|
|
else if (i % 6 == 0) bcolortype[i] = image->color2rgb("cyan");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
bdiamtype = NULL;
|
|
|
|
bcolortype = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// viewflag = DYNAMIC if any view parameter is dynamic
|
|
|
|
|
|
|
|
viewflag = STATIC;
|
2012-06-07 06:47:51 +08:00
|
|
|
if (thetastr || phistr || cflag == DYNAMIC ||
|
2011-06-09 06:00:31 +08:00
|
|
|
upxstr || upystr || upzstr || zoomstr || perspstr) viewflag = DYNAMIC;
|
|
|
|
|
2012-01-12 05:27:57 +08:00
|
|
|
box_bounds();
|
2011-06-09 06:00:31 +08:00
|
|
|
if (cflag == STATIC) box_center();
|
|
|
|
if (viewflag == STATIC) view_params();
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
// local data
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
maxbufcopy = 0;
|
2013-07-24 07:07:54 +08:00
|
|
|
chooseghost = NULL;
|
2011-06-09 06:00:31 +08:00
|
|
|
bufcopy = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
DumpImage::~DumpImage()
|
|
|
|
{
|
2011-12-23 05:47:52 +08:00
|
|
|
delete image;
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
delete [] diamtype;
|
|
|
|
delete [] diamelement;
|
|
|
|
delete [] colortype;
|
|
|
|
delete [] colorelement;
|
|
|
|
delete [] bdiamtype;
|
|
|
|
delete [] bcolortype;
|
2013-07-24 07:07:54 +08:00
|
|
|
memory->destroy(chooseghost);
|
|
|
|
memory->destroy(bufcopy);
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void DumpImage::init_style()
|
|
|
|
{
|
2013-11-06 00:10:30 +08:00
|
|
|
if (multifile == 0 && !multifile_override)
|
2011-12-23 05:47:52 +08:00
|
|
|
error->all(FLERR,"Dump image requires one snapshot per file");
|
2011-09-24 02:06:55 +08:00
|
|
|
if (sort_flag) error->all(FLERR,"Dump image cannot perform sorting");
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
DumpCustom::init_style();
|
|
|
|
|
|
|
|
// check variables
|
|
|
|
|
|
|
|
if (thetastr) {
|
|
|
|
thetavar = input->variable->find(thetastr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (thetavar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image theta does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(thetavar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image theta is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (phistr) {
|
|
|
|
phivar = input->variable->find(phistr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (phivar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image phi does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(phivar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image phi is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (cxstr) {
|
|
|
|
cxvar = input->variable->find(cxstr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (cxvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image center does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(cxvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image center is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (cystr) {
|
|
|
|
cyvar = input->variable->find(cystr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (cyvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image center does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(cyvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image center is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (czstr) {
|
|
|
|
czvar = input->variable->find(czstr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (czvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image center does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(czvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image center is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (upxstr) {
|
|
|
|
upxvar = input->variable->find(upxstr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (upxvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image center does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(upxvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image center is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (upystr) {
|
|
|
|
upyvar = input->variable->find(upystr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (upyvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image center does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(upyvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image center is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (upzstr) {
|
|
|
|
upzvar = input->variable->find(upzstr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (upzvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image center does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(upzvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image center is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (zoomstr) {
|
|
|
|
zoomvar = input->variable->find(zoomstr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (zoomvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image zoom does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(zoomvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image zoom is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
if (perspstr) {
|
|
|
|
perspvar = input->variable->find(perspstr);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (perspvar < 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable name for dump image persp does not exist");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (!input->variable->equalstyle(perspvar))
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Variable for dump image persp is invalid style");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// set up type -> element mapping
|
|
|
|
|
|
|
|
if (atomflag && acolor == ELEMENT) {
|
|
|
|
for (int i = 1; i <= ntypes; i++) {
|
2011-12-23 05:47:52 +08:00
|
|
|
colorelement[i] = image->element2color(typenames[i]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (colorelement[i] == NULL)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Invalid dump image element name");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (atomflag && adiam == ELEMENT) {
|
|
|
|
for (int i = 1; i <= ntypes; i++) {
|
2011-12-23 05:47:52 +08:00
|
|
|
diamelement[i] = image->element2diam(typenames[i]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (diamelement[i] == 0.0)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Invalid dump image element name");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void DumpImage::write()
|
|
|
|
{
|
|
|
|
// open new file
|
|
|
|
|
|
|
|
openfile();
|
|
|
|
|
|
|
|
// reset box center and view parameters if dynamic
|
|
|
|
|
2012-01-12 05:27:57 +08:00
|
|
|
box_bounds();
|
2011-06-09 06:00:31 +08:00
|
|
|
if (cflag == DYNAMIC) box_center();
|
|
|
|
if (viewflag == DYNAMIC) view_params();
|
|
|
|
|
|
|
|
// nme = # of atoms this proc will contribute to dump
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
nme = count();
|
|
|
|
|
|
|
|
if (nme > maxbuf) {
|
|
|
|
maxbuf = nme;
|
|
|
|
memory->destroy(buf);
|
|
|
|
memory->create(buf,maxbuf*size_one,"dump:buf");
|
|
|
|
}
|
|
|
|
|
2013-10-17 00:54:58 +08:00
|
|
|
// pack buf with color & diameter
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
pack(NULL);
|
2013-10-17 00:54:58 +08:00
|
|
|
|
|
|
|
// set minmax color range if using dynamic atom color map
|
|
|
|
|
|
|
|
if (acolor == ATTRIBUTE && image->map_dynamic(0)) {
|
|
|
|
double two[2],twoall[2];
|
|
|
|
double lo = BIG;
|
|
|
|
double hi = -BIG;
|
|
|
|
int m = 0;
|
|
|
|
for (int i = 0; i < nchoose; i++) {
|
|
|
|
lo = MIN(lo,buf[m]);
|
|
|
|
hi = MAX(hi,buf[m]);
|
|
|
|
m += size_one;
|
|
|
|
}
|
|
|
|
two[0] = -lo;
|
|
|
|
two[1] = hi;
|
|
|
|
MPI_Allreduce(two,twoall,2,MPI_DOUBLE,MPI_MAX,world);
|
|
|
|
int flag = image->map_minmax(0,-twoall[0],twoall[1]);
|
|
|
|
if (flag) error->all(FLERR,"Invalid color map min/max values");
|
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
// create image on each proc, then merge them
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
image->clear();
|
|
|
|
create_image();
|
|
|
|
image->merge();
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
// write image file
|
|
|
|
|
|
|
|
if (me == 0) {
|
2011-12-23 05:47:52 +08:00
|
|
|
if (filetype == JPG) image->write_JPG(fp);
|
2013-10-30 23:03:13 +08:00
|
|
|
else if (filetype == PNG) image->write_PNG(fp);
|
2011-12-23 05:47:52 +08:00
|
|
|
else image->write_PPM(fp);
|
2013-11-04 23:52:10 +08:00
|
|
|
if (multifile) {
|
|
|
|
fclose(fp);
|
|
|
|
fp = NULL;
|
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
simulation box bounds
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void DumpImage::box_bounds()
|
|
|
|
{
|
|
|
|
if (domain->triclinic == 0) {
|
|
|
|
boxxlo = domain->boxlo[0];
|
|
|
|
boxxhi = domain->boxhi[0];
|
|
|
|
boxylo = domain->boxlo[1];
|
|
|
|
boxyhi = domain->boxhi[1];
|
|
|
|
boxzlo = domain->boxlo[2];
|
|
|
|
boxzhi = domain->boxhi[2];
|
|
|
|
} else {
|
|
|
|
boxxlo = domain->boxlo_bound[0];
|
|
|
|
boxxhi = domain->boxhi_bound[0];
|
|
|
|
boxylo = domain->boxlo_bound[1];
|
|
|
|
boxyhi = domain->boxhi_bound[1];
|
|
|
|
boxzlo = domain->boxlo_bound[2];
|
|
|
|
boxzhi = domain->boxhi_bound[2];
|
|
|
|
boxxy = domain->xy;
|
|
|
|
boxxz = domain->xz;
|
|
|
|
boxyz = domain->yz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
reset view parameters
|
|
|
|
called once from constructor if view is STATIC
|
|
|
|
called every snapshot from write() if view is DYNAMIC
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void DumpImage::box_center()
|
|
|
|
{
|
2011-12-23 05:47:52 +08:00
|
|
|
if (cxstr) cx = input->variable->compute_equal(cxvar);
|
|
|
|
if (cystr) cy = input->variable->compute_equal(cyvar);
|
|
|
|
if (czstr) cz = input->variable->compute_equal(czvar);
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
image->xctr = boxxlo + cx*(boxxhi-boxxlo);
|
|
|
|
image->yctr = boxylo + cy*(boxyhi-boxylo);
|
|
|
|
image->zctr = boxzlo + cz*(boxzhi-boxzlo);
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
2011-12-23 05:47:52 +08:00
|
|
|
reset view parameters in Image class
|
2011-06-09 06:00:31 +08:00
|
|
|
called once from constructor if view is STATIC
|
|
|
|
called every snapshot from write() if view is DYNAMIC
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void DumpImage::view_params()
|
|
|
|
{
|
2011-12-23 05:47:52 +08:00
|
|
|
// view direction theta and phi
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
if (thetastr) {
|
2011-12-23 05:47:52 +08:00
|
|
|
double theta = input->variable->compute_equal(thetavar);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (theta < 0.0 || theta > 180.0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Invalid dump image theta value");
|
2011-10-20 08:11:49 +08:00
|
|
|
theta *= MY_PI/180.0;
|
2011-12-23 05:47:52 +08:00
|
|
|
image->theta = theta;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
2011-12-23 05:47:52 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
if (phistr) {
|
2011-12-23 05:47:52 +08:00
|
|
|
double phi = input->variable->compute_equal(phivar);
|
2011-10-20 08:11:49 +08:00
|
|
|
phi *= MY_PI/180.0;
|
2011-12-23 05:47:52 +08:00
|
|
|
image->phi = phi;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// up vector
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (upxstr) image->up[0] = input->variable->compute_equal(upxvar);
|
|
|
|
if (upystr) image->up[1] = input->variable->compute_equal(upyvar);
|
|
|
|
if (upzstr) image->up[2] = input->variable->compute_equal(upzvar);
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
// zoom and perspective
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (zoomstr) image->zoom = input->variable->compute_equal(zoomvar);
|
|
|
|
if (image->zoom <= 0.0) error->all(FLERR,"Invalid dump image zoom value");
|
|
|
|
if (perspstr) image->persp = input->variable->compute_equal(perspvar);
|
|
|
|
if (image->persp < 0.0) error->all(FLERR,"Invalid dump image persp value");
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
// remainder of view setup is internal to Image class
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
image->view_params(boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi);
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
create image for atoms on this proc
|
2012-06-07 06:47:51 +08:00
|
|
|
every pixel has depth
|
2011-06-09 06:00:31 +08:00
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void DumpImage::create_image()
|
|
|
|
{
|
2016-01-15 06:33:46 +08:00
|
|
|
int i,j,k,m,n,itype,atom1,atom2,imol,iatom,btype,ibonus,drawflag;
|
2014-01-26 06:46:08 +08:00
|
|
|
tagint tagprev;
|
2011-06-09 06:00:31 +08:00
|
|
|
double diameter,delx,dely,delz;
|
2016-07-15 03:42:39 +08:00
|
|
|
int *bodyvec,*fixvec;
|
|
|
|
double **bodyarray,**fixarray;
|
2011-06-09 06:00:31 +08:00
|
|
|
double *color,*color1,*color2;
|
2016-07-15 03:42:39 +08:00
|
|
|
double *p1,*p2,*p3;
|
2016-01-15 06:33:46 +08:00
|
|
|
double xmid[3],pt1[3],pt2[3],pt3[3];
|
|
|
|
double mat[3][3];
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
// render my atoms
|
|
|
|
|
|
|
|
if (atomflag) {
|
|
|
|
double **x = atom->x;
|
2016-01-15 06:33:46 +08:00
|
|
|
int *line = atom->line;
|
|
|
|
int *tri = atom->tri;
|
2015-12-18 07:05:20 +08:00
|
|
|
int *body = atom->body;
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
m = 0;
|
|
|
|
for (i = 0; i < nchoose; i++) {
|
|
|
|
j = clist[i];
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
if (acolor == TYPE) {
|
2012-06-07 06:47:51 +08:00
|
|
|
itype = static_cast<int> (buf[m]);
|
|
|
|
color = colortype[itype];
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (acolor == ELEMENT) {
|
2012-06-07 06:47:51 +08:00
|
|
|
itype = static_cast<int> (buf[m]);
|
|
|
|
color = colorelement[itype];
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (acolor == ATTRIBUTE) {
|
2013-10-15 07:22:02 +08:00
|
|
|
color = image->map_value2color(0,buf[m]);
|
2015-09-03 04:39:55 +08:00
|
|
|
} else color = image->color2rgb("white");
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
if (adiam == NUMERIC) {
|
2012-06-07 06:47:51 +08:00
|
|
|
diameter = adiamvalue;
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (adiam == TYPE) {
|
2012-06-07 06:47:51 +08:00
|
|
|
itype = static_cast<int> (buf[m+1]);
|
|
|
|
diameter = diamtype[itype];
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (adiam == ELEMENT) {
|
2012-06-07 06:47:51 +08:00
|
|
|
itype = static_cast<int> (buf[m+1]);
|
|
|
|
diameter = diamelement[itype];
|
2011-06-09 06:00:31 +08:00
|
|
|
} else if (adiam == ATTRIBUTE) {
|
2012-06-07 06:47:51 +08:00
|
|
|
diameter = buf[m+1];
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
2011-12-23 05:47:52 +08:00
|
|
|
|
2016-01-15 06:33:46 +08:00
|
|
|
// do not draw if line,tri,body keywords enabled and atom is one of those
|
|
|
|
|
|
|
|
drawflag = 1;
|
|
|
|
if (extraflag) {
|
|
|
|
if (lineflag && line[j] >= 0) drawflag = 0;
|
|
|
|
if (triflag && tri[j] >= 0) drawflag = 0;
|
|
|
|
if (bodyflag && body[j] >= 0) drawflag = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawflag) image->draw_sphere(x[j],color,diameter);
|
|
|
|
|
|
|
|
m += size_one;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render atoms that are lines
|
|
|
|
|
|
|
|
if (lineflag) {
|
|
|
|
double length,theta,dx,dy;
|
|
|
|
double **x = atom->x;
|
|
|
|
int *line = atom->line;
|
|
|
|
int *type = atom->type;
|
|
|
|
|
|
|
|
for (i = 0; i < nchoose; i++) {
|
|
|
|
j = clist[i];
|
|
|
|
if (line[j] < 0) continue;
|
|
|
|
|
|
|
|
if (lcolor == TYPE) {
|
|
|
|
color = colortype[type[j]];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ldiam == NUMERIC) {
|
|
|
|
diameter = ldiamvalue;
|
|
|
|
}
|
|
|
|
|
|
|
|
length = avec_line->bonus[line[j]].length;
|
|
|
|
theta = avec_line->bonus[line[j]].theta;
|
|
|
|
dx = 0.5*length*cos(theta);
|
|
|
|
dy = 0.5*length*sin(theta);
|
|
|
|
|
|
|
|
pt1[0] = x[j][0] + dx;
|
|
|
|
pt1[1] = x[j][1] + dy;
|
|
|
|
pt1[2] = 0.0;
|
|
|
|
pt2[0] = x[j][0] - dx;
|
|
|
|
pt2[1] = x[j][1] - dy;
|
|
|
|
pt2[2] = 0.0;
|
|
|
|
|
|
|
|
image->draw_cylinder(pt1,pt2,color,ldiamvalue,3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render atoms that are triangles
|
2016-01-28 04:33:55 +08:00
|
|
|
// tstyle = 1 for tri only, 2 for edges only, 3 for both
|
2016-01-15 06:33:46 +08:00
|
|
|
|
|
|
|
if (triflag) {
|
2016-01-28 04:33:55 +08:00
|
|
|
int tridraw = 1;
|
|
|
|
if (tstyle == 2) tridraw = 0;
|
|
|
|
int edgedraw = 1;
|
|
|
|
if (tstyle == 1) edgedraw = 0;
|
|
|
|
|
2016-01-15 06:33:46 +08:00
|
|
|
double **x = atom->x;
|
|
|
|
int *tri = atom->tri;
|
|
|
|
int *type = atom->type;
|
|
|
|
|
|
|
|
for (i = 0; i < nchoose; i++) {
|
|
|
|
j = clist[i];
|
|
|
|
if (tri[j] < 0) continue;
|
|
|
|
|
|
|
|
if (tcolor == TYPE) {
|
|
|
|
color = colortype[type[j]];
|
|
|
|
}
|
|
|
|
|
|
|
|
MathExtra::quat_to_mat(avec_tri->bonus[tri[i]].quat,mat);
|
|
|
|
MathExtra::matvec(mat,avec_tri->bonus[tri[i]].c1,pt1);
|
|
|
|
MathExtra::matvec(mat,avec_tri->bonus[tri[i]].c2,pt2);
|
|
|
|
MathExtra::matvec(mat,avec_tri->bonus[tri[i]].c3,pt3);
|
|
|
|
MathExtra::add3(pt1,x[i],pt1);
|
|
|
|
MathExtra::add3(pt2,x[i],pt2);
|
|
|
|
MathExtra::add3(pt3,x[i],pt3);
|
|
|
|
|
2016-01-28 04:33:55 +08:00
|
|
|
if (tridraw) image->draw_triangle(pt1,pt2,pt3,color);
|
|
|
|
if (edgedraw) {
|
|
|
|
image->draw_cylinder(pt1,pt2,color,tdiamvalue,3);
|
|
|
|
image->draw_cylinder(pt2,pt3,color,tdiamvalue,3);
|
|
|
|
image->draw_cylinder(pt3,pt1,color,tdiamvalue,3);
|
|
|
|
}
|
2016-01-15 06:33:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render atoms that are bodies
|
|
|
|
|
|
|
|
if (bodyflag) {
|
|
|
|
Body *bptr = avec_body->bptr;
|
|
|
|
int *body = atom->body;
|
|
|
|
|
|
|
|
m = 0;
|
|
|
|
for (i = 0; i < nchoose; i++) {
|
|
|
|
j = clist[i];
|
|
|
|
if (body[j] < 0) continue;
|
|
|
|
|
|
|
|
if (bodycolor == TYPE) {
|
|
|
|
itype = static_cast<int> (buf[m]);
|
|
|
|
color = colortype[itype];
|
|
|
|
}
|
|
|
|
|
|
|
|
ibonus = body[i];
|
|
|
|
n = bptr->image(ibonus,bodyflag1,bodyflag2,bodyvec,bodyarray);
|
|
|
|
for (k = 0; k < n; k++) {
|
|
|
|
if (bodyvec[k] == SPHERE)
|
|
|
|
image->draw_sphere(bodyarray[k],color,bodyarray[k][3]);
|
|
|
|
else if (bodyvec[k] == LINE)
|
|
|
|
image->draw_cylinder(&bodyarray[k][0],&bodyarray[k][3],
|
|
|
|
color,bodyarray[k][6],3);
|
2015-12-18 07:05:20 +08:00
|
|
|
}
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
m += size_one;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// render bonds for my atoms
|
|
|
|
// both atoms in bond must be selected for bond to be rendered
|
|
|
|
// if newton_bond is off, only render bond once
|
|
|
|
// render bond in 2 pieces if crosses periodic boundary
|
|
|
|
// if bond is deleted (type = 0), do not render
|
|
|
|
// if bond is turned off (type < 0), still render
|
|
|
|
|
|
|
|
if (bondflag) {
|
|
|
|
double **x = atom->x;
|
2014-01-18 02:43:09 +08:00
|
|
|
tagint *tag = atom->tag;
|
|
|
|
tagint **bond_atom = atom->bond_atom;
|
2011-06-09 06:00:31 +08:00
|
|
|
int **bond_type = atom->bond_type;
|
|
|
|
int *num_bond = atom->num_bond;
|
2014-01-26 06:46:08 +08:00
|
|
|
int *molindex = atom->molindex;
|
|
|
|
int *molatom = atom->molatom;
|
2011-06-09 06:00:31 +08:00
|
|
|
int *type = atom->type;
|
|
|
|
int nlocal = atom->nlocal;
|
|
|
|
int newton_bond = force->newton_bond;
|
2014-01-26 06:46:08 +08:00
|
|
|
int molecular = atom->molecular;
|
|
|
|
Molecule **onemols = atom->avec->onemols;
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
// communicate choose flag for ghost atoms to know if they are selected
|
|
|
|
// if bcolor/bdiam = ATOM, setup bufcopy to comm atom color/diam attributes
|
|
|
|
|
2016-06-01 00:33:07 +08:00
|
|
|
if (atom->nmax > maxbufcopy) {
|
2013-07-24 07:07:54 +08:00
|
|
|
maxbufcopy = atom->nmax;
|
|
|
|
memory->destroy(chooseghost);
|
|
|
|
memory->create(chooseghost,maxbufcopy,"dump:chooseghost");
|
|
|
|
if (comm_forward == 3) {
|
2012-06-07 06:47:51 +08:00
|
|
|
memory->destroy(bufcopy);
|
|
|
|
memory->create(bufcopy,maxbufcopy,2,"dump:bufcopy");
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
2013-07-24 07:07:54 +08:00
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2013-07-24 07:07:54 +08:00
|
|
|
for (i = 0; i < nlocal; i++) chooseghost[i] = choose[i];
|
|
|
|
|
|
|
|
if (comm_forward == 3) {
|
2011-06-09 06:00:31 +08:00
|
|
|
for (i = 0; i < nlocal; i++) bufcopy[i][0] = bufcopy[i][1] = 0.0;
|
|
|
|
m = 0;
|
|
|
|
for (i = 0; i < nchoose; i++) {
|
2012-06-07 06:47:51 +08:00
|
|
|
j = clist[i];
|
|
|
|
bufcopy[j][0] = buf[m];
|
|
|
|
bufcopy[j][1] = buf[m+1];
|
|
|
|
m += size_one;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
comm->forward_comm_dump(this);
|
|
|
|
|
|
|
|
for (i = 0; i < nchoose; i++) {
|
|
|
|
atom1 = clist[i];
|
2014-01-26 06:46:08 +08:00
|
|
|
if (molecular == 1) n = num_bond[atom1];
|
|
|
|
else {
|
|
|
|
if (molindex[atom1] < 0) continue;
|
|
|
|
imol = molindex[atom1];
|
|
|
|
iatom = molatom[atom1];
|
|
|
|
n = onemols[imol]->num_bond[iatom];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (m = 0; m < n; m++) {
|
|
|
|
if (molecular == 1) {
|
|
|
|
btype = bond_type[atom1][m];
|
|
|
|
atom2 = atom->map(bond_atom[atom1][m]);
|
|
|
|
} else {
|
|
|
|
tagprev = tag[i] - iatom - 1;
|
2014-08-14 21:10:39 +08:00
|
|
|
btype = atom->map(onemols[imol]->bond_type[iatom][m]);
|
2014-01-26 06:46:08 +08:00
|
|
|
atom2 = atom->map(onemols[imol]->bond_atom[iatom][m]+tagprev);
|
|
|
|
}
|
|
|
|
|
2013-07-24 07:07:54 +08:00
|
|
|
if (atom2 < 0 || !chooseghost[atom2]) continue;
|
2012-06-07 06:47:51 +08:00
|
|
|
if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue;
|
2014-01-26 06:46:08 +08:00
|
|
|
if (btype == 0) continue;
|
2012-06-07 06:47:51 +08:00
|
|
|
|
|
|
|
if (bcolor == ATOM) {
|
|
|
|
if (acolor == TYPE) {
|
|
|
|
color1 = colortype[type[atom1]];
|
|
|
|
color2 = colortype[type[atom2]];
|
|
|
|
} else if (acolor == ELEMENT) {
|
|
|
|
color1 = colorelement[type[atom1]];
|
|
|
|
color2 = colorelement[type[atom2]];
|
|
|
|
} else if (acolor == ATTRIBUTE) {
|
2013-10-15 07:22:02 +08:00
|
|
|
color1 = image->map_value2color(0,bufcopy[atom1][0]);
|
|
|
|
color2 = image->map_value2color(0,bufcopy[atom2][0]);
|
2015-09-03 04:39:55 +08:00
|
|
|
} else {
|
|
|
|
color1 = image->color2rgb("white");
|
|
|
|
color2 = image->color2rgb("white");
|
2012-06-07 06:47:51 +08:00
|
|
|
}
|
|
|
|
} else if (bcolor == TYPE) {
|
2014-01-26 06:46:08 +08:00
|
|
|
itype = btype;
|
2012-06-07 06:47:51 +08:00
|
|
|
if (itype < 0) itype = -itype;
|
|
|
|
color = bcolortype[itype];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bdiam == NUMERIC) {
|
|
|
|
diameter = bdiamvalue;
|
|
|
|
} else if (bdiam == ATOM) {
|
|
|
|
if (adiam == NUMERIC) {
|
|
|
|
diameter = adiamvalue;
|
|
|
|
} else if (adiam == TYPE) {
|
|
|
|
diameter = MIN(diamtype[type[atom1]],diamtype[type[atom1]]);
|
|
|
|
} else if (adiam == ELEMENT) {
|
|
|
|
diameter = MIN(diamelement[type[atom1]],diamelement[type[atom1]]);
|
|
|
|
} else if (adiam == ATTRIBUTE) {
|
|
|
|
diameter = MIN(bufcopy[atom1][1],bufcopy[atom2][1]);
|
|
|
|
}
|
|
|
|
} else if (bdiam == TYPE) {
|
2014-01-26 06:46:08 +08:00
|
|
|
itype = btype;
|
2012-06-07 06:47:51 +08:00
|
|
|
if (itype < 0) itype = -itype;
|
|
|
|
diameter = bdiamtype[itype];
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw cylinder in 2 pieces if bcolor = ATOM
|
|
|
|
// or bond crosses periodic boundary
|
|
|
|
|
|
|
|
delx = x[atom2][0] - x[atom1][0];
|
|
|
|
dely = x[atom2][1] - x[atom1][1];
|
|
|
|
delz = x[atom2][2] - x[atom1][2];
|
|
|
|
|
|
|
|
if (bcolor == ATOM || domain->minimum_image_check(delx,dely,delz)) {
|
|
|
|
domain->minimum_image(delx,dely,delz);
|
|
|
|
xmid[0] = x[atom1][0] + 0.5*delx;
|
|
|
|
xmid[1] = x[atom1][1] + 0.5*dely;
|
|
|
|
xmid[2] = x[atom1][2] + 0.5*delz;
|
|
|
|
if (bcolor == ATOM)
|
|
|
|
image->draw_cylinder(x[atom1],xmid,color1,diameter,3);
|
|
|
|
else image->draw_cylinder(x[atom1],xmid,color,diameter,3);
|
|
|
|
xmid[0] = x[atom2][0] - 0.5*delx;
|
|
|
|
xmid[1] = x[atom2][1] - 0.5*dely;
|
|
|
|
xmid[2] = x[atom2][2] - 0.5*delz;
|
|
|
|
if (bcolor == ATOM)
|
|
|
|
image->draw_cylinder(xmid,x[atom2],color2,diameter,3);
|
|
|
|
else image->draw_cylinder(xmid,x[atom2],color,diameter,3);
|
|
|
|
|
|
|
|
} else image->draw_cylinder(x[atom1],x[atom2],color,diameter,3);
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-15 03:42:39 +08:00
|
|
|
// render objects provided by a fix
|
|
|
|
|
|
|
|
if (fixflag) {
|
2016-07-23 06:52:03 +08:00
|
|
|
int tridraw=0,edgedraw=0;
|
2016-07-15 03:42:39 +08:00
|
|
|
if (domain->dimension == 3) {
|
|
|
|
tridraw = 1;
|
|
|
|
edgedraw = 1;
|
|
|
|
if ((int) fixflag1 == 2) tridraw = 0;
|
|
|
|
if ((int) fixflag1 == 1) edgedraw = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
n = fixptr->image(fixvec,fixarray);
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
if (fixvec[i] == SPHERE) {
|
|
|
|
// no fix draws spheres yet
|
|
|
|
} else if (fixvec[i] == LINE) {
|
|
|
|
if (fixcolor == TYPE) {
|
|
|
|
itype = static_cast<int> (fixarray[i][0]);
|
|
|
|
color = colortype[itype];
|
|
|
|
}
|
|
|
|
image->draw_cylinder(&fixarray[i][1],&fixarray[i][4],
|
|
|
|
color,fixflag1,3);
|
|
|
|
} else if (fixvec[i] == TRI) {
|
|
|
|
if (fixcolor == TYPE) {
|
|
|
|
itype = static_cast<int> (fixarray[i][0]);
|
|
|
|
color = colortype[itype];
|
|
|
|
}
|
|
|
|
p1 = &fixarray[i][1];
|
|
|
|
p2 = &fixarray[i][4];
|
|
|
|
p3 = &fixarray[i][7];
|
|
|
|
if (tridraw) image->draw_triangle(p1,p2,p3,color);
|
|
|
|
if (edgedraw) {
|
|
|
|
image->draw_cylinder(p1,p2,color,fixflag2,3);
|
|
|
|
image->draw_cylinder(p2,p3,color,fixflag2,3);
|
|
|
|
image->draw_cylinder(p3,p1,color,fixflag2,3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-02 07:40:44 +08:00
|
|
|
// render outline of my sub-box, orthogonal or triclinic
|
|
|
|
|
|
|
|
if (subboxflag) {
|
|
|
|
double diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
|
|
|
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
2014-09-13 01:29:37 +08:00
|
|
|
diameter *= subboxdiam;
|
2014-08-02 07:40:44 +08:00
|
|
|
|
|
|
|
double *sublo = domain->sublo;
|
|
|
|
double *subhi = domain->subhi;
|
|
|
|
|
|
|
|
double (*boxcorners)[3];
|
|
|
|
double box[8][3];
|
|
|
|
if (domain->triclinic == 0) {
|
|
|
|
box[0][0] = sublo[0]; box[0][1] = sublo[1]; box[0][2] = sublo[2];
|
|
|
|
box[1][0] = subhi[0]; box[1][1] = sublo[1]; box[1][2] = sublo[2];
|
|
|
|
box[2][0] = sublo[0]; box[2][1] = subhi[1]; box[2][2] = sublo[2];
|
|
|
|
box[3][0] = subhi[0]; box[3][1] = subhi[1]; box[3][2] = sublo[2];
|
|
|
|
box[4][0] = sublo[0]; box[4][1] = sublo[1]; box[4][2] = subhi[2];
|
|
|
|
box[5][0] = subhi[0]; box[5][1] = sublo[1]; box[5][2] = subhi[2];
|
|
|
|
box[6][0] = sublo[0]; box[6][1] = subhi[1]; box[6][2] = subhi[2];
|
|
|
|
box[7][0] = subhi[0]; box[7][1] = subhi[1]; box[7][2] = subhi[2];
|
|
|
|
boxcorners = box;
|
|
|
|
} else {
|
|
|
|
domain->subbox_corners();
|
|
|
|
boxcorners = domain->corners;
|
|
|
|
}
|
|
|
|
|
2014-09-13 01:29:37 +08:00
|
|
|
image->draw_box(boxcorners,diameter);
|
2014-08-02 07:40:44 +08:00
|
|
|
}
|
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
// render outline of simulation box, orthogonal or triclinic
|
|
|
|
|
|
|
|
if (boxflag) {
|
|
|
|
double diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
|
|
|
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
|
|
|
diameter *= boxdiam;
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
double (*boxcorners)[3];
|
|
|
|
double box[8][3];
|
2011-06-09 06:00:31 +08:00
|
|
|
if (domain->triclinic == 0) {
|
2011-12-23 05:47:52 +08:00
|
|
|
box[0][0] = boxxlo; box[0][1] = boxylo; box[0][2] = boxzlo;
|
|
|
|
box[1][0] = boxxhi; box[1][1] = boxylo; box[1][2] = boxzlo;
|
|
|
|
box[2][0] = boxxlo; box[2][1] = boxyhi; box[2][2] = boxzlo;
|
|
|
|
box[3][0] = boxxhi; box[3][1] = boxyhi; box[3][2] = boxzlo;
|
|
|
|
box[4][0] = boxxlo; box[4][1] = boxylo; box[4][2] = boxzhi;
|
|
|
|
box[5][0] = boxxhi; box[5][1] = boxylo; box[5][2] = boxzhi;
|
|
|
|
box[6][0] = boxxlo; box[6][1] = boxyhi; box[6][2] = boxzhi;
|
|
|
|
box[7][0] = boxxhi; box[7][1] = boxyhi; box[7][2] = boxzhi;
|
|
|
|
boxcorners = box;
|
2011-06-09 06:00:31 +08:00
|
|
|
} else {
|
|
|
|
domain->box_corners();
|
2011-12-23 05:47:52 +08:00
|
|
|
boxcorners = domain->corners;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
image->draw_box(boxcorners,diameter);
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// render XYZ axes in red/green/blue
|
|
|
|
// offset by 10% of box size and scale by axeslen
|
|
|
|
|
|
|
|
if (axesflag) {
|
|
|
|
double diameter = MIN(boxxhi-boxxlo,boxyhi-boxylo);
|
|
|
|
if (domain->dimension == 3) diameter = MIN(diameter,boxzhi-boxzlo);
|
|
|
|
diameter *= axesdiam;
|
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
double (*boxcorners)[3];
|
|
|
|
double axes[4][3];
|
2011-06-09 06:00:31 +08:00
|
|
|
if (domain->triclinic == 0) {
|
2011-12-23 05:47:52 +08:00
|
|
|
axes[0][0] = boxxlo; axes[0][1] = boxylo; axes[0][2] = boxzlo;
|
|
|
|
axes[1][0] = boxxhi; axes[1][1] = boxylo; axes[1][2] = boxzlo;
|
|
|
|
axes[2][0] = boxxlo; axes[2][1] = boxyhi; axes[2][2] = boxzlo;
|
2012-01-04 05:57:21 +08:00
|
|
|
axes[3][0] = boxxlo; axes[3][1] = boxylo; axes[3][2] = boxzhi;
|
2011-06-09 06:00:31 +08:00
|
|
|
} else {
|
|
|
|
domain->box_corners();
|
2011-12-23 05:47:52 +08:00
|
|
|
boxcorners = domain->corners;
|
2012-06-07 06:47:51 +08:00
|
|
|
axes[0][0] = boxcorners[0][0];
|
|
|
|
axes[0][1] = boxcorners[0][1];
|
2011-12-23 05:47:52 +08:00
|
|
|
axes[0][2] = boxcorners[0][2];
|
2012-06-07 06:47:51 +08:00
|
|
|
axes[1][0] = boxcorners[1][0];
|
|
|
|
axes[1][1] = boxcorners[1][1];
|
2011-12-23 05:47:52 +08:00
|
|
|
axes[1][2] = boxcorners[1][2];
|
2012-06-07 06:47:51 +08:00
|
|
|
axes[2][0] = boxcorners[2][0];
|
|
|
|
axes[2][1] = boxcorners[2][1];
|
2011-12-23 05:47:52 +08:00
|
|
|
axes[2][2] = boxcorners[2][2];
|
2012-06-07 06:47:51 +08:00
|
|
|
axes[3][0] = boxcorners[4][0];
|
|
|
|
axes[3][1] = boxcorners[4][1];
|
2012-01-04 05:57:21 +08:00
|
|
|
axes[3][2] = boxcorners[4][2];
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
double offset = MAX(boxxhi-boxxlo,boxyhi-boxylo);
|
|
|
|
if (domain->dimension == 3) offset = MAX(offset,boxzhi-boxzlo);
|
|
|
|
offset *= 0.1;
|
2011-12-23 05:47:52 +08:00
|
|
|
axes[0][0] -= offset; axes[0][1] -= offset; axes[0][2] -= offset;
|
|
|
|
axes[1][0] -= offset; axes[1][1] -= offset; axes[1][2] -= offset;
|
|
|
|
axes[2][0] -= offset; axes[2][1] -= offset; axes[2][2] -= offset;
|
2012-01-04 05:57:21 +08:00
|
|
|
axes[3][0] -= offset; axes[3][1] -= offset; axes[3][2] -= offset;
|
2011-12-23 05:47:52 +08:00
|
|
|
|
|
|
|
axes[1][0] = axes[0][0] + axeslen*(axes[1][0]-axes[0][0]);
|
|
|
|
axes[1][1] = axes[0][1] + axeslen*(axes[1][1]-axes[0][1]);
|
|
|
|
axes[1][2] = axes[0][2] + axeslen*(axes[1][2]-axes[0][2]);
|
|
|
|
axes[2][0] = axes[0][0] + axeslen*(axes[2][0]-axes[0][0]);
|
|
|
|
axes[2][1] = axes[0][1] + axeslen*(axes[2][1]-axes[0][1]);
|
|
|
|
axes[2][2] = axes[0][2] + axeslen*(axes[2][2]-axes[0][2]);
|
2012-01-04 05:57:21 +08:00
|
|
|
axes[3][0] = axes[0][0] + axeslen*(axes[3][0]-axes[0][0]);
|
|
|
|
axes[3][1] = axes[0][1] + axeslen*(axes[3][1]-axes[0][1]);
|
|
|
|
axes[3][2] = axes[0][2] + axeslen*(axes[3][2]-axes[0][2]);
|
2011-12-23 05:47:52 +08:00
|
|
|
|
|
|
|
image->draw_axes(axes,diameter);
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
2015-10-31 04:04:06 +08:00
|
|
|
int DumpImage::pack_forward_comm(int n, int *list, double *buf,
|
2014-08-07 00:23:15 +08:00
|
|
|
int pbc_flag, int *pbc)
|
2011-06-09 06:00:31 +08:00
|
|
|
{
|
|
|
|
int i,j,m;
|
|
|
|
|
|
|
|
m = 0;
|
|
|
|
|
|
|
|
if (comm_forward == 1) {
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
j = list[i];
|
2013-07-24 07:07:54 +08:00
|
|
|
buf[m++] = chooseghost[j];
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
j = list[i];
|
2013-07-24 07:07:54 +08:00
|
|
|
buf[m++] = chooseghost[j];
|
2011-06-09 06:00:31 +08:00
|
|
|
buf[m++] = bufcopy[j][0];
|
|
|
|
buf[m++] = bufcopy[j][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-07 00:23:15 +08:00
|
|
|
return m;
|
2011-06-09 06:00:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
2014-08-07 00:23:15 +08:00
|
|
|
void DumpImage::unpack_forward_comm(int n, int first, double *buf)
|
2011-06-09 06:00:31 +08:00
|
|
|
{
|
|
|
|
int i,m,last;
|
|
|
|
|
|
|
|
m = 0;
|
|
|
|
last = first + n;
|
|
|
|
|
|
|
|
if (comm_forward == 1)
|
2013-07-24 07:07:54 +08:00
|
|
|
for (i = first; i < last; i++) chooseghost[i] = static_cast<int> (buf[m++]);
|
2011-06-09 06:00:31 +08:00
|
|
|
else {
|
|
|
|
for (i = first; i < last; i++) {
|
2013-07-24 07:07:54 +08:00
|
|
|
chooseghost[i] = static_cast<int> (buf[m++]);
|
2011-06-09 06:00:31 +08:00
|
|
|
bufcopy[i][0] = buf[m++];
|
|
|
|
bufcopy[i][1] = buf[m++];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
int DumpImage::modify_param(int narg, char **arg)
|
|
|
|
{
|
|
|
|
int n = DumpCustom::modify_param(narg,arg);
|
|
|
|
if (n) return n;
|
|
|
|
|
|
|
|
if (strcmp(arg[0],"acolor") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
int nlo,nhi;
|
2016-10-27 03:53:02 +08:00
|
|
|
force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi);
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
// ptrs = list of ncount colornames separated by '/'
|
|
|
|
|
|
|
|
int ncount = 1;
|
|
|
|
char *nextptr;
|
|
|
|
char *ptr = arg[2];
|
2014-03-10 23:45:25 +08:00
|
|
|
while ((nextptr = strchr(ptr,'/'))) {
|
2011-06-09 06:00:31 +08:00
|
|
|
ptr = nextptr + 1;
|
|
|
|
ncount++;
|
|
|
|
}
|
|
|
|
char **ptrs = new char*[ncount+1];
|
|
|
|
ncount = 0;
|
|
|
|
ptrs[ncount++] = strtok(arg[2],"/");
|
2014-03-10 23:45:25 +08:00
|
|
|
while ((ptrs[ncount++] = strtok(NULL,"/")));
|
2011-06-09 06:00:31 +08:00
|
|
|
ncount--;
|
|
|
|
|
|
|
|
// assign each of ncount colors in round-robin fashion to types
|
|
|
|
|
|
|
|
int m = 0;
|
|
|
|
for (int i = nlo; i <= nhi; i++) {
|
2011-12-23 05:47:52 +08:00
|
|
|
colortype[i] = image->color2rgb(ptrs[m%ncount]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (colortype[i] == NULL)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Invalid color in dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
m++;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete [] ptrs;
|
|
|
|
return 3;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(arg[0],"adiam") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
int nlo,nhi;
|
2016-10-27 03:53:02 +08:00
|
|
|
force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi);
|
2013-06-29 03:00:58 +08:00
|
|
|
double diam = force->numeric(FLERR,arg[2]);
|
2011-09-24 02:06:55 +08:00
|
|
|
if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
for (int i = nlo; i <= nhi; i++) diamtype[i] = diam;
|
|
|
|
return 3;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[0],"amap") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 6) error->all(FLERR,"Illegal dump_modify command");
|
|
|
|
if (strlen(arg[3]) != 2) error->all(FLERR,"Illegal dump_modify command");
|
2015-04-02 22:06:11 +08:00
|
|
|
int factor;
|
2011-12-23 05:47:52 +08:00
|
|
|
if (arg[3][0] == 's') factor = 1;
|
2015-04-02 22:06:11 +08:00
|
|
|
else if (arg[3][0] == 'c') factor = 2;
|
|
|
|
else if (arg[3][0] == 'd') factor = 3;
|
|
|
|
else error->all(FLERR,"Illegal dump_modify command");
|
2013-06-29 03:00:58 +08:00
|
|
|
int nentry = force->inumeric(FLERR,arg[5]);
|
2011-12-23 05:47:52 +08:00
|
|
|
if (nentry < 1) error->all(FLERR,"Illegal dump_modify command");
|
|
|
|
int n = 6 + factor*nentry;
|
|
|
|
if (narg < n) error->all(FLERR,"Illegal dump_modify command");
|
2013-10-15 07:22:02 +08:00
|
|
|
int flag = image->map_reset(0,n-1,&arg[1]);
|
2011-12-23 05:47:52 +08:00
|
|
|
if (flag) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
return n;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[0],"bcolor") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (atom->nbondtypes == 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Dump modify bcolor not allowed with no bond types");
|
2011-06-09 06:00:31 +08:00
|
|
|
int nlo,nhi;
|
2016-10-27 03:53:02 +08:00
|
|
|
force->bounds(FLERR,arg[1],atom->nbondtypes,nlo,nhi);
|
2011-06-09 06:00:31 +08:00
|
|
|
|
|
|
|
// ptrs = list of ncount colornames separated by '/'
|
|
|
|
|
|
|
|
int ncount = 1;
|
|
|
|
char *nextptr;
|
|
|
|
char *ptr = arg[2];
|
2014-03-10 23:45:25 +08:00
|
|
|
while ((nextptr = strchr(ptr,'/'))) {
|
2011-06-09 06:00:31 +08:00
|
|
|
ptr = nextptr + 1;
|
|
|
|
ncount++;
|
|
|
|
}
|
|
|
|
char **ptrs = new char*[ncount+1];
|
|
|
|
ncount = 0;
|
|
|
|
ptrs[ncount++] = strtok(arg[2],"/");
|
2014-03-10 23:45:25 +08:00
|
|
|
while ((ptrs[ncount++] = strtok(NULL,"/")));
|
2011-06-09 06:00:31 +08:00
|
|
|
ncount--;
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
// assign each of ncount colors in round-robin fashion to types
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
int m = 0;
|
|
|
|
for (int i = nlo; i <= nhi; i++) {
|
2011-12-23 05:47:52 +08:00
|
|
|
bcolortype[i] = image->color2rgb(ptrs[m%ncount]);
|
2011-06-09 06:00:31 +08:00
|
|
|
if (bcolortype[i] == NULL)
|
2012-06-07 06:47:51 +08:00
|
|
|
error->all(FLERR,"Invalid color in dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
m++;
|
|
|
|
}
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-06-09 06:00:31 +08:00
|
|
|
delete [] ptrs;
|
|
|
|
return 3;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
2012-06-07 06:47:51 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[0],"bdiam") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 3) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
if (atom->nbondtypes == 0)
|
2011-09-24 02:06:55 +08:00
|
|
|
error->all(FLERR,"Dump modify bdiam not allowed with no bond types");
|
2011-06-09 06:00:31 +08:00
|
|
|
int nlo,nhi;
|
2016-10-27 03:53:02 +08:00
|
|
|
force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi);
|
2013-06-29 03:00:58 +08:00
|
|
|
double diam = force->numeric(FLERR,arg[2]);
|
2011-09-24 02:06:55 +08:00
|
|
|
if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam;
|
|
|
|
return 3;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[0],"backcolor") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
2011-12-23 05:47:52 +08:00
|
|
|
double *color = image->color2rgb(arg[1]);
|
2011-09-24 02:06:55 +08:00
|
|
|
if (color == NULL) error->all(FLERR,"Invalid color in dump_modify command");
|
2011-12-23 05:47:52 +08:00
|
|
|
image->background[0] = static_cast<int> (color[0]*255.0);
|
|
|
|
image->background[1] = static_cast<int> (color[1]*255.0);
|
|
|
|
image->background[2] = static_cast<int> (color[2]*255.0);
|
2011-06-09 06:00:31 +08:00
|
|
|
return 2;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[0],"boxcolor") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
|
2011-12-23 05:47:52 +08:00
|
|
|
image->boxcolor = image->color2rgb(arg[1]);
|
2012-06-07 06:47:51 +08:00
|
|
|
if (image->boxcolor == NULL)
|
2011-12-23 05:47:52 +08:00
|
|
|
error->all(FLERR,"Invalid color in dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
return 2;
|
2011-12-23 05:47:52 +08:00
|
|
|
}
|
2011-06-09 06:00:31 +08:00
|
|
|
|
2011-12-23 05:47:52 +08:00
|
|
|
if (strcmp(arg[0],"color") == 0) {
|
2011-09-24 02:06:55 +08:00
|
|
|
if (narg < 5) error->all(FLERR,"Illegal dump_modify command");
|
2013-06-29 03:00:58 +08:00
|
|
|
int flag = image->addcolor(arg[1],force->numeric(FLERR,arg[2]),force->numeric(FLERR,arg[3]),force->numeric(FLERR,arg[4]));
|
2011-12-23 05:47:52 +08:00
|
|
|
if (flag) error->all(FLERR,"Illegal dump_modify command");
|
2011-06-09 06:00:31 +08:00
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|