00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * RCS INFORMATION: 00010 * 00011 * $RCSfile: Orbital.h,v $ 00012 * $Author: johns $ $Locker: $ $State: Exp $ 00013 * $Revision: 1.45 $ $Date: 2020年07月28日 07:39:34 $ 00014 * 00015 ***************************************************************************/ 00021 #ifndef ORBITAL_H 00022 #define ORBITAL_H 00023 00024 #include <string.h> 00025 #include "QMData.h" 00026 #include "Molecule.h" 00027 #include "ProfileHooks.h" 00028 00031 class Orbital { 00032 private: 00033 int numatoms; 00034 const float *atompos; 00035 00036 00037 int num_wave_f; 00038 00039 00040 float *wave_f; 00041 00042 int num_basis_funcs; 00043 00044 const float *basis_array; 00045 00046 00047 00048 00049 00050 00051 int numtypes; 00052 const basis_atom_t *basis_set; 00053 00054 const int *atom_types; 00055 const int *atom_sort; 00056 00057 const int *atom_basis; 00058 00059 const float **norm_factors; 00060 00061 00062 const int *num_shells_per_atom; 00063 const int *num_prim_per_shell; 00064 const int *shell_types; 00065 00066 00067 // grid related data 00068 int numvoxels[3]; 00069 float voxelsize; 00070 float origin[3]; 00071 float gridsize[3]; 00072 00073 float *grid_data; 00074 00075 00076 00077 public: 00078 Orbital(const float *atompos, 00079 const float *wave_function, 00080 const float *basis, 00081 const basis_atom_t *bset, 00082 const int *types, 00083 const int *atom_sort, 00084 const int *atom_basis, 00085 const float **norm_factors, 00086 const int *num_shells_per_atom, 00087 const int *num_prim_per_shell, 00088 const int *orbital_symmetry, 00089 int numatoms, int numtypes, int num_wave_f, 00090 int num_basis_funcs, 00091 int orbid); 00092 00093 ~Orbital(void); 00094 00095 00096 // Return array sizes need for GPU-acclerated versions 00097 int total_shells() { 00098 int shellcnt=0; 00099 for (int at=0; at<numatoms; at++) { 00100 for (int shell=0; shell < num_shells_per_atom[at]; shell++) { 00101 shellcnt++; 00102 } 00103 } 00104 00105 return shellcnt; 00106 } 00107 00108 int num_types(void) { return numtypes; } 00109 00111 int max_primitives(void); 00112 00114 int max_shell_type(void); 00115 00118 int max_wave_f_count(void); 00119 00121 const float* get_origin() { return origin; } 00122 00124 const float* get_gridsize() { return gridsize; } 00125 00127 const int* get_numvoxels() { return numvoxels; } 00128 00130 void get_grid_axes(float xaxis[3], float yaxis[3], float zaxis[3]) { 00131 xaxis[0] = gridsize[0]; 00132 yaxis[1] = gridsize[1]; 00133 zaxis[2] = gridsize[2]; 00134 xaxis[1] = xaxis[2] = yaxis[0] = yaxis[2] = zaxis[0] = zaxis[1] = 0.0; 00135 } 00136 00138 float get_resolution() { return voxelsize; } 00139 00143 void set_grid(float newori[3], float newdim[3], float voxelsize); 00144 00146 void set_resolution(float voxelsize); 00147 00149 float* get_grid_data() { return grid_data; } 00150 00155 int set_grid_to_bbox(const float *pos, float padding, 00156 float resolution); 00157 00161 void find_optimal_grid(float threshold, 00162 int minstepsize, int maxstepsize); 00163 00168 int check_plane(int w, float threshold, int minstepsize, int &stepsize); 00169 00172 void normalize_wavefunction(const float *wfn); 00173 00175 int calculate_mo(DrawMolecule *mol, int density); 00176 00178 float evaluate_grid_point(float grid_x, float grid_y, float grid_z); 00179 00181 double flops_per_gridpoint(); 00182 00183 void print_wavefunction(); 00184 }; 00185 00186 00187 // Compute the volumetric data for the whole grid 00188 int evaluate_grid(int numatoms, 00189 const float *wave_f, 00190 const float *basis_array, 00191 const float *atompos, 00192 const int *atom_basis, 00193 const int *num_shells_per_atom, 00194 const int *num_prim_per_shell, 00195 const int *shell_types, 00196 const int *numvoxels, 00197 float voxelsize, 00198 const float *origin, 00199 int density, 00200 float * orbitalgrid); 00201 00202 #define VMDORBUSETHRPOOL 1 00203 00204 // Multiprocessor implementation 00205 int evaluate_grid_fast(wkf_cpu_caps_t *cpucaps, 00206 #if defined(VMDORBUSETHRPOOL) 00207 wkf_threadpool_t *thrpool, 00208 #else 00209 int numcputhreads, 00210 #endif 00211 int numatoms, 00212 const float *wave_f, 00213 const float *basis_array, 00214 const float *atompos, 00215 const int *atom_basis, 00216 const int *num_shells_per_atom, 00217 const int *num_prim_per_shell, 00218 const int *shell_types, 00219 const int *numvoxels, 00220 float voxelsize, 00221 const float *origin, 00222 int density, 00223 float * orbitalgrid); 00224 00225 #endif 00226