diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-03-06 07:40:24 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-03-06 07:40:24 (GMT) |
commit | f5fba9d06af6924c5ecbc5b9d5dcad200887b3a4 (patch) | |
tree | eb678a326ed73209c0e9dbd6c5d0f84a462b33ce /src | |
parent | 100fb403356da3afeffd4363c14d8bf4ef4b9a40 (diff) |
Added function tng_chain_residue_find to the API
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tng_io.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index b4a65ae..ef4d14a 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -5850,6 +5850,29 @@ tng_function_status tng_chain_name_set(tng_trajectory_t tng_data, return(TNG_SUCCESS); } +tng_function_status tng_chain_residue_find(tng_trajectory_t tng_data, + tng_chain_t chain, + const char *name, + tng_residue_t *residue) +{ + int i, n_residues; + + n_residues = chain->n_residues; + + for(i = 0; i < n_residues; i++) + { + *residue = &chain->residues[i]; + if(name[0] != 0 || strcmp(name, (*residue)->name) == 0) + { + return(TNG_SUCCESS); + } + } + + *residue = 0; + + return(TNG_FAILURE); +} + tng_function_status tng_chain_residue_add(tng_trajectory_t tng_data, tng_chain_t chain, const char *name, |