Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.cpp

    rc94eeb r906822  
    2727#include "tesselation.hpp"
    2828#include "vector.hpp"
    29 #include "Matrix.hpp"
    3029#include "World.hpp"
    3130#include "Plane.hpp"
     
    8079void molecule::setName(const std::string _name){
    8180  OBSERVE;
    82   cout << "Set name of molecule " << getId() << " to " << _name << endl;
    8381  strncpy(name,_name.c_str(),MAXSTRINGSIZE);
    8482}
     
    285283  Vector Orthovector1, Orthovector2;  // temporary vectors in coordination construction
    286284  Vector InBondvector;    // vector in direction of *Bond
    287   Matrix matrix;
     285  double *matrix = NULL;
    288286  bond *Binder = NULL;
    289287  double * const cell_size = World::getInstance().getDomain();
     
    308306      } // (signs are correct, was tested!)
    309307    }
    310     double *matrix_double = ReturnFullMatrixforSymmetric(cell_size);
    311     matrix = Matrix(matrix_double);
    312     delete[](matrix_double);
     308    matrix = ReturnFullMatrixforSymmetric(cell_size);
    313309    Orthovector1.MatrixMultiplication(matrix);
    314310    InBondvector -= Orthovector1; // subtract just the additional translation
     311    delete[](matrix);
    315312    bondlength = InBondvector.Norm();
    316313//    Log() << Verbose(4) << "Corrected InBondvector is now: ";
     
    543540      break;
    544541  }
     542  delete[](matrix);
    545543
    546544//  Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl;
     
    741739  else
    742740    length = strlen(molname) - strlen(endname);
    743   cout << "Set name of molecule " << getId() << " to " << molname << endl;
    744741  strncpy(name, molname, length);
    745742  name[length]='\0';
     
    883880        ElementNo[i] = current++;
    884881    }
    885     ActOnAllAtoms( &atom::OutputArrayIndexed, (ostream * const) output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL );
     882    ActOnAllAtoms( &atom::OutputArrayIndexed, output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL );
    886883    return true;
    887884  }
     
    10061003  for(int i=MAX_ELEMENTS;i--;)
    10071004    ElementCount += (ElementsInMolecule[i] != 0 ? 1 : 0);
     1005};
     1006
     1007
     1008/** Counts necessary number of valence electrons and returns number and SpinType.
     1009 * \param configuration containing everything
     1010 */
     1011void molecule::CalculateOrbitals(class config &configuration)
     1012{
     1013  configuration.MaxPsiDouble = configuration.PsiMaxNoDown = configuration.PsiMaxNoUp = configuration.PsiType = 0;
     1014  for(int i=MAX_ELEMENTS;i--;) {
     1015    if (ElementsInMolecule[i] != 0) {
     1016      //Log() << Verbose(0) << "CalculateOrbitals: " << elemente->FindElement(i)->name << " has a valence of " << (int)elemente->FindElement(i)->Valence << " and there are " << ElementsInMolecule[i] << " of it." << endl;
     1017      configuration.MaxPsiDouble += ElementsInMolecule[i]*((int)elemente->FindElement(i)->Valence);
     1018    }
     1019  }
     1020  configuration.PsiMaxNoDown = configuration.MaxPsiDouble/2 + (configuration.MaxPsiDouble % 2);
     1021  configuration.PsiMaxNoUp = configuration.MaxPsiDouble/2;
     1022  configuration.MaxPsiDouble /= 2;
     1023  configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1;
     1024  if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) {
     1025    configuration.ProcPEGamma /= 2;
     1026    configuration.ProcPEPsi *= 2;
     1027  } else {
     1028    configuration.ProcPEGamma *= configuration.ProcPEPsi;
     1029    configuration.ProcPEPsi = 1;
     1030  }
     1031  cout << configuration.PsiMaxNoDown << ">" << configuration.PsiMaxNoUp << endl;
     1032  if (configuration.PsiMaxNoDown > configuration.PsiMaxNoUp) {
     1033    configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoDown;
     1034    cout << configuration.PsiMaxNoDown << " " << configuration.InitMaxMinStopStep << endl;
     1035  } else {
     1036    configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoUp;
     1037    cout << configuration.PsiMaxNoUp << " " << configuration.InitMaxMinStopStep << endl;
     1038  }
    10081039};
    10091040
Note: See TracChangeset for help on using the changeset viewer.