CCL Home Page
Up Directory CCL mmioc.c
/* Copyright 1995, Columbia University, all rights reserved.
 * Permission is granted to utilize and disseminate this code or
 *  document without charge, provided that (1) this copyright notice is 
 *  not removed, and (2) all changes made by other than members of the 
 *  MacroModel Development Group at Columbia University are, if further 
 *  disseminated, (a) noted as such; for example, by means of source-code 
 *  comment lines, and (b) communicated back to the author for possible 
 *  inclusion in subsequent versions. */

/****************************************************************************
 * $RCSfile: mmioc.c,v $
 * $Revision: 1.12 $
 * $Date: 1998/02/06 05:31:23 $
 ***************************************************************************/

#include 
#include "mmio.h"
#include "mmioc.h"
#define FALSE 0
#define TRUE 1

/****************************************************************************/
int mmio_open( int *idataset, char *fname, int mode ) 
{
	int retcode;
	retcode = _file_open( idataset, fname, mode );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_open: _file_open() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_close( int idataset ) 
{
	int retcode;
	retcode = _file_close( idataset );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_close: _file_close() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
void mmio_errfile( FILE *file ) 
{
	_setc_errfile( file );
}
/****************************************************************************/
char *mmio_return_code( int status ) 
{
	return _return_code( status );
}
/****************************************************************************/
int mmio_goto_ct( int idataset, int ict_new ) 
{
	int retcode;
	retcode = _goto_ct( idataset, ict_new );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_goto_ct: _goto_ct() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_skip_ct( int idataset, int nct_skip ) 
{
	int retcode;
	retcode = _skip_ct( idataset, nct_skip );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_skip_ct: _skip_ct() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_count_ct( int idataset, int *nct ) 
{
	int retcode;
	retcode = _count_ct( idataset, nct );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_open: _file_open() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_get_ct( int idataset, int ct_type, int *natom, char *title ) 
{
	int retcode;
	retcode = _get_ct( idataset, ct_type, natom, title );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_get_ct: _get_ct() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_get_atom( int idataset, int *mmod_iatom, int *itype, int *nbond,
 int *bond_atom, int *bond_order, float *xyz, float *charge1, float *charge2,
 char *chain, int *color, int *resnum, char *resname1, char *resname4,
 char *pdbname ) 
{
	int retcode;
	char growname[ MMIO_S_STRLEN + 1 ];

	retcode = _get_atom( idataset, mmod_iatom, itype, nbond, bond_atom,
	 bond_order, xyz, charge1, charge2, chain,
	 color, resnum, resname1, resname4, pdbname, growname, FALSE );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_get_atom: _get_atom() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_get_atomg( int idataset, int *mmod_iatom, int *itype, int *nbond,
 int *bond_atom, int *bond_order, float *xyz, float *charge1, float *charge2,
 char *chain, int *color, int *resnum, char *resname1, char *resname4,
 char *pdbname, char *growname ) 
{
	int retcode;
	retcode = _get_atom( idataset, mmod_iatom, itype, nbond, bond_atom,
	 bond_order, xyz, charge1, charge2, chain,
	 color, resnum, resname1, resname4, pdbname, growname, FALSE );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_get_atom: _get_atom() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_put_ct( int idataset, int ct_type, int natom, char *title ) 
{
	int retcode;
	retcode = _put_ct( idataset, ct_type, natom, title );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_put_ct: _put_ct() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_put_atom( int idataset, int mmod_iatom, int itype, int nbond,
 int *bond_atom, int *bond_order, float *xyz, float charge1, float charge2,
 char chain, int color, int resnum, char resname1, char *resname4,
 char *pdbname ) 
{
	int retcode;
	char growname[ MMIO_S_STRLEN + 1 ]; 

        growname[ 0 ] = '\0';

	retcode = _put_atom( idataset, mmod_iatom, itype, nbond, bond_atom,
	 bond_order, xyz, charge1, charge2, chain,
	 color, resnum, resname1, resname4, pdbname, growname );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_put_atom: _put_atom() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_put_atomg( int idataset, int mmod_iatom, int itype, int nbond,
 int *bond_atom, int *bond_order, float *xyz, float charge1, float charge2,
 char chain, int color, int resnum, char resname1, char *resname4,
 char *pdbname, char *growname ) 
{
	int retcode;

	retcode = _put_atom( idataset, mmod_iatom, itype, nbond, bond_atom,
	 bond_order, xyz, charge1, charge2, chain,
	 color, resnum, resname1, resname4, pdbname, growname );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_put_atom: _put_atom() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
int mmio_cleanup( void )
{
	int retcode;
	retcode = _cleanup_mmio( );
	if( retcode == MMIO_ERR ) {
		_error_mmio( "mmio_cleanup: _cleanup_mmio() fails\n" );
	}
	return retcode;
}
/****************************************************************************/
Modified: Fri Feb 6 05:31:56 1998 GMT
Page accessed 4439 times since Sat Apr 17 21:57:59 1999 GMT