Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions src/ADIOS/adios_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,9 @@
#ifndef LMP_ADIOS_COMMON_H
#define LMP_ADIOS_COMMON_H

// common definitions for all ADIOS package classes

static const char default_config[] = "<?xml version=\"1.0\"?>\n"
"<adios-config>\n"
" <io name=\"atom\">\n"
" <engine type=\"BP4\">\n"
" <parameter key=\"substreams\" value=\"1\"/>\n"
" </engine>\n"
" </io>\n"
" <io name=\"custom\">\n"
" <engine type=\"BP4\">\n"
" <parameter key=\"substreams\" value=\"1\"/>\n"
" </engine>\n"
" </io>\n"
" <io name=\"read_dump\">\n"
" <engine type=\"BP4\">\n"
" </engine>\n"
" </io>\n"
"</adios-config>\n";
// common definition for all ADIOS package classes
namespace LAMMPS_ADIOS {
extern const char *default_config;
}

#endif
61 changes: 44 additions & 17 deletions src/ADIOS/dump_atom_adios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@
#include "adios_common.h"

using namespace LAMMPS_NS;
using namespace LAMMPS_ADIOS;

// common definition for all ADIOS package classes

const char *LAMMPS_ADIOS::default_config =
(const char *) "<?xml version=\"1.0\"?>\n"
"<adios-config>\n"
" <io name=\"atom\">\n"
" <engine type=\"BP4\">\n"
" <parameter key=\"substreams\" value=\"1\"/>\n"
" </engine>\n"
" </io>\n"
" <io name=\"custom\">\n"
" <engine type=\"BP4\">\n"
" <parameter key=\"substreams\" value=\"1\"/>\n"
" </engine>\n"
" </io>\n"
" <io name=\"read_dump\">\n"
" <engine type=\"BP4\">\n"
" </engine>\n"
" </io>\n"
"</adios-config>\n";

namespace LAMMPS_NS {
class DumpAtomADIOSInternal {
Expand Down Expand Up @@ -235,24 +257,29 @@ void DumpAtomADIOS::init_style()

// setup column string

std::vector<std::string> columnNames;

if (scale_flag == 0 && image_flag == 0) {
columns = (char *) "id type x y z";
columnNames = {"id", "type", "x", "y", "z"};
} else if (scale_flag == 0 && image_flag == 1) {
columns = (char *) "id type x y z ix iy iz";
columnNames = {"id", "type", "x", "y", "z", "ix", "iy", "iz"};
} else if (scale_flag == 1 && image_flag == 0) {
columns = (char *) "id type xs ys zs";
columnNames = {"id", "type", "xs", "ys", "zs"};
} else if (scale_flag == 1 && image_flag == 1) {
columns = (char *) "id type xs ys zs ix iy iz";
columnNames = {"id", "type", "xs", "ys", "zs", "ix", "iy", "iz"};
}
std::string default_columns;

for (int icol = 0; icol < (int) columnNames.size(); ++icol)
if (keyword_user[icol].size()) columnNames[icol] = keyword_user[icol];
if (scale_flag == 0 && image_flag == 0)
default_columns = "id type x y z";
else if (scale_flag == 0 && image_flag == 1)
default_columns = "id type x y z ix iy iz";
else if (scale_flag == 1 && image_flag == 0)
default_columns = "id type xs ys zs";
else if (scale_flag == 1 && image_flag == 1)
default_columns = "id type xs ys zs ix iy iz";

std::vector<std::string> columnNames = utils::split_words(default_columns);

int icol = 0;
columns.clear();
for (const auto &item : columnNames) {
if (columns.size()) columns += " ";
if (keyword_user[icol].size())
columns += keyword_user[icol];
else
columns += item;
++icol;
}

// setup function ptrs

Expand Down
9 changes: 5 additions & 4 deletions src/ADIOS/dump_custom_adios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "adios_common.h"

using namespace LAMMPS_NS;
using namespace LAMMPS_ADIOS;

namespace LAMMPS_NS {
class DumpCustomADIOSInternal {
Expand Down Expand Up @@ -80,15 +81,15 @@ DumpCustomADIOS::DumpCustomADIOS(LAMMPS *lmp, int narg, char **arg) : DumpCustom
}

internal->columnNames.reserve(nfield);
for (int i = 0; i < nfield; ++i) { internal->columnNames.emplace_back(earg[i]); }
for (int i = 0; i < nfield; ++i) internal->columnNames.emplace_back(earg[i]);
}

/* ---------------------------------------------------------------------- */

DumpCustomADIOS::~DumpCustomADIOS()
{
internal->columnNames.clear();
if (internal->fh) { internal->fh.Close(); }
if (internal->fh) internal->fh.Close();
delete internal->ad;
delete internal;
}
Expand Down Expand Up @@ -216,10 +217,10 @@ void DumpCustomADIOS::write()
internal->fh.Put<uint64_t>("nme", bnme);
internal->fh.Put<uint64_t>("offset", atomOffset);
// now write the atoms
internal->fh.Put<double>("atoms", buf);
internal->fh.Put<double>(internal->varAtoms, buf);
internal->fh.EndStep(); // I/O will happen now...

if (multifile) { internal->fh.Close(); }
if (multifile) internal->fh.Close();
}

/* ---------------------------------------------------------------------- */
Expand Down
1 change: 1 addition & 0 deletions src/ADIOS/reader_adios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "adios_common.h"

using namespace LAMMPS_NS;
using namespace LAMMPS_ADIOS;

static constexpr double SMALL = 1.0e-6;

Expand Down
4 changes: 3 additions & 1 deletion src/EXTRA-COMMAND/group2ndx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ void Group2Ndx::command(int narg, char **arg)
}

