Ignore:
Timestamp:
Nov 4, 2009, 7:56:04 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
4ef101, aa8542
Parents:
ec70ec
Message:

Huge change from ofstream * (const) out --> Log().

  • first shift was done via regular expressions
  • then via error messages from the code
  • note that class atom, class element and class molecule kept in parts their output stream, was they print to file.
  • make check runs fine
  • MISSING: Verbosity is not fixed for everything (i.e. if no endl; is present and next has Verbose(0) ...)

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecule_geometry.cpp

    rec70ec r543ce4  
    1212#include "helpers.hpp"
    1313#include "leastsquaremin.hpp"
     14#include "log.hpp"
    1415#include "memoryallocator.hpp"
    1516#include "molecule.hpp"
     
    2122 * \param *out output stream for debugging
    2223 */
    23 bool molecule::CenterInBox(ofstream *out)
     24bool molecule::CenterInBox()
    2425{
    2526  bool status = true;
    26   const Vector *Center = DetermineCenterOfAll(out);
     27  const Vector *Center = DetermineCenterOfAll();
    2728  double *M = ReturnFullMatrixforSymmetric(cell_size);
    2829  double *Minv = InverseMatrix(M);
     
    4243 * \param *out output stream for debugging
    4344 */
    44 bool molecule::BoundInBox(ofstream *out)
     45bool molecule::BoundInBox()
    4546{
    4647  bool status = true;
     
    6061 * \param *max coordinates of other edge, specifying box dimensions.
    6162 */
    62 void molecule::CenterEdge(ofstream *out, Vector *max)
     63void molecule::CenterEdge(Vector *max)
    6364{
    6465  Vector *min = new Vector;
    6566
    66 //  *out << Verbose(3) << "Begin of CenterEdge." << endl;
     67//  Log() << Verbose(3) << "Begin of CenterEdge." << endl;
    6768  atom *ptr = start->next;  // start at first in list
    6869  if (ptr != end) {   //list not empty?
     
    7980      }
    8081    }
    81 //    *out << Verbose(4) << "Maximum is ";
     82//    Log() << Verbose(4) << "Maximum is ";
    8283//    max->Output(out);
    83 //    *out << ", Minimum is ";
     84//    Log() << Verbose(0) << ", Minimum is ";
    8485//    min->Output(out);
    85 //    *out << endl;
     86//    Log() << Verbose(0) << endl;
    8687    min->Scale(-1.);
    8788    max->AddVector(min);
     
    9091  }
    9192  delete(min);
    92 //  *out << Verbose(3) << "End of CenterEdge." << endl;
     93//  Log() << Verbose(3) << "End of CenterEdge." << endl;
    9394};
    9495
     
    9798 * \param *center return vector for translation vector
    9899 */
    99 void molecule::CenterOrigin(ofstream *out)
     100void molecule::CenterOrigin()
    100101{
    101102  int Num = 0;
     
    117118
    118119/** Returns vector pointing to center of all atoms.
    119  * \param *out output stream for debugging
    120120 * \return pointer to center of all vector
    121121 */
    122 Vector * molecule::DetermineCenterOfAll(ofstream *out) const
     122Vector * molecule::DetermineCenterOfAll() const
    123123{
    124124  atom *ptr = start->next;  // start at first in list
     
    138138    a->Scale(1./Num); // divide through total mass (and sign for direction)
    139139  }
    140   //cout << Verbose(1) << "Resulting center of gravity: ";
    141   //a->Output(out);
    142   //cout << endl;
    143140  return a;
    144141};
     
    148145 * \return pointer to center of gravity vector
    149146 */
    150 Vector * molecule::DetermineCenterOfGravity(ofstream *out)
     147Vector * molecule::DetermineCenterOfGravity()
    151148{
    152149  atom *ptr = start->next;  // start at first in list
     
    167164    a->Scale(-1./Num); // divide through total mass (and sign for direction)
    168165  }
    169 //  *out << Verbose(1) << "Resulting center of gravity: ";
     166//  Log() << Verbose(1) << "Resulting center of gravity: ";
    170167//  a->Output(out);
    171 //  *out << endl;
     168//  Log() << Verbose(0) << endl;
    172169  return a;
    173170};
     
    177174 * \param *center return vector for translation vector
    178175 */
    179 void molecule::CenterPeriodic(ofstream *out)
     176void molecule::CenterPeriodic()
    180177{
    181178  DeterminePeriodicCenter(Center);
     
    187184 * \param *center return vector for translation vector
    188185 */
    189 void molecule::CenterAtVector(ofstream *out, Vector *newcenter)
     186void molecule::CenterAtVector(Vector *newcenter)
    190187{
    191188  Center.CopyVector(newcenter);
     
    277274              if ((fabs(tmp)) > BondDistance) {
    278275                flag = false;
    279                 cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl;
     276                Log() << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl;
    280277                if (tmp > 0)
    281278                  Translationvector.x[j] -= 1.;
     
    288285        Testvector.MatrixMultiplication(matrix);
    289286        Center.AddVector(&Testvector);
    290         cout << Verbose(1) << "vector is: ";
    291         Testvector.Output((ofstream *)&cout);
    292         cout << endl;
     287        Log() << Verbose(1) << "vector is: ";
     288        Testvector.Output();
     289        Log() << Verbose(0) << endl;
    293290#ifdef ADDHYDROGEN
    294291        // now also change all hydrogens
     
    300297            Testvector.MatrixMultiplication(matrix);
    301298            Center.AddVector(&Testvector);
    302             cout << Verbose(1) << "Hydrogen vector is: ";
    303             Testvector.Output((ofstream *)&cout);
    304             cout << endl;
     299            Log() << Verbose(1) << "Hydrogen vector is: ";
     300            Testvector.Output();
     301            Log() << Verbose(0) << endl;
    305302          }
    306303        }
     
    318315 * TODO treatment of trajetories missing
    319316 */
    320 void molecule::PrincipalAxisSystem(ofstream *out, bool DoRotate)
     317void molecule::PrincipalAxisSystem(bool DoRotate)
    321318{
    322319  atom *ptr = start;  // start at first in list
    323320  double InertiaTensor[NDIM*NDIM];
    324   Vector *CenterOfGravity = DetermineCenterOfGravity(out);
    325 
    326   CenterPeriodic(out);
     321  Vector *CenterOfGravity = DetermineCenterOfGravity();
     322
     323  CenterPeriodic();
    327324
    328325  // reset inertia tensor
     
    347344  }
    348345  // print InertiaTensor for debugging
    349   *out << "The inertia tensor is:" << endl;
     346  Log() << Verbose(0) << "The inertia tensor is:" << endl;
    350347  for(int i=0;i<NDIM;i++) {
    351348    for(int j=0;j<NDIM;j++)
    352       *out << InertiaTensor[i*NDIM+j] << " ";
    353     *out << endl;
    354   }
    355   *out << endl;
     349      Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ";
     350    Log() << Verbose(0) << endl;
     351  }
     352  Log() << Verbose(0) << endl;
    356353
    357354  // diagonalize to determine principal axis system
     
    365362
    366363  for(int i=0;i<NDIM;i++) {
    367     *out << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i);
    368     *out << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl;
     364    Log() << Verbose(1) << "eigenvalue = " << gsl_vector_get(eval, i);
     365    Log() << Verbose(0) << ", eigenvector = (" << evec->data[i * evec->tda + 0] << "," << evec->data[i * evec->tda + 1] << "," << evec->data[i * evec->tda + 2] << ")" << endl;
    369366  }
    370367
    371368  // check whether we rotate or not
    372369  if (DoRotate) {
    373     *out << Verbose(1) << "Transforming molecule into PAS ... ";
     370    Log() << Verbose(1) << "Transforming molecule into PAS ... ";
    374371    // the eigenvectors specify the transformation matrix
    375372    ActOnAllVectors( &Vector::MatrixMultiplication, (const double *) evec->data );
    376     *out << "done." << endl;
     373    Log() << Verbose(0) << "done." << endl;
    377374
    378375    // summing anew for debugging (resulting matrix has to be diagonal!)
     
    399396    }
    400397    // print InertiaTensor for debugging
    401     *out << "The inertia tensor is:" << endl;
     398    Log() << Verbose(0) << "The inertia tensor is:" << endl;
    402399    for(int i=0;i<NDIM;i++) {
    403400      for(int j=0;j<NDIM;j++)
    404         *out << InertiaTensor[i*NDIM+j] << " ";
    405       *out << endl;
    406     }
    407     *out << endl;
     401        Log() << Verbose(0) << InertiaTensor[i*NDIM+j] << " ";
     402      Log() << Verbose(0) << endl;
     403    }
     404    Log() << Verbose(0) << endl;
    408405  }
    409406
     
    428425
    429426  // rotate on z-x plane
    430   cout << Verbose(0) << "Begin of Aligning all atoms." << endl;
     427  Log() << Verbose(0) << "Begin of Aligning all atoms." << endl;
    431428  alpha = atan(-n->x[0]/n->x[2]);
    432   cout << Verbose(1) << "Z-X-angle: " << alpha << " ... ";
     429  Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ";
    433430  while (ptr->next != end) {
    434431    ptr = ptr->next;
     
    446443  n->x[0] =  cos(alpha) * tmp +  sin(alpha) * n->x[2];
    447444  n->x[2] = -sin(alpha) * tmp +  cos(alpha) * n->x[2];
    448   cout << Verbose(1) << "alignment vector after first rotation: ";
    449   n->Output((ofstream *)&cout);
    450   cout << endl;
     445  Log() << Verbose(1) << "alignment vector after first rotation: ";
     446  n->Output();
     447  Log() << Verbose(0) << endl;
    451448
    452449  // rotate on z-y plane
    453450  ptr = start;
    454451  alpha = atan(-n->x[1]/n->x[2]);
    455   cout << Verbose(1) << "Z-Y-angle: " << alpha << " ... ";
     452  Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ";
    456453  while (ptr->next != end) {
    457454    ptr = ptr->next;
     
    470467  n->x[2] = -sin(alpha) * tmp +  cos(alpha) * n->x[2];
    471468
    472   cout << Verbose(1) << "alignment vector after second rotation: ";
    473   n->Output((ofstream *)&cout);
    474   cout << Verbose(1) << endl;
    475   cout << Verbose(0) << "End of Aligning all atoms." << endl;
     469  Log() << Verbose(1) << "alignment vector after second rotation: ";
     470  n->Output();
     471  Log() << Verbose(1) << endl;
     472  Log() << Verbose(0) << "End of Aligning all atoms." << endl;
    476473};
    477474
Note: See TracChangeset for help on using the changeset viewer.