Skip to content

Commit

Permalink
rename classes and files (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
anjohan committed Oct 21, 2024
1 parent fd2d39d commit 23cc455
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions compute_allegro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ComputeAllegro<peratom>::ComputeAllegro(LAMMPS *lmp, int narg, char **arg) : Com
error->all(FLERR, "no pair style; compute allegro must be defined after pair style");
}

((PairAllegro<0> *) force->pair)->add_custom_output(quantity);
((PairNequIPAllegro<0> *) force->pair)->add_custom_output(quantity);
}

template<int peratom>
Expand Down Expand Up @@ -109,7 +109,7 @@ void ComputeAllegro<peratom>::compute_vector()
}
} else {
const torch::Tensor &quantity_tensor =
((PairAllegro<0> *) force->pair)->custom_output.at(quantity).cpu().ravel();
((PairNequIPAllegro<0> *) force->pair)->custom_output.at(quantity).cpu().ravel();

auto quantity = quantity_tensor.data_ptr<double>();

Expand Down Expand Up @@ -140,7 +140,7 @@ void ComputeAllegro<peratom>::compute_peratom()
// guard against empty domain (pair style won't store tensor)
if (atom->nlocal > 0) {
const torch::Tensor &quantity_tensor =
((PairAllegro<0> *) force->pair)->custom_output.at(quantity).cpu().contiguous().reshape({-1,nperatom});
((PairNequIPAllegro<0> *) force->pair)->custom_output.at(quantity).cpu().contiguous().reshape({-1,nperatom});

auto quantity = quantity_tensor.accessor<double,2>();
quantityptr = quantity_tensor.data_ptr<double>();
Expand Down
2 changes: 1 addition & 1 deletion pair_allegro_kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace Kokkos {
/* ---------------------------------------------------------------------- */

template<int nequip_mode>
PairAllegroKokkos<nequip_mode>::PairAllegroKokkos(LAMMPS *lmp) : PairAllegro<nequip_mode>(lmp)
PairAllegroKokkos<nequip_mode>::PairAllegroKokkos(LAMMPS *lmp) : PairNequIPAllegro<nequip_mode>(lmp)
{
this->respa_enable = 0;

Expand Down
4 changes: 2 additions & 2 deletions pair_allegro_kokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ PairStyle(allegro/kk,PairAllegroKokkos<0>)
namespace LAMMPS_NS {

template<int nequip_mode>
class PairAllegroKokkos : public PairAllegro<nequip_mode> {
class PairAllegroKokkos : public PairNequIPAllegro<nequip_mode> {
public:
typedef PairAllegro<nequip_mode> super;
typedef PairNequIPAllegro<nequip_mode> super;
using DeviceType = LMPDeviceType;
using MemberType = typename Kokkos::TeamPolicy<DeviceType>::member_type;
enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
Expand Down
28 changes: 14 additions & 14 deletions pair_allegro.cpp → pair_nequip_allegro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

using namespace LAMMPS_NS;

template <int nequip_mode> PairAllegro<nequip_mode>::PairAllegro(LAMMPS *lmp) : Pair(lmp)
template <int nequip_mode> PairNequIPAllegro<nequip_mode>::PairNequIPAllegro(LAMMPS *lmp) : Pair(lmp)
{
restartinfo = 0;
manybody_flag = 1;
Expand Down Expand Up @@ -106,7 +106,7 @@ template <int nequip_mode> PairAllegro<nequip_mode>::PairAllegro(LAMMPS *lmp) :
if (debug_mode) std::cout << "Allegro is using device " << device << "\n";
}

template <int nequip_mode> PairAllegro<nequip_mode>::~PairAllegro()
template <int nequip_mode> PairNequIPAllegro<nequip_mode>::~PairNequIPAllegro()
{
if (copymode) return;
if (allocated) {
Expand All @@ -116,7 +116,7 @@ template <int nequip_mode> PairAllegro<nequip_mode>::~PairAllegro()
}
}

template <int nequip_mode> void PairAllegro<nequip_mode>::init_style()
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::init_style()
{
if (atom->tag_enable == 0) error->all(FLERR, "Pair style Allegro requires atom IDs");

Expand All @@ -132,12 +132,12 @@ template <int nequip_mode> void PairAllegro<nequip_mode>::init_style()
if (nequip_mode && force->newton_pair) error->all(FLERR, "Pair style nequip requires newton pair off");
}

template <int nequip_mode> double PairAllegro<nequip_mode>::init_one(int i, int j)
template <int nequip_mode> double PairNequIPAllegro<nequip_mode>::init_one(int i, int j)
{
return cutoff;
}

template <int nequip_mode> void PairAllegro<nequip_mode>::allocate()
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::allocate()
{
allocated = 1;
int n = atom->ntypes;
Expand All @@ -147,13 +147,13 @@ template <int nequip_mode> void PairAllegro<nequip_mode>::allocate()
memory->create(cutoff_matrix, n, n, "pair:cutoff_matrix");
}

template <int nequip_mode> void PairAllegro<nequip_mode>::settings(int narg, char ** /*arg*/)
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::settings(int narg, char ** /*arg*/)
{
// "allegro" should be the only word after "pair_style" in the input file.
if (narg > 0) error->all(FLERR, "Illegal pair_style command, too many arguments");
}

template <int nequip_mode> void PairAllegro<nequip_mode>::coeff(int narg, char **arg)
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::coeff(int narg, char **arg)
{
if (!allocated) allocate();

Expand Down Expand Up @@ -290,7 +290,7 @@ template <int nequip_mode> void PairAllegro<nequip_mode>::coeff(int narg, char *
}

// Force and energy computation
template <int nequip_mode> void PairAllegro<nequip_mode>::compute(int eflag, int vflag)
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::compute(int eflag, int vflag)
{
ev_init(eflag, vflag);

Expand Down Expand Up @@ -368,7 +368,7 @@ template <int nequip_mode> void PairAllegro<nequip_mode>::compute(int eflag, int
}
}

template <int nequip_mode> c10::Dict<std::string, torch::Tensor> PairAllegro<nequip_mode>::preprocess() {
template <int nequip_mode> c10::Dict<std::string, torch::Tensor> PairNequIPAllegro<nequip_mode>::preprocess() {
// Atom positions, including ghost atoms
double **x = atom->x;
// Atom IDs, unique, reproducible, the "real" indices
Expand Down Expand Up @@ -563,7 +563,7 @@ template <int nequip_mode> c10::Dict<std::string, torch::Tensor> PairAllegro<neq
return input;
}

template <int nequip_mode> torch::Tensor PairAllegro<nequip_mode>::get_cell(){
template <int nequip_mode> torch::Tensor PairNequIPAllegro<nequip_mode>::get_cell(){
torch::Tensor cell_tensor = torch::zeros({3,3}, torch::TensorOptions().dtype(inputtorchtype));
auto cell = cell_tensor.accessor<inputtype,2>();

Expand All @@ -579,7 +579,7 @@ template <int nequip_mode> torch::Tensor PairAllegro<nequip_mode>::get_cell(){
return cell_tensor;
}

template <int nequip_mode> void PairAllegro<nequip_mode>::get_tag2i(std::vector<int> &tag2i){
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::get_tag2i(std::vector<int> &tag2i){
int inum = list->inum;
int *ilist = list->ilist;
tagint *tag = atom->tag;
Expand All @@ -592,12 +592,12 @@ template <int nequip_mode> void PairAllegro<nequip_mode>::get_tag2i(std::vector<
}
}

template <int nequip_mode> void PairAllegro<nequip_mode>::add_custom_output(std::string name)
template <int nequip_mode> void PairNequIPAllegro<nequip_mode>::add_custom_output(std::string name)
{
custom_output_names.push_back(name);
}

namespace LAMMPS_NS {
template class PairAllegro<0>;
template class PairAllegro<1>;
template class PairNequIPAllegro<0>;
template class PairNequIPAllegro<1>;
} // namespace LAMMPS_NS
10 changes: 5 additions & 5 deletions pair_allegro.h → pair_nequip_allegro.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#ifdef PAIR_CLASS

PairStyle(nequip,PairAllegro<1>)
PairStyle(allegro,PairAllegro<0>)
PairStyle(nequip,PairNequIPAllegro<1>)
PairStyle(allegro,PairNequIPAllegro<0>)

#else

Expand All @@ -34,10 +34,10 @@ PairStyle(allegro,PairAllegro<0>)
namespace LAMMPS_NS {

template<int nequip_mode>
class PairAllegro : public Pair {
class PairNequIPAllegro : public Pair {
public:
PairAllegro(class LAMMPS *);
virtual ~PairAllegro();
PairNequIPAllegro(class LAMMPS *);
virtual ~PairNequIPAllegro();
virtual void compute(int, int);
void settings(int, char **);
virtual void coeff(int, char **);
Expand Down

0 comments on commit 23cc455

Please sign in to comment.