From 16df17c0481e58c2d2112780df1ed5f80b140ee8 Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Wed, 18 Jun 2014 14:51:21 +0200 Subject: Bug fix. Did not look through all chains. Always set the residues in the chain when adding residues. Change-Id: I785b829ab3ae68fa5ac39ba2accf02ce22a03fab diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 852be78..fb6089c 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -8422,7 +8422,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_find n_chains = molecule->n_chains; - for(i = n_chains - 1; i > 0; i--) + for(i = n_chains - 1; i >= 0; i--) { *chain = &molecule->chains[i]; if(name[0] == 0 || strcmp(name, (*chain)->name) == 0) @@ -8800,6 +8800,10 @@ tng_function_status DECLSPECDLLEXPORT tng_chain_residue_w_id_add { chain->residues = *residue; } + else + { + chain->residues = &molecule->residues[curr_index]; + } (*residue)->name = 0; tng_residue_name_set(tng_data, *residue, name); -- cgit v0.10.1