mdlib -> awh
simd -> hardware
gpu_utils -> hardware
-topology -> listed-forces
listed-forces -> mdlib
dr[clust_id].aver_6[ndr] += fcd->disres.Rt_6[label];
snew(fshift, SHIFTS);
- interaction_function[F_DISRES].ifunc(n, &forceatoms[i], forceparams,
- x, f, fshift,
- pbc, g, lam, &dvdl, nullptr, fcd, nullptr);
+ ta_disres(n, &forceatoms[i], forceparams,
+ x, f, fshift,
+ pbc, g, lam, &dvdl, nullptr, fcd, nullptr);
sfree(fshift);
viol = fcd->disres.sumviol;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
* Bonded force functions
*
*************************************************************************/
-t_ifunc bonds, g96bonds, morse_bonds, cubic_bonds, FENE_bonds, restraint_bonds;
-t_ifunc angles, g96angles, cross_bond_bond, cross_bond_angle, urey_bradley, quartic_angles, linear_angles;
-t_ifunc restrangles;
-t_ifunc pdihs, idihs, rbdihs;
-t_ifunc restrdihs, cbtdihs;
-t_ifunc tab_bonds, tab_angles, tab_dihs;
-t_ifunc polarize, anharm_polarize, water_pol, thole_pol, angres, angresz, dihres, unimplemented;
+real bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real g96bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real morse_bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real cubic_bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real FENE_bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real restraint_bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real angles(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real g96angles(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real cross_bond_bond(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real cross_bond_angle(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real urey_bradley(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real quartic_angles(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real linear_angles(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real restrangles(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real pdihs(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real idihs(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real rbdihs(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real restrdihs(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real cbtdihs(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real tab_bonds(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real tab_angles(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real tab_dihs(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real polarize(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real anharm_polarize(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real water_pol(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real thole_pol(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real angres(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real angresz(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real dihres(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
+real unimplemented(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
+
/* As pdihs(), but without calculating energies and shift forces */
void
t_fcdata *fcd, history_t *hist);
//! Calculates the distance restraint forces, return the potential.
-t_ifunc ta_disres;
+real ta_disres(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
//! Copies the new time averages that have been calculated in calc_disres_R_6.
void update_disres_history(const t_fcdata *fcd, history_t *hist);
#include <cassert>
#include <algorithm>
+#include <array>
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "listed-internal.h"
+struct BondedInteractions
+{
+ BondedFunction function;
+ int nrnbIndex;
+};
+
+/*! \brief Lookup table of bonded interaction functions
+ *
+ * This must have as many entries as interaction_function in ifunc.cpp */
+static std::array<BondedInteractions, F_NRE> s_bondedInteractionFunctions
+ = {
+ BondedInteractions {bonds, eNR_BONDS }, // F_BONDS
+ BondedInteractions {g96bonds, eNR_BONDS }, // F_G96BONDS
+ BondedInteractions {morse_bonds, eNR_MORSE }, // F_MORSE
+ BondedInteractions {cubic_bonds, eNR_CUBICBONDS }, // F_CUBICBONDS
+ BondedInteractions {unimplemented, -1 }, // F_CONNBONDS
+ BondedInteractions {bonds, eNR_BONDS }, // F_HARMONIC
+ BondedInteractions {FENE_bonds, eNR_FENEBONDS }, // F_FENEBONDS
+ BondedInteractions {tab_bonds, eNR_TABBONDS }, // F_TABBONDS
+ BondedInteractions {tab_bonds, eNR_TABBONDS }, // F_TABBONDSNC
+ BondedInteractions {restraint_bonds, eNR_RESTRBONDS }, // F_RESTRBONDS
+ BondedInteractions {angles, eNR_ANGLES }, // F_ANGLES
+ BondedInteractions {g96angles, eNR_ANGLES }, // F_G96ANGLES
+ BondedInteractions {restrangles, eNR_ANGLES }, // F_RESTRANGLES
+ BondedInteractions {linear_angles, eNR_ANGLES }, // F_LINEAR_ANGLES
+ BondedInteractions {cross_bond_bond, eNR_CROSS_BOND_BOND }, // F_CROSS_BOND_BONDS
+ BondedInteractions {cross_bond_angle, eNR_CROSS_BOND_ANGLE }, // F_CROSS_BOND_ANGLES
+ BondedInteractions {urey_bradley, eNR_UREY_BRADLEY }, // F_UREY_BRADLEY
+ BondedInteractions {quartic_angles, eNR_QANGLES }, // F_QUARTIC_ANGLES
+ BondedInteractions {tab_angles, eNR_TABANGLES }, // F_TABANGLES
+ BondedInteractions {pdihs, eNR_PROPER }, // F_PDIHS
+ BondedInteractions {rbdihs, eNR_RB }, // F_RBDIHS
+ BondedInteractions {restrdihs, eNR_PROPER }, // F_RESTRDIHS
+ BondedInteractions {cbtdihs, eNR_RB }, // F_CBTDIHS
+ BondedInteractions {rbdihs, eNR_FOURDIH }, // F_FOURDIHS
+ BondedInteractions {idihs, eNR_IMPROPER }, // F_IDIHS
+ BondedInteractions {pdihs, eNR_IMPROPER }, // F_PIDIHS
+ BondedInteractions {tab_dihs, eNR_TABDIHS }, // F_TABDIHS
+ BondedInteractions {unimplemented, eNR_CMAP }, // F_CMAP
+ BondedInteractions {unimplemented, -1 }, // F_GB12_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_GB13_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_GB14_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_GBPOL_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_NPSOLVATION_NOLONGERUSED
+ BondedInteractions {unimplemented, eNR_NB14 }, // F_LJ14
+ BondedInteractions {unimplemented, -1 }, // F_COUL14
+ BondedInteractions {unimplemented, eNR_NB14 }, // F_LJC14_Q
+ BondedInteractions {unimplemented, eNR_NB14 }, // F_LJC_PAIRS_NB
+ BondedInteractions {unimplemented, -1 }, // F_LJ
+ BondedInteractions {unimplemented, -1 }, // F_BHAM
+ BondedInteractions {unimplemented, -1 }, // F_LJ_LR_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_BHAM_LR_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_DISPCORR
+ BondedInteractions {unimplemented, -1 }, // F_COUL_SR
+ BondedInteractions {unimplemented, -1 }, // F_COUL_LR_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_RF_EXCL
+ BondedInteractions {unimplemented, -1 }, // F_COUL_RECIP
+ BondedInteractions {unimplemented, -1 }, // F_LJ_RECIP
+ BondedInteractions {unimplemented, -1 }, // F_DPD
+ BondedInteractions {polarize, eNR_POLARIZE }, // F_POLARIZATION
+ BondedInteractions {water_pol, eNR_WPOL }, // F_WATER_POL
+ BondedInteractions {thole_pol, eNR_THOLE }, // F_THOLE_POL
+ BondedInteractions {anharm_polarize, eNR_ANHARM_POL }, // F_ANHARM_POL
+ BondedInteractions {unimplemented, -1 }, // F_POSRES
+ BondedInteractions {unimplemented, -1 }, // F_FBPOSRES
+ BondedInteractions {ta_disres, eNR_DISRES }, // F_DISRES
+ BondedInteractions {unimplemented, -1 }, // F_DISRESVIOL
+ BondedInteractions {orires, eNR_ORIRES }, // F_ORIRES
+ BondedInteractions {unimplemented, -1 }, // F_ORIRESDEV
+ BondedInteractions {angres, eNR_ANGRES }, // F_ANGRES
+ BondedInteractions {angresz, eNR_ANGRESZ }, // F_ANGRESZ
+ BondedInteractions {dihres, eNR_DIHRES }, // F_DIHRES
+ BondedInteractions {unimplemented, -1 }, // F_DIHRESVIOL
+ BondedInteractions {unimplemented, -1 }, // F_CONSTR
+ BondedInteractions {unimplemented, -1 }, // F_CONSTRNC
+ BondedInteractions {unimplemented, -1 }, // F_SETTLE
+ BondedInteractions {unimplemented, -1 }, // F_VSITE2
+ BondedInteractions {unimplemented, -1 }, // F_VSITE3
+ BondedInteractions {unimplemented, -1 }, // F_VSITE3FD
+ BondedInteractions {unimplemented, -1 }, // F_VSITE3FAD
+ BondedInteractions {unimplemented, -1 }, // F_VSITE3OUT
+ BondedInteractions {unimplemented, -1 }, // F_VSITE4FD
+ BondedInteractions {unimplemented, -1 }, // F_VSITE4FDN
+ BondedInteractions {unimplemented, -1 }, // F_VSITEN
+ BondedInteractions {unimplemented, -1 }, // F_COM_PULL
+ BondedInteractions {unimplemented, -1 }, // F_EQM
+ BondedInteractions {unimplemented, -1 }, // F_EPOT
+ BondedInteractions {unimplemented, -1 }, // F_EKIN
+ BondedInteractions {unimplemented, -1 }, // F_ETOT
+ BondedInteractions {unimplemented, -1 }, // F_ECONSERVED
+ BondedInteractions {unimplemented, -1 }, // F_TEMP
+ BondedInteractions {unimplemented, -1 }, // F_VTEMP_NOLONGERUSED
+ BondedInteractions {unimplemented, -1 }, // F_PDISPCORR
+ BondedInteractions {unimplemented, -1 }, // F_PRES
+ BondedInteractions {unimplemented, -1 }, // F_DVDL_CONSTR
+ BondedInteractions {unimplemented, -1 }, // F_DVDL
+ BondedInteractions {unimplemented, -1 }, // F_DKDL
+ BondedInteractions {unimplemented, -1 }, // F_DVDL_COUL
+ BondedInteractions {unimplemented, -1 }, // F_DVDL_VDW
+ BondedInteractions {unimplemented, -1 }, // F_DVDL_BONDED
+ BondedInteractions {unimplemented, -1 }, // F_DVDL_RESTRAINT
+ BondedInteractions {unimplemented, -1 }, // F_DVDL_TEMPERATURE
+ };
+
+BondedFunction bondedFunction(int ftype)
+{
+ return s_bondedInteractionFunctions[ftype].function;
+}
+
+//! Getter for finding the flop count for an \c ftype interaction.
+static int nrnbIndex(int ftype)
+{
+ return s_bondedInteractionFunctions[ftype].nrnbIndex;
+}
+
namespace
{
#endif
else
{
- v = interaction_function[ftype].ifunc(nbn, iatoms+nb0,
- idef->iparams,
- x, f, fshift,
- pbc, g, lambda[efptFTYPE], &(dvdl[efptFTYPE]),
- md, fcd, global_atom_index);
+ v = bondedFunction(ftype)(nbn, iatoms+nb0,
+ idef->iparams,
+ x, f, fshift,
+ pbc, g, lambda[efptFTYPE], &(dvdl[efptFTYPE]),
+ md, fcd, global_atom_index);
}
}
else
if (thread == 0)
{
- inc_nrnb(nrnb, interaction_function[ftype].nrnb_ind, nbonds);
+ inc_nrnb(nrnb, nrnbIndex(ftype), nbonds);
}
return v;
#define GMX_LISTED_FORCES_LISTED_FORCES_H
#include "gromacs/math/vectypes.h"
+#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/basedefinitions.h"
struct gmx_enerdata_t;
class ForceWithVirial;
}
+//! Type of CPU function to compute a bonded interaction.
+using BondedFunction = real(*)(int nbonds, const t_iatom iatoms[],
+ const t_iparams iparams[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *ddgatindex);
+
+//! Getter for finding a callable CPU function to compute an \c ftype interaction.
+BondedFunction bondedFunction(int ftype);
+
/*! \brief Return whether this is an interaction that actually
* calculates a potential and works on multiple atoms (not e.g. a
* connection or a position restraint).
void print_orires_log(FILE *log, t_oriresdata *od);
//! Calculates the orientation restraint forces.
-t_ifunc orires;
+real orires(int nfa, const t_iatom forceatoms[], const t_iparams ip[],
+ const rvec x[], rvec4 f[], rvec fshift[],
+ const t_pbc *pbc, const t_graph *g,
+ real lambda, real *dvdlambda,
+ const t_mdatoms *md, t_fcdata *fcd,
+ int *global_atom_index);
//! Copies the new time averages that have been calculated in calc_orires_dev.
void update_orires_history(const t_fcdata *fcd, history_t *hist);
#include <gtest/gtest.h>
+#include "gromacs/listed-forces/listed-forces.h"
#include "gromacs/math/units.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
t_pbc pbc;
set_pbc(&pbc, epbc, box);
int ddgatindex = 0;
- real energy = interaction_function[ftype].ifunc(iatoms.size(),
- iatoms.data(),
- iparams,
- x, f, fshift,
- &pbc,
- /* const struct t_graph *g */ nullptr,
- lambda, &dvdlambda,
- /* const struct t_mdatoms *md */ nullptr,
- /* struct t_fcdata *fcd */ nullptr,
- &ddgatindex);
+ real energy = bondedFunction(ftype)(iatoms.size(),
+ iatoms.data(),
+ iparams,
+ x, f, fshift,
+ &pbc,
+ /* const struct t_graph *g */ nullptr,
+ lambda, &dvdlambda,
+ /* const struct t_mdatoms *md */ nullptr,
+ /* struct t_fcdata *fcd */ nullptr,
+ &ddgatindex);
checker_.checkReal(energy, interaction_function[ftype].longname);
}
#include "ifunc.h"
-#include "gromacs/listed-forces/bonded.h"
-#include "gromacs/listed-forces/disre.h"
-#include "gromacs/listed-forces/orires.h"
+#define def_bonded(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND}
-#define def_bonded(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND, (ind), (func)}
+#define def_bondedz(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_LIMZERO}
-#define def_bondedz(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_LIMZERO, (ind), (func)}
+#define def_bondedt(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_TABULATED}
-#define def_bondedt(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_TABULATED, (ind), (func)}
+#define def_bondedtz(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_TABULATED | IF_LIMZERO}
-#define def_bondedtz(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_TABULATED | IF_LIMZERO, (ind), (func)}
+#define def_angle(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_ATYPE}
-#define def_angle(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_ATYPE, (ind), (func)}
+#define def_bond(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND | IF_BTYPE}
-#define def_bond(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND | IF_BTYPE, (ind), (func)}
+#define def_bondt(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND | IF_TABULATED}
-#define def_bondt(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND | IF_TABULATED, (ind), (func)}
-
-#define def_bondnb(str, lstr, nra, nrpa, nrpb, ind, func) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND, (ind), (func)}
+#define def_bondnb(str, lstr, nra, nrpa, nrpb) \
+ {str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND}
#define def_vsite(str, lstr, nra, nrpa) \
- {str, lstr, (nra), (nrpa), 0, IF_VSITE, -1, unimplemented}
+ {str, lstr, (nra), (nrpa), 0, IF_VSITE}
#define def_shk(str, lstr, nra, nrpa, nrpb) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_CONSTRAINT, -1, unimplemented}
+ {str, lstr, (nra), (nrpa), (nrpb), IF_CONSTRAINT}
#define def_shkcb(str, lstr, nra, nrpa, nrpb) \
- {str, lstr, (nra), (nrpa), (nrpb), IF_CONSTRAINT | IF_CHEMBOND, -1, unimplemented}
+ {str, lstr, (nra), (nrpa), (nrpb), IF_CONSTRAINT | IF_CHEMBOND}
#define def_nb(str, lstr, nra, nrp) \
- {str, lstr, (nra), (nrp), 0, IF_NULL, -1, unimplemented}
+ {str, lstr, (nra), (nrp), 0, IF_NULL}
#define def_nofc(str, lstr) \
- {str, lstr, 0, 0, 0, IF_NULL, -1, unimplemented}
+ {str, lstr, 0, 0, 0, IF_NULL}
/* this MUST correspond to the enum in src/gromacs/topology/idef.h */
const t_interaction_function interaction_function[F_NRE] =
{
- def_bond ("BONDS", "Bond", 2, 2, 2, eNR_BONDS, bonds ),
- def_bond ("G96BONDS", "G96Bond", 2, 2, 2, eNR_BONDS, g96bonds ),
- def_bond ("MORSE", "Morse", 2, 3, 3, eNR_MORSE, morse_bonds ),
- def_bond ("CUBICBONDS", "Cubic Bonds", 2, 3, 0, eNR_CUBICBONDS, cubic_bonds),
- def_bondnb ("CONNBONDS", "Connect Bonds", 2, 0, 0, 0, unimplemented ),
- def_bonded ("HARMONIC", "Harmonic Pot.", 2, 2, 2, eNR_BONDS, bonds ),
- def_bondnb ("FENEBONDS", "FENE Bonds", 2, 2, 0, eNR_FENEBONDS, FENE_bonds ),
- def_bondt ("TABBONDS", "Tab. Bonds", 2, 2, 2, eNR_TABBONDS, tab_bonds ),
- def_bondedtz("TABBONDSNC", "Tab. Bonds NC", 2, 2, 2, eNR_TABBONDS, tab_bonds ),
- def_bonded ("RESTRAINTPOT", "Restraint Pot.", 2, 4, 4, eNR_RESTRBONDS, restraint_bonds ),
- def_angle ("ANGLES", "Angle", 3, 2, 2, eNR_ANGLES, angles ),
- def_angle ("G96ANGLES", "G96Angle", 3, 2, 2, eNR_ANGLES, g96angles ),
- def_angle ("RESTRANGLES", "Restricted Angles", 3, 2, 2, eNR_ANGLES, restrangles),
- def_angle ("LINEAR_ANGLES", "Lin. Angle", 3, 2, 2, eNR_LINEAR_ANGLES, linear_angles ),
- def_bonded ("CROSS_BOND_BOND", "Bond-Cross", 3, 3, 0, eNR_CROSS_BOND_BOND, cross_bond_bond ),
- def_bonded ("CROSS_BOND_ANGLE", "BA-Cross", 3, 4, 0, eNR_CROSS_BOND_ANGLE, cross_bond_angle ),
- def_angle ("UREY_BRADLEY", "U-B", 3, 4, 4, eNR_UREY_BRADLEY, urey_bradley ),
- def_angle ("QANGLES", "Quartic Angles", 3, 6, 0, eNR_QANGLES, quartic_angles ),
- def_bondedt ("TABANGLES", "Tab. Angles", 3, 2, 2, eNR_TABANGLES, tab_angles ),
- def_bonded ("PDIHS", "Proper Dih.", 4, 3, 3, eNR_PROPER, pdihs ),
- def_bonded ("RBDIHS", "Ryckaert-Bell.", 4, 6, 6, eNR_RB, rbdihs ),
- def_bonded ("RESTRDIHS", "Restricted Dih.", 4, 2, 2, eNR_PROPER, restrdihs),
- def_bonded ("CBTDIHS", "CBT Dih.", 4, 6, 6, eNR_RB, cbtdihs ),
- def_bonded ("FOURDIHS", "Fourier Dih.", 4, 4, 4, eNR_FOURDIH, rbdihs ),
- def_bonded ("IDIHS", "Improper Dih.", 4, 2, 2, eNR_IMPROPER, idihs ),
- def_bonded ("PIDIHS", "Improper Dih.", 4, 3, 3, eNR_IMPROPER, pdihs ),
- def_bondedt ("TABDIHS", "Tab. Dih.", 4, 2, 2, eNR_TABDIHS, tab_dihs ),
- def_bonded ("CMAP", "CMAP Dih.", 5, -1, -1, eNR_CMAP, unimplemented ),
+ def_bond ("BONDS", "Bond", 2, 2, 2),
+ def_bond ("G96BONDS", "G96Bond", 2, 2, 2),
+ def_bond ("MORSE", "Morse", 2, 3, 3),
+ def_bond ("CUBICBONDS", "Cubic Bonds", 2, 3, 0),
+ def_bondnb ("CONNBONDS", "Connect Bonds", 2, 0, 0),
+ def_bonded ("HARMONIC", "Harmonic Pot.", 2, 2, 2),
+ def_bondnb ("FENEBONDS", "FENE Bonds", 2, 2, 0),
+ def_bondt ("TABBONDS", "Tab. Bonds", 2, 2, 2),
+ def_bondedtz("TABBONDSNC", "Tab. Bonds NC", 2, 2, 2),
+ def_bonded ("RESTRAINTPOT", "Restraint Pot.", 2, 4, 4),
+ def_angle ("ANGLES", "Angle", 3, 2, 2),
+ def_angle ("G96ANGLES", "G96Angle", 3, 2, 2),
+ def_angle ("RESTRANGLES", "Restricted Angles", 3, 2, 2),
+ def_angle ("LINEAR_ANGLES", "Lin. Angle", 3, 2, 2),
+ def_bonded ("CROSS_BOND_BOND", "Bond-Cross", 3, 3, 0),
+ def_bonded ("CROSS_BOND_ANGLE", "BA-Cross", 3, 4, 0),
+ def_angle ("UREY_BRADLEY", "U-B", 3, 4, 4),
+ def_angle ("QANGLES", "Quartic Angles", 3, 6, 0),
+ def_bondedt ("TABANGLES", "Tab. Angles", 3, 2, 2),
+ def_bonded ("PDIHS", "Proper Dih.", 4, 3, 3),
+ def_bonded ("RBDIHS", "Ryckaert-Bell.", 4, 6, 6),
+ def_bonded ("RESTRDIHS", "Restricted Dih.", 4, 2, 2),
+ def_bonded ("CBTDIHS", "CBT Dih.", 4, 6, 6),
+ def_bonded ("FOURDIHS", "Fourier Dih.", 4, 4, 4),
+ def_bonded ("IDIHS", "Improper Dih.", 4, 2, 2),
+ def_bonded ("PIDIHS", "Improper Dih.", 4, 3, 3),
+ def_bondedt ("TABDIHS", "Tab. Dih.", 4, 2, 2),
+ def_bonded ("CMAP", "CMAP Dih.", 5, -1, -1),
def_nofc ("GB12", "GB 1-2 Pol. (unused)" ),
def_nofc ("GB13", "GB 1-3 Pol. (unused)" ),
def_nofc ("GB14", "GB 1-4 Pol. (unused)" ),
def_nofc ("GBPOL", "GB Polarization (unused)" ),
def_nofc ("NPSOLVATION", "Nonpolar Sol. (unused)" ),
- def_bondedz ("LJ14", "LJ-14", 2, 2, 2, eNR_NB14, unimplemented ),
+ def_bondedz ("LJ14", "LJ-14", 2, 2, 2),
def_nofc ("COUL14", "Coulomb-14" ),
- def_bondedz ("LJC14_Q", "LJC-14 q", 2, 5, 0, eNR_NB14, unimplemented ),
- def_bondedz ("LJC_NB", "LJC Pairs NB", 2, 4, 0, eNR_NB14, unimplemented ),
+ def_bondedz ("LJC14_Q", "LJC-14 q", 2, 5, 0),
+ def_bondedz ("LJC_NB", "LJC Pairs NB", 2, 4, 0),
def_nb ("LJ_SR", "LJ (SR)", 2, 2 ),
def_nb ("BHAM", "Buck.ham (SR)", 2, 3 ),
def_nofc ("LJ_LR", "LJ (unused)" ),
def_nofc ("COUL_RECIP", "Coul. recip." ),
def_nofc ("LJ_RECIP", "LJ recip." ),
def_nofc ("DPD", "DPD" ),
- def_bondnb ("POLARIZATION", "Polarization", 2, 1, 0, eNR_POLARIZE, polarize ),
- def_bonded ("WATERPOL", "Water Pol.", 5, 6, 0, eNR_WPOL, water_pol ),
- def_bonded ("THOLE", "Thole Pol.", 4, 3, 0, eNR_THOLE, thole_pol ),
- def_bondnb ("ANHARM_POL", "Anharm. Pol.", 2, 3, 0, eNR_ANHARM_POL, anharm_polarize ),
- def_bonded ("POSRES", "Position Rest.", 1, 3, 3, eNR_POSRES, unimplemented ),
- def_bonded ("FBPOSRES", "Flat-bottom posres", 1, 3, 0, eNR_FBPOSRES, unimplemented ),
- def_bonded ("DISRES", "Dis. Rest.", 2, 6, 0, eNR_DISRES, ta_disres ),
+ def_bondnb ("POLARIZATION", "Polarization", 2, 1, 0),
+ def_bonded ("WATERPOL", "Water Pol.", 5, 6, 0),
+ def_bonded ("THOLE", "Thole Pol.", 4, 3, 0),
+ def_bondnb ("ANHARM_POL", "Anharm. Pol.", 2, 3, 0),
+ def_bonded ("POSRES", "Position Rest.", 1, 3, 3),
+ def_bonded ("FBPOSRES", "Flat-bottom posres", 1, 3, 0),
+ def_bonded ("DISRES", "Dis. Rest.", 2, 6, 0),
def_nofc ("DISRESVIOL", "D.R.Viol. (nm)" ),
- def_bonded ("ORIRES", "Orient. Rest.", 2, 6, 0, eNR_ORIRES, orires ),
+ def_bonded ("ORIRES", "Orient. Rest.", 2, 6, 0),
def_nofc ("ORDEV", "Ori. R. RMSD" ),
- def_bonded ("ANGRES", "Angle Rest.", 4, 3, 3, eNR_ANGRES, angres ),
- def_bonded ("ANGRESZ", "Angle Rest. Z", 2, 3, 3, eNR_ANGRESZ, angresz ),
- def_bonded ("DIHRES", "Dih. Rest.", 4, 3, 3, eNR_DIHRES, dihres ),
+ def_bonded ("ANGRES", "Angle Rest.", 4, 3, 3),
+ def_bonded ("ANGRESZ", "Angle Rest. Z", 2, 3, 3),
+ def_bonded ("DIHRES", "Dih. Rest.", 4, 3, 3),
def_nofc ("DIHRESVIOL", "Dih. Rest. Viol." ), /* obsolete */
def_shkcb ("CONSTR", "Constraint", 2, 1, 1 ),
def_shk ("CONSTRNC", "Constr. No Conn.", 2, 1, 1 ),
*/
typedef real rvec4[4];
-typedef real t_ifunc (int nbonds, const t_iatom iatoms[],
- const t_iparams iparams[],
- const rvec x[], rvec4 f[], rvec fshift[],
- const struct t_pbc *pbc, const struct t_graph *g,
- real lambda, real *dvdlambda,
- const struct t_mdatoms *md, struct t_fcdata *fcd,
- int *ddgatindex);
-
/*
* The function type t_ifunc() calculates one interaction, using iatoms[]
* and iparams. Within the function the number of atoms to be used is
/* iparams struct! (see idef.h) */
/* A and B are for normal and free energy components respectively. */
unsigned int flags; /* Flags (see above) */
- int nrnb_ind; /* index for nrnb (-1 if unknown) */
- t_ifunc *ifunc; /* the function it self */
};
#define NRFPA(ftype) (interaction_function[(ftype)].nrfpA)