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
|
|
|
#include "bbltyp.h"
int write_smiles(FILE *fp, ums_type *mol)
{
smilescontab_t *ct;
char *smilesstring;
int result;
ct = (smilescontab_t *)malloc(sizeof(smilescontab_t));
find_aromatic_atoms(mol);
mol = delete_atoms(mol,"default");
if (ums_to_smiles_ct(mol,&ct))
{
smilesstring = contabtosmiles(ct);
fprintf(fp,"%s\n",smilesstring);
}
else
{
printf("Unable to create smiles string\n");
result = FALSE;
}
if (ct)
free(ct);
if (smilesstring)
free(smilesstring);
return(result);
}
/*-----------------------------------------------------
FUNCTION : ums_to_smiles_ct
PURPOSE : translate a ums into a SMILES connection table
------------------------------------------------------*/
int ums_to_smiles_ct(ums_type *mol, smilescontab_t **ct)
{
smilescontab_t *newptr;
int i,j;
int conn, bo;
if(!(newptr = realloc((*ct), smiles_CONTABHDRSIZE + (Atoms * sizeof(smilesatom_t)))))
{
printf("OUT OF MEMORY AT %s %s \n",__FILE__,__LINE__);
return FALSE;
}
(*ct) = newptr;
(*ct)->natoms = Atoms;
for (i = 1; i <= Atoms; i++)
{
atomic_number_to_name(Atomic_number(i),(*ct)->atom[i-1].symbol);
for (j = 0; j < md_MAXBONDS; j++)
{
(*ct)->atom[i-1].bondedto[j] = (j < Valence(i) ? Connection(i,j) - 1 : 0);
(*ct)->atom[i-1].bondtype[j] = (j < Valence(i) ? BO(i,j) : 0);
}
}
return(TRUE);
}
void printcontab(smilescontab_t *contab)
{
int a, b;
for(a=0; anatoms; a++)
{
printf("%4d %2.2s", a+1, contab->atom[a].symbol);
for(b=0; batom[a].bondedto[b]+1, contab->atom[a].bondtype[b]);
printf("\n");
}
}
|