Program Listing for File c_api.h

Return to documentation for file (source/api_c/include/c_api.h)

// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
#ifdef __cplusplus
extern "C" {
#else
// for C99
#include <stdbool.h>
#endif

typedef struct DP_Nlist DP_Nlist;

extern DP_Nlist* DP_NewNlist(int inum_,
                             int* ilist_,
                             int* numneigh_,
                             int** firstneigh_);

const char* DP_NlistCheckOK(DP_Nlist* dp);

typedef struct DP_DeepPot DP_DeepPot;

extern DP_DeepPot* DP_NewDeepPot(const char* c_model);

extern DP_DeepPot* DP_NewDeepPotWithParam(const char* c_model,
                                          const int gpu_rank,
                                          const char* c_file_content);

extern DP_DeepPot* DP_NewDeepPotWithParam2(const char* c_model,
                                           const int gpu_rank,
                                           const char* c_file_content,
                                           const int size_file_content);

extern void DP_DeepPotCompute(DP_DeepPot* 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);

extern void DP_DeepPotComputef(DP_DeepPot* 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);

extern void DP_DeepPotComputeNList(DP_DeepPot* dp,
                                   const int natom,
                                   const double* coord,
                                   const int* atype,
                                   const double* cell,
                                   const int nghost,
                                   const DP_Nlist* nlist,
                                   const int ago,
                                   double* energy,
                                   double* force,
                                   double* virial,
                                   double* atomic_energy,
                                   double* atomic_virial);

extern void DP_DeepPotComputeNListf(DP_DeepPot* dp,
                                    const int natom,
                                    const float* coord,
                                    const int* atype,
                                    const float* cell,
                                    const int nghost,
                                    const DP_Nlist* nlist,
                                    const int ago,
                                    double* energy,
                                    float* force,
                                    float* virial,
                                    float* atomic_energy,
                                    float* atomic_virial);

extern void DP_DeepPotCompute2(DP_DeepPot* dp,
                               const int nframes,
                               const int natom,
                               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);

extern void DP_DeepPotComputef2(DP_DeepPot* dp,
                                const int nframes,
                                const int natom,
                                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);

extern void DP_DeepPotComputeNList2(DP_DeepPot* dp,
                                    const int nframes,
                                    const int natom,
                                    const double* coord,
                                    const int* atype,
                                    const double* cell,
                                    const int nghost,
                                    const DP_Nlist* nlist,
                                    const int ago,
                                    const double* fparam,
                                    const double* aparam,
                                    double* energy,
                                    double* force,
                                    double* virial,
                                    double* atomic_energy,
                                    double* atomic_virial);

extern void DP_DeepPotComputeNListf2(DP_DeepPot* dp,
                                     const int nframes,
                                     const int natom,
                                     const float* coord,
                                     const int* atype,
                                     const float* cell,
                                     const int nghost,
                                     const DP_Nlist* nlist,
                                     const int ago,
                                     const float* fparam,
                                     const float* aparam,
                                     double* energy,
                                     float* force,
                                     float* virial,
                                     float* atomic_energy,
                                     float* atomic_virial);

extern void DP_DeepPotComputeMixedType(DP_DeepPot* 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);
extern void DP_DeepPotComputeMixedTypef(DP_DeepPot* 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);

typedef struct DP_DeepPotModelDevi DP_DeepPotModelDevi;

extern DP_DeepPotModelDevi* DP_NewDeepPotModelDevi(const char** c_models,
                                                   int n_models);

extern DP_DeepPotModelDevi* DP_NewDeepPotModelDeviWithParam(
    const char** c_model,
    const int n_models,
    const int gpu_rank,
    const char** c_file_contents,
    const int n_file_contents,
    const int* size_file_contents);

extern void DP_DeepPotModelDeviComputeNList(DP_DeepPotModelDevi* dp,
                                            const int natom,
                                            const double* coord,
                                            const int* atype,
                                            const double* cell,
                                            const int nghost,
                                            const DP_Nlist* nlist,
                                            const int ago,
                                            double* energy,
                                            double* force,
                                            double* virial,
                                            double* atomic_energy,
                                            double* atomic_virial);

extern void DP_DeepPotModelDeviComputeNListf(DP_DeepPotModelDevi* dp,
                                             const int natom,
                                             const float* coord,
                                             const int* atype,
                                             const float* cell,
                                             const int nghost,
                                             const DP_Nlist* nlist,
                                             const int ago,
                                             double* energy,
                                             float* force,
                                             float* virial,
                                             float* atomic_energy,
                                             float* atomic_virial);

void DP_DeepPotModelDeviComputeNList2(DP_DeepPotModelDevi* dp,
                                      const int nframes,
                                      const int natoms,
                                      const double* coord,
                                      const int* atype,
                                      const double* cell,
                                      const int nghost,
                                      const DP_Nlist* nlist,
                                      const int ago,
                                      const double* fparam,
                                      const double* aparam,
                                      double* energy,
                                      double* force,
                                      double* virial,
                                      double* atomic_energy,
                                      double* atomic_virial);
void DP_DeepPotModelDeviComputeNListf2(DP_DeepPotModelDevi* dp,
                                       const int nframes,
                                       const int natoms,
                                       const float* coord,
                                       const int* atype,
                                       const float* cell,
                                       const int nghost,
                                       const DP_Nlist* nlist,
                                       const int ago,
                                       const float* fparam,
                                       const float* aparam,
                                       double* energy,
                                       float* force,
                                       float* virial,
                                       float* atomic_energy,
                                       float* atomic_virial);

double DP_DeepPotModelDeviGetCutoff(DP_DeepPotModelDevi* dp);

int DP_DeepPotModelDeviGetNumbTypes(DP_DeepPotModelDevi* dp);

int DP_DeepPotModelDeviGetNumbTypesSpin(DP_DeepPotModelDevi* dp);

const char* DP_DeepPotModelDeviCheckOK(DP_DeepPotModelDevi* dp);

double DP_DeepPotGetCutoff(DP_DeepPot* dp);

int DP_DeepPotGetNumbTypes(DP_DeepPot* dp);

int DP_DeepPotGetNumbTypesSpin(DP_DeepPot* dp);

int DP_DeepPotGetDimFParam(DP_DeepPot* dp);

int DP_DeepPotGetDimAParam(DP_DeepPot* dp);

bool DP_DeepPotIsAParamNAll(DP_DeepPot* dp);

const char* DP_DeepPotGetTypeMap(DP_DeepPot* dp);

int DP_DeepPotModelDeviGetDimFParam(DP_DeepPotModelDevi* dp);
int DP_DeepPotModelDeviGetDimAParam(DP_DeepPotModelDevi* dp);

bool DP_DeepPotModelDeviIsAParamNAll(DP_DeepPotModelDevi* dp);

typedef struct DP_DeepTensor DP_DeepTensor;

const char* DP_DeepPotCheckOK(DP_DeepPot* dp);

extern DP_DeepTensor* DP_NewDeepTensor(const char* c_model);

extern DP_DeepTensor* DP_NewDeepTensorWithParam(const char* c_model,
                                                const int gpu_rank,
                                                const char* c_name_scope);

extern void DP_DeepTensorComputeTensor(DP_DeepTensor* dt,
                                       const int natom,
                                       const double* coord,
                                       const int* atype,
                                       const double* cell,
                                       double** tensor,
                                       int* size);

extern void DP_DeepTensorComputeTensorf(DP_DeepTensor* dt,
                                        const int natom,
                                        const float* coord,
                                        const int* atype,
                                        const float* cell,
                                        float** tensor,
                                        int* size);

extern void DP_DeepTensorComputeTensorNList(DP_DeepTensor* dt,
                                            const int natom,
                                            const double* coord,
                                            const int* atype,
                                            const double* cell,
                                            const int nghost,
                                            const DP_Nlist* nlist,
                                            double** tensor,
                                            int* size);

extern void DP_DeepTensorComputeTensorNListf(DP_DeepTensor* dt,
                                             const int natom,
                                             const float* coord,
                                             const int* atype,
                                             const float* cell,
                                             const int nghost,
                                             const DP_Nlist* nlist,
                                             float** tensor,
                                             int* size);

extern void DP_DeepTensorCompute(DP_DeepTensor* dt,
                                 const int natom,
                                 const double* coord,
                                 const int* atype,
                                 const double* cell,
                                 double* global_tensor,
                                 double* force,
                                 double* virial,
                                 double** atomic_tensor,
                                 double* atomic_virial,
                                 int* size_at);

extern void DP_DeepTensorComputef(DP_DeepTensor* dt,
                                  const int natom,
                                  const float* coord,
                                  const int* atype,
                                  const float* cell,
                                  float* global_tensor,
                                  float* force,
                                  float* virial,
                                  float** atomic_tensor,
                                  float* atomic_virial,
                                  int* size_at);

extern void DP_DeepTensorComputeNList(DP_DeepTensor* dt,
                                      const int natom,
                                      const double* coord,
                                      const int* atype,
                                      const double* cell,
                                      const int nghost,
                                      const DP_Nlist* nlist,
                                      double* global_tensor,
                                      double* force,
                                      double* virial,
                                      double** atomic_tensor,
                                      double* atomic_virial,
                                      int* size_at);

extern void DP_DeepTensorComputeNListf(DP_DeepTensor* dt,
                                       const int natom,
                                       const float* coord,
                                       const int* atype,
                                       const float* cell,
                                       const int nghost,
                                       const DP_Nlist* nlist,
                                       float* global_tensor,
                                       float* force,
                                       float* virial,
                                       float** atomic_tensor,
                                       float* atomic_virial,
                                       int* size_at);

double DP_DeepTensorGetCutoff(DP_DeepTensor* dt);

int DP_DeepTensorGetNumbTypes(DP_DeepTensor* dt);

int DP_DeepTensorGetOutputDim(DP_DeepTensor* dt);

int* DP_DeepTensorGetSelTypes(DP_DeepTensor* dt);

int DP_DeepTensorGetNumbSelTypes(DP_DeepTensor* dt);

const char* DP_DeepTensorGetTypeMap(DP_DeepTensor* dt);

const char* DP_DeepTensorCheckOK(DP_DeepTensor* dt);

typedef struct DP_DipoleChargeModifier DP_DipoleChargeModifier;

extern DP_DipoleChargeModifier* DP_NewDipoleChargeModifier(const char* c_model);

extern DP_DipoleChargeModifier* DP_NewDipoleChargeModifierWithParam(
    const char* c_model, const int gpu_rank, const char* c_name_scope);

extern void DP_DipoleChargeModifierComputeNList(DP_DipoleChargeModifier* dcm,
                                                const int natom,
                                                const double* coord,
                                                const int* atype,
                                                const double* cell,
                                                const int* pairs,
                                                const int npairs,
                                                const double* delef_,
                                                const int nghost,
                                                const DP_Nlist* nlist,
                                                double* dfcorr_,
                                                double* dvcorr_);

extern void DP_DipoleChargeModifierComputeNListf(DP_DipoleChargeModifier* dcm,
                                                 const int natom,
                                                 const float* coord,
                                                 const int* atype,
                                                 const float* cell,
                                                 const int* pairs,
                                                 const int npairs,
                                                 const float* delef_,
                                                 const int nghost,
                                                 const DP_Nlist* nlist,
                                                 float* dfcorr_,
                                                 float* dvcorr_);

double DP_DipoleChargeModifierGetCutoff(DP_DipoleChargeModifier* dt);

int DP_DipoleChargeModifierGetNumbTypes(DP_DipoleChargeModifier* dt);

int* DP_DipoleChargeModifierGetSelTypes(DP_DipoleChargeModifier* dt);

int DP_DipoleChargeModifierGetNumbSelTypes(DP_DipoleChargeModifier* dt);

const char* DP_DipoleChargeModifierCheckOK(DP_DipoleChargeModifier* dcm);

extern void DP_ConvertPbtxtToPb(const char* c_pbtxt, const char* c_pb);

extern void DP_PrintSummary(const char* c_pre);

const char* DP_ReadFileToChar(const char* c_model);

const char* DP_ReadFileToChar2(const char* c_model, int* size);

void DP_SelectByType(const int natoms,
                     const int* atype,
                     const int nghost,
                     const int nsel_type,
                     const int* sel_type,
                     int* fwd_map,
                     int* nreal,
                     int* bkw_map,
                     int* nghost_real);

void DP_SelectMapInt(const int* in,
                     const int* fwd_map,
                     const int stride,
                     const int nall1,
                     const int nall2,
                     int* out);

void DP_DeleteChar(const char* c_str);

#ifdef __cplusplus
} /* end extern "C" */
#endif