• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ rvec_dec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rvec_dec函数的典型用法代码示例。如果您正苦于以下问题:C++ rvec_dec函数的具体用法?C++ rvec_dec怎么用?C++ rvec_dec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rvec_dec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: reset_x_ndim

void reset_x_ndim(int ndim,int ncm,atom_id ind_cm[],
		  int nreset,atom_id *ind_reset,rvec x[],real mass[])
{
  int  i,m,ai;
  rvec xcm;
  real tm,mm;
  
  tm=0.0;
  clear_rvec(xcm);
  for(i=0; i<ncm; i++) {
    ai=ind_cm[i];
    mm=mass[ai];
    for(m=0; m<ndim; m++)
      xcm[m]+=mm*x[ai][m];
    tm+=mm;
  }
  for(m=0; m<ndim; m++)
    xcm[m]/=tm;
    
  if (ind_reset)
    for(i=0; i<nreset; i++)
      rvec_dec(x[ind_reset[i]],xcm);
  else
    for(i=0; i<nreset; i++)
      rvec_dec(x[i],xcm);
}
开发者ID:BioinformaticsArchive,项目名称:GromPy,代码行数:26,代码来源:do_fit.c


示例2: reset_x_ndim

void reset_x_ndim(int ndim,int ncm,const atom_id *ind_cm,
                  int nreset,const atom_id *ind_reset,
                  rvec x[],const real mass[])
{
    int  i,m,ai;
    rvec xcm;
    real tm,mm;

    if (ndim>DIM)
    {
        gmx_incons("More than 3 dimensions not supported.");
    }
    tm = 0.0;
    clear_rvec(xcm);
    if (ind_cm != NULL)
    {
        for(i=0; i<ncm; i++)
        {
            ai = ind_cm[i];
            mm = mass[ai];
            for(m=0; m<ndim; m++)
            {
                xcm[m] += mm*x[ai][m];
            }
            tm += mm;
        }
    }
    else
    {
        for(i=0; i<ncm; i++)
        {
            mm = mass[i];
            for(m=0; m<ndim; m++)
            {
                xcm[m] += mm*x[i][m];
            }
            tm += mm;
        }
    }
    for(m=0; m<ndim; m++)
    {
        xcm[m] /= tm;
    }

    if (ind_reset != NULL)
    {
        for(i=0; i<nreset; i++)
        {
            rvec_dec(x[ind_reset[i]],xcm);
        }
    }
    else
    {
        for(i=0; i<nreset; i++)
        {
            rvec_dec(x[i],xcm);
        }
    }
}
开发者ID:enasyunis,项目名称:gromacs,代码行数:59,代码来源:do_fit.c


示例3: calc_axes

static void calc_axes(rvec x[],t_atom atom[],int gnx[],atom_id *index[],
		      gmx_bool bRot,t_bundle *bun)
{
  int  end,i,div,d;
  real *mtot,m;
  rvec axis[MAX_ENDS],cent;
  
  snew(mtot,bun->n);

  for(end=0; end<bun->nend; end++) {
    for(i=0; i<bun->n; i++) {
      clear_rvec(bun->end[end][i]);
      mtot[i] = 0;
    }
    div = gnx[end]/bun->n;
    for(i=0; i<gnx[end]; i++) {
      m = atom[index[end][i]].m;
      for(d=0; d<DIM; d++)
	bun->end[end][i/div][d] += m*x[index[end][i]][d];
      mtot[i/div] += m;
    }
    clear_rvec(axis[end]);
    for(i=0; i<bun->n; i++) {
      svmul(1.0/mtot[i],bun->end[end][i],bun->end[end][i]);
      rvec_inc(axis[end],bun->end[end][i]);
    }
    svmul(1.0/bun->n,axis[end],axis[end]);
  }
  sfree(mtot);

  rvec_add(axis[0],axis[1],cent);
  svmul(0.5,cent,cent);
  /* center the bundle on the origin */
  for(end=0; end<bun->nend; end++) {
    rvec_dec(axis[end],cent);
    for(i=0; i<bun->n; i++)
      rvec_dec(bun->end[end][i],cent);
  }
  if (bRot) {
    /* rotate the axis parallel to the z-axis */
    rotate_ends(bun,axis[0],YY,ZZ);
    rotate_ends(bun,axis[0],XX,ZZ);
  }
  for(i=0; i<bun->n; i++) {
    rvec_add(bun->end[0][i],bun->end[1][i],bun->mid[i]);
    svmul(0.5,bun->mid[i],bun->mid[i]);
    rvec_sub(bun->end[0][i],bun->end[1][i],bun->dir[i]);
    bun->len[i] = norm(bun->dir[i]);
    unitv(bun->dir[i],bun->dir[i]);
  }
}
开发者ID:andersx,项目名称:gmx-debug,代码行数:51,代码来源:gmx_bundle.c


