From 81be9b37de9c9379ec96dabf5d31f9e931b5f7b7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 2 Oct 2017 17:15:13 -0400 Subject: [PATCH] formatting, whitespace and include file/constants cleanup --- src/USER-UEF/compute_pressure_uef.cpp | 12 ++++++------ src/USER-UEF/compute_pressure_uef.h | 10 +++++----- src/USER-UEF/compute_temp_uef.cpp | 8 ++++---- src/USER-UEF/compute_temp_uef.h | 8 ++++---- src/USER-UEF/dump_cfg_uef.cpp | 6 +++--- src/USER-UEF/dump_cfg_uef.h | 2 +- src/USER-UEF/fix_nh_uef.cpp | 6 +++--- src/USER-UEF/fix_npt_uef.cpp | 5 ----- src/USER-UEF/fix_npt_uef.h | 2 +- src/USER-UEF/fix_nvt_uef.cpp | 5 ----- src/USER-UEF/fix_nvt_uef.h | 2 +- src/USER-UEF/uef_utils.cpp | 24 +++++++++++++----------- src/USER-UEF/uef_utils.h | 20 +++++--------------- 13 files changed, 46 insertions(+), 64 deletions(-) diff --git a/src/USER-UEF/compute_pressure_uef.cpp b/src/USER-UEF/compute_pressure_uef.cpp index e9bbdf0cf4..5c6ef0940f 100644 --- a/src/USER-UEF/compute_pressure_uef.cpp +++ b/src/USER-UEF/compute_pressure_uef.cpp @@ -13,9 +13,9 @@ Contributing author: David Nicholson (MIT) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include +#include +#include #include "compute_pressure_uef.h" #include "fix_nh_uef.h" #include "update.h" @@ -118,7 +118,7 @@ void ComputePressureUef::compute_vector() if (force->kspace && kspace_virial && force->kspace->scalar_pressure_flag) error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' for " - "tensor components with kspace_style msm"); + "tensor components with kspace_style msm"); // invoke temperature if it hasn't been already @@ -131,7 +131,7 @@ void ComputePressureUef::compute_vector() if (dimension == 3) { inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); - virial_compute(6,3); + virial_compute(6,3); if (in_fix) virial_rot(virial,rot); else @@ -182,7 +182,7 @@ void ComputePressureUef::virial_rot(double *x, const double r[3][3]) // [00 10 20 ] [ 0 3 4 ] [00 01 02 ] // [01 11 21 ] [ 3 1 5 ] [10 11 12 ] // [02 12 22 ] [ 4 5 2 ] [20 21 22 ] - for (int k = 0; k<3; ++k) + for (int k = 0; k<3; ++k) { t[0][k] = x[0]*r[0][k] + x[3]*r[1][k] + x[4]*r[2][k]; t[1][k] = x[3]*r[0][k] + x[1]*r[1][k] + x[5]*r[2][k]; diff --git a/src/USER-UEF/compute_pressure_uef.h b/src/USER-UEF/compute_pressure_uef.h index 2f591b64d8..d3a4d3195c 100644 --- a/src/USER-UEF/compute_pressure_uef.h +++ b/src/USER-UEF/compute_pressure_uef.h @@ -1,4 +1,4 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -31,11 +31,11 @@ class ComputePressureUef : public ComputePressure { ComputePressureUef(class LAMMPS *, int, char **); virtual ~ComputePressureUef(){} virtual void init(); - virtual void compute_vector(); - virtual double compute_scalar(); + virtual void compute_vector(); + virtual double compute_scalar(); void update_rot(); bool in_fix; //true if this compute is used in fix/nvt/npt - + protected: bool ext_flags[3]; // true if used in average output pressure @@ -57,7 +57,7 @@ only additions are: E: Can't use compute pressure/uef without defining a fix nvt/npt/uef -Self-explanatory. +Self-explanatory. W: The temperature used in compute pressure/uef is not of style temp/uef diff --git a/src/USER-UEF/compute_temp_uef.cpp b/src/USER-UEF/compute_temp_uef.cpp index 8c8c9be293..2947adc879 100644 --- a/src/USER-UEF/compute_temp_uef.cpp +++ b/src/USER-UEF/compute_temp_uef.cpp @@ -13,8 +13,8 @@ Contributing author: David Nicholson (MIT) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include +#include #include "compute_temp_uef.h" #include "fix_nh_uef.h" #include "update.h" @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; * Base constructor initialized to use rotation matrix * ----------------------------------------------------------------------*/ ComputeTempUef::ComputeTempUef(LAMMPS *lmp, int narg, char **arg) : - ComputeTemp(lmp, narg, arg) + ComputeTemp(lmp, narg, arg) { rot_flag=true; } @@ -94,7 +94,7 @@ void ComputeTempUef::virial_rot(double *x, const double r[3][3]) // [00 10 20 ] [ 0 3 4 ] [00 01 02 ] // [01 11 21 ] [ 3 1 5 ] [10 11 12 ] // [02 12 22 ] [ 4 5 2 ] [20 21 22 ] - for (int k = 0; k<3; ++k) + for (int k = 0; k<3; ++k) { t[0][k] = x[0]*r[0][k] + x[3]*r[1][k] + x[4]*r[2][k]; t[1][k] = x[3]*r[0][k] + x[1]*r[1][k] + x[5]*r[2][k]; diff --git a/src/USER-UEF/compute_temp_uef.h b/src/USER-UEF/compute_temp_uef.h index 2e9dc901c0..460e2b18c0 100644 --- a/src/USER-UEF/compute_temp_uef.h +++ b/src/USER-UEF/compute_temp_uef.h @@ -1,4 +1,4 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -31,10 +31,10 @@ class ComputeTempUef : public ComputeTemp { ComputeTempUef(class LAMMPS *, int, char **); virtual ~ComputeTempUef(){} virtual void init(); - virtual void compute_vector(); + virtual void compute_vector(); void yes_rot(); void no_rot(); - + protected: bool rot_flag; @@ -55,6 +55,6 @@ only addition is: E: Can't use compute temp/uef without defining a fix nvt/npt/uef -Self-explanatory. +Self-explanatory. */ diff --git a/src/USER-UEF/dump_cfg_uef.cpp b/src/USER-UEF/dump_cfg_uef.cpp index 44e1f8c5ae..4b0c08275a 100644 --- a/src/USER-UEF/dump_cfg_uef.cpp +++ b/src/USER-UEF/dump_cfg_uef.cpp @@ -36,8 +36,8 @@ enum{INT,DOUBLE,STRING,BIGINT}; // same as in DumpCustom #define ONEFIELD 32 #define DELTA 1048576 -/* ---------------------------------------------------------------------- - * base method is mostly fine, just need to find the FixNHUef +/* ---------------------------------------------------------------------- + * base method is mostly fine, just need to find the FixNHUef * ----------------------------------------------------------------------*/ void DumpCFGUef::init_style() { @@ -58,7 +58,7 @@ void DumpCFGUef::init_style() ifix_uef=i; } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- * this is really the only difference between the base class and this one. * since the output is in scaled coordinates, changing the simulation box * edges to the flow frame will put coordinates in the flow frame too. diff --git a/src/USER-UEF/dump_cfg_uef.h b/src/USER-UEF/dump_cfg_uef.h index 059fc63008..d2881136ad 100644 --- a/src/USER-UEF/dump_cfg_uef.h +++ b/src/USER-UEF/dump_cfg_uef.h @@ -43,7 +43,7 @@ class DumpCFGUef : public DumpCFG { #endif /* ERROR/WARNING messages: - + E: Can't use dump cfg/uef without defining a fix nvt/npt/uef Self-explanatory. diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index fe342f1efd..ee31674128 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -13,9 +13,9 @@ Contributing author: David Nicholson (MIT) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include +#include +#include #include "fix_nh_uef.h" #include "atom.h" #include "force.h" diff --git a/src/USER-UEF/fix_npt_uef.cpp b/src/USER-UEF/fix_npt_uef.cpp index 1bf027bf85..b8ab1eccf9 100644 --- a/src/USER-UEF/fix_npt_uef.cpp +++ b/src/USER-UEF/fix_npt_uef.cpp @@ -13,14 +13,10 @@ Contributing author: David Nicholson (MIT) ------------------------------------------------------------------------- */ -#include "string.h" #include "fix_npt_uef.h" -#include "modify.h" #include "error.h" using namespace LAMMPS_NS; -using namespace FixConst; - FixNPTUef::FixNPTUef(LAMMPS *lmp, int narg, char **arg) : FixNHUef(lmp, narg, arg) @@ -29,5 +25,4 @@ FixNPTUef::FixNPTUef(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Temperature control must be used with fix npt/uef"); if (!pstat_flag) error->all(FLERR,"Pressure control must be used with fix npt/uef"); - } diff --git a/src/USER-UEF/fix_npt_uef.h b/src/USER-UEF/fix_npt_uef.h index a77060a937..4c0cd28ae0 100644 --- a/src/USER-UEF/fix_npt_uef.h +++ b/src/USER-UEF/fix_npt_uef.h @@ -1,4 +1,4 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov diff --git a/src/USER-UEF/fix_nvt_uef.cpp b/src/USER-UEF/fix_nvt_uef.cpp index 589a4b5b56..2fd4a28545 100644 --- a/src/USER-UEF/fix_nvt_uef.cpp +++ b/src/USER-UEF/fix_nvt_uef.cpp @@ -13,14 +13,10 @@ Contributing author: David Nicholson (MIT) ------------------------------------------------------------------------- */ -#include "string.h" #include "fix_nvt_uef.h" -#include "modify.h" #include "error.h" using namespace LAMMPS_NS; -using namespace FixConst; - FixNVTUef::FixNVTUef(LAMMPS *lmp, int narg, char **arg) : FixNHUef(lmp, narg, arg) @@ -29,7 +25,6 @@ FixNVTUef::FixNVTUef(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Temperature control must be used with fix nvt/uef"); if (pstat_flag) error->all(FLERR,"Pressure control can't be used with fix nvt/uef"); - } diff --git a/src/USER-UEF/fix_nvt_uef.h b/src/USER-UEF/fix_nvt_uef.h index a6eba7a284..718e36e756 100644 --- a/src/USER-UEF/fix_nvt_uef.h +++ b/src/USER-UEF/fix_nvt_uef.h @@ -1,4 +1,4 @@ -/* ---------------------------------------------------------------------- +/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov diff --git a/src/USER-UEF/uef_utils.cpp b/src/USER-UEF/uef_utils.cpp index 37ee896c7e..f270fe1d8b 100644 --- a/src/USER-UEF/uef_utils.cpp +++ b/src/USER-UEF/uef_utils.cpp @@ -11,20 +11,22 @@ See the README file in the top-level LAMMPS directory. Contributing author: David Nicholson (MIT) -------------------------------------------------------------------------- +------------------------------------------------------------------------- - This class contains functions to calculate the evolution of the periodic + This class contains functions to calculate the evolution of the periodic simulation box under elongational flow as described by Matthew Dobson in the arXiv preprint at http://arxiv.org/abs/1408.7078 - + Additionally, there are methods to do a lattice reduction to further reduce the simulation box using the method of Igor Semaev at http://link.springer.com/chapter/10.1007%2F3-540-44670-2_13 */ + #include #include "uef_utils.h" -namespace LAMMPS_NS{ namespace UEF_utils{ +namespace LAMMPS_NS { + namespace UEF_utils{ UEFBox::UEFBox() { @@ -46,7 +48,7 @@ UEFBox::UEFBox() // strain = w1 * theta1 + w2 * theta2 theta[0]=theta[1]=0; - + //set up the initial box l and change of basis matrix r for (int k=0;k<3;k++) for (int j=0;j<3;j++) @@ -124,8 +126,8 @@ void UEFBox::step_deform(const double ex, const double ey) theta[0] +=winv[0][0]*ex + winv[0][1]*ey; theta[1] +=winv[1][0]*ex + winv[1][1]*ey; - // deformation of the box. reduce() needs to - // be called regularly or calculation will become + // deformation of the box. reduce() needs to + // be called regularly or calculation will become // unstable double eps[3]; eps[0]=ex; eps[1] = ey; eps[2] = -ex-ey; @@ -148,7 +150,7 @@ bool UEFBox::reduce() theta[0] -= f1; theta[1] -= f2; - // store old change or basis matrix to determine if it + // store old change or basis matrix to determine if it // changes int r0[3][3]; for (int k=0;k<3;k++) @@ -157,7 +159,7 @@ bool UEFBox::reduce() // this modifies the old change basis matrix to // handle the case where the automorphism transforms - // the box but the reduced basis doesn't change + // the box but the reduced basis doesn't change // (r0 should still equal r at the end) if (f1 > 0) for (int k=0;k