if (narg == 1) { // write out all groups
for (int i = 0; i < group->ngroup; ++i) { write_group(fp, i); }
for (int i = 0; i < Group::MAX_GROUP; ++i) {
if (group->names[i]) write_group(fp, i);
}
} else { // write only selected groups
for (int i = 1; i < narg; ++i) {
int gid = group->find(arg[i]);
Expand Down
11 changes: 7 additions & 4 deletions src/GRAPHICS/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace {
constexpr int NCOLORS = 140;
constexpr int NELEMENTS = 109;
constexpr double EPSILON = 1.0e-6;
constexpr double TRANS_DELTA = 0.01;

enum { NUMERIC, MINVALUE, MAXVALUE };
enum { CONTINUOUS, DISCRETE, SEQUENTIAL };
Expand Down Expand Up @@ -888,9 +889,9 @@ void Image::draw_pixmap(int xc, int yc, int pixwidth, int pixheight, const unsig
// we allow a few steps difference for each channel to account
// for rounding errors and reduce "bleeding" from interpolation

if ((fabs(pixelcolor[0] - transcolor[0]) < 0.01) &&
(fabs(pixelcolor[1] - transcolor[1]) < 0.01) &&
(fabs(pixelcolor[2] - transcolor[2]) < 0.01)) continue;
if ((fabs(pixelcolor[0] - transcolor[0]) < TRANS_DELTA) &&
(fabs(pixelcolor[1] - transcolor[1]) < TRANS_DELTA) &&
(fabs(pixelcolor[2] - transcolor[2]) < TRANS_DELTA)) continue;

draw_pixel(ix, iy, dist, normal, pixelcolor);
}
Expand Down Expand Up @@ -1359,6 +1360,7 @@ void Image::draw_pixel(int ix, int iy, double depth,
const double *surface, const double *surfaceColor)
{
if (!std::isfinite(depth)) return; // reject pixels with invalid depth buffer values
if (!surfaceColor) return; // reject pixels with an invalid color

double diffuseKey,diffuseFill,diffuseBack,specularKey;
if (depth < 0 || (depthBuffer[ix + iy*width] >= 0 && depth >= depthBuffer[ix + iy*width])) return;
Expand Down Expand Up @@ -2552,5 +2554,6 @@ double *ColorMap::value2color(double value)
return mentry[ibin%nentry].color;
}

return nullptr;
// always return a non-NULL pointer
return mentry[0].color;
}
8 changes: 4 additions & 4 deletions src/KOKKOS/atom_vec_ellipsoid_kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ void AtomVecEllipsoidKokkos::sync_pinned(ExecutionSpace space, uint64_t mask, in
if ((mask & V_MASK) && atomKK->k_v.need_sync_device())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_v,space,async_flag);
if ((mask & F_MASK) && atomKK->k_f.need_sync_device())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_f,space,async_flag);
perform_pinned_copy_transform<DAT::ttransform_kkacc_1d_3>(atomKK->k_f,space,async_flag);
if ((mask & TAG_MASK) && atomKK->k_tag.need_sync_device())
perform_pinned_copy<DAT::tdual_tagint_1d>(atomKK->k_tag,space,async_flag);
if ((mask & TYPE_MASK) && atomKK->k_type.need_sync_device())
Expand All @@ -958,7 +958,7 @@ void AtomVecEllipsoidKokkos::sync_pinned(ExecutionSpace space, uint64_t mask, in
if ((mask & ANGMOM_MASK) && atomKK->k_angmom.need_sync_device())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_angmom,space,async_flag);
if ((mask & TORQUE_MASK) && atomKK->k_torque.need_sync_device())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_torque,space,async_flag);
perform_pinned_copy_transform<DAT::ttransform_kkacc_1d_3>(atomKK->k_torque,space,async_flag);
if ((mask & ELLIPSOID_MASK) && atomKK->k_ellipsoid.need_sync_device())
perform_pinned_copy<DAT::tdual_int_1d>(atomKK->k_ellipsoid,space,async_flag);
if ((mask & BONUS_MASK) && k_bonus.need_sync_device())
Expand All @@ -969,7 +969,7 @@ void AtomVecEllipsoidKokkos::sync_pinned(ExecutionSpace space, uint64_t mask, in
if ((mask & V_MASK) && atomKK->k_v.need_sync_host())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_v,space,async_flag);
if ((mask & F_MASK) && atomKK->k_f.need_sync_host())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_f,space,async_flag);
perform_pinned_copy_transform<DAT::ttransform_kkacc_1d_3>(atomKK->k_f,space,async_flag);
if ((mask & TAG_MASK) && atomKK->k_tag.need_sync_host())
perform_pinned_copy<DAT::tdual_tagint_1d>(atomKK->k_tag,space,async_flag);
if ((mask & TYPE_MASK) && atomKK->k_type.need_sync_host())
Expand All @@ -983,7 +983,7 @@ void AtomVecEllipsoidKokkos::sync_pinned(ExecutionSpace space, uint64_t mask, in
if ((mask & ANGMOM_MASK) && atomKK->k_angmom.need_sync_host())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_angmom,space,async_flag);
if ((mask & TORQUE_MASK) && atomKK->k_torque.need_sync_host())
perform_pinned_copy_transform<DAT::ttransform_kkfloat_1d_3>(atomKK->k_torque,space,async_flag);
perform_pinned_copy_transform<DAT::ttransform_kkacc_1d_3>(atomKK->k_torque,space,async_flag);
if ((mask & ELLIPSOID_MASK) && atomKK->k_ellipsoid.need_sync_host())
perform_pinned_copy<DAT::tdual_int_1d>(atomKK->k_ellipsoid,space,async_flag);
if ((mask & BONUS_MASK) && k_bonus.need_sync_host())
Expand Down
6 changes: 3 additions & 3 deletions src/KOKKOS/atom_vec_ellipsoid_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ class AtomVecEllipsoidKokkos : public AtomVecKokkos, public AtomVecEllipsoid {

DAT::t_kkfloat_1d_3_lr d_x;
DAT::t_kkfloat_1d_3 d_v;
DAT::t_kkfloat_1d_3 d_f;
DAT::t_kkacc_1d_3 d_f;

DAT::t_kkfloat_1d d_rmass;
HAT::t_kkfloat_1d h_rmass;
DAT::t_kkfloat_1d_3 d_angmom;
HAT::t_kkfloat_1d_3 h_angmom;
DAT::t_kkfloat_1d_3 d_torque;
HAT::t_kkfloat_1d_3 h_torque;
DAT::t_kkacc_1d_3 d_torque;
HAT::t_kkacc_1d_3 h_torque;
DAT::t_int_1d d_ellipsoid;
HAT::t_int_1d h_ellipsoid;

Expand Down
2 changes: 1 addition & 1 deletion src/KOKKOS/bond_hybrid_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BondHybridKokkos : public BondHybrid {

DAT::tdual_int_1d k_map; // which style each bond type points to
DAT::tdual_int_1d k_nbondlist; // # of bonds in sub-style bondlists
DAT::tdual_int_3d k_bondlist; // bondlist for each sub-style
DAT::tdual_int_3d_lr k_bondlist; // bondlist for each sub-style

void allocate() override;
void deallocate() override;
Expand Down
2 changes: 1 addition & 1 deletion src/KOKKOS/dihedral_hybrid_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DihedralHybridKokkos : public DihedralHybrid {

DAT::tdual_int_1d k_map; // which style each dihedral type points to
DAT::tdual_int_1d k_ndihedrallist; // # of dihedrals in sub-style dihedrallists
DAT::tdual_int_3d k_dihedrallist; // dihedrallist for each sub-style
DAT::tdual_int_3d_lr k_dihedrallist; // dihedrallist for each sub-style

void allocate() override;
void deallocate() override;
Expand Down
2 changes: 1 addition & 1 deletion src/KOKKOS/fix_langevin_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace LAMMPS_NS {
// For angmom thermostat
class AtomVecEllipsoidKokkos *avecEllipKK;
typename AtomVecEllipsoidKokkosBonusArray<DeviceType>::t_bonus_1d bonus;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3 torque;
typename ArrayTypes<DeviceType>::t_kkacc_1d_3 torque;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3 angmom;
typename ArrayTypes<DeviceType>::t_int_1d ellipsoid;
void angmom_thermostat();
Expand Down
4 changes: 2 additions & 2 deletions src/KOKKOS/fix_nve_asphere_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class FixNVEAsphereKokkos : public FixNVEAsphere {
typename ArrayTypes<DeviceType>::t_int_1d ellipsoid;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3_lr x;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3 v;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3 f;
typename ArrayTypes<DeviceType>::t_kkacc_1d_3 f;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3 angmom;
typename ArrayTypes<DeviceType>::t_kkfloat_1d_3 torque;
typename ArrayTypes<DeviceType>::t_kkacc_1d_3 torque;
typename ArrayTypes<DeviceType>::t_kkfloat_1d rmass;
typename ArrayTypes<DeviceType>::t_int_1d mask;
};
Expand Down
2 changes: 1 addition & 1 deletion src/KOKKOS/fix_shake_kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void FixShakeKokkos<DeviceType>::operator()(TagFixShakeMinPostForce<NEIGHFLAG,VF
const int i0 = d_closest_list(i, 0);

auto apply_restraint = [&](int idx0, int idx1, int type_idx, bool is_angle) {
if (idx0 < 0 || idx1 < 0) return 0.0;
if (idx0 < 0 || idx1 < 0) return (KK_FLOAT)0.0;
const KK_FLOAT d0 = is_angle ? d_angle_distance[type_idx] : d_bond_distance[type_idx];
const KK_FLOAT delx = d_x(idx0, 0) - d_x(idx1, 0);
const KK_FLOAT dely = d_x(idx0, 1) - d_x(idx1, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/KOKKOS/improper_hybrid_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ImproperHybridKokkos : public ImproperHybrid {

DAT::tdual_int_1d k_map; // which style each improper type points to
DAT::tdual_int_1d k_nimproperlist; // # of impropers in sub-style improperlists
DAT::tdual_int_3d k_improperlist; // improperlist for each sub-style
DAT::tdual_int_3d_lr k_improperlist; // improperlist for each sub-style

void allocate() override;
void deallocate() override;
Expand Down
2 changes: 1 addition & 1 deletion src/fix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void Fix::modify_params(int narg, char **arg)
}
}

void::Fix::set_molecule(int, tagint, int, double *, double *, double *)
void Fix::set_molecule(int, tagint, int, double *, double *, double *)
{
error->all(FLERR,"Molecule update not implemented for fix {}", style);
}
Expand Down
7 changes: 3 additions & 4 deletions src/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

using namespace LAMMPS_NS;

static constexpr int MAX_GROUP = 32;
static constexpr double EPSILON = 1.0e-6;

enum { NONE, TYPE, MOLECULE, ID };
Expand Down Expand Up @@ -152,7 +151,7 @@ void Group::assign(int narg, char **arg)
bool created = false;

if (igroup == -1) {
if (ngroup == MAX_GROUP) error->all(FLERR, "Too many groups (max {})", MAX_GROUP);
if (ngroup == MAX_GROUP) error->all(FLERR, "Too many groups (max {})", int(MAX_GROUP));
igroup = find_unused();
names[igroup] = utils::strdup(arg[0]);
ngroup++;
Expand Down Expand Up @@ -592,7 +591,7 @@ void Group::create(const std::string &name, int *flag)
int igroup = find(name);

if (igroup == -1) {
if (ngroup == MAX_GROUP) error->all(FLERR, "Too many groups (max {})", MAX_GROUP);
if (ngroup == MAX_GROUP) error->all(FLERR, "Too many groups (max {})", int(MAX_GROUP));
igroup = find_unused();
names[igroup] = utils::strdup(name);
ngroup++;
Expand Down Expand Up @@ -629,7 +628,7 @@ int Group::find_or_create(const char *name)
int igroup = find(name);
if (igroup >= 0) return igroup;

if (ngroup == MAX_GROUP) error->all(FLERR, "Too many groups (max {})", MAX_GROUP);
if (ngroup == MAX_GROUP) error->all(FLERR, "Too many groups (max {})", int(MAX_GROUP));
igroup = find_unused();
names[igroup] = utils::strdup(name);
ngroup++;
Expand Down
11 changes: 6 additions & 5 deletions src/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class Group : protected Pointers {
friend class FixGroup;

public:
int ngroup; // # of defined groups
char **names; // name of each group
int *bitmask; // one-bit mask for each group
int *inversemask; // inverse mask for each group
int *dynamic; // 1 if dynamic, 0 if not
enum { MAX_GROUP = 32 }; // max # of groups. limited to 32 because bitmasks are 32-bit int.
int ngroup; // # of defined groups
char **names; // name of each group
int *bitmask; // one-bit mask for each group
int *inversemask; // inverse mask for each group
int *dynamic; // 1 if dynamic, 0 if not

Group(class LAMMPS *);
~Group() override;
Expand Down
8 changes: 5 additions & 3 deletions src/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,12 @@ void Info::command(int narg, char **arg)
char **names = group->names;
int *dynamic = group->dynamic;
fputs("\nGroup information:\n",out);
for (int i=0; i < ngroup; ++i) {
if (names[i])
for (int i=0; i < Group::MAX_GROUP; ++i) {
// skip over deleted groups
if (names[i]) {
utils::print(out,"Group[{:2d}]: {:16} ({})\n",
i, names[i], dynamic[i] ? "dynamic" : "static");
i, names[i], dynamic[i] ? "dynamic" : "static");
}
}
}

Expand Down
Loading