1 #ifndef VDWXC_H 2 #define VDWXC_H 3 4 // libvdwxc can be compiled in three ways: 5 // * libvdwxc + fftw 6 // * libvdwxc + fftw + mpi + fftw-mpi 7 // * libvdwxc + fftw + mpi + fftw-mpi + pfft 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #include <complex.h> 14 15 16 #define VDWXC_DF1 1 17 #define VDWXC_DF2 2 18 #define VDWXC_FUNCTIONAL_CUSTOM -1 19 20 #define VDWXC_FFTW_SERIAL 0 21 #define VDWXC_FFTW_MPI 1 22 #define VDWXC_PFFT 2 23 24 // FUNC_xxxx and VDW_xxxx deprecated 25 // in favour of VDWXC_xxxx 26 #define FUNC_VDWDF VDWXC_DF1 27 #define FUNC_VDWDF2 VDWXC_DF2 28 #define FUNC_VDWDFCX 3 29 #define FUNC_CUSTOM VDWXC_FUNCTIONAL_CUSTOM 30 #define VDW_FFTW_SERIAL VDWXC_FFTW_SERIAL 31 #define VDW_FFTW_MPI VDWXC_FFTW_MPI 32 #define VDW_PFFT VDWXC_PFFT 33 34 #define VDWXC_HAS_SPIN 1 35 36 typedef struct vdwxc_data_obj *vdwxc_data; 37 38 // This header file declares the high level functions that are called 39 // by DFT codes. 40 41 vdwxc_data vdwxc_new(int functional); 42 vdwxc_data vdwxc_new_spin(int functional); 43 44 void vdwxc_print(vdwxc_data data); 45 int vdwxc_tostring(vdwxc_data data, int maxsize, char *str); 46 47 void vdwxc_set_unit_cell(vdwxc_data data, 48 int Nx, int Ny, int Nz, 49 double C00, double C10, double C20, 50 double C01, double C11, double C21, 51 double C02, double C12, double C22); 52 53 // Set the radial grid for vdW-DF calculations. 54 //void vdwxc_df_set_radial_grid(vdwxc_data data, double h, int Nr); 55 56 // These are functions because it seems more portable than constants 57 // For example they can be called through Python ctypes and such. 58 int vdwxc_has_mpi(void); 59 int vdwxc_has_pfft(void); 60 61 void vdwxc_init_serial(vdwxc_data data); 62 63 double vdwxc_calculate(vdwxc_data data, 64 double *rho_g, double *sigma_g, 65 double *dedn_g, double *dedsigma_g); 66 67 double vdwxc_calculate_spin(vdwxc_data data, 68 double *rho_up_g, double *rho_dn_g, 69 double *sigma_up_g, double *sigma_dn_g, 70 double *dedn_up_g, double *dedn_dn_g, 71 double *dedsigma_up_g, double *dedsigma_dn_g); 72 73 //double vdwxc_calculate_radial(vdwxc_data data, int N, double dr, double* rho_i, 74 // double* sigma_i, double* dedn_i, double* dedsigma_i); 75 76 77 void vdwxc_finalize(vdwxc_data* data); 78 79 void vdwxc_get_q0(vdwxc_data data, double *q0); 80 81 // Functions for more or less internal use. 82 //void vdwxc_allocate_buffers(vdwxc_data data); 83 84 85 /* 86 Input: 87 int N : number of grid points 88 double Z_ab 89 double q_cut 90 double* rho : density (in electrons / Bohr^3) 91 double* sigma : |\nabla \rho|^2 92 93 Output: 94 double* q0 : q0 95 double* dq0_drho : Derivative of q0 wrt. rho 96 double* dq0_dsigma : Derivative of q0 wrt. gradient of rho 97 */ 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif 103