better error checking
This commit is contained in:
@ -99,6 +99,7 @@ void Group::assign(int narg, char **arg)
|
|||||||
// clear mask of each atom assigned to this group
|
// clear mask of each atom assigned to this group
|
||||||
|
|
||||||
if (strcmp(arg[1],"delete") == 0) {
|
if (strcmp(arg[1],"delete") == 0) {
|
||||||
|
if (narg != 2) error->all(FLERR,"Illegal group command");
|
||||||
int igroup = find(arg[0]);
|
int igroup = find(arg[0]);
|
||||||
if (igroup == -1) error->all(FLERR,"Could not find group delete group ID");
|
if (igroup == -1) error->all(FLERR,"Could not find group delete group ID");
|
||||||
if (igroup == 0) error->all(FLERR,"Cannot delete group all");
|
if (igroup == 0) error->all(FLERR,"Cannot delete group all");
|
||||||
@ -183,7 +184,8 @@ void Group::assign(int narg, char **arg)
|
|||||||
|
|
||||||
} else if (strcmp(arg[1],"empty") == 0) {
|
} else if (strcmp(arg[1],"empty") == 0) {
|
||||||
|
|
||||||
; // nothing to do here
|
if (narg != 2) error->all(FLERR,"Illegal group command");
|
||||||
|
// nothing else to do here
|
||||||
|
|
||||||
// style = type, molecule, id
|
// style = type, molecule, id
|
||||||
// add to group if atom matches type/molecule/id or condition
|
// add to group if atom matches type/molecule/id or condition
|
||||||
@ -546,7 +548,7 @@ void Group::assign(const std::string &groupcmd)
|
|||||||
add flagged atoms to a new or existing group
|
add flagged atoms to a new or existing group
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Group::create(char *name, int *flag)
|
void Group::create(const char *name, int *flag)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class Group : protected Pointers {
|
|||||||
~Group();
|
~Group();
|
||||||
void assign(int, char **); // assign atoms to a group
|
void assign(int, char **); // assign atoms to a group
|
||||||
void assign(const std::string &); // convenience function
|
void assign(const std::string &); // convenience function
|
||||||
void create(char *, int *); // add flagged atoms to a group
|
void create(const char *, int *); // add flagged atoms to a group
|
||||||
int find(const std::string &); // lookup name in list of groups
|
int find(const std::string &); // lookup name in list of groups
|
||||||
int find_or_create(const char *); // lookup name or create new group
|
int find_or_create(const char *); // lookup name or create new group
|
||||||
void write_restart(FILE *);
|
void write_restart(FILE *);
|
||||||
|
|||||||
Reference in New Issue
Block a user