1 /* 2 * (c) 2004 Iowa State University 3 * see the LICENSE file in the top level directory 4 */ 5 6 /* BasisSet.h 7 8 Basis Set classes 9 10 Seperated from other files 4/1998 BMB 11 */ 12 #ifndef __BasisSet__ 13 #define __BasisSet__ 14 #include <vector> 15 16 typedef class XMLElement XMLElement; 17 18 /** 19 * The TypeOfShell enum is pretty self explanatory in that it lists the possible 20 * shell types including cartesian S-I shells and the same for spherical harmonics. 21 */ 22 enum TypeOfShell { 23 LShell=-1, 24 SShell=0, 25 PShell, 26 DShell, 27 FShell, 28 GShell, 29 HShell, 30 IShell, 31 SHLShell=9, 32 SHSShell=10, 33 SHPShell, 34 SHDShell, 35 SHFShell, 36 SHGShell, 37 SHHShell, 38 SHIShell 39 }; 40 41 /** 42 * BasisShell contains the information on a single shell including the shell type, 43 * coefficients and exponents. 44 */ 45 class BasisShell { 46 public: 47 std::vector<float> Exponent; ///< Exponent for each primitive 48 std::vector<float> NormCoef; ///< Normalized coefficients 49 std::vector<float> InputCoef; ///< Standard input set of coefficients 50 short ShellType; ///< s, p, d, etc 51 short NumPrims; ///< # of primitives in this shell 52 53 BasisShell(void); 54 ~BasisShell(void); 55 /// Convert the shell data into XML format 56 void WriteXML(XMLElement * parent) const; 57 /// Build this shell from the provided XML 58 void ReadXML(XMLElement * parent); 59 /// Returns the number of functions in the shell taking into account spherical harmonics 60 /// This would be the number of coefficients needed in an MOVector for this shell. 61 long GetNumFuncs(bool UseSphericalHarmonics) const; 62 /// Return the start of the function in the angular momenta list 63 long GetAngularStart(bool UseSphericalHarmonics) const; 64 /// Returns a plain text form of the label for each function 65 void GetLabel(char * Label, short FuncNum, bool UseSphericalHarmonics) const; 66 /// Returns the dimension of the primitive contraction. GetNumPrimitives(void)67 inline long GetNumPrimitives(void) const {return NumPrims;}; 68 /// Returns the shell type GetShellType(void)69 inline long GetShellType(void) const {return ((ShellType>=0) ? ShellType : -ShellType);}; 70 }; 71 72 /** 73 * The BasisSet class packages up the basis set information for a typical computation. 74 * This include a set of basis shells and a mapping of the shells to the atoms in the molecule. 75 */ 76 class BasisSet { 77 public: 78 std::vector<BasisShell> Shells; ///< Set of shells in basis 79 std::vector<long> BasisMap; ///< Maps the basis onto molecule 80 ///< stored as start, end for each atom 81 std::vector<long> NuclearCharge; ///< Normally the same as the atom type, except for ECP's 82 long MapLength; ///< allocation size of the BasisMap 83 long NumShells; ///< number of saved shells (some shells may be reused) 84 long NumFuncs; ///< Total # of funcs, that is the total number of 85 ///< of shells x the # of functions per shell (ie 1 for 86 ///< s, 3 for p,...) MOVectors are NumFuncsxNumFuncs 87 bool goodCharges; ///< Are the nuclear charges valid (normally true!) 88 89 //member functions 90 BasisSet(long nAtoms, long nShells); 91 ~BasisSet(void); 92 /// Convert the Basis Set to XML for output 93 void WriteXML(XMLElement * parent) const; 94 /// Parse the provided XML to produce a basis set. 95 static BasisSet * ReadXML(XMLElement * parent); 96 /// Output the basis for the specifed atom in GAMESS input file format. 97 void WriteBasis(BufferFile * File, long AtomNum) const; 98 /// Returns the number of basis functions taking spherical harmonics into account. 99 /// This is the expected dimension for an MO vector. 100 long GetNumBasisFuncs(bool UseSphericalHarmonics) const; 101 /// Returns the shell count in the basis set. GetNumShells(void)102 long GetNumShells(void) const {return NumShells;}; 103 /// Return the nuclear charge array. GetNuclearChargeArray(void)104 inline std::vector<long> GetNuclearChargeArray(void) const {return NuclearCharge;}; 105 /// Return in the provided array an indexing of the start of each shell into an MO vector. 106 void GetShellIndexArray(long * IndexArray) const; 107 /// Normalize the basis set coefficients to save effort when producing grids later. 108 void Normalize(bool InputNormed, bool NormOutput); 109 /// Parse the basis set from a GAMESS log file 110 static BasisSet * ParseGAMESSBasisSet(BufferFile * Buffer, long NumAtoms, const mpAtom * Atoms); 111 /// Parses a basis set from a MolDen format file with the given number of atoms. 112 bool ReadMolDenBasisSet(BufferFile * Buffer, long NumAtoms); 113 /** 114 * Is the nuclear charge array valid? 115 */ AreNuclearChargesValid(void)116 bool AreNuclearChargesValid(void) const {return goodCharges;}; 117 /** 118 * Set the flag to indicate if the nuclearCharge array is valid. 119 */ NuclearChargesAreValid(bool v)120 void NuclearChargesAreValid(bool v) {goodCharges = v;}; 121 }; 122 123 #endif /* __BasisSet__ */ 124