git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11124 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2013-12-17 15:30:08 +00:00
parent 916e1a7e5b
commit 16dde18ab2
5 changed files with 74 additions and 3 deletions

View File

@ -35,7 +35,8 @@ class Atom : protected Pointers {
bigint nbonds,nangles,ndihedrals,nimpropers;
int ntypes,nbondtypes,nangletypes,ndihedraltypes,nimpropertypes;
int bond_per_atom,angle_per_atom,dihedral_per_atom,improper_per_atom;
int extra_bond_per_atom;
int extra_bond_per_atom,extra_angle_per_atom;
int extra_dihedral_per_atom,extra_improper_per_atom;
int firstgroup; // store atoms in this group first, -1 if unset
int nfirst; // # of atoms in first group on this proc

View File

@ -15,10 +15,12 @@
#include "string.h"
#include "create_box.h"
#include "atom.h"
#include "atom_vec.h"
#include "force.h"
#include "domain.h"
#include "region.h"
#include "region_prism.h"
#include "force.h"
#include "comm.h"
#include "update.h"
#include "error.h"
@ -33,7 +35,7 @@ CreateBox::CreateBox(LAMMPS *lmp) : Pointers(lmp) {}
void CreateBox::command(int narg, char **arg)
{
if (narg != 2) error->all(FLERR,"Illegal create_box command");
if (narg < 2) error->all(FLERR,"Illegal create_box command");
if (domain->box_exist)
error->all(FLERR,"Cannot create_box after simulation box is defined");
@ -102,6 +104,61 @@ void CreateBox::command(int narg, char **arg)
atom->ndihedraltypes = 0;
atom->nimpropertypes = 0;
// process optional args that can overwrite default settings
int iarg = 2;
while (iarg < narg) {
if (strcmp(arg[iarg],"bond types") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->bonds_allow)
error->all(FLERR,"No bonds allowed with this atom style");
atom->nbondtypes = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"angle types") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->angles_allow)
error->all(FLERR,"No angles allowed with this atom style");
atom->nangletypes = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"dihedral types") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->dihedrals_allow)
error->all(FLERR,"No dihedrals allowed with this atom style");
atom->ndihedraltypes = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"improper types") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->impropers_allow)
error->all(FLERR,"No impropers allowed with this atom style");
atom->nimpropertypes = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"extra bond per atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->bonds_allow)
error->all(FLERR,"No bonds allowed with this atom style");
atom->bond_per_atom = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"extra angle per atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->angles_allow)
error->all(FLERR,"No angles allowed with this atom style");
atom->angle_per_atom = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"extra dihedral per atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->dihedrals_allow)
error->all(FLERR,"No dihedrals allowed with this atom style");
atom->dihedral_per_atom = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else if (strcmp(arg[iarg],"extra improper per atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command");
if (!atom->avec->impropers_allow)
error->all(FLERR,"No impropers allowed with this atom style");
atom->improper_per_atom = force->inumeric(FLERR,arg[iarg+1]);
iarg += 2;
} else error->all(FLERR,"Illegal create_box command");
}
// problem setup using info from header
// no call to atom->grow since create_atoms or fixes will do it

View File

@ -52,7 +52,7 @@ void DumpMovie::openfile()
sprintf(moviecmd,"ffmpeg -v error -y -r %.2f -f image2pipe -c:v ppm -i - "
"-r 24.0 -b:v %dk %s ", framerate, bitrate, filename);
#else
error->one(FLERR,"Cannot generate movie file");
error->one(FLERR,"Support for writing movies not included");
#endif
#if defined(_WIN32)

View File

@ -331,6 +331,10 @@ void Molecule::types(char *line)
readline(line);
sscanf(line,"%d %d",&tmp,&type[i]);
}
for (int i = 0; i < natoms; i++)
if (type[i] <= 0 || type[i] > atom->ntypes)
error->all(FLERR,"Invalid atom type in molecule file");
}
/* ----------------------------------------------------------------------

View File

@ -151,6 +151,9 @@ void ReadData::command(int narg, char **arg)
if (compressed) pclose(fp);
else fclose(fp);
atom->bond_per_atom += atom->extra_bond_per_atom;
atom->angle_per_atom += atom->extra_angle_per_atom;
atom->dihedral_per_atom += atom->extra_dihedral_per_atom;
atom->improper_per_atom += atom->extra_improper_per_atom;
}
MPI_Bcast(&atom->bond_per_atom,1,MPI_INT,0,world);
@ -499,6 +502,12 @@ void ReadData::header(int flag)
else if (strstr(line,"extra bond per atom"))
sscanf(line,"%d",&atom->extra_bond_per_atom);
else if (strstr(line,"extra angle per atom"))
sscanf(line,"%d",&atom->extra_angle_per_atom);
else if (strstr(line,"extra dihedral per atom"))
sscanf(line,"%d",&atom->extra_dihedral_per_atom);
else if (strstr(line,"extra improper per atom"))
sscanf(line,"%d",&atom->extra_improper_per_atom);
else if (strstr(line,"xlo xhi"))
sscanf(line,"%lg %lg",&domain->boxlo[0],&domain->boxhi[0]);