示例4: prep_data

/* prepare the coordinates by removing periodic boundary crossings.
   gnx = the number of atoms/molecules
   index = the indices
   xcur = the current coordinates
   xprev = the previous coordinates
   box = the box matrix */
static void prep_data(gmx_bool bMol,int gnx,atom_id index[],
		      rvec xcur[],rvec xprev[],matrix box)
{
    int  i,m,ind;
    rvec hbox;

    /* Remove periodicity */
    for(m=0; (m<DIM); m++)
        hbox[m]=0.5*box[m][m];
    
    for(i=0; (i<gnx); i++) {
        if (bMol)
            ind = i;
        else
            ind = index[i];

        for(m=DIM-1; m>=0; m--) 
        {
            while(xcur[ind][m]-xprev[ind][m] <= -hbox[m])
                rvec_inc(xcur[ind],box[m]);
            while(xcur[ind][m]-xprev[ind][m] >  hbox[m])
                rvec_dec(xcur[ind],box[m]);
        }      
    }
}
开发者ID:BradleyDickson,项目名称:ABPenabledGROMACS,代码行数:31,代码来源:gmx_msd.c


示例5: center_coords

static void center_coords(t_atoms *atoms, matrix box, rvec x0[], int axis)
{
    int  i, m;
    real tmass, mm;
    rvec com, shift, box_center;

    tmass = 0;
    clear_rvec(com);
    for (i = 0; (i < atoms->nr); i++)
    {
        mm     = atoms->atom[i].m;
        tmass += mm;
        for (m = 0; (m < DIM); m++)
        {
            com[m] += mm*x0[i][m];
        }
    }
    for (m = 0; (m < DIM); m++)
    {
        com[m] /= tmass;
    }
    calc_box_center(ecenterDEF, box, box_center);
    rvec_sub(box_center, com, shift);
    shift[axis] -= box_center[axis];

    for (i = 0; (i < atoms->nr); i++)
    {
        rvec_dec(x0[i], shift);
    }
}
开发者ID:tanigawa,项目名称:gromacs,代码行数:30,代码来源:gmx_densorder.cpp


示例6: do_stopcm_grp

void do_stopcm_grp(FILE *fp,int start,int homenr,unsigned short *group_id,
		   rvec x[],rvec v[],t_vcm *vcm)
{
  int  i,g,m;
  real tm,tm_1;
  rvec dv,dx;
  
  if (vcm->mode != ecmNO) {
    /* Subtract linear momentum */
    g = 0;
    switch (vcm->ndim) {
    case 1:
      for(i=start; (i<start+homenr); i++) {
	if (group_id)
	  g = group_id[i];
	v[i][XX] -= vcm->group_v[g][XX];
      }
      break;
    case 2:
      for(i=start; (i<start+homenr); i++) {
	if (group_id)
	  g = group_id[i];
	v[i][XX] -= vcm->group_v[g][XX];
	v[i][YY] -= vcm->group_v[g][YY];
      }
      break;
    case 3:
      for(i=start; (i<start+homenr); i++) {
	if (group_id)
	  g = group_id[i];
	rvec_dec(v[i],vcm->group_v[g]);
      }
      break;
    }
    if (vcm->mode == ecmANGULAR) {
      /* Subtract angular momentum */
      for(i=start; (i<start+homenr); i++) {
	if (group_id)
	  g = group_id[i];
	/* Compute the correction to the velocity for each atom */
	rvec_sub(x[i],vcm->group_x[g],dx);
	cprod(vcm->group_w[g],dx,dv);
	rvec_dec(v[i],dv);
      }
    }
  }
}
开发者ID:TTarenzi,项目名称:MMCG-HAdResS,代码行数:47,代码来源:vcm.c


