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

This commit is contained in:
sjplimp
2011-05-20 15:44:23 +00:00
parent f4d2ebfb54
commit 93115ad750
2 changed files with 31 additions and 9 deletions

View File

@ -117,32 +117,54 @@ void Force::init()
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;
if (pair) delete pair;
pair = new_pair(style);
pair = new_pair(style,suffix);
int n = strlen(style) + 1;
pair_style = new char[n];
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 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"
#undef PAIR_CLASS
else error->all("Invalid pair style");
else error->all("Invalid pair style");
}
return NULL;
}