summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-11-26 09:41:17 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-11-26 09:41:17 (GMT)
commit5ea15b21f5d497df39c021b4af854bf73db2e4b9 (patch)
tree05280a35cef757221684d65f178a77250c381d12 /src
parent9c6b8ad67d2fa8c7a0a47e1449e0c59828206a24 (diff)
Added functions tng_molecule_alloc() and tng_molecule_free()
Diffstat (limited to 'src')
-rw-r--r--src/lib/tng_io.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index 5349f20..ce1732c 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -7720,6 +7720,38 @@ tng_function_status DECLSPECDLLEXPORT tng_residue_atom_w_id_add
return(stat);
}
+tng_function_status DECLSPECDLLEXPORT tng_molecule_alloc(const tng_trajectory_t tng_data,
+ tng_molecule_t *molecule_p)
+{
+ *molecule_p = malloc(sizeof(struct tng_molecule));
+ if(!*molecule_p)
+ {
+ printf("TNG library: Cannot allocate memory (%lu bytes). %s: %d\n",
+ sizeof(struct tng_molecule), __FILE__, __LINE__);
+ return(TNG_CRITICAL);
+ }
+
+ tng_molecule_init(tng_data, *molecule_p);
+
+ return(TNG_SUCCESS);
+}
+
+tng_function_status DECLSPECDLLEXPORT tng_molecule_free(const tng_trajectory_t tng_data,
+ tng_molecule_t *molecule_p)
+{
+ if(!*molecule_p)
+ {
+ return(TNG_SUCCESS);
+ }
+
+ tng_molecule_destroy(tng_data, *molecule_p);
+
+ free(*molecule_p);
+ *molecule_p = 0;
+
+ return(TNG_SUCCESS);
+}
+
tng_function_status DECLSPECDLLEXPORT tng_molecule_init(const tng_trajectory_t tng_data,
tng_molecule_t molecule)
{
contact: Jan Huwald // Impressum