diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tng_io.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 805e7eb..e3a50f6 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -6951,6 +6951,33 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_set return(TNG_SUCCESS); } +tng_function_status DECLSPECDLLEXPORT tng_molecule_find + (tng_trajectory_t tng_data, + const char *name, + int64_t nr, + tng_molecule_t *molecule) +{ + int i, n_molecules; + + n_molecules = tng_data->n_molecules; + + for(i = 0; i < n_molecules; i++) + { + *molecule = &tng_data->molecules[i]; + if(name[0] != 0 || strcmp(name, (*molecule)->name) == 0) + { + if(nr == -1 || nr == (*molecule)->id) + { + return(TNG_SUCCESS); + } + } + } + + *molecule = 0; + + return(TNG_FAILURE); +} + tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_find (tng_trajectory_t tng_data, tng_molecule_t molecule, |