* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
#include <math.h>
-#include "typedefs.h"
-#include "mdatoms.h"
-#include "smalloc.h"
-#include "main.h"
-#include "qmmm.h"
-#include "mtop_util.h"
-#include "gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/qmmm.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/utility/smalloc.h"
#define ALMOST_ZERO 1e-30
void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
int nindex, int *index,
- int start, int homenr,
+ int homenr,
t_mdatoms *md)
{
+ gmx_bool bLJPME;
gmx_mtop_atomlookup_t alook;
int i;
t_grpopts *opts;
- real c6, c12;
gmx_groups_t *groups;
gmx_molblock_t *molblock;
+ bLJPME = EVDW_PME(ir->vdwtype);
+
opts = &ir->opts;
groups = &mtop->groups;
molblock = mtop->molblock;
- /* Index==NULL indicates particle decomposition,
- * unless we have an empty DD node, so also check for homenr and start.
- * This should be signaled properly with an extra parameter or nindex==-1.
+ /* Index==NULL indicates no DD (unless we have a DD node with no
+ * atoms), so also check for homenr. This should be
+ * signaled properly with an extra parameter or nindex==-1.
*/
- if (index == NULL && (homenr > 0 || start > 0))
+ if (index == NULL && (homenr > 0))
{
md->nr = mtop->natoms;
}
srenew(md->massT, md->nalloc);
srenew(md->invmass, md->nalloc);
srenew(md->chargeA, md->nalloc);
- srenew(md->c6A, md->nalloc);
- srenew(md->sigmaA, md->nalloc);
- srenew(md->sigma3A, md->nalloc);
+ if (bLJPME)
+ {
+ srenew(md->sqrt_c6A, md->nalloc);
+ srenew(md->sigmaA, md->nalloc);
+ srenew(md->sigma3A, md->nalloc);
+ }
if (md->nPerturbed)
{
srenew(md->chargeB, md->nalloc);
- srenew(md->c6B, md->nalloc);
- srenew(md->sigmaB, md->nalloc);
- srenew(md->sigma3B, md->nalloc);
+ if (bLJPME)
+ {
+ srenew(md->sqrt_c6B, md->nalloc);
+ srenew(md->sigmaB, md->nalloc);
+ srenew(md->sigma3B, md->nalloc);
+ }
}
srenew(md->typeA, md->nalloc);
if (md->nPerturbed)
{
int g, ag, molb;
real mA, mB, fac;
+ real c6, c12;
t_atom *atom;
if (index == NULL)
}
md->chargeA[i] = atom->q;
md->typeA[i] = atom->type;
- c6 = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c6;
- c12 = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c12;
- md->c6A[i] = sqrt(c6);
- if (c6 == 0.0 || c12 == 0.0)
- {
- md->sigmaA[i] = 1.0;
- }
- else
+ if (bLJPME)
{
- md->sigmaA[i] = pow(c12/c6, 1.0/6.0);
+ c6 = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c6;
+ c12 = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c12;
+ md->sqrt_c6A[i] = sqrt(c6);
+ if (c6 == 0.0 || c12 == 0)
+ {
+ md->sigmaA[i] = 1.0;
+ }
+ else
+ {
+ md->sigmaA[i] = pow(c12/c6, 1.0/6.0);
+ }
+ md->sigma3A[i] = 1/(md->sigmaA[i]*md->sigmaA[i]*md->sigmaA[i]);
}
- md->sigma3A[i] = 1/(md->sigmaA[i]*md->sigmaA[i]*md->sigmaA[i]);
-
if (md->nPerturbed)
{
+ md->bPerturbed[i] = PERTURBED(*atom);
md->chargeB[i] = atom->qB;
md->typeB[i] = atom->typeB;
- c6 = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c6;
- c12 = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c12;
- md->c6B[i] = sqrt(c6);
- if (c6 == 0.0 || c12 == 0.0)
- {
- md->sigmaB[i] = 1.0;
- }
- else
+ if (bLJPME)
{
- md->sigmaB[i] = pow(c12/c6, 1.0/6.0);
+ c6 = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c6;
+ c12 = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c12;
+ md->sqrt_c6B[i] = sqrt(c6);
+ if (c6 == 0.0 || c12 == 0)
+ {
+ md->sigmaB[i] = 1.0;
+ }
+ else
+ {
+ md->sigmaB[i] = pow(c12/c6, 1.0/6.0);
+ }
+ md->sigma3B[i] = 1/(md->sigmaB[i]*md->sigmaB[i]*md->sigmaB[i]);
}
- md->bPerturbed[i] = PERTURBED(*atom);
- md->sigma3B[i] = 1/(md->sigmaB[i]*md->sigmaB[i]*md->sigmaB[i]);
}
md->ptype[i] = atom->ptype;
if (md->cTC)
gmx_mtop_atomlookup_destroy(alook);
- md->start = start;
md->homenr = homenr;
md->lambda = 0;
}