diff options
-rw-r--r-- | src/lib/tng_io.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |