Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 31, 2024
1 parent 605fb9b commit 2cc6d8a
Show file tree
Hide file tree
Showing 10 changed files with 505 additions and 490 deletions.
16 changes: 8 additions & 8 deletions source/api_c/src/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ inline void DP_DeepPotCompute_variant_sp(DP_DeepPot* dp,
std::vector<double> e;
std::vector<VALUETYPE> f, fm, v, ae, av;

DP_REQUIRES_OK(dp, dp->dp.compute_spin(e, f, fm, v, ae, av, coord_, spin_, atype_,
cell_, fparam_, aparam_));
DP_REQUIRES_OK(dp, dp->dp.compute_spin(e, f, fm, v, ae, av, coord_, spin_,
atype_, cell_, fparam_, aparam_));
// copy from C++ vectors to C arrays, if not NULL pointer
if (energy) {
std::copy(e.begin(), e.end(), energy);
Expand Down Expand Up @@ -487,7 +487,7 @@ inline void DP_DeepPotComputeNList_variant_sp(DP_DeepPot* dp,
std::vector<VALUETYPE> f, fm, v, ae, av;
DP_REQUIRES_OK(
dp, dp->dp.compute_spin(e, f, fm, v, ae, av, coord_, spin_, atype_, cell_,
nghost, nlist->nl, ago, fparam_, aparam_));
nghost, nlist->nl, ago, fparam_, aparam_));
// copy from C++ vectors to C arrays, if not NULL pointer
if (energy) {
std::copy(e.begin(), e.end(), energy);
Expand Down Expand Up @@ -893,13 +893,13 @@ void DP_DeepPotModelDeviComputeNList_variant_sp(DP_DeepPotModelDevi* dp,
std::vector<double> e;
std::vector<std::vector<VALUETYPE>> f, fm, v, ae, av;
if (atomic_energy || atomic_virial) {
DP_REQUIRES_OK(
dp, dp->dp.compute_spin(e, f, fm, v, ae, av, coord_, spin_, atype_, cell_,
nghost, nlist->nl, ago, fparam_, aparam_));
DP_REQUIRES_OK(dp, dp->dp.compute_spin(e, f, fm, v, ae, av, coord_, spin_,
atype_, cell_, nghost, nlist->nl,
ago, fparam_, aparam_));
} else {
DP_REQUIRES_OK(
dp, dp->dp.compute_spin(e, f, fm, v, coord_, spin_, atype_, cell_, nghost,
nlist->nl, ago, fparam_, aparam_));
dp, dp->dp.compute_spin(e, f, fm, v, coord_, spin_, atype_, cell_,
nghost, nlist->nl, ago, fparam_, aparam_));
}
// 2D vector to 2D array, flatten first
if (energy) {
Expand Down
266 changes: 138 additions & 128 deletions source/api_cc/include/DeepPot.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,27 +459,29 @@ class DeepPot {
* @{
**/
template <typename VALUETYPE>
void compute_spin(ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
template <typename VALUETYPE>
void compute_spin(std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
/** @} */

/**
Expand Down Expand Up @@ -558,33 +560,35 @@ class DeepPot {
* @{
**/
template <typename VALUETYPE>
void compute_spin(ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& inlist,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& inlist,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
template <typename VALUETYPE>
void compute_spin(std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& inlist,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& inlist,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
/** @} */
/**
* @brief Evaluate the energy, force, virial, atomic energy, and atomic virial
Expand Down Expand Up @@ -660,31 +664,33 @@ class DeepPot {
* @{
**/
template <typename VALUETYPE>
void compute_spin(ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
template <typename VALUETYPE>
void compute_spin(std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
/** @} */

/**
Expand Down Expand Up @@ -773,37 +779,39 @@ class DeepPot {
* @{
**/
template <typename VALUETYPE>
void compute_spin(ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
ENERGYTYPE& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
template <typename VALUETYPE>
void compute_spin(std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
std::vector<ENERGYTYPE>& ener,
std::vector<VALUETYPE>& force,
std::vector<VALUETYPE>& force_mag,
std::vector<VALUETYPE>& virial,
std::vector<VALUETYPE>& atom_energy,
std::vector<VALUETYPE>& atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
/** @} */
/**
* @brief Evaluate the energy, force, and virial with the mixed type
Expand Down Expand Up @@ -1105,19 +1113,20 @@ class DeepPotModelDevi {
*same aparam.
**/
template <typename VALUETYPE>
void compute_spin(std::vector<ENERGYTYPE>& all_ener,
std::vector<std::vector<VALUETYPE> >& all_force,
std::vector<std::vector<VALUETYPE> >& all_force_mag,
std::vector<std::vector<VALUETYPE> >& all_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
std::vector<ENERGYTYPE>& all_ener,
std::vector<std::vector<VALUETYPE> >& all_force,
std::vector<std::vector<VALUETYPE> >& all_force_mag,
std::vector<std::vector<VALUETYPE> >& all_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
/**
* @brief Evaluate the energy, force, virial, atomic energy, and atomic virial
*by using these DP models.
Expand Down Expand Up @@ -1189,21 +1198,22 @@ class DeepPotModelDevi {
*same aparam.
**/
template <typename VALUETYPE>
void compute_spin(std::vector<ENERGYTYPE>& all_ener,
std::vector<std::vector<VALUETYPE> >& all_force,
std::vector<std::vector<VALUETYPE> >& all_force_mag,
std::vector<std::vector<VALUETYPE> >& all_virial,
std::vector<std::vector<VALUETYPE> >& all_atom_energy,
std::vector<std::vector<VALUETYPE> >& all_atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
void compute_spin(
std::vector<ENERGYTYPE>& all_ener,
std::vector<std::vector<VALUETYPE> >& all_force,
std::vector<std::vector<VALUETYPE> >& all_force_mag,
std::vector<std::vector<VALUETYPE> >& all_virial,
std::vector<std::vector<VALUETYPE> >& all_atom_energy,
std::vector<std::vector<VALUETYPE> >& all_atom_virial,
const std::vector<VALUETYPE>& coord,
const std::vector<VALUETYPE>& spin,
const std::vector<int>& atype,
const std::vector<VALUETYPE>& box,
const int nghost,
const InputNlist& lmp_list,
const int& ago,
const std::vector<VALUETYPE>& fparam = std::vector<VALUETYPE>(),
const std::vector<VALUETYPE>& aparam = std::vector<VALUETYPE>());
/**
* @brief Get the cutoff radius.
* @return The cutoff radius.
Expand Down
Loading

0 comments on commit 2cc6d8a

Please sign in to comment.