QCSystem.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 #include <iomanip>
00020 //
00021 #include "QCSystem.hpp"
00022 #include "QCMndoParam.hpp"
00023 #include "QCAm1Param.hpp"
00024 #include "QCPm3Param.hpp"
00025 #include "QCTable.hpp"
00029 QCSystem::QCSystem (void) :  QCOrdering(), QCAtoms(),systemCharge(0), spinMultiplicity(0), 
00030                              nbAtomicOrbitals(0),  nbElectrons(0) 
00031 {}
00035 template <class TPParam>
00036 void
00037 QCSystem::setParamIndexes (const TPParam *QCRestrict parameters,  int nbAtomTypes) {
00038   
00039   for (int i=0; i<nbAtoms; i++) {
00040     int j = 0;
00041     bool found = false;
00042     
00043     while (!found && j<nbAtomTypes) {
00044       
00045       if (parameters[j].getIdentifier() == getType(i)) {
00046         found = true;
00047         setParamIndexAt(i, j);
00048       } else {
00049         j++;
00050       }
00051     }
00052     
00053     if (!found) {
00057       exit(EXIT_FAILURE);
00058       
00059     }
00060   }
00061 }
00062 
00063 
00064 
00065 
00069 template <class TPParam>
00070 void 
00071 QCSystem::setSystemNumbers (const TPParam *QCRestrict parameters) {
00072 
00073 
00074   nbAtomicOrbitals = 0;
00075   nbElectrons      = 0;
00076 
00077   for (int i=0; i<nbAtoms; i++) {
00078     
00083     setFirstAOAt(i, nbAtomicOrbitals);
00084     nbAtomicOrbitals += parameters[getParamIndexAt(i)].getNbAO();
00085     nbElectrons += parameters[getParamIndexAt(i)].getNbValenceElec();
00086   }
00090   nbElectrons -= systemCharge;
00091 }
00095 ostream& 
00096 operator << (ostream& out, const QCSystem& system) {
00097 
00098   out << " * Atoms:             " << endl
00099       << system.QCAtoms::asBase()
00100       << "\n * Nb Atoms:          " << system.getNbAtoms()
00101       << "\n * System Charge:     " << system.getSystemCharge()
00102       << "\n * Spin Multiplicity: " << system.getSpinMultiplicity()
00103       << "\n * NbAtomicOrbitals:  " << system.getNbAtomicOrbitals()
00104       << "\n * NbElectrons:       " << system.getNbElectrons() 
00105       << endl;
00106 
00107   return out;
00108 }
00109 //
00110 void QCSystem::writeQCIAtomicSystem( std::ofstream& out){
00111   out << "//"<<std::endl 
00112       << "// System  "<<std::endl
00113       << "// Total charge of the system"<<std::endl 
00114       <<"QCPP SYSTEM CHARGE"<<std::endl <<this->getSystemCharge()<<std::endl
00115       << "//Spin multiplicity   "<<std::endl 
00116       <<"QCPP SPIN MULTIPLICITY"<<std::endl <<this->getSpinMultiplicity()<<std::endl
00117       << "//"<<std::endl 
00118       <<"//Number of atoms"<<std::endl 
00119       <<"QCPP NB ATOMS"<<std::endl 
00120       << this->getNbAtoms() <<std::endl ;
00121   //
00122   out << std::setprecision(6);
00123   for (int i=0; i< this->getNbAtoms(); ++i) {
00124     out <<"   "<< table[QCAtoms::atomType[i]] //table[QCAtoms::atomType[i]]
00125         << std::setw(13) << QCAtoms::atoms[i * DIMENSION + COORDX]
00126         << std::setw(13) << QCAtoms::atoms[i * DIMENSION + COORDY]
00127         << std::setw(13) << QCAtoms::atoms[i * DIMENSION + COORDZ]
00128         << std::setw(8) << i + 1   // a cause de la numerotation C
00129         << "   " << QCAtoms::_fragName[i] << "  "
00130         << QCAtoms::_connect[i].size() ;
00131     for ( int j = 0 ; j < static_cast<int>(QCAtoms::_connect[i].size()); ++j){
00132       out << "  "<< QCAtoms::_connect[i][j] +1 ; // C convention
00133     }
00134     out << std::endl ;
00135       //
00136   }
00137   
00138 }
00139 
00140 
00141 
00142 
00143 
00147 QCPARAMETER_METH_EXPL_INST_PARAM(void QCSystem::setParamIndexes,
00148                                  int nbAtomTypes);
00149 
00150 QCPARAMETER_METH_EXPL_INST(void QCSystem::setSystemNumbers);

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