*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/qmmm.h"
#include "gromacs/legacyheaders/txtdump.h"
#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/utility/fatalerror.h"
void
-F77_FUNC(inigms, IMIGMS) (void);
+ F77_FUNC(inigms, IMIGMS) (void);
void
-F77_FUNC(endgms, ENDGMS) (void);
+ F77_FUNC(endgms, ENDGMS) (void);
void
-F77_FUNC(grads, GRADS) (int *nrqmat, real *qmcrd, int *nrmmat, real *mmchrg,
- real *mmcrd, real *qmgrad, real *mmgrad, real *energy);
+ F77_FUNC(grads, GRADS) (int *nrqmat, real *qmcrd, int *nrmmat, real *mmchrg,
+ real *mmcrd, real *qmgrad, real *mmgrad, real *energy);
* dynamics simulations. 7-6-2002 (London)
*/
int
- i, j, rank;
+ i, j;
FILE
*out;
char
}
}
-real call_gamess(t_commrec *cr, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm,
+real call_gamess(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm,
rvec f[], rvec fshift[])
{
/* do the actual QMMM calculation using GAMESS-UK. In this
* gradient routines linked directly
*/
int
- i, j, rank;
+ i, j;
real
QMener = 0.0, *qmgrad, *mmgrad, *mmcrd, *qmcrd, energy;
t_QMMMrec
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
+#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
-
/* TODO: this should be made thread-safe */
/* Gaussian interface routines */
-void init_gaussian(t_commrec *cr, t_QMrec *qm, t_MMrec *mm)
+void init_gaussian(t_QMrec *qm)
{
- FILE
- *rffile = NULL, *out = NULL;
+ FILE *out = NULL;
ivec
- basissets[eQMbasisNR] = {{0, 3, 0},
+ basissets[eQMbasisNR] = {{0, 3, 0},
{0, 3, 0}, /*added for double sto-3g entry in names.c*/
{5, 0, 0},
{5, 0, 1},
{1, 6, 11},
{4, 6, 0}};
char
- *buf = NULL;
+ *buf = NULL;
int
- i;
+ i;
/* using the ivec above to convert the basis read form the mdp file
* in a human readable format into some numbers for the gaussian
} /* write_gaussian_input */
-real read_gaussian_output(rvec QMgrad[], rvec MMgrad[], int step,
- t_QMrec *qm, t_MMrec *mm)
+real read_gaussian_output(rvec QMgrad[], rvec MMgrad[], t_QMrec *qm, t_MMrec *mm)
{
int
i, j, atnum;
return(QMener);
}
-real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step,
- gmx_bool swapped, t_QMrec *qm, t_MMrec *mm)
+real read_gaussian_SH_output(rvec QMgrad[], rvec MMgrad[], int step, t_QMrec *qm, t_MMrec *mm)
{
int
i;
}
}
-real call_gaussian(t_commrec *cr, t_forcerec *fr,
- t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[])
+real call_gaussian(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[])
{
/* normal gaussian jobs */
static int
write_gaussian_input(step, fr, qm, mm);
do_gaussian(step, exe);
- QMener = read_gaussian_output(QMgrad, MMgrad, step, qm, mm);
+ QMener = read_gaussian_output(QMgrad, MMgrad, qm, mm);
/* put the QMMM forces in the force array and to the fshift
*/
for (i = 0; i < qm->nrQMatoms; i++)
} /* call_gaussian */
-real call_gaussian_SH(t_commrec *cr, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm,
- rvec f[], rvec fshift[])
+real call_gaussian_SH(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[])
{
/* a gaussian call routine intended for doing diabatic surface
* "sliding". See the manual for the theoretical background of this
write_gaussian_SH_input(step, swapped, fr, qm, mm);
do_gaussian(step, exe);
- QMener = read_gaussian_SH_output(QMgrad, MMgrad, step, swapped, qm, mm);
+ QMener = read_gaussian_SH_output(QMgrad, MMgrad, step, qm, mm);
/* check for a surface hop. Only possible if we were already state
* averaging.
{
write_gaussian_SH_input(step, swapped, fr, qm, mm);
do_gaussian(step, exe);
- QMener = read_gaussian_SH_output(QMgrad, MMgrad, step, swapped, qm, mm);
+ QMener = read_gaussian_SH_output(QMgrad, MMgrad, step, qm, mm);
}
}
/* add the QMMM forces to the gmx force array and fshift
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* mopac interface routines */
void
-F77_FUNC(domldt, DOMLDT) (int *nrqmat, int labels[], char keywords[]);
+ F77_FUNC(domldt, DOMLDT) (int *nrqmat, int labels[], char keywords[]);
void
-F77_FUNC(domop, DOMOP) (int *nrqmat, double qmcrd[], int *nrmmat,
- double mmchrg[], double mmcrd[], double qmgrad[],
- double mmgrad[], double *energy, double qmcharges[]);
+ F77_FUNC(domop, DOMOP) (int *nrqmat, double qmcrd[], int *nrmmat,
+ double mmchrg[], double mmcrd[], double qmgrad[],
+ double mmgrad[], double *energy, double qmcharges[]);
-void init_mopac(t_commrec *cr, t_QMrec *qm, t_MMrec *mm)
+void init_mopac(t_QMrec *qm)
{
/* initializes the mopac routines ans sets up the semiempirical
* computation by calling moldat(). The inline mopac routines can
} /* init_mopac */
-real call_mopac(t_commrec *cr, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm,
- rvec f[], rvec fshift[])
+real call_mopac(t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[])
{
/* do the actual QMMM calculation using directly linked mopac subroutines
*/
return (QMener);
}
-real call_mopac_SH(t_commrec *cr, t_forcerec *fr, t_QMrec *qm, t_MMrec *mm,
- rvec f[], rvec fshift[])
+real call_mopac_SH(t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[])
{
/* do the actual SH QMMM calculation using directly linked mopac
subroutines */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int
i, j, atnum;
char
- buf[300], tmp[300], orca_xyzFilename[300], orca_pcgradFilename[300], orca_engradFilename[300];
+ buf[300], orca_xyzFilename[300], orca_pcgradFilename[300], orca_engradFilename[300];
real
QMener;
FILE
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
#ifdef GMX_DOUBLE
- sscanf(buf, "%s%lf%lf%lf\n",
- tmp,
+ sscanf(buf, "%d%lf%lf%lf\n",
+ &atnum,
&qm->xQM[i][XX],
&qm->xQM[i][YY],
&qm->xQM[i][ZZ]);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdlib.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/fileio/confio.h"
#include "gromacs/legacyheaders/force.h"
#include "gromacs/legacyheaders/macros.h"
init_gamess(t_commrec *cr, t_QMrec *qm, t_MMrec *mm);
real
-call_gamess(t_commrec *cr, t_forcerec *fr,
+call_gamess(t_forcerec *fr,
t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
#elif defined GMX_QMMM_MOPAC
/* MOPAC interface */
void
-init_mopac(t_commrec *cr, t_QMrec *qm, t_MMrec *mm);
+init_mopac(t_QMrec *qm);
real
-call_mopac(t_commrec *cr, t_forcerec *fr, t_QMrec *qm,
- t_MMrec *mm, rvec f[], rvec fshift[]);
+call_mopac(t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
real
-call_mopac_SH(t_commrec *cr, t_forcerec *fr, t_QMrec *qm,
- t_MMrec *mm, rvec f[], rvec fshift[]);
+call_mopac_SH(t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
#elif defined GMX_QMMM_GAUSSIAN
/* GAUSSIAN interface */
void
-init_gaussian(t_commrec *cr, t_QMrec *qm, t_MMrec *mm);
+init_gaussian(t_QMrec *qm);
real
-call_gaussian_SH(t_commrec *cr, t_forcerec *fr, t_QMrec *qm,
- t_MMrec *mm, rvec f[], rvec fshift[]);
+call_gaussian_SH(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
real
-call_gaussian(t_commrec *cr, t_forcerec *fr, t_QMrec *qm,
- t_MMrec *mm, rvec f[], rvec fshift[]);
+call_gaussian(t_forcerec *fr, t_QMrec *qm, t_MMrec *mm, rvec f[], rvec fshift[]);
#elif defined GMX_QMMM_ORCA
/* ORCA interface */
#ifdef GMX_QMMM_MOPAC
if (qm->bSH)
{
- QMener = call_mopac_SH(cr, fr, qm, mm, f, fshift);
+ QMener = call_mopac_SH(qm, mm, f, fshift);
}
else
{
- QMener = call_mopac(cr, fr, qm, mm, f, fshift);
+ QMener = call_mopac(qm, mm, f, fshift);
}
#else
gmx_fatal(FARGS, "Semi-empirical QM only supported with Mopac.");
if (qm->bSH && qm->QMmethod == eQMmethodCASSCF)
{
#ifdef GMX_QMMM_GAUSSIAN
- QMener = call_gaussian_SH(cr, fr, qm, mm, f, fshift);
+ QMener = call_gaussian_SH(fr, qm, mm, f, fshift);
#else
gmx_fatal(FARGS, "Ab-initio Surface-hopping only supported with Gaussian.");
#endif
else
{
#ifdef GMX_QMMM_GAMESS
- QMener = call_gamess(cr, fr, qm, mm, f, fshift);
+ QMener = call_gamess(fr, qm, mm, f, fshift);
#elif defined GMX_QMMM_GAUSSIAN
- QMener = call_gaussian(cr, fr, qm, mm, f, fshift);
+ QMener = call_gaussian(fr, qm, mm, f, fshift);
#elif defined GMX_QMMM_ORCA
QMener = call_orca(fr, qm, mm, f, fshift);
#else
{
#ifdef GMX_QMMM_MOPAC
/* do a semi-empiprical calculation */
- init_mopac(cr, qm, mm);
+ init_mopac(qm);
#else
gmx_fatal(FARGS, "Semi-empirical QM only supported with Mopac.");
#endif
#ifdef GMX_QMMM_GAMESS
init_gamess(cr, qm, mm);
#elif defined GMX_QMMM_GAUSSIAN
- init_gaussian(cr, qm, mm);
+ init_gaussian(qm);
#elif defined GMX_QMMM_ORCA
init_orca(qm);
#else
FILE
*out = NULL;
int
- i, j, k, nrexcl = 0, *excluded = NULL, max = 0;
+ i, j, k, nrexcl = 0, *excluded = NULL, max_excl = 0;
out = fopen("QMMMexcl.dat", "w");
{
if (mm->indexMM[k] == excls->a[j]) /* the excluded MM atom */
{
- if (nrexcl >= max)
+ if (nrexcl >= max_excl)
{
- max += 1000;
- srenew(excluded, max);
+ max_excl += 1000;
+ srenew(excluded, max_excl);
}
excluded[nrexcl++] = k;
continue;
t_ilist *ilist_mol;
gmx_mtop_atomlookup_t alook;
- c6au = (HARTREE2KJ*AVOGADRO*pow(BOHR2NM, 6));
- c12au = (HARTREE2KJ*AVOGADRO*pow(BOHR2NM, 12));
+ c6au = (HARTREE2KJ*AVOGADRO*std::pow(BOHR2NM, 6));
+ c12au = (HARTREE2KJ*AVOGADRO*std::pow(BOHR2NM, 12));
/* issue a fatal if the user wants to run with more than one node */
if (PAR(cr))
{
{
#ifdef GMX_QMMM_MOPAC
/* semi-empiprical 1-layer ONIOM calculation requested (mopac93) */
- init_mopac(cr, qr->qm[0], qr->mm);
+ init_mopac(qr->qm[0]);
#else
gmx_fatal(FARGS, "Semi-empirical QM only supported with Mopac.");
#endif
#ifdef GMX_QMMM_GAMESS
init_gamess(cr, qr->qm[0], qr->mm);
#elif defined GMX_QMMM_GAUSSIAN
- init_gaussian(cr, qr->qm[0], qr->mm);
+ init_gaussian(qr->qm[0]);
#elif defined GMX_QMMM_ORCA
init_orca(qr->qm[0]);
#else
QMMMlist;
rvec
dx, crd;
- int
- *MMatoms;
t_QMrec
*qm;
t_MMrec
real
c12au, c6au;
- c6au = (HARTREE2KJ*AVOGADRO*pow(BOHR2NM, 6));
- c12au = (HARTREE2KJ*AVOGADRO*pow(BOHR2NM, 12));
+ c6au = (HARTREE2KJ*AVOGADRO*std::pow(BOHR2NM, 6));
+ c12au = (HARTREE2KJ*AVOGADRO*std::pow(BOHR2NM, 12));
/* every cpu has this array. On every processor we fill this array
* with 1's and 0's. 1's indicate the atoms is a QM atom on the
crd[0] = IS2X(QMMMlist.shift[i]) + IS2X(qm_i_particles[i].shift);
crd[1] = IS2Y(QMMMlist.shift[i]) + IS2Y(qm_i_particles[i].shift);
crd[2] = IS2Z(QMMMlist.shift[i]) + IS2Z(qm_i_particles[i].shift);
- is = XYZ2IS(crd[0], crd[1], crd[2]);
+ is = static_cast<int>(XYZ2IS(crd[0], crd[1], crd[2]));
for (j = QMMMlist.jindex[i];
j < QMMMlist.jindex[i+1];
j++)
qsort(qm_i_particles, QMMMlist.nri,
(size_t)sizeof(qm_i_particles[0]),
struct_comp);
- qsort(mm_j_particles, mm_nr,
- (size_t)sizeof(mm_j_particles[0]),
- struct_comp);
+ /* The mm_j_particles argument to qsort is not allowed to be NULL */
+ if (mm_nr > 0)
+ {
+ qsort(mm_j_particles, mm_nr,
+ (size_t)sizeof(mm_j_particles[0]),
+ struct_comp);
+ }
/* remove multiples in the QM shift array, since in init_QMMM() we
* went through the atom numbers from 0 to md.nr, the order sorted
* here matches the one of QMindex already.