update neighbor list requests and compute style lookups in machine learning packages
This commit is contained in:
@ -26,7 +26,6 @@
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
#include "update.h"
|
||||
|
||||
@ -226,9 +225,7 @@ void PairHDNNP::coeff(int narg, char **arg)
|
||||
|
||||
void PairHDNNP::init_style()
|
||||
{
|
||||
int irequest = neighbor->request((void *) this);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
|
||||
// Return immediately if HDNNP setup is already completed.
|
||||
if (interface->isInitialized()) return;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
Contributing author: Aidan Thompson (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <cstring>
|
||||
#include "compute_mliap.h"
|
||||
|
||||
#include "mliap_data.h"
|
||||
#include "mliap_model_linear.h"
|
||||
@ -26,17 +26,17 @@
|
||||
#include "mliap_model_python.h"
|
||||
#endif
|
||||
|
||||
#include "compute_mliap.h"
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "update.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -151,17 +151,9 @@ void ComputeMLIAP::init()
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"mliap") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
if (modify->get_compute_by_style("mliap").size() > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute mliap");
|
||||
|
||||
// initialize model and descriptor
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
@ -314,9 +313,7 @@ void PairMLIAP::init_style()
|
||||
|
||||
// need a full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -35,7 +35,6 @@ Copyright 2021 Yury Lysogorskiy^1, Cas van der Oord^2, Anton Bochkarev^1,
|
||||
#include "math_const.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
#include "update.h"
|
||||
|
||||
@ -354,9 +353,7 @@ void PairPACE::init_style()
|
||||
if (force->newton_pair == 0) error->all(FLERR, "Pair style pACE requires newton pair on");
|
||||
|
||||
// request a full neighbor list
|
||||
int irequest = neighbor->request(this, instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
#include "potential_file_reader.h"
|
||||
#include "update.h"
|
||||
@ -308,10 +307,8 @@ void PairQUIP::init_style()
|
||||
|
||||
if (force->newton_pair != 1) error->all(FLERR, "Pair style quip requires newton pair on");
|
||||
|
||||
// Initialise neighbor list
|
||||
int irequest_full = neighbor->request(this);
|
||||
neighbor->requests[irequest_full]->half = 0;
|
||||
neighbor->requests[irequest_full]->full = 1;
|
||||
// request full neighbor list
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -38,7 +38,6 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918
|
||||
#include "memory.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "tokenizer.h"
|
||||
#include "update.h"
|
||||
|
||||
@ -1253,10 +1252,7 @@ void PairRANN::init_list(int /*which*/, NeighList *ptr)
|
||||
|
||||
void PairRANN::init_style()
|
||||
{
|
||||
int irequest_full = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest_full]->id = 1;
|
||||
neighbor->requests[irequest_full]->half = 0;
|
||||
neighbor->requests[irequest_full]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
}
|
||||
|
||||
|
||||
@ -1274,34 +1270,34 @@ void PairRANN::errorf(const char *file, int line, const char * message) {
|
||||
}
|
||||
|
||||
int PairRANN::factorial(int n) {
|
||||
return round(MathSpecial::factorial(n));
|
||||
return round(MathSpecial::factorial(n));
|
||||
}
|
||||
|
||||
RANN::Fingerprint *PairRANN::create_fingerprint(const char *style)
|
||||
{
|
||||
if (strcmp(style,"radial")==0) {
|
||||
return new RANN::Fingerprint_radial(this);
|
||||
return new RANN::Fingerprint_radial(this);
|
||||
}
|
||||
else if (strcmp(style,"radialscreened")==0) {
|
||||
return new RANN::Fingerprint_radialscreened(this);
|
||||
return new RANN::Fingerprint_radialscreened(this);
|
||||
}
|
||||
else if (strcmp(style,"radialscreenedspin")==0) {
|
||||
return new RANN::Fingerprint_radialscreenedspin(this);
|
||||
return new RANN::Fingerprint_radialscreenedspin(this);
|
||||
}
|
||||
else if (strcmp(style,"radialspin")==0) {
|
||||
return new RANN::Fingerprint_radialspin(this);
|
||||
return new RANN::Fingerprint_radialspin(this);
|
||||
}
|
||||
else if (strcmp(style,"bond")==0) {
|
||||
return new RANN::Fingerprint_bond(this);
|
||||
return new RANN::Fingerprint_bond(this);
|
||||
}
|
||||
else if (strcmp(style,"bondscreened")==0) {
|
||||
return new RANN::Fingerprint_bondscreened(this);
|
||||
return new RANN::Fingerprint_bondscreened(this);
|
||||
}
|
||||
else if (strcmp(style,"bondscreenedspin")==0) {
|
||||
return new RANN::Fingerprint_bondscreenedspin(this);
|
||||
return new RANN::Fingerprint_bondscreenedspin(this);
|
||||
}
|
||||
else if (strcmp(style,"bondspin")==0) {
|
||||
return new RANN::Fingerprint_bondspin(this);
|
||||
return new RANN::Fingerprint_bondspin(this);
|
||||
}
|
||||
error->one(FLERR,"Unknown fingerprint style {}",style);
|
||||
return nullptr;
|
||||
@ -1311,10 +1307,10 @@ RANN::Fingerprint *PairRANN::create_fingerprint(const char *style)
|
||||
RANN::Activation *PairRANN::create_activation(const char *style)
|
||||
{
|
||||
if (strcmp(style,"linear")==0) {
|
||||
return new RANN::Activation_linear(this);
|
||||
return new RANN::Activation_linear(this);
|
||||
}
|
||||
else if (strcmp(style,"sigI")==0) {
|
||||
return new RANN::Activation_sigI(this);
|
||||
return new RANN::Activation_sigI(this);
|
||||
}
|
||||
error->one(FLERR,"Unknown activation style {}",style);
|
||||
return nullptr;
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_sna_atom.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "sna.h"
|
||||
#include "atom.h"
|
||||
@ -21,13 +20,14 @@
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
@ -172,17 +172,9 @@ void ComputeSNAAtom::init()
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"sna/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
if (modify->get_compute_by_style("sna/atom").size() > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute sna/atom");
|
||||
snaptr->init();
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_snad_atom.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "sna.h"
|
||||
#include "atom.h"
|
||||
@ -21,13 +20,14 @@
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
@ -174,17 +174,9 @@ void ComputeSNADAtom::init()
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"snad/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
if (modify->get_compute_by_style("snad/atom").size() > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute snad/atom");
|
||||
snaptr->init();
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_snap.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "sna.h"
|
||||
#include "atom.h"
|
||||
@ -21,13 +20,14 @@
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "pair.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{SCALAR,VECTOR,ARRAY};
|
||||
@ -197,17 +197,9 @@ void ComputeSnap::init()
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"snap") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
if (modify->get_compute_by_style("snap").size() > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute snap");
|
||||
snaptr->init();
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "compute_snav_atom.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "sna.h"
|
||||
#include "atom.h"
|
||||
@ -21,12 +20,13 @@
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
@ -170,17 +170,9 @@ void ComputeSNAVAtom::init()
|
||||
|
||||
// need an occasional full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->occasional = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (strcmp(modify->compute[i]->style,"snav/atom") == 0) count++;
|
||||
if (count > 1 && comm->me == 0)
|
||||
if (modify->get_compute_by_style("snav/atom").size() > 1 && comm->me == 0)
|
||||
error->warning(FLERR,"More than one compute snav/atom");
|
||||
snaptr->init();
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "force.h"
|
||||
#include "memory.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
#include "sna.h"
|
||||
#include "tokenizer.h"
|
||||
@ -435,9 +434,7 @@ void PairSNAP::init_style()
|
||||
|
||||
// need a full neighbor list
|
||||
|
||||
int irequest = neighbor->request(this,instance_me);
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->add_request(this, NeighConst::REQ_FULL);
|
||||
|
||||
snaptr->init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user