Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Orbital.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2011 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: Orbital.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.36 $       $Date: 2010/12/16 04:08:28 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *
00019  * The Orbital class, which stores orbitals, for a
00020  * single timestep.
00021  *
00022  ***************************************************************************/
00023 #ifndef ORBITAL_H
00024 #define ORBITAL_H
00025 
00026 #include<string.h>
00027 #include "QMData.h"
00028 #include "Molecule.h"
00029 
00032 class Orbital {
00033 private:
00034   int atomid;
00035   int shellid;
00036 
00037   int numatoms;         
00038   const float *atompos; 
00039 
00040 
00041   int num_wave_f; 
00042 
00043 
00044   float *wave_f;            
00045 
00046   int num_basis_funcs;      
00047 
00048   const float *basis_array; 
00049 
00050 
00051 
00052 
00053 
00054 
00055   int numtypes;
00056   const basis_atom_t *basis_set;  
00057 
00058   const int *atom_types;          
00059   const int *atom_sort;           
00060 
00061   const int *atom_basis;          
00062 
00063   const float **norm_factors;     
00064 
00065 
00066   const int *num_shells_per_atom; 
00067   const int *num_prim_per_shell;  
00068   const int *shell_types;         
00069 
00070 
00071   // grid related data
00072   int numvoxels[3];  
00073   float voxelsize;   
00074   float origin[3];   
00075   float gridsize[3]; 
00076 
00077   float *grid_data;  
00078 
00079 
00080 
00081 public:
00082   Orbital(const float *atompos,
00083           const float *wave_function,
00084           const float *basis,
00085           const basis_atom_t *bset,
00086           const int *types,
00087           const int *atom_sort,
00088           const int *atom_basis,
00089           const float **norm_factors,
00090           const int *num_shells_per_atom,
00091           const int *num_prim_per_shell,
00092           const int *orbital_symmetry,
00093           int numatoms, int numtypes, int num_wave_f,
00094           int num_basis_funcs, 
00095           int orbid); 
00096 
00097   ~Orbital(void);               
00098 
00099 
00100   // Return array sizes need for GPU-acclerated versions
00101   int total_shells() {
00102     int shellcnt=0;
00103     for (int at=0; at<numatoms; at++) {
00104       for (int shell=0; shell < num_shells_per_atom[at]; shell++) { 
00105         shellcnt++;
00106       }
00107     }
00108 
00109     return shellcnt;
00110   }
00111 
00112   // Return the max number of primitives that occur in a basis function
00113   int max_primitives(void);
00114 
00115   // Return maximum shell type contained in the orbital
00116   int max_shell_type(void);
00117 
00118   // Count the max number of wave_f accesses for the shell types
00119   // contained in this orbital 
00120   int max_wave_f_count(void);
00121 
00122   // Get the grid origin
00123   const float* get_origin() { return origin; }
00124 
00125   // Get the side lengths of the grid in Angstrom
00126   const float* get_gridsize() { return gridsize; }
00127 
00128   // Get the number of voxels in each dimension
00129   const int* get_numvoxels() { return numvoxels; }
00130 
00131   // Get the axes of the volumetric grid as defined in 
00132   // volumetric_t.
00133   void get_grid_axes(float xaxis[3], float yaxis[3], float zaxis[3]) {
00134     xaxis[0] = gridsize[0];
00135     yaxis[1] = gridsize[1];
00136     zaxis[2] = gridsize[2];
00137     xaxis[1] = xaxis[2] = yaxis[0] = yaxis[2] = zaxis[0] = zaxis[1] = 0.0;
00138   }
00139 
00140   // Get the grid resolution, i.e. the side length of a voxel
00141   float get_resolution() { return voxelsize; }
00142 
00143   // Set the grid size and resolution
00144   // The given grid dimensions will be rounded to a multiple
00145   // of the voxel size.
00146   void set_grid(float newori[3], float newdim[3], float voxelsize);
00147 
00148   // Change the resolution of the grid
00149   void set_resolution(float voxelsize);
00150 
00151   // Get a pointer to the raw volumetric data
00152   float* get_grid_data() { return grid_data; }
00153 
00154   // Sets the grid dimensions to the bounding box of the given
00155   // set of atoms *pos including a padding in all dimensions.
00156   // The resulting grid dimensions will be rounded to a multiple
00157   // of the voxel size.
00158   int set_grid_to_bbox(const float *pos, float padding,
00159                        float resolution);
00160 
00161   // Optimize position and dimension of current grid so that
00162   // all orbital values higher than threshold are contained
00163   // in the grid.
00164   void find_optimal_grid(float threshold,
00165                          int minstepsize, int maxstepsize);
00166 
00167   // Check if all values in the boundary plane given by dir 
00168   // are below threshold.
00169   // If not, jump back, decrease the stepsize and test again.
00170   // Helper function for find_optimal_grid().
00171   int check_plane(int w, float threshold, int minstepsize, int &stepsize);
00172 
00173   // Multiply wavefunction coefficients with the
00174   // basis set normalization factors.
00175   void normalize_wavefunction(const float *wfn);
00176 
00177   // Compute the volumetric data for the orbital
00178   int calculate_mo(DrawMolecule *mol, int density);
00179 
00180   // Compute the volumetric data for given point in space
00181   float evaluate_grid_point(float grid_x, float grid_y, float grid_z);
00182 
00183   // Compute total FLOPS executed for a single gridpoint
00184   double flops_per_gridpoint();
00185 
00186   void print_wavefunction();
00187 };
00188 
00189 
00190 // Compute the volumetric data for the whole grid
00191 int evaluate_grid(int numatoms, 
00192                   const float *wave_f, 
00193                   const float *basis_array,
00194                   const float *atompos,
00195                   const int *atom_basis,
00196                   const int *num_shells_per_atom,
00197                   const int *num_prim_per_shell,
00198                   const int *shell_types,
00199                   const int *numvoxels,
00200                   float voxelsize,
00201                   const float *origin,
00202                   int density,
00203                   float * orbitalgrid); 
00204 
00205 // Multiprocessor implementation
00206 int evaluate_grid_fast(int numatoms, 
00207                        const float *wave_f,
00208                        const float *basis_array,
00209                        const float *atompos,
00210                        const int *atom_basis,
00211                        const int *num_shells_per_atom,
00212                        const int *num_prim_per_shell,
00213                        const int *shell_types,
00214                        const int *numvoxels,
00215                        float voxelsize,
00216                        const float *origin,
00217                        int density,
00218                        float * orbitalgrid); 
00219 
00220 #endif
00221 

Generated on Sat May 26 01:48:17 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002