Fix variables compatibility with chunk arrays
When using variables with chunk computes that produce arrays (such as `compute chunk/atom`) the compute will not have set `size_array_rows` to the appropriate value before it has ever been called and will therefore incorrectly have thrown the error "Variable formula compute array is zero length".
This commit is contained in:
@ -1657,10 +1657,6 @@ 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);
|
||||
@ -1668,6 +1664,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
|
||||
compute->compute_array();
|
||||
compute->invoked_flag |= Compute::INVOKED_ARRAY;
|
||||
}
|
||||
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);
|
||||
|
||||
auto newtree = new Tree();
|
||||
newtree->type = VECTORARRAY;
|
||||
|
||||
Reference in New Issue
Block a user