| 
      babel-1.6
      | 
     
    
     | 
Makefile, 
README.1ST, 
addh.c, 
addh2.c, 
aromatic.c, 
assbnd.c, 
asstypes.c, 
babel.h, 
bblmacs.h, 
bblmast.h, 
bbltyp.h, 
block.c, 
bndord.c, 
bo.c, 
buildct.c, 
combine.c, 
convert.c, 
delatms.c, 
delh2o.c, 
element.lis, 
filesrch.c, 
fileutil.c, 
gastchg.c, 
gauss.hdr, 
htoend.c, 
int2cart.c, 
intcart.c, 
menus.c, 
miniums.c, 
molwt.c, 
new.lis, 
nodummy.c, 
orient.c, 
precip.c, 
printbad.c, 
progress.c, 
psgvb.hdr, 
quanta.lis, 
rdalch.c, 
rdampout.c, 
rdbalst.c, 
rdbgf.c, 
rdboogie.c, 
rdc3d.c, 
rdcacao.c, 
rdcadpac.c, 
rdcharmm.c, 
rdcsd.c, 
rddock.c, 
rddpdb.c, 
rdelmnts.c, 
rdfdat.c, 
rdfeat.c, 
rdfract.c, 
rdg96.c, 
rdgamout.c, 
rdgauout.c, 
rdgzmat.c, 
rdhin.c, 
rdinsite.c, 
rdint.c, 
rdirc.c, 
rdisis.c, 
rdm3d.c, 
rdmacmod.c, 
rdmacmol.c, 
rdmdl.c, 
rdmicro.c, 
rdmm2.c, 
rdmm2in.c, 
rdmm3.c, 
rdmolen.c, 
rdmopac.c, 
rdmopcrt.c, 
rdpcmod.c, 
rdpdb.c, 
rdprep.c, 
rdpsgout.c, 
rdpsgvin.c, 
rdquanta.c, 
rdschak.c, 
rdshelx.c, 
rdsmiles.c, 
rdspart.c, 
rdspmm.c, 
rdspsemi.c, 
rdsybmol.c, 
rdsybyl.c, 
rdtypes.c, 
rdunichm.c, 
rdwiz.c, 
rdxed.c, 
rdxyz.c, 
renum.c, 
report.c, 
rings.c, 
ringutil.c, 
sets.c, 
smilesto.c, 
spline.c, 
strngutl.c, 
tokenst.c, 
tosmiles.c, 
tree.c, 
typbybo.c, 
types.lis, 
umslist.c, 
utils.c, 
vectors.c, 
wralch.c, 
wrbalst.c, 
wrbgf.c, 
wrbmin.c, 
wrbox.c, 
wrc3d.c, 
wrcacao.c, 
wrcache.c, 
wrcacint.c, 
wrchdrw.c, 
wrcontmp.c, 
wrcsr.c, 
wrcssr.c, 
wrdock.c, 
wrdpdb.c, 
wrfeat.c, 
wrfh.c, 
wrg96.c, 
wrgamess.c, 
wrgau.c, 
wrgaucrt.c, 
wrhin.c, 
wricon.c, 
wrint.c, 
wrisis.c, 
wrm3d.c, 
wrmaccs.c, 
wrmacmod.c, 
wrmcmol.c, 
wrmdl.c, 
wrmicro.c, 
wrmimic.c, 
wrmiv.c, 
wrmm2.c, 
wrmm3.c, 
wrmopac.c, 
wrpcmod.c, 
wrpdb.c, 
wrpsgv.c, 
wrpsgvz.c, 
wrsmiles.c, 
wrspart.c, 
wrsybmol.c, 
wrsybyl.c, 
wrtinker.c, 
wrtorlst.c, 
wrunichm.c, 
wrwiz.c, 
wrxed.c, 
wrxyz.c
      | 
     
    
   | 
  
 
   | 
  
/*****
This file is part of the Babel Program
Copyright (C) 1992-96 W. Patrick Walters and Matthew T. Stahl 
All Rights Reserved 
All Rights Reserved 
All Rights Reserved 
All Rights Reserved 
For more information please contact :
babel@mercury.aichem.arizona.edu
------------------------------------------------------------------------
FILE : rdsybyl.c
AUTHOR(S) : Jussi Eloranta 
	    University of Jyvdskyld, Finland
Modified:  6-94 by Matthew Stahl to work with new method of 
           handling substructure files
Modified:  8-95 by Pat Walters to accomodate the modified mol2
           format used by the NCI Molecules R' Us folks
DATE : 12-93
PURPOSE : routines to read an SYBYL MOL2 file
          Supported record types (@):
	  molecule, atom, bond. Others are igonred.
******/
#include "bbltyp.h"
#define MOL "MOLECULE"
#define ATO "ATOM"
#define BON "BOND"
int
read_sybyl(FILE *file1, ums_type *mol)
{
  char input_line[BUFF_SIZE];
  char temp_title[BUFF_SIZE];
  int i;
  char temp_type[5];
  int start,end,order;
  int found_string = FALSE;
  long int pos;
  char bo_str[5];
  double temp_num = 0.0;
  int column;
  while (fgets(input_line,sizeof(input_line),file1)) 
  {
    if ((input_line[0] == '@') && strstr(input_line,MOL))
    {
      found_string = TRUE;
      break;
    }
  }
  if (!found_string)
    return(FALSE);
  /* @molecule record (6 data lines) */
  /* molecule name */
  fgets(input_line,sizeof(input_line),file1);
/*
  if(sscanf(input_line, "%s",temp_title) != 1)	
    show_warning("Problem reading name of current file");
*/
  strcpy(temp_title,input_line);
  /* # atoms, # bonds, # substructures, # features, # sets */
  fgets(input_line,sizeof(input_line),file1);
  if(sscanf(input_line, "%d %d", &Atoms, &Bonds) != 2)
  {
    show_warning("Problem reading number of Atoms and Bonds");
    return(FALSE);
  }
  found_string = FALSE;
  while (fgets(input_line, sizeof(input_line), file1))
  {
    if (strstr(input_line,"Energy"))
    {
      sscanf(input_line,"%*s%*s%lf",&temp_num);
    }
    if ((input_line[0] == '@') && strstr(input_line,ATO))
    {
      found_string = TRUE;
      break;
    }
  }
  
  if (!found_string)
  {
    show_warning("Unable to locate Atom Table in Sybyl MOL2 file");
    Atoms = Bonds = 0;
    return(FALSE);
  }
  
  ShowProgress(Atoms,"Reading Atoms");
  
  initialize_ums(&mol);
  initialize_residues(&mol);
  strcpy(Title,temp_title);
  strip_return(Title);
  Energy = temp_num;
  column = locate_input_type("SYB");  
  for (i = 1; i <= Atoms; i ++) 
  {
    UpdateProgress();
    strcpy(ResName(i),"UNK");
    ResNum(i) = 1;
    ChainNum(i) = 0;
    fgets(input_line,sizeof(input_line),file1);
    sscanf(input_line," %*s %s %lf %lf %lf %s %*s %*s %lf",
	   AtmId(i),
	   &X(i),
	   &Y(i),
	   &Z(i),
	   temp_type,
	   &Charge(i));
    Atomic_number(i) = get_input_type(i,column,temp_type,Type(i),dummy);    
  }
  
  found_string = FALSE;
  while (fgets(input_line, sizeof(input_line), file1))
  {
    if ((input_line[0] == '@') && strstr(input_line,BON))
    {
      found_string = TRUE;
      break;
    }
  }
  if (!found_string)
  {
    show_warning("Unable to locate Bond Table in Sybyl MOL2 file");
    release_ums(mol);
    free(mol->residues);
    Atoms = Bonds = 0;
    return(FALSE);
  }
  
  for (i = 0; i < Bonds; i ++) 
    {
      fgets(input_line,sizeof(input_line),file1);
      sscanf(input_line,"%*d %d %d %s",&start,&end,bo_str);
      uppercase(bo_str);
      if (EQ(bo_str,"AR"))
	order = 5;
      else 
	if (EQ(bo_str,"AM"))
	  order = 1;
	else
	  order = atoi(bo_str);
      Connection(start,Valence(start)) = end;
      BO(start,Valence(start)) = order;
      Valence(start)++;      
      Connection(end,Valence(end)) = start;
      BO(end,Valence(end)) = order;
      Valence(end)++;
    }
  build_connection_table(mol);
  pos = ftell(file1);
  while (fgets(input_line,sizeof(input_line), file1) != NULL) 
  {
    if ((input_line[0] == '@') && strstr(input_line,MOL))
    {
      fseek(file1,pos,0);
      break;
    }
  }
  type_hydrogens(mol);
  return(TRUE);
}
 
   |