From f7083045c6f7d23bac47b8302e413becd53fc030 Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Thu, 19 Jun 2014 10:33:46 +0200 Subject: When adding a bond do not automatically check if it exists. Leave that responsibility to the caller to speed things up. Change-Id: Ide4741d0ad7461bf600766cbc49ad3b5e781fd9e diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index fb6089c..252cbb2 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -8515,21 +8515,9 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_bond_add const int64_t to_atom_id, tng_bond_t *bond) { - int64_t i; tng_bond_t new_bonds; (void)tng_data; - for(i = 0; i < molecule->n_bonds; i++) - { - *bond = &molecule->bonds[i]; - /* Check if the bond already exists */ - if(((*bond)->from_atom_id == from_atom_id && (*bond)->to_atom_id == to_atom_id) || - ((*bond)->to_atom_id == from_atom_id && (*bond)->from_atom_id == to_atom_id)) - { - return(TNG_SUCCESS); - } - } - new_bonds = realloc(molecule->bonds, sizeof(struct tng_bond) * (molecule->n_bonds + 1)); -- cgit v0.10.1