/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
*
- *
+ *
* This source code is part of
- *
+ *
* G R O M A C S
- *
+ *
* GROningen MAchine for Chemical Simulations
- *
+ *
* VERSION 4.0.5
* Written by Christoph Junghans, Brad Lambeth, and possibly others.
* Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
* 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:
* GROningen Mixture of Alchemy and Childrens' Stories
*/
-
+
#include "adress.h"
#include "maths.h"
#include "pbc.h"
#include "typedefs.h"
#include "vec.h"
-real
+real
adress_weight(rvec x,
int adresstype,
real adressr,
sqr_dl = 0.0;
- if (pbc)
+ if (pbc)
{
pbc_dx(pbc,(*ref),x,dx);
- }
- else
+ }
+ else
{
rvec_sub((*ref),x,dx);
}
case eAdressOff:
/* default to explicit simulation */
return 1;
- case eAdressConst:
+ case eAdressConst:
/* constant value for weighting function = adressw */
return fr->adress_const_wf;
- case eAdressXSplit:
+ case eAdressXSplit:
/* plane through center of ref, varies in x direction */
sqr_dl = dx[0]*dx[0];
break;
/* default to explicit simulation */
return 1;
}
-
+
dl=sqrt(sqr_dl);
-
+
/* molecule is coarse grained */
if (dl > l2)
{
/* Since this is center of mass AdResS, the vsite is not guaranteed
- * to be on the same node as the constructing atoms. Therefore we
+ * to be on the same node as the constructing atoms. Therefore we
* loop over the charge groups, calculate their center of mass,
* then use this to calculate wf for each atom. This wastes vsite
* construction, but it's the only way to assure that the explicit
cg0,cg1);
#endif
cgindex = cgs->index;
-
+
/* Compute the center of mass for all charge groups */
- for(icg=cg0; (icg<cg1); icg++)
+ for(icg=cg0; (icg<cg1); icg++)
{
k0 = cgindex[icg];
k1 = cgindex[icg+1];
if (mtot > 0.0)
{
inv_mtot = 1.0/mtot;
-
+
clear_rvec(ix);
for(k=k0; (k<k1); k++)
{
adress_set_kernel_flags(n_ex, n_hyb, n_cg, mdatoms);
-
+
}
void update_adress_weights_atom_per_atom(
int cg0,
* This is an approximation
* as in the theory requires an interpolation based on the center of masses.
* Should be used with caution */
-
+
for (icg = cg0; (icg < cg1); icg++) {
k0 = cgindex[icg];
k1 = cgindex[icg + 1];
* Loop over vsite types, calculate the weight of the vsite,
* then assign that weight to the constructing atoms. */
- for(ftype=0; (ftype<F_NRE); ftype++)
+ for(ftype=0; (ftype<F_NRE); ftype++)
{
- if (interaction_function[ftype].flags & IF_VSITE)
+ if (interaction_function[ftype].flags & IF_VSITE)
{
nra = interaction_function[ftype].nratoms;
nr = ilist[ftype].nr;
ia = ilist[ftype].iatoms;
-
- for(i=0; (i<nr); )
+
+ for(i=0; (i<nr); )
{
/* The vsite and first constructing atom */
avsite = ia[1];
break;
case F_VSITEN:
inc = 3*ip[ia[0]].vsiten.n;
- for(j=3; j<inc; j+=3)
+ for(j=3; j<inc; j+=3)
{
ai = ia[j+2];
wf[ai] = wf[avsite];
* We still can't be sure that the vsite and constructing
* atoms are on the same processor, so we must calculate
* in the same way as com adress. */
-
- for(icg=cg0; (icg<cg1); icg++)
+
+ for(icg=cg0; (icg<cg1); icg++)
{
k0 = cgindex[icg];
k1 = cgindex[icg+1];
ATFtab = fr->atf_tabs[DEFAULT_TF_TABLE].tab;
tabscale = fr->atf_tabs[DEFAULT_TF_TABLE].scale;
}
-
+
fscal = 0;
if (pbc)
{
rvec_sub((*ref),x[iatom],dr);
}
-
-
+
+
/* calculate distace to adress center again */
sqr_dl =0.0;
/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
*
- *
+ *
* This source code is part of
- *
+ *
* G R O M A C S
- *
+ *
* GROningen MAchine for Chemical Simulations
- *
+ *
* VERSION 4.0.5
* Written by Christoph Junghans, Brad Lambeth, and possibly others.
* Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
* 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:
* GROningen Mixture of Alchemy and Childrens' Stories
*/
* eAdressSphere - spherical splitting with ref as center
* else - weight = 1 - explicit simulation
* \param[in] adressr radius/size of the explicit zone
- * \param[in] adressw size of the hybrid zone
+ * \param[in] adressw size of the hybrid zone
* \param[in] ref center of the explicit zone
* for adresstype 1 - unused
* for adresstype 2 - only ref[0] is used
- * \param[in] pbc for calculating shortest distance to ref
+ * \param[in] pbc pbc struct for calculating shortest distance
+ * \param[in] fr the forcerec containing all the parameters
*
* \return weight of the particle
*
*/
-real
+real
adress_weight(rvec x,
int adresstype,
real adressr,
* \param[in,out] fplog log file in case of debug
* \param[in] cg0 first charge group to update
* \param[in] cg1 last+1 charge group to update
- * \param[in] cgs block containing the cg index
- * \param[in] x array with all the particle positions
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
* \param[in] fr the forcerec containing all the parameters
* \param[in,out] mdatoms the struct containing all the atoms properties
* \param[in] pbc for shortest distance in adress_weight
*
* \param[in] ip contains interaction parameters, in this case the number of constructing atoms n for vsitesn
* \param[in] ilist list of interaction types, in this case the virtual site types are what's important
- * \param[in] x array with all the particle positions
+ * \param[in] x array with all the particle positions
* \param[in] fr the forcerec containing all the parameters
* \param[in,out] mdatoms the struct containing all the atoms properties
* \param[in] pbc for shortest distance in adress_weight
t_forcerec * fr,
t_mdatoms * mdatoms,
t_pbc * pbc);
+
/** \brief update the weight of all coarse-grained particles in several charge groups for atom vsites
*
* \param[in] cg0 first charge group to update
* \param[in] cg1 last+1 charge group to update
- * \param[in] cgs block containing the cg index
- * \param[in] x array with all the particle positions
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
* \param[in] fr the forcerec containing all the parameters
* \param[in,out] mdatoms the struct containing all the atoms properties
* \param[in] pbc for shortest distance in adress_weight
t_mdatoms * mdatoms,
t_pbc * pbc);
+/** \brief update the weight on per atom basis of all coarse-grained particles in several charge groups for atom vsites
+ *
+ * \param[in] cg0 first charge group to update
+ * \param[in] cg1 last+1 charge group to update
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in,out] mdatoms the struct containing all the atoms properties
+ * \param[in] pbc for shortest distance in adress_weight
+ */
void
update_adress_weights_atom_per_atom(int cg0,
int cg1,
*
* \param[in] cg0 first charge group to update
* \param[in] cg1 last+1 charge group to update
- * \param[in] cgs block containing the cg index
- * \param[in] x array with all the particle positions
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
* \param[in,out] f the force array pointing at f_novirsum from sim_util.c
* \param[in] fr the forcerec containing all the parameters
* \param[in] mdatoms the struct containing all the atoms properties
t_mdatoms * mdatoms,
t_pbc * pbc);
+
+/** \brief checks weather a cpu calculates only coarse-grained or explicit interactions
+ *
+ * \param[in] n_ex number of explicit particles
+ * \param[in] n_hyb number of hybrid particles
+ * \param[in] n_cg number of coarse-grained particles
+ * \param[in,out] mdatoms the struct containing all the atoms properties
+ */
void adress_set_kernel_flags(int n_ex, int n_hyb, int n_cg, t_mdatoms * mdatoms);
-/* functions to look up if a energy group is explicit or coarse-grained*/
+/** \brief looks up if a energy group is explicit
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in] egp_nr energy group number
+ * \return boolean if explicit or not
+ */
gmx_bool egp_explicit(t_forcerec * fr, int egp_nr);
+
+/** \brief looks up if a energy group is coarse-grained
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in] egp_nr energy group number
+ * \return boolean if coarse-grained or not
+ */
gmx_bool egp_coarsegrained(t_forcerec * fr, int egp_nr);
#endif