plug memory leaks in coupling examples
This commit is contained in:
@ -148,6 +148,7 @@ int main(int narg, char **arg)
|
|||||||
|
|
||||||
double *fx = (double *) plugin->extract_variable(lmp,"fx",(char *)"all");
|
double *fx = (double *) plugin->extract_variable(lmp,"fx",(char *)"all");
|
||||||
printf("Force on 1 atom via extract_variable: %g\n",fx[0]);
|
printf("Force on 1 atom via extract_variable: %g\n",fx[0]);
|
||||||
|
plugin->free(fx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use commands_string() and commands_list() to invoke more commands */
|
/* use commands_string() and commands_list() to invoke more commands */
|
||||||
|
|||||||
@ -121,6 +121,7 @@ int main(int narg, char **arg)
|
|||||||
|
|
||||||
double *fx = (double *) lammps_extract_variable(lmp,"fx","all");
|
double *fx = (double *) lammps_extract_variable(lmp,"fx","all");
|
||||||
printf("Force on 1 atom via extract_variable: %g\n",fx[0]);
|
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 */
|
/* use commands_string() and commands_list() to invoke more commands */
|
||||||
|
|||||||
@ -125,12 +125,12 @@ int main(int narg, char **arg)
|
|||||||
// extract force on single atom two different ways
|
// extract force on single atom two different ways
|
||||||
|
|
||||||
if (lammps == 1) {
|
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]);
|
printf("Force on 1 atom via extract_atom: %g\n",f[0][0]);
|
||||||
|
|
||||||
double *fx = (double *)
|
double *fx = (double *) lammps_extract_variable(lmp, "fx", "all");
|
||||||
lammps_extract_variable(lmp,(char *) "fx",(char *) "all");
|
|
||||||
printf("Force on 1 atom via extract_variable: %g\n",fx[0]);
|
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
|
// use commands_string() and commands_list() to invoke more commands
|
||||||
|
|||||||
Reference in New Issue
Block a user