Implemented patches due to Axel Kohlmeyer for porting to Cray XMT.
AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
+
+# on the cray xt3 we have to tell autoconf that we
+# are actually cross-compiling even if the architecture
+# of host and target are the same. so we enforce
+# cross-compilation if __QK_USER__ is defined
+ AC_MSG_CHECKING([for catamount])
+ AC_TRY_COMPILE([
+#if defined __QK_USER__
+#else
+#error not catamount
+#endif
+],,[
+ AC_MSG_RESULT(yes)
+ cross_compiling=yes
+ AC_DEFINE(GMX_CRAY_XT3,[],[Enable special hacks for Cray XT3])
+ AC_DEFINE(GMX_NO_SYSTEM,[],[Ignore calls to system(3)])
+ AC_DEFINE(GMX_NO_NICE,[],[Ignore calls to nice(3)])
+ AC_DEFINE(GMX_BROKEN_CALLOC,[],[Don't use calloc(3)])
+ extra_LDFLAGS="$extra_LDFLAGS -lgmalloc -lacml"
+],[
+ AC_MSG_RESULT(no)
+])
+# end of "$enable_mpi" = "yes"
fi
if test "$enable_threads" = "yes"; then
* Open and Close
********************************************************/
-extern int fio_open(char *fn,char *mode);
+extern int gmx_fio_open(char *fn,char *mode);
/* Open a new file for reading or writing.
* The file type will be deduced from the file name.
* If fn is NULL, stdin / stdout will be used for Ascii I/O (TPA type)
* unix, but is important on windows.
*/
-extern void fio_close(int fp);
+extern void gmx_fio_close(int fp);
/* Close the file corresponding to fp (if not stdio)
* The routine will exit when an invalid fio is handled.
*/
-extern void fio_select(int fp);
+extern void gmx_fio_select(int fp);
/* This routine sets the global variables do_read and do_write
* to point to the correct routines for fp.
*/
* Change properties of the open file
********************************************************/
-extern void fio_setprecision(int fio,bool bDouble);
+extern void gmx_fio_setprecision(int fio,bool bDouble);
/* Select the floating point precision for reading and writing files */
-extern char *fio_getname(int fio);
+extern char *gmx_fio_getname(int fio);
/* Return the filename corresponding to the fio index */
-extern int fio_getftp(int fio);
+extern int gmx_fio_getftp(int fio);
/* Return the filetype corresponding to the fio index */
-extern void fio_setftp_fio(int fio,int ftp);
+extern void gmx_fio_setftp_fio(int fio,int ftp);
/* And set it */
-extern void fio_setdebug(int fio,bool bDebug);
+extern void gmx_fio_setdebug(int fio,bool bDebug);
/* Set the debug mode */
-extern bool fio_getdebug(int fio);
+extern bool gmx_fio_getdebug(int fio);
/* Return whether debug mode is on in fio */
-extern bool fio_getread(int fio);
+extern bool gmx_fio_getread(int fio);
/* Return whether read mode is on in fio */
/***************************************************
* FILE Operations
***************************************************/
-extern void fio_rewind(int fio);
+extern void gmx_fio_rewind(int fio);
/* Rewind the tpa file in fio */
-extern void fio_flush(int fio);
+extern void gmx_fio_flush(int fio);
/* Flush the fio */
-extern off_t fio_ftell(int fio);
+extern off_t gmx_fio_ftell(int fio);
/* Return file position if possible */
-extern void fio_seek(int fio,off_t fpos);
+extern void gmx_fio_seek(int fio,off_t fpos);
/* Set file position if possible, quit otherwise */
-extern FILE *fio_getfp(int fio);
+extern FILE *gmx_fio_getfp(int fio);
/* Return the file pointer itself */
-extern XDR *fio_getxdr(int fio);
+extern XDR *gmx_fio_getxdr(int fio);
/* Return the file pointer itself */
extern void set_comment(char *comment);
bool bFillGrid,bool bDoForces);
+/* Debugging routines from wnblist.c */
+extern void dump_nblist(FILE *out,t_commrec *cr,t_forcerec *fr,int nDNL);
+
+extern int read_nblist(FILE *in,FILE *out,int **mat,int natoms,bool bSymm);
+/* Returns total number of neighbors. If bSymm the matrix is symmetrized. */
+
#endif /* _ns_h */
printf("Going to open %s\n",fn);
fpread = open_trn(fn,"r");
fpwrite = open_tpx(NULL,"w");
- fio_setdebug(fpwrite,TRUE);
+ gmx_fio_setdebug(fpwrite,TRUE);
mmm=mass[0]+2*mass[1];
for(i=0; (i<5); i++)
static void edr_nms(int fp,int *nre,char ***nms)
{
XDR *xdr;
- bool bRead = fio_getread(fp);
+ bool bRead = gmx_fio_getread(fp);
int i;
char **NM;
- xdr = fio_getxdr(fp);
+ xdr = gmx_fio_getxdr(fp);
NM=*nms;
static bool do_eheader(int fp,t_enxframe *fr,bool *bOK)
{
int block,i,dum=0;
- bool bRead = fio_getread(fp);
+ bool bRead = gmx_fio_getread(fp);
int tempfix_nr=0;
*bOK=TRUE;
{
bool bRead;
- bRead = fio_getread(fp);
- if (fio_getftp(fp) == efEDR) {
- fio_select(fp);
+ bRead = gmx_fio_getread(fp);
+ if (gmx_fio_getftp(fp) == efEDR) {
+ gmx_fio_select(fp);
edr_nms(fp,nre,nms);
}
else if (bRead)
- rd_ener_nms(fio_getfp(fp),nre,nms);
+ rd_ener_nms(gmx_fio_getfp(fp),nre,nms);
else
- wr_ener_nms(fio_getfp(fp),*nre,*nms);
+ wr_ener_nms(gmx_fio_getfp(fp),*nre,*nms);
}
void close_enx(int fp)
{
- fio_close(fp);
+ gmx_fio_close(fp);
}
static bool empty_file(char *fn)
bool bDum=TRUE;
if (mode[0]=='r') {
- fp=fio_open(fn,mode);
- fio_select(fp);
- fio_setprecision(fp,FALSE);
+ fp=gmx_fio_open(fn,mode);
+ gmx_fio_select(fp);
+ gmx_fio_setprecision(fp,FALSE);
do_enxnms(fp,&nre,&nm);
snew(fr,1);
do_eheader(fp,fr,&bDum);
sfree(nm);
}
else {
- fio_rewind(fp);
- fio_select(fp);
- fio_setprecision(fp,TRUE);
+ gmx_fio_rewind(fp);
+ gmx_fio_select(fp);
+ gmx_fio_setprecision(fp,TRUE);
do_enxnms(fp,&nre,&nm);
do_eheader(fp,fr,&bDum);
if (((fr->e_size && (fr->nre == nre) &&
}
free_enxframe(fr);
sfree(fr);
- fio_rewind(fp);
+ gmx_fio_rewind(fp);
}
else
- fp = fio_open(fn,mode);
+ fp = gmx_fio_open(fn,mode);
framenr=0;
frametime=0;
real tmp1,tmp2;
bOK = TRUE;
- bRead = fio_getread(fp);
+ bRead = gmx_fio_getread(fp);
if (!bRead) {
fr->e_size = fr->nre*sizeof(fr->ener[0].e)*4;
fr->d_size = fr->ndisre*(sizeof(fr->rav[0]) +
sizeof(fr->rt[0]));
}
- fio_select(fp);
+ gmx_fio_select(fp);
if (!do_eheader(fp,fr,&bOK)) {
if (bRead) {
bSane = bSane || (fr->nr[block] > 0);
if (!((fr->step >= 0) && bSane)) {
fprintf(stderr,"\nWARNING: there may be something wrong with energy file %s\n",
- fio_getname(fp));
+ gmx_fio_getname(fp));
fprintf(stderr,"Found: step=%d, nre=%d, ndisre=%d, nblock=%d, time=%g.\n"
"Trying to skip frame expect a crash though\n",
fr->step,fr->nre,fr->ndisre,fr->nblock,fr->t);
static bool do_dummy(void *item,int nitem,int eio,
char *desc,char *srcfile,int line)
{
- gmx_fatal(FARGS,"fio_select not called!");
+ gmx_fatal(FARGS,"gmx_fio_select not called!");
return FALSE;
}
}
#endif
-#define fio_check(fio) range_check(fio,0,nFIO)
+#define gmx_fio_check(fio) range_check(fio,0,nFIO)
/*****************************************************************
*
* EXPORTED SECTION
*
*****************************************************************/
-int fio_open(char *fn,char *mode)
+int gmx_fio_open(char *fn,char *mode)
{
t_fileio *fio=NULL;
int i,nfio=0;
else if (mode[0]=='a')
strcpy(newmode,"a");
else
- gmx_fatal(FARGS,"DEATH HORROR in fio_open, mode is '%s'",mode);
+ gmx_fatal(FARGS,"DEATH HORROR in gmx_fio_open, mode is '%s'",mode);
}
/* Check if it should be opened as a binary file */
}
-void fio_close(int fio)
+void gmx_fio_close(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (in_ftpset(FIO[fio].iFTP,asize(ftpXDR),ftpXDR)) {
xdrclose(FIO[fio].xdr);
do_write = do_dummy;
}
-void fio_select(int fio)
+void gmx_fio_select(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
#ifdef DEBUG
fprintf(stderr,"Select fio called with type %d for file %s\n",
FIO[fio].iFTP,FIO[fio].fn);
curfio = &(FIO[fio]);
}
-void fio_setprecision(int fio,bool bDouble)
+void gmx_fio_setprecision(int fio,bool bDouble)
{
- fio_check(fio);
+ gmx_fio_check(fio);
FIO[fio].bDouble = bDouble;
}
-bool fio_getdebug(int fio)
+bool gmx_fio_getdebug(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
return FIO[fio].bDebug;
}
-void fio_setdebug(int fio,bool bDebug)
+void gmx_fio_setdebug(int fio,bool bDebug)
{
- fio_check(fio);
+ gmx_fio_check(fio);
FIO[fio].bDebug = bDebug;
}
-char *fio_getname(int fio)
+char *gmx_fio_getname(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
return curfio->fn;
}
-void fio_setftp(int fio,int ftp)
+void gmx_fio_setftp(int fio,int ftp)
{
- fio_check(fio);
+ gmx_fio_check(fio);
FIO[fio].iFTP = ftp;
}
-int fio_getftp(int fio)
+int gmx_fio_getftp(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
return FIO[fio].iFTP;
}
-void fio_rewind(int fio)
+void gmx_fio_rewind(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (FIO[fio].xdr) {
xdrclose(FIO[fio].xdr);
/* File is always opened as binary by xdropen */
frewind(FIO[fio].fp);
}
-void fio_flush(int fio)
+void gmx_fio_flush(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (FIO[fio].fp)
fflush(FIO[fio].fp);
if (FIO[fio].xdr)
(void) fflush ((FILE *) FIO[fio].xdr->x_private);
}
-off_t fio_ftell(int fio)
+off_t gmx_fio_ftell(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (FIO[fio].fp)
return ftell(FIO[fio].fp);
else
return 0;
}
-void fio_seek(int fio, off_t fpos)
+void gmx_fio_seek(int fio, off_t fpos)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (FIO[fio].fp)
#ifdef HAVE_FSEEKO
fseeko(FIO[fio].fp,fpos,SEEK_SET);
gmx_file(FIO[fio].fn);
}
-FILE *fio_getfp(int fio)
+FILE *gmx_fio_getfp(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (FIO[fio].fp)
return FIO[fio].fp;
else
return NULL;
}
-XDR *fio_getxdr(int fio)
+XDR *gmx_fio_getxdr(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
if (FIO[fio].xdr)
return FIO[fio].xdr;
else
return NULL;
}
-bool fio_getread(int fio)
+bool gmx_fio_getread(int fio)
{
- fio_check(fio);
+ gmx_fio_check(fio);
return FIO[fio].bRead;
}
inda0 = a0 - g->start;
inda1 = a1 - g->start;
bFound = FALSE;
- /* Search for a direct edga between a0 and a1.
+ /* Search for a direct edge between a0 and a1.
* All egdes are bidirectional, so we only need to search one way.
*/
for(i=0; (i<g->nedge[inda0] && !bFound); i++)
gmx_fatal(FARGS,"Both full AND sparse matrix specified to gmx_mtxio_write().\n");
}
- fd = fio_open(filename,"w");
- fio_select(fd);
- xd = fio_getxdr(fd);
+ fd = gmx_fio_open(filename,"w");
+ gmx_fio_select(fd);
+ xd = gmx_fio_getxdr(fd);
/* Write magic number */
i = GMX_MTXIO_MAGIC_NUMBER;
}
}
}
- fio_close(fd);
+ gmx_fio_close(fd);
}
char gmxver[256];
size_t sz;
- fd = fio_open(filename,"r");
- fio_select(fd);
- xd = fio_getxdr(fd);
+ fd = gmx_fio_open(filename,"r");
+ gmx_fio_select(fd);
+ xd = gmx_fio_getxdr(fd);
/* Read and check magic number */
i = GMX_MTXIO_MAGIC_NUMBER;
}
}
}
- fio_close(fd);
+ gmx_fio_close(fd);
}
p=NULL;
else
{
+#ifdef GMX_BROKEN_CALLOC
+ /* emulate calloc(3) with malloc/memset on machines with
+ a broken calloc, e.g. in -lgmalloc on cray xt3. */
+ if ((p=malloc((size_t)nelem*(size_t)elsize))==NULL)
+ gmx_fatal(errno,__FILE__,__LINE__,
+ "calloc for %s (nelem=%d, elsize=%d, file %s"
+ ", line %d)",name,nelem,elsize,file,line);
+ memset(p, 0,(size_t) (nelem * elsize));
+#else
if ((p=calloc((size_t)nelem,(size_t)elsize))==NULL)
gmx_fatal(errno,__FILE__,__LINE__,
"calloc for %s (nelem=%d, elsize=%d, file %s"
", line %d)",name,nelem,elsize,file,line);
+#endif
}
#ifdef DEBUG
log_action(1,name,file,line,nelem,elsize,p);
}
if ((xx || vv || ff) && MASTER(cr)) {
fwrite_trn(fp,step,t,lambda,box,natoms,xx,vv,ff);
- fio_flush(fp);
+ gmx_fio_flush(fp);
}
return fp;
}
else
sscanf(not_nicestr[0],"%d",&nicelevel);
}
+
+#ifndef GMX_NO_NICE
+ /* The some system, e.g. the catamount kernel on cray xt3 do not have nice(2). */
if (nicelevel != 0 && !bExit)
nice(nicelevel);
+#endif
+
#endif
if (!(FF(PCA_QUIET) || bQuiet )) {
#include <config.h>
#endif
+#ifdef GMX_CRAY_XT3
+#ifndef NO_PWUID
+#define NO_PWUID
+#endif
+#endif
+
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
char buf[STRLEN];
bool bDbg;
- if (fio_getftp(fp) == efTPA) {
+ if (gmx_fio_getftp(fp) == efTPA) {
if (!bRead) {
do_string(itemstr[key]);
- bDbg = fio_getdebug(fp);
- fio_setdebug(fp,FALSE);
+ bDbg = gmx_fio_getdebug(fp);
+ gmx_fio_setdebug(fp,FALSE);
do_string(comment_str[key]);
- fio_setdebug(fp,bDbg);
+ gmx_fio_setdebug(fp,bDbg);
}
else {
- if (fio_getdebug(fp))
+ if (gmx_fio_getdebug(fp))
fprintf(stderr,"Looking for section %s (%s, %d)",
itemstr[key],src,line);
if (strcasecmp(buf,itemstr[key]) != 0)
gmx_fatal(FARGS,"\nCould not find section heading %s",itemstr[key]);
- else if (fio_getdebug(fp))
+ else if (gmx_fio_getdebug(fp))
fprintf(stderr," and found it\n");
}
}
bool bDouble;
int precision;
int fver,fgen;
- fio_select(fp);
- fio_setdebug(fp,bDebugMode());
+ gmx_fio_select(fp);
+ gmx_fio_setdebug(fp,bDebugMode());
/* NEW! XDR tpb file */
precision = sizeof(real);
gmx_fatal(FARGS,"Can not read file %s,\n"
" this file is from a Gromacs version which is older than 2.0\n"
" Make a new one with grompp or use a gro or pdb file, if possible",
- fio_getname(fp));
+ gmx_fio_getname(fp));
do_int(precision);
bDouble = (precision == sizeof(double));
if ((precision != sizeof(float)) && !bDouble)
gmx_fatal(FARGS,"Unknown precision in file %s: real is %d bytes "
"instead of %d or %d",
- fio_getname(fp),precision,sizeof(float),sizeof(double));
- fio_setprecision(fp,bDouble);
+ gmx_fio_getname(fp),precision,sizeof(float),sizeof(double));
+ gmx_fio_setprecision(fp,bDouble);
fprintf(stderr,"Reading file %s, %s (%s precision)\n",
- fio_getname(fp),buf,bDouble ? "double" : "single");
+ gmx_fio_getname(fp),buf,bDouble ? "double" : "single");
}
else {
do_string(GromacsVersion());
bDouble = (precision == sizeof(double));
- fio_setprecision(fp,bDouble);
+ gmx_fio_setprecision(fp,bDouble);
do_int(precision);
fver = tpx_version;
fgen = tpx_generation;
((fver > tpx_version) && !TopOnlyOK) ||
(fgen > tpx_generation))
gmx_fatal(FARGS,"reading tpx file (%s) version %d with version %d program",
- fio_getname(fp),fver,tpx_version);
+ gmx_fio_getname(fp),fver,tpx_version);
do_section(eitemHEADER,bRead);
do_int (tpx->natoms);
}
}
-#define do_test(b,p) if (bRead && (p!=NULL) && !b) gmx_fatal(FARGS,"No %s in %s",#p,fio_getname(fp))
+#define do_test(b,p) if (bRead && (p!=NULL) && !b) gmx_fatal(FARGS,"No %s in %s",#p,gmx_fio_getname(fp))
do_test(tpx.bBox,state->box);
do_section(eitemBOX,bRead);
int open_tpx(char *fn,char *mode)
{
- return fio_open(fn,mode);
+ return gmx_fio_open(fn,mode);
}
void close_tpx(int fp)
{
- fio_close(fp);
+ gmx_fio_close(fp);
}
void read_tpxheader(char *fn,t_tpxheader *tpx, bool TopOnlyOK,int *file_version, int *file_generation)
*bOK=TRUE;
- fio_select(fp);
+ gmx_fio_select(fp);
if (!do_int(magic))
return FALSE;
if (!*bOK) return *bOK;
sh->bDouble = (nFloatSize(sh) == sizeof(double));
- fio_setprecision(fp,sh->bDouble);
+ gmx_fio_setprecision(fp,sh->bDouble);
if (bRead && bFirst) {
fprintf(stderr,"(%s precision)\n",sh->bDouble ? "double" : "single");
int open_trn(char *fn,char *mode)
{
- return fio_open(fn,mode);
+ return gmx_fio_open(fn,mode);
}
void close_trn(int fp)
{
- fio_close(fp);
+ gmx_fio_close(fp);
}
else
prec = 1000.0;
- switch (fio_getftp(fnum)) {
+ switch (gmx_fio_getftp(fnum)) {
case efTRJ:
case efTRR:
break;
default:
if (!fr->bX)
gmx_fatal(FARGS,"Need coordinates to write a %s trajectory",
- ftp2ext(fio_getftp(fnum)));
+ ftp2ext(gmx_fio_getftp(fnum)));
break;
}
- switch (fio_getftp(fnum)) {
+ switch (gmx_fio_getftp(fnum)) {
case efTRJ:
case efTRR:
if (fr->bV) {
break;
}
- switch (fio_getftp(fnum)) {
+ switch (gmx_fio_getftp(fnum)) {
case efXTC:
write_xtc(fnum,nind,fr->step,fr->time,fr->box,xout,prec);
break;
case efENT:
if (!fr->bAtoms)
gmx_fatal(FARGS,"Can not write a %s file without atom names",
- ftp2ext(fio_getftp(fnum)));
+ ftp2ext(gmx_fio_getftp(fnum)));
sprintf(title,"frame t= %.3f",fr->time);
- if (fio_getftp(fnum) == efGRO)
- write_hconf_indexed_p(fio_getfp(fnum),title,fr->atoms,nind,ind,
+ if (gmx_fio_getftp(fnum) == efGRO)
+ write_hconf_indexed_p(gmx_fio_getfp(fnum),title,fr->atoms,nind,ind,
prec2ndec(prec),
fr->x,fr->bV ? fr->v : NULL,fr->box);
else
- write_pdbfile_indexed(fio_getfp(fnum),title,fr->atoms,
+ write_pdbfile_indexed(gmx_fio_getfp(fnum),title,fr->atoms,
fr->x,fr->box,0,fr->step,nind,ind);
break;
case efG87:
- write_gms(fio_getfp(fnum),nind,xout,fr->box);
+ write_gms(gmx_fio_getfp(fnum),nind,xout,fr->box);
break;
case efG96:
- write_g96_conf(fio_getfp(fnum),fr,nind,ind);
+ write_g96_conf(gmx_fio_getfp(fnum),fr,nind,ind);
break;
default:
gmx_fatal(FARGS,"Sorry, write_trxframe_indexed can not write %s",
- ftp2ext(fio_getftp(fnum)));
+ ftp2ext(gmx_fio_getftp(fnum)));
break;
}
- switch (fio_getftp(fnum)) {
+ switch (gmx_fio_getftp(fnum)) {
case efTRN:
case efTRJ:
case efTRR:
else
prec = 1000.0;
- switch (fio_getftp(fnum)) {
+ switch (gmx_fio_getftp(fnum)) {
case efTRJ:
case efTRR:
break;
default:
if (!fr->bX)
gmx_fatal(FARGS,"Need coordinates to write a %s trajectory",
- ftp2ext(fio_getftp(fnum)));
+ ftp2ext(gmx_fio_getftp(fnum)));
break;
}
- switch (fio_getftp(fnum)) {
+ switch (gmx_fio_getftp(fnum)) {
case efXTC:
write_xtc(fnum,fr->natoms,fr->step,fr->time,fr->box,fr->x,prec);
break;
case efENT:
if (!fr->bAtoms)
gmx_fatal(FARGS,"Can not write a %s file without atom names",
- ftp2ext(fio_getftp(fnum)));
+ ftp2ext(gmx_fio_getftp(fnum)));
sprintf(title,"frame t= %.3f",fr->time);
- if (fio_getftp(fnum) == efGRO)
- write_hconf_p(fio_getfp(fnum),title,fr->atoms,
+ if (gmx_fio_getftp(fnum) == efGRO)
+ write_hconf_p(gmx_fio_getfp(fnum),title,fr->atoms,
prec2ndec(prec),fr->x,fr->bV ? fr->v : NULL,fr->box);
else
- write_pdbfile(fio_getfp(fnum),title,
+ write_pdbfile(gmx_fio_getfp(fnum),title,
fr->atoms,fr->x,fr->box,0,fr->step);
break;
case efG87:
- write_gms(fio_getfp(fnum),fr->natoms,fr->x,fr->box);
+ write_gms(gmx_fio_getfp(fnum),fr->natoms,fr->x,fr->box);
break;
case efG96:
- write_g96_conf(fio_getfp(fnum),fr,-1,NULL);
+ write_g96_conf(gmx_fio_getfp(fnum),fr,-1,NULL);
break;
default:
gmx_fatal(FARGS,"Sorry, write_trxframe can not write %s",
- ftp2ext(fio_getftp(fnum)));
+ ftp2ext(gmx_fio_getftp(fnum)));
break;
}
void close_trx(int status)
{
- fio_close(status);
+ gmx_fio_close(status);
}
int open_trx(char *outfile,char *filemode)
if (filemode[0]!='w' && filemode[0]!='a')
gmx_fatal(FARGS,"Sorry, write_trx can only write");
- return fio_open(outfile,filemode);
+ return gmx_fio_open(outfile,filemode);
}
static bool gmx_next_frame(int status,t_trxframe *fr)
fr->tppf = fr->tpf;
fr->tpf = fr->time;
- switch (fio_getftp(status)) {
+ switch (gmx_fio_getftp(status)) {
case efTRJ:
case efTRR:
bRet = gmx_next_frame(status,fr);
break;
case efG96:
- read_g96_conf(fio_getfp(status),NULL,fr);
+ read_g96_conf(gmx_fio_getfp(status),NULL,fr);
bRet = (fr->natoms > 0);
break;
case efG87:
- bRet = xyz_next_x(fio_getfp(status),&fr->time,fr->natoms,fr->x,fr->box);
+ bRet = xyz_next_x(gmx_fio_getfp(status),&fr->time,fr->natoms,fr->x,fr->box);
fr->bTime = bRet;
fr->bX = bRet;
fr->bBox = bRet;
}
break;
case efPDB:
- bRet = pdb_next_x(fio_getfp(status),fr);
+ bRet = pdb_next_x(gmx_fio_getfp(status),fr);
break;
case efGRO:
- bRet = gro_next_x_or_v(fio_getfp(status),fr);
+ bRet = gro_next_x_or_v(gmx_fio_getfp(status),fr);
break;
default:
gmx_fatal(FARGS,"DEATH HORROR in read_next_frame ftp=%s,status=%d",
- ftp2ext(fio_getftp(status)),status);
+ ftp2ext(gmx_fio_getftp(status)),status);
}
if (bRet) {
bFirst = TRUE;
INITCOUNT;
- fp = *status =fio_open(fn,"r");
- switch (fio_getftp(fp))
+ fp = *status =gmx_fio_open(fn,"r");
+ switch (gmx_fio_getftp(fp))
{
case efTRJ:
case efTRR:
break;
case efG96:
/* Can not rewind a compressed file, so open it twice */
- read_g96_conf(fio_getfp(fp),fn,fr);
- fio_close(fp);
+ read_g96_conf(gmx_fio_getfp(fp),fn,fr);
+ gmx_fio_close(fp);
clear_trxframe(fr,FALSE);
if (flags & (TRX_READ_X | TRX_NEED_X))
snew(fr->x,fr->natoms);
if (flags & (TRX_READ_V | TRX_NEED_V))
snew(fr->v,fr->natoms);
- fp = *status =fio_open(fn,"r");
+ fp = *status =gmx_fio_open(fn,"r");
break;
case efG87:
- fr->natoms=xyz_first_x(fio_getfp(fp),&fr->time,&fr->x,fr->box);
+ fr->natoms=xyz_first_x(gmx_fio_getfp(fp),&fr->time,&fr->x,fr->box);
if (fr->natoms) {
fr->bTime = TRUE;
fr->bX = TRUE;
bFirst = FALSE;
break;
case efPDB:
- pdb_first_x(fio_getfp(fp),fr);
+ pdb_first_x(gmx_fio_getfp(fp),fr);
if (fr->natoms)
printcount(fr->time,FALSE);
bFirst = FALSE;
break;
case efGRO:
- if (gro_first_x_or_v(fio_getfp(fp),fr))
+ if (gro_first_x_or_v(gmx_fio_getfp(fp),fr))
printcount(fr->time,FALSE);
bFirst = FALSE;
break;
void close_trj(int status)
{
- fio_close(status);
+ gmx_fio_close(status);
}
void rewind_trj(int status)
{
INITCOUNT;
- fio_rewind(status);
+ gmx_fio_rewind(status);
}
/***** V E L O C I T Y S T U F F *****/
if ( strlen(cmd) ) {
sprintf(buf,"%s %s %s &",cmd,opts ? opts : "",fn);
fprintf(stderr,"Executing '%s'\n",buf);
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
+#else
system(buf);
+#endif
}
}
}
int open_xtc(char *fn,char *mode)
{
- return fio_open(fn,mode);
+ return gmx_fio_open(fn,mode);
}
void close_xtc(int fp)
{
- fio_close(fp);
+ gmx_fio_close(fp);
}
static void check_xtc_magic(int magic)
XDR *xd;
bool bDum;
- xd = fio_getxdr(fp);
+ xd = gmx_fio_getxdr(fp);
/* write magic number and xtc identidier */
if (!xtc_header(xd,&magic_number,&natoms,&step,&time,&bDum))
return 0;
XDR *xd;
*bOK=TRUE;
- xd = fio_getxdr(fp);
+ xd = gmx_fio_getxdr(fp);
/* read header and malloc x */
if ( !xtc_header(xd,&magic,natoms,step,time,bOK))
XDR *xd;
*bOK=TRUE;
- xd = fio_getxdr(fp);
+ xd = gmx_fio_getxdr(fp);
/* read header */
if (!xtc_header(xd,&magic,&n,step,time,bOK))
INC(fr,count,first,last,bF);
INC(fr,count,first,last,bBox);
#undef INC
- fpos = fio_ftell(status);
+ fpos = gmx_fio_ftell(status);
} while (read_next_frame(status,&fr));
fprintf(stderr,"\n");
fpread = open_trn(fn,"r");
fpwrite = open_tpx(NULL,"w");
- fio_setdebug(fpwrite,TRUE);
+ gmx_fio_setdebug(fpwrite,TRUE);
nframe = 0;
while (fread_trnheader(fpread,&trn,&bOK)) {
}
thanx(stdout);
+
+ return 0;
}
{
double nodetime=0,realtime;
t_inputrec *inputrec;
- t_state *state;
- rvec *buf,*f,*vold,*vt;
+ t_state *state=NULL;
+ rvec *buf=NULL,*f=NULL,*vold=NULL,*vt=NULL;
real tmpr1,tmpr2;
- real *ener;
+ real *ener=NULL;
t_nrnb *nrnb;
t_nsborder *nsb=NULL;
- t_topology *top;
- t_groups *grps;
- t_graph *graph;
- t_mdatoms *mdatoms;
- t_forcerec *fr;
- t_fcdata *fcd;
- real ewaldcoeff;
- gmx_pme_t *pmedata;
+ t_topology *top=NULL;
+ t_groups *grps=NULL;
+ t_graph *graph=NULL;
+ t_mdatoms *mdatoms=NULL;
+ t_forcerec *fr=NULL;
+ t_fcdata *fcd=NULL;
+ real ewaldcoeff=0;
+ gmx_pme_t *pmedata=NULL;
time_t start_t=0;
- bool bVsites,bParVsites;
+ bool bVsites=FALSE,bParVsites=FALSE;
t_comm_vsites vsitecomm;
- int i,m,nChargePerturbed,status;
+ int i,m,nChargePerturbed=0,status;
char *gro;
if ((ddxyz[XX]!=1 || ddxyz[YY]!=1 || ddxyz[ZZ]!=1)) {
{
gmx_multisim_t *ms;
int exchange=-1,shift;
- bool bExchanged;
+ bool bExchanged=FALSE;
ms = cr->ms;
fprintf(debug,"Command line for cpp:\n\t%s\n",command);
/* execute preprocessor */
+#ifdef GMX_NO_SYSTEM
+ error = 0;
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.",command);
+#else
error=system(command);
+#endif
if (error) {
if (error>0)
printf("cpp exit code: %d\n",error);
static void get_cg_distribution(FILE *fplog,gmx_domdec_t *dd,
t_block *cgs,matrix box,rvec pos[])
{
- int i,buf2[2],cg_gl;
+ int i,cg_gl;
+ int buf2[2] = { 0, 0 };
clear_dd_indices(dd,0);
int gmx_ddindex2nodeid(t_commrec *cr,int ddindex)
{
ivec coords;
- int nodeid;
+ int nodeid=-1;
if (cr->dd->bCartesian) {
gmx_ddindex2xyz(cr->dd->nc,ddindex,coords);
ivec coords,coords_pme;
int i;
int pmenode;
-
+
dd = cr->dd;
pmenode = -1;
+ if (dd == NULL) return pmenode; /* no domain decomposition? */
/* This assumes a uniform x domain decomposition grid cell size */
if (dd->bCartesian) {
#ifdef GMX_MPI
#include "nsb.h"
#include "names.h"
#include "network.h"
-#include "wnblist.h"
#include "pbc.h"
#include "ns.h"
#include "nrnb.h"
#include "vec.h"
#include "physics.h"
#include "coulomb.h"
+#include "pppm.h"
+#include "xvgr.h"
#include "fftgrid.h"
static void calc_k(rvec lll,int ix,int iy,int iz,int nx,int ny,int nz,rvec k)
sfree(leg[i]);
sfree(leg);
}
-
+ clear_rvec(x_init);
V_all = 0;
VembU_all = 0;
#ifdef GMX_MPI
MPI_Recv(&cve,sizeof(cve),MPI_BYTE,cr->dd->pme_nodeid,1,cr->mpi_comm_mysim,
MPI_STATUS_IGNORE);
+#else
+ memset(&cve,0,sizeof(cve));
#endif
m_add(vir,cve.vir,vir);
#include "nsb.h"
#include "names.h"
#include "network.h"
-#include "wnblist.h"
#include "pbc.h"
#include "ns.h"
#include "nrnb.h"
#include "nsb.h"
#include "names.h"
#include "network.h"
-#include "wnblist.h"
#include "pbc.h"
#include "ns.h"
#include "nrnb.h"
"input.com",
"input.log");
fprintf(stderr,"Calling '%s'\n",buf);
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ gmx_fatal(FARGS,"Call to '%s' failed\n",buf);
+#else
if ( system(buf) != 0 )
gmx_fatal(FARGS,"Call to '%s' failed\n",buf);
+#endif
}
real call_gaussian(t_commrec *cr, t_forcerec *fr,
#include "nsb.h"
#include "names.h"
#include "network.h"
-#include "wnblist.h"
#include "pbc.h"
#include "ns.h"
#include "nrnb.h"
#include "nsb.h"
#include "names.h"
#include "network.h"
-#include "wnblist.h"
#include "pbc.h"
#include "ns.h"
#include "nrnb.h"
#include <config.h>
#endif
+#ifdef GMX_CRAY_XT3
+#include<catamount/dclock.h>
+#endif
+
+
#include <stdio.h>
#include <time.h>
#include <math.h>
#define clock() -1
#endif
static double runtime=0;
+#ifdef GMX_CRAY_XT3
+static double cprev;
+
+void start_time(void)
+{
+ cprev = dclock();
+ runtime = 0.0;
+}
+
+void update_time(void)
+{
+ double c;
+
+ c = dclock();
+ runtime += (c-cprev);
+ cprev = c;
+}
+#else
static clock_t cprev;
void start_time(void)
runtime += (c-cprev)/(double)CLOCKS_PER_SEC;
cprev = c;
}
-
+#endif
double node_time(void)
{
return runtime;
#include "gmx_fatal.h"
#include "main.h"
#include "vsite.h"
+#include "mdrun.h"
static void split_ilist(FILE *log,t_ilist *il,t_commrec *cr)
{
#include "string2.h"
#include "force.h"
#include "smalloc.h"
-#include "wnblist.h"
+#include "ns.h"
#include "nrnb.h"
#include "gmx_fatal.h"
#include "macros.h"
+++ /dev/null
-/*
- * $Id$
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * GROwing Monsters And Cloning Shrimps
- */
-
-#ifndef _wnblist_h
-#define _wnblist_h
-
-#include "stdio.h"
-#include "typedefs.h"
-
-extern void dump_nblist(FILE *out,t_commrec *cr,t_forcerec *fr,int nDNL);
-
-extern int read_nblist(FILE *in,FILE *out,int **mat,int natoms,bool bSymm);
-/* Returns total number of neighbors. If bSymm the matrix is symmetrized. */
-
-#endif /* _wnblist_h */
#ifdef DEBUG
fprintf(stderr,"command: %s\n",command);
#endif
+
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
+#else
system(command);
+#endif
+
#ifdef DEBUG
unlink(tmp)
#endif
char comm[256];
sprintf(comm,"xwd -id %d -display %s > %s",(int)w,dispname,fn);
+
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
+#else
system(comm);
+#endif
}
static void dump_it(t_manager *man)
}
strcat(doit," &");
fprintf(stderr,"Going to exec: '%s'\n",doit);
+
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
+#else
system(doit);
+#endif
+
HideDlg(data->appl);
}
else if (strcasecmp(set,"Cancel") == 0) {
#include "mdatoms.h"
#include "nrnb.h"
#include "ns.h"
-#include "../mdlib/wnblist.h"
static real box_margin;
TRUE,FALSE);
if (debug)
- dump_nblist(debug,fr,0);
+ dump_nblist(debug,cr,fr,0);
if (bVerbose)
fprintf(stderr,"Succesfully made neighbourlist\n");
extern correl_t *init_correl(int n);
extern void done_correl(correl_t *c);
+extern void correl(real data1[],real data2[],int n,real ans[]);
+extern void four1(real data[],int nn,int isign);
#endif
rewind(tapeout);
#else
fclose(tapein);
+
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
+#else
system(dssp);
+#endif
+
#endif
strip_dssp(tmpfile,nres,bPhbres,t,
accr[nframe],fTArea,&mat,average_area);
#include <string.h>
#include <math.h>
+#include <ctype.h>
#include "typedefs.h"
#include "gmx_fatal.h"
int *set;
bool bEOF,bVerbose = TRUE;
char *ptr,buf[STRLEN];
- char **newnm;
+ char **newnm=NULL;
if ((getenv("VERBOSE")) != NULL)
bVerbose = FALSE;
fprintf(stderr,"End your selection with an empty line or a zero.\n");
fprintf(stderr,"---------------------------------------------------------\n");
- if ( bVerbose ) {
- nlen = 0;
- snew(newnm,nre);
- for(i=0; (i<nre); i++) {
- newnm[i] = strdup(nm[i]);
- nlen = max(nlen,strlen(newnm[i]));
- }
- kk = max(1,80/(nlen+4));
- sprintf(buf,"%%-3d %%-%ds ",nlen);
- for(k=0; (k<nre); ) {
- for(j=0; (j<kk) && (k<nre); j++,k++) {
- /* Insert dashes in all the names */
- while ((ptr = strchr(newnm[k],' ')) != NULL)
- *ptr='-';
+ nlen = 0;
+ snew(newnm,nre);
+ for(i=0; (i<nre); i++) {
+ newnm[i] = strdup(nm[i]);
+ nlen = max(nlen,strlen(newnm[i]));
+ }
+ kk = max(1,80/(nlen+4));
+ sprintf(buf,"%%-3d %%-%ds ",nlen);
+ for(k=0; (k<nre); ) {
+ for(j=0; (j<kk) && (k<nre); j++,k++) {
+ /* Insert dashes in all the names */
+ while ((ptr = strchr(newnm[k],' ')) != NULL)
+ *ptr='-';
+ if ( bVerbose )
fprintf(stderr,buf,k+1,newnm[k]);
- }
- fprintf(stderr,"\n");
}
- fprintf(stderr,"\n");
+ if ( bVerbose )
+ fprintf(stderr,"\n");
}
+ if ( bVerbose )
+ fprintf(stderr,"\n");
snew(bE,nre);
};
int i;
- for(i-0; (i<asize(uh)); i++)
+ for(i=0; (i<asize(uh)); i++)
if (strcmp(name,uh[i].name) == 0)
return NCMT-1+uh[i].nh;
real *radius,*dgs_factor=NULL,*area=NULL,*surfacedots=NULL;
real at_area,*atom_area=NULL,*atom_area2=NULL;
real *res_a=NULL,*res_area=NULL,*res_area2=NULL;
- real totarea,totvolume,totmass,density,harea,tarea,fluc2;
+ real totarea,totvolume,totmass=0,density,harea,tarea,fluc2;
atom_id **index,*findex;
int *nx,nphobic,npcheck,retval;
char **grpname,*fgrpname;
check_trn(fn);
in = open_trn(fn,"r");
- fp = fio_getfp(in);
+ fp = gmx_fio_getfp(in);
if (fp == NULL) {
fprintf(stderr,"Sorry, can not trunc %s, truncation of this filetype is not supported\n",fn);
close_trn(in);
} else {
j = 0;
- fpos = fio_ftell(in);
+ fpos = gmx_fio_ftell(in);
bStop= FALSE;
while (!bStop && fread_trnheader(in,&sh,&bOK)) {
fread_htrn(in,&sh,NULL,NULL,NULL,NULL);
}
if (ftp == efG87)
- fprintf(fio_getfp(trxout),"Generated by %s. #atoms=%d, a BOX is"
+ fprintf(gmx_fio_getfp(trxout),"Generated by %s. #atoms=%d, a BOX is"
" stored in this file.\n",Program(),nout);
/* Start the big loop over frames */
char c[255];
sprintf(c,"%s %d",exec_command,file_nr-1);
/*fprintf(stderr,"Executing '%s'\n",c);*/
+#ifdef GMX_NO_SYSTEM
+ printf("Warning-- No calls to system(3) supported on this platform.");
+ printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
+#else
system(c);
+#endif
}
outframe++;
}