endif()
set(TNG_ROOT_BINARY_DIR ${CMAKE_BINARY_DIR}/${TNG_ROOT_BINARY_DIR})
+set(TNG_MAJOR_VERSION "1")
+set(TNG_MINOR_VERSION "8")
+set(TNG_VERSION_PATCH_LEVEL "1")
+set(TNG_IO_VERSION "${TNG_MAJOR_VERSION}.${TNG_MINOR_VERSION}.${TNG_VERSION_PATCH_LEVEL}")
+
function (TNG_GENERATE_VERSION_H)
- set(TNG_MAJOR_VERSION "1")
- set(TNG_MINOR_VERSION "8")
- set(TNG_VERSION_PATCH_LEVEL "0")
- set(TNG_IO_VERSION "${TNG_MAJOR_VERSION}.${TNG_MINOR_VERSION}.${TNG_VERSION_PATCH_LEVEL}")
set(TNG_API_VERSION "8")
configure_file(${TNG_ROOT_SOURCE_DIR}/include/tng/version.h.in
${TNG_ROOT_BINARY_DIR}/include/tng/version.h)
return(TNG_SUCCESS);
}
+/**
+ * @brief Update atoms->residue pointers (after new memory for
+ * molecule->residues has been allocated).
+ * @param tng_data The trajectory container containing the molecule.
+ * @param mol The molecule that contains the chains that need to be
+ * updated.
+ * @returns TNG_SUCCESS (0) if successful.
+ */
+static tng_function_status tng_molecule_atoms_residue_pointers_update
+ (const tng_trajectory_t tng_data,
+ const tng_molecule_t mol)
+{
+ tng_atom_t atom;
+ tng_residue_t residue;
+ int64_t i, j, atom_offset = 0;
+ (void)tng_data;
+
+ for(i = 0; i < mol->n_residues; i++)
+ {
+ residue = &mol->residues[i];
+ for(j = 0; j < residue->n_atoms; j++)
+ {
+ atom = &mol->atoms[j + atom_offset];
+ atom->residue = residue;
+ }
+ atom_offset += residue->n_atoms;
+ }
+ return(TNG_SUCCESS);
+}
+
tng_function_status DECLSPECDLLEXPORT tng_version_major
(const tng_trajectory_t tng_data,
int *version)
*residue = &molecule->residues[curr_index + chain->n_residues];
tng_molecule_chains_residue_pointers_update(tng_data, molecule);
+ tng_molecule_atoms_residue_pointers_update(tng_data, molecule);
(*residue)->name = 0;
tng_residue_name_set(tng_data, *residue, name);