示例7: my_sub_xcm

static void my_sub_xcm(int nbb,atom_id bbind[],rvec x[],rvec xcm)
{
  int i,ai;
  
  for(i=0; (i<nbb); i++) {
    ai=bbind[i];
    rvec_dec(x[ai],xcm);
  }
}
开发者ID:BioinformaticsArchive,项目名称:GromPy,代码行数:9,代码来源:fitahx.c


示例8: sub_xcm

real sub_xcm(rvec x[], int gnx, atom_id *index, t_atom atom[], rvec xcm,
             gmx_bool bQ)
{
    int  i, ii;
    real tm;

    tm = calc_xcm(x, gnx, index, atom, xcm, bQ);
    for (i = 0; (i < gnx); i++)
    {
        ii = index ? index[i] : i;
        rvec_dec(x[ii], xcm);
    }
    return tm;
}
开发者ID:dkarkoulis,项目名称:gromacs,代码行数:14,代码来源:princ.c


示例9: center_molecule

static void center_molecule(int atomCount, rvec x[])
{
    rvec center;
    clear_rvec(center);
    for (int i = 0; i < atomCount; ++i)
    {
        rvec_inc(center, x[i]);
    }
    svmul(1.0/atomCount, center, center);
    for (int i = 0; i < atomCount; ++i)
    {
        rvec_dec(x[i], center);
    }
}
开发者ID:mokmonteiro,项目名称:gromacs,代码行数:14,代码来源:insert-molecules.cpp


示例10: correct_box_elem

static int correct_box_elem(FILE *fplog, int step, tensor box, int v, int d)
{
    int shift, maxshift = 10;

    shift = 0;

    /* correct elem d of vector v with vector d */
    while (box[v][d] > BOX_MARGIN_CORRECT*0.5*box[d][d])
    {
        if (fplog)
        {
            fprintf(fplog, "Step %d: correcting invalid box:\n", step);
            pr_rvecs(fplog, 0, "old box", box, DIM);
        }
        rvec_dec(box[v], box[d]);
        shift--;
        if (fplog)
        {
            pr_rvecs(fplog, 0, "new box", box, DIM);
        }
        if (shift <= -maxshift)
        {
            gmx_fatal(FARGS,
                      "Box was shifted at least %d times. Please see log-file.",
                      maxshift);
        }
    }
    while (box[v][d] < -BOX_MARGIN_CORRECT*0.5*box[d][d])
    {
        if (fplog)
        {
            fprintf(fplog, "Step %d: correcting invalid box:\n", step);
            pr_rvecs(fplog, 0, "old box", box, DIM);
        }
        rvec_inc(box[v], box[d]);
        shift++;
        if (fplog)
        {
            pr_rvecs(fplog, 0, "new box", box, DIM);
        }
        if (shift >= maxshift)
        {
            gmx_fatal(FARGS,
                      "Box was shifted at least %d times. Please see log-file.",
                      maxshift);
        }
    }

    return shift;
}
开发者ID:yhalcyon,项目名称:Gromacs,代码行数:50,代码来源:pbc.c


示例11: copy_mat

void
BoxDeformation::apply(ArrayRef<RVec> x,
                      matrix         box,
                      int64_t        step)
{
    matrix updatedBox, invbox, mu;

    double elapsedTime = (step + 1 - initialStep_) * timeStep_;
    copy_mat(box, updatedBox);
    for (int i = 0; i < DIM; i++)
    {
        for (int j = 0; j < DIM; j++)
        {
            if (deformationTensor_[i][j] != 0)
            {
                updatedBox[i][j] =
                    referenceBox_[i][j] + elapsedTime * deformationTensor_[i][j];
            }
        }
    }
    /* We correct the off-diagonal elements,
     * which can grow indefinitely during shearing,
     * so the shifts do not get messed up.
     */
    for (int i = 1; i < DIM; i++)
    {
        for (int j = i-1; j >= 0; j--)
        {
            while (updatedBox[i][j] - box[i][j] > 0.5 * updatedBox[j][j])
            {
                rvec_dec(updatedBox[i], updatedBox[j]);
            }
            while (updatedBox[i][j] - box[i][j] < -0.5 * updatedBox[j][j])
            {
                rvec_inc(updatedBox[i], updatedBox[j]);
            }
        }
    }
    invertBoxMatrix(box, invbox);
    // Return the updated box
    copy_mat(updatedBox, box);
    mmul_ur0(box, invbox, mu);

    for (auto &thisX : x)
    {
        thisX[XX] = mu[XX][XX]*thisX[XX] + mu[YY][XX]*thisX[YY] + mu[ZZ][XX]*thisX[ZZ];
        thisX[YY] = mu[YY][YY]*thisX[YY] + mu[ZZ][YY]*thisX[ZZ];
        thisX[ZZ] = mu[ZZ][ZZ]*thisX[ZZ];
    }
}
开发者ID:friforever,项目名称:gromacs,代码行数:50,代码来源:boxdeformation.cpp


