mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6186 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
ab5508e3c8
commit
717139ef0f
36
src/atom.cpp
36
src/atom.cpp
|
@ -261,10 +261,20 @@ void Atom::create_avec(const char *style, int narg, char **arg, char *suffix)
|
||||||
rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0;
|
rmass_flag = radius_flag = omega_flag = torque_flag = angmom_flag = 0;
|
||||||
vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
|
vfrac_flag = spin_flag = eradius_flag = ervel_flag = erforce_flag = 0;
|
||||||
|
|
||||||
avec = new_avec(style,narg,arg,suffix);
|
int sflag;
|
||||||
int n = strlen(style) + 1;
|
avec = new_avec(style,narg,arg,suffix,sflag);
|
||||||
atom_style = new char[n];
|
|
||||||
strcpy(atom_style,style);
|
if (sflag) {
|
||||||
|
char estyle[256];
|
||||||
|
sprintf(estyle,"%s/%s",style,suffix);
|
||||||
|
int n = strlen(estyle) + 1;
|
||||||
|
atom_style = new char[n];
|
||||||
|
strcpy(atom_style,estyle);
|
||||||
|
} else {
|
||||||
|
int n = strlen(style) + 1;
|
||||||
|
atom_style = new char[n];
|
||||||
|
strcpy(atom_style,style);
|
||||||
|
}
|
||||||
|
|
||||||
// if molecular system, default is to have array map
|
// if molecular system, default is to have array map
|
||||||
|
|
||||||
|
@ -276,14 +286,13 @@ void Atom::create_avec(const char *style, int narg, char **arg, char *suffix)
|
||||||
generate an AtomVec class, first with suffix appended
|
generate an AtomVec class, first with suffix appended
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
AtomVec *Atom::new_avec(const char *style, int narg, char **arg, char *suffix)
|
AtomVec *Atom::new_avec(const char *style, int narg, char **arg,
|
||||||
|
char *suffix, int &sflag)
|
||||||
{
|
{
|
||||||
int success = 0;
|
|
||||||
|
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
|
sflag = 1;
|
||||||
char estyle[256];
|
char estyle[256];
|
||||||
sprintf(estyle,"%s/%s",style,suffix);
|
sprintf(estyle,"%s/%s",style,suffix);
|
||||||
success = 1;
|
|
||||||
|
|
||||||
if (0) return NULL;
|
if (0) return NULL;
|
||||||
|
|
||||||
|
@ -294,20 +303,19 @@ AtomVec *Atom::new_avec(const char *style, int narg, char **arg, char *suffix)
|
||||||
#undef AtomStyle
|
#undef AtomStyle
|
||||||
#undef ATOM_CLASS
|
#undef ATOM_CLASS
|
||||||
|
|
||||||
else success = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
sflag = 0;
|
||||||
if (0) return NULL;
|
|
||||||
|
if (0) return NULL;
|
||||||
|
|
||||||
#define ATOM_CLASS
|
#define ATOM_CLASS
|
||||||
#define AtomStyle(key,Class) \
|
#define AtomStyle(key,Class) \
|
||||||
else if (strcmp(style,#key) == 0) return new Class(lmp,narg,arg);
|
else if (strcmp(style,#key) == 0) return new Class(lmp,narg,arg);
|
||||||
#include "style_atom.h"
|
#include "style_atom.h"
|
||||||
#undef ATOM_CLASS
|
#undef ATOM_CLASS
|
||||||
|
|
||||||
else error->all("Invalid atom style");
|
else error->all("Invalid atom style");
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ class Atom : protected Pointers {
|
||||||
|
|
||||||
void settings(class Atom *);
|
void settings(class Atom *);
|
||||||
void create_avec(const char *, int, char **, char *suffix = NULL);
|
void create_avec(const char *, int, char **, char *suffix = NULL);
|
||||||
class AtomVec *new_avec(const char *, int, char **, char *suffix = NULL);
|
class AtomVec *new_avec(const char *, int, char **, char *, int &);
|
||||||
void init();
|
void init();
|
||||||
void setup();
|
void setup();
|
||||||
|
|
||||||
|
|
|
@ -122,24 +122,32 @@ 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,suffix);
|
int sflag;
|
||||||
int n = strlen(style) + 1;
|
pair = new_pair(style,suffix,sflag);
|
||||||
pair_style = new char[n];
|
|
||||||
strcpy(pair_style,style);
|
if (sflag) {
|
||||||
|
char estyle[256];
|
||||||
|
sprintf(estyle,"%s/%s",style,suffix);
|
||||||
|
int n = strlen(estyle) + 1;
|
||||||
|
pair_style = new char[n];
|
||||||
|
strcpy(pair_style,estyle);
|
||||||
|
} else {
|
||||||
|
int n = strlen(style) + 1;
|
||||||
|
pair_style = new char[n];
|
||||||
|
strcpy(pair_style,style);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
generate a pair class, first with suffix appended
|
generate a pair class, first with suffix appended
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
Pair *Force::new_pair(const char *style, char *suffix)
|
Pair *Force::new_pair(const char *style, char *suffix, int &sflag)
|
||||||
{
|
{
|
||||||
int success = 0;
|
|
||||||
|
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
|
sflag = 1;
|
||||||
char estyle[256];
|
char estyle[256];
|
||||||
sprintf(estyle,"%s/%s",style,suffix);
|
sprintf(estyle,"%s/%s",style,suffix);
|
||||||
success = 1;
|
|
||||||
|
|
||||||
if (0) return NULL;
|
if (0) return NULL;
|
||||||
|
|
||||||
|
@ -150,20 +158,19 @@ Pair *Force::new_pair(const char *style, char *suffix)
|
||||||
#undef PairStyle
|
#undef PairStyle
|
||||||
#undef PAIR_CLASS
|
#undef PAIR_CLASS
|
||||||
|
|
||||||
else success = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
sflag = 0;
|
||||||
if (strcmp(style,"none") == 0) return NULL;
|
|
||||||
|
if (strcmp(style,"none") == 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(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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class Force : protected Pointers {
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void create_pair(const char *, char *suffix = NULL);
|
void create_pair(const char *, char *suffix = NULL);
|
||||||
class Pair *new_pair(const char *, char *suffix = NULL);
|
class Pair *new_pair(const char *, char *, int &);
|
||||||
class Pair *pair_match(const char *, int);
|
class Pair *pair_match(const char *, int);
|
||||||
|
|
||||||
void create_bond(const char *);
|
void create_bond(const char *);
|
||||||
|
|
Loading…
Reference in New Issue