add labelmap command
This commit is contained in:
@ -29,6 +29,7 @@
|
|||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "improper.h"
|
#include "improper.h"
|
||||||
#include "kspace.h"
|
#include "kspace.h"
|
||||||
|
#include "label_map.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "min.h"
|
#include "min.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
@ -738,6 +739,7 @@ int Input::execute_command()
|
|||||||
else if (!strcmp(command,"improper_style")) improper_style();
|
else if (!strcmp(command,"improper_style")) improper_style();
|
||||||
else if (!strcmp(command,"kspace_modify")) kspace_modify();
|
else if (!strcmp(command,"kspace_modify")) kspace_modify();
|
||||||
else if (!strcmp(command,"kspace_style")) kspace_style();
|
else if (!strcmp(command,"kspace_style")) kspace_style();
|
||||||
|
else if (!strcmp(command,"labelmap")) labelmap();
|
||||||
else if (!strcmp(command,"lattice")) lattice();
|
else if (!strcmp(command,"lattice")) lattice();
|
||||||
else if (!strcmp(command,"mass")) mass();
|
else if (!strcmp(command,"mass")) mass();
|
||||||
else if (!strcmp(command,"min_modify")) min_modify();
|
else if (!strcmp(command,"min_modify")) min_modify();
|
||||||
@ -1552,6 +1554,14 @@ void Input::kspace_style()
|
|||||||
force->create_kspace(arg[0],1);
|
force->create_kspace(arg[0],1);
|
||||||
if (force->kspace) force->kspace->settings(narg-1,&arg[1]);
|
if (force->kspace) force->kspace->settings(narg-1,&arg[1]);
|
||||||
}
|
}
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Input::labelmap()
|
||||||
|
{
|
||||||
|
if (domain->box_exist == 0)
|
||||||
|
error->all(FLERR,"Labelmap command before simulation box is defined");
|
||||||
|
atom->lmap->modify_lmap(narg,arg);
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,7 @@ class Input : protected Pointers {
|
|||||||
void improper_style();
|
void improper_style();
|
||||||
void kspace_modify();
|
void kspace_modify();
|
||||||
void kspace_style();
|
void kspace_style();
|
||||||
|
void labelmap();
|
||||||
void lattice();
|
void lattice();
|
||||||
void mass();
|
void mass();
|
||||||
void min_modify();
|
void min_modify();
|
||||||
|
|||||||
@ -80,6 +80,42 @@ void LabelMap::allocate_type_labels()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
labelmap command in input script
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void LabelMap::modify_lmap(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (narg < 3 || narg % 2 == 0) error->all(FLERR,"Illegal labelmap command");
|
||||||
|
|
||||||
|
int ntypes;
|
||||||
|
std::vector<std::string> *labels;
|
||||||
|
if (!strcmp(arg[0],"atom")) {
|
||||||
|
ntypes = natomtypes;
|
||||||
|
labels = &typelabel;
|
||||||
|
} else if (!strcmp(arg[0],"bond")) {
|
||||||
|
ntypes = nbondtypes;
|
||||||
|
labels = &btypelabel;
|
||||||
|
} else if (!strcmp(arg[0],"angle")) {
|
||||||
|
ntypes = nangletypes;
|
||||||
|
labels = &atypelabel;
|
||||||
|
} else if (!strcmp(arg[0],"dihedral")) {
|
||||||
|
ntypes = ndihedraltypes;
|
||||||
|
labels = &dtypelabel;
|
||||||
|
} else if (!strcmp(arg[0],"improper")) {
|
||||||
|
ntypes = nimpropertypes;
|
||||||
|
labels = &itypelabel;
|
||||||
|
} else error->all(FLERR,"Illegal labelmap command");
|
||||||
|
|
||||||
|
int itype;
|
||||||
|
int iarg = 1;
|
||||||
|
while (iarg < narg) {
|
||||||
|
itype = utils::inumeric(FLERR,arg[iarg++],false,lmp);
|
||||||
|
if (itype > ntypes) error->all(FLERR,"Topology type exceeds system topology type");
|
||||||
|
(*labels)[itype-1] = arg[iarg++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
copy another map (lmap2) into this one
|
copy another map (lmap2) into this one
|
||||||
if label already exists, leave in place
|
if label already exists, leave in place
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class LabelMap : protected Pointers {
|
|||||||
~LabelMap();
|
~LabelMap();
|
||||||
|
|
||||||
void allocate_type_labels();
|
void allocate_type_labels();
|
||||||
|
void modify_lmap(int, char **);
|
||||||
void merge_lmap(class LabelMap *, int); // copy another lmap into this one
|
void merge_lmap(class LabelMap *, int); // copy another lmap into this one
|
||||||
void create_lmap2lmap(class LabelMap *, int); // index mapping between two lmaps
|
void create_lmap2lmap(class LabelMap *, int); // index mapping between two lmaps
|
||||||
int find_or_create(std::string, std::vector<std::string> &, int); // look up type or create new type
|
int find_or_create(std::string, std::vector<std::string> &, int); // look up type or create new type
|
||||||
|
|||||||
@ -1971,7 +1971,6 @@ void ReadData::impropercoeffs(int which)
|
|||||||
void ReadData::typelabels(std::vector<std::string> &mytypelabel, int myntypes, int mode)
|
void ReadData::typelabels(std::vector<std::string> &mytypelabel, int myntypes, int mode)
|
||||||
{
|
{
|
||||||
if (settypeflag) error->all(FLERR,"Must read Type Labels before any section involving types");
|
if (settypeflag) error->all(FLERR,"Must read Type Labels before any section involving types");
|
||||||
int n;
|
|
||||||
char *next;
|
char *next;
|
||||||
char *buf = new char[myntypes*MAXLINE];
|
char *buf = new char[myntypes*MAXLINE];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user