Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    r244a84 r58ed4a  
    1919#include "memoryallocator.hpp"
    2020#include "periodentafel.hpp"
     21#include "World.hpp"
    2122
    2223/*********************************** Functions for class MoleculeListClass *************************/
     
    313314  Tesselation *TesselStruct = NULL;
    314315  if ((srcmol == NULL) || (mol == NULL)) {
    315     eLog() << Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl;
     316    DoeLog(1) && (eLog()<< Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl);
    316317    return false;
    317318  }
     
    321322  FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL);
    322323  if (TesselStruct == NULL) {
    323     eLog() << Verbose(1) << "Could not tesselate the fixed molecule." << endl;
     324    DoeLog(1) && (eLog()<< Verbose(1) << "Could not tesselate the fixed molecule." << endl);
    324325    return false;
    325326  }
     
    442443    input.open(line.c_str());
    443444    if (input == NULL) {
    444       eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
     445      DoeLog(0) && (eLog()<< Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
    445446      performCriticalExit();
    446447      return false;
     
    638639  int FragmentCounter = 0;
    639640  ofstream output;
    640 
     641  double cell_size_backup[6];
     642  double * const cell_size = World::get()->cell_size;
     643
     644  // backup cell_size
     645  for (int i=0;i<6;i++)
     646    cell_size_backup[i] = cell_size[i];
    641647  // store the fragments as config and as xyz
    642648  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     
    646652      strcpy(PathBackup, path);
    647653    else {
    648       eLog() << Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl;
     654      DoeLog(0) && (eLog()<< Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl);
    649655      performCriticalExit();
    650656    }
     
    682688      j += k + 1;
    683689      BoxDimension.x[k] = 2.5 * (configuration->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
    684       (*ListRunner)->cell_size[j] += BoxDimension.x[k] * 2.;
     690      cell_size[j] = BoxDimension.x[k] * 2.;
    685691    }
    686692    (*ListRunner)->Translate(&BoxDimension);
     
    724730  // printing final number
    725731  Log() << Verbose(2) << "Final number of fragments: " << FragmentCounter << "." << endl;
     732
     733  // restore cell_size
     734  for (int i=0;i<6;i++)
     735    cell_size[i] = cell_size_backup[i];
    726736
    727737  return result;
     
    776786
    777787  // 1. dissect the molecule into connected subgraphs
    778   configuration->BG->ConstructBondGraph(mol);
     788  if (!configuration->BG->ConstructBondGraph(mol)) {
     789    delete (mol);
     790    DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     791    return;
     792  }
    779793
    780794  // 2. scan for connected subgraphs
     
    783797  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
    784798  delete(BackEdgeStack);
     799  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
     800    delete (mol);
     801    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
     802    return;
     803  }
    785804
    786805  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
     
    824843    Walker = mol->start->next;
    825844    if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
    826       eLog() << Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl;
     845      DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl);
    827846      performCriticalExit();
    828847    }
     
    833852      molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
    834853    } else {
    835       eLog() << Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl;
     854      DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl);
    836855      performCriticalExit();
    837856    }
Note: See TracChangeset for help on using the changeset viewer.