/* Activate output of forces for correctness checks */
/* #define PRINT_FORCES */
#ifdef PRINT_FORCES
-# define PRINT_FORCE_J \
- fprintf(stderr, "f%d = %15.8f %15.8f %15.8f\n", erg->xc_ref_ind[j], erg->f_rot_loc[j][XX], \
- erg->f_rot_loc[j][YY], erg->f_rot_loc[j][ZZ]);
+# define PRINT_FORCE_J \
+ fprintf(stderr, \
+ "f%d = %15.8f %15.8f %15.8f\n", \
+ erg->xc_ref_ind[j], \
+ erg->f_rot_loc[j][XX], \
+ erg->f_rot_loc[j][YY], \
+ erg->f_rot_loc[j][ZZ]);
# define PRINT_POT_TAU \
if (MASTER(cr)) \
{ \
fprintf(stderr, \
"potential = %15.8f\n" \
"torque = %15.8f\n", \
- erg->V, erg->torque_v); \
+ erg->V, \
+ erg->torque_v); \
}
#else
# define PRINT_FORCE_J
}
#if GMX_MPI
- MPI_Reduce(er->mpi_inbuf, er->mpi_outbuf, count, GMX_MPI_REAL, MPI_SUM, MASTERRANK(cr),
- cr->mpi_comm_mygroup);
+ MPI_Reduce(er->mpi_inbuf, er->mpi_outbuf, count, GMX_MPI_REAL, MPI_SUM, MASTERRANK(cr), cr->mpi_comm_mygroup);
#endif
/* Copy back the reduced data from the buffer on the master */
/* We can do the calculations ONLY if there is weight in the slab! */
if (erg->slab_weights[slabIndex] > WEIGHT_MIN)
{
- svmul(1.0 / erg->slab_weights[slabIndex], erg->slab_center[slabIndex],
- erg->slab_center[slabIndex]);
+ svmul(1.0 / erg->slab_weights[slabIndex], erg->slab_center[slabIndex], erg->slab_center[slabIndex]);
}
else
{
for (int j = erg->slab_first; j <= erg->slab_last; j++)
{
int slabIndex = j - erg->slab_first;
- fprintf(out_slabs, "%6d%12.3e%12.3e%12.3e", j, erg->slab_center[slabIndex][XX],
- erg->slab_center[slabIndex][YY], erg->slab_center[slabIndex][ZZ]);
+ fprintf(out_slabs,
+ "%6d%12.3e%12.3e%12.3e",
+ j,
+ erg->slab_center[slabIndex][XX],
+ erg->slab_center[slabIndex][YY],
+ erg->slab_center[slabIndex][ZZ]);
}
fprintf(out_slabs, "\n");
}
fp = gmx_ffopen(fn, "w");
- fprintf(fp, "# Output of %s is written in intervals of %d time step%s.\n#\n", what, steps,
- steps > 1 ? "s" : "");
+ fprintf(fp, "# Output of %s is written in intervals of %d time step%s.\n#\n", what, steps, steps > 1 ? "s" : "");
return fp;
}
gmx_enfrotgrp* erg = &ergRef;
if (ISFLEX(erg->rotg))
{
- fprintf(fp, "# Rotation group %d (%s), slab distance %f nm, %s.\n", erg->groupIndex,
- erotg_names[erg->rotg->eType], erg->rotg->slab_dist,
+ fprintf(fp,
+ "# Rotation group %d (%s), slab distance %f nm, %s.\n",
+ erg->groupIndex,
+ erotg_names[erg->rotg->eType],
+ erg->rotg->slab_dist,
erg->rotg->bMassW ? "centers of mass" : "geometrical centers");
}
}
}
else
{
- fp = xvgropen(fn, "Rotation angles and energy", "Time (ps)",
- "angles (degrees) and energies (kJ/mol)", oenv);
+ fp = xvgropen(fn,
+ "Rotation angles and energy",
+ "Time (ps)",
+ "angles (degrees) and energies (kJ/mol)",
+ oenv);
fprintf(fp,
"# Output of enforced rotation data is written in intervals of %d time "
"step%s.\n#\n",
- er->nstrout, er->nstrout > 1 ? "s" : "");
+ er->nstrout,
+ er->nstrout > 1 ? "s" : "");
fprintf(fp,
"# The scalar tau is the torque (kJ/mol) in the direction of the rotation vector "
"v.\n");
fprintf(fp, "#\n");
fprintf(fp, "# ROTATION GROUP %d, potential type '%s':\n", g, erotg_names[rotg->eType]);
fprintf(fp, "# rot-massw%d %s\n", g, yesno_names[rotg->bMassW]);
- fprintf(fp, "# rot-vec%d %12.5e %12.5e %12.5e\n", g, erg->vec[XX],
- erg->vec[YY], erg->vec[ZZ]);
+ fprintf(fp,
+ "# rot-vec%d %12.5e %12.5e %12.5e\n",
+ g,
+ erg->vec[XX],
+ erg->vec[YY],
+ erg->vec[ZZ]);
fprintf(fp, "# rot-rate%d %12.5e degrees/ps\n", g, rotg->rate);
fprintf(fp, "# rot-k%d %12.5e kJ/(mol*nm^2)\n", g, rotg->k);
if (rotg->eType == erotgISO || rotg->eType == erotgPM || rotg->eType == erotgRM
|| rotg->eType == erotgRM2)
{
- fprintf(fp, "# rot-pivot%d %12.5e %12.5e %12.5e nm\n", g, rotg->pivot[XX],
- rotg->pivot[YY], rotg->pivot[ZZ]);
+ fprintf(fp,
+ "# rot-pivot%d %12.5e %12.5e %12.5e nm\n",
+ g,
+ rotg->pivot[XX],
+ rotg->pivot[YY],
+ rotg->pivot[ZZ]);
}
if (bFlex)
if ((rotg->eType == erotgISOPF) || (rotg->eType == erotgPMPF) || (rotg->eType == erotgRMPF)
|| (rotg->eType == erotgRM2PF || (rotg->eType == erotgFLEXT) || (rotg->eType == erotgFLEX2T)))
{
- fprintf(fp, "# ref. grp. %d center %12.5e %12.5e %12.5e\n", g,
- erg->xc_ref_center[XX], erg->xc_ref_center[YY], erg->xc_ref_center[ZZ]);
+ fprintf(fp,
+ "# ref. grp. %d center %12.5e %12.5e %12.5e\n",
+ g,
+ erg->xc_ref_center[XX],
+ erg->xc_ref_center[YY],
+ erg->xc_ref_center[ZZ]);
- fprintf(fp, "# grp. %d init.center %12.5e %12.5e %12.5e\n", g, erg->xc_center[XX],
- erg->xc_center[YY], erg->xc_center[ZZ]);
+ fprintf(fp,
+ "# grp. %d init.center %12.5e %12.5e %12.5e\n",
+ g,
+ erg->xc_center[XX],
+ erg->xc_center[YY],
+ erg->xc_center[ZZ]);
}
if ((rotg->eType == erotgRM2) || (rotg->eType == erotgFLEX2) || (rotg->eType == erotgFLEX2T))
fprintf(fp,
"# theta_fit%d is determined by first evaluating the potential for %d "
"angles around theta_ref%d.\n",
- g, rotg->PotAngle_nstep, g);
+ g,
+ rotg->PotAngle_nstep,
+ g);
fprintf(fp,
"# The fit angle is the one with the smallest potential. It is given as "
"the deviation\n");
buf[0] = '\0';
}
- fprintf(fp, "#\n# ROTATION GROUP %d '%s',%s fit type '%s'.\n", g,
- erotg_names[rotg->eType], buf, erotg_fitnames[rotg->eFittype]);
+ fprintf(fp,
+ "#\n# ROTATION GROUP %d '%s',%s fit type '%s'.\n",
+ g,
+ erotg_names[rotg->eType],
+ buf,
+ erotg_fitnames[rotg->eFittype]);
/* Special type of fitting using the potential minimum. This is
* done for the whole group only, not for the individual slabs. */
fprintf(fp,
"# To obtain theta_fit%d, the potential is evaluated for %d angles "
"around theta_ref%d\n",
- g, rotg->PotAngle_nstep, g);
+ g,
+ rotg->PotAngle_nstep,
+ g);
fprintf(fp,
"# The fit angle in the rotation standard outfile is the one with "
"minimal energy E(theta_fit) [kJ/mol].\n");
const gmx_enfrotgrp* erg = &er->enfrotgrp[g];
if (ISFLEX(rotg))
{
- fprintf(fp, "# Rotation group %d (%s), slab distance %f nm.\n", g,
- erotg_names[rotg->eType], rotg->slab_dist);
+ fprintf(fp,
+ "# Rotation group %d (%s), slab distance %f nm.\n",
+ g,
+ erotg_names[rotg->eType],
+ rotg->slab_dist);
fprintf(fp,
"# The scalar tau is the torque (kJ/mol) in the direction of the rotation "
"vector.\n");
fprintf(fp, "# To obtain the vectorial torque, multiply tau with\n");
- fprintf(fp, "# rot-vec%d %10.3e %10.3e %10.3e\n", g, erg->vec[XX],
- erg->vec[YY], erg->vec[ZZ]);
+ fprintf(fp,
+ "# rot-vec%d %10.3e %10.3e %10.3e\n",
+ g,
+ erg->vec[XX],
+ erg->vec[YY],
+ erg->vec[ZZ]);
fprintf(fp, "#\n");
}
}
/* From the point of view of the current positions, the reference has rotated
* backwards. Since we output the angle relative to the fixed reference,
* we need the minus sign. */
- fitangle = -opt_angle_analytic(erg->xc_ref_sorted, fitcoords, erg->mc_sorted, erg->rotg->nat,
- erg->xc_ref_center, center, erg->vec);
+ fitangle = -opt_angle_analytic(
+ erg->xc_ref_sorted, fitcoords, erg->mc_sorted, erg->rotg->nat, erg->xc_ref_center, center, erg->vec);
return fitangle;
}
clear_rvec(ref_center);
clear_rvec(act_center);
}
- fitangle = -opt_angle_analytic(sd->ref, sd->x, sd->weight, sd->nat, ref_center,
- act_center, erg->vec);
+ fitangle = -opt_angle_analytic(
+ sd->ref, sd->x, sd->weight, sd->nat, ref_center, act_center, erg->vec);
fprintf(fp, "%6d%6d%12.3f", n, sd->nat, fitangle);
}
}
}
#ifdef SUM_PARTS
- fprintf(stderr, "sum1: %15.8f %15.8f %15.8f\n", -erg->rotg->k * sum1vec[XX],
- -erg->rotg->k * sum1vec[YY], -erg->rotg->k * sum1vec[ZZ]);
- fprintf(stderr, "sum2: %15.8f %15.8f %15.8f\n", erg->rotg->k * sum2vec[XX],
- erg->rotg->k * sum2vec[YY], erg->rotg->k * sum2vec[ZZ]);
- fprintf(stderr, "sum3: %15.8f %15.8f %15.8f\n", -erg->rotg->k * sum3vec[XX],
- -erg->rotg->k * sum3vec[YY], -erg->rotg->k * sum3vec[ZZ]);
- fprintf(stderr, "sum4: %15.8f %15.8f %15.8f\n", 0.5 * erg->rotg->k * sum4vec[XX],
- 0.5 * erg->rotg->k * sum4vec[YY], 0.5 * erg->rotg->k * sum4vec[ZZ]);
+ fprintf(stderr,
+ "sum1: %15.8f %15.8f %15.8f\n",
+ -erg->rotg->k * sum1vec[XX],
+ -erg->rotg->k * sum1vec[YY],
+ -erg->rotg->k * sum1vec[ZZ]);
+ fprintf(stderr,
+ "sum2: %15.8f %15.8f %15.8f\n",
+ erg->rotg->k * sum2vec[XX],
+ erg->rotg->k * sum2vec[YY],
+ erg->rotg->k * sum2vec[ZZ]);
+ fprintf(stderr,
+ "sum3: %15.8f %15.8f %15.8f\n",
+ -erg->rotg->k * sum3vec[XX],
+ -erg->rotg->k * sum3vec[YY],
+ -erg->rotg->k * sum3vec[ZZ]);
+ fprintf(stderr,
+ "sum4: %15.8f %15.8f %15.8f\n",
+ 0.5 * erg->rotg->k * sum4vec[XX],
+ 0.5 * erg->rotg->k * sum4vec[YY],
+ 0.5 * erg->rotg->k * sum4vec[ZZ]);
#endif
PRINT_FORCE_J
/* Check whether we have reference data to compare against */
if (erg->slab_first < erg->slab_first_ref)
{
- gmx_fatal(FARGS, "%s No reference data for first slab (n=%d), unable to proceed.", RotStr,
- erg->slab_first);
+ gmx_fatal(FARGS, "%s No reference data for first slab (n=%d), unable to proceed.", RotStr, erg->slab_first);
}
/* Check whether we have reference data to compare against */
if (erg->slab_last > erg->slab_last_ref)
{
- gmx_fatal(FARGS, "%s No reference data for last slab (n=%d), unable to proceed.", RotStr,
- erg->slab_last);
+ gmx_fatal(FARGS, "%s No reference data for last slab (n=%d), unable to proceed.", RotStr, erg->slab_last);
}
}
/* Rotate with the alternative angle. Like rotate_local_reference(),
* just for a single local atom */
- mvmul(erg->PotAngleFit->rotmat[ifit], erg->rotg->x_ref[jj],
- fit_xr_loc); /* fit_xr_loc = Omega*(y_i-y_c) */
+ mvmul(erg->PotAngleFit->rotmat[ifit], erg->rotg->x_ref[jj], fit_xr_loc); /* fit_xr_loc = Omega*(y_i-y_c) */
/* Calculate Omega*(y_i-y_c)-(x_i-x_c) */
rvec_sub(fit_xr_loc, xi_xc, dr);
/* Rotate with the alternative angle. Like rotate_local_reference(),
* just for a single local atom */
- mvmul(erg->PotAngleFit->rotmat[ifit], erg->rotg->x_ref[jj],
- fit_tmpvec); /* fit_tmpvec = Omega*(yj0-u) */
+ mvmul(erg->PotAngleFit->rotmat[ifit], erg->rotg->x_ref[jj], fit_tmpvec); /* fit_tmpvec = Omega*(yj0-u) */
/* Calculate Omega.(yj0-u) */
cprod(erg->vec, fit_tmpvec, tmpvec); /* tmpvec = v x Omega.(yj0-u) */
int iigrp = collectiveRotationGroupIndex[j];
/* Rotate with the alternative angle. Like rotate_local_reference(),
* just for a single local atom */
- mvmul(erg->PotAngleFit->rotmat[ifit], erg->rotg->x_ref[iigrp],
- fit_rj); /* fit_rj = Omega*(yj0-u) */
+ mvmul(erg->PotAngleFit->rotmat[ifit], erg->rotg->x_ref[iigrp], fit_rj); /* fit_rj = Omega*(yj0-u) */
}
fit_fac = iprod(v_xj_u, fit_rj); /* fac = (v x (xj-u)).fit_rj */
/* Add to the rotation potential for this angle: */
if ((nullptr != fplog) && bVerbose)
{
- fprintf(fplog, "%s allocating memory to store data for %d slabs (rotation group %d).\n",
- RotStr, nslabs, erg->groupIndex);
+ fprintf(fplog,
+ "%s allocating memory to store data for %d slabs (rotation group %d).\n",
+ RotStr,
+ nslabs,
+ erg->groupIndex);
}
snew(erg->slab_center, nslabs);
snew(erg->slab_center_ref, nslabs);
{
nat_max = std::max(nat_max, erg->rotg->nat);
- init_rot_group(fplog, cr, erg, x_pbc, mtop, mdrunOptions.verbose, er->out_slabs,
- MASTER(cr) ? globalState->box : nullptr, ir,
+ init_rot_group(fplog,
+ cr,
+ erg,
+ x_pbc,
+ mtop,
+ mdrunOptions.verbose,
+ er->out_slabs,
+ MASTER(cr) ? globalState->box : nullptr,
+ ir,
!er->restartWithAppending); /* Do not output the reference centers
* again if we are appending */
}
/* Transfer the rotation group's positions such that every node has
* all of them. Every node contributes its local positions x and stores
* it in the collective erg->xc array. */
- communicate_group_positions(cr, erg->xc, erg->xc_shifts, erg->xc_eshifts, bNS, x,
- rotg->nat, erg->atomSet->numAtomsLocal(),
+ communicate_group_positions(cr,
+ erg->xc,
+ erg->xc_shifts,
+ erg->xc_eshifts,
+ bNS,
+ x,
+ rotg->nat,
+ erg->atomSet->numAtomsLocal(),
erg->atomSet->localIndex().data(),
- erg->atomSet->collectiveIndex().data(), erg->xc_old, box);
+ erg->atomSet->collectiveIndex().data(),
+ erg->xc_old,
+ box);
}
else
{
/* Get the center of the rotation group */
if ((rotg->eType == erotgISOPF) || (rotg->eType == erotgPMPF))
{
- get_center_comm(cr, erg->x_loc_pbc, erg->m_loc, erg->atomSet->numAtomsLocal(),
- rotg->nat, erg->xc_center);
+ get_center_comm(
+ cr, erg->x_loc_pbc, erg->m_loc, erg->atomSet->numAtomsLocal(), rotg->nat, erg->xc_center);
}
}