示例12: print_constraint

void print_constraint(t_pull *pull, rvec *f, int step, matrix box, int niter) 
{
  int i,ii,m; 
  rvec tmp,tmp2,tmp3;

  for (i=0;i<pull->pull.n;i++) {
    if (pull->bCyl) 
      rvec_sub(pull->pull.x_con[i],pull->dyna.x_con[i],tmp);
    else 
      rvec_sub(pull->pull.x_con[i],pull->ref.x_con[0],tmp);
    for (m=DIM-1; m>=0; m--) {
      if (tmp[m] < -0.5*box[m][m]) rvec_inc(tmp,box[m]);
      if (tmp[m] >  0.5*box[m][m]) rvec_dec(tmp,box[m]);
      tmp[m] *= pull->dims[m];
    }
    if (pull->bVerbose) 
      fprintf(pull->out,"%d:%d ds:%e f:%e n:%d\n", step,i,norm(tmp),
	      pull->pull.f[i][ZZ],niter);
    else
      fprintf(pull->out,"%e ",pull->pull.f[i][ZZ]);
  }

  if (!pull->bVerbose)
    fprintf(pull->out,"\n");

  /* DEBUG */ /* this code doesn't correct for pbc, needs improvement */
  if (pull->bVerbose) {
    for (i=0;i<pull->pull.n;i++) {
      if (pull->bCyl) 
	fprintf(pull->out,"eConstraint: step %d. Refgroup = dynamic (%f,%f\n"
		"Group %d (%s): ref. dist = %8.3f, unconstr. dist = %8.3f"
		" con. dist = %8.3f f_i = %8.3f\n", step, pull->r,pull->rc,
		i,pull->pull.grps[i],
		pull->dyna.x_ref[i][ZZ]-pull->pull.x_ref[i][ZZ],
		pull->dyna.x_unc[i][ZZ]-pull->pull.x_unc[i][ZZ],
		pull->dyna.x_con[i][ZZ]-pull->pull.x_con[i][ZZ],
		pull->pull.f[i][ZZ]);
      else {
	rvec_sub(pull->ref.x_ref[0],pull->pull.x_ref[i],tmp);
	rvec_sub(pull->ref.x_unc[0],pull->pull.x_unc[i],tmp2);
	rvec_sub(pull->ref.x_con[0],pull->pull.x_con[i],tmp3);
	fprintf(stderr,"grp %d:ref (%8.3f,%8.3f,%8.3f) unc(%8.3f%8.3f%8.3f\n"
		"con (%8.3f%8.3f%8.3f)\n",i, tmp[0],tmp[1],tmp[2],
		tmp2[0],tmp2[1],tmp2[2],tmp3[0],tmp3[1],tmp3[2]);
      }
    }
  } /* END DEBUG */

}
开发者ID:Chadi-akel,项目名称:cere,代码行数:49,代码来源:pullio.c


示例13: prep_data

/* prepare the coordinates by removing periodic boundary crossings.
   gnx = the number of atoms/molecules
   index = the indices
   xcur = the current coordinates
   xprev = the previous coordinates
   box = the box matrix */
static void prep_data(gmx_bool bMol, int gnx, int index[],
                      rvec xcur[], rvec xprev[], matrix box)
{
    int  i, m, ind;
    rvec hbox;

    /* Remove periodicity */
    for (m = 0; (m < DIM); m++)
    {
        hbox[m] = 0.5*box[m][m];
    }

    for (i = 0; (i < gnx); i++)
    {
        if (bMol)
        {
            ind = i;
        }
        else
        {
            ind = index[i];
        }

        for (m = DIM-1; m >= 0; m--)
        {
            if (hbox[m] == 0)
            {
                continue;
            }
            while (xcur[ind][m]-xprev[ind][m] <= -hbox[m])
            {
                rvec_inc(xcur[ind], box[m]);
            }
            while (xcur[ind][m]-xprev[ind][m] >  hbox[m])
            {
                rvec_dec(xcur[ind], box[m]);
            }
        }
    }
}
开发者ID:MichalKononenko,项目名称:gromacs,代码行数:46,代码来源:gmx_msd.cpp


示例14: correct_t0_pbc

void correct_t0_pbc(t_pull *pull, rvec x[], t_mdatoms *md, matrix box) {
  int i,ii,j,m;
  real tm;
  rvec com,dx;

  /* loop over all atoms in index for group i. Check if they moved
     more than half a box with respect to xp. If so add/subtract a box 
     from x0. Copy x to xp.
   */
  for (i=0;i<pull->ref.ngx[0];i++) {
    ii = pull->ref.idx[0][i];
    
    /* correct for jumps across the box */
    rvec_sub(x[ii],pull->ref.xp[0][i],dx);
    for (m=DIM-1; m>=0; m--) {
      if (dx[m] < -0.5*box[m][m]) {
	rvec_inc(dx,box[m]);
	if (pull->bVerbose && fabs(pull->dims[m])>GMX_REAL_MIN)
	  fprintf(stderr,"Jumped +box: nr %d dir: %d old:%8.3f\n",ii,m,
		  pull->ref.x0[0][i][m]); 
      }
      
      if (dx[m] >  0.5*box[m][m]) {
	rvec_dec(dx,box[m]);
	if (pull->bVerbose && fabs(pull->dims[m])>GMX_REAL_MIN)
	  fprintf(stderr,"Jumped -box: nr %d dir: %d old:%8.3f\n",ii,m,
		  pull->ref.x0[0][i][m]); 
      }

      pull->ref.x0[0][i][m] += dx[m];
      pull->ref.xp[0][i][m]  = x[ii][m];
    }
  }
  tm = calc_com2(pull->ref.x0[0],pull->ref.ngx[0],pull->ref.idx[0],
		 md,com,box);
  if (pull->bVerbose) 
    fprintf(stderr,"correct_t0: Group %s: mass:%8.3f com:%8.3f%8.3f%8.3f\n",
	    pull->ref.grps[0],tm,com[0],com[1],com[2]);
}
开发者ID:Chadi-akel,项目名称:cere,代码行数:39,代码来源:pullutil.c


示例15: calc_com2

/* calculates com of all atoms in x[], *index has their index numbers
   to get the masses from atom[] */
real calc_com2(rvec x[],int gnx,atom_id *index,t_mdatoms *md,rvec com,
	       matrix box)
{
  int  i,ii,m;
  real m0,tm;

  clear_rvec(com);
  tm=0;
  for(i=0; (i<gnx); i++) {
    ii=index[i];
    m0=md->massT[ii];
    tm+=m0;
    for(m=0; (m<DIM); m++)
      com[m]+=m0*x[i][m];
  }
  svmul(1/tm,com,com);
  for(m=DIM-1; m>=0; m--) {
    /* next two lines used to be commented out */
    if (com[m] < 0        ) rvec_inc(com,box[m]);
    if (com[m] > box[m][m]) rvec_dec(com,box[m]); 
  }
  return tm;
}
开发者ID:Chadi-akel,项目名称:cere,代码行数:25,代码来源:pullutil.c


示例16: calc_rm_cm

void calc_rm_cm(int isize, atom_id index[], t_atoms *atoms, rvec x[], rvec xcm)
{
    int  i, d;
    real tm, m;

    /* calculate and remove center of mass of reference structure */
    tm = 0;
    clear_rvec(xcm);
    for (i = 0; i < isize; i++)
    {
        m = atoms->atom[index[i]].m;
        for (d = 0; d < DIM; d++)
        {
            xcm[d] += m*x[index[i]][d];
        }
        tm += m;
    }
    svmul(1/tm, xcm, xcm);
    for (i = 0; i < atoms->nr; i++)
    {
        rvec_dec(x[i], xcm);
    }
}
开发者ID:alwanderer,项目名称:gromacs,代码行数:23,代码来源:gmx_confrms.c


