QCManager.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 
00021 #include "QCCommon.hpp"
00022 #include "QCManager.hpp"
00023 #include "QCReader.hpp"
00024 #include "QCGlobalSystem.hpp"
00025 #include "QCMDSystem.hpp"
00026 #include "QCDistMDSystem.hpp"
00027 #include "QCMndo.hpp"
00028 #include "QCMndoParam.hpp"
00029 #include "QCAm1.hpp"
00030 #include "QCAm1Param.hpp"
00031 #include "QCPm3.hpp"
00032 #include "QCPm3Param.hpp"
00033 #include "QCOverlapGtr.hpp"
00034 #include "QCSCFAlgo.hpp"
00035 #include "QCDCAlgo.hpp"
00036 
00037 
00038 
00042 template <class TPModel, class TPSystem>
00043 QCManager<TPModel, TPSystem>::QCManager (int& argc, char **&  argv) :system(argc,argv), 
00044                                                                      _files(), generalData(),
00045                                                                      parameters(NULL), nbParam(0),
00046                                                                      model(), solver(), memory(),
00047                                                                      partitioner(NULL)
00048 {}
00052 template <class TPModel, class TPSystem>
00053 QCManager<TPModel, TPSystem>::QCManager (void) :system(), _files(), generalData(),
00054                                                 parameters(NULL), nbParam(0),
00055                                                 model(), solver(), memory(),
00056                                                 partitioner(NULL)
00057 {}
00061 template <class TPModel, class TPSystem>
00062 QCManager<TPModel, TPSystem>::~QCManager (void) 
00063 {
00064   QC_TRACE_END("BEGIN QCManager<TPModel, TPSystem>::~QCManager");  
00065   if (parameters != NULL){
00066     delete [] parameters;
00067   }
00068   if (partitioner != NULL){
00069     delete partitioner;
00070   }
00071   QC_TRACE_END("END   QCManager<TPModel, TPSystem>::~QCManager");  
00072 }
00076 template <class TPModel, class TPSystem>
00077 void
00078 QCManager<TPModel, TPSystem>::readAtoms (const string& path) {
00079   QCReader reader;
00080 
00081   reader.readAtomsFile(this->_files.getAtomsFile() + INPUT_SUFFIX, system, path);
00082 }
00083 
00087 template <class TPModel, class TPSystem>
00088 void QCManager<TPModel, TPSystem>::readParameters (const string& path) {
00089   QCReader reader;
00090   reader.readParameterFile(this->_files.getParameterFile() + INPUT_SUFFIX, 
00091                            parameters, nbParam, path);
00092 }
00093 
00097 template <class TPModel, class TPSystem>
00098 void 
00099 QCManager<TPModel, TPSystem>::initTools (const QCFiles& files, const QCGeneralData& data, const string& path) {
00100   //  
00101   QC_TRACE_INIT("BEGIN QCManager<TPModel, TPSystem>::init");
00102   this->setFiles(files);
00103   this->setGeneralities(data);
00104   this->readParameters(QCCommon::DataBaseDirName);
00105   this->readAtoms(path);
00106   //
00107   system.QCSystem::init(parameters, nbParam);
00108   //
00109   QC_TRACE_INIT("END QCManager<TPModel, TPSystem>::init");
00110 }  
00114 template <class TPModel, class TPSystem>
00115 void 
00116 QCManager<TPModel, TPSystem>::init (const QCFiles& files, const QCGeneralData& data, const string& path) {
00117   //  
00118   QC_TRACE_INIT("BEGIN QCManager<TPModel, TPSystem>::init");
00119   this->setFiles(files);
00120   this->setGeneralities(data);
00121   this->readParameters(QCCommon::DataBaseDirName);
00122   this->readAtoms(path);
00123   system.checkData(data) ;
00124   //
00125   // DEBUG OLIVIER
00126   if(data.isDCComputation()){
00127     
00128     int nb       = system.getNbAtoms();
00129     //    system.computeAA();
00130     int * charge = new int [nb];
00131   
00132     system.QCSystem::init(parameters, nbParam);
00133     //
00134     //  TODO - il faut ameliorer cela on peut le faire directement sans passer par un tableau intermediare
00135     //
00136     for (int i = 0; i < nb; ++i) {
00137       charge[i] = parameters[system.getParamIndexAt(i)].getNbAO();
00138     }
00139 
00140     system.buildPartitioner(this->partitioner, data, _files, charge, nb);  
00141     delete [] charge; 
00142   }
00143   //  
00144   system.init(*this, path);
00145   //
00146   QCOverlapGtr< QCSymMatrix >::FillExpHalfVector(*this);
00147   //
00148   solver.init(data);
00149   //
00150   QC_TRACE_INIT("END QCManager<TPModel, TPSystem>::init");
00151 }
00152 
00153 
00154 
00158 template <class TPModel, class TPSystem>
00159 void
00160 QCManager<TPModel, TPSystem>::runComputations (void) {
00161 
00162   
00163   // Evaluation de l utilisation memoire
00164   memory.evaluateUsedMemory();
00165   
00166   solver.solve (*this);
00167 
00168   // Compute gradient
00169   if (generalData.getComputationType() == QC_ENERGY_DERIV) {
00170     system.computeEnergyDerivatives(*this);
00171   }
00172 
00173 }
00174 
00178 QCMODEL_SYSTEM_EXPL_INST(QCManager);
00179 

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