add extract method to bond style harmonic/shift
This commit is contained in:
@ -228,3 +228,16 @@ void BondHarmonicShift::born_matrix(int type, double rsq, int /*i*/, int /*j*/,
|
||||
du2 = 2 * k[type];
|
||||
if (r > 0.0) du = du2 * dr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return ptr to internal members upon request
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
void *BondHarmonicShift::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 1;
|
||||
if (strcmp(str, "k") == 0) return (void *) k;
|
||||
if (strcmp(str, "r0") == 0) return (void *) r0;
|
||||
if (strcmp(str, "r1") == 0) return (void *) r1;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ class BondHarmonicShift : public Bond {
|
||||
void write_data(FILE *) override;
|
||||
double single(int, double, int, int, double &) override;
|
||||
void born_matrix(int, double, int, int, double &, double &) override;
|
||||
void *extract(const char *, int &);
|
||||
|
||||
protected:
|
||||
double *k, *r0, *r1;
|
||||
|
||||
Reference in New Issue
Block a user