git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@595 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -11,6 +11,10 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing author (triclinic) : Pieter in 't Veld (SNL)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
@ -645,7 +649,7 @@ void Domain::unmap(double *x, int image)
|
|||||||
|
|
||||||
void Domain::set_lattice(int narg, char **arg)
|
void Domain::set_lattice(int narg, char **arg)
|
||||||
{
|
{
|
||||||
delete lattice;
|
if (lattice) delete lattice;
|
||||||
lattice = new Lattice(lmp,narg,arg);
|
lattice = new Lattice(lmp,narg,arg);
|
||||||
if (lattice->style == 0) {
|
if (lattice->style == 0) {
|
||||||
delete lattice;
|
delete lattice;
|
||||||
@ -661,11 +665,7 @@ void Domain::add_region(int narg, char **arg)
|
|||||||
{
|
{
|
||||||
if (narg < 2) error->all("Illegal region command");
|
if (narg < 2) error->all("Illegal region command");
|
||||||
|
|
||||||
// error checks
|
if (find_region(arg[0]) >= 0) error->all("Reuse of region ID");
|
||||||
|
|
||||||
for (int iregion = 0; iregion < nregion; iregion++)
|
|
||||||
if (strcmp(arg[0],regions[iregion]->id) == 0)
|
|
||||||
error->all("Reuse of region ID");
|
|
||||||
|
|
||||||
// extend Region list if necessary
|
// extend Region list if necessary
|
||||||
|
|
||||||
@ -691,6 +691,18 @@ void Domain::add_region(int narg, char **arg)
|
|||||||
nregion++;
|
nregion++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
return region index if name matches existing region ID
|
||||||
|
return -1 if no such region
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int Domain::find_region(char *name)
|
||||||
|
{
|
||||||
|
for (int iregion = 0; iregion < nregion; iregion++)
|
||||||
|
if (strcmp(name,regions[iregion]->id) == 0) return iregion;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
boundary settings from the input script
|
boundary settings from the input script
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -91,6 +91,7 @@ class Domain : protected Pointers {
|
|||||||
void minimum_image(double *);
|
void minimum_image(double *);
|
||||||
void set_lattice(int, char **);
|
void set_lattice(int, char **);
|
||||||
void add_region(int, char **);
|
void add_region(int, char **);
|
||||||
|
int find_region(char *);
|
||||||
void set_boundary(int, char **);
|
void set_boundary(int, char **);
|
||||||
void print_box(char *);
|
void print_box(char *);
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,9 @@ enum{NONE,SC,BCC,FCC,DIAMOND,SQ,SQ2,HEX,CUSTOM};
|
|||||||
|
|
||||||
Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||||
{
|
{
|
||||||
|
nbasis = 0;
|
||||||
|
basis = NULL;
|
||||||
|
|
||||||
// parse style arg
|
// parse style arg
|
||||||
|
|
||||||
if (narg < 1) error->all("Illegal lattice command");
|
if (narg < 1) error->all("Illegal lattice command");
|
||||||
@ -76,9 +79,6 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
// x,y,z = fractional coords within unit cell
|
// x,y,z = fractional coords within unit cell
|
||||||
// style CUSTOM will be defined by optional args
|
// style CUSTOM will be defined by optional args
|
||||||
|
|
||||||
nbasis = 0;
|
|
||||||
basis = NULL;
|
|
||||||
|
|
||||||
if (style == SC) {
|
if (style == SC) {
|
||||||
add_basis(0.0,0.0,0.0);
|
add_basis(0.0,0.0,0.0);
|
||||||
} else if (style == BCC) {
|
} else if (style == BCC) {
|
||||||
@ -158,9 +158,9 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
} else if (strcmp(arg[iarg],"spacings") == 0) {
|
} else if (strcmp(arg[iarg],"spacings") == 0) {
|
||||||
if (iarg+4 > narg) error->all("Illegal lattice command");
|
if (iarg+4 > narg) error->all("Illegal lattice command");
|
||||||
spaceflag = 1;
|
spaceflag = 1;
|
||||||
xlattice = atoi(arg[iarg+1]);
|
xlattice = atof(arg[iarg+1]);
|
||||||
ylattice = atoi(arg[iarg+2]);
|
ylattice = atof(arg[iarg+2]);
|
||||||
zlattice = atoi(arg[iarg+3]);
|
zlattice = atof(arg[iarg+3]);
|
||||||
iarg += 4;
|
iarg += 4;
|
||||||
|
|
||||||
} else if (strcmp(arg[iarg],"a1") == 0) {
|
} else if (strcmp(arg[iarg],"a1") == 0) {
|
||||||
|
|||||||
@ -22,9 +22,11 @@ class Lattice : protected Pointers {
|
|||||||
public:
|
public:
|
||||||
int style; // enum list of NONE,SC,FCC,etc
|
int style; // enum list of NONE,SC,FCC,etc
|
||||||
double xlattice,ylattice,zlattice; // lattice scale factors in 3 dims
|
double xlattice,ylattice,zlattice; // lattice scale factors in 3 dims
|
||||||
|
double a1[3],a2[3],a3[3]; // vectors that bound unit cell
|
||||||
int nbasis; // # of atoms in basis of unit cell
|
int nbasis; // # of atoms in basis of unit cell
|
||||||
double **basis; // fractional coords of each basis atom
|
double **basis; // fractional coords of each basis atom
|
||||||
// within unit cell (0 <= coord < 1)
|
// within unit cell (0 <= coord < 1)
|
||||||
|
|
||||||
Lattice(class LAMMPS *, int, char **);
|
Lattice(class LAMMPS *, int, char **);
|
||||||
~Lattice();
|
~Lattice();
|
||||||
void lattice2box(double &, double &, double &);
|
void lattice2box(double &, double &, double &);
|
||||||
@ -38,7 +40,6 @@ private:
|
|||||||
int orientx[3]; // lattice orientation vecs
|
int orientx[3]; // lattice orientation vecs
|
||||||
int orienty[3]; // orientx = what lattice dir lies
|
int orienty[3]; // orientx = what lattice dir lies
|
||||||
int orientz[3]; // along x dim in box
|
int orientz[3]; // along x dim in box
|
||||||
double a1[3],a2[3],a3[3]; // vectors that bound unit cell
|
|
||||||
|
|
||||||
double primitive[3][3]; // lattice <-> box transform matrices
|
double primitive[3][3]; // lattice <-> box transform matrices
|
||||||
double priminv[3][3];
|
double priminv[3][3];
|
||||||
|
|||||||
Reference in New Issue
Block a user