示例17: orient_princ

void orient_princ(t_atoms *atoms, int isize, atom_id *index,
                  int natoms, rvec x[], rvec *v, rvec d)
{
    int     i, m;
    rvec    xcm, prcomp;
    matrix  trans;

    calc_xcm(x, isize, index, atoms->atom, xcm, FALSE);
    for (i = 0; i < natoms; i++)
    {
        rvec_dec(x[i], xcm);
    }
    principal_comp(isize, index, atoms->atom, x, trans, prcomp);
    if (d)
    {
        copy_rvec(prcomp, d);
    }

    /* Check whether this trans matrix mirrors the molecule */
    if (det(trans) < 0)
    {
        for (m = 0; (m < DIM); m++)
        {
            trans[ZZ][m] = -trans[ZZ][m];
        }
    }
    rotate_atoms(natoms, NULL, x, trans);
    if (v)
    {
        rotate_atoms(natoms, NULL, v, trans);
    }

    for (i = 0; i < natoms; i++)
    {
        rvec_inc(x[i], xcm);
    }
}
开发者ID:dkarkoulis,项目名称:gromacs,代码行数:37,代码来源:princ.c


示例18: center_coords

void center_coords(t_atoms *atoms, atom_id *index_center, int ncenter,
                   matrix box, rvec x0[])
{
    int  i, k, m;
    real tmass, mm;
    rvec com, shift, box_center;

    tmass = 0;
    clear_rvec(com);
    for (k = 0; (k < ncenter); k++)
    {
        i = index_center[k];
        if (i >= atoms->nr)
        {
            gmx_fatal(FARGS, "Index %d refers to atom %d, which is larger than natoms (%d).",
                      k+1, i+1, atoms->nr);
        }
        mm     = atoms->atom[i].m;
        tmass += mm;
        for (m = 0; (m < DIM); m++)
        {
            com[m] += mm*x0[i][m];
        }
    }
    for (m = 0; (m < DIM); m++)
    {
        com[m] /= tmass;
    }
    calc_box_center(ecenterDEF, box, box_center);
    rvec_sub(box_center, com, shift);

    /* Important - while the center was calculated based on a group, we should move all atoms */
    for (i = 0; (i < atoms->nr); i++)
    {
        rvec_dec(x0[i], shift);
    }
}
开发者ID:schlaicha,项目名称:gromacs,代码行数:37,代码来源:gmx_density.c


示例19: gmx_editconf


