biod.pnpi.spb.ru
/
alexxy
/
gromacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moved another bunch of mdlib utils to C++
[alexxy/gromacs.git]
/
src
/
gromacs
/
mdlib
/
adress.cpp
diff --git
a/src/gromacs/mdlib/adress.c
b/src/gromacs/mdlib/adress.cpp
similarity index 94%
rename from
src/gromacs/mdlib/adress.c
rename to
src/gromacs/mdlib/adress.cpp
index 9e9db2908984f30cd6a842a4780d2979b194382e..4f5fb2a471dc8ee3d3af2e82491b337b40b63f4e 100644
(file)
--- a/
src/gromacs/mdlib/adress.c
+++ b/
src/gromacs/mdlib/adress.cpp
@@
-2,7
+2,7
@@
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
- * Copyright (c) 2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,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.
* 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.
@@
-38,6
+38,8
@@
#include "adress.h"
#include "adress.h"
+#include <cmath>
+
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/legacyheaders/types/simple.h"
#include "gromacs/math/utilities.h"
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/legacyheaders/types/simple.h"
#include "gromacs/math/utilities.h"
@@
-95,7
+97,7
@@
adress_weight(rvec x,
return 1;
}
return 1;
}
- dl = sqrt(sqr_dl);
+ dl = s
td::s
qrt(sqr_dl);
/* molecule is coarse grained */
if (dl > l2)
/* molecule is coarse grained */
if (dl > l2)
@@
-110,7
+112,7
@@
adress_weight(rvec x,
/* hybrid region */
else
{
/* hybrid region */
else
{
- tmp = cos((dl-adressr)*M_PI/2/adressw);
+ tmp =
std::
cos((dl-adressr)*M_PI/2/adressw);
return tmp*tmp;
}
}
return tmp*tmp;
}
}
@@
-261,14
+263,11
@@
void update_adress_weights_atom_per_atom(
t_mdatoms * mdatoms,
t_pbc * pbc)
{
t_mdatoms * mdatoms,
t_pbc * pbc)
{
- int icg, k, k0, k1, d;
- real nrcg, inv_ncg, mtot, inv_mtot;
+ int icg, k, k0, k1;
atom_id * cgindex;
atom_id * cgindex;
- rvec ix;
int adresstype;
real adressr, adressw;
rvec * ref;
int adresstype;
real adressr, adressw;
rvec * ref;
- real * massT;
real * wf;
real * wf;
@@
-281,7
+280,6
@@
void update_adress_weights_atom_per_atom(
adresstype = fr->adress_type;
adressr = fr->adress_ex_width;
adressw = fr->adress_hy_width;
adresstype = fr->adress_type;
adressr = fr->adress_ex_width;
adressw = fr->adress_hy_width;
- massT = mdatoms->massT;
wf = mdatoms->wf;
ref = &(fr->adress_refs);
wf = mdatoms->wf;
ref = &(fr->adress_refs);
@@
-296,7
+294,6
@@
void update_adress_weights_atom_per_atom(
{
k0 = cgindex[icg];
k1 = cgindex[icg + 1];
{
k0 = cgindex[icg];
k1 = cgindex[icg + 1];
- nrcg = k1 - k0;
for (k = (k0); (k < k1); k++)
{
for (k = (k0); (k < k1); k++)
{
@@
-326,7
+323,7
@@
update_adress_weights_cog(t_iparams ip[],
t_mdatoms * mdatoms,
t_pbc * pbc)
{
t_mdatoms * mdatoms,
t_pbc * pbc)
{
- int i, j,
k,
nr, nra, inc;
+ int i, j, nr, nra, inc;
int ftype, adresstype;
t_iatom avsite, ai, aj, ak, al;
t_iatom * ia;
int ftype, adresstype;
t_iatom avsite, ai, aj, ak, al;
t_iatom * ia;
@@
-464,13
+461,11
@@
update_adress_weights_atom(int cg0,
int adresstype;
real adressr, adressw;
rvec * ref;
int adresstype;
real adressr, adressw;
rvec * ref;
- real * massT;
real * wf;
adresstype = fr->adress_type;
adressr = fr->adress_ex_width;
adressw = fr->adress_hy_width;
real * wf;
adresstype = fr->adress_type;
adressr = fr->adress_ex_width;
adressw = fr->adress_hy_width;
- massT = mdatoms->massT;
wf = mdatoms->wf;
ref = &(fr->adress_refs);
cgindex = cgs->index;
wf = mdatoms->wf;
ref = &(fr->adress_refs);
cgindex = cgs->index;
@@
-497,33
+492,25
@@
update_adress_weights_atom(int cg0,
void
adress_thermo_force(int start,
int homenr,
void
adress_thermo_force(int start,
int homenr,
- t_block * cgs,
rvec x[],
rvec f[],
t_forcerec * fr,
t_mdatoms * mdatoms,
t_pbc * pbc)
{
rvec x[],
rvec f[],
t_forcerec * fr,
t_mdatoms * mdatoms,
t_pbc * pbc)
{
- int iatom, n0, nnn,
nrcg,
i;
+ int iatom, n0, nnn, i;
int adresstype;
int adresstype;
- real adressw, adressr;
- atom_id * cgindex;
unsigned short * ptype;
rvec * ref;
unsigned short * ptype;
rvec * ref;
- real * wf;
real tabscale;
real * ATFtab;
rvec dr;
real tabscale;
real * ATFtab;
rvec dr;
- real w
, wsq, wmin1, wmin1sq, wp, w
t, rinv, sqr_dl, dl;
- real eps, eps2, F, Geps, Heps2, Fp,
dmu_dwp, dwp_dr,
fscal;
+ real wt, rinv, sqr_dl, dl;
+ real eps, eps2, F, Geps, Heps2, Fp, fscal;
adresstype = fr->adress_type;
adresstype = fr->adress_type;
- adressw = fr->adress_hy_width;
- adressr = fr->adress_ex_width;
- cgindex = cgs->index;
ptype = mdatoms->ptype;
ref = &(fr->adress_refs);
ptype = mdatoms->ptype;
ref = &(fr->adress_refs);
- wf = mdatoms->wf;
for (iatom = start; (iatom < start+homenr); iatom++)
{
for (iatom = start; (iatom < start+homenr); iatom++)
{
@@
-531,7
+518,6
@@
adress_thermo_force(int start,
{
if (ptype[iatom] == eptVSite)
{
{
if (ptype[iatom] == eptVSite)
{
- w = wf[iatom];
/* is it hybrid or apply the thermodynamics force everywhere?*/
if (mdatoms->tf_table_index[iatom] != NO_TF_TABLE)
{
/* is it hybrid or apply the thermodynamics force everywhere?*/
if (mdatoms->tf_table_index[iatom] != NO_TF_TABLE)
{
@@
-548,7
+534,6
@@
adress_thermo_force(int start,
tabscale = fr->atf_tabs[DEFAULT_TF_TABLE].scale;
}
tabscale = fr->atf_tabs[DEFAULT_TF_TABLE].scale;
}
- fscal = 0;
if (pbc)
{
pbc_dx(pbc, (*ref), x[iatom], dr);
if (pbc)
{
pbc_dx(pbc, (*ref), x[iatom], dr);
@@
-583,10
+568,10
@@
adress_thermo_force(int start,
rinv = 0.0;
}
rinv = 0.0;
}
- dl = sqrt(sqr_dl);
+ dl = s
td::s
qrt(sqr_dl);
/* table origin is adress center */
wt = dl*tabscale;
/* table origin is adress center */
wt = dl*tabscale;
- n0 =
wt
;
+ n0 =
static_cast<int>(wt)
;
eps = wt-n0;
eps2 = eps*eps;
nnn = 4*n0;
eps = wt-n0;
eps2 = eps*eps;
nnn = 4*n0;