Skip to content

Commit

Permalink
Merge pull request lammps#4098 from GenieTim/patch-1
Browse files Browse the repository at this point in the history
Fix variables compatibility with chunk arrays
  • Loading branch information
akohlmey authored Mar 30, 2024
2 parents 810ae3c + 7137290 commit b79bcce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,17 +1657,19 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)

if (!compute->array_flag)
print_var_error(FLERR,"Mismatched compute in variable formula",ivar);
if (compute->size_array_rows == 0)
print_var_error(FLERR,"Variable formula compute array is zero length",ivar);
if (index1 > compute->size_array_cols)
print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0);
if (!compute->is_initialized())
print_var_error(FLERR,"Variable formula compute cannot be invoked before "
"initialization by a run",ivar);
if (index1 > compute->size_array_cols)
print_var_error(FLERR,"Variable formula compute array is accessed out-of-range",ivar,0);
if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array();
compute->invoked_flag |= Compute::INVOKED_ARRAY;
}
// wait until after compute invocation to check size_array_rows
// b/c may be zero until after initial invocation
if (compute->size_array_rows == 0)
print_var_error(FLERR,"Variable formula compute array is zero length",ivar);

auto newtree = new Tree();
newtree->type = VECTORARRAY;
Expand Down

0 comments on commit b79bcce

Please sign in to comment.