//.........这里部分代码省略.........
            real vol,dens;

            vol = det(box);
            dens = (mass*AMU)/(vol*NANO*NANO*NANO);
            fprintf(stderr,"Volume  of input %g (nm^3)\n",vol);
            fprintf(stderr,"Mass    of input %g (a.m.u.)\n",mass);
            fprintf(stderr,"Density of input %g (g/l)\n",dens);
            if (vol==0 || mass==0)
                gmx_fatal(FARGS,"Cannot scale density with "
                          "zero mass (%g) or volume (%g)\n",mass,vol);

            scale[XX] = scale[YY] = scale[ZZ] = pow(dens/rho,1.0/3.0);
            fprintf(stderr,"Scaling all box vectors by %g\n",scale[XX]);
        }
        scale_conf(atoms.nr,x,box,scale);
    }

	if (bAlign) {
		if (bIndex) {
            fprintf(stderr,"\nSelect a group that you want to align:\n");
            get_index(&atoms,ftp2fn_null(efNDX,NFILE,fnm),
                      1,&asize,&aindex,&agrpname);
        } else {
            asize = atoms.nr;
            snew(aindex,asize);
			for (i=0;i<asize;i++)
				aindex[i]=i;
        }
		printf("Aligning %d atoms (out of %d) to %g %g %g, center of rotation %g %g %g\n",asize,natom,
			targetvec[XX],targetvec[YY],targetvec[ZZ],
			aligncenter[XX],aligncenter[YY],aligncenter[ZZ]);
		/*subtract out pivot point*/
		for(i=0; i<asize; i++)
			rvec_dec(x[aindex[i]],aligncenter);
		/*now determine transform and rotate*/
		/*will this work?*/
		principal_comp(asize,aindex,atoms.atom,x, trans,princd);

		unitv(targetvec,targetvec);
		printf("Using %g %g %g as principal axis\n", trans[0][2],trans[1][2],trans[2][2]);
		tmpvec[XX]=trans[0][2]; tmpvec[YY]=trans[1][2]; tmpvec[ZZ]=trans[2][2];
		calc_rotmatrix(tmpvec, targetvec, rotmatrix);
		/* rotmatrix finished */

		for (i=0;i<asize;++i)
		{
			mvmul(rotmatrix,x[aindex[i]],tmpvec);
			copy_rvec(tmpvec,x[aindex[i]]);
		}

		/*add pivot point back*/
		for(i=0; i<asize; i++)
			rvec_inc(x[aindex[i]],aligncenter);
		if (!bIndex)
			sfree(aindex);
	}

    if (bTranslate) {
        if (bIndex) {
            fprintf(stderr,"\nSelect a group that you want to translate:\n");
            get_index(&atoms,ftp2fn_null(efNDX,NFILE,fnm),
                      1,&ssize,&sindex,&sgrpname);
        } else {
            ssize = atoms.nr;
            sindex = NULL;
        }
开发者ID:andersx,项目名称:gmx-debug,代码行数:67,代码来源:gmx_editconf.c


示例20: do_listed_vdw_q


//.........这里部分代码省略.........
             */
            if(ivdw==2)
            {
                gmx_fatal(FARGS,"Cannot do free energy Buckingham interactions.");
            }
            count = 0;
            gmx_nb_free_energy_kernel(icoul,
                                      ivdw,
                                      i1,
                                      &i0,
                                      j_index,
                                      &i1,
                                      &shift_f,
                                      fr->shift_vec[0],
                                      fshift[0],
                                      &gid,
                                      x14[0],
                                      f14[0],
                                      chargeA,
                                      chargeB,
                                      eps,
                                      krf,
                                      crf,
                                      fr->ewaldcoeff,
                                      egcoul,
                                      typeA,
                                      typeB,
                                      ntype,
                                      nbfp,
                                      egnb,
                                      tabscale,
                                      tab,
                                      lambda,
                                      dvdlambda,
                                      fr->sc_alpha,
                                      fr->sc_power,
                                      fr->sc_sigma6_def,
                                      fr->sc_sigma6_min,
                                      TRUE,
                                      &outeriter,
                                      &inneriter);
        }
        else 
        { 
            /* Not perturbed - call kernel 330 */
            nb_kernel330
                ( &i1,
                  &i0,
                  j_index,
                  &i1,
                  &shift_f,
                  fr->shift_vec[0],
                  fshift[0],
                  &gid,
                  x14[0],
                  f14[0],
                  chargeA,
                  &eps,
                  &krf,
                  &crf,
                  egcoul,
                  typeA,
                  &ntype,
                  nbfp,
                  egnb,
                  &tabscale,
                  tab,
                  NULL,
                  NULL,
                  NULL,
                  NULL,
                  &nthreads,
                  &count,
                  (void *)&mtx,
                  &outeriter,
                  &inneriter,
                  NULL);                
        }
        
        /* Add the forces */
        rvec_inc(f[ai],f14[0]);
        rvec_dec(f[aj],f14[0]);

	if (pf_global->bInitialized)
	    pf_atom_add_bonded(pf_global, ai, aj, PF_INTER_NB14, f14[0]);

        if (g) 
        {
            /* Correct the shift forces using the graph */
            ivec_sub(SHIFT_IVEC(g,ai),SHIFT_IVEC(g,aj),dt);    
            shift_vir = IVEC2IS(dt);
            rvec_inc(fshift[shift_vir],f14[0]);
            rvec_dec(fshift[CENTRAL],f14[0]);
        }
        
	    /* flops: eNR_KERNEL_OUTER + eNR_KERNEL330 + 12 */
        }
    }
    return 0.0;
}
开发者ID:chenleo,项目名称:gromacs453pf,代码行数:101,代码来源:nonbonded.c



注:本文中的rvec_dec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rvec_inc函数代码示例发布时间:2022-05-30
下一篇:
C++ rvec_add函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap