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

This commit is contained in:
sjplimp 2011-05-20 15:40:22 +00:00
parent 3145254774
commit f4d2ebfb54
2 changed files with 60 additions and 15 deletions

View File

@ -591,7 +591,7 @@ int Modify::min_reset_ref()
add a new fix or replace one with same ID
------------------------------------------------------------------------- */
void Modify::add_fix(int narg, char **arg)
void Modify::add_fix(int narg, char **arg, char *suffix)
{
if (domain->box_exist == 0)
error->all("Fix command before simulation box is defined");
@ -636,17 +636,39 @@ void Modify::add_fix(int narg, char **arg)
}
}
// create the Fix
// create the Fix, first with suffix appended
if (0) return; // dummy line to enable else-if macro expansion
int success = 0;
if (suffix) {
char estyle[256];
sprintf(estyle,"%s/%s",arg[2],suffix);
success = 1;
if (0) return;
#define FIX_CLASS
#define FixStyle(key,Class) \
else if (strcmp(arg[2],#key) == 0) fix[ifix] = new Class(lmp,narg,arg);
else if (strcmp(estyle,#key) == 0) fix[ifix] = new Class(lmp,narg,arg);
#include "style_fix.h"
#undef FixStyle
#undef FIX_CLASS
else error->all("Invalid fix style");
else success = 0;
}
if (!success) {
if (0) return;
#define FIX_CLASS
#define FixStyle(key,Class) \
else if (strcmp(arg[2],#key) == 0) fix[ifix] = new Class(lmp,narg,arg);
#include "style_fix.h"
#undef FixStyle
#undef FIX_CLASS
else error->all("Invalid fix style");
}
// set fix mask values and increment nfix (if new)
@ -740,7 +762,7 @@ int Modify::find_fix(const char *id)
add a new compute
------------------------------------------------------------------------- */
void Modify::add_compute(int narg, char **arg)
void Modify::add_compute(int narg, char **arg, char *suffix)
{
if (narg < 3) error->all("Illegal compute command");
@ -758,18 +780,41 @@ void Modify::add_compute(int narg, char **arg)
memory->srealloc(compute,maxcompute*sizeof(Compute *),"modify:compute");
}
// create the Compute
// create the Compute, first with suffix appended
if (0) return; // dummy line to enable else-if macro expansion
int success = 0;
if (suffix) {
char estyle[256];
sprintf(estyle,"%s/%s",arg[2],suffix);
success = 1;
if (0) return;
#define COMPUTE_CLASS
#define ComputeStyle(key,Class) \
else if (strcmp(arg[2],#key) == 0) \
compute[ncompute] = new Class(lmp,narg,arg);
else if (strcmp(estyle,#key) == 0) \
compute[ncompute] = new Class(lmp,narg,arg);
#include "style_compute.h"
#undef ComputeStyle
#undef COMPUTE_CLASS
else error->all("Invalid compute style");
else success = 0;
}
if (!success) {
if (0) return;
#define COMPUTE_CLASS
#define ComputeStyle(key,Class) \
else if (strcmp(arg[2],#key) == 0) \
compute[ncompute] = new Class(lmp,narg,arg);
#include "style_compute.h"
#undef ComputeStyle
#undef COMPUTE_CLASS
else error->all("Invalid compute style");
}
ncompute++;
}

View File

@ -40,7 +40,7 @@ class Modify : protected Pointers {
class Compute **compute;
Modify(class LAMMPS *);
~Modify();
virtual ~Modify();
void init();
void setup(int);
void setup_pre_exchange();
@ -79,12 +79,12 @@ class Modify : protected Pointers {
double max_alpha(double *);
int min_dof();
void add_fix(int, char **);
void add_fix(int, char **, char *suffix = NULL);
void modify_fix(int, char **);
void delete_fix(const char *);
int find_fix(const char *);
void add_compute(int, char **);
void add_compute(int, char **, char *suffix = NULL);
void modify_compute(int, char **);
void delete_compute(char *);
int find_compute(char *);
@ -98,7 +98,7 @@ class Modify : protected Pointers {
bigint memory_usage();
private:
protected:
// lists of fixes to apply at different stages of timestep