[gmx-developers] oddity in code - intentional?
jan
rtm443x at googlemail.com
Thu May 7 14:59:02 CEST 2020
Hi all,
I've been diverted by some other things, plus had a lot of learning to
do. Still at it.
Anyway, trying to understand how the gromacs code works in the hot
loops. I'm looking at how kernel_ElecEwTwinCut_VdwLJCombGeom_F.cpp
gets built up.
I noticed what I'd describe as a syntactic discrepancy (which is not
to say it's wrong, just visually aberrant).
>From 2 different parts of the expansion (the # stuff is the
preprocessor line-syncing stuff. Ignore it).
--- (A) ---
fscal_S1 = rinvsq_S1 * (frcoul_S1 + frLJ_S1);
# 1179 "kernel_inner.h"
fscal_S2 = rinvsq_S2 * (frcoul_S2 + frLJ_S2);
fscal_S3 = rinvsq_S3 * (frcoul_S3 + frLJ_S3);
---
--- (B) ---
fscal_S1 = rinvsq_S1 * (frcoul_S1 + frLJ_S1);
# 1187 "kernel_inner.h"
fscal_S2 = rinvsq_S2 * frcoul_S2;
fscal_S3 = rinvsq_S3 * frcoul_S3;
---
The top one A all have the same form, the bottom B is mixed. Dunno if
bug, just looked odd.
Relevant piece of source code seems to be this from kernel_inner.h
---
# ifdef CALC_LJ
# ifdef CALC_COULOMB
fscal_S0 = rinvsq_S0 * (frcoul_S0 + frLJ_S0);
# else
fscal_S0 = rinvsq_S0 * frLJ_S0;
# endif
# ifdef CALC_COULOMB
fscal_S1 = rinvsq_S1 * (frcoul_S1 + frLJ_S1);
# else
fscal_S1 = rinvsq_S1 * frLJ_S1;
# endif
# else
fscal_S0 = rinvsq_S0 * frcoul_S0;
fscal_S1 = rinvsq_S1 * frcoul_S1;
# endif /* CALC_LJ */
# if defined CALC_LJ && !defined HALF_LJ
# ifdef CALC_COULOMB
fscal_S2 = rinvsq_S2 * (frcoul_S2 + frLJ_S2);
fscal_S3 = rinvsq_S3 * (frcoul_S3 + frLJ_S3);
# else
fscal_S2 = rinvsq_S2 * frLJ_S2;
fscal_S3 = rinvsq_S3 * frLJ_S3;
# endif
# else
/* Atom 2 and 3 don't have LJ, so only add Coulomb forces */
fscal_S2 = rinvsq_S2 * frcoul_S2;
fscal_S3 = rinvsq_S3 * frcoul_S3;
# endif
---
thanks
jan
More information about the gromacs.org_gmx-developers
mailing list