diff options
| author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-12-02 13:29:56 (GMT) | 
|---|---|---|
| committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-12-02 13:29:56 (GMT) | 
| commit | cc8cfde086edbaa145d106c5c895aba6c728fc79 (patch) | |
| tree | 7c8ceed0d590b61fb921afe1e5e6fea816365ed8 /src/lib | |
| parent | 591bbab4c27f38722de2a90951519e2c777be0a6 (diff) | |
Many getter for molecules added.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/tng_io.c | 194 | 
1 files changed, 194 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 121688d..d17d60b 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -6973,6 +6973,26 @@ static tng_function_status tng_frame_set_finalize  //     return(TNG_SUCCESS);  // }  */ + +tng_function_status tng_atom_name_get(tng_trajectory_t tng_data, +                                      const tng_atom_t atom, +                                      char *name, +                                      const int max_len) +{ +    (void) tng_data; +    TNG_ASSERT(atom, "TNG library: atom must not be NULL"); +    TNG_ASSERT(name, "TNG library: name must not be a NULL pointer"); + +    strncpy(name, atom->name, max_len - 1); +    name[max_len - 1] = 0; + +    if(strlen(atom->name) > (unsigned int)max_len - 1) +    { +        return(TNG_FAILURE); +    } +    return(TNG_SUCCESS); +} +  tng_function_status tng_atom_name_set(tng_trajectory_t tng_data,                                        tng_atom_t atom,                                        const char *new_name) @@ -7008,6 +7028,25 @@ tng_function_status tng_atom_name_set(tng_trajectory_t tng_data,      return(TNG_SUCCESS);  } +tng_function_status tng_atom_type_get(tng_trajectory_t tng_data, +                                      const tng_atom_t atom, +                                      char *type, +                                      const int max_len) +{ +    (void) tng_data; +    TNG_ASSERT(atom, "TNG library: atom must not be NULL"); +    TNG_ASSERT(type, "TNG library: type must not be a NULL pointer"); + +    strncpy(type, atom->atom_type, max_len - 1); +    type[max_len - 1] = 0; + +    if(strlen(atom->atom_type) > (unsigned int)max_len - 1) +    { +        return(TNG_FAILURE); +    } +    return(TNG_SUCCESS); +} +  tng_function_status tng_atom_type_set(tng_trajectory_t tng_data,                                        tng_atom_t atom,                                        const char *new_type) @@ -7259,6 +7298,25 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add      return(TNG_SUCCESS);  } +tng_function_status tng_molecule_name_get(tng_trajectory_t tng_data, +                                          const tng_molecule_t molecule, +                                          char *name, +                                          const int max_len) +{ +    (void) tng_data; +    TNG_ASSERT(molecule, "TNG library: molecule must not be NULL"); +    TNG_ASSERT(name, "TNG library: name must not be a NULL pointer"); + +    strncpy(name, molecule->name, max_len - 1); +    name[max_len - 1] = 0; + +    if(strlen(molecule->name) > (unsigned int)max_len - 1) +    { +        return(TNG_FAILURE); +    } +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_molecule_name_set                  (tng_trajectory_t tng_data,                   tng_molecule_t molecule, @@ -7532,6 +7590,57 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_system_copy(tng_trajectory_t      return(TNG_SUCCESS);  } +tng_function_status DECLSPECDLLEXPORT tng_molecule_chains_get +                (const tng_trajectory_t tng_data, +                 const tng_molecule_t molecule, +                 tng_chain_t **chains, +                 int64_t *n) +{ +    (void) tng_data; +    TNG_ASSERT(molecule, "TNG library: molecule must not be NULL"); +    TNG_ASSERT(chains, "TNG library: chains must not be a NULL pointer"); +    TNG_ASSERT(n, "TNG library: n must not be a NULL pointer"); + +    *chains = &molecule->chains; +    *n = molecule->n_chains; + +    return(TNG_SUCCESS); +} + +tng_function_status DECLSPECDLLEXPORT tng_molecule_residues_get +                (const tng_trajectory_t tng_data, +                 const tng_molecule_t molecule, +                 tng_residue_t **residues, +                 int64_t *n) +{ +    (void) tng_data; +    TNG_ASSERT(molecule, "TNG library: molecule must not be NULL"); +    TNG_ASSERT(residues, "TNG library: residues must not be a NULL pointer"); +    TNG_ASSERT(n, "TNG library: n must not be a NULL pointer"); + +    *residues = &molecule->residues; +    *n = molecule->n_residues; + +    return(TNG_SUCCESS); +} + +tng_function_status DECLSPECDLLEXPORT tng_molecule_atoms_get +                (const tng_trajectory_t tng_data, +                 const tng_molecule_t molecule, +                 tng_atom_t **atoms, +                 int64_t *n) +{ +    (void) tng_data; +    TNG_ASSERT(molecule, "TNG library: molecule must not be NULL"); +    TNG_ASSERT(atoms, "TNG library: atoms must not be a NULL pointer"); +    TNG_ASSERT(n, "TNG library: n must not be a NULL pointer"); + +    *atoms = &molecule->atoms; +    *n = molecule->n_atoms; + +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_find                  (tng_trajectory_t tng_data,                   tng_molecule_t molecule, @@ -7712,6 +7821,25 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_atom_find      return(TNG_FAILURE);  } +tng_function_status tng_chain_name_get(const tng_trajectory_t tng_data, +                                       const tng_chain_t chain, +                                       char *name, +                                       const int max_len) +{ +    (void) tng_data; +    TNG_ASSERT(chain, "TNG library: chain must not be NULL"); +    TNG_ASSERT(name, "TNG library: name must not be a NULL pointer"); + +    strncpy(name, chain->name, max_len - 1); +    name[max_len - 1] = 0; + +    if(strlen(chain->name) > (unsigned int)max_len - 1) +    { +        return(TNG_FAILURE); +    } +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_chain_name_set                  (tng_trajectory_t tng_data,                   tng_chain_t chain, @@ -7747,6 +7875,23 @@ tng_function_status DECLSPECDLLEXPORT tng_chain_name_set      return(TNG_SUCCESS);  } +tng_function_status DECLSPECDLLEXPORT tng_chain_residues_get +                (const tng_trajectory_t tng_data, +                 const tng_chain_t chain, +                 tng_residue_t **residues, +                 int64_t *n) +{ +    (void) tng_data; +    TNG_ASSERT(chain, "TNG library: chain must not be NULL"); +    TNG_ASSERT(residues, "TNG library: residues must not be a NULL pointer"); +    TNG_ASSERT(n, "TNG library: n must not be a NULL pointer"); + +    *residues = &chain->residues; +    *n = chain->n_residues; + +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_chain_residue_find                  (tng_trajectory_t tng_data,                   tng_chain_t chain, @@ -7886,6 +8031,25 @@ tng_function_status DECLSPECDLLEXPORT tng_chain_residue_w_id_add      return(stat);  } +tng_function_status tng_residue_name_get(tng_trajectory_t tng_data, +                                         const tng_residue_t residue, +                                         char *name, +                                         const int max_len) +{ +    (void) tng_data; +    TNG_ASSERT(residue, "TNG library: residue must not be NULL"); +    TNG_ASSERT(name, "TNG library: name must not be a NULL pointer"); + +    strncpy(name, residue->name, max_len - 1); +    name[max_len - 1] = 0; + +    if(strlen(residue->name) > (unsigned int)max_len - 1) +    { +        return(TNG_FAILURE); +    } +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_residue_name_set(tng_trajectory_t tng_data,                                                             tng_residue_t residue,                                                             const char *new_name) @@ -7921,6 +8085,24 @@ tng_function_status DECLSPECDLLEXPORT tng_residue_name_set(tng_trajectory_t tng_      return(TNG_SUCCESS);  } +tng_function_status DECLSPECDLLEXPORT tng_residue_atoms_get +                (const tng_trajectory_t tng_data, +                 const tng_molecule_t molecule, +                 const tng_residue_t residue, +                 tng_atom_t **atoms, +                 int64_t *n) +{ +    (void) tng_data; +    TNG_ASSERT(residue, "TNG library: residue must not be NULL"); +    TNG_ASSERT(atoms, "TNG library: atoms must not be a NULL pointer"); +    TNG_ASSERT(n, "TNG library: n must not be a NULL pointer"); + +    **atoms = &molecule->atoms[residue->atoms_offset]; +    *n = residue->n_atoms; + +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_residue_atom_add                  (tng_trajectory_t tng_data,                   tng_residue_t residue, @@ -10273,6 +10455,18 @@ tng_function_status DECLSPECDLLEXPORT tng_num_particles_get      return(TNG_SUCCESS);  } +tng_function_status DECLSPECDLLEXPORT tng_num_particles_variable_get +                (const tng_trajectory_t tng_data, +                 tng_variable_n_atoms_flag *variable) +{ +    TNG_ASSERT(tng_data, "TNG library: Trajectory container not properly setup."); +    TNG_ASSERT(variable, "TNG library: variable must not be a NULL pointer"); + +    *variable = tng_data->var_num_atoms_flag; + +    return(TNG_SUCCESS); +} +  tng_function_status DECLSPECDLLEXPORT tng_num_molecule_types_get                      (const tng_trajectory_t tng_data,                       int64_t *n)  | 
