summaryrefslogtreecommitdiff
path: root/src/lib/tng_io.c
diff options
context:
space:
mode:
authorMagnus Lundborg <lundborg.magnus@gmail.com>2013-11-26 12:50:44 (GMT)
committerMagnus Lundborg <lundborg.magnus@gmail.com>2013-11-26 12:50:44 (GMT)
commitc85ff9e8d3374ee6e11b5a49ce9f098a9856b7ef (patch)
treeb1235b3173da7e85e1e52a375c16a22c745bf312 /src/lib/tng_io.c
parent062242b7c5360baa426e396b2be4c3cc1d58cd21 (diff)
Modified tng_molecule_existing_add()
Diffstat (limited to 'src/lib/tng_io.c')
-rw-r--r--src/lib/tng_io.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index f00810c..d224679 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -7069,10 +7069,10 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_w_id_add
tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add
(tng_trajectory_t tng_data,
- tng_molecule_t molecule)
+ tng_molecule_t *molecule_p)
{
tng_bool found_id = TNG_TRUE;
- tng_molecule_t new_molecules;
+ tng_molecule_t new_molecules, molecule;
int64_t *new_molecule_cnt_list, i, id;
TNG_ASSERT(tng_data, "TNG library: Trajectory container not properly setup.");
@@ -7125,6 +7125,8 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add
return(TNG_CRITICAL);
}
+ molecule = *molecule_p;
+
tng_data->molecules = new_molecules;
tng_data->molecule_cnt_list = new_molecule_cnt_list;
@@ -7132,6 +7134,12 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add
tng_data->molecule_cnt_list[tng_data->n_molecules] = 0;
+ free(*molecule_p);
+
+ molecule = &new_molecules[tng_data->n_molecules];
+
+ *molecule_p = molecule;
+
molecule->id = id;
tng_data->n_molecules++;
@@ -7221,6 +7229,8 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_set
}
if(index == -1)
{
+ printf("TNG library: Could not find molecule in TNG trajectory. %s: %d\n",
+ __FILE__, __LINE__);
return(TNG_FAILURE);
}
old_cnt = tng_data->molecule_cnt_list[index];
@@ -7736,7 +7746,7 @@ tng_function_status DECLSPECDLLEXPORT tng_residue_atom_w_id_add
if(molecule->atoms[i].id == id)
{
stat = TNG_FAILURE;
- printf("TNG library: Atom ID already in use. %s: %d\n", __FILE__, __LINE__);
+ printf("TNG library: Atom ID %"PRId64" already in use. %s: %d\n", id, __FILE__, __LINE__);
break;
}
}
contact: Jan Huwald // Impressum