apply clang-format

This commit is contained in:
Axel Kohlmeyer
2021-12-21 13:20:25 -05:00
parent c780768e91
commit 364d0be28c
4 changed files with 109 additions and 105 deletions

View File

@ -29,7 +29,9 @@ DumpStyle(netcdf,DumpNetCDF);
#include "dump_custom.h"
namespace LAMMPS_NS {
namespace NetCDFUnits {enum Quantity : int;} // forward declaration
namespace NetCDFUnits {
enum Quantity : int;
} // namespace NetCDFUnits
const int NC_FIELD_NAME_MAX = 100;
const int DUMP_NC_MAX_DIMS = 100;
@ -43,11 +45,11 @@ class DumpNetCDF : public DumpCustom {
private:
// per-atoms quantities (positions, velocities, etc.)
struct nc_perat_t {
int dims; // number of dimensions
int field[DUMP_NC_MAX_DIMS]; // field indices corresponding to the dim.
char name[NC_FIELD_NAME_MAX]; // field name
int var; // NetCDF variable
NetCDFUnits::Quantity quantity; // type of the quantity
int dims; // number of dimensions
int field[DUMP_NC_MAX_DIMS]; // field indices corresponding to the dim.
char name[NC_FIELD_NAME_MAX]; // field name
int var; // NetCDF variable
NetCDFUnits::Quantity quantity; // type of the quantity
bool constant; // is this property per file (not per frame)
int ndumped; // number of enties written for this prop.
@ -64,8 +66,8 @@ class DumpNetCDF : public DumpCustom {
int *thermovar; // NetCDF variables for thermo output
int type_nc_real; // netcdf type to use for real variables: float or double
bool thermo; // write thermo output to netcdf file
int type_nc_real; // netcdf type to use for real variables: float or double
bool thermo; // write thermo output to netcdf file
bigint n_buffer; // size of buffer
bigint *int_buffer; // buffer for passing data to netcdf

View File

@ -29,7 +29,9 @@ DumpStyle(netcdf/mpiio,DumpNetCDFMPIIO);
#include "dump_custom.h"
namespace LAMMPS_NS {
namespace NetCDFUnits {enum Quantity : int;} // forward declaration
namespace NetCDFUnits {
enum Quantity : int;
} // namespace NetCDFUnits
const int NC_MPIIO_FIELD_NAME_MAX = 100;
const int DUMP_NC_MPIIO_MAX_DIMS = 100;
@ -63,8 +65,8 @@ class DumpNetCDFMPIIO : public DumpCustom {
int *thermovar; // NetCDF variables for thermo output
int type_nc_real; // netcdf type to use for real variables: float or double
bool thermo; // write thermo output to netcdf file
int type_nc_real; // netcdf type to use for real variables: float or double
bool thermo; // write thermo output to netcdf file
bigint n_buffer; // size of buffer
bigint *int_buffer; // buffer for passing data to netcdf

View File

@ -1,4 +1,3 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -24,7 +23,8 @@
using namespace LAMMPS_NS;
std::string NetCDFUnits::get_unit_for(const char* unit_style, Quantity quantity, Error* error) {
std::string NetCDFUnits::get_unit_for(const char *unit_style, Quantity quantity, Error *error)
{
if (!strcmp(unit_style, "lj")) {
if (quantity == Quantity::UNKNOWN) {
return "";
@ -33,108 +33,108 @@ std::string NetCDFUnits::get_unit_for(const char* unit_style, Quantity quantity,
}
} else if (!strcmp(unit_style, "real")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "femtosecond";
case Quantity::DISTANCE:
return "angstrom";
case Quantity::VELOCITY:
return "angstrom/femtosecond";
case Quantity::FORCE:
return "(Kcal/mol)/angstrom)";
case Quantity::DIPOLE_MOMENT:
return "e * angstrom";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "femtosecond";
case Quantity::DISTANCE:
return "angstrom";
case Quantity::VELOCITY:
return "angstrom/femtosecond";
case Quantity::FORCE:
return "(Kcal/mol)/angstrom)";
case Quantity::DIPOLE_MOMENT:
return "e * angstrom";
}
} else if (!strcmp(unit_style, "metal")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "picosecond";
case Quantity::DISTANCE:
return "angstrom";
case Quantity::VELOCITY:
return "angstrom/picosecond";
case Quantity::FORCE:
return "eV/angstrom";
case Quantity::DIPOLE_MOMENT:
return "e * angstrom";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "picosecond";
case Quantity::DISTANCE:
return "angstrom";
case Quantity::VELOCITY:
return "angstrom/picosecond";
case Quantity::FORCE:
return "eV/angstrom";
case Quantity::DIPOLE_MOMENT:
return "e * angstrom";
}
} else if (!strcmp(unit_style, "si")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "second";
case Quantity::DISTANCE:
return "meter";
case Quantity::VELOCITY:
return "meter/second";
case Quantity::FORCE:
return "Newton";
case Quantity::DIPOLE_MOMENT:
return "Coulomb * meter";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "second";
case Quantity::DISTANCE:
return "meter";
case Quantity::VELOCITY:
return "meter/second";
case Quantity::FORCE:
return "Newton";
case Quantity::DIPOLE_MOMENT:
return "Coulomb * meter";
}
} else if (!strcmp(unit_style, "cgs")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "second";
case Quantity::DISTANCE:
return "centimeter";
case Quantity::VELOCITY:
return "centimeter/second";
case Quantity::FORCE:
return "dynes";
case Quantity::DIPOLE_MOMENT:
return "statcoul * cm";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "second";
case Quantity::DISTANCE:
return "centimeter";
case Quantity::VELOCITY:
return "centimeter/second";
case Quantity::FORCE:
return "dynes";
case Quantity::DIPOLE_MOMENT:
return "statcoul * cm";
}
} else if (!strcmp(unit_style, "electron")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "femtoseconds";
case Quantity::DISTANCE:
return "Bohr";
case Quantity::VELOCITY:
return "Bohr/atomic time units";
case Quantity::FORCE:
return "Hartree/Bohr";
case Quantity::DIPOLE_MOMENT:
return "Debye";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "femtoseconds";
case Quantity::DISTANCE:
return "Bohr";
case Quantity::VELOCITY:
return "Bohr/atomic time units";
case Quantity::FORCE:
return "Hartree/Bohr";
case Quantity::DIPOLE_MOMENT:
return "Debye";
}
} else if (!strcmp(unit_style, "micro")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "microseconds";
case Quantity::DISTANCE:
return "micrometers";
case Quantity::VELOCITY:
return "micrometers/microsecond";
case Quantity::FORCE:
return "picogram * micrometer/microsecond^2";
case Quantity::DIPOLE_MOMENT:
return "picocoulomb * micrometer";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "microseconds";
case Quantity::DISTANCE:
return "micrometers";
case Quantity::VELOCITY:
return "micrometers/microsecond";
case Quantity::FORCE:
return "picogram * micrometer/microsecond^2";
case Quantity::DIPOLE_MOMENT:
return "picocoulomb * micrometer";
}
} else if (!strcmp(unit_style, "nano")) {
switch (quantity) {
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "nanoseconds";
case Quantity::DISTANCE:
return "nanometers";
case Quantity::VELOCITY:
return "nanometers/nanosecond";
case Quantity::FORCE:
return "attogram * nanometer/nanosecond^2";
case Quantity::DIPOLE_MOMENT:
return "e * nanometer";
case Quantity::UNKNOWN:
return "";
case Quantity::TIME:
return "nanoseconds";
case Quantity::DISTANCE:
return "nanometers";
case Quantity::VELOCITY:
return "nanometers/nanosecond";
case Quantity::FORCE:
return "attogram * nanometer/nanosecond^2";
case Quantity::DIPOLE_MOMENT:
return "e * nanometer";
}
}

View File

@ -26,21 +26,21 @@ namespace LAMMPS_NS {
class Error;
namespace NetCDFUnits {
// type of quantity for per-atom values (used to get the unit)
enum Quantity : int {
// type of quantity for per-atom values (used to get the unit)
enum Quantity : int {
UNKNOWN = 0,
TIME,
DISTANCE,
VELOCITY,
FORCE,
DIPOLE_MOMENT,
};
};
// get the name of the unit for the given `quantity` in the given LAMMPS
// `unit_style` any error will be reported through `error`
std::string get_unit_for(const char* unit_style, Quantity quantity, Error* error);
}
}
// get the name of the unit for the given `quantity` in the given LAMMPS
// `unit_style` any error will be reported through `error`
std::string get_unit_for(const char *unit_style, Quantity quantity, Error *error);
} // namespace NetCDFUnits
} // namespace LAMMPS_NS
#endif
#endif