Main Page | Class List | File List | Class Members | File Members

topo.h File Reference

Topology file reader. More...

#include "adt/array.h"
#include "adt/list.h"
#include "mdio/file.h"
#include "mdio/param.h"
#include "mdapi/mdtypes.h"

Go to the source code of this file.

Classes

struct  mdio_Topo_t
 Topology file reader class. More...

Typedefs

typedef mdio_Topo_t mdio_Topo
 Topology file reader class.

Functions

mdio_Topo * mdio_createTopo (void)
 Constructor.
void mdio_destroyTopo (mdio_Topo *)
 Destructor.
int mdio_readTopo (mdio_Topo *, const char *name)
 Read topology file.
int mdio_indexParamTopo (mdio_Topo *, mdio_Param *p)
 Index force field parameter arrays from topology arrays.
MD_Atom * mdio_getAtomTopo (mdio_Topo *, int *nelems)
 Obtain array of atoms.
MD_Bond * mdio_getBondTopo (mdio_Topo *, int *nelems)
 Obtain array of bonds.
MD_Angle * mdio_getAngleTopo (mdio_Topo *, int *nelems)
 Obtain array of angles.
MD_Tors * mdio_getDihedTopo (mdio_Topo *, int *nelems)
 Obtain array of dihedrals.
MD_Tors * mdio_getImprTopo (mdio_Topo *, int *nelems)
 Obtain array of impropers.
MD_Excl * mdio_getExclTopo (mdio_Topo *, int *nelems)
 Obtain array of exclusions.
int mdio_initializeTopo (mdio_Topo *)
 Alternative constructor.
void mdio_cleanupTopo (mdio_Topo *)
 Alternative destructor.


Detailed Description

Topology file reader.

Author:
David J. Hardy
Date:
2003-2005
The mdio_Topo class reads an X-Plor PSF topology file, storing the results into arrays of MDAPI topology data types defined in mdtypes.h. There is also a routine to setup the cross-indexing of the topology arrays into the force field parameter arrays, given an mdio_Param object.

The mdio_Topo class is derivde from mdio_File so that error handling is performed by simply typecasting (mdio_Topo *) to a (mdio_File *).


Typedef Documentation

typedef struct mdio_Topo_t mdio_Topo
 

Topology file reader class.

Members should be treated as private.


Function Documentation

void mdio_cleanupTopo (  mdio_Topo *   ) 
 

Alternative destructor.

Use to destroy a preallocated mdio_Topo object (i.e. one constructed using mdio_initializeTopo() ).

mdio_Topo* mdio_createTopo (  void   ) 
 

Constructor.

Creates dynamically allocated topology file reader object.

Returns:
Pointer to new object or NULL on failure.

void mdio_destroyTopo (  mdio_Topo *   ) 
 

Destructor.

Frees dynamically allocated topology file reader object after freeing the arrays of collected topology data types.

Note that the topology arrays obtained do not persist beyond destruction of mdio_Topo object.

MD_Angle* mdio_getAngleTopo (  mdio_Topo *  ,
int *  nelems
) 
 

Obtain array of angles.

Parameters:
[out] nelems Length of array returned into indicated variable.
Returns:
The angle array as a pointer.

MD_Atom* mdio_getAtomTopo (  mdio_Topo *  ,
int *  nelems
) 
 

Obtain array of atoms.

Parameters:
[out] nelems Length of array returned into indicated variable.
Returns:
The atom array as a pointer.

MD_Bond* mdio_getBondTopo (  mdio_Topo *  ,
int *  nelems
) 
 

Obtain array of bonds.

Parameters:
[out] nelems Length of array returned into indicated variable.
Returns:
The bond array as a pointer.

MD_Tors* mdio_getDihedTopo (  mdio_Topo *  ,
int *  nelems
) 
 

Obtain array of dihedrals.

Parameters:
[out] nelems Length of array returned into indicated variable.
Returns:
The dihedral array as a pointer.

MD_Excl* mdio_getExclTopo (  mdio_Topo *  ,
int *  nelems
) 
 

Obtain array of exclusions.

Parameters:
[out] nelems Length of array returned into indicated variable.
Returns:
The exclusion array as a pointer.

MD_Tors* mdio_getImprTopo (  mdio_Topo *  ,
int *  nelems
) 
 

Obtain array of impropers.

Parameters:
[out] nelems Length of array returned into indicated variable.
Returns:
The improper array as a pointer.

int mdio_indexParamTopo (  mdio_Topo *  ,
mdio_Param *  p
) 
 

Index force field parameter arrays from topology arrays.

Parameters:
[in,out] p Force field parameters have already been read.
Computes the indexing that matches the particular bonded interactions described by the topology arrays to their bond types described by the force field parameter arrays. The MD_NbfixPrm array that is part of p is also updated to index the correct MD_AtomPrm array entries.

Returns:
0 on success, MDIO_ERROR on failure.
Note that if multiple definitions for a force field parameter occurs, a warning will be issued. The last such definition will be the one indexed by the corresponding topology array. A warning will not result in returning the MDIO_ERROR value, but the error handler will be invoked for each warning. A way of determining after the call that some warning occurred is to compare mdio_getErrnumFile() against the value MDIO_ERROR_WARN.

int mdio_initializeTopo (  mdio_Topo *   ) 
 

Alternative constructor.

Use to construct a preallocated mdio_Topo object. See mdio_createTopo() for a description of expected arguments.

int mdio_readTopo (  mdio_Topo *  ,
const char *  name
) 
 

Read topology file.

Parameters:
[in] name A nil-terminated string naming the topology file.
Opens the file, reads and parses the file contents, and closes the file. Incrementally builds arrays storing the topology data types.

Returns:
0 on success, MDIO_ERROR on failure.


Generated on Thu Feb 7 18:11:41 2008 for MDX by  doxygen 1.3.9.1