CCL Home Page
Up Directory CCL read_mm2
/*============================================================================*/
/* FILENAME: READ_MM2.C (READ_MM2.O)
/* PURPOSE: TO READ IN AN MM2 INPUT FILE.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 13 JULY 1993 MVG (ADDED ATOM TYPES 61-110).
/*============================================================================*/

#include "utility.h"
#include "newgeo.h"

#define MAX_MM2_ATOM_TYPES 110

#define max(a,b) (a=MAX_BONDS_PER_ATOM || intco[second_atom].bond_cnt>=MAX_BONDS_PER_ATOM)
         return(errmsg("Too many bonds to a single atom",FALSE));
      intco[first_atom].bonds[intco[first_atom].bond_cnt++] = second_atom;
      intco[second_atom].bonds[intco[second_atom].bond_cnt++] = first_atom;
      }

   return(TRUE);
   }

int process_attached_atom_list(line)
/*============================================================================*/
/* PURPOSE: PROCESS AN MM2 ATTACHED ATOM LIST INTO THE INDIVIDUAL BONDS.
*/
   char line[];	/* RAW ATTACHED ATOM LIST FROM MM2 INPUT FILE. */
   {
   int i;
   char atom_string[6];	/* STRING VERSION OF ATOM NUMBER. */
   int first_atom;	/* FIRST ATOM OF VALID PAIR. */
   int second_atom;	/* SECOND ATOM OF VALID PAIR. */

   /* TAKE APART AN ATTACHED ATOM LIST AN ATOM PAIR AT A TIME. */
   i=0;
   while (i<15 && atoi(&line[i*5])!=0)
      {
      /* GET THE VALID ATOM PAIR. */
      strncpy(atom_string,&line[i*5],5);
      atom_string[5]=0;
      first_atom=atoi(atom_string)-1;	/* MM2 COUNTS FROM 1. */

      strncpy(atom_string,&line[(i+1)*5],5);
      atom_string[5]=0;
      second_atom=atoi(atom_string)-1;	/* MM2 COUNTS FROM 1. */

      i+=2;	/* FINISHED THIS PAIR, SKIP AHEAD TO NEXT. */

      /* ADD THE BONDS TO EACH ATOM'S RESPECTIVE BOND LIST. */
      if (intco[first_atom].bond_cnt>=MAX_BONDS_PER_ATOM || intco[second_atom].bond_cnt>=MAX_BONDS_PER_ATOM)
         return(errmsg("Too many bonds to a single atom",FALSE));
      intco[first_atom].bonds[intco[first_atom].bond_cnt++] = second_atom;
      intco[second_atom].bonds[intco[second_atom].bond_cnt++] = first_atom;
      }

   return(TRUE);
   }
Modified: Fri Feb 11 17:00:00 1994 GMT
Page accessed 4955 times since Sat Apr 17 21:58:50 1999 GMT