Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: model devi C/C++ API without nlist #3647

Merged
merged 10 commits into from
Apr 6, 2024
141 changes: 141 additions & 0 deletions source/api_c/include/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,147 @@ extern DP_DeepPotModelDevi* DP_NewDeepPotModelDeviWithParam(
*/
extern void DP_DeleteDeepPotModelDevi(DP_DeepPotModelDevi* dp);

/**
* @brief Evaluate the energy, force and virial by using a DP model deviation
*with neighbor list. (double version)
* @param[in] dp The DP model deviation to use.
* @param[in] natoms The number of atoms.
* @param[in] coord The coordinates of atoms. The array should be of size natoms
*x 3.
* @param[in] atype The atom types. The array should contain natoms ints.
* @param[in] box The cell of the region. The array should be of size 9. Pass
*NULL if pbc is not used.
* @param[out] energy Output energy.
* @param[out] force Output force. The array should be of size natoms x 3.
* @param[out] virial Output virial. The array should be of size 9.
* @param[out] atomic_energy Output atomic energy. The array should be of size
*natoms.
* @param[out] atomic_virial Output atomic virial. The array should be of size
*natoms x 9.
* @warning The output arrays should be allocated before calling this function.
*Pass NULL if not required.
**/
extern void DP_DeepPotModelDeviCompute(DP_DeepPotModelDevi* dp,
const int natom,
const double* coord,
const int* atype,
const double* cell,
double* energy,
double* force,
double* virial,
double* atomic_energy,
double* atomic_virial);

/**
* @brief Evaluate the energy, force and virial by using a DP model deviation
*with neighbor list. (float version)
* @param[in] dp The DP model deviation to use.
* @param[in] natoms The number of atoms.
* @param[in] coord The coordinates of atoms. The array should be of size natoms
*x 3.
* @param[in] atype The atom types. The array should contain natoms ints.
* @param[in] box The cell of the region. The array should be of size 9. Pass
*NULL if pbc is not used.
* @param[out] energy Output energy.
* @param[out] force Output force. The array should be of size natoms x 3.
* @param[out] virial Output virial. The array should be of size 9.
* @param[out] atomic_energy Output atomic energy. The array should be of size
*natoms.
* @param[out] atomic_virial Output atomic virial. The array should be of size
*natoms x 9.
* @warning The output arrays should be allocated before calling this function.
*Pass NULL if not required.
**/
extern void DP_DeepPotModelDeviComputef(DP_DeepPotModelDevi* dp,
const int natom,
const float* coord,
const int* atype,
const float* cell,
double* energy,
float* force,
float* virial,
float* atomic_energy,
float* atomic_virial);

/**
* @brief Evaluate the energy, force and virial by using a DP model deviation
*with neighbor list. (double version)
* @version 2
* @param[in] dp The DP model deviation to use.
* @param[in] nframes The number of frames. Only support 1 for now.
* @param[in] natoms The number of atoms.
* @param[in] coord The coordinates of atoms. The array should be of size natoms
*x 3.
* @param[in] atype The atom types. The array should contain natoms ints.
* @param[in] box The cell of the region. The array should be of size 9. Pass
*NULL if pbc is not used.
* @param[in] fparam The frame parameters. The array can be of size nframes x
*dim_fparam.
* @param[in] aparam The atom parameters. The array can be of size nframes x
*natoms x dim_aparam.
* @param[out] energy Output energy.
* @param[out] force Output force. The array should be of size natoms x 3.
* @param[out] virial Output virial. The array should be of size 9.
* @param[out] atomic_energy Output atomic energy. The array should be of size
*natoms.
* @param[out] atomic_virial Output atomic virial. The array should be of size
*natoms x 9.
* @warning The output arrays should be allocated before calling this function.
*Pass NULL if not required.
**/
void DP_DeepPotModelDeviCompute2(DP_DeepPotModelDevi* dp,
const int nframes,
const int natoms,
const double* coord,
const int* atype,
const double* cell,
const double* fparam,
const double* aparam,
double* energy,
double* force,
double* virial,
double* atomic_energy,
double* atomic_virial);
/**
* @brief Evaluate the energy, force and virial by using a DP model deviation
*with neighbor list. (float version)
* @version 2
* @param[in] dp The DP model deviation to use.
* @param[in] nframes The number of frames. Only support 1 for now.
* @param[in] natoms The number of atoms.
* @param[in] coord The coordinates of atoms. The array should be of size natoms
*x 3.
* @param[in] atype The atom types. The array should contain natoms ints.
* @param[in] box The cell of the region. The array should be of size 9. Pass
*NULL if pbc is not used.
* @param[in] fparam The frame parameters. The array can be of size nframes x
*dim_fparam.
* @param[in] aparam The atom parameters. The array can be of size nframes x
*natoms x dim_aparam.
* @param[out] energy Output energy.
* @param[out] force Output force. The array should be of size natoms x 3.
* @param[out] virial Output virial. The array should be of size 9.
* @param[out] atomic_energy Output atomic energy. The array should be of size
*natoms.
* @param[out] atomic_virial Output atomic virial. The array should be of size
*natoms x 9.
* @warning The output arrays should be allocated before calling this function.
*Pass NULL if not required.
**/
void DP_DeepPotModelDeviComputef2(DP_DeepPotModelDevi* dp,
const int nframes,
const int natoms,
const float* coord,
const int* atype,
const float* cell,
const float* fparam,
const float* aparam,
double* energy,
float* force,
float* virial,
float* atomic_energy,
float* atomic_virial);

/**
* @brief Evaluate the energy, force and virial by using a DP model deviation
*with neighbor list. (double version)
Expand Down
Loading