plug memory leaks in coupling examples

This commit is contained in:
Axel Kohlmeyer
2023-01-13 05:40:28 -05:00
parent b03e9609ce
commit aa2d2509d8
3 changed files with 5 additions and 3 deletions

View File

@ -125,12 +125,12 @@ int main(int narg, char **arg)
// extract force on single atom two different ways
if (lammps == 1) {
double **f = (double **) lammps_extract_atom(lmp,(char *) "f");
double **f = (double **) lammps_extract_atom(lmp, "f");
printf("Force on 1 atom via extract_atom: %g\n",f[0][0]);
double *fx = (double *)
lammps_extract_variable(lmp,(char *) "fx",(char *) "all");
double *fx = (double *) lammps_extract_variable(lmp, "fx", "all");
printf("Force on 1 atom via extract_variable: %g\n",fx[0]);
lammps_free(fx);
}
// use commands_string() and commands_list() to invoke more commands