remove class member "me" and apply clang-format
This commit is contained in:
@ -106,7 +106,6 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
restart_global = 1;
|
restart_global = 1;
|
||||||
energy_global_flag = 1;
|
energy_global_flag = 1;
|
||||||
|
|
||||||
me = comm->me;
|
|
||||||
root2root = MPI_COMM_NULL;
|
root2root = MPI_COMM_NULL;
|
||||||
proxy = nullptr;
|
proxy = nullptr;
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
if (!out_name) out_name = utils::strdup("out");
|
if (!out_name) out_name = utils::strdup("out");
|
||||||
|
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
#ifdef LAMMPS_BIGBIG
|
#ifdef LAMMPS_BIGBIG
|
||||||
utils::logmesg(lmp, "colvars: Warning: cannot handle atom ids > 2147483647\n");
|
utils::logmesg(lmp, "colvars: Warning: cannot handle atom ids > 2147483647\n");
|
||||||
#endif
|
#endif
|
||||||
@ -181,7 +180,7 @@ int FixColvars::parse_fix_arguments(int narg, char **arg, bool fix_constructor)
|
|||||||
is_fix_keyword = true;
|
is_fix_keyword = true;
|
||||||
} else if (0 == strcmp(arg[iarg], "tstat")) {
|
} else if (0 == strcmp(arg[iarg], "tstat")) {
|
||||||
tfix_name = utils::strdup(arg[iarg+1]);
|
tfix_name = utils::strdup(arg[iarg+1]);
|
||||||
if (me == 0) set_thermostat_temperature();
|
if (comm->me == 0) set_thermostat_temperature();
|
||||||
is_fix_keyword = true;
|
is_fix_keyword = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,6 +262,7 @@ int FixColvars::setmask()
|
|||||||
|
|
||||||
void FixColvars::init()
|
void FixColvars::init()
|
||||||
{
|
{
|
||||||
|
const auto me = comm->me;
|
||||||
if (atom->tag_enable == 0)
|
if (atom->tag_enable == 0)
|
||||||
error->all(FLERR, "Cannot use fix colvars without atom IDs");
|
error->all(FLERR, "Cannot use fix colvars without atom IDs");
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ void FixColvars::init()
|
|||||||
|
|
||||||
void FixColvars::set_thermostat_temperature()
|
void FixColvars::set_thermostat_temperature()
|
||||||
{
|
{
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
if (tfix_name) {
|
if (tfix_name) {
|
||||||
if (strcmp(tfix_name, "NULL") != 0) {
|
if (strcmp(tfix_name, "NULL") != 0) {
|
||||||
Fix *tstat_fix = modify->get_fix_by_id(tfix_name);
|
Fix *tstat_fix = modify->get_fix_by_id(tfix_name);
|
||||||
@ -319,6 +319,7 @@ void FixColvars::set_thermostat_temperature()
|
|||||||
void FixColvars::init_taglist()
|
void FixColvars::init_taglist()
|
||||||
{
|
{
|
||||||
int new_taglist_size = -1;
|
int new_taglist_size = -1;
|
||||||
|
const auto me = comm->me;
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
|
|
||||||
@ -389,7 +390,7 @@ int FixColvars::modify_param(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Any unknown arguments will go through the Colvars scripting interface
|
// Any unknown arguments will go through the Colvars scripting interface
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
int error_code = COLVARSCRIPT_OK;
|
int error_code = COLVARSCRIPT_OK;
|
||||||
colvarscript *script = proxy->script;
|
colvarscript *script = proxy->script;
|
||||||
script->set_cmdline_main_cmd("fix_modify " + std::string(id));
|
script->set_cmdline_main_cmd("fix_modify " + std::string(id));
|
||||||
@ -437,7 +438,7 @@ int FixColvars::modify_param(int narg, char **arg)
|
|||||||
|
|
||||||
void FixColvars::setup_io()
|
void FixColvars::setup_io()
|
||||||
{
|
{
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
proxy->set_input_prefix(std::string(inp_name ? inp_name : ""));
|
proxy->set_input_prefix(std::string(inp_name ? inp_name : ""));
|
||||||
if (proxy->input_prefix().size() > 0) {
|
if (proxy->input_prefix().size() > 0) {
|
||||||
proxy->log("Will read input state from file \""+
|
proxy->log("Will read input state from file \""+
|
||||||
@ -469,7 +470,8 @@ void FixColvars::setup(int vflag)
|
|||||||
const tagint * const tag = atom->tag;
|
const tagint * const tag = atom->tag;
|
||||||
const int * const type = atom->type;
|
const int * const type = atom->type;
|
||||||
int i,nme,tmp,ndata;
|
int i,nme,tmp,ndata;
|
||||||
int nlocal = atom->nlocal;
|
const auto nlocal = atom->nlocal;
|
||||||
|
const auto me = comm->me;
|
||||||
|
|
||||||
MPI_Status status;
|
MPI_Status status;
|
||||||
MPI_Request request;
|
MPI_Request request;
|
||||||
@ -636,6 +638,8 @@ void FixColvars::setup(int vflag)
|
|||||||
* Send coodinates and add colvar forces to atoms. */
|
* Send coodinates and add colvar forces to atoms. */
|
||||||
void FixColvars::post_force(int /*vflag*/)
|
void FixColvars::post_force(int /*vflag*/)
|
||||||
{
|
{
|
||||||
|
const auto me = comm->me;
|
||||||
|
|
||||||
// some housekeeping: update status of the proxy as needed.
|
// some housekeeping: update status of the proxy as needed.
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
if (proxy->want_exit())
|
if (proxy->want_exit())
|
||||||
@ -825,7 +829,7 @@ void FixColvars::end_of_step()
|
|||||||
MPI_Request request;
|
MPI_Request request;
|
||||||
int tmp, ndata;
|
int tmp, ndata;
|
||||||
|
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
|
|
||||||
// store old force data
|
// store old force data
|
||||||
std::vector<cvm::rvector> &of = *(proxy->modify_atom_total_forces());
|
std::vector<cvm::rvector> &of = *(proxy->modify_atom_total_forces());
|
||||||
@ -886,7 +890,7 @@ void FixColvars::end_of_step()
|
|||||||
|
|
||||||
void FixColvars::write_restart(FILE *fp)
|
void FixColvars::write_restart(FILE *fp)
|
||||||
{
|
{
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
cvm::memory_stream ms;
|
cvm::memory_stream ms;
|
||||||
if (proxy->colvars->write_state(ms)) {
|
if (proxy->colvars->write_state(ms)) {
|
||||||
int len_cv_state = ms.length();
|
int len_cv_state = ms.length();
|
||||||
@ -905,7 +909,7 @@ void FixColvars::write_restart(FILE *fp)
|
|||||||
|
|
||||||
void FixColvars::restart(char *buf)
|
void FixColvars::restart(char *buf)
|
||||||
{
|
{
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
// Read the buffer's length, then load it into Colvars starting right past that location
|
// Read the buffer's length, then load it into Colvars starting right past that location
|
||||||
int length = *(reinterpret_cast<int *>(buf));
|
int length = *(reinterpret_cast<int *>(buf));
|
||||||
unsigned char *colvars_state_buffer = reinterpret_cast<unsigned char *>(buf + sizeof(int));
|
unsigned char *colvars_state_buffer = reinterpret_cast<unsigned char *>(buf + sizeof(int));
|
||||||
@ -919,7 +923,7 @@ void FixColvars::restart(char *buf)
|
|||||||
|
|
||||||
void FixColvars::post_run()
|
void FixColvars::post_run()
|
||||||
{
|
{
|
||||||
if (me == 0) {
|
if (comm->me == 0) {
|
||||||
proxy->post_run();
|
proxy->post_run();
|
||||||
if (lmp->citeme) {
|
if (lmp->citeme) {
|
||||||
lmp->citeme->add(proxy->colvars->feature_report(1));
|
lmp->citeme->add(proxy->colvars->feature_report(1));
|
||||||
|
|||||||
@ -38,7 +38,7 @@ FixStyle(colvars,FixColvars);
|
|||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
namespace IntHash_NS {
|
namespace IntHash_NS {
|
||||||
class inthash_t;
|
class inthash_t;
|
||||||
}
|
}
|
||||||
class colvarproxy_lammps;
|
class colvarproxy_lammps;
|
||||||
|
|
||||||
@ -76,7 +76,6 @@ class FixColvars : public Fix {
|
|||||||
double t_target = 0.0; // thermostat target temperature
|
double t_target = 0.0; // thermostat target temperature
|
||||||
double energy; // biasing energy of the fix
|
double energy; // biasing energy of the fix
|
||||||
|
|
||||||
int me; // my MPI rank in this "world".
|
|
||||||
int num_coords; // total number of atoms controlled by this fix
|
int num_coords; // total number of atoms controlled by this fix
|
||||||
tagint *taglist; // list of all atom IDs referenced by colvars.
|
tagint *taglist; // list of all atom IDs referenced by colvars.
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ class FixColvars : public Fix {
|
|||||||
/// Arguments passed from fix_modify to the Colvars script interface
|
/// Arguments passed from fix_modify to the Colvars script interface
|
||||||
unsigned char *script_args[100];
|
unsigned char *script_args[100];
|
||||||
|
|
||||||
IntHash_NS::inthash_t *idmap; // hash for mapping atom indices to consistent order.
|
IntHash_NS::inthash_t *idmap; // hash for mapping atom indices to consistent order.
|
||||||
|
|
||||||
int nlevels_respa; // flag to determine respa levels.
|
int nlevels_respa; // flag to determine respa levels.
|
||||||
int store_forces; // flag to determine whether to store total forces
|
int store_forces; // flag to determine whether to store total forces
|
||||||
@ -98,7 +97,7 @@ class FixColvars : public Fix {
|
|||||||
// only supports one instance at a time
|
// only supports one instance at a time
|
||||||
MPI_Comm root2root; // inter-root communicator for multi-replica support
|
MPI_Comm root2root; // inter-root communicator for multi-replica support
|
||||||
|
|
||||||
void init_taglist(); // initialize list of atom tags and hash table
|
void init_taglist(); // initialize list of atom tags and hash table
|
||||||
|
|
||||||
/// Share with Colvars the thermostat fix named by tfix_name
|
/// Share with Colvars the thermostat fix named by tfix_name
|
||||||
void set_thermostat_temperature();
|
void set_thermostat_temperature();
|
||||||
|
|||||||
Reference in New Issue
Block a user