enable and apply clang-format to a whole bunch of small .cpp files in src/

This commit is contained in:
Axel Kohlmeyer
2023-03-25 09:59:25 -04:00
parent 22a1cf935e
commit 8cd34af4f0
38 changed files with 604 additions and 645 deletions

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -14,20 +13,19 @@
#include "compute_gyration.h"
#include "update.h"
#include "atom.h"
#include "group.h"
#include "domain.h"
#include "error.h"
#include "group.h"
#include "update.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg)
ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
{
if (narg != 3) error->all(FLERR,"Illegal compute gyration command");
if (narg != 3) error->all(FLERR, "Illegal compute gyration command");
scalar_flag = vector_flag = 1;
size_vector = 6;
@ -41,7 +39,7 @@ ComputeGyration::ComputeGyration(LAMMPS *lmp, int narg, char **arg) :
ComputeGyration::~ComputeGyration()
{
delete [] vector;
delete[] vector;
}
/* ---------------------------------------------------------------------- */
@ -59,8 +57,8 @@ double ComputeGyration::compute_scalar()
double xcm[3];
if (group->dynamic[igroup]) masstotal = group->mass(igroup);
group->xcm(igroup,masstotal,xcm);
scalar = group->gyration(igroup,masstotal,xcm);
group->xcm(igroup, masstotal, xcm);
scalar = group->gyration(igroup, masstotal, xcm);
return scalar;
}
@ -75,7 +73,7 @@ void ComputeGyration::compute_vector()
invoked_vector = update->ntimestep;
double xcm[3];
group->xcm(igroup,masstotal,xcm);
group->xcm(igroup, masstotal, xcm);
double **x = atom->x;
int *mask = atom->mask;
@ -85,7 +83,7 @@ void ComputeGyration::compute_vector()
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
double dx,dy,dz,massone;
double dx, dy, dz, massone;
double unwrap[3];
double rg[6];
@ -93,24 +91,25 @@ void ComputeGyration::compute_vector()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
if (rmass) massone = rmass[i];
else massone = mass[type[i]];
if (rmass)
massone = rmass[i];
else
massone = mass[type[i]];
domain->unmap(x[i],image[i],unwrap);
domain->unmap(x[i], image[i], unwrap);
dx = unwrap[0] - xcm[0];
dy = unwrap[1] - xcm[1];
dz = unwrap[2] - xcm[2];
rg[0] += dx*dx * massone;
rg[1] += dy*dy * massone;
rg[2] += dz*dz * massone;
rg[3] += dx*dy * massone;
rg[4] += dx*dz * massone;
rg[5] += dy*dz * massone;
rg[0] += dx * dx * massone;
rg[1] += dy * dy * massone;
rg[2] += dz * dz * massone;
rg[3] += dx * dy * massone;
rg[4] += dx * dz * massone;
rg[5] += dy * dz * massone;
}
MPI_Allreduce(rg,vector,6,MPI_DOUBLE,MPI_SUM,world);
MPI_Allreduce(rg, vector, 6, MPI_DOUBLE, MPI_SUM, world);
if (masstotal > 0.0)
for (int i = 0; i < 6; i++)
vector[i] /= masstotal;
for (int i = 0; i < 6; i++) vector[i] /= masstotal;
}