[gmx-developers] external potential ?

Gerrit Groenhof G.Groenhof at chem.rug.nl
Wed Feb 11 12:34:39 CET 2004


Hi Michael,
 
In force.c

At any point you can add a force on the particles in the
force function (src/mdlib/force.c)
The particles' forces are in f[], the positions in x[]. Furhter you
might need to acces the mdatoms struct, containing the info
of the particels in the simulation.

So the simplest in my opinion would be something like:

in void force(FILE       *fp,     int        step,
	   t_forcerec *fr,      t_inputrec *ir,
	   t_idef     *idef,    t_nsborder *nsb,
	   t_commrec  *cr,      t_commrec *mcr,
	   t_nrnb     *nrnb,
	   t_groups   *grps,    t_mdatoms  *md,
	   int        ngener,   t_grpopts  *opts,
	   rvec       x[],      rvec       f[],
	   real       epot[],   t_fcdata   *fcd,
	   bool       bVerbose, matrix     box,
	   real       lambda,   t_graph    *graph,
	   t_block    *excl,    bool       bNBFonly,
	   matrix lr_vir,       rvec       mu_tot,
	   real       qsum,     bool       bGatherOnly)
{
  blablabla

  for (i = 0;i<md->nr;i++) /* t_mdatoms *md comtains the info see
	                      mdatoms.h in include/types 
                            */
    {
       check_for_some_criterium(x, ...)
       for(j=0;j<DIM;j++) /*DIM = 3, the number of dimensions*/
         f[i][j]+=whatever_you_want_to_add_as_a_force;
    }

    blablabla

}

Good luck,

Gerrit

> 
> Dear all,
> Can I apply an external potential (possibly tabulated) acting on
> all particles in my simulation box, e.g. a kind of PMF (f(z))
> to represent a surface ?
> If not, where in the source-code would be the best place
> to implement such an external potential ?
> cheers,
> Michael
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the 
> www interface or send it to gmx-developers-request at gromacs.org.
> 




More information about the gromacs.org_gmx-developers mailing list