add extract method to bond style harmonic/shift

This commit is contained in:
Axel Kohlmeyer
2024-09-16 20:48:41 -04:00
parent 804aa4ee85
commit 11365e7b2e
2 changed files with 14 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;