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"
static int first_time = TRUE;
static int mol_count = 1;
int write_csr(FILE *fp, ums_type *mol)
{
if (first_time)
{
write_csr_header(fp,mol);
first_time = FALSE;
}
write_csr_coords(fp,mol);
mol_count++;
}
void write_csr_header(FILE *fp, ums_type *mol)
{
char *molnames;
int nmol, natom;
molnames = pad_string(Title,100);
nmol = 1;
natom = Atoms;
write_size(4*sizeof(char),fp);
fwrite("V33 ",1,4*sizeof(char),fp);
write_size(4*sizeof(char),fp);
write_size(2*sizeof(int),fp);
fwrite(&natom,1,sizeof(int),fp);
fwrite(&nmol,1,sizeof(int),fp);
write_size(2*sizeof(int),fp);
write_size(100*sizeof(char),fp);
fwrite(molnames,1,100*sizeof(char),fp);
write_size(100*sizeof(char),fp);
write_size(sizeof(int),fp);
fwrite(&natom,1,sizeof(int),fp);
write_size(sizeof(int),fp);
free(molnames);
}
void write_csr_coords(FILE *fp, ums_type *mol)
{
int i;
int the_size,jconf;
float x,y,z,energy;
char title[100];
char *tag;
the_size = sizeof(int) + sizeof(float) + (80 * sizeof(char));
jconf = 1;
energy = -2.584565;
sprintf(title,"%s:%d",Title,mol_count);
tag = pad_string(title,80);
/*
printf("processing %s \n",title);
*/
write_size(the_size,fp);
fwrite(&jconf,1,sizeof(int),fp);
fwrite(&energy,1,sizeof(energy),fp);
fwrite(tag,1,80*sizeof(char),fp);
write_size(the_size,fp);
write_size(Atoms * sizeof(float),fp);
for (i = 1; i <= Atoms; i++)
{
x = (float)X(i);
fwrite(&x,1,sizeof(float),fp);
}
write_size(Atoms * sizeof(float),fp);
write_size(Atoms *sizeof(float),fp);
for (i = 1; i <= Atoms; i++)
{
y = (float)Y(i);
fwrite(&y,1,sizeof(float),fp);
}
write_size(Atoms * sizeof(float),fp);
write_size(Atoms * sizeof(float),fp);
for (i = 1; i <= Atoms; i++)
{
z = (float)Z(i);
fwrite(&z,1,sizeof(float),fp);
}
write_size(Atoms * sizeof(float),fp);
}
void write_size(int the_size, FILE *fp)
{
fwrite(&the_size,1,sizeof(int),fp);
}
char *pad_string(char *input, int size)
{
int i;
char *output;
output = (char *)malloc(size * sizeof(char));
for (i = 0; i < size; i++)
output[i] = ' ';
for (i = 0; i < strlen(input); i++)
output[i] = input[i];
return(output);
}
|