Small cleanup
This commit is contained in:
@ -320,6 +320,8 @@ action pair_multi_lucy_rx_kokkos.cpp pair_multi_lucy_rx.cpp
|
|||||||
action pair_multi_lucy_rx_kokkos.h pair_multi_lucy_rx.h
|
action pair_multi_lucy_rx_kokkos.h pair_multi_lucy_rx.h
|
||||||
action pair_pace_kokkos.cpp pair_pace.cpp
|
action pair_pace_kokkos.cpp pair_pace.cpp
|
||||||
action pair_pace_kokkos.h pair_pace.h
|
action pair_pace_kokkos.h pair_pace.h
|
||||||
|
action pair_pace_extrapolation_kokkos.cpp pair_pace_extrapolation.cpp
|
||||||
|
action pair_pace_extrapolation_kokkos.h pair_pace_extrapolation.h
|
||||||
action pair_reaxff_kokkos.cpp pair_reaxff.cpp
|
action pair_reaxff_kokkos.cpp pair_reaxff.cpp
|
||||||
action pair_reaxff_kokkos.h pair_reaxff.h
|
action pair_reaxff_kokkos.h pair_reaxff.h
|
||||||
action pair_snap_kokkos.cpp pair_snap.cpp
|
action pair_snap_kokkos.cpp pair_snap.cpp
|
||||||
|
|||||||
@ -41,8 +41,7 @@ namespace LAMMPS_NS {
|
|||||||
struct ACEALImpl {
|
struct ACEALImpl {
|
||||||
ACEALImpl() : basis_set(nullptr), ace(nullptr) {}
|
ACEALImpl() : basis_set(nullptr), ace(nullptr) {}
|
||||||
|
|
||||||
~ACEALImpl()
|
~ACEALImpl() {
|
||||||
{
|
|
||||||
delete basis_set;
|
delete basis_set;
|
||||||
delete ace;
|
delete ace;
|
||||||
}
|
}
|
||||||
@ -187,7 +186,7 @@ void PairPACEExtrapolationKokkos<DeviceType>::copy_pertype()
|
|||||||
h_rho_core_cutoff[n] = basis_set->map_embedding_specifications.at(n).rho_core_cutoff;
|
h_rho_core_cutoff[n] = basis_set->map_embedding_specifications.at(n).rho_core_cutoff;
|
||||||
h_drho_core_cutoff[n] = basis_set->map_embedding_specifications.at(n).drho_core_cutoff;
|
h_drho_core_cutoff[n] = basis_set->map_embedding_specifications.at(n).drho_core_cutoff;
|
||||||
|
|
||||||
h_E0vals(n)= basis_set->E0vals(n);
|
h_E0vals(n) = basis_set->E0vals(n);
|
||||||
|
|
||||||
h_ndensity(n) = basis_set->map_embedding_specifications.at(n).ndensity;
|
h_ndensity(n) = basis_set->map_embedding_specifications.at(n).ndensity;
|
||||||
|
|
||||||
@ -321,8 +320,6 @@ void PairPACEExtrapolationKokkos<DeviceType>::copy_tilde()
|
|||||||
t_ace_3d d_ASI_temp;
|
t_ace_3d d_ASI_temp;
|
||||||
MemKK::realloc_kokkos(d_ASI_temp, "pace:ASI_temp", nelements, total_num_functions_max, total_num_functions_max);
|
MemKK::realloc_kokkos(d_ASI_temp, "pace:ASI_temp", nelements, total_num_functions_max, total_num_functions_max);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
auto h_rank = Kokkos::create_mirror_view(d_rank);
|
auto h_rank = Kokkos::create_mirror_view(d_rank);
|
||||||
auto h_num_ms_combs = Kokkos::create_mirror_view(d_num_ms_combs);
|
auto h_num_ms_combs = Kokkos::create_mirror_view(d_num_ms_combs);
|
||||||
auto h_func_inds = Kokkos::create_mirror_view(d_func_inds);
|
auto h_func_inds = Kokkos::create_mirror_view(d_func_inds);
|
||||||
@ -332,7 +329,7 @@ void PairPACEExtrapolationKokkos<DeviceType>::copy_tilde()
|
|||||||
auto h_ms_combs = Kokkos::create_mirror_view(d_ms_combs);
|
auto h_ms_combs = Kokkos::create_mirror_view(d_ms_combs);
|
||||||
auto h_gen_cgs = Kokkos::create_mirror_view(d_gen_cgs);
|
auto h_gen_cgs = Kokkos::create_mirror_view(d_gen_cgs);
|
||||||
auto h_coeffs = Kokkos::create_mirror_view(d_coeffs);
|
auto h_coeffs = Kokkos::create_mirror_view(d_coeffs);
|
||||||
// asi
|
// asi
|
||||||
auto h_ASI = Kokkos::create_mirror_view(d_ASI_temp);
|
auto h_ASI = Kokkos::create_mirror_view(d_ASI_temp);
|
||||||
|
|
||||||
// copy values on host
|
// copy values on host
|
||||||
@ -400,11 +397,10 @@ void PairPACEExtrapolationKokkos<DeviceType>::copy_tilde()
|
|||||||
|
|
||||||
// ASI
|
// ASI
|
||||||
const auto &A_as_inv = b_evaluator->A_active_set_inv.at(mu);
|
const auto &A_as_inv = b_evaluator->A_active_set_inv.at(mu);
|
||||||
for(int i = 0; i < total_basis_size_rank1 + total_basis_size; i++)
|
for (int i = 0; i < total_basis_size_rank1 + total_basis_size; i++)
|
||||||
for(int j = 0; j < total_basis_size_rank1 + total_basis_size; j++){
|
for (int j = 0; j < total_basis_size_rank1 + total_basis_size; j++){
|
||||||
h_ASI(mu,i,j)=A_as_inv(j,i); // transpose back for better performance on GPU
|
h_ASI(mu,i,j) = A_as_inv(j,i); // transpose back for better performance on GPU
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Kokkos::deep_copy(d_rank, h_rank);
|
Kokkos::deep_copy(d_rank, h_rank);
|
||||||
@ -565,6 +561,7 @@ void PairPACEExtrapolationKokkos<DeviceType>::compute(int eflag_in, int vflag_in
|
|||||||
ev_init(eflag,vflag,0);
|
ev_init(eflag,vflag,0);
|
||||||
|
|
||||||
// reallocate per-atom arrays if necessary
|
// reallocate per-atom arrays if necessary
|
||||||
|
|
||||||
if (eflag_atom) {
|
if (eflag_atom) {
|
||||||
memoryKK->destroy_kokkos(k_eatom,eatom);
|
memoryKK->destroy_kokkos(k_eatom,eatom);
|
||||||
memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom");
|
memoryKK->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom");
|
||||||
@ -742,7 +739,7 @@ void PairPACEExtrapolationKokkos<DeviceType>::compute(int eflag_in, int vflag_in
|
|||||||
ev += ev_tmp;
|
ev += ev_tmp;
|
||||||
|
|
||||||
//if gamma_flag - copy current d_gamma to extrapolation_grade_gamma
|
//if gamma_flag - copy current d_gamma to extrapolation_grade_gamma
|
||||||
if(gamma_flag){
|
if (gamma_flag){
|
||||||
h_gamma = Kokkos::create_mirror_view(d_gamma);
|
h_gamma = Kokkos::create_mirror_view(d_gamma);
|
||||||
Kokkos:deep_copy(h_gamma, d_gamma);
|
Kokkos:deep_copy(h_gamma, d_gamma);
|
||||||
memcpy(extrapolation_grade_gamma+chunk_offset, (void *) h_gamma.data(), sizeof(double)*chunk_size);
|
memcpy(extrapolation_grade_gamma+chunk_offset, (void *) h_gamma.data(), sizeof(double)*chunk_size);
|
||||||
@ -1001,7 +998,7 @@ void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeRho,
|
|||||||
|
|
||||||
|
|
||||||
//gamma_i
|
//gamma_i
|
||||||
if(gamma_flag)
|
if (gamma_flag)
|
||||||
Kokkos::atomic_add(&projections(ii, func_ind), d_gen_cgs(mu_i, idx_ms_comb) * A_cur);
|
Kokkos::atomic_add(&projections(ii, func_ind), d_gen_cgs(mu_i, idx_ms_comb) * A_cur);
|
||||||
|
|
||||||
} else { // rank > 1
|
} else { // rank > 1
|
||||||
@ -1040,14 +1037,13 @@ void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeRho,
|
|||||||
Kokkos::atomic_add(&rhos(ii, p), B.real_part_product(d_coeffs(mu_i, func_ind, p) * d_gen_cgs(mu_i, idx_ms_comb)));
|
Kokkos::atomic_add(&rhos(ii, p), B.real_part_product(d_coeffs(mu_i, func_ind, p) * d_gen_cgs(mu_i, idx_ms_comb)));
|
||||||
}
|
}
|
||||||
//gamma_i
|
//gamma_i
|
||||||
if(gamma_flag)
|
if (gamma_flag)
|
||||||
Kokkos::atomic_add(&projections(ii, func_ind), B.real_part_product(d_gen_cgs(mu_i, idx_ms_comb)));
|
Kokkos::atomic_add(&projections(ii, func_ind), B.real_part_product(d_gen_cgs(mu_i, idx_ms_comb)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeFS, const int& ii) const
|
void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeFS, const int& ii) const
|
||||||
@ -1079,10 +1075,8 @@ void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeFS,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeGamma, const int& ii) const
|
void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeGamma, const int& ii) const
|
||||||
@ -1091,10 +1085,9 @@ void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeGamm
|
|||||||
const int mu_i = d_map(type(i));
|
const int mu_i = d_map(type(i));
|
||||||
const int basis_size = d_total_basis_size(mu_i);
|
const int basis_size = d_total_basis_size(mu_i);
|
||||||
|
|
||||||
|
|
||||||
double gamma_max = 0;
|
double gamma_max = 0;
|
||||||
double current_gamma;
|
double current_gamma;
|
||||||
for (int j = 0; j <basis_size; j++) { //
|
for (int j = 0; j <basis_size; j++) {
|
||||||
current_gamma = 0;
|
current_gamma = 0;
|
||||||
|
|
||||||
// compute row-matrix-multiplication asi_vector * A_as_inv (transposed matrix)
|
// compute row-matrix-multiplication asi_vector * A_as_inv (transposed matrix)
|
||||||
@ -1108,8 +1101,8 @@ void PairPACEExtrapolationKokkos<DeviceType>::operator() (TagPairPACEComputeGamm
|
|||||||
|
|
||||||
// tally energy contribution
|
// tally energy contribution
|
||||||
d_gamma(ii) = gamma_max;
|
d_gamma(ii) = gamma_max;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
@ -1824,19 +1817,10 @@ double PairPACEExtrapolationKokkos<DeviceType>::memory_usage()
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
|
||||||
template class PairPACEExtrapolationKokkos<LMPDeviceType>;
|
|
||||||
#ifdef LMP_KOKKOS_GPU
|
|
||||||
template class PairPACEExtrapolationKokkos<LMPHostType>;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
extract method for extracting value of scale variable
|
extract method for extracting value of scale variable
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
void *PairPACEExtrapolationKokkos<DeviceType>::extract(const char *str, int &dim)
|
void *PairPACEExtrapolationKokkos<DeviceType>::extract(const char *str, int &dim)
|
||||||
{
|
{
|
||||||
@ -1857,6 +1841,7 @@ void *PairPACEExtrapolationKokkos<DeviceType>::extract(const char *str, int &dim
|
|||||||
1 or more = # of columns in per-atom array
|
1 or more = # of columns in per-atom array
|
||||||
return NULL if str is not recognized
|
return NULL if str is not recognized
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
void *PairPACEExtrapolationKokkos<DeviceType>::extract_peratom(const char *str, int &ncol)
|
void *PairPACEExtrapolationKokkos<DeviceType>::extract_peratom(const char *str, int &ncol)
|
||||||
{
|
{
|
||||||
@ -1867,3 +1852,13 @@ void *PairPACEExtrapolationKokkos<DeviceType>::extract_peratom(const char *str,
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
template class PairPACEExtrapolationKokkos<LMPDeviceType>;
|
||||||
|
#ifdef LMP_KOKKOS_GPU
|
||||||
|
template class PairPACEExtrapolationKokkos<LMPHostType>;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -135,16 +135,12 @@ void PairPACEExtrapolation::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double **f = atom->f;
|
double **f = atom->f;
|
||||||
// tagint *tag = atom->tag;
|
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
// number of atoms in cell
|
// number of atoms in cell
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
int newton_pair = force->newton_pair;
|
int newton_pair = force->newton_pair;
|
||||||
|
|
||||||
// number of atoms including ghost atoms
|
|
||||||
// int nall = nlocal + atom->nghost;
|
|
||||||
|
|
||||||
// inum: length of the neighborlists list
|
// inum: length of the neighborlists list
|
||||||
inum = list->inum;
|
inum = list->inum;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user