format changes
This commit is contained in:
@ -301,8 +301,7 @@ void PairLineLJ::compute(int eflag, int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -375,8 +375,7 @@ void PairTriLJ::compute(int eflag, int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -337,8 +337,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/)
|
|||||||
|
|
||||||
num_contacts = 0;
|
num_contacts = 0;
|
||||||
facc[0] = facc[1] = facc[2] = 0;
|
facc[0] = facc[1] = facc[2] = 0;
|
||||||
vertex_against_wall(i, wall_pos, x, f, torque, side,
|
vertex_against_wall(i, wall_pos, x, f, torque, side, contact_list, num_contacts, facc);
|
||||||
contact_list, num_contacts, facc);
|
|
||||||
|
|
||||||
if (num_contacts >= 2) {
|
if (num_contacts >= 2) {
|
||||||
|
|
||||||
|
|||||||
@ -324,8 +324,7 @@ void PairBodyNparticle::compute(int eflag, int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -207,8 +207,7 @@ void PairBodyRoundedPolygon::compute(int eflag, int vflag)
|
|||||||
if (r > radi + radj + cut_inner) continue;
|
if (r > radi + radj + cut_inner) continue;
|
||||||
|
|
||||||
if (npi == 1 && npj == 1) {
|
if (npi == 1 && npj == 1) {
|
||||||
sphere_against_sphere(i, j, delx, dely, delz, rsq,
|
sphere_against_sphere(i, j, delx, dely, delz, rsq, k_nij, k_naij, x, v, f, evflag);
|
||||||
k_nij, k_naij, x, v, f, evflag);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -397,8 +397,7 @@ void PairLJClass2::compute_outer(int eflag, int vflag)
|
|||||||
fpair = factor_lj*forcelj*r2inv;
|
fpair = factor_lj*forcelj*r2inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1000,7 +1000,7 @@ double FixColvars::compute_scalar()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
/* local memory usage. approximately. */
|
/* local memory usage. approximately. */
|
||||||
double FixColvars::memory_usage(void)
|
double FixColvars::memory_usage()
|
||||||
{
|
{
|
||||||
double bytes = (double) (num_coords * (2*sizeof(int)+3*sizeof(double)));
|
double bytes = (double) (num_coords * (2*sizeof(int)+3*sizeof(double)));
|
||||||
bytes += (double)(double) (nmax*size_one) + sizeof(this);
|
bytes += (double)(double) (nmax*size_one) + sizeof(this);
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* -*- c++ -*- ----------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -17,46 +16,41 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "gz_file_writer.h"
|
#include "gz_file_writer.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
GzFileWriter::GzFileWriter() : FileWriter(),
|
GzFileWriter::GzFileWriter() : FileWriter(), compression_level(Z_BEST_COMPRESSION), gzFp(nullptr) {}
|
||||||
compression_level(Z_BEST_COMPRESSION),
|
|
||||||
gzFp(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
GzFileWriter::~GzFileWriter()
|
GzFileWriter::~GzFileWriter()
|
||||||
{
|
{
|
||||||
close();
|
GzFileWriter::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void GzFileWriter::open(const std::string &path, bool append)
|
void GzFileWriter::open(const std::string &path, bool append)
|
||||||
{
|
{
|
||||||
if (isopen()) return;
|
if (isopen()) return;
|
||||||
|
|
||||||
std::string mode;
|
std::string mode;
|
||||||
if (append) {
|
if (append) {
|
||||||
mode = fmt::format("ab{}", mode, compression_level);
|
mode = fmt::format("ab{}", mode, compression_level);
|
||||||
} else {
|
} else {
|
||||||
mode = fmt::format("wb{}", mode, compression_level);
|
mode = fmt::format("wb{}", mode, compression_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
gzFp = gzopen(path.c_str(), mode.c_str());
|
gzFp = gzopen(path.c_str(), mode.c_str());
|
||||||
|
|
||||||
if (gzFp == nullptr)
|
if (gzFp == nullptr) throw FileWriterException(fmt::format("Could not open file '{}'", path));
|
||||||
throw FileWriterException(fmt::format("Could not open file '{}'", path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
size_t GzFileWriter::write(const void * buffer, size_t length)
|
size_t GzFileWriter::write(const void *buffer, size_t length)
|
||||||
{
|
{
|
||||||
if (!isopen()) return 0;
|
if (!isopen()) return 0;
|
||||||
|
|
||||||
@ -76,7 +70,7 @@ void GzFileWriter::flush()
|
|||||||
|
|
||||||
void GzFileWriter::close()
|
void GzFileWriter::close()
|
||||||
{
|
{
|
||||||
if (!isopen()) return;
|
if (!GzFileWriter::isopen()) return;
|
||||||
|
|
||||||
gzclose(gzFp);
|
gzclose(gzFp);
|
||||||
gzFp = nullptr;
|
gzFp = nullptr;
|
||||||
@ -100,7 +94,8 @@ void GzFileWriter::setCompressionLevel(int level)
|
|||||||
const int max_level = Z_BEST_COMPRESSION;
|
const int max_level = Z_BEST_COMPRESSION;
|
||||||
|
|
||||||
if (level < min_level || level > max_level)
|
if (level < min_level || level > max_level)
|
||||||
throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
|
throw FileWriterException(
|
||||||
|
fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
|
||||||
|
|
||||||
compression_level = level;
|
compression_level = level;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* -*- c++ -*- ----------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -19,16 +18,13 @@
|
|||||||
#ifdef LAMMPS_ZSTD
|
#ifdef LAMMPS_ZSTD
|
||||||
|
|
||||||
#include "zstd_file_writer.h"
|
#include "zstd_file_writer.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
ZstdFileWriter::ZstdFileWriter() : FileWriter(),
|
ZstdFileWriter::ZstdFileWriter() :
|
||||||
compression_level(0),
|
FileWriter(), compression_level(0), checksum_flag(1), cctx(nullptr), fp(nullptr)
|
||||||
checksum_flag(1),
|
|
||||||
cctx(nullptr),
|
|
||||||
fp(nullptr)
|
|
||||||
{
|
{
|
||||||
out_buffer_size = ZSTD_CStreamOutSize();
|
out_buffer_size = ZSTD_CStreamOutSize();
|
||||||
out_buffer = new char[out_buffer_size];
|
out_buffer = new char[out_buffer_size];
|
||||||
@ -38,9 +34,9 @@ ZstdFileWriter::ZstdFileWriter() : FileWriter(),
|
|||||||
|
|
||||||
ZstdFileWriter::~ZstdFileWriter()
|
ZstdFileWriter::~ZstdFileWriter()
|
||||||
{
|
{
|
||||||
close();
|
ZstdFileWriter::close();
|
||||||
|
|
||||||
delete [] out_buffer;
|
delete[] out_buffer;
|
||||||
out_buffer = nullptr;
|
out_buffer = nullptr;
|
||||||
out_buffer_size = 0;
|
out_buffer_size = 0;
|
||||||
}
|
}
|
||||||
@ -49,41 +45,39 @@ ZstdFileWriter::~ZstdFileWriter()
|
|||||||
|
|
||||||
void ZstdFileWriter::open(const std::string &path, bool append)
|
void ZstdFileWriter::open(const std::string &path, bool append)
|
||||||
{
|
{
|
||||||
if (isopen()) return;
|
if (isopen()) return;
|
||||||
|
|
||||||
if (append) {
|
if (append) {
|
||||||
fp = fopen(path.c_str(), "ab");
|
fp = fopen(path.c_str(), "ab");
|
||||||
} else {
|
} else {
|
||||||
fp = fopen(path.c_str(), "wb");
|
fp = fopen(path.c_str(), "wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fp) {
|
if (!fp) { throw FileWriterException(fmt::format("Could not open file '{}'", path)); }
|
||||||
throw FileWriterException(fmt::format("Could not open file '{}'", path));
|
|
||||||
}
|
|
||||||
|
|
||||||
cctx = ZSTD_createCCtx();
|
cctx = ZSTD_createCCtx();
|
||||||
|
|
||||||
if (!cctx) {
|
if (!cctx) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = nullptr;
|
fp = nullptr;
|
||||||
throw FileWriterException("Could not create Zstd context");
|
throw FileWriterException("Could not create Zstd context");
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level);
|
ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level);
|
||||||
ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, checksum_flag);
|
ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, checksum_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
size_t ZstdFileWriter::write(const void * buffer, size_t length)
|
size_t ZstdFileWriter::write(const void *buffer, size_t length)
|
||||||
{
|
{
|
||||||
if (!isopen()) return 0;
|
if (!isopen()) return 0;
|
||||||
|
|
||||||
ZSTD_inBuffer input = { buffer, length, 0 };
|
ZSTD_inBuffer input = {buffer, length, 0};
|
||||||
ZSTD_EndDirective mode = ZSTD_e_continue;
|
ZSTD_EndDirective mode = ZSTD_e_continue;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 };
|
ZSTD_outBuffer output = {out_buffer, out_buffer_size, 0};
|
||||||
ZSTD_compressStream2(cctx, &output, &input, mode);
|
ZSTD_compressStream2(cctx, &output, &input, mode);
|
||||||
fwrite(out_buffer, sizeof(char), output.pos, fp);
|
fwrite(out_buffer, sizeof(char), output.pos, fp);
|
||||||
} while (input.pos < input.size);
|
} while (input.pos < input.size);
|
||||||
@ -98,11 +92,11 @@ void ZstdFileWriter::flush()
|
|||||||
if (!isopen()) return;
|
if (!isopen()) return;
|
||||||
|
|
||||||
size_t remaining;
|
size_t remaining;
|
||||||
ZSTD_inBuffer input = { nullptr, 0, 0 };
|
ZSTD_inBuffer input = {nullptr, 0, 0};
|
||||||
ZSTD_EndDirective mode = ZSTD_e_flush;
|
ZSTD_EndDirective mode = ZSTD_e_flush;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 };
|
ZSTD_outBuffer output = {out_buffer, out_buffer_size, 0};
|
||||||
remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
|
remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
|
||||||
fwrite(out_buffer, sizeof(char), output.pos, fp);
|
fwrite(out_buffer, sizeof(char), output.pos, fp);
|
||||||
} while (remaining);
|
} while (remaining);
|
||||||
@ -114,14 +108,14 @@ void ZstdFileWriter::flush()
|
|||||||
|
|
||||||
void ZstdFileWriter::close()
|
void ZstdFileWriter::close()
|
||||||
{
|
{
|
||||||
if (!isopen()) return;
|
if (!ZstdFileWriter::isopen()) return;
|
||||||
|
|
||||||
size_t remaining;
|
size_t remaining;
|
||||||
ZSTD_inBuffer input = { nullptr, 0, 0 };
|
ZSTD_inBuffer input = {nullptr, 0, 0};
|
||||||
ZSTD_EndDirective mode = ZSTD_e_end;
|
ZSTD_EndDirective mode = ZSTD_e_end;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 };
|
ZSTD_outBuffer output = {out_buffer, out_buffer_size, 0};
|
||||||
remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
|
remaining = ZSTD_compressStream2(cctx, &output, &input, mode);
|
||||||
fwrite(out_buffer, sizeof(char), output.pos, fp);
|
fwrite(out_buffer, sizeof(char), output.pos, fp);
|
||||||
} while (remaining);
|
} while (remaining);
|
||||||
@ -150,7 +144,8 @@ void ZstdFileWriter::setCompressionLevel(int level)
|
|||||||
const int max_level = ZSTD_maxCLevel();
|
const int max_level = ZSTD_maxCLevel();
|
||||||
|
|
||||||
if (level < min_level || level > max_level)
|
if (level < min_level || level > max_level)
|
||||||
throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
|
throw FileWriterException(
|
||||||
|
fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level));
|
||||||
|
|
||||||
compression_level = level;
|
compression_level = level;
|
||||||
}
|
}
|
||||||
@ -159,8 +154,7 @@ void ZstdFileWriter::setCompressionLevel(int level)
|
|||||||
|
|
||||||
void ZstdFileWriter::setChecksum(bool enabled)
|
void ZstdFileWriter::setChecksum(bool enabled)
|
||||||
{
|
{
|
||||||
if (isopen())
|
if (isopen()) throw FileWriterException("Checksum flag can not be changed while file is open");
|
||||||
throw FileWriterException("Checksum flag can not be changed while file is open");
|
|
||||||
checksum_flag = enabled ? 1 : 0;
|
checksum_flag = enabled ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ using namespace LAMMPS_NS;
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *lmp, int narg, char **arg) :
|
ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Compute(lmp, narg, arg), efield(NULL)
|
Compute(lmp, narg, arg), efield(nullptr)
|
||||||
{
|
{
|
||||||
if (narg < 3) error->all(FLERR,"Illegal compute efield/atom command");
|
if (narg < 3) error->all(FLERR,"Illegal compute efield/atom command");
|
||||||
|
|
||||||
|
|||||||
@ -69,8 +69,8 @@ using namespace MathConst;
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) :
|
FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Fix(lmp, narg, arg), q_backup(NULL), c(NULL), g(NULL), h(NULL), r(NULL), s(NULL), v(NULL),
|
Fix(lmp, narg, arg), q_backup(nullptr), c(nullptr), g(nullptr), h(nullptr), r(nullptr), s(nullptr), v(nullptr),
|
||||||
y(NULL)
|
y(nullptr)
|
||||||
{
|
{
|
||||||
if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/gmres command");
|
if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/gmres command");
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (atom->torque_flag) torqueflag = 1;
|
if (atom->torque_flag) torqueflag = 1;
|
||||||
if (atom->avec->forceclearflag) extraflag = 1;
|
if (atom->avec->forceclearflag) extraflag = 1;
|
||||||
|
|
||||||
grow_arrays(atom->nmax);
|
FixPolarizeBEMGMRES::grow_arrays(atom->nmax);
|
||||||
atom->add_callback(0); // to ensure to work with atom->sort()
|
atom->add_callback(0); // to ensure to work with atom->sort()
|
||||||
|
|
||||||
// output the residual and actual number of iterations
|
// output the residual and actual number of iterations
|
||||||
@ -133,7 +133,7 @@ FixPolarizeBEMGMRES::~FixPolarizeBEMGMRES()
|
|||||||
memory->destroy(mat2tag);
|
memory->destroy(mat2tag);
|
||||||
memory->destroy(tag2mat);
|
memory->destroy(tag2mat);
|
||||||
|
|
||||||
if (allocated) deallocate();
|
if (allocated) FixPolarizeBEMGMRES::deallocate();
|
||||||
atom->delete_callback(id, 0);
|
atom->delete_callback(id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@ FixPolarizeFunctional::FixPolarizeFunctional(LAMMPS *lmp, int narg, char **arg)
|
|||||||
cg_r = cg_p = cg_Ap = nullptr;
|
cg_r = cg_p = cg_Ap = nullptr;
|
||||||
cg_A = nullptr;
|
cg_A = nullptr;
|
||||||
|
|
||||||
grow_arrays(atom->nmax);
|
FixPolarizeFunctional::grow_arrays(atom->nmax);
|
||||||
atom->add_callback(0); // to ensure to work with atom->sort()
|
atom->add_callback(0); // to ensure to work with atom->sort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -221,10 +221,10 @@ void PairCoulLongDielectric::init_style()
|
|||||||
|
|
||||||
// insure use of KSpace long-range solver, set g_ewald
|
// insure use of KSpace long-range solver, set g_ewald
|
||||||
|
|
||||||
if (force->kspace == NULL) error->all(FLERR, "Pair style requires a KSpace style");
|
if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
|
||||||
g_ewald = force->kspace->g_ewald;
|
g_ewald = force->kspace->g_ewald;
|
||||||
|
|
||||||
// setup force tables
|
// setup force tables
|
||||||
|
|
||||||
if (ncoultablebits) init_tables(cut_coul, NULL);
|
if (ncoultablebits) init_tables(cut_coul, nullptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,8 +40,8 @@ using namespace MathConst;
|
|||||||
|
|
||||||
PairLJCutCoulDebyeDielectric::PairLJCutCoulDebyeDielectric(LAMMPS *lmp) : PairLJCutCoulDebye(lmp)
|
PairLJCutCoulDebyeDielectric::PairLJCutCoulDebyeDielectric(LAMMPS *lmp) : PairLJCutCoulDebye(lmp)
|
||||||
{
|
{
|
||||||
efield = NULL;
|
efield = nullptr;
|
||||||
epot = NULL;
|
epot = nullptr;
|
||||||
nmax = 0;
|
nmax = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -257,7 +257,7 @@ void PairLJCutCoulLongDielectric::init_style()
|
|||||||
|
|
||||||
// insure use of KSpace long-range solver, set g_ewald
|
// insure use of KSpace long-range solver, set g_ewald
|
||||||
|
|
||||||
if (force->kspace == NULL) error->all(FLERR, "Pair style requires a KSpace style");
|
if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
|
||||||
g_ewald = force->kspace->g_ewald;
|
g_ewald = force->kspace->g_ewald;
|
||||||
|
|
||||||
// setup force tables
|
// setup force tables
|
||||||
|
|||||||
@ -365,7 +365,7 @@ void PairLJCutCoulMSMDielectric::init_style()
|
|||||||
|
|
||||||
// insure use of KSpace long-range solver, set g_ewald
|
// insure use of KSpace long-range solver, set g_ewald
|
||||||
|
|
||||||
if (force->kspace == NULL) error->all(FLERR, "Pair style requires a KSpace style");
|
if (force->kspace == nullptr) error->all(FLERR, "Pair style requires a KSpace style");
|
||||||
g_ewald = force->kspace->g_ewald;
|
g_ewald = force->kspace->g_ewald;
|
||||||
|
|
||||||
// setup force tables
|
// setup force tables
|
||||||
@ -382,5 +382,5 @@ void *PairLJCutCoulMSMDielectric::extract(const char *str, int &dim)
|
|||||||
dim = 2;
|
dim = 2;
|
||||||
if (strcmp(str, "epsilon") == 0) return (void *) epsilon;
|
if (strcmp(str, "epsilon") == 0) return (void *) epsilon;
|
||||||
if (strcmp(str, "sigma") == 0) return (void *) sigma;
|
if (strcmp(str, "sigma") == 0) return (void *) sigma;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ namespace /* anonymous */
|
|||||||
{
|
{
|
||||||
|
|
||||||
typedef double TimerType;
|
typedef double TimerType;
|
||||||
TimerType getTimeStamp(void) { return MPI_Wtime(); }
|
TimerType getTimeStamp() { return MPI_Wtime(); }
|
||||||
double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; }
|
double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; }
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
@ -1246,7 +1246,7 @@ int FixRX::rkf45_h0 (const int neq, const double t, const double /*t_stop*/,
|
|||||||
return (iter + 1);
|
return (iter + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixRX::odeDiagnostics(void)
|
void FixRX::odeDiagnostics()
|
||||||
{
|
{
|
||||||
TimerType timer_start = getTimeStamp();
|
TimerType timer_start = getTimeStamp();
|
||||||
|
|
||||||
|
|||||||
@ -224,7 +224,7 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// perform initial allocation of atom-based array
|
// perform initial allocation of atom-based array
|
||||||
// register with Atom class
|
// register with Atom class
|
||||||
|
|
||||||
grow_arrays(atom->nmax);
|
FixMesoMove::grow_arrays(atom->nmax);
|
||||||
atom->add_callback(Atom::GROW);
|
atom->add_callback(Atom::GROW);
|
||||||
atom->add_callback(Atom::RESTART);
|
atom->add_callback(Atom::RESTART);
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
drudeid = nullptr;
|
drudeid = nullptr;
|
||||||
grow_arrays(atom->nmax);
|
FixDrude::grow_arrays(atom->nmax);
|
||||||
atom->add_callback(Atom::GROW);
|
atom->add_callback(Atom::GROW);
|
||||||
atom->add_callback(Atom::RESTART);
|
atom->add_callback(Atom::RESTART);
|
||||||
atom->add_callback(Atom::BORDER);
|
atom->add_callback(Atom::BORDER);
|
||||||
@ -516,7 +516,8 @@ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr) {
|
|||||||
* ----------------------------------------------------------------------*/
|
* ----------------------------------------------------------------------*/
|
||||||
void FixDrude::set_arrays(int i) {
|
void FixDrude::set_arrays(int i) {
|
||||||
if (drudetype[atom->type[i]] != NOPOL_TYPE) {
|
if (drudetype[atom->type[i]] != NOPOL_TYPE) {
|
||||||
if (atom->nspecial[i] ==0) error->all(FLERR, "Polarizable atoms cannot be inserted with special lists info from the molecule template");
|
if (atom->nspecial[i] == nullptr)
|
||||||
|
error->all(FLERR, "Polarizable atoms cannot be inserted with special lists info from the molecule template");
|
||||||
drudeid[i] = atom->special[i][0]; // Drude partner should be at first place in the special list
|
drudeid[i] = atom->special[i][0]; // Drude partner should be at first place in the special list
|
||||||
} else {
|
} else {
|
||||||
drudeid[i] = 0;
|
drudeid[i] = 0;
|
||||||
|
|||||||
@ -84,14 +84,14 @@ FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
// by default, do not compute work done
|
// by default, do not compute work done
|
||||||
|
|
||||||
workflag=0;
|
workflag=false;
|
||||||
|
|
||||||
// process optional keyword
|
// process optional keyword
|
||||||
int iarg = 6;
|
int iarg = 6;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
if (strcmp(arg[iarg],"energy") == 0) {
|
if (strcmp(arg[iarg],"energy") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal energy keyword");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal energy keyword");
|
||||||
if (strcmp(arg[iarg+1],"yes") == 0) workflag = 1;
|
if (strcmp(arg[iarg+1],"yes") == 0) workflag = true;
|
||||||
else if (strcmp(arg[iarg+1],"no") != 0)
|
else if (strcmp(arg[iarg+1],"no") != 0)
|
||||||
error->all(FLERR,"Illegal energy keyword");
|
error->all(FLERR,"Illegal energy keyword");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
@ -139,7 +139,7 @@ void FixFlowGauss::setup(int vflag)
|
|||||||
{
|
{
|
||||||
// need to compute work done if fix_modify energy yes is set
|
// need to compute work done if fix_modify energy yes is set
|
||||||
|
|
||||||
if (thermo_energy) workflag = 1;
|
if (thermo_energy) workflag = true;
|
||||||
|
|
||||||
// get total mass of group
|
// get total mass of group
|
||||||
|
|
||||||
|
|||||||
@ -366,7 +366,7 @@ void FixTTMGrid::write_electron_temperatures(const std::string &filename)
|
|||||||
update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, style);
|
update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
gc->gather(GridComm::FIX, this, 1, sizeof(double), 1, NULL, MPI_DOUBLE);
|
gc->gather(GridComm::FIX, this, 1, sizeof(double), 1, nullptr, MPI_DOUBLE);
|
||||||
|
|
||||||
if (comm->me == 0) fclose(FPout);
|
if (comm->me == 0) fclose(FPout);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
nzgrid = utils::inumeric(FLERR,arg[7],false,lmp);
|
nzgrid = utils::inumeric(FLERR,arg[7],false,lmp);
|
||||||
|
|
||||||
double tinit = 0.0;
|
double tinit = 0.0;
|
||||||
infile = outfile = NULL;
|
infile = outfile = nullptr;
|
||||||
|
|
||||||
int iarg = 8;
|
int iarg = 8;
|
||||||
while (iarg < narg) {
|
while (iarg < narg) {
|
||||||
|
|||||||
@ -376,8 +376,7 @@ void PairLJ96Cut::compute_outer(int eflag, int vflag)
|
|||||||
r2inv = 1.0/rsq;
|
r2inv = 1.0/rsq;
|
||||||
r6inv = r2inv*r2inv*r2inv;
|
r6inv = r2inv*r2inv*r2inv;
|
||||||
r3inv = sqrt(r6inv);
|
r3inv = sqrt(r6inv);
|
||||||
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) -
|
evdwl = r6inv*(lj3[itype][jtype]*r3inv-lj4[itype][jtype]) - offset[itype][jtype];
|
||||||
offset[itype][jtype];
|
|
||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,8 +391,7 @@ void PairLJ96Cut::compute_outer(int eflag, int vflag)
|
|||||||
fpair = factor_lj*forcelj*r2inv;
|
fpair = factor_lj*forcelj*r2inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,14 +195,12 @@ void PairLJExpandCoulLong::compute(int eflag, int vflag)
|
|||||||
} else ecoul = 0.0;
|
} else ecoul = 0.0;
|
||||||
|
|
||||||
if (rsq < cut_ljsq[itype][jtype]) {
|
if (rsq < cut_ljsq[itype][jtype]) {
|
||||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - offset[itype][jtype];
|
||||||
offset[itype][jtype];
|
|
||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
} else evdwl = 0.0;
|
} else evdwl = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,ecoul,fpair,delx,dely,delz);
|
||||||
evdwl,ecoul,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -980,8 +978,7 @@ double PairLJExpandCoulLong::single(int i, int j, int itype, int jtype,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rsq < cut_ljsq[itype][jtype]) {
|
if (rsq < cut_ljsq[itype][jtype]) {
|
||||||
philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) -
|
philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - offset[itype][jtype];
|
||||||
offset[itype][jtype];
|
|
||||||
eng += factor_lj*philj;
|
eng += factor_lj*philj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -164,16 +164,14 @@ void PairLJGromacsCoulGromacs::compute(int eflag, int vflag)
|
|||||||
evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||||
evdwl += ljsw5[itype][jtype];
|
evdwl += ljsw5[itype][jtype];
|
||||||
if (rsq > cut_lj_innersq) {
|
if (rsq > cut_lj_innersq) {
|
||||||
eswitch = tlj*tlj*tlj *
|
eswitch = tlj*tlj*tlj * (ljsw3[itype][jtype] + ljsw4[itype][jtype]*tlj);
|
||||||
(ljsw3[itype][jtype] + ljsw4[itype][jtype]*tlj);
|
|
||||||
evdwl += eswitch;
|
evdwl += eswitch;
|
||||||
}
|
}
|
||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
} else evdwl = 0.0;
|
} else evdwl = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,ecoul,fpair,delx,dely,delz);
|
||||||
evdwl,ecoul,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,8 +485,7 @@ double PairLJGromacsCoulGromacs::single(int i, int j, int itype, int jtype,
|
|||||||
if (rsq < cut_coulsq) {
|
if (rsq < cut_coulsq) {
|
||||||
phicoul = force->qqrd2e * atom->q[i]*atom->q[j] * (sqrt(r2inv)-coulsw5);
|
phicoul = force->qqrd2e * atom->q[i]*atom->q[j] * (sqrt(r2inv)-coulsw5);
|
||||||
if (rsq > cut_coul_innersq) {
|
if (rsq > cut_coul_innersq) {
|
||||||
phiswitchcoul = force->qqrd2e * atom->q[i]*atom->q[j] *
|
phiswitchcoul = force->qqrd2e * atom->q[i]*atom->q[j] * tc*tc*tc * (coulsw3 + coulsw4*tc);
|
||||||
tc*tc*tc * (coulsw3 + coulsw4*tc);
|
|
||||||
phicoul += phiswitchcoul;
|
phicoul += phiswitchcoul;
|
||||||
}
|
}
|
||||||
eng += factor_coul*phicoul;
|
eng += factor_coul*phicoul;
|
||||||
@ -498,8 +495,7 @@ double PairLJGromacsCoulGromacs::single(int i, int j, int itype, int jtype,
|
|||||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]);
|
||||||
philj += ljsw5[itype][jtype];
|
philj += ljsw5[itype][jtype];
|
||||||
if (rsq > cut_lj_innersq) {
|
if (rsq > cut_lj_innersq) {
|
||||||
phiswitch = tlj*tlj*tlj *
|
phiswitch = tlj*tlj*tlj * (ljsw3[itype][jtype] + ljsw4[itype][jtype]*tlj);
|
||||||
(ljsw3[itype][jtype] + ljsw4[itype][jtype]*tlj);
|
|
||||||
philj += phiswitch;
|
philj += phiswitch;
|
||||||
}
|
}
|
||||||
eng += factor_lj*philj;
|
eng += factor_lj*philj;
|
||||||
|
|||||||
@ -183,15 +183,13 @@ void PairLJRelRes::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
if (eflag) {
|
if (eflag) {
|
||||||
if (rsq < cutf_inner_sq[itype][jtype]) {
|
if (rsq < cutf_inner_sq[itype][jtype]) {
|
||||||
evdwl = r6inv*(ljf3[itype][jtype]*r6inv-
|
evdwl = r6inv*(ljf3[itype][jtype]*r6inv-ljf4[itype][jtype])-offsetsm[itype][jtype];
|
||||||
ljf4[itype][jtype])-offsetsm[itype][jtype];
|
|
||||||
} else if (rsq < cutfsq[itype][jtype]) {
|
} else if (rsq < cutfsq[itype][jtype]) {
|
||||||
evdwl = ljswf0[itype][jtype]-ljswf1[itype][jtype]*t-
|
evdwl = ljswf0[itype][jtype]-ljswf1[itype][jtype]*t-
|
||||||
ljswf2[itype][jtype]*tsq/2.0-ljswf3[itype][jtype]*tsq*t/3.0-
|
ljswf2[itype][jtype]*tsq/2.0-ljswf3[itype][jtype]*tsq*t/3.0-
|
||||||
ljswf4[itype][jtype]*tsq*tsq/4.0-offsetsp[itype][jtype];
|
ljswf4[itype][jtype]*tsq*tsq/4.0-offsetsp[itype][jtype];
|
||||||
} else if (rsq < cut_inner_sq[itype][jtype]) {
|
} else if (rsq < cut_inner_sq[itype][jtype]) {
|
||||||
evdwl = r6inv*(lj3[itype][jtype]*r6inv-
|
evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype])-offset[itype][jtype];
|
||||||
lj4[itype][jtype])-offset[itype][jtype];
|
|
||||||
} else {
|
} else {
|
||||||
evdwl = ljsw0[itype][jtype]-ljsw1[itype][jtype]*t-
|
evdwl = ljsw0[itype][jtype]-ljsw1[itype][jtype]*t-
|
||||||
ljsw2[itype][jtype]*tsq/2.0-ljsw3[itype][jtype]*tsq*t/3.0-
|
ljsw2[itype][jtype]*tsq/2.0-ljsw3[itype][jtype]*tsq*t/3.0-
|
||||||
@ -200,8 +198,7 @@ void PairLJRelRes::compute(int eflag, int vflag)
|
|||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -726,15 +723,13 @@ double PairLJRelRes::single(int /*i*/, int /*j*/, int itype, int jtype,
|
|||||||
fforce = factor_lj*forcelj*r2inv;
|
fforce = factor_lj*forcelj*r2inv;
|
||||||
|
|
||||||
if (rsq < cutf_inner_sq[itype][jtype]) {
|
if (rsq < cutf_inner_sq[itype][jtype]) {
|
||||||
philj = r6inv*(ljf3[itype][jtype]*r6inv-
|
philj = r6inv*(ljf3[itype][jtype]*r6inv-ljf4[itype][jtype])-offsetsm[itype][jtype];
|
||||||
ljf4[itype][jtype])-offsetsm[itype][jtype];
|
|
||||||
} else if (rsq < cutfsq[itype][jtype]) {
|
} else if (rsq < cutfsq[itype][jtype]) {
|
||||||
philj = ljswf0[itype][jtype]-ljswf1[itype][jtype]*t-
|
philj = ljswf0[itype][jtype]-ljswf1[itype][jtype]*t-
|
||||||
ljswf2[itype][jtype]*tsq/2.0-ljswf3[itype][jtype]*tsq*t/3.0-
|
ljswf2[itype][jtype]*tsq/2.0-ljswf3[itype][jtype]*tsq*t/3.0-
|
||||||
ljswf4[itype][jtype]*tsq*tsq/4.0-offsetsp[itype][jtype];
|
ljswf4[itype][jtype]*tsq*tsq/4.0-offsetsp[itype][jtype];
|
||||||
} else if (rsq < cut_inner_sq[itype][jtype]) {
|
} else if (rsq < cut_inner_sq[itype][jtype]) {
|
||||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]) -
|
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||||
offset[itype][jtype];
|
|
||||||
} else {
|
} else {
|
||||||
philj = ljsw0[itype][jtype] - ljsw1[itype][jtype]*t -
|
philj = ljsw0[itype][jtype] - ljsw1[itype][jtype]*t -
|
||||||
ljsw2[itype][jtype]*tsq/2.0 - ljsw3[itype][jtype]*tsq*t/3.0 -
|
ljsw2[itype][jtype]*tsq/2.0 - ljsw3[itype][jtype]*tsq*t/3.0 -
|
||||||
|
|||||||
@ -136,8 +136,7 @@ void PairLJSmooth::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
if (eflag) {
|
if (eflag) {
|
||||||
if (rsq < cut_inner_sq[itype][jtype])
|
if (rsq < cut_inner_sq[itype][jtype])
|
||||||
evdwl = r6inv * (lj3[itype][jtype]*r6inv -
|
evdwl = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||||
lj4[itype][jtype]) - offset[itype][jtype];
|
|
||||||
else
|
else
|
||||||
evdwl = ljsw0[itype][jtype] - ljsw1[itype][jtype]*t -
|
evdwl = ljsw0[itype][jtype] - ljsw1[itype][jtype]*t -
|
||||||
ljsw2[itype][jtype]*tsq/2.0 - ljsw3[itype][jtype]*tsq*t/3.0 -
|
ljsw2[itype][jtype]*tsq/2.0 - ljsw3[itype][jtype]*tsq*t/3.0 -
|
||||||
@ -145,8 +144,7 @@ void PairLJSmooth::compute(int eflag, int vflag)
|
|||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,8 +444,7 @@ double PairLJSmooth::single(int /*i*/, int /*j*/, int itype, int jtype, double r
|
|||||||
fforce = factor_lj*forcelj*r2inv;
|
fforce = factor_lj*forcelj*r2inv;
|
||||||
|
|
||||||
if (rsq < cut_inner_sq[itype][jtype])
|
if (rsq < cut_inner_sq[itype][jtype])
|
||||||
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]) -
|
philj = r6inv * (lj3[itype][jtype]*r6inv - lj4[itype][jtype]) - offset[itype][jtype];
|
||||||
offset[itype][jtype];
|
|
||||||
else
|
else
|
||||||
philj = ljsw0[itype][jtype] - ljsw1[itype][jtype]*t -
|
philj = ljsw0[itype][jtype] - ljsw1[itype][jtype]*t -
|
||||||
ljsw2[itype][jtype]*tsq/2.0 - ljsw3[itype][jtype]*tsq*t/3.0 -
|
ljsw2[itype][jtype]*tsq/2.0 - ljsw3[itype][jtype]*tsq*t/3.0 -
|
||||||
|
|||||||
@ -147,17 +147,13 @@ void PairNMCutCoulCut::compute(int eflag, int vflag)
|
|||||||
ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv);
|
||||||
else ecoul = 0.0;
|
else ecoul = 0.0;
|
||||||
if (rsq < cut_ljsq[itype][jtype]) {
|
if (rsq < cut_ljsq[itype][jtype]) {
|
||||||
evdwl = e0nm[itype][jtype]*(mm[itype][jtype] *
|
evdwl = e0nm[itype][jtype]*(mm[itype][jtype] * r0n[itype][jtype]*rninv -
|
||||||
r0n[itype][jtype]*rninv -
|
nn[itype][jtype] * r0m[itype][jtype]*rminv) - offset[itype][jtype];
|
||||||
nn[itype][jtype] *
|
|
||||||
r0m[itype][jtype]*rminv) -
|
|
||||||
offset[itype][jtype];
|
|
||||||
evdwl *= factor_lj;
|
evdwl *= factor_lj;
|
||||||
} else evdwl = 0.0;
|
} else evdwl = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,ecoul,fpair,delx,dely,delz);
|
||||||
evdwl,ecoul,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,8 +178,7 @@ void PairLJCutCoulLongSoft::compute(int eflag, int vflag)
|
|||||||
} else evdwl = 0.0;
|
} else evdwl = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,ecoul,fpair,delx,dely,delz);
|
||||||
evdwl,ecoul,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -410,8 +410,7 @@ void PairLJCutSoft::compute_outer(int eflag, int vflag)
|
|||||||
fpair = factor_lj*forcelj;
|
fpair = factor_lj*forcelj;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz);
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -308,10 +308,9 @@ struct fft_plan_3d *fft_3d_create_plan(
|
|||||||
first_jhi = (ip1+1)*nmid/np1 - 1;
|
first_jhi = (ip1+1)*nmid/np1 - 1;
|
||||||
first_klo = ip2*nslow/np2;
|
first_klo = ip2*nslow/np2;
|
||||||
first_khi = (ip2+1)*nslow/np2 - 1;
|
first_khi = (ip2+1)*nslow/np2 - 1;
|
||||||
plan->pre_plan =
|
plan->pre_plan = remap_3d_create_plan(comm,in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi,
|
||||||
remap_3d_create_plan(comm,in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi,
|
first_ilo,first_ihi,first_jlo,first_jhi,
|
||||||
first_ilo,first_ihi,first_jlo,first_jhi,
|
first_klo,first_khi,2,0,0,FFT_PRECISION,0);
|
||||||
first_klo,first_khi,2,0,0,FFT_PRECISION,0);
|
|
||||||
if (plan->pre_plan == nullptr) return nullptr;
|
if (plan->pre_plan == nullptr) return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,13 +329,10 @@ struct fft_plan_3d *fft_3d_create_plan(
|
|||||||
second_jhi = nmid - 1;
|
second_jhi = nmid - 1;
|
||||||
second_klo = ip2*nslow/np2;
|
second_klo = ip2*nslow/np2;
|
||||||
second_khi = (ip2+1)*nslow/np2 - 1;
|
second_khi = (ip2+1)*nslow/np2 - 1;
|
||||||
plan->mid1_plan =
|
plan->mid1_plan = remap_3d_create_plan(comm, first_ilo,first_ihi,first_jlo,first_jhi,
|
||||||
remap_3d_create_plan(comm,
|
first_klo,first_khi,second_ilo,second_ihi,
|
||||||
first_ilo,first_ihi,first_jlo,first_jhi,
|
second_jlo,second_jhi,second_klo,second_khi,
|
||||||
first_klo,first_khi,
|
2,1,0,FFT_PRECISION,usecollective);
|
||||||
second_ilo,second_ihi,second_jlo,second_jhi,
|
|
||||||
second_klo,second_khi,2,1,0,FFT_PRECISION,
|
|
||||||
usecollective);
|
|
||||||
if (plan->mid1_plan == nullptr) return nullptr;
|
if (plan->mid1_plan == nullptr) return nullptr;
|
||||||
|
|
||||||
// 1d FFTs along mid axis
|
// 1d FFTs along mid axis
|
||||||
|
|||||||
@ -125,8 +125,6 @@ void PairEAMFS::read_file(char *filename)
|
|||||||
|
|
||||||
// transparently convert units for supported conversions
|
// transparently convert units for supported conversions
|
||||||
|
|
||||||
// transparently convert units for supported conversions
|
|
||||||
|
|
||||||
int unit_convert = reader.get_unit_convert();
|
int unit_convert = reader.get_unit_convert();
|
||||||
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
|
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
|
||||||
unit_convert);
|
unit_convert);
|
||||||
|
|||||||
@ -32,8 +32,8 @@
|
|||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "verlet.h"
|
#include "verlet.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
enum { NONE, REAL, METAL }; // LAMMPS units which MDI supports
|
enum { NONE, REAL, METAL }; // LAMMPS units which MDI supports
|
||||||
|
|
||||||
|
|||||||
@ -31,8 +31,8 @@
|
|||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "verlet.h"
|
#include "verlet.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
|||||||
@ -329,13 +329,12 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// pass id_temp as 4th arg to pressure constructor
|
// pass id_temp as 4th arg to pressure constructor
|
||||||
|
|
||||||
id_press = utils::strdup(std::string(id) + "_press");
|
id_press = utils::strdup(std::string(id) + "_press");
|
||||||
modify->add_compute(fmt::format("{} all pressure {} virial",
|
modify->add_compute(fmt::format("{} all pressure {} virial",id_press, id_temp));
|
||||||
id_press, id_temp));
|
|
||||||
pflag = 1;
|
pflag = 1;
|
||||||
|
|
||||||
dimension = domain->dimension;
|
dimension = domain->dimension;
|
||||||
nrigid = 0;
|
nrigid = 0;
|
||||||
rfix = 0;
|
rfix = nullptr;
|
||||||
|
|
||||||
current_lifo = 0;
|
current_lifo = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -428,7 +428,7 @@ double FixEfield::memory_usage()
|
|||||||
return energy added by fix
|
return energy added by fix
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double FixEfield::compute_scalar(void)
|
double FixEfield::compute_scalar()
|
||||||
{
|
{
|
||||||
if (force_flag == 0) {
|
if (force_flag == 0) {
|
||||||
MPI_Allreduce(fsum,fsum_all,4,MPI_DOUBLE,MPI_SUM,world);
|
MPI_Allreduce(fsum,fsum_all,4,MPI_DOUBLE,MPI_SUM,world);
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* -*- c++ -*- ----------------------------------------------------------
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -22,45 +21,43 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
ImbalanceGroup::ImbalanceGroup(LAMMPS *lmp) : Imbalance(lmp), id(0), factor(0)
|
ImbalanceGroup::ImbalanceGroup(LAMMPS *lmp) : Imbalance(lmp), id(nullptr), factor(nullptr) {}
|
||||||
{}
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
ImbalanceGroup::~ImbalanceGroup()
|
ImbalanceGroup::~ImbalanceGroup()
|
||||||
{
|
{
|
||||||
delete [] id;
|
delete[] id;
|
||||||
delete [] factor;
|
delete[] factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
int ImbalanceGroup::options(int narg, char **arg)
|
int ImbalanceGroup::options(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 3) error->all(FLERR,"Illegal balance weight command");
|
if (narg < 3) error->all(FLERR, "Illegal balance weight command");
|
||||||
|
|
||||||
num = utils::inumeric(FLERR,arg[0],false,lmp);
|
num = utils::inumeric(FLERR, arg[0], false, lmp);
|
||||||
if (num < 1) error->all(FLERR,"Illegal balance weight command");
|
if (num < 1) error->all(FLERR, "Illegal balance weight command");
|
||||||
if (2*num+1 > narg) error->all(FLERR,"Illegal balance weight command");
|
if (2 * num + 1 > narg) error->all(FLERR, "Illegal balance weight command");
|
||||||
|
|
||||||
id = new int[num];
|
id = new int[num];
|
||||||
factor = new double[num];
|
factor = new double[num];
|
||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
id[i] = group->find(arg[2*i+1]);
|
id[i] = group->find(arg[2 * i + 1]);
|
||||||
if (id[i] < 0)
|
if (id[i] < 0) error->all(FLERR, "Unknown group in balance weight command: {}", arg[2 * i + 1]);
|
||||||
error->all(FLERR,"Unknown group in balance weight command: {}", arg[2*i+1]);
|
factor[i] = utils::numeric(FLERR, arg[2 * i + 2], false, lmp);
|
||||||
factor[i] = utils::numeric(FLERR,arg[2*i+2],false,lmp);
|
if (factor[i] <= 0.0) error->all(FLERR, "Illegal balance weight command");
|
||||||
if (factor[i] <= 0.0) error->all(FLERR,"Illegal balance weight command");
|
|
||||||
}
|
}
|
||||||
return 2*num+1;
|
return 2 * num + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
void ImbalanceGroup::compute(double *weight)
|
void ImbalanceGroup::compute(double *weight)
|
||||||
{
|
{
|
||||||
const int * const mask = atom->mask;
|
const int *const mask = atom->mask;
|
||||||
const int * const bitmask = group->bitmask;
|
const int *const bitmask = group->bitmask;
|
||||||
const int nlocal = atom->nlocal;
|
const int nlocal = atom->nlocal;
|
||||||
|
|
||||||
if (num == 0) return;
|
if (num == 0) return;
|
||||||
@ -68,8 +65,7 @@ void ImbalanceGroup::compute(double *weight)
|
|||||||
for (int i = 0; i < nlocal; ++i) {
|
for (int i = 0; i < nlocal; ++i) {
|
||||||
const int imask = mask[i];
|
const int imask = mask[i];
|
||||||
for (int j = 0; j < num; ++j) {
|
for (int j = 0; j < num; ++j) {
|
||||||
if (imask & bitmask[id[j]])
|
if (imask & bitmask[id[j]]) weight[i] *= factor[j];
|
||||||
weight[i] *= factor[j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,11 +77,10 @@ std::string ImbalanceGroup::info()
|
|||||||
std::string mesg = "";
|
std::string mesg = "";
|
||||||
|
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
const char * const * const names = group->names;
|
const char *const *const names = group->names;
|
||||||
|
|
||||||
mesg += " group weights:";
|
mesg += " group weights:";
|
||||||
for (int i = 0; i < num; ++i)
|
for (int i = 0; i < num; ++i) mesg += fmt::format(" {}={}", names[id[i]], factor[i]);
|
||||||
mesg += fmt::format(" {}={}",names[id[i]],factor[i]);
|
|
||||||
mesg += "\n";
|
mesg += "\n";
|
||||||
}
|
}
|
||||||
return mesg;
|
return mesg;
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -21,20 +20,20 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
ImbalanceStore::ImbalanceStore(LAMMPS *lmp) : Imbalance(lmp), name(0) {}
|
ImbalanceStore::ImbalanceStore(LAMMPS *lmp) : Imbalance(lmp), name(nullptr) {}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
ImbalanceStore::~ImbalanceStore()
|
ImbalanceStore::~ImbalanceStore()
|
||||||
{
|
{
|
||||||
delete [] name;
|
delete[] name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
int ImbalanceStore::options(int narg, char **arg)
|
int ImbalanceStore::options(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 1) error->all(FLERR,"Illegal balance weight command");
|
if (narg < 1) error->all(FLERR, "Illegal balance weight command");
|
||||||
name = utils::strdup(arg[0]);
|
name = utils::strdup(arg[0]);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -44,13 +43,13 @@ int ImbalanceStore::options(int narg, char **arg)
|
|||||||
|
|
||||||
void ImbalanceStore::compute(double *weight)
|
void ImbalanceStore::compute(double *weight)
|
||||||
{
|
{
|
||||||
int flag,cols;
|
int flag, cols;
|
||||||
int index = atom->find_custom(name,flag,cols);
|
int index = atom->find_custom(name, flag, cols);
|
||||||
|
|
||||||
// property does not exist
|
// property does not exist
|
||||||
|
|
||||||
if (index < 0 || flag != 1 || cols)
|
if (index < 0 || flag != 1 || cols)
|
||||||
error->all(FLERR,"Balance weight store vector does not exist");
|
error->all(FLERR, "Balance weight store vector does not exist");
|
||||||
|
|
||||||
double *prop = atom->dvector[index];
|
double *prop = atom->dvector[index];
|
||||||
const int nlocal = atom->nlocal;
|
const int nlocal = atom->nlocal;
|
||||||
@ -61,5 +60,5 @@ void ImbalanceStore::compute(double *weight)
|
|||||||
|
|
||||||
std::string ImbalanceStore::info()
|
std::string ImbalanceStore::info()
|
||||||
{
|
{
|
||||||
return fmt::format(" storing weight in atom property d_{}\n",name);
|
return fmt::format(" storing weight in atom property d_{}\n", name);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -30,9 +29,9 @@ ImbalanceTime::ImbalanceTime(LAMMPS *lmp) : Imbalance(lmp) {}
|
|||||||
|
|
||||||
int ImbalanceTime::options(int narg, char **arg)
|
int ImbalanceTime::options(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 1) error->all(FLERR,"Illegal balance weight command");
|
if (narg < 1) error->all(FLERR, "Illegal balance weight command");
|
||||||
factor = utils::numeric(FLERR,arg[0],false,lmp);
|
factor = utils::numeric(FLERR, arg[0], false, lmp);
|
||||||
if (factor <= 0.0) error->all(FLERR,"Illegal balance weight command");
|
if (factor <= 0.0) error->all(FLERR, "Illegal balance weight command");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +70,14 @@ void ImbalanceTime::compute(double *weight)
|
|||||||
cost += 0.1;
|
cost += 0.1;
|
||||||
|
|
||||||
double maxcost;
|
double maxcost;
|
||||||
MPI_Allreduce(&cost,&maxcost,1,MPI_DOUBLE,MPI_MAX,world);
|
MPI_Allreduce(&cost, &maxcost, 1, MPI_DOUBLE, MPI_MAX, world);
|
||||||
if (maxcost <= 0.1) return;
|
if (maxcost <= 0.1) return;
|
||||||
|
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
double localwt = 0.0;
|
double localwt = 0.0;
|
||||||
if (nlocal) localwt = cost/nlocal;
|
if (nlocal) localwt = cost / nlocal;
|
||||||
|
|
||||||
if (nlocal && localwt <= 0.0) error->one(FLERR,"Balance weight <= 0.0");
|
if (nlocal && localwt <= 0.0) error->one(FLERR, "Balance weight <= 0.0");
|
||||||
|
|
||||||
// apply factor if specified != 1.0
|
// apply factor if specified != 1.0
|
||||||
// wtlo,wthi = lo/hi values excluding 0.0 due to no atoms on this proc
|
// wtlo,wthi = lo/hi values excluding 0.0 due to no atoms on this proc
|
||||||
@ -87,15 +86,15 @@ void ImbalanceTime::compute(double *weight)
|
|||||||
// expand/contract all localwt values from lo->hi to lo->newhi
|
// expand/contract all localwt values from lo->hi to lo->newhi
|
||||||
|
|
||||||
if (factor != 1.0) {
|
if (factor != 1.0) {
|
||||||
double wtlo,wthi;
|
double wtlo, wthi;
|
||||||
if (localwt == 0.0) localwt = BIG;
|
if (localwt == 0.0) localwt = BIG;
|
||||||
MPI_Allreduce(&localwt,&wtlo,1,MPI_DOUBLE,MPI_MIN,world);
|
MPI_Allreduce(&localwt, &wtlo, 1, MPI_DOUBLE, MPI_MIN, world);
|
||||||
if (localwt == BIG) localwt = 0.0;
|
if (localwt == BIG) localwt = 0.0;
|
||||||
MPI_Allreduce(&localwt,&wthi,1,MPI_DOUBLE,MPI_MAX,world);
|
MPI_Allreduce(&localwt, &wthi, 1, MPI_DOUBLE, MPI_MAX, world);
|
||||||
if (wtlo == wthi) return;
|
if (wtlo == wthi) return;
|
||||||
|
|
||||||
double newhi = wthi*factor;
|
double newhi = wthi * factor;
|
||||||
localwt = wtlo + ((localwt-wtlo)/(wthi-wtlo)) * (newhi-wtlo);
|
localwt = wtlo + ((localwt - wtlo) / (wthi - wtlo)) * (newhi - wtlo);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) weight[i] *= localwt;
|
for (int i = 0; i < nlocal; i++) weight[i] *= localwt;
|
||||||
@ -109,5 +108,5 @@ void ImbalanceTime::compute(double *weight)
|
|||||||
|
|
||||||
std::string ImbalanceTime::info()
|
std::string ImbalanceTime::info()
|
||||||
{
|
{
|
||||||
return fmt::format(" time weight factor: {}\n",factor);
|
return fmt::format(" time weight factor: {}\n", factor);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -25,20 +24,20 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
ImbalanceVar::ImbalanceVar(LAMMPS *lmp) : Imbalance(lmp), name(0) {}
|
ImbalanceVar::ImbalanceVar(LAMMPS *lmp) : Imbalance(lmp), name(nullptr) {}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
ImbalanceVar::~ImbalanceVar()
|
ImbalanceVar::~ImbalanceVar()
|
||||||
{
|
{
|
||||||
delete [] name;
|
delete[] name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
int ImbalanceVar::options(int narg, char **arg)
|
int ImbalanceVar::options(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 1) error->all(FLERR,"Illegal balance weight command");
|
if (narg < 1) error->all(FLERR, "Illegal balance weight command");
|
||||||
name = utils::strdup(arg[0]);
|
name = utils::strdup(arg[0]);
|
||||||
init(0);
|
init(0);
|
||||||
|
|
||||||
@ -51,10 +50,10 @@ void ImbalanceVar::init(int /*flag*/)
|
|||||||
{
|
{
|
||||||
id = input->variable->find(name);
|
id = input->variable->find(name);
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
error->all(FLERR,"Variable name for balance weight does not exist");
|
error->all(FLERR, "Variable name for balance weight does not exist");
|
||||||
} else {
|
} else {
|
||||||
if (input->variable->atomstyle(id) == 0)
|
if (input->variable->atomstyle(id) == 0)
|
||||||
error->all(FLERR,"Variable for balance weight has invalid style");
|
error->all(FLERR, "Variable for balance weight has invalid style");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,16 +66,16 @@ void ImbalanceVar::compute(double *weight)
|
|||||||
|
|
||||||
double *values;
|
double *values;
|
||||||
const int nlocal = atom->nlocal;
|
const int nlocal = atom->nlocal;
|
||||||
memory->create(values,nlocal,"imbalance:values");
|
memory->create(values, nlocal, "imbalance:values");
|
||||||
|
|
||||||
input->variable->compute_atom(id,all,values,1,0);
|
input->variable->compute_atom(id, all, values, 1, 0);
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
for (int i = 0; i < nlocal; i++)
|
for (int i = 0; i < nlocal; i++)
|
||||||
if (values[i] <= 0.0) flag = 1;
|
if (values[i] <= 0.0) flag = 1;
|
||||||
int flagall;
|
int flagall;
|
||||||
MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world);
|
MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world);
|
||||||
if (flagall) error->one(FLERR,"Balance weight <= 0.0");
|
if (flagall) error->one(FLERR, "Balance weight <= 0.0");
|
||||||
|
|
||||||
for (int i = 0; i < nlocal; i++) weight[i] *= values[i];
|
for (int i = 0; i < nlocal; i++) weight[i] *= values[i];
|
||||||
|
|
||||||
@ -87,5 +86,5 @@ void ImbalanceVar::compute(double *weight)
|
|||||||
|
|
||||||
std::string ImbalanceVar::info()
|
std::string ImbalanceVar::info()
|
||||||
{
|
{
|
||||||
return fmt::format(" weight variable: {}\n",name);
|
return fmt::format(" weight variable: {}\n", name);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -893,7 +893,7 @@ bool MinHFTN::compute_inner_cg_step_(const double dTrustRadius,
|
|||||||
Private method calc_xinf_using_mpi_
|
Private method calc_xinf_using_mpi_
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double MinHFTN::calc_xinf_using_mpi_(void) const
|
double MinHFTN::calc_xinf_using_mpi_() const
|
||||||
{
|
{
|
||||||
double dXInfLocal = 0.0;
|
double dXInfLocal = 0.0;
|
||||||
for (int i = 0; i < nvec; i++)
|
for (int i = 0; i < nvec; i++)
|
||||||
@ -1162,7 +1162,7 @@ bool MinHFTN::step_exceeds_TR_(const double dTrustRadius,
|
|||||||
which calls fix_box_relax->max_alpha
|
which calls fix_box_relax->max_alpha
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
bool MinHFTN::step_exceeds_DMAX_(void) const
|
bool MinHFTN::step_exceeds_DMAX_() const
|
||||||
{
|
{
|
||||||
double dAlpha = dmax * sqrt((double) _nNumUnknowns);
|
double dAlpha = dmax * sqrt((double) _nNumUnknowns);
|
||||||
|
|
||||||
@ -1611,7 +1611,7 @@ void MinHFTN::evaluate_dir_der_(const bool bUseForwardDiffs,
|
|||||||
Private method open_hftn_print_file_
|
Private method open_hftn_print_file_
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MinHFTN::open_hftn_print_file_(void)
|
void MinHFTN::open_hftn_print_file_()
|
||||||
{
|
{
|
||||||
int nMyRank;
|
int nMyRank;
|
||||||
MPI_Comm_rank (world, &nMyRank);
|
MPI_Comm_rank (world, &nMyRank);
|
||||||
@ -1700,7 +1700,7 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted,
|
|||||||
Private method close_hftn_print_file_
|
Private method close_hftn_print_file_
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MinHFTN::close_hftn_print_file_(void)
|
void MinHFTN::close_hftn_print_file_()
|
||||||
{
|
{
|
||||||
if (_fpPrint != nullptr) fclose (_fpPrint);
|
if (_fpPrint != nullptr) fclose (_fpPrint);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -12,7 +12,6 @@ es certain rights in this software. This software is distributed under
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "npair_half_size_multi_newtoff.h"
|
#include "npair_half_size_multi_newtoff.h"
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
|||||||
@ -346,7 +346,7 @@ void NStencil::create_setup()
|
|||||||
// Skip all stencils by default, initialize smax
|
// Skip all stencils by default, initialize smax
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
flag_skip_multi[i][j] = 1;
|
flag_skip_multi[i][j] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,8 @@ void NStencilFullMulti2d::set_stencil_properties()
|
|||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
flag_half_multi[i][j] = 0;
|
flag_half_multi[i][j] = false;
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = false;
|
||||||
bin_collection_multi[i][j] = j;
|
bin_collection_multi[i][j] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,8 +38,8 @@ void NStencilFullMulti3d::set_stencil_properties()
|
|||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
flag_half_multi[i][j] = 0;
|
flag_half_multi[i][j] = true;
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = false;
|
||||||
bin_collection_multi[i][j] = j;
|
bin_collection_multi[i][j] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,13 +43,13 @@ void NStencilHalfMulti2d::set_stencil_properties()
|
|||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = false;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = true;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
} else {
|
} else {
|
||||||
flag_half_multi[i][j] = 0;
|
flag_half_multi[i][j] = false;
|
||||||
bin_collection_multi[i][j] = j;
|
bin_collection_multi[i][j] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,13 +43,13 @@ void NStencilHalfMulti2dTri::set_stencil_properties()
|
|||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = false;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = true;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
} else {
|
} else {
|
||||||
flag_half_multi[i][j] = 0;
|
flag_half_multi[i][j] = false;
|
||||||
bin_collection_multi[i][j] = j;
|
bin_collection_multi[i][j] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,13 +43,13 @@ void NStencilHalfMulti3d::set_stencil_properties()
|
|||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = false;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = true;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
} else {
|
} else {
|
||||||
flag_half_multi[i][j] = 0;
|
flag_half_multi[i][j] = false;
|
||||||
bin_collection_multi[i][j] = j;
|
bin_collection_multi[i][j] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,13 +43,13 @@ void NStencilHalfMulti3dTri::set_stencil_properties()
|
|||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = false;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = true;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
} else {
|
} else {
|
||||||
flag_half_multi[i][j] = 0;
|
flag_half_multi[i][j] = false;
|
||||||
bin_collection_multi[i][j] = j;
|
bin_collection_multi[i][j] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,7 +317,7 @@ void Output::write(bigint ntimestep)
|
|||||||
if (next_restart_single == ntimestep) {
|
if (next_restart_single == ntimestep) {
|
||||||
|
|
||||||
std::string file = restart1;
|
std::string file = restart1;
|
||||||
std::size_t found = file.find("*");
|
std::size_t found = file.find('*');
|
||||||
if (found != std::string::npos)
|
if (found != std::string::npos)
|
||||||
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ void Output::write_restart(bigint ntimestep)
|
|||||||
{
|
{
|
||||||
if (restart_flag_single) {
|
if (restart_flag_single) {
|
||||||
std::string file = restart1;
|
std::string file = restart1;
|
||||||
std::size_t found = file.find("*");
|
std::size_t found = file.find('*');
|
||||||
if (found != std::string::npos)
|
if (found != std::string::npos)
|
||||||
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
||||||
restart->write(file);
|
restart->write(file);
|
||||||
|
|||||||
@ -758,8 +758,7 @@ void Pair::add_tally_callback(Compute *ptr)
|
|||||||
if (found < 0) {
|
if (found < 0) {
|
||||||
found = num_tally_compute;
|
found = num_tally_compute;
|
||||||
++num_tally_compute;
|
++num_tally_compute;
|
||||||
void *p = memory->srealloc((void *)list_tally_compute,
|
void *p = memory->srealloc((void *)list_tally_compute, sizeof(Compute *) * num_tally_compute,
|
||||||
sizeof(Compute *) * num_tally_compute,
|
|
||||||
"pair:list_tally_compute");
|
"pair:list_tally_compute");
|
||||||
list_tally_compute = (Compute **) p;
|
list_tally_compute = (Compute **) p;
|
||||||
list_tally_compute[num_tally_compute-1] = ptr;
|
list_tally_compute[num_tally_compute-1] = ptr;
|
||||||
|
|||||||
@ -476,7 +476,7 @@ void PairHybrid::coeff(int narg, char **arg)
|
|||||||
// 4th arg = pair sub-style index if name used multiple times
|
// 4th arg = pair sub-style index if name used multiple times
|
||||||
// allow for "none" as valid sub-style name
|
// allow for "none" as valid sub-style name
|
||||||
|
|
||||||
int multflag;
|
int multflag = 0;
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
for (m = 0; m < nstyles; m++) {
|
for (m = 0; m < nstyles; m++) {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ void PairHybridOverlay::coeff(int narg, char **arg)
|
|||||||
// 4th arg = pair sub-style index if name used multiple times
|
// 4th arg = pair sub-style index if name used multiple times
|
||||||
// allow for "none" as valid sub-style name
|
// allow for "none" as valid sub-style name
|
||||||
|
|
||||||
int multflag;
|
int multflag = 0;
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
for (m = 0; m < nstyles; m++) {
|
for (m = 0; m < nstyles; m++) {
|
||||||
@ -128,7 +128,7 @@ void PairHybridOverlay::init_svector()
|
|||||||
void PairHybridOverlay::copy_svector(int itype, int jtype)
|
void PairHybridOverlay::copy_svector(int itype, int jtype)
|
||||||
{
|
{
|
||||||
int n=0;
|
int n=0;
|
||||||
Pair *this_style;
|
Pair *this_style = nullptr;
|
||||||
|
|
||||||
// fill svector array.
|
// fill svector array.
|
||||||
// copy data from active styles and use 0.0 for inactive ones
|
// copy data from active styles and use 0.0 for inactive ones
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// clang-format off
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
https://www.lammps.org/, Sandia National Laboratories
|
https://www.lammps.org/, Sandia National Laboratories
|
||||||
@ -32,9 +31,8 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
PairHybridScaled::PairHybridScaled(LAMMPS *lmp)
|
PairHybridScaled::PairHybridScaled(LAMMPS *lmp) :
|
||||||
: PairHybrid(lmp), fsum(nullptr), tsum(nullptr),
|
PairHybrid(lmp), fsum(nullptr), tsum(nullptr), scaleval(nullptr), scaleidx(nullptr)
|
||||||
scaleval(nullptr), scaleidx(nullptr)
|
|
||||||
{
|
{
|
||||||
nmaxfsum = -1;
|
nmaxfsum = -1;
|
||||||
}
|
}
|
||||||
@ -63,7 +61,7 @@ PairHybridScaled::~PairHybridScaled()
|
|||||||
|
|
||||||
void PairHybridScaled::compute(int eflag, int vflag)
|
void PairHybridScaled::compute(int eflag, int vflag)
|
||||||
{
|
{
|
||||||
int i,j,m,n;
|
int i, j, m, n;
|
||||||
|
|
||||||
// update scale values from variables where needed
|
// update scale values from variables where needed
|
||||||
|
|
||||||
@ -73,13 +71,11 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
for (i = 0; i < nvars; ++i) {
|
for (i = 0; i < nvars; ++i) {
|
||||||
j = input->variable->find(scalevars[i].c_str());
|
j = input->variable->find(scalevars[i].c_str());
|
||||||
if (j < 0)
|
if (j < 0)
|
||||||
error->all(FLERR,"Variable '{}' not found when updating "
|
error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]);
|
||||||
"scale factors",scalevars[i]);
|
|
||||||
vals[i] = input->variable->compute_equal(j);
|
vals[i] = input->variable->compute_equal(j);
|
||||||
}
|
}
|
||||||
for (i = 0; i < nstyles; ++i) {
|
for (i = 0; i < nstyles; ++i) {
|
||||||
if (scaleidx[i] >= 0)
|
if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]];
|
||||||
scaleval[i] = vals[scaleidx[i]];
|
|
||||||
}
|
}
|
||||||
delete[] vals;
|
delete[] vals;
|
||||||
}
|
}
|
||||||
@ -92,7 +88,7 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
if (no_virial_fdotr_compute && (vflag & VIRIAL_FDOTR))
|
if (no_virial_fdotr_compute && (vflag & VIRIAL_FDOTR))
|
||||||
vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR);
|
vflag = VIRIAL_PAIR | (vflag & ~VIRIAL_FDOTR);
|
||||||
|
|
||||||
ev_init(eflag,vflag);
|
ev_init(eflag, vflag);
|
||||||
|
|
||||||
// grow fsum array if needed, and copy existing forces (usually 0.0) to it.
|
// grow fsum array if needed, and copy existing forces (usually 0.0) to it.
|
||||||
|
|
||||||
@ -100,8 +96,8 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
memory->destroy(fsum);
|
memory->destroy(fsum);
|
||||||
if (atom->torque_flag) memory->destroy(tsum);
|
if (atom->torque_flag) memory->destroy(tsum);
|
||||||
nmaxfsum = atom->nmax;
|
nmaxfsum = atom->nmax;
|
||||||
memory->create(fsum,nmaxfsum,3,"pair:fsum");
|
memory->create(fsum, nmaxfsum, 3, "pair:fsum");
|
||||||
if (atom->torque_flag) memory->create(tsum,nmaxfsum,3,"pair:tsum");
|
if (atom->torque_flag) memory->create(tsum, nmaxfsum, 3, "pair:tsum");
|
||||||
}
|
}
|
||||||
const int nall = atom->nlocal + atom->nghost;
|
const int nall = atom->nlocal + atom->nghost;
|
||||||
auto f = atom->f;
|
auto f = atom->f;
|
||||||
@ -122,8 +118,10 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
// necessary so substyle will not invoke virial_fdotr_compute()
|
// necessary so substyle will not invoke virial_fdotr_compute()
|
||||||
|
|
||||||
int vflag_substyle;
|
int vflag_substyle;
|
||||||
if (vflag & VIRIAL_FDOTR) vflag_substyle = vflag & ~VIRIAL_FDOTR;
|
if (vflag & VIRIAL_FDOTR)
|
||||||
else vflag_substyle = vflag;
|
vflag_substyle = vflag & ~VIRIAL_FDOTR;
|
||||||
|
else
|
||||||
|
vflag_substyle = vflag;
|
||||||
|
|
||||||
double *saved_special = save_special();
|
double *saved_special = save_special();
|
||||||
|
|
||||||
@ -131,7 +129,7 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
Respa *respa = nullptr;
|
Respa *respa = nullptr;
|
||||||
respaflag = 0;
|
respaflag = 0;
|
||||||
if (utils::strmatch(update->integrate_style,"^respa")) {
|
if (utils::strmatch(update->integrate_style, "^respa")) {
|
||||||
respa = (Respa *) update->integrate;
|
respa = (Respa *) update->integrate;
|
||||||
if (respa->nhybrid_styles > 0) respaflag = 1;
|
if (respa->nhybrid_styles > 0) respaflag = 1;
|
||||||
}
|
}
|
||||||
@ -140,8 +138,8 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
// clear forces and torques
|
// clear forces and torques
|
||||||
|
|
||||||
memset(&f[0][0],0,nall*3*sizeof(double));
|
memset(&f[0][0], 0, nall * 3 * sizeof(double));
|
||||||
if (atom->torque_flag) memset(&t[0][0],0,nall*3*sizeof(double));
|
if (atom->torque_flag) memset(&t[0][0], 0, nall * 3 * sizeof(double));
|
||||||
|
|
||||||
set_special(m);
|
set_special(m);
|
||||||
|
|
||||||
@ -152,20 +150,21 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
if (styles[m]->compute_flag == 0) continue;
|
if (styles[m]->compute_flag == 0) continue;
|
||||||
if (outerflag && styles[m]->respa_enable)
|
if (outerflag && styles[m]->respa_enable)
|
||||||
styles[m]->compute_outer(eflag,vflag_substyle);
|
styles[m]->compute_outer(eflag, vflag_substyle);
|
||||||
else styles[m]->compute(eflag,vflag_substyle);
|
else
|
||||||
|
styles[m]->compute(eflag, vflag_substyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add scaled forces to global sum
|
// add scaled forces to global sum
|
||||||
const double scale = scaleval[m];
|
const double scale = scaleval[m];
|
||||||
for (i = 0; i < nall; ++i) {
|
for (i = 0; i < nall; ++i) {
|
||||||
fsum[i][0] += scale*f[i][0];
|
fsum[i][0] += scale * f[i][0];
|
||||||
fsum[i][1] += scale*f[i][1];
|
fsum[i][1] += scale * f[i][1];
|
||||||
fsum[i][2] += scale*f[i][2];
|
fsum[i][2] += scale * f[i][2];
|
||||||
if (atom->torque_flag) {
|
if (atom->torque_flag) {
|
||||||
tsum[i][0] += scale*t[i][0];
|
tsum[i][0] += scale * t[i][0];
|
||||||
tsum[i][1] += scale*t[i][1];
|
tsum[i][1] += scale * t[i][1];
|
||||||
tsum[i][2] += scale*t[i][2];
|
tsum[i][2] += scale * t[i][2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,25 +175,24 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
if (respaflag && !respa->tally_global) continue;
|
if (respaflag && !respa->tally_global) continue;
|
||||||
|
|
||||||
if (eflag_global) {
|
if (eflag_global) {
|
||||||
eng_vdwl += scale*styles[m]->eng_vdwl;
|
eng_vdwl += scale * styles[m]->eng_vdwl;
|
||||||
eng_coul += scale*styles[m]->eng_coul;
|
eng_coul += scale * styles[m]->eng_coul;
|
||||||
}
|
}
|
||||||
if (vflag_global) {
|
if (vflag_global) {
|
||||||
for (n = 0; n < 6; n++) virial[n] += scale*styles[m]->virial[n];
|
for (n = 0; n < 6; n++) virial[n] += scale * styles[m]->virial[n];
|
||||||
}
|
}
|
||||||
if (eflag_atom) {
|
if (eflag_atom) {
|
||||||
n = atom->nlocal;
|
n = atom->nlocal;
|
||||||
if (force->newton_pair) n += atom->nghost;
|
if (force->newton_pair) n += atom->nghost;
|
||||||
double *eatom_substyle = styles[m]->eatom;
|
double *eatom_substyle = styles[m]->eatom;
|
||||||
for (i = 0; i < n; i++) eatom[i] += scale*eatom_substyle[i];
|
for (i = 0; i < n; i++) eatom[i] += scale * eatom_substyle[i];
|
||||||
}
|
}
|
||||||
if (vflag_atom) {
|
if (vflag_atom) {
|
||||||
n = atom->nlocal;
|
n = atom->nlocal;
|
||||||
if (force->newton_pair) n += atom->nghost;
|
if (force->newton_pair) n += atom->nghost;
|
||||||
double **vatom_substyle = styles[m]->vatom;
|
double **vatom_substyle = styles[m]->vatom;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
for (j = 0; j < 6; j++)
|
for (j = 0; j < 6; j++) vatom[i][j] += scale * vatom_substyle[i][j];
|
||||||
vatom[i][j] += scale*vatom_substyle[i][j];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// substyles may be CENTROID_SAME or CENTROID_AVAIL
|
// substyles may be CENTROID_SAME or CENTROID_AVAIL
|
||||||
@ -205,17 +203,12 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
if (styles[m]->centroidstressflag == CENTROID_AVAIL) {
|
if (styles[m]->centroidstressflag == CENTROID_AVAIL) {
|
||||||
double **cvatom_substyle = styles[m]->cvatom;
|
double **cvatom_substyle = styles[m]->cvatom;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
for (j = 0; j < 9; j++)
|
for (j = 0; j < 9; j++) cvatom[i][j] += scale * cvatom_substyle[i][j];
|
||||||
cvatom[i][j] += scale*cvatom_substyle[i][j];
|
|
||||||
} else {
|
} else {
|
||||||
double **vatom_substyle = styles[m]->vatom;
|
double **vatom_substyle = styles[m]->vatom;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < 6; j++) {
|
for (j = 0; j < 6; j++) { cvatom[i][j] += scale * vatom_substyle[i][j]; }
|
||||||
cvatom[i][j] += scale*vatom_substyle[i][j];
|
for (j = 6; j < 9; j++) { cvatom[i][j] += scale * vatom_substyle[i][j - 3]; }
|
||||||
}
|
|
||||||
for (j = 6; j < 9; j++) {
|
|
||||||
cvatom[i][j] += scale*vatom_substyle[i][j-3];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +226,7 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
t[i][2] = tsum[i][2];
|
t[i][2] = tsum[i][2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete [] saved_special;
|
delete[] saved_special;
|
||||||
|
|
||||||
if (vflag_fdotr) virial_fdotr_compute();
|
if (vflag_fdotr) virial_fdotr_compute();
|
||||||
}
|
}
|
||||||
@ -244,22 +237,21 @@ void PairHybridScaled::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
void PairHybridScaled::settings(int narg, char **arg)
|
void PairHybridScaled::settings(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 1) error->all(FLERR,"Illegal pair_style command");
|
if (narg < 1) error->all(FLERR, "Illegal pair_style command");
|
||||||
if (lmp->kokkos && !utils::strmatch(force->pair_style,"^hybrid.*/kk$"))
|
if (lmp->kokkos && !utils::strmatch(force->pair_style, "^hybrid.*/kk$"))
|
||||||
error->all(FLERR,"Must use pair_style {}/kk with Kokkos",
|
error->all(FLERR, "Must use pair_style {}/kk with Kokkos", force->pair_style);
|
||||||
force->pair_style);
|
|
||||||
|
|
||||||
if (atom->avec->forceclearflag)
|
if (atom->avec->forceclearflag)
|
||||||
error->all(FLERR,"Atom style is not compatible with pair_style hybrid/scaled");
|
error->all(FLERR, "Atom style is not compatible with pair_style hybrid/scaled");
|
||||||
|
|
||||||
// delete old lists, since cannot just change settings
|
// delete old lists, since cannot just change settings
|
||||||
|
|
||||||
if (nstyles > 0) {
|
if (nstyles > 0) {
|
||||||
for (int m = 0; m < nstyles; m++) {
|
for (int m = 0; m < nstyles; m++) {
|
||||||
delete styles[m];
|
delete styles[m];
|
||||||
delete [] keywords[m];
|
delete[] keywords[m];
|
||||||
if (special_lj[m]) delete [] special_lj[m];
|
if (special_lj[m]) delete[] special_lj[m];
|
||||||
if (special_coul[m]) delete [] special_coul[m];
|
if (special_coul[m]) delete[] special_coul[m];
|
||||||
}
|
}
|
||||||
delete[] styles;
|
delete[] styles;
|
||||||
delete[] keywords;
|
delete[] keywords;
|
||||||
@ -283,12 +275,12 @@ void PairHybridScaled::settings(int narg, char **arg)
|
|||||||
|
|
||||||
// allocate list of sub-styles as big as possibly needed if no extra args
|
// allocate list of sub-styles as big as possibly needed if no extra args
|
||||||
|
|
||||||
styles = new Pair*[narg];
|
styles = new Pair *[narg];
|
||||||
keywords = new char*[narg];
|
keywords = new char *[narg];
|
||||||
multiple = new int[narg];
|
multiple = new int[narg];
|
||||||
|
|
||||||
special_lj = new double*[narg];
|
special_lj = new double *[narg];
|
||||||
special_coul = new double*[narg];
|
special_coul = new double *[narg];
|
||||||
compute_tally = new int[narg];
|
compute_tally = new int[narg];
|
||||||
|
|
||||||
scaleval = new double[narg];
|
scaleval = new double[narg];
|
||||||
@ -301,62 +293,63 @@ void PairHybridScaled::settings(int narg, char **arg)
|
|||||||
// call settings() with set of args that are not pair style names
|
// call settings() with set of args that are not pair style names
|
||||||
// use force->pair_map to determine which args these are
|
// use force->pair_map to determine which args these are
|
||||||
|
|
||||||
int iarg,jarg,dummy;
|
int iarg, jarg, dummy;
|
||||||
|
|
||||||
iarg = 0;
|
iarg = 0;
|
||||||
nstyles = 0;
|
nstyles = 0;
|
||||||
while (iarg < narg-1) {
|
while (iarg < narg - 1) {
|
||||||
|
|
||||||
// first process scale factor or variable
|
// first process scale factor or variable
|
||||||
// idx < 0 indicates constant value otherwise index in variable name list
|
// idx < 0 indicates constant value otherwise index in variable name list
|
||||||
|
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
if (utils::strmatch(arg[iarg],"^v_")) {
|
if (utils::strmatch(arg[iarg], "^v_")) {
|
||||||
for (std::size_t i=0; i < scalevars.size(); ++i) {
|
for (std::size_t i = 0; i < scalevars.size(); ++i) {
|
||||||
if (scalevars[i] == arg[iarg]+2) {
|
if (scalevars[i] == arg[iarg] + 2) {
|
||||||
idx = i;
|
idx = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
idx = scalevars.size();
|
idx = scalevars.size();
|
||||||
scalevars.push_back(arg[iarg]+2);
|
scalevars.emplace_back(arg[iarg] + 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val = utils::numeric(FLERR,arg[iarg],false,lmp);
|
val = utils::numeric(FLERR, arg[iarg], false, lmp);
|
||||||
}
|
}
|
||||||
scaleval[nstyles] = val;
|
scaleval[nstyles] = val;
|
||||||
scaleidx[nstyles] = idx;
|
scaleidx[nstyles] = idx;
|
||||||
++iarg;
|
++iarg;
|
||||||
|
|
||||||
if (utils::strmatch(arg[iarg],"^hybrid"))
|
if (utils::strmatch(arg[iarg], "^hybrid"))
|
||||||
error->all(FLERR,"Pair style hybrid/scaled cannot have hybrid as an argument");
|
error->all(FLERR, "Pair style hybrid/scaled cannot have hybrid as an argument");
|
||||||
if (strcmp(arg[iarg],"none") == 0)
|
if (strcmp(arg[iarg], "none") == 0)
|
||||||
error->all(FLERR,"Pair style hybrid/scaled cannot have none as an argument");
|
error->all(FLERR, "Pair style hybrid/scaled cannot have none as an argument");
|
||||||
|
|
||||||
styles[nstyles] = force->new_pair(arg[iarg],1,dummy);
|
styles[nstyles] = force->new_pair(arg[iarg], 1, dummy);
|
||||||
force->store_style(keywords[nstyles],arg[iarg],0);
|
force->store_style(keywords[nstyles], arg[iarg], 0);
|
||||||
special_lj[nstyles] = special_coul[nstyles] = nullptr;
|
special_lj[nstyles] = special_coul[nstyles] = nullptr;
|
||||||
compute_tally[nstyles] = 1;
|
compute_tally[nstyles] = 1;
|
||||||
|
|
||||||
if ((styles[nstyles]->suffix_flag & (Suffix::INTEL|Suffix::GPU|Suffix::OMP)) != 0)
|
if ((styles[nstyles]->suffix_flag & (Suffix::INTEL | Suffix::GPU | Suffix::OMP)) != 0)
|
||||||
error->all(FLERR,"Pair style hybrid/scaled does not support "
|
error->all(FLERR,
|
||||||
|
"Pair style hybrid/scaled does not support "
|
||||||
"accelerator styles");
|
"accelerator styles");
|
||||||
|
|
||||||
// determine list of arguments for pair style settings
|
// determine list of arguments for pair style settings
|
||||||
// by looking for the next known pair style name.
|
// by looking for the next known pair style name.
|
||||||
|
|
||||||
jarg = iarg + 1;
|
jarg = iarg + 1;
|
||||||
while ((jarg < narg)
|
while ((jarg < narg) && !force->pair_map->count(arg[jarg]) &&
|
||||||
&& !force->pair_map->count(arg[jarg])
|
!lmp->match_style("pair", arg[jarg]))
|
||||||
&& !lmp->match_style("pair",arg[jarg])) jarg++;
|
jarg++;
|
||||||
|
|
||||||
// decrement to account for scale factor except when last argument
|
// decrement to account for scale factor except when last argument
|
||||||
|
|
||||||
if (jarg < narg) --jarg;
|
if (jarg < narg) --jarg;
|
||||||
|
|
||||||
styles[nstyles]->settings(jarg-iarg-1,arg+iarg+1);
|
styles[nstyles]->settings(jarg - iarg - 1, arg + iarg + 1);
|
||||||
iarg = jarg;
|
iarg = jarg;
|
||||||
nstyles++;
|
nstyles++;
|
||||||
}
|
}
|
||||||
@ -366,7 +359,7 @@ void PairHybridScaled::settings(int narg, char **arg)
|
|||||||
for (int i = 0; i < nstyles; i++) {
|
for (int i = 0; i < nstyles; i++) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int j = 0; j < nstyles; j++) {
|
for (int j = 0; j < nstyles; j++) {
|
||||||
if (strcmp(keywords[j],keywords[i]) == 0) count++;
|
if (strcmp(keywords[j], keywords[i]) == 0) count++;
|
||||||
if (j == i) multiple[i] = count;
|
if (j == i) multiple[i] = count;
|
||||||
}
|
}
|
||||||
if (count == 1) multiple[i] = 0;
|
if (count == 1) multiple[i] = 0;
|
||||||
@ -383,11 +376,10 @@ void PairHybridScaled::settings(int narg, char **arg)
|
|||||||
since overlay could have multiple sub-styles, sum results explicitly
|
since overlay could have multiple sub-styles, sum results explicitly
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
|
double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, double factor_coul,
|
||||||
double factor_coul, double factor_lj, double &fforce)
|
double factor_lj, double &fforce)
|
||||||
{
|
{
|
||||||
if (nmap[itype][jtype] == 0)
|
if (nmap[itype][jtype] == 0) error->one(FLERR, "Invoked pair single on pair style none");
|
||||||
error->one(FLERR,"Invoked pair single on pair style none");
|
|
||||||
|
|
||||||
// update scale values from variables where needed
|
// update scale values from variables where needed
|
||||||
|
|
||||||
@ -397,13 +389,11 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
|
|||||||
for (i = 0; i < nvars; ++i) {
|
for (i = 0; i < nvars; ++i) {
|
||||||
j = input->variable->find(scalevars[i].c_str());
|
j = input->variable->find(scalevars[i].c_str());
|
||||||
if (j < 0)
|
if (j < 0)
|
||||||
error->all(FLERR,"Variable '{}' not found when updating "
|
error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[i]);
|
||||||
"scale factors",scalevars[i]);
|
|
||||||
vals[i] = input->variable->compute_equal(j);
|
vals[i] = input->variable->compute_equal(j);
|
||||||
}
|
}
|
||||||
for (i = 0; i < nstyles; ++i) {
|
for (i = 0; i < nstyles; ++i) {
|
||||||
if (scaleidx[i] >= 0)
|
if (scaleidx[i] >= 0) scaleval[i] = vals[scaleidx[i]];
|
||||||
scaleval[i] = vals[scaleidx[i]];
|
|
||||||
}
|
}
|
||||||
delete[] vals;
|
delete[] vals;
|
||||||
}
|
}
|
||||||
@ -414,23 +404,22 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
|
|||||||
double scale;
|
double scale;
|
||||||
|
|
||||||
for (int m = 0; m < nmap[itype][jtype]; m++) {
|
for (int m = 0; m < nmap[itype][jtype]; m++) {
|
||||||
if (rsq < styles[map[itype][jtype][m]]->cutsq[itype][jtype]) {
|
auto pstyle = styles[map[itype][jtype][m]];
|
||||||
if (styles[map[itype][jtype][m]]->single_enable == 0)
|
if (rsq < pstyle->cutsq[itype][jtype]) {
|
||||||
error->one(FLERR,"Pair hybrid sub-style does not support single call");
|
if (pstyle->single_enable == 0)
|
||||||
|
error->one(FLERR, "Pair hybrid sub-style does not support single call");
|
||||||
|
|
||||||
if ((special_lj[map[itype][jtype][m]] != nullptr) ||
|
if ((special_lj[map[itype][jtype][m]] != nullptr) ||
|
||||||
(special_coul[map[itype][jtype][m]] != nullptr))
|
(special_coul[map[itype][jtype][m]] != nullptr))
|
||||||
error->one(FLERR,"Pair hybrid single calls do not support"
|
error->one(FLERR, "Pair hybrid single() does not support per sub-style special_bond");
|
||||||
" per sub-style special bond values");
|
|
||||||
|
|
||||||
scale = scaleval[map[itype][jtype][m]];
|
scale = scaleval[map[itype][jtype][m]];
|
||||||
esum += scale * styles[map[itype][jtype][m]]->single(i,j,itype,jtype,rsq,
|
esum += scale * pstyle->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fone);
|
||||||
factor_coul,factor_lj,fone);
|
|
||||||
fforce += scale * fone;
|
fforce += scale * fone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (single_extra) copy_svector(itype,jtype);
|
if (single_extra) copy_svector(itype, jtype);
|
||||||
return esum;
|
return esum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,49 +429,54 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
|
|||||||
|
|
||||||
void PairHybridScaled::coeff(int narg, char **arg)
|
void PairHybridScaled::coeff(int narg, char **arg)
|
||||||
{
|
{
|
||||||
if (narg < 3) error->all(FLERR,"Incorrect args for pair coefficients");
|
if (narg < 3) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||||
if (!allocated) allocate();
|
if (!allocated) allocate();
|
||||||
|
|
||||||
int ilo,ihi,jlo,jhi;
|
int ilo, ihi, jlo, jhi;
|
||||||
utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error);
|
utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error);
|
||||||
utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error);
|
utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error);
|
||||||
|
|
||||||
// 3rd arg = pair sub-style name
|
// 3rd arg = pair sub-style name
|
||||||
// 4th arg = pair sub-style index if name used multiple times
|
// 4th arg = pair sub-style index if name used multiple times
|
||||||
// allow for "none" as valid sub-style name
|
// allow for "none" as valid sub-style name
|
||||||
|
|
||||||
int multflag;
|
int multflag = 0;
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
for (m = 0; m < nstyles; m++) {
|
for (m = 0; m < nstyles; m++) {
|
||||||
multflag = 0;
|
multflag = 0;
|
||||||
if (strcmp(arg[2],keywords[m]) == 0) {
|
if (strcmp(arg[2], keywords[m]) == 0) {
|
||||||
if (multiple[m]) {
|
if (multiple[m]) {
|
||||||
multflag = 1;
|
multflag = 1;
|
||||||
if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients");
|
if (narg < 4) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||||
int index = utils::inumeric(FLERR,arg[3],false,lmp);
|
int index = utils::inumeric(FLERR, arg[3], false, lmp);
|
||||||
if (index == multiple[m]) break;
|
if (index == multiple[m])
|
||||||
else continue;
|
break;
|
||||||
} else break;
|
else
|
||||||
|
continue;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int none = 0;
|
int none = 0;
|
||||||
if (m == nstyles) {
|
if (m == nstyles) {
|
||||||
if (strcmp(arg[2],"none") == 0) none = 1;
|
if (strcmp(arg[2], "none") == 0)
|
||||||
else error->all(FLERR,"Pair coeff for hybrid has invalid style");
|
none = 1;
|
||||||
|
else
|
||||||
|
error->all(FLERR, "Pair coeff for hybrid has invalid style");
|
||||||
}
|
}
|
||||||
|
|
||||||
// move 1st/2nd args to 2nd/3rd args
|
// move 1st/2nd args to 2nd/3rd args
|
||||||
// if multflag: move 1st/2nd args to 3rd/4th args
|
// if multflag: move 1st/2nd args to 3rd/4th args
|
||||||
// just copy ptrs, since arg[] points into original input line
|
// just copy ptrs, since arg[] points into original input line
|
||||||
|
|
||||||
arg[2+multflag] = arg[1];
|
arg[2 + multflag] = arg[1];
|
||||||
arg[1+multflag] = arg[0];
|
arg[1 + multflag] = arg[0];
|
||||||
|
|
||||||
// invoke sub-style coeff() starting with 1st remaining arg
|
// invoke sub-style coeff() starting with 1st remaining arg
|
||||||
|
|
||||||
if (!none) styles[m]->coeff(narg-1-multflag,&arg[1+multflag]);
|
if (!none) styles[m]->coeff(narg - 1 - multflag, &arg[1 + multflag]);
|
||||||
|
|
||||||
// set setflag and which type pairs map to which sub-style
|
// set setflag and which type pairs map to which sub-style
|
||||||
// if sub-style is none: set hybrid subflag, wipe out map
|
// if sub-style is none: set hybrid subflag, wipe out map
|
||||||
@ -492,7 +486,7 @@ void PairHybridScaled::coeff(int narg, char **arg)
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = ilo; i <= ihi; i++) {
|
for (int i = ilo; i <= ihi; i++) {
|
||||||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
for (int j = MAX(jlo, i); j <= jhi; j++) {
|
||||||
if (none) {
|
if (none) {
|
||||||
setflag[i][j] = 1;
|
setflag[i][j] = 1;
|
||||||
nmap[i][j] = 0;
|
nmap[i][j] = 0;
|
||||||
@ -508,7 +502,7 @@ void PairHybridScaled::coeff(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
|
if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -519,15 +513,15 @@ void PairHybridScaled::write_restart(FILE *fp)
|
|||||||
{
|
{
|
||||||
PairHybrid::write_restart(fp);
|
PairHybrid::write_restart(fp);
|
||||||
|
|
||||||
fwrite(scaleval,sizeof(double),nstyles,fp);
|
fwrite(scaleval, sizeof(double), nstyles, fp);
|
||||||
fwrite(scaleidx,sizeof(int),nstyles,fp);
|
fwrite(scaleidx, sizeof(int), nstyles, fp);
|
||||||
|
|
||||||
int n = scalevars.size();
|
int n = scalevars.size();
|
||||||
fwrite(&n,sizeof(int),1,fp);
|
fwrite(&n, sizeof(int), 1, fp);
|
||||||
for (auto var : scalevars) {
|
for (auto var : scalevars) {
|
||||||
n = var.size() + 1;
|
n = var.size() + 1;
|
||||||
fwrite(&n,sizeof(int),1,fp);
|
fwrite(&n, sizeof(int), 1, fp);
|
||||||
fwrite(var.c_str(),sizeof(char),n,fp);
|
fwrite(var.c_str(), sizeof(char), n, fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,23 +541,23 @@ void PairHybridScaled::read_restart(FILE *fp)
|
|||||||
|
|
||||||
int n, me = comm->me;
|
int n, me = comm->me;
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
utils::sfread(FLERR,scaleval,sizeof(double),nstyles,fp,nullptr,error);
|
utils::sfread(FLERR, scaleval, sizeof(double), nstyles, fp, nullptr, error);
|
||||||
utils::sfread(FLERR,scaleidx,sizeof(int),nstyles,fp,nullptr,error);
|
utils::sfread(FLERR, scaleidx, sizeof(int), nstyles, fp, nullptr, error);
|
||||||
}
|
}
|
||||||
MPI_Bcast(scaleval,nstyles,MPI_DOUBLE,0,world);
|
MPI_Bcast(scaleval, nstyles, MPI_DOUBLE, 0, world);
|
||||||
MPI_Bcast(scaleidx,nstyles,MPI_INT,0,world);
|
MPI_Bcast(scaleidx, nstyles, MPI_INT, 0, world);
|
||||||
|
|
||||||
char *tmp;
|
char *tmp;
|
||||||
if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error);
|
if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error);
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n, 1, MPI_INT, 0, world);
|
||||||
scalevars.resize(n);
|
scalevars.resize(n);
|
||||||
for (size_t j=0; j < scalevars.size(); ++j) {
|
for (auto &scale : scalevars) {
|
||||||
if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error);
|
if (me == 0) utils::sfread(FLERR, &n, sizeof(int), 1, fp, nullptr, error);
|
||||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
MPI_Bcast(&n, 1, MPI_INT, 0, world);
|
||||||
tmp = new char[n];
|
tmp = new char[n];
|
||||||
if (me == 0) utils::sfread(FLERR,tmp,sizeof(char),n,fp,nullptr,error);
|
if (me == 0) utils::sfread(FLERR, tmp, sizeof(char), n, fp, nullptr, error);
|
||||||
MPI_Bcast(tmp,n,MPI_CHAR,0,world);
|
MPI_Bcast(tmp, n, MPI_CHAR, 0, world);
|
||||||
scalevars[j] = tmp;
|
scale = tmp;
|
||||||
delete[] tmp;
|
delete[] tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -578,11 +572,10 @@ void PairHybridScaled::init_svector()
|
|||||||
// allocate svector
|
// allocate svector
|
||||||
|
|
||||||
single_extra = 0;
|
single_extra = 0;
|
||||||
for (int m = 0; m < nstyles; m++)
|
for (int m = 0; m < nstyles; m++) single_extra += styles[m]->single_extra;
|
||||||
single_extra += styles[m]->single_extra;
|
|
||||||
|
|
||||||
if (single_extra) {
|
if (single_extra) {
|
||||||
delete [] svector;
|
delete[] svector;
|
||||||
svector = new double[single_extra];
|
svector = new double[single_extra];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -593,7 +586,7 @@ void PairHybridScaled::init_svector()
|
|||||||
|
|
||||||
void PairHybridScaled::copy_svector(int itype, int jtype)
|
void PairHybridScaled::copy_svector(int itype, int jtype)
|
||||||
{
|
{
|
||||||
int n=0;
|
int n = 0;
|
||||||
Pair *this_style;
|
Pair *this_style;
|
||||||
|
|
||||||
// fill svector array.
|
// fill svector array.
|
||||||
|
|||||||
@ -285,7 +285,7 @@ bigint ReadDump::seek(bigint nrequest, int exact)
|
|||||||
ntimestep = -1;
|
ntimestep = -1;
|
||||||
if (multiproc) {
|
if (multiproc) {
|
||||||
std::string multiname = files[ifile];
|
std::string multiname = files[ifile];
|
||||||
multiname.replace(multiname.find("%"),1,"0");
|
multiname.replace(multiname.find('%'),1,"0");
|
||||||
readers[0]->open_file(multiname.c_str());
|
readers[0]->open_file(multiname.c_str());
|
||||||
} else readers[0]->open_file(files[ifile]);
|
} else readers[0]->open_file(files[ifile]);
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ bigint ReadDump::seek(bigint nrequest, int exact)
|
|||||||
for (int i = 0; i < nreader; i++) {
|
for (int i = 0; i < nreader; i++) {
|
||||||
if (me == 0 && i == 0) continue; // proc 0, reader 0 already found it
|
if (me == 0 && i == 0) continue; // proc 0, reader 0 already found it
|
||||||
std::string multiname = files[currentfile];
|
std::string multiname = files[currentfile];
|
||||||
multiname.replace(multiname.find("%"),1,fmt::format("{}",firstfile+i));
|
multiname.replace(multiname.find('%'),1,fmt::format("{}",firstfile+i));
|
||||||
readers[i]->open_file(multiname.c_str());
|
readers[i]->open_file(multiname.c_str());
|
||||||
|
|
||||||
bigint step;
|
bigint step;
|
||||||
@ -377,7 +377,7 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip)
|
|||||||
if (ifile != currentfile) {
|
if (ifile != currentfile) {
|
||||||
if (multiproc) {
|
if (multiproc) {
|
||||||
std::string multiname = files[ifile];
|
std::string multiname = files[ifile];
|
||||||
multiname.replace(multiname.find("%"),1,"0");
|
multiname.replace(multiname.find('%'),1,"0");
|
||||||
readers[0]->open_file(multiname.c_str());
|
readers[0]->open_file(multiname.c_str());
|
||||||
} else readers[0]->open_file(files[ifile]);
|
} else readers[0]->open_file(files[ifile]);
|
||||||
}
|
}
|
||||||
@ -431,7 +431,7 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip)
|
|||||||
for (int i = 0; i < nreader; i++) {
|
for (int i = 0; i < nreader; i++) {
|
||||||
if (me == 0 && i == 0) continue;
|
if (me == 0 && i == 0) continue;
|
||||||
std::string multiname = files[currentfile];
|
std::string multiname = files[currentfile];
|
||||||
multiname.replace(multiname.find("%"),1,fmt::format("{}",firstfile+i));
|
multiname.replace(multiname.find('%'),1,fmt::format("{}",firstfile+i));
|
||||||
readers[i]->open_file(multiname.c_str());
|
readers[i]->open_file(multiname.c_str());
|
||||||
|
|
||||||
bigint step;
|
bigint step;
|
||||||
|
|||||||
@ -106,7 +106,7 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
utils::logmesg(lmp,"Reading restart file ...\n");
|
utils::logmesg(lmp,"Reading restart file ...\n");
|
||||||
std::string hfile = file;
|
std::string hfile = file;
|
||||||
if (multiproc) {
|
if (multiproc) {
|
||||||
hfile.replace(hfile.find("%"),1,"base");
|
hfile.replace(hfile.find('%'),1,"base");
|
||||||
}
|
}
|
||||||
fp = fopen(hfile.c_str(),"rb");
|
fp = fopen(hfile.c_str(),"rb");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
@ -268,7 +268,7 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
|
|
||||||
for (int iproc = me; iproc < multiproc_file; iproc += nprocs) {
|
for (int iproc = me; iproc < multiproc_file; iproc += nprocs) {
|
||||||
std::string procfile = file;
|
std::string procfile = file;
|
||||||
procfile.replace(procfile.find("%"),1,fmt::format("{}",iproc));
|
procfile.replace(procfile.find('%'),1,fmt::format("{}",iproc));
|
||||||
fp = fopen(procfile.c_str(),"rb");
|
fp = fopen(procfile.c_str(),"rb");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
error->one(FLERR,"Cannot open restart file {}: {}",
|
error->one(FLERR,"Cannot open restart file {}: {}",
|
||||||
@ -332,7 +332,7 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
|
|
||||||
if (filereader) {
|
if (filereader) {
|
||||||
std::string procfile = file;
|
std::string procfile = file;
|
||||||
procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster));
|
procfile.replace(procfile.find('%'),1,fmt::format("{}",icluster));
|
||||||
fp = fopen(procfile.c_str(),"rb");
|
fp = fopen(procfile.c_str(),"rb");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
error->one(FLERR,"Cannot open restart file {}: {}", procfile, utils::getsyserror());
|
error->one(FLERR,"Cannot open restart file {}: {}", procfile, utils::getsyserror());
|
||||||
|
|||||||
@ -89,7 +89,7 @@ void ResetMolIDs::command(int narg, char **arg)
|
|||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"offset") == 0) {
|
} else if (strcmp(arg[iarg],"offset") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal reset_mol_ids command");
|
||||||
offset = utils::tnumeric(FLERR,arg[iarg+1],1,lmp);
|
offset = utils::tnumeric(FLERR,arg[iarg+1],true,lmp);
|
||||||
if (offset < -1) error->all(FLERR,"Illegal reset_mol_ids command");
|
if (offset < -1) error->all(FLERR,"Illegal reset_mol_ids command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else error->all(FLERR,"Illegal reset_mol_ids command");
|
} else error->all(FLERR,"Illegal reset_mol_ids command");
|
||||||
|
|||||||
@ -61,7 +61,7 @@ void WriteData::command(int narg, char **arg)
|
|||||||
// if filename contains a "*", replace with current timestep
|
// if filename contains a "*", replace with current timestep
|
||||||
|
|
||||||
std::string file = arg[0];
|
std::string file = arg[0];
|
||||||
std::size_t found = file.find("*");
|
std::size_t found = file.find('*');
|
||||||
if (found != std::string::npos)
|
if (found != std::string::npos)
|
||||||
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +65,7 @@ void WriteRestart::command(int narg, char **arg)
|
|||||||
// if filename contains a "*", replace with current timestep
|
// if filename contains a "*", replace with current timestep
|
||||||
|
|
||||||
std::string file = arg[0];
|
std::string file = arg[0];
|
||||||
std::size_t found = file.find("*");
|
std::size_t found = file.find('*');
|
||||||
if (found != std::string::npos)
|
if (found != std::string::npos)
|
||||||
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
file.replace(found,1,fmt::format("{}",update->ntimestep));
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller,
|
|||||||
file = final file name to write, except may contain a "%"
|
file = final file name to write, except may contain a "%"
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void WriteRestart::write(std::string file)
|
void WriteRestart::write(const std::string &file)
|
||||||
{
|
{
|
||||||
// special case where reneighboring is not done in integrator
|
// special case where reneighboring is not done in integrator
|
||||||
// on timestep restart file is written (due to build_once being set)
|
// on timestep restart file is written (due to build_once being set)
|
||||||
@ -228,7 +228,7 @@ void WriteRestart::write(std::string file)
|
|||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
std::string base = file;
|
std::string base = file;
|
||||||
if (multiproc) base.replace(base.find("%"),1,"base");
|
if (multiproc) base.replace(base.find('%'),1,"base");
|
||||||
|
|
||||||
fp = fopen(base.c_str(),"wb");
|
fp = fopen(base.c_str(),"wb");
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
@ -290,7 +290,7 @@ void WriteRestart::write(std::string file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string multiname = file;
|
std::string multiname = file;
|
||||||
multiname.replace(multiname.find("%"),1,fmt::format("{}",icluster));
|
multiname.replace(multiname.find('%'),1,fmt::format("{}",icluster));
|
||||||
|
|
||||||
if (filewriter) {
|
if (filewriter) {
|
||||||
fp = fopen(multiname.c_str(),"wb");
|
fp = fopen(multiname.c_str(),"wb");
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class WriteRestart : public Command {
|
|||||||
WriteRestart(class LAMMPS *);
|
WriteRestart(class LAMMPS *);
|
||||||
void command(int, char **);
|
void command(int, char **);
|
||||||
void multiproc_options(int, int, int, char **);
|
void multiproc_options(int, int, int, char **);
|
||||||
void write(std::string);
|
void write(const std::string &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int me, nprocs;
|
int me, nprocs;
|
||||||
|
|||||||
@ -29,9 +29,9 @@
|
|||||||
// g++ -g -DLAMMPS_BIGBIG binarytxt.o -o binary2txt
|
// g++ -g -DLAMMPS_BIGBIG binarytxt.o -o binary2txt
|
||||||
// again -DLAMMPS_SMALLBIG is the default
|
// again -DLAMMPS_SMALLBIG is the default
|
||||||
|
|
||||||
#include "stdint.h"
|
#include <cstdint>
|
||||||
#define __STDC_FORMAT_MACROS
|
#define __STDC_FORMAT_MACROS
|
||||||
#include "inttypes.h"
|
#include <cinttypes>
|
||||||
|
|
||||||
#ifndef PRId64
|
#ifndef PRId64
|
||||||
#define PRId64 "ld"
|
#define PRId64 "ld"
|
||||||
@ -65,7 +65,7 @@ int main(int narg, char **arg)
|
|||||||
char boundstr[9];
|
char boundstr[9];
|
||||||
|
|
||||||
int maxbuf = 0;
|
int maxbuf = 0;
|
||||||
double *buf = NULL;
|
double *buf = nullptr;
|
||||||
|
|
||||||
if (narg == 1) {
|
if (narg == 1) {
|
||||||
printf("Syntax: binary2txt file1 file2 ...\n");
|
printf("Syntax: binary2txt file1 file2 ...\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user