标题:gcc编译时出现In function 'main'问题求教~~~
只看楼主
芷岸栀开
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-9-4
 问题点数:0 回复次数:0 
gcc编译时出现In function 'main'问题求教~~~

我在linux系统中进行c程序编译,结果出现以下问题,我装的gsl是1.16版本的,具体报错见以下:
[shchlin@db-cluster ~]$ gcc -g -I/home/shchlin/gromacs-4.5.3/include/gromacs -I/home/shchlin/gsl/include g_2dionrdf.c -lm -lrt -L/home/shchlin/gromacs-4.5.3/lib -lgmx -L/home/shchlin/gsl/lib -lgsl -lgsl -lgslcblas -o g_2dionrdf
g_2dionrdf.c: In function 'main':

g_2dionrdf.c:160: warning: passing argument 9 of 'parse_common_args' from incompatible pointer type

g_2dionrdf.c:160: error: too few arguments to function 'parse_common_args'

g_2dionrdf.c:168: warning: passing argument 2 of 'read_tpx' from incompatible pointer type

g_2dionrdf.c:168: warning: passing argument 3 of 'read_tpx' from incompatible pointer type

g_2dionrdf.c:168: warning: passing argument 4 of 'read_tpx' from incompatible pointer type

g_2dionrdf.c:168: warning: passing argument 5 of 'read_tpx' from incompatible pointer type

g_2dionrdf.c:168: warning: passing argument 7 of 'read_tpx' from incompatible pointer type

g_2dionrdf.c:168: error: too many arguments to function 'read_tpx'

g_2dionrdf.c:282: warning: passing argument 1 of 'read_first_frame' from incompatible pointer type

g_2dionrdf.c:282: warning: passing argument 2 of 'read_first_frame' from incompatible pointer type

g_2dionrdf.c:282: warning: passing argument 3 of 'read_first_frame' from incompatible pointer type

g_2dionrdf.c:282: warning: passing argument 4 of 'read_first_frame' makes pointer from integer without a cast

g_2dionrdf.c:282: error: too few arguments to function 'read_first_frame'

g_2dionrdf.c:461: warning: passing argument 1 of 'read_next_frame' makes pointer from integer without a cast

g_2dionrdf.c:461: warning: passing argument 2 of 'read_next_frame' from incompatible pointer type

g_2dionrdf.c:461: error: too few arguments to function 'read_next_frame'



编写的c程序g_2dionrdf.c见下列所示:
g_2dionrdf.zip (5.41 KB)

/*
 * $Id: template.c,v 1.5 2008/05/29 08:36:53 hess Exp $
 *
 *                This source code is part of
 *
 *                 G   R   O   M   A   C   S
 *
 *          GROningen MAchine for Chemical Simulations
 *
 *                        VERSION 3.0
 *
 * Copyright (c) 1991-2001
 * BIOSON Research Institute, Dept. of Biophysical Chemistry
 * University of Groningen, The Netherlands
 *
 * 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.
 *
 * 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.
 *
 * Do check out http://www. , or mail us at gromacs@ .
 *
 * And Hey:
 * Gyas ROwers Mature At Cryogenic Speed
 */

/* This line is only for CVS version info */
static char *SRCID_template_c = "$Id: template.c,v 1.5 2008/05/29 08:36:53 hess Exp $";

#include "time.h"
#include "statutil.h"
#include "typedefs.h"
#include "smalloc.h"
#include "vec.h"
#include "copyrite.h"
#include "tpxio.h"
#include "string.h"

int main(int argc,char *argv[])
{
  static char *desc[] = {
    "this is a small test program meant to serve as a template ",
    "when writing your own analysis tools. The advantage of ",
    "using gromacs for this is that you have access to all ",
    "information in the topology, and your program will be ",
    "able to handle all types of coordinates and trajectory ",
    "files supported by gromacs. Go ahead and try it! ",
    "This test version just writes the coordinates of an ",
    "arbitrary atom to standard out for each frame. You can ",
    "select which atom you want to examine with the -n argument."
  };
 
  static int nah2o=3;
  static int rbin=125;
  static float range=2.5;
  static float zib=9.5;
  static float zie=15.5;
  static float te=0.35;
  static float gdslo=10.0;
  static float gdshi=14.9;
  static int sl=1;
  int MAXBIN = 500;
  int BINR = 500;
  int NUMGR = 2;
  int natoms,step;
  int kk, kj, im, ih, ij, ict, mk, mj, zi;
  int i, i_SOL, i_CO2, i_cation, i_anion;
  int nwater, nCO2, ncation, nanion;
  int zibbin, ziebin, countbin;
  int idim, numatoms, bin, bin3d, binnr, binz, binj, ind;
  int *anum, anum_LL, anum_UL, anum_AVG, anum_b;
  double PI=3.1415926536;
  double at = 300.0;
  double ak = 8.314e-03;
  double akt, atot, dz, comzkk, comzkj, drbin;
  double drsq, dr, drsq3d, dr3d, delx, dely, delz, dist, dzi, dte;
  double rlow, rhigh, slabv, volb, vol, avgnum, bnum, gofr, gofrh, *gofra;
  double *gb, *gravg;
  double gofra_3d;
  double bbox[DIM];
  double **gr, **grh, **gr_UL, **gr_LL, **gr_AVG;
  double *gr_UL_3d, *gr_LL_3d, *gr_AVG_3d;
  double **gr_b_3d;
  FILE *fpxvg, *fpxvg3, *fpxvgb;

  /* Extra arguments - but note how you always get the begin/end
   * options when running the program, without mentioning them here!
   */
 
  t_pargs pa[] = {
    { "-nah2o", FALSE, etINT, {&nah2o},
      "Number of sites in a water molecule (default = 3)"
    },
    { "-rbin", FALSE, etINT, {&rbin},
      "Number of bins in the radial direction (default = 125)"
    },
    { "-range", FALSE, etREAL, {&range},
      "Range in the radial direction (default = 2.5 nm)"
    },
    { "-zib", FALSE, etREAL, {&zib},
      "Beginning of output range in the z-direction (default = 9.5 nm)"
    },
    { "-zie", FALSE, etREAL, {&zie},
      "End of output range in the z-direction (default = 15.5 nm)"
    },
    { "-GDSlo", FALSE, etREAL, {&gdslo},
      "Lower GDS (default = 10.0 nm)"
    },
    { "-GDShi", FALSE, etREAL, {&gdshi},
      "Upper GDS (default = 14.9 nm)"
    },
    { "-te", FALSE, etREAL, {&te},
      "10--90 thickness (default = 0.35 nm)"
    },
    { "-sl", FALSE, etINT, {&sl},
      "Number of slabs (default = 1)"
    }
  };
 
  t_topology top;
  real time,lambda;
  t_inputrec ir;
  int        ePBC;
  char       title[STRLEN];
  t_trxframe fr;
  rvec       *xtop;
  matrix     box;
  int        status;
  int        flags = TRX_READ_X;
  gmx_mtop_t gmx_top;


  t_filenm fnm[] = {
    { efTPS,  NULL,  NULL, ffREAD },   /* this is for the topology */
    { efTRX, "-f", NULL, ffREAD },     /* this for the trajectory */
    { efLOG, "-g", "g2d_ion.log", ffWRITE },    /* this for general output */
    { efXVG, "-o2d", "gofr2d_ion.xvg", ffWRITE },     /* and this for output */
    { efXVG, "-o3d", "gofr3d_ion.xvg", ffWRITE },     /* and this for output */
    { efXVG, "-o3db", "gofr_bulk_ion.xvg", ffWRITE }     /* and this for output */
  };
 
#define NFILE asize(fnm)

  CopyRight(stderr,argv[0]);

  /* This is the routine responsible for adding default options,
   * calling the X/motif interface, etc. */
  parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW,
            NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);

  /* We don't need any topology information to write the coordinates,
   * but to show how it works we start by writing the name and
   * charge of the selected atom. It returns a boolean telling us
   * whether the topology was found and could be read
   */
 
  read_tpx(ftp2fn(efTPS,NFILE,fnm),&step,&time,&lambda,&ir,box,&natoms,NULL,NULL,NULL,&gmx_top);
  read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,&top,&ePBC,&xtop,NULL,box,TRUE);
  sfree(xtop);

  /* My own routine starts here. */

  for (idim=0; idim<DIM; idim++){
    bbox[idim] = box[idim][idim];
  }

  dz = bbox[ZZ]/((double) sl);
  dte = te/2.0;
  zibbin = ((int) (zib/dz));
  ziebin = ((int) (zie/dz));

  if(sl > MAXBIN) {
    printf("Error: sl > MAXBIN \n");
  }
  else {
    printf("sl = %d, zibbin = %d, ziebin = %d, dz = %lg \n", \
       sl,zibbin,ziebin,dz);
  }
  if(rbin > BINR) {
    printf("Error: rbin > BINR \n");
  }

  numatoms = top.atoms.nr;
  nwater = numatoms/nah2o;
  akt = ak * at;
  slabv = bbox[XX] * bbox[YY];
  volb = bbox[XX] * bbox[YY] * (gdshi-gdslo);
  drbin = range/((double) rbin);

  /* See /usr/local/gromacs/include/types, particularly topology.h
     and idef.h, for the struct definition. */

  ict = 0;
  printf("Number of water molecules = %d \n",nwater);
  printf("Note: this water molecule has %d sites \n",nah2o);

  /*  Allocating arrays; snew is defined in smalloc.h */
  snew(anum,sl);
  snew(gr,sl);
  snew(grh,sl);
  snew(gr_UL,NUMGR);
  snew(gr_LL,NUMGR);
  snew(gr_AVG,NUMGR);
  snew(gr_b_3d,NUMGR);
  snew(gofra,NUMGR);
  snew(gb,NUMGR);
  for (binz=0; binz<sl; binz++) {
    snew(gr[binz],rbin);
    snew(grh[binz],rbin);
  }
  for (ih=0;ih<NUMGR;ih++) {
    snew(gr_UL[ih],rbin);
    snew(gr_LL[ih],rbin);
    snew(gr_AVG[ih],rbin);
    snew(gr_b_3d[ih],rbin);
  }
  snew(gr_UL_3d,rbin);
  snew(gr_LL_3d,rbin);
  snew(gr_AVG_3d,rbin);
  anum_UL = 0;
  anum_LL = 0;
  anum_AVG = 0;
  anum_b = 0;

  /*Find start atom and end atom for each block*/
  struct ntypeatom{
  int start;
  int end;
  };
  struct ntypeatom nta[4];
  nta[0].start = 0;
  nta[0].end = nta[0].start + gmx_top.molblock[0].nmol * gmx_top.molblock[0].natoms_mol - 1;

  for (i=1; i<gmx_top.nmoltype; i++) {
    nta[i].start = nta[i-1].end + 1;
    nta[i].end = nta[i].start + gmx_top.molblock[i].nmol *     gmx_top.molblock[i].natoms_mol -1;
  }

/* Find the block for each molecule */
  for (i=0; i<gmx_top.nmoltype; i++) {
    if (!strcmp(gmx_top.moltype[i].name[0],"SOL")) {
      /*fprintf(fplog,"Block for SOL = %d \n", i);*/
      i_SOL = i;
      nwater = gmx_top.molblock[i_SOL].nmol;
      printf("Block for SOL = %d, SOL molecules = %d, SOL atom start = %d, SOL atom end = %d\n", i_SOL, nwater, nta[i_SOL].start, nta[i_SOL].end);
    }

    if (!strcmp(gmx_top.moltype[i].name[0],"CO2")) {
      i_CO2 = i;
      nCO2 = gmx_top.molblock[i_CO2].nmol;
      printf("Block for CO2 = %d, CO2 molecules = %d, CO2 atom start = %d, CO2 atom end = %d\n", i_CO2, nCO2, nta[i_CO2].start, nta[i_CO2].end);
    }

    if (!strcmp(gmx_top.moltype[i].name[0],"CA2+")) {
      i_cation = i;
      ncation = gmx_top.molblock[i_cation].nmol;
      printf("Block for Na = %d, Na molecules = %d, Na atom start = %d, Na atom end = %d\n", i_cation, ncation, nta[i_cation].start, nta[i_cation].end);
    }

    if (!strcmp(gmx_top.moltype[i].name[0],"CL-")) {
      i_anion = i;
      nanion = gmx_top.molblock[i_anion].nmol;
      printf("Block for Cl = %d, Cl molecules = %d, Cl atom start = %d, Cl atom end = %d\n", i_anion, nanion, nta[i_anion].start, nta[i_anion].end);
    }
  }





  read_first_frame(&status,ftp2fn(efTRX,NFILE,fnm),&fr,flags);
  do {
    ict += 1;

    /* Accumulate the radial distribution in each layer */
    for (mk=0; mk<nwater; mk++){
      comzkk = 0.0;
      for (im=0; im<nah2o; im++) {
    kk = mk*nah2o + im + nta[i_SOL].start;
    comzkk += fr.x[kk][ZZ];
      }
      comzkk = comzkk/((double) nah2o);
      binz = ((int) (comzkk/dz));
      anum[binz] += 1;
      if ((comzkk>=gdslo) && (comzkk<=(gdslo+dte))) {
    anum_LL += 1;
    anum_AVG += 1;
      }
      else if ((comzkk<=gdshi) && (comzkk>=(gdshi-dte))) {
    anum_UL += 1;
    anum_AVG += 1;
      }
      if ((comzkk>=gdslo) && (comzkk<=gdshi)) {
    anum_b++;
      }
      for (mj=0; mj<nwater; mj++) {
    if (mk != mj) {
      comzkj = 0.0;
      for (ij=0; ij<nah2o; ij++) {
        kj = mj*nah2o + ij + nta[i_SOL].start;
        comzkj += fr.x[kj][ZZ];
      }
      comzkj = comzkj/((double) nah2o);
      binj = ((int) (comzkj/dz));
      
      if (binz == binj) {
        kk = mk*nah2o + nta[i_SOL].start;
        kj = mj*nah2o + nta[i_SOL].start;
        delx = fr.x[kk][XX] - fr.x[kj][XX];
        delx -= bbox[XX]*rint(delx/bbox[XX]);
        dely = fr.x[kk][YY] - fr.x[kj][YY];
        dely -= bbox[YY]*rint(dely/bbox[YY]);
        delz = fr.x[kk][ZZ] - fr.x[kj][ZZ];
        drsq = delx*delx + dely*dely + delz*delz;
        dr = sqrt(drsq);
        bin = ((int) (dr/drbin));
        if (bin < rbin) {
          gr[binz][bin] += 1.0;
        }
         for (ih=1; ih<nah2o; ih++) {
        kj = mj*nah2o + ih + nta[i_SOL].start;
        delx = fr.x[kk][XX] - fr.x[kj][XX];
        delx -= bbox[XX]*rint(delx/bbox[XX]);
        dely = fr.x[kk][YY] - fr.x[kj][YY];
        dely -= bbox[YY]*rint(dely/bbox[YY]);
        delz = fr.x[kk][ZZ] - fr.x[kj][ZZ];
        drsq = delx*delx + dely*dely + delz*delz;
        dr = sqrt(drsq);
        bin = ((int) (dr/drbin));
        if (bin < rbin) {
          grh[binz][bin] += 1.0;
        }
          }

       }

      if ((comzkk>=gdslo) && (comzkk<=gdshi)) {
        if ((comzkj>=gdslo) && (comzkj<=gdshi)) {        
          kk = mk*nah2o + nta[i_SOL].start;
          kj = mj*nah2o + nta[i_SOL].start;
          delx = fr.x[kk][XX] - fr.x[kj][XX];
          delx -= bbox[XX]*rint(delx/bbox[XX]);
          dely = fr.x[kk][YY] - fr.x[kj][YY];
          dely -= bbox[YY]*rint(dely/bbox[YY]);
          delz = fr.x[kk][ZZ] - fr.x[kj][ZZ];
          drsq3d = delx*delx + dely*dely + delz*delz;
          dr3d = sqrt(drsq3d);
          bin3d = ((int) (dr3d/drbin));
          if (bin3d < rbin) {
        gr_b_3d[0][bin3d] += 1.0;
          }
          for (ih=1; ih<nah2o; ih++) {
        kj = mj*nah2o + ih + nta[i_SOL].start;
        delx = fr.x[kk][XX] - fr.x[kj][XX];
        delx -= bbox[XX]*rint(delx/bbox[XX]);
        dely = fr.x[kk][YY] - fr.x[kj][YY];
        dely -= bbox[YY]*rint(dely/bbox[YY]);
        delz = fr.x[kk][ZZ] - fr.x[kj][ZZ];
        drsq3d = delx*delx + dely*dely + delz*delz;
        dr3d = sqrt(drsq3d);
        bin3d = ((int) (dr3d/drbin));
        if (bin3d < rbin) {
          gr_b_3d[1][bin3d] += 1.0;
        }
          }         
        }
      }
      
      if ((comzkk>=gdslo) && (comzkk<=(gdslo+dte))) {
        if ((comzkj>=gdslo) && (comzkj<=(gdslo+dte))) {
          kk = mk*nah2o + nta[i_SOL].start;
          kj = mj*nah2o + nta[i_SOL].start;
          delx = fr.x[kk][XX] - fr.x[kj][XX];
          delx -= bbox[XX]*rint(delx/bbox[XX]);
          dely = fr.x[kk][YY] - fr.x[kj][YY];
          dely -= bbox[YY]*rint(dely/bbox[YY]);
          delz = fr.x[kk][ZZ] - fr.x[kj][ZZ];
          drsq = delx*delx + dely*dely;
          drsq3d = delx*delx + dely*dely + delz*delz;
          dr = sqrt(drsq);
          dr3d = sqrt(drsq3d);
          bin = ((int) (dr/drbin));
          bin3d = ((int) (dr3d/drbin));
          if (bin < rbin) {
        gr_LL[0][bin] += 1.0;
        gr_AVG[0][bin] += 1.0;
          }
          if (bin3d < rbin) {
        gr_LL_3d[bin3d] += 1.0;
        gr_AVG_3d[bin3d] += 1.0;
          }
          for (ih=1; ih<nah2o; ih++) {
        kj = mj*nah2o + ih + nta[i_SOL].start;
        delx = fr.x[kk][XX] - fr.x[kj][XX];
        delx -= bbox[XX]*rint(delx/bbox[XX]);
        dely = fr.x[kk][YY] - fr.x[kj][YY];
        dely -= bbox[YY]*rint(dely/bbox[YY]);
        drsq = delx*delx + dely*dely;
        dr = sqrt(drsq);
        bin = ((int) (dr/drbin));
        if (bin < rbin) {
          gr_LL[1][bin] += 1.0;
          gr_AVG[1][bin] += 1.0;
        }
          }
        }
      }
      if ((comzkk<=gdshi) && (comzkk>=(gdshi-dte))) {
        if ((comzkj<=gdshi) && (comzkj>=(gdshi-dte))) {
          kk = mk*nah2o + nta[i_SOL].start;
          kj = mj*nah2o + nta[i_SOL].start;
          delx = fr.x[kk][XX] - fr.x[kj][XX];
          delx -= bbox[XX]*rint(delx/bbox[XX]);
          dely = fr.x[kk][YY] - fr.x[kj][YY];
          dely -= bbox[YY]*rint(dely/bbox[YY]);
          delz = fr.x[kk][ZZ] - fr.x[kj][ZZ];
          drsq = delx*delx + dely*dely;
          drsq3d = delx*delx + dely*dely + delz*delz;
          dr = sqrt(drsq);
          dr3d = sqrt(drsq3d);
          bin = ((int) (dr/drbin));
          bin3d = ((int) (dr3d/drbin));
          if (bin < rbin) {
        gr_UL[0][bin] += 1.0;
        gr_AVG[0][bin] += 1.0;
          }
          if (bin3d < rbin) {
        gr_UL_3d[bin3d] += 1.0;
        gr_AVG_3d[bin3d] += 1.0;
          }
          for (ih=1; ih<nah2o; ih++) {
        kj = mj*nah2o + ih + nta[i_SOL].start;
        delx = fr.x[kk][XX] - fr.x[kj][XX];
        delx -= bbox[XX]*rint(delx/bbox[XX]);
        dely = fr.x[kk][YY] - fr.x[kj][YY];
        dely -= bbox[YY]*rint(dely/bbox[YY]);
        drsq = delx*delx + dely*dely;
        dr = sqrt(drsq);
        bin = ((int) (dr/drbin));
        if (bin < rbin) {
          gr_UL[1][bin] += 1.0;
          gr_AVG[1][bin] += 1.0;
        }
          }
        }
      }
    }
      }
    }
  } while(read_next_frame(status,&fr));

  atot = ((double) ict);
  fpxvg = opt2FILE("-o2d",NFILE,fnm,"w");
  fpxvg3 = opt2FILE("-o3d",NFILE,fnm,"w");
  fpxvgb = opt2FILE("-o3db",NFILE,fnm,"w");

  bnum = ((double) anum_b)/atot;
  fprintf(fpxvgb,"# r, gOO, gOH \n");
  for (bin=0; bin<rbin; bin++) {
    rlow = ((double) bin)*drbin;
    rhigh = rlow + drbin;
    vol = 4.*PI*(rhigh*rhigh*rhigh - rlow*rlow*rlow)/3.;
    if (bnum != 0) {
      avgnum = bnum*vol/volb;
      gb[0] = gr_b_3d[0][bin]/bnum/atot/avgnum;
      gb[1] = gr_b_3d[1][bin]/bnum/atot/avgnum/2.0;
    }
    else {
      gb[0] = 0.0;
      gb[1] = 0.0;
    }
    fprintf(fpxvgb,"%lg %lg %lg\n", rlow, gb[0], gb[1]);
  }
    printf("%lg %lg %lg %lg %lg\n",gr_b_3d[0][bin], bnum, atot, avgnum,  gb[0]);
  ffclose(fpxvgb);

  ind = 0;
  bnum = ((double) anum_AVG)/atot;
  fprintf(fpxvg,"# Average, index = %d, bnum = %lg \n",ind,bnum);
  fprintf(fpxvg3,"# Average, index = %d, bnum = %lg \n",ind,bnum);
  for (bin=0; bin<rbin; bin++) {
    rlow = ((double) bin)*drbin;
    rhigh = rlow + drbin;
    vol = PI * (rhigh*rhigh - rlow*rlow);
    if (bnum != 0) {
      avgnum = 0.5*bnum*vol/slabv;
      gofra[0] = gr_AVG[0][bin]/bnum/atot/avgnum;
      gofra[1] = gr_AVG[1][bin]/bnum/atot/avgnum/2.0;
      gofra_3d = gr_AVG_3d[bin]/bnum/atot/avgnum;
    }
    else {
      gofra[0] = 0.0;
      gofra[1] = 0.0;
      gofra_3d = 0.0;
    }
    fprintf(fpxvg,"%lg %lg %lg\n", rlow, gofra[0], gofra[1]);
    fprintf(fpxvg3,"%lg %lg\n", rlow, gofra_3d);
  }
  ind ++;
  fprintf(fpxvg," \n");
  fprintf(fpxvg," \n");
  fprintf(fpxvg3," \n");
  fprintf(fpxvg3," \n");
    printf("%lg %lg %lg %lg %lg\n",gr_b_3d[0][bin], bnum, atot, avgnum,  gb[0]);


  bnum = ((double) anum_UL)/atot;
  fprintf(fpxvg,"# Upper GDS, index = %d, bnum = %lg \n",ind,bnum);
  fprintf(fpxvg3,"# Upper GDS, index = %d, bnum = %lg \n",ind,bnum);
  for (bin=0; bin<rbin; bin++) {
    rlow = ((double) bin)*drbin;
    rhigh = rlow + drbin;
    vol = PI * (rhigh*rhigh - rlow*rlow);
    if (bnum != 0) {
      avgnum = bnum*vol/slabv;
      gofra[0] = gr_UL[0][bin]/bnum/atot/avgnum;
      gofra[1] = gr_UL[1][bin]/bnum/atot/avgnum/2.0;
      gofra_3d = gr_UL_3d[bin]/bnum/atot/avgnum;
    }
    else {
      gofra[0] = 0.0;
      gofra[1] = 0.0;
      gofra_3d = 0.0;
    }
    fprintf(fpxvg,"%lg %lg %lg \n", rlow, gofra[0], gofra[1]);
    fprintf(fpxvg3,"%lg %lg \n", rlow, gofra_3d);
  }
  ind ++;
  fprintf(fpxvg," \n");
  fprintf(fpxvg," \n");
  fprintf(fpxvg3," \n");
  fprintf(fpxvg3," \n");
    printf("%lg %lg %lg %lg %lg\n",gr_b_3d[0][bin], bnum, atot, avgnum,  gb[0]);


  bnum = ((double) anum_LL)/atot;
  fprintf(fpxvg,"# Lower GDS, index = %d, bnum = %lg \n",ind,bnum);
  fprintf(fpxvg3,"# Lower GDS, index = %d, bnum = %lg \n",ind,bnum);
  for (bin=0; bin<rbin; bin++) {
    rlow = ((double) bin)*drbin;
    rhigh = rlow + drbin;
    vol = PI * (rhigh*rhigh - rlow*rlow);
    if (bnum != 0) {
      avgnum = bnum*vol/slabv;
      gofra[0] = gr_LL[0][bin]/bnum/atot/avgnum;
      gofra[1] = gr_LL[1][bin]/bnum/atot/avgnum/2.0;
      gofra_3d = gr_LL_3d[bin]/bnum/atot/avgnum;
    }
    else {
      gofra[0] = 0.0;
      gofra[1] = 0.0;
      gofra_3d = 0.0;
    }
    fprintf(fpxvg,"%lg %lg %lg \n", rlow, gofra[0], gofra[1]);
    fprintf(fpxvg3,"%lg %lg \n", rlow, gofra_3d);
  }
  ind ++;
  fprintf(fpxvg," \n");
  fprintf(fpxvg," \n");
  fprintf(fpxvg3," \n");
  fprintf(fpxvg3," \n");
  ffclose(fpxvg3);
    printf("%lg %lg %lg %lg %lg\n",gr_b_3d[0][bin], bnum, atot, avgnum,  gb[0]);


  countbin = 0;
  snew(gravg,rbin);
  for (zi=zibbin; zi<ziebin; zi++) {
    dist = ((double) zi)*dz;
    if ((dist<=gdshi) && (dist>=gdslo)) {
      countbin++;
    }
    bnum = ((double) anum[zi])/atot;
    fprintf(fpxvg,"# zloc = %lg, zi = %d, index = %d, bnum = %lg \n", \
      dist,zi,ind,bnum);
    for (bin=0; bin<rbin; bin++) {
      rlow = ((double) bin)*drbin;
      rhigh = rlow + drbin;
      vol = PI * (rhigh*rhigh - rlow*rlow);
      if (bnum != 0) {
    avgnum = bnum*vol/slabv;
    gofr = gr[zi][bin]/bnum/atot/avgnum;
    gofrh = grh[zi][bin]/bnum/atot/avgnum/2;
      }
      else {
    gofr = 0.0;
    gofrh = 0.0;
      }
      fprintf(fpxvg,"%lg %lg  %lg \n", rlow, gofr, gofrh);
      if ((dist<=gdshi) && (dist>=gdslo)) {
    gravg[bin] += gofr;
      }
    }
    ind ++;
    fprintf(fpxvg," \n");
    fprintf(fpxvg," \n");
  }
  fprintf(fpxvg,"#Average, index = %d \n",ind);
    printf("%lg %lg %lg %lg %lg\n",gr_b_3d[0][bin], bnum, atot, avgnum,  gb[0]);

  for (bin=0; bin<rbin; bin++) {
    rlow = ((double) bin)*drbin;
    fprintf(fpxvg,"%lg %lg \n", rlow, gravg[bin]/((double) countbin));
  }

  ffclose(fpxvg);
  sfree(anum);
  sfree(gr);
  sfree(gravg);

  thanx(stderr);
 
  return 0;
}


搜索更多相关主题的帖子: function passing linux warning include 
2015-09-04 15:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-457001-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.675833 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved