QCGeneralData.cpp

Go to the documentation of this file.
00001 //*****************************************************************************//
00002 //                                                                             //
00003 //   Copyright (c) 2001                                                        //
00004 //      INRIA                                                                  //
00005 //      54600 VILLERS LES NANCY                                                //
00006 //      France                                                                 //
00007 //                                                                             //
00008 //*****************************************************************************//
00009 //                                                                             //
00010 //               *** NOTICE OF PROPRIETARY INFORMATION ***                     //
00011 //                                                                             //
00012 // The information contained in this file is considered proprietary and the    //
00013 // exclusive property of  INRIA. This information may not be disclosed,        //
00014 // duplicated or used, in whole or in part, for  any purpose  whatsoever       //
00015 // without express written authorization from INRIA                            //
00016 //                                                                             //
00017 //*****************************************************************************//
00018 
00019 
00020 #include <sstream>
00021 
00022 #include "QCGeneralData.hpp"
00023 #include "QCReader.hpp"
00024 
00025 
00026 
00030 template <class Numeric>
00031 inline void updateVal (pair<string, Numeric>& member) {
00032 
00033   istringstream iss (member.first);
00034   iss >> member.second;
00035 }
00036 
00037 
00041 template <class Numeric>
00042 inline string toString (const Numeric num) {
00043 
00044   ostringstream oss;
00045   oss << num;
00046   return oss.str();
00047 }
00048 
00049 
00050 
00054 QCGeneralData::QCGeneralData (void) :
00055   modelType (QCCommon::Pm3Str, QC_PM3_MODEL),
00056   parameterType (QCCommon::Pm3ParamStr, QC_PM3_PARAM),
00057   computationType (QCCommon::EnergyStr, QC_ENERGY),
00058   mainAlgorithm (QCCommon::SCFStr, QC_SCF),
00059   diagoAlgorithm (QCCommon::ClassicDiagoStr, QC_CLASSIC_DIAGO),
00060   shiftingLevelParameter (toString(QC_ONE), QC_ONE),
00061   intgAcquisitionMethod (QCCommon::DirectComputationStr, QC_DIRECT_COMPUTATION),
00062   initDensityMatrix (QCCommon::initDiagStr,  QC_DENSITY_DIAG),
00063   energyThreshold (toString(QC_Em6), QC_Em6),
00064   energyNbMaxIter ("50", 50),
00066   derivationType (QCCommon::NumericalDerivationStr, QC_NUMERICAL_DERIVATION),
00067   derivShiftBhvr (QCCommon::ConstantStr, QC_CONSTANT),
00068   deltaQ (toString(QC_Em5), QC_Em5),
00069   nbPartitions ("0", 0),
00070   buffDiameter (toString(QC_ZERO), QC_ZERO),
00071   cutRadius (toString(QC_ZERO), QC_ZERO),
00072   readPartitionFile ("NO", false),
00073   partitionType(QCCommon::StandardPartStr, QC_STANDARD_PART),
00074   partitionerType(QCCommon::KimikaStr, QC_KIMIKA),_DCcomputational(false), 
00075   refs ()
00076 {
00077   refs [QCReader::MODEL_TYPE]              = &modelType.first;
00078   refs [QCReader::PARAMETER_TYPE]          = &parameterType.first;
00079   refs [QCReader::COMPUTATION_TYPE]        = &computationType.first;
00080   refs [QCReader::MAIN_ALGORITHM]          = &mainAlgorithm.first;
00081   refs [QCReader::DIAGO_ALGORITHM]         = &diagoAlgorithm.first;
00082   refs [QCReader::SHIFT_LEVEL_PARAM]       = &shiftingLevelParameter.first;
00083   refs [QCReader::INTG_ACQUISITION_METHOD] = &intgAcquisitionMethod.first;
00084   refs [QCReader::INIT_DENSITY_MATRIX]     = &initDensityMatrix.first;
00085   refs [QCReader::ENERGY_THRESHOLD]        = &energyThreshold.first;
00086   refs [QCReader::ENERGY_MAX_ITER]         = &energyNbMaxIter.first;
00087   refs [QCReader::DERIVATION_TYPE]         = &derivationType.first;
00088   refs [QCReader::DERIV_SHIFT_BHVR]        = &derivShiftBhvr.first;
00089   refs [QCReader::DELTA_Q]                 = &deltaQ.first;
00090   refs [QCReader::NB_PARTITIONS]           = &nbPartitions.first;
00091   refs [QCReader::BUFFER_DIAMETER]         = &buffDiameter.first;
00092   refs [QCReader::CUT_RADIUS]              = &cutRadius.first;
00093   refs [QCReader::READ_PARTITION_FILE]     = &readPartitionFile.first;
00094   refs [QCReader::PARTITION_TYPE]          = &partitionType.first;
00095   refs [QCReader::PARTITIONER_TYPE]        = &partitionerType.first;
00096 }
00097 
00098 
00099 
00103 void
00104 QCGeneralData::reportStrValues (void) {
00105 
00106   updateEnum (modelType, QCCommon::modelTypes);
00107   updateEnum (parameterType, QCCommon::paramTypes);
00108   updateEnum (computationType, QCCommon::computations);
00109   updateEnum (mainAlgorithm, QCCommon::mainAlgorithms);
00110   updateEnum (diagoAlgorithm, QCCommon::diagoAlgorithms);
00111   updateVal  (shiftingLevelParameter);
00112   updateEnum (intgAcquisitionMethod, QCCommon::intgAcqMethods);
00113   updateEnum (initDensityMatrix, QCCommon::initDensityMatrix);
00114   updateVal  (energyThreshold);
00115   updateVal  (energyNbMaxIter);
00116   updateEnum (derivationType, QCCommon::derivationTypes);
00117   updateEnum (derivShiftBhvr, QCCommon::derivShiftBhvrs);
00118   updateVal  (deltaQ);
00119   updateVal  (nbPartitions);
00120   updateVal  (buffDiameter);
00121   updateVal  (cutRadius);
00122   if (readPartitionFile.first == QCCommon::YesStr) {
00123     readPartitionFile.second = true;
00124   } else {
00125     readPartitionFile.second = false;
00126   }
00127   updateEnum (partitionType, QCCommon::partitionTypes);
00128   updateEnum (partitionerType, QCCommon::partitionerTypes);
00129 }
00130 
00131 
00132 QCGeneralData::~QCGeneralData (){
00133   QC_TRACE_END("BEGIN QCGeneralData::~QCGeneralData");  
00134   QC_TRACE_END("  this : " << this << std::endl <<  *this <<std::endl);
00135   QC_TRACE_END("END   QCGeneralData>::~QCGeneralData");  
00136 
00137 }
00138 
00142 ostream& 
00143 operator << (ostream& out, const QCGeneralData& data) {
00144 
00145   out << " * Model Type:                          " 
00146       << data.getModelTypeStr() << " (" << data.getModelType() << ")";
00147   out << "\n * Parameter Type:                      " 
00148       << data.getParameterTypeStr() << " (" << data.getParameterType() << ")";
00149   out << "\n * Calculation Type:                    " 
00150       << data.getComputationTypeStr() << " (" << data.getComputationType() 
00151       << ")";
00152   out << "\n * Main Algorithm:                      " 
00153       << data.getMainAlgorithmStr() << " (" << data.getMainAlgorithm() << ")";
00154   out << "\n * Diagonalization Algorithm:           " 
00155       << data.getDiagoAlgorithmStr() << " (" << data.getDiagoAlgorithm() << ")";
00156   if (data.getMainAlgorithm() == QC_LEVEL_SHIFTING ||   data.getMainAlgorithm() == QC_DC_LEVEL_SHIFTING) {
00157     out << "\n * Shifting Level Parameter:            " 
00158         << data.getShiftingLevelParameter();
00159   }
00160   if (data.isDCComputation()) {
00161     out << "\n * Read Partition File:                 " 
00162         << (data.isReadPartitionFromFile()? "yes" : "no");
00163     out << "\n * Partition Number (Divide & Conquer): " << data.getNbPartitions()
00164         << "\n * Buffer Diameter (Divide & Conquer):  " << data.getBuffDiameter()
00165         << "\n * Cut Radius (Divide & Conquer):       " << data.getCutRadius()
00166         << "\n * Partitioner Type (Divide & Conquer): " 
00167         << data.getPartitionTypeStr() << " ("         << data.getPartitionType() << ")";
00168   }
00169   if(data.getComputationType() != QC_TOOLS){
00170     out << "\n * Repulsion Integrals Aquiring Method: " 
00171         << data.getIntgAcquisitionMethodStr()
00172         << " (" << data.getIntgAcquisitionMethod() << ")";
00173     out << "\n * Energy Convergence Threshold:        " 
00174         << data.getEnergyThreshold();
00175     out << "\n * Energy Maximum Iteration Number:     " 
00176         << data.getEnergyNbMaxIter();
00177     out << "\n * init Density matrix :                " 
00178         << data.getInitDensityMatrixStr()
00179         << " (" << data.getInitDensityMatrix() << ")";
00180     //
00181     if (data.getComputationType() == QC_ENERGY_DERIV) {
00182       out << "\n * Derivation Type:                     " 
00183           << data.getDerivationTypeStr() << " ("
00184           << data.getDerivationType() << ")";
00185       if (data.getDerivationType() == QC_NUMERICAL_DERIVATION) {
00186         if (data.getDerivShiftBhvr() == QC_COMPUTED) {
00187           out << "\n * The derivation shift is calculated at"
00188             " each iteration of the geometry optimization.";
00189         } 
00190         else {
00191           out << "\n * Numerical Procedure Shift:           " << data.getDeltaQ();
00192         }
00193       } 
00194     }
00195   }
00196 
00197   out << endl;
00198   
00199   return out;
00200 }
00201 
00202   void   QCGeneralData::setRadius (const QCFloat R1, const QCFloat R2) 
00203   {  buffDiameter.second= R1 ; buffDiameter.first = toString(R1); 
00204      cutRadius.second=R2; ; cutRadius.first = toString(R2); }
00205  
00206 void   QCGeneralData::setNumberOfPartitions (const int N){
00207   nbPartitions.first = toString(N); 
00208   nbPartitions.second = N;
00209 }

Generated on Sat Jan 28 21:07:26 2006 for QC++ by  doxygen 1.4.4