Correct bug in PairHybridScaled::single
This commit is contained in:
@ -68,14 +68,14 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
||||
const int nvars = scalevars.size();
|
||||
if (nvars > 0) {
|
||||
double *vals = new double[nvars];
|
||||
for (i = 0; i < nvars; ++i) {
|
||||
j = input->variable->find(scalevars[i].c_str());
|
||||
if (j < 0)
|
||||
error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]);
|
||||
vals[i] = input->variable->compute_equal(j);
|
||||
for (int k = 0; k < nvars; ++k) {
|
||||
int m = input->variable->find(scalevars[k].c_str());
|
||||
if (m < 0)
|
||||
error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]);
|
||||
vals[k] = input->variable->compute_equal(m);
|
||||
}
|
||||
for (i = 0; i < nstyles; ++i) {
|
||||
if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]];
|
||||
for (int k = 0; k < nstyles; ++k) {
|
||||
if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]];
|
||||
}
|
||||
delete[] vals;
|
||||
}
|
||||
@ -386,14 +386,14 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
|
||||
const int nvars = scalevars.size();
|
||||
if (nvars > 0) {
|
||||
double *vals = new double[nvars];
|
||||
for (i = 0; i < nvars; ++i) {
|
||||
j = input->variable->find(scalevars[i].c_str());
|
||||
if (j < 0)
|
||||
error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]);
|
||||
vals[i] = input->variable->compute_equal(j);
|
||||
for (int k = 0; k < nvars; ++k) {
|
||||
int m = input->variable->find(scalevars[k].c_str());
|
||||
if (m < 0)
|
||||
error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]);
|
||||
vals[k] = input->variable->compute_equal(m);
|
||||
}
|
||||
for (i = 0; i < nstyles; ++i) {
|
||||
if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]];
|
||||
for (int k = 0; k < nstyles; ++k) {
|
||||
if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]];
|
||||
}
|
||||
delete[] vals;
|
||||
}
|
||||
@ -593,7 +593,7 @@ void PairHybridScaled::init_svector()
|
||||
void PairHybridScaled::copy_svector(int itype, int jtype)
|
||||
{
|
||||
int n = 0;
|
||||
Pair *this_style;
|
||||
Pair *this_style = nullptr;
|
||||
|
||||
// fill svector array.
|
||||
// copy data from active styles and use 0.0 for inactive ones
|
||||
|
||||
Reference in New Issue
Block a user