git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6154 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -117,32 +117,54 @@ void Force::init()
|
|||||||
create a pair style, called from input script or restart file
|
create a pair style, called from input script or restart file
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Force::create_pair(const char *style)
|
void Force::create_pair(const char *style, char *suffix)
|
||||||
{
|
{
|
||||||
delete [] pair_style;
|
delete [] pair_style;
|
||||||
if (pair) delete pair;
|
if (pair) delete pair;
|
||||||
|
|
||||||
pair = new_pair(style);
|
pair = new_pair(style,suffix);
|
||||||
int n = strlen(style) + 1;
|
int n = strlen(style) + 1;
|
||||||
pair_style = new char[n];
|
pair_style = new char[n];
|
||||||
strcpy(pair_style,style);
|
strcpy(pair_style,style);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
generate a pair class
|
generate a pair class, first with suffix appended
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
Pair *Force::new_pair(const char *style)
|
Pair *Force::new_pair(const char *style, char *suffix)
|
||||||
{
|
{
|
||||||
if (strcmp(style,"none") == 0) return NULL;
|
int success = 0;
|
||||||
|
|
||||||
|
if (suffix) {
|
||||||
|
char estyle[256];
|
||||||
|
sprintf(estyle,"%s/%s",style,suffix);
|
||||||
|
success = 1;
|
||||||
|
|
||||||
|
if (0) return NULL;
|
||||||
|
|
||||||
#define PAIR_CLASS
|
#define PAIR_CLASS
|
||||||
#define PairStyle(key,Class) \
|
#define PairStyle(key,Class) \
|
||||||
else if (strcmp(style,#key) == 0) return new Class(lmp);
|
else if (strcmp(estyle,#key) == 0) return new Class(lmp);
|
||||||
|
#include "style_pair.h"
|
||||||
|
#undef PairStyle
|
||||||
|
#undef PAIR_CLASS
|
||||||
|
|
||||||
|
else success = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
if (strcmp(style,"none") == 0) return NULL;
|
||||||
|
|
||||||
|
#define PAIR_CLASS
|
||||||
|
#define PairStyle(key,Class) \
|
||||||
|
else if (strcmp(style,#key) == 0) return new Class(lmp);
|
||||||
#include "style_pair.h"
|
#include "style_pair.h"
|
||||||
#undef PAIR_CLASS
|
#undef PAIR_CLASS
|
||||||
|
|
||||||
else error->all("Invalid pair style");
|
else error->all("Invalid pair style");
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,8 +64,8 @@ class Force : protected Pointers {
|
|||||||
~Force();
|
~Force();
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void create_pair(const char *);
|
void create_pair(const char *, char *suffix = NULL);
|
||||||
class Pair *new_pair(const char *);
|
class Pair *new_pair(const char *, char *suffix = NULL);
|
||||||
class Pair *pair_match(const char *, int);
|
class Pair *pair_match(const char *, int);
|
||||||
|
|
||||||
void create_bond(const char *);
|
void create_bond(const char *);
|
||||||
|
|||||||
Reference in New Issue
Block a user