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

This commit is contained in:
sjplimp 2010-10-18 17:20:07 +00:00
parent 4723d0462a
commit bbaf00743c
2 changed files with 18 additions and 2 deletions

View File

@ -29,7 +29,11 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
if (narg != 4) error->all("Illegal compute pair command");
if (igroup) error->all("Compute pair must use group all");
pair = force->pair_match(arg[3],1);
int n = strlen(arg[3]) + 1;
pstyle = new char[n];
strcpy(pstyle,arg[3]);
pair = force->pair_match(pstyle,1);
if (!pair) error->all("Unrecognized pair style in compute pair command");
npair = pair->nextra;
if (!npair)
@ -51,12 +55,23 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) :
ComputePair::~ComputePair()
{
delete [] pstyle;
delete [] one;
delete [] vector;
}
/* ---------------------------------------------------------------------- */
void ComputePair::init()
{
// recheck for pair style in case it has been deleted
pair = force->pair_match(pstyle,1);
if (!pair) error->all("Unrecognized pair style in compute pair command");
}
/* ---------------------------------------------------------------------- */
void ComputePair::compute_vector()
{
invoked_vector = update->ntimestep;

View File

@ -28,11 +28,12 @@ class ComputePair : public Compute {
public:
ComputePair(class LAMMPS *, int, char **);
~ComputePair();
void init() {}
void init();
void compute_vector();
private:
int npair;
char *pstyle;
class Pair *pair;
double *one;
};