Changes in / [dd97a9:5d6f38]


Ignore:
Files:
256 added
146 deleted
61 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    rdd97a9 r5d6f38  
    134134AC_CONFIG_FILES([tests/regression/molecuilder], [chmod +x tests/regression/molecuilder])
    135135AC_CONFIG_FILES([
     136        tests/CodeChecks/atlocal
     137        tests/CodeChecks/Makefile])
     138AC_CONFIG_FILES([
    136139        tests/Tesselations/Makefile
    137140        tests/Tesselations/defs])
     
    145148        src/Makefile
    146149        src/Actions/Makefile
    147   src/Exceptions/Makefile
    148   src/Helpers/Makefile
    149   src/LinearAlgebra/Makefile
    150   src/Parser/Makefile
     150        src/Exceptions/Makefile
     151        src/Helpers/Makefile
     152        src/LinearAlgebra/Makefile
     153        src/Parser/Makefile
    151154        src/UIElements/Makefile
    152         src/unittests/Makefile])
     155])
     156AC_CONFIG_FILES([
     157        src/unittests/Makefile
     158        src/Actions/unittests/Makefile
     159        src/Descriptors/unittests/Makefile
     160        src/Helpers/unittests/Makefile
     161        src/LinearAlgebra/unittests/Makefile
     162  src/Parser/unittests/Makefile
     163        src/Patterns/unittests/Makefile
     164  src/UIElements/Menu/unittests/Makefile
     165])
    153166AC_OUTPUT
  • src/Actions/CommandAction/BondLengthTableAction.cpp

    rdd97a9 r5d6f38  
    4747  if (configuration->BG == NULL) {
    4848    configuration->BG = new BondGraph(configuration->GetIsAngstroem());
    49     if ((!params.BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName.string()))) {
     49    if ((!params.BondGraphFileName.empty())
     50        && boost::filesystem::exists(params.BondGraphFileName)
     51        && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName.string()))) {
    5052      DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    5153      return Action::success;
  • src/Actions/Makefile.am

    rdd97a9 r5d6f38  
    1515  ${MOLECULEACTIONSOURCE} \
    1616  ${PARSERACTIONSOURCE} \
    17   ${SELECTIONACTIONSOURCE} \
     17  ${SELECTIONATOMACTIONSOURCE} \
     18  ${SELECTIONMOLECULEACTIONSOURCE} \
    1819  ${TESSELATIONACTIONSOURCE} \
    1920  ${WORLDACTIONSOURCE} \
     
    2930  ${MOLECULEACTIONHEADER} \
    3031  ${PARSERACTIONHEADER} \
    31   ${SELECTIONACTIONHEADER} \
     32  ${SELECTIONATOMACTIONHEADER} \
     33  ${SELECTIONMOLECULEACTIONHEADER} \
    3234  ${TESSELATIONACTIONHEADER} \
    3335  ${WORLDACTIONHEADER} \
     
    122124  MoleculeAction/VerletIntegrationAction.hpp
    123125                 
    124 SELECTIONACTIONSOURCE = \
    125         SelectionAction/AllAtomsAction.cpp \
    126         SelectionAction/AllAtomsInsideCuboidAction.cpp \
    127         SelectionAction/AllAtomsInsideSphereAction.cpp \
    128         SelectionAction/AllAtomsOfMoleculeAction.cpp \
    129         SelectionAction/AllMoleculesAction.cpp \
    130         SelectionAction/AtomByElementAction.cpp \
    131         SelectionAction/AtomByIdAction.cpp \
    132         SelectionAction/ClearAllAtomsAction.cpp \
    133         SelectionAction/ClearAllMoleculesAction.cpp \
    134         SelectionAction/MoleculeByFormulaAction.cpp \
    135         SelectionAction/MoleculeByIdAction.cpp \
    136         SelectionAction/MoleculeByOrderAction.cpp \
    137         SelectionAction/MoleculeOfAtomAction.cpp \
    138         SelectionAction/NotAllAtomsAction.cpp \
    139         SelectionAction/NotAllAtomsInsideCuboidAction.cpp \
    140         SelectionAction/NotAllAtomsInsideSphereAction.cpp \
    141         SelectionAction/NotAllAtomsOfMoleculeAction.cpp \
    142         SelectionAction/NotAllMoleculesAction.cpp \
    143         SelectionAction/NotAtomByElementAction.cpp \
    144         SelectionAction/NotAtomByIdAction.cpp \
    145         SelectionAction/NotMoleculeByFormulaAction.cpp \
    146         SelectionAction/NotMoleculeByIdAction.cpp \
    147         SelectionAction/NotMoleculeOfAtomAction.cpp
    148 SELECTIONACTIONHEADER = \
    149         SelectionAction/AllAtomsAction.hpp \
    150         SelectionAction/AllAtomsInsideCuboidAction.hpp \
    151         SelectionAction/AllAtomsInsideSphereAction.hpp \
    152         SelectionAction/AllAtomsOfMoleculeAction.hpp \
    153         SelectionAction/AllMoleculesAction.hpp \
    154         SelectionAction/AtomByElementAction.hpp \
    155         SelectionAction/AtomByIdAction.hpp \
    156         SelectionAction/ClearAllAtomsAction.hpp \
    157         SelectionAction/ClearAllMoleculesAction.hpp \
    158         SelectionAction/MoleculeByFormulaAction.hpp \
    159         SelectionAction/MoleculeByIdAction.hpp \
    160         SelectionAction/MoleculeByOrderAction.hpp \
    161         SelectionAction/MoleculeOfAtomAction.hpp \
    162         SelectionAction/NotAllAtomsAction.hpp \
    163         SelectionAction/NotAllAtomsInsideCuboidAction.hpp \
    164         SelectionAction/NotAllAtomsInsideSphereAction.hpp \
    165         SelectionAction/NotAllAtomsOfMoleculeAction.hpp \
    166         SelectionAction/NotAllMoleculesAction.hpp \
    167         SelectionAction/NotAtomByElementAction.hpp \
    168         SelectionAction/NotAtomByIdAction.hpp \
    169         SelectionAction/NotMoleculeByFormulaAction.hpp \
    170         SelectionAction/NotMoleculeByIdAction.hpp \
    171         SelectionAction/NotMoleculeOfAtomAction.cpp
    172 
     126SELECTIONATOMACTIONSOURCE = \
     127        SelectionAction/Atoms/AllAtomsAction.cpp \
     128        SelectionAction/Atoms/AllAtomsInsideCuboidAction.cpp \
     129        SelectionAction/Atoms/AllAtomsInsideSphereAction.cpp \
     130        SelectionAction/Atoms/AllAtomsOfMoleculeAction.cpp \
     131        SelectionAction/Atoms/AtomByElementAction.cpp \
     132        SelectionAction/Atoms/AtomByIdAction.cpp \
     133        SelectionAction/Atoms/ClearAllAtomsAction.cpp \
     134        SelectionAction/Atoms/NotAllAtomsAction.cpp \
     135        SelectionAction/Atoms/NotAllAtomsInsideCuboidAction.cpp \
     136        SelectionAction/Atoms/NotAllAtomsInsideSphereAction.cpp \
     137        SelectionAction/Atoms/NotAllAtomsOfMoleculeAction.cpp \
     138        SelectionAction/Atoms/NotAtomByElementAction.cpp \
     139        SelectionAction/Atoms/NotAtomByIdAction.cpp
     140SELECTIONATOMACTIONHEADER = \
     141        SelectionAction/Atoms/AllAtomsAction.hpp \
     142        SelectionAction/Atoms/AllAtomsInsideCuboidAction.hpp \
     143        SelectionAction/Atoms/AllAtomsInsideSphereAction.hpp \
     144        SelectionAction/Atoms/AllAtomsOfMoleculeAction.hpp \
     145        SelectionAction/Atoms/AtomByElementAction.hpp \
     146        SelectionAction/Atoms/AtomByIdAction.hpp \
     147        SelectionAction/Atoms/ClearAllAtomsAction.hpp \
     148        SelectionAction/Atoms/NotAllAtomsAction.hpp \
     149        SelectionAction/Atoms/NotAllAtomsInsideCuboidAction.hpp \
     150        SelectionAction/Atoms/NotAllAtomsInsideSphereAction.hpp \
     151        SelectionAction/Atoms/NotAllAtomsOfMoleculeAction.hpp \
     152        SelectionAction/Atoms/NotAtomByElementAction.hpp \
     153        SelectionAction/Atoms/NotAtomByIdAction.hpp
     154
     155SELECTIONMOLECULEACTIONSOURCE = \
     156        SelectionAction/Molecules/AllMoleculesAction.cpp \
     157        SelectionAction/Molecules/ClearAllMoleculesAction.cpp \
     158        SelectionAction/Molecules/MoleculeByFormulaAction.cpp \
     159        SelectionAction/Molecules/MoleculeByIdAction.cpp \
     160        SelectionAction/Molecules/MoleculeByNameAction.cpp \
     161        SelectionAction/Molecules/MoleculeByOrderAction.cpp \
     162        SelectionAction/Molecules/MoleculeOfAtomAction.cpp \
     163        SelectionAction/Molecules/NotAllMoleculesAction.cpp \
     164        SelectionAction/Molecules/NotMoleculeByFormulaAction.cpp \
     165        SelectionAction/Molecules/NotMoleculeByIdAction.cpp \
     166        SelectionAction/Molecules/NotMoleculeByNameAction.cpp \
     167        SelectionAction/Molecules/NotMoleculeByOrderAction.cpp \
     168        SelectionAction/Molecules/NotMoleculeOfAtomAction.cpp
     169SELECTIONMOLECULEACTIONHEADER = \
     170        SelectionAction/Molecules/AllMoleculesAction.hpp \
     171        SelectionAction/Molecules/ClearAllMoleculesAction.hpp \
     172        SelectionAction/Molecules/MoleculeByFormulaAction.hpp \
     173        SelectionAction/Molecules/MoleculeByIdAction.hpp \
     174        SelectionAction/Molecules/MoleculeByNameAction.hpp \
     175        SelectionAction/Molecules/MoleculeByOrderAction.hpp \
     176        SelectionAction/Molecules/MoleculeOfAtomAction.hpp \
     177        SelectionAction/Molecules/NotAllMoleculesAction.hpp \
     178        SelectionAction/Molecules/NotMoleculeByFormulaAction.hpp \
     179        SelectionAction/Molecules/NotMoleculeByIdAction.hpp \
     180        SelectionAction/Molecules/NotMoleculeByNameAction.hpp \
     181        SelectionAction/Molecules/NotMoleculeByOrderAction.hpp \
     182        SelectionAction/Molecules/NotMoleculeOfAtomAction.hpp
     183       
    173184TESSELATIONACTIONSOURCE = \
    174185  TesselationAction/ConvexEnvelopeAction.cpp \
  • src/Actions/MoleculeAction/LoadAction.cpp

    rdd97a9 r5d6f38  
    6464    boost::filesystem::ifstream input;
    6565    input.open(params.filename);
    66     FormatParserStorage::getInstance().get(input, FilenameSuffix);
     66    FormatParserStorage::getInstance().load(input, FilenameSuffix);
    6767    input.close();
    6868
  • src/Actions/MoleculeAction/SaveAction.cpp

    rdd97a9 r5d6f38  
    6060  output.open(params.filename);
    6161  if (!output.fail()) {
    62     FormatParserStorage::getInstance().put(output, FilenameSuffix);
     62    FormatParserStorage::getInstance().saveSelectedMolecules(output, FilenameSuffix);
    6363  } else {
    6464    DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << params.filename << "." << endl);
     
    6666  output.close();
    6767
    68   return Action::failure;
     68  return Action::success;
    6969}
    7070
  • src/Actions/MoleculeAction/SaveAction.def

    rdd97a9 r5d6f38  
    3030
    3131// finally the information stored in the ActionTrait specialization
    32 #define DESCRIPTION "save world as file of certain type"
     32#define DESCRIPTION "save selected molecules as file of certain type"
    3333#define SHORTFORM "s"
  • src/Actions/WorldAction/InputAction.cpp

    rdd97a9 r5d6f38  
    7171    // parse the file
    7272    test.open(params.filename);
    73     FormatParserStorage::getInstance().get(test, FilenameSuffix);
     73    FormatParserStorage::getInstance().load(test, FilenameSuffix);
    7474    test.close();
    7575
  • src/Actions/WorldAction/OutputAction.cpp

    rdd97a9 r5d6f38  
    2020#include "Helpers/MemDebug.hpp"
    2121
    22 #include "Parser/ChangeTracker.hpp"
     22#include "Parser/FormatParserStorage.hpp"
    2323#include "Helpers/Log.hpp"
    2424#include "Helpers/Verbose.hpp"
     
    2727#include <iostream>
    2828#include <string>
     29
     30#include <boost/filesystem/fstream.hpp>
    2931
    3032using namespace std;
     
    4042  getParametersfromValueStorage();
    4143
    42   DoLog(0) && (Log() << Verbose(0) << "Saving world to files." << endl);
    43   ChangeTracker::getInstance().saveStatus();
     44  DoLog(1) && (Log() << Verbose(1) << "Storing world to file " << params.filename << "." << endl);
     45
     46  // extract suffix
     47  std::string FilenameSuffix;
     48  std::string FilenamePrefix;
     49  if (params.filename.has_filename()) {
     50    // get suffix
     51    FilenameSuffix = params.filename.extension().substr(1); // remove the prefixed "."
     52    FilenamePrefix = params.filename.stem();
     53  } else {
     54    DoeLog(1) && (eLog() << Verbose(1) << "Output file does not have a suffix, cannot recognize format." << endl);
     55    return Action::failure;
     56  }
     57
     58  // store file
     59  // parse the file
     60  boost::filesystem::ofstream output;
     61  output.open(params.filename);
     62  if (!output.fail()) {
     63    FormatParserStorage::getInstance().saveWorld(output, FilenameSuffix);
     64  } else {
     65    DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << params.filename << "." << endl);
     66  }
     67  output.close();
     68
    4469  return Action::success;
    4570}
  • src/Actions/WorldAction/OutputAction.def

    rdd97a9 r5d6f38  
    77
    88// all includes and forward declarations necessary for non-integral types below
    9 
     9#
    1010
    1111// i.e. there is an integer with variable name Z that can be found in
    1212// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1313// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    14 #undef paramtypes
    15 #undef paramtokens
    16 #undef paramdescriptions
     14#define paramtypes (boost::filesystem::path)
     15#define paramtokens ("output")
     16#define paramdescriptions ("filename to write to")
    1717#undef paramdefaults
    18 #undef paramreferences
     18#define paramreferences (filename)
    1919
    2020#undef statetypes
     
    3030
    3131// finally the information stored in the ActionTrait specialization
    32 #define DESCRIPTION "write output files"
     32#define DESCRIPTION "write all atoms to given file"
    3333#undef SHORTFORM
  • src/Descriptors/MoleculeNameDescriptor.cpp

    rdd97a9 r5d6f38  
    5353
    5454vector<molecule*> MoleculeNameDescriptor_impl::findAll(){
    55   molecule *res = find();
    56   return (res)?(vector<molecule*>(1,res)):(vector<molecule*>());
     55  vector<molecule *> foundMolecules;
     56  World::MoleculeSet &molecules = getMolecules();
     57  World::MoleculeSet::iterator res = molecules.begin();
     58  for (; res != molecules.end(); res++)
     59    if (res->second->name == name)
     60      foundMolecules.push_back(res->second);
     61  return foundMolecules;
    5762}
  • src/Helpers/MemDebug.cpp

    rdd97a9 r5d6f38  
    380380  // mark the block as not in the list (will be changed by addEntry)
    381381  entry->isIgnored = true;
    382   Memory::addEntry(entry);
     382  if (line != 0)  { // indicator that we do not know the source
     383    Memory::addEntry(entry);
     384  }
    383385
    384386  // get the checksum...
     
    424426  // mark the block as not in the list (will be changed by addEntry)
    425427  entry->isIgnored = true;
    426   Memory::addEntry(entry);
     428  if (line != 0)  { // indicator that we do not know the source
     429    Memory::addEntry(entry);
     430  }
    427431
    428432  // get the checksum...
     
    505509void operator delete(void *ptr) throw() {
    506510  if(!ptr){
    507     cerr << "Warning: Deleting NULL pointer" << endl;
     511    //cerr << "Warning: Deleting NULL pointer" << endl;
    508512    return;
    509513  }
  • src/Helpers/MemDebug.hpp

    rdd97a9 r5d6f38  
    5252#include <boost/shared_ptr.hpp>
    5353#include <boost/function.hpp>
    54 #include <boost/program_options.hpp>
    5554
    5655
  • src/LinearAlgebra/Makefile.am

    rdd97a9 r5d6f38  
    1717  LineSegment.cpp \
    1818  LineSegmentSet.cpp \
    19   linearsystemofequations.cpp \
     19  LinearSystemOfEquations.cpp \
    2020  MatrixContent.cpp \
    2121  MatrixVector_ops.cpp \
     
    3636  LineSegment.hpp \
    3737  LineSegmentSet.hpp \
    38   linearsystemofequations.hpp \
     38  LinearSystemOfEquations.hpp \
    3939  MatrixContent.hpp \
    4040  MatrixVector_ops.hpp \
  • src/LinearAlgebra/Subspace.hpp

    rdd97a9 r5d6f38  
    1515#include "MatrixContent.hpp"
    1616#include "VectorContent.hpp"
    17 #include "unittests/SubspaceFactorizerUnittest.hpp"
     17#include "unittests/SubspaceFactorizerUnitTest.hpp"
    1818
    1919/** A subset of eigenvectors from an Eigenspace.
  • src/Makefile.am

    rdd97a9 r5d6f38  
    8484
    8585 
    86 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
     86DESCRIPTORSOURCE = \
     87        Descriptors/AtomDescriptor.cpp \
    8788  Descriptors/AtomIdDescriptor.cpp \
     89  Descriptors/AtomOfMoleculeSelectionDescriptor.cpp \
    8890  Descriptors/AtomSelectionDescriptor.cpp \
    8991  Descriptors/AtomShapeDescriptor.cpp \
     
    9395  Descriptors/MoleculeIdDescriptor.cpp \
    9496  Descriptors/MoleculeNameDescriptor.cpp \
     97  Descriptors/MoleculeOfAtomSelectionDescriptor.cpp \
     98  Descriptors/MoleculeOrderDescriptor.cpp \
    9599  Descriptors/MoleculePtrDescriptor.cpp \
    96100  Descriptors/MoleculeSelectionDescriptor.cpp
    97101                                   
    98102
    99 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp \
     103DESCRIPTORHEADER = \
     104        Descriptors/AtomDescriptor.hpp \
    100105  Descriptors/AtomIdDescriptor.hpp \
     106  Descriptors/AtomOfMoleculeSelectionDescriptor.hpp \
    101107  Descriptors/AtomSelectionDescriptor.hpp \
    102108  Descriptors/AtomShapeDescriptor.hpp \
     
    106112  Descriptors/MoleculeIdDescriptor.hpp \
    107113  Descriptors/MoleculeNameDescriptor.hpp \
     114  Descriptors/MoleculeOfAtomSelectionDescriptor.hpp \
     115  Descriptors/MoleculeOrderDescriptor.hpp \
    108116  Descriptors/MoleculePtrDescriptor.hpp \
    109   Descriptors/MoleculeSelectionDescriptor.cpp
     117  Descriptors/MoleculeSelectionDescriptor.hpp
     118 
     119DESCRIPTORIMPLHEADER = \
     120        Descriptors/AtomDescriptor_impl.hpp \
     121  Descriptors/AtomIdDescriptor_impl.hpp \
     122  Descriptors/AtomOfMoleculeSelectionDescriptor_impl.hpp \
     123  Descriptors/AtomSelectionDescriptor_impl.hpp \
     124  Descriptors/AtomShapeDescriptor_impl.hpp \
     125  Descriptors/AtomTypeDescriptor_impl.hpp \
     126  Descriptors/MoleculeDescriptor_impl.hpp \
     127  Descriptors/MoleculeFormulaDescriptor_impl.hpp \
     128  Descriptors/MoleculeIdDescriptor_impl.hpp \
     129  Descriptors/MoleculeNameDescriptor_impl.hpp \
     130  Descriptors/MoleculeOfAtomSelectionDescriptor_impl.hpp \
     131  Descriptors/MoleculeOrderDescriptor_impl.hpp \
     132  Descriptors/MoleculePtrDescriptor_impl.hpp \
     133  Descriptors/MoleculeSelectionDescriptor_impl.hpp
    110134 
    111135THERMOSTATSOURCE = \
     
    191215  ${SHAPEHEADER} \
    192216  ${DESCRIPTORHEADER} \
     217  ${DESCRIPTORIMPLHEADER} \
    193218  ${THERMOSTATHEADER} \
    194219  ${TESSELATIONHEADER} \
     
    292317#molecuilder_CXXFLAGS += -DNO_CACHING
    293318molecuilder_LDFLAGS = $(BOOST_LIB)
    294 molecuilder_SOURCES = builder.cpp
     319molecuilder_SOURCES = builder.cpp builder_init.cpp builder_init.hpp
    295320molecuilder_LDADD = \
    296321        UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \
     
    304329
    305330#Stuff for building the GUI using Qt
    306 molecuildergui_SOURCES = builder.cpp
     331molecuildergui_SOURCES = builder.cpp builder_init.cpp builder_init.hpp
    307332molecuildergui_CXXFLAGS = $(BOOST_CPPFLAGS) -DUSE_GUI_QT
    308333molecuildergui_LDFLAGS = $(BOOST_LIB)
  • src/Parser/FormatParser.cpp

    rdd97a9 r5d6f38  
    5252  }
    5353
    54   save(saveStream);
     54  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     55  save(saveStream, atoms);
    5556}
    5657
  • src/Parser/FormatParser.hpp

    rdd97a9 r5d6f38  
    1313#include "parser.hpp"
    1414
     15class atom;
     16
    1517/**
    1618 * General parser which observes the change tracker.
     
    2022  FormatParser();
    2123  virtual ~FormatParser();
    22   virtual void save(std::ostream* file)=0;
     24  virtual void save(std::ostream* file, const std::vector<atom *> &atoms)=0;
    2325  virtual void load(std::istream* file)=0;
    2426  void setOstream(std::ostream* file);
  • src/Parser/FormatParserStorage.cpp

    rdd97a9 r5d6f38  
    3636
    3737#include "Helpers/Assert.hpp"
     38
     39#include "molecule.hpp"
    3840
    3941#include "Patterns/Singleton_impl.hpp"
     
    224226 * \return true - parsing ok, false - suffix unknown
    225227 */
    226 bool FormatParserStorage::get(std::istream &input, std::string suffix)
     228bool FormatParserStorage::load(std::istream &input, std::string suffix)
    227229{
    228230  if (suffix == ParserSuffixes[mpqc]) {
     
    243245}
    244246
     247/** Stores all selected atoms in an ostream depending on its suffix
     248 * \param &output output stream
     249 * \param suffix
     250 * \return true - storing ok, false - suffix unknown
     251 */
     252bool FormatParserStorage::saveSelectedAtoms(std::ostream &output, std::string suffix)
     253{
     254  std::vector<atom *> atoms = World::getInstance().getSelectedAtoms();
     255  return save(output, suffix, atoms);
     256}
     257
     258/** Stores all selected atoms in an ostream depending on its suffix
     259 * We store in the order of the atomic ids, not in the order they appear in the molecules.
     260 * Hence, we first create a vector from all selected molecules' atoms.
     261 * \param &output output stream
     262 * \param suffix
     263 * \return true - storing ok, false - suffix unknown
     264 */
     265bool FormatParserStorage::saveSelectedMolecules(std::ostream &output, std::string suffix)
     266{
     267  std::vector<molecule *> molecules = World::getInstance().getSelectedMolecules();
     268  std::map<size_t, atom *> IdAtoms;
     269  for (std::vector<molecule *>::const_iterator MolIter = molecules.begin();
     270      MolIter != molecules.end();
     271      ++MolIter) {
     272    for(molecule::atomSet::const_iterator AtomIter = (*MolIter)->begin();
     273        AtomIter != (*MolIter)->end();
     274        ++AtomIter) {
     275      IdAtoms.insert( make_pair((*AtomIter)->getId(), (*AtomIter)) );
     276    }
     277  }
     278  std::vector<atom *> atoms;
     279  atoms.reserve(IdAtoms.size());
     280  for (std::map<size_t, atom *>::const_iterator iter = IdAtoms.begin();
     281      iter != IdAtoms.end();
     282      ++iter) {
     283    atoms.push_back(iter->second);
     284  }
     285  return save(output, suffix, atoms);
     286}
    245287
    246288/** Stores world in an ostream depending on its suffix
     
    249291 * \return true - storing ok, false - suffix unknown
    250292 */
    251 bool FormatParserStorage::put(std::ostream &output, std::string suffix)
     293bool FormatParserStorage::saveWorld(std::ostream &output, std::string suffix)
     294{
     295  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     296  return save(output, suffix, atoms);
     297}
     298
     299/** Stores a given vector of \a atoms in an ostream depending on its suffix
     300 * \param &output output stream
     301 * \param suffix
     302 * \return true - storing ok, false - suffix unknown
     303 */
     304bool FormatParserStorage::save(std::ostream &output, std::string suffix, const std::vector<atom *> &atoms)
    252305{
    253306  if (suffix == ParserSuffixes[mpqc]) {
    254     getMpqc().save(&output);
     307    getMpqc().save(&output, atoms);
    255308  } else if (suffix == ParserSuffixes[pcp]) {
    256     getPcp().save(&output);
     309    getPcp().save(&output, atoms);
    257310  } else if (suffix == ParserSuffixes[pdb]) {
    258     getPdb().save(&output);
     311    getPdb().save(&output, atoms);
    259312  } else if (suffix == ParserSuffixes[tremolo]) {
    260     getTremolo().save(&output);
     313    getTremolo().save(&output, atoms);
    261314  } else if (suffix == ParserSuffixes[xyz]) {
    262     getXyz().save(&output);
     315    getXyz().save(&output, atoms);
    263316  } else {
    264317    DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix " << suffix << " to for FormatParserStorage::put()." << endl);
  • src/Parser/FormatParserStorage.hpp

    rdd97a9 r5d6f38  
    2020#include <vector>
    2121
     22class atom;
    2223class FormatParser;
    2324class MpqcParser;
     
    4546  bool add(ParserTypes type);
    4647
    47   bool get(std::istream &input, std::string suffix);
    48   bool put(std::ostream &output, std::string suffix);
     48  bool load(std::istream &input, std::string suffix);
     49  bool save(std::ostream &output, std::string suffix, const std::vector<atom *> &atoms);
     50  bool saveSelectedAtoms(std::ostream &output, std::string suffix);
     51  bool saveSelectedMolecules(std::ostream &output, std::string suffix);
     52  bool saveWorld(std::ostream &output, std::string suffix);
    4953  MpqcParser &getMpqc();
    5054  PcpParser &getPcp();
  • src/Parser/MpqcParser.cpp

    rdd97a9 r5d6f38  
    5353}
    5454
    55 void MpqcParser::save(ostream *file)
     55/**
     56 * Saves the \a atoms into as a MPQC file.
     57 *
     58 * \param file where to save the state
     59 * \param atoms atoms to store
     60 */
     61void MpqcParser::save(ostream *file, const std::vector<atom *> &atoms)
    5662{
    5763  DoLog(0) && (Log() << Verbose(0) << "Saving changes to MPQC ." << std::endl);
    5864
    5965  if (HessianPresent)
    60     saveHessian(file);
     66    saveHessian(file, atoms);
    6167  else
    62     saveSimple(file);
     68    saveSimple(file, atoms);
    6369}
    6470
    6571/** Saves all atoms and data into a MPQC config file without hessian.
    6672 * \param *file output stream
     73 * \param atoms atoms to store
    6774 */
    68 void MpqcParser::saveSimple(ostream *file)
     75void MpqcParser::saveSimple(ostream *file, const std::vector<atom *> &atoms)
    6976{
    7077  Vector center;
     
    112119/** Saves all atoms and data into a MPQC config file with hessian.
    113120 * \param *file output stream
     121 * \param atoms atoms to store
    114122 */
    115 void MpqcParser::saveHessian(ostream *file)
     123void MpqcParser::saveHessian(ostream *file, const std::vector<atom *> &atoms)
    116124{
    117125  Vector center;
  • src/Parser/MpqcParser.hpp

    rdd97a9 r5d6f38  
    2222  ~MpqcParser();
    2323  void load(std::istream* file);
    24   void save(std::ostream* file);
     24  void save(std::ostream* file, const std::vector<atom *> &atoms);
    2525
    2626  void setHessian(bool hessian);
     
    3030  bool HessianPresent;
    3131
    32   void saveSimple(std::ostream *file);
    33   void saveHessian(std::ostream *file);
     32  void saveSimple(std::ostream *file, const std::vector<atom *> &atoms);
     33  void saveHessian(std::ostream *file, const std::vector<atom *> &atoms);
    3434};
    3535
  • src/Parser/PcpParser.cpp

    rdd97a9 r5d6f38  
    368368}
    369369
    370 /** Saves the World into a PCP config file.
    371  * \param *file output stream to save to
    372  */
    373 void PcpParser::save(std::ostream* file)
     370/**
     371 * Saves the \a atoms into as a PCP file.
     372 *
     373 * \param file where to save the state
     374 * \param atoms atoms to store
     375 */
     376void PcpParser::save(std::ostream* file, const std::vector<atom *> &atoms)
    374377{
    375378  DoLog(0) && (Log() << Verbose(0) << "Saving changes to pcp." << std::endl);
     
    379382  if (!file->fail()) {
    380383    // calculate number of Psis
    381     vector<atom *> allatoms = World::getInstance().getAllAtoms();
    382     CalculateOrbitals(allatoms);
     384    CalculateOrbitals(atoms);
    383385    *file << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl;
    384386    *file << endl;
     
    468470    *file << "RelativeCoord\t" << RelativeCoord << "\t# whether ion coordinates are relative (1) or absolute (0)" << endl;
    469471    map<int, int> ZtoIndexMap;
    470     OutputElements(file, allatoms, ZtoIndexMap);
    471     OutputAtoms(file, allatoms, ZtoIndexMap);
     472    OutputElements(file, atoms, ZtoIndexMap);
     473    OutputAtoms(file, atoms, ZtoIndexMap);
    472474  } else {
    473475    DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open output file." << endl);
     
    479481 * \param &allatoms all atoms to store away
    480482 */
    481 void PcpParser::CalculateOrbitals(vector<atom *> &allatoms)
     483void PcpParser::CalculateOrbitals(const std::vector<atom *> &allatoms)
    482484{
    483485  PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
    484   for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
     486  for (vector<atom *>::const_iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
    485487    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals();
    486488  }
     
    512514 * \param &ZtoIndexMap map of which atoms belong to which ion number
    513515 */
    514 void PcpParser::OutputElements(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
     516void PcpParser::OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
    515517{
    516518  map<int, int> PresentElements;
    517519  pair <   map<int, int>::iterator, bool > Inserter;
    518520  // insert all found elements into the map
    519   for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
     521  for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    520522    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1));
    521523    if (!Inserter.second) // increase if present
     
    542544 * \param &ZtoIndexMap map of which atoms belong to which ion number
    543545 */
    544 void PcpParser::OutputAtoms(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
     546void PcpParser::OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
    545547{
    546548  *file << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
     
    548550  pair <   map<int, int>::iterator, bool > Inserter;
    549551  int nr = 0;
    550   for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
     552  for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    551553    Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) );
    552554    if (!Inserter.second)
  • src/Parser/PcpParser.hpp

    rdd97a9 r5d6f38  
    2020  ~PcpParser();
    2121  void load(std::istream* file);
    22   void save(std::ostream* file);
     22  void save(std::ostream* file, const std::vector<atom *> &atoms);
    2323
    2424  bool operator==(const PcpParser& b) const;
     
    2727
    2828  void ParseThermostats(class ConfigFileBuffer * const fb);
    29   void OutputAtoms(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap);
    30   void OutputElements(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap);
    31   void CalculateOrbitals(vector<atom *> &allatoms);
     29  void OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap);
     30  void OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap);
     31  void CalculateOrbitals(const std::vector<atom *> &allatoms);
    3232
    3333  class StructParallelization {
  • src/Parser/PdbAtomInfoContainer.cpp

    rdd97a9 r5d6f38  
    2424#include "Helpers/toString.hpp"
    2525//#include "Helpers/Verbose.hpp"
     26#include "LinearAlgebra/Vector.hpp"
    2627#include "PdbAtomInfoContainer.hpp"
    2728
    2829
    2930PdbAtomInfoContainer::PdbAtomInfoContainer() :
     31  token("ATOM"),
    3032  serial(0),
    3133  name("-"),
    32   altloc('0'),
     34  altLoc('0'),
    3335  resName("-"),
    3436  chainID('0'),
     
    3739  occupancy(0.),
    3840  tempFactor(0.),
     41  element(""),
    3942  charge(0)
    4043{}
     
    4649{
    4750  switch (key) {
     51    case PdbKey::token :
     52      ScanKey(token, value);
     53      break;
    4854    case PdbKey::serial :
    4955      ScanKey(serial, value);
     
    5258      ScanKey(name, value);
    5359      break;
    54     case PdbKey::altloc :
    55       ScanKey(altloc, value);
     60    case PdbKey::altLoc :
     61      ScanKey(altLoc, value);
    5662      break;
    5763    case PdbKey::resName :
     
    6773      ScanKey(iCode, value);
    6874      break;
     75    case PdbKey::X :
     76      ScanKey(XYZ[0], value);
     77      break;
     78    case PdbKey::Y :
     79      ScanKey(XYZ[1], value);
     80      break;
     81    case PdbKey::Z :
     82      ScanKey(XYZ[2], value);
     83      break;
    6984    case PdbKey::occupancy :
    7085      ScanKey(occupancy, value);
     
    7287    case PdbKey::tempFactor :
    7388      ScanKey(tempFactor, value);
     89      break;
     90    case PdbKey::element :
     91      ScanKey(element, value);
    7492      break;
    7593    case PdbKey::charge :
     
    82100}
    83101
    84 std::string PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const
     102template <>
     103std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const
    85104{
    86105  switch (key) {
     106    case PdbKey::token :
     107      return toString(token);
    87108    case PdbKey::serial :
    88109      return toString(serial);
    89110    case PdbKey::name :
    90111      return toString(name);
    91     case PdbKey::altloc :
    92       return toString(altloc);
     112    case PdbKey::altLoc :
     113      return toString(altLoc);
    93114    case PdbKey::resName :
    94115      return toString(resName);
     
    99120    case PdbKey::iCode :
    100121      return toString(iCode);
     122    case PdbKey::X :
     123      return toString(XYZ[0]);
     124    case PdbKey::Y :
     125      return toString(XYZ[1]);
     126    case PdbKey::Z :
     127      return toString(XYZ[2]);
    101128    case PdbKey::occupancy :
    102129      return toString(occupancy);
    103130    case PdbKey::tempFactor :
    104131      return toString(tempFactor);
     132    case PdbKey::element :
     133      return toString(element);
    105134    case PdbKey::charge :
    106135      return toString(charge);
     
    111140}
    112141
     142template <>
     143int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const
     144{
     145  switch (key) {
     146    case PdbKey::serial :
     147      return serial;
     148    case PdbKey::resSeq :
     149      return resSeq;
     150    case PdbKey::charge :
     151      return charge;
     152    default :
     153      std::cout << "Unknown key or not presentable as int: " << key << std::endl;
     154      return 0;
     155  }
     156}
     157
     158template <>
     159double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const
     160{
     161  switch (key) {
     162    case PdbKey::X :
     163      return XYZ[0];
     164    case PdbKey::Y :
     165      return XYZ[1];
     166    case PdbKey::Z :
     167      return XYZ[2];
     168    case PdbKey::occupancy :
     169      return occupancy;
     170    case PdbKey::tempFactor :
     171      return tempFactor;
     172    default :
     173      std::cout << "Unknown key or not presentable as double: " << key << std::endl;
     174      return 0.;
     175  }
     176}
  • src/Parser/PdbAtomInfoContainer.hpp

    rdd97a9 r5d6f38  
    1111#include "PdbKey.hpp"
    1212
     13class Vector;
     14
    1315#include <string>
     16#include <typeinfo>
    1417
    1518/**
     
    2225
    2326  // getter and setter
    24   std::string get(const PdbKey::PdbDataKey key) const;
     27  template <class T> T get(const PdbKey::PdbDataKey key) const  {
     28    switch (key) {
     29      default :
     30        std::cout << "Unknown key or not representable as " << typeid(T).name() << ": " << key << std::endl;
     31        break;
     32    }
     33    return (T)NULL;
     34  }
    2535  void set(const PdbKey::PdbDataKey key, std::string value);
    2636
     
    4656
    4757private:
     58  std::string token;
    4859  int serial;
    4960  std::string name;
    50   char altloc;
     61  char altLoc;
    5162  std::string resName;
    5263  char chainID;
    5364  int resSeq;
    5465  char iCode;
     66  Vector XYZ;
    5567  float occupancy;
    5668  float tempFactor;
     69  std::string element;
    5770  int charge;
    5871};
    5972
     73template <>
     74std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const;
     75template <>
     76int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const;
     77template <>
     78double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const;
     79
    6080#endif /* PDBATOMINFOCONTAINER_HPP_ */
  • src/Parser/PdbKey.hpp

    rdd97a9 r5d6f38  
    1818  enum PdbDataKey {
    1919    noKey,
     20    token,
    2021    serial,
    2122    name,
    22     altloc,
     23    altLoc,
    2324    resName,
    2425    chainID,
    2526    resSeq,
    2627    iCode,
     28    X,
     29    Y,
     30    Z,
    2731    occupancy,
    2832    tempFactor,
     33    element,
    2934    charge
    3035  };
  • src/Parser/PdbParser.cpp

    rdd97a9 r5d6f38  
    4646PdbParser::PdbParser() {
    4747  knownTokens["ATOM"] = PdbKey::Atom;
     48  knownTokens["HETATM"] = PdbKey::Atom;
    4849  knownTokens["TER"] = PdbKey::Filler;
    4950  knownTokens["END"] = PdbKey::EndOfFile;
     
    5152  knownTokens["REMARK"] = PdbKey::Remark;
    5253  knownTokens[""] = PdbKey::EndOfFile;
     54
     55  // argh, why can't just PdbKey::X+(size_t)i
     56  PositionEnumMap[0] = PdbKey::X;
     57  PositionEnumMap[1] = PdbKey::Y;
     58  PositionEnumMap[2] = PdbKey::Z;
    5359}
    5460
     
    99105  size_t linecount  = 0;
    100106  enum PdbKey::KnownTokens token;
     107
     108  // reset atomIdMap for this file (to correctly parse CONECT entries)
     109  atomIdMap.clear();
    101110
    102111  molecule *newmol = World::getInstance().createMolecule();
     
    136145
    137146/**
    138  * Saves the World's current state into as a PDB file.
     147 * Saves the \a atoms into as a PDB file.
    139148 *
    140149 * \param file where to save the state
    141  */
    142 void PdbParser::save(ostream* file) {
     150 * \param atoms atoms to store
     151 */
     152void PdbParser::save(ostream* file, const std::vector<atom *> &AtomList)
     153{
    143154  DoLog(0) && (Log() << Verbose(0) << "Saving changes to pdb." << std::endl);
    144 
    145155  {
    146156    // add initial remark
     
    157167  }
    158168
    159   // we distribute new atom numbers, hence clear map beforehand
     169  // we distribute serials, hence clear map beforehand
    160170  atomIdMap.clear();
    161171  {
    162     vector<atom *> AtomList = World::getInstance().getAllAtoms();
    163 
    164     std::vector<int> elementNo(MAX_ELEMENTS,1);
     172    std::map<size_t,size_t> MolIdMap;
     173    size_t MolNo = 1;  // residue number starts at 1 in pdb
     174    for (vector<atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
     175      const molecule *mol = (*atomIt)->getMolecule();
     176      if ((mol != NULL) && (MolIdMap.find(mol->getId()) == MolIdMap.end())) {
     177        MolIdMap[mol->getId()] = MolNo++;
     178      }
     179    }
     180    const size_t MaxMol = MolNo;
     181
     182    // have a count per element and per molecule (0 is for all homeless atoms)
     183    std::vector<int> **elementNo = new std::vector<int>*[MaxMol];
     184    for (size_t i = 0; i < MaxMol; ++i)
     185      elementNo[i] = new std::vector<int>(MAX_ELEMENTS,1);
    165186    char name[MAXSTRINGSIZE];
     187    std::string ResidueName;
    166188
    167189    // write ATOMs
    168190    int AtomNo = 1; // serial number starts at 1 in pdb
    169     int MolNo = 1;  // residue number starts at 1 in pdb
    170     for (vector<atom *>::iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
     191    for (vector<atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
     192      PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt);
     193      // gather info about residue
     194      const molecule *mol = (*atomIt)->getMolecule();
     195      if (mol == NULL) {
     196        MolNo = 0;
     197        atomInfo.set(PdbKey::resSeq, "0");
     198      } else {
     199        ASSERT(MolIdMap.find(mol->getId()) != MolIdMap.end(),
     200            "PdbParser::save() - Mol id "+toString(mol->getId())+" not present despite we set it?!");
     201        MolNo = MolIdMap[mol->getId()];
     202        atomInfo.set(PdbKey::resSeq, toString(MolIdMap[mol->getId()]));
     203        if (atomInfo.get<std::string>(PdbKey::resName) == "-")
     204          atomInfo.set(PdbKey::resName, mol->getName().substr(0,3));
     205      }
     206      // get info about atom
    171207      const size_t  Z = (*atomIt)->getType()->getAtomicNumber();
    172       sprintf(name, "%2s%02d",(*atomIt)->getType()->getSymbol().c_str(), elementNo[Z]);
    173       elementNo[Z] = (elementNo[Z]+1) % 100;   // confine to two digits
    174       const molecule *mol = (*atomIt)->getMolecule();
    175       if (mol == NULL) {  // for homeless atoms, MolNo = -1 is reserved
    176         MolNo = -1;
    177       } else {
    178         MolNo = mol->getId();
     208      if (atomInfo.get<std::string>(PdbKey::name) == "-") {  // if no name set, give it a new name
     209        sprintf(name, "%2s%02d",(*atomIt)->getType()->getSymbol().c_str(), (*elementNo[MolNo])[Z]);
     210        (*elementNo[MolNo])[Z] = ((*elementNo[MolNo])[Z]+1) % 100;   // confine to two digits
     211        atomInfo.set(PdbKey::name, name);
    179212      }
    180       saveLine(file, *atomIt, name, AtomNo, MolNo);
    181       setAtomId((*atomIt)->getId(), AtomNo);
     213      // set position
     214      for (size_t i=0; i<NDIM;++i) {
     215        stringstream position;
     216        position << setw(8) << fixed << setprecision(3) << (*atomIt)->getPosition().at(i);
     217        atomInfo.set(PositionEnumMap[i], position.str());
     218      }
     219      // change element and charge if changed
     220      if (atomInfo.get<std::string>(PdbKey::element) != (*atomIt)->getType()->getSymbol())
     221        atomInfo.set(PdbKey::element, (*atomIt)->getType()->getSymbol());
     222      setSerial((*atomIt)->getId(), AtomNo);
     223      atomInfo.set(PdbKey::serial, toString(AtomNo));
     224
     225      // finally save the line
     226      saveLine(file, atomInfo);
    182227      AtomNo++;
    183228    }
     229    for (size_t i = 0; i < MaxMol; ++i)
     230      delete elementNo[i];
     231    delete elementNo;
    184232
    185233    // write CONECTs
    186     for (vector<atom *>::iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
     234    for (vector<atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
    187235      writeNeighbors(file, 4, *atomIt);
    188236    }
     
    193241}
    194242
     243/** Either returns reference to present entry or creates new with default values.
     244 *
     245 * @param _atom atom whose entry we desire
     246 * @return
     247 */
     248PdbAtomInfoContainer& PdbParser::getadditionalAtomData(atom *_atom)
     249{
     250  if (additionalAtomData.find(_atom->getId()) != additionalAtomData.end()) {
     251  } else if (additionalAtomData.find(_atom->father->getId()) != additionalAtomData.end()) {
     252    // use info from direct father
     253    additionalAtomData[_atom->getId()] = additionalAtomData[_atom->father->getId()];
     254  } else if (additionalAtomData.find(_atom->GetTrueFather()->getId()) != additionalAtomData.end()) {
     255    // use info from topmost father
     256    additionalAtomData[_atom->getId()] = additionalAtomData[_atom->GetTrueFather()->getId()];
     257  } else {
     258    // create new entry use default values if nothing else is known
     259    additionalAtomData[_atom->getId()] = defaultAdditionalData;
     260  }
     261  return additionalAtomData[_atom->getId()];
     262}
     263
    195264/**
    196265 * Writes one line of PDB-formatted data to the provided stream.
     
    198267 * \param stream where to write the line to
    199268 * \param *currentAtom the atom of which information should be written
     269 * \param AtomNo serial number of atom
    200270 * \param *name name of atom, i.e. H01
    201  * \param AtomNo serial number of atom
     271 * \param ResidueName Name of molecule
    202272 * \param ResidueNo number of residue
    203273 */
    204 void PdbParser::saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResidueNo) {
    205   *file << "ATOM ";
    206   *file << setw(6) << AtomNo; /* atom serial number */
    207   *file << setw(1) << " ";
    208   *file << setfill(' ') << left << setw(4) << name << right;  /* atom name */
    209   *file << setw(1) << " ";
    210   *file << setfill(' ') << setw(3) << ((currentAtom->getMolecule() != NULL) ? currentAtom->getMolecule()->getName().substr(0,3) : "-");  /* residue name */
    211   *file << setw(1) << " ";
    212   *file << setfill(' ') << setw(1) << (char)('a'+(unsigned char)(AtomNo % 26)); /* letter for chain */
    213   *file << setw(4) << ResidueNo; /* residue sequence number */
    214   *file << setw(4) << "    ";
    215   for (int i=0;i<NDIM;i++) {
    216     *file << setw(8) << setprecision(3) << showpoint << currentAtom->at(i); /* positional coordinate in Angstroem */
    217   }
    218   *file << setw(6) << setprecision(2) << showpoint << (double)currentAtom->getType()->getValence(); /* occupancy */
    219   *file << setw(6) << setprecision(2) << showpoint << (double)currentAtom->getType()->getNoValenceOrbitals(); /* temperature factor */
    220   *file << noshowpoint;
    221   *file << setw(6) << "      ";
    222   *file << setw(4) << "0";
    223   *file << setfill(' ') << setw(2) << currentAtom->getType()->getSymbol();
    224   *file << setw(2) << "0";
     274void PdbParser::saveLine(
     275    ostream* file,
     276    const PdbAtomInfoContainer &atomInfo)
     277{
     278  *file << setfill(' ') << left << setw(6)
     279      << atomInfo.get<std::string>(PdbKey::token);
     280  *file << setfill(' ') << right << setw(5)
     281      << atomInfo.get<int>(PdbKey::serial); /* atom serial number */
     282  *file << " "; /* char 12 is empty */
     283  *file << setfill(' ') << left << setw(4)
     284      << atomInfo.get<std::string>(PdbKey::name);  /* atom name */
     285  *file << setfill(' ') << left << setw(1)
     286      << atomInfo.get<std::string>(PdbKey::altLoc); /* alternate location/conformation */
     287  *file << setfill(' ') << left << setw(3)
     288      << atomInfo.get<std::string>(PdbKey::resName);  /* residue name */
     289  *file << " "; /* char 21 is empty */
     290  *file << setfill(' ') << left << setw(1)
     291      << atomInfo.get<std::string>(PdbKey::chainID); /* chain identifier */
     292  *file << setfill(' ') << left << setw(4)
     293      << atomInfo.get<int>(PdbKey::resSeq); /* residue sequence number */
     294  *file << setfill(' ') << left << setw(1)
     295      << atomInfo.get<std::string>(PdbKey::iCode); /* iCode */
     296  *file << "   "; /* char 28-30 are empty */
     297  // have the following operate on stringstreams such that format specifiers
     298  // only act on these
     299  for (size_t i=0;i<NDIM;++i) {
     300    stringstream position;
     301    position << fixed << setprecision(3) << showpoint
     302        << atomInfo.get<double>(PositionEnumMap[i]);
     303    *file << setfill(' ') << right << setw(8) << position.str();
     304  }
     305  {
     306    stringstream occupancy;
     307    occupancy << fixed << setprecision(2) << showpoint
     308        << atomInfo.get<double>(PdbKey::occupancy); /* occupancy */
     309    *file << setfill(' ') << right << setw(6) << occupancy.str();
     310  }
     311  {
     312    stringstream tempFactor;
     313    tempFactor << fixed << setprecision(2) << showpoint
     314        << atomInfo.get<double>(PdbKey::tempFactor); /* temperature factor */
     315    *file << setfill(' ') << right << setw(6) << tempFactor.str();
     316  }
     317  *file << "          "; /* char 68-76 are empty */
     318  *file << setfill(' ') << right << setw(2) << atomInfo.get<std::string>(PdbKey::element); /* element */
     319  *file << setfill(' ') << right << setw(2) << atomInfo.get<int>(PdbKey::charge); /* charge */
    225320
    226321  *file << endl;
     
    240335      if (MaxNo >= MaxnumberOfNeighbors) {
    241336        *file << "CONECT";
    242         *file << setw(5) << getAtomId(currentAtom->getId());
     337        *file << setw(5) << getSerial(currentAtom->getId());
    243338        MaxNo = 0;
    244339      }
    245       *file << setw(5) << getAtomId((*currentBond)->GetOtherAtom(currentAtom)->getId());
     340      *file << setw(5) << getSerial((*currentBond)->GetOtherAtom(currentAtom)->getId());
    246341      MaxNo++;
    247342      if (MaxNo == MaxnumberOfNeighbors)
     
    253348}
    254349
    255 
    256350/** Retrieves a value from PdbParser::atomIdMap.
    257351 * \param atomid key
     
    259353 */
    260354size_t PdbParser::getSerial(const size_t atomid) const
    261 {
    262   ConvertTo<size_t> toSize_t;
    263   ASSERT(additionalAtomData.find(atomid) != additionalAtomData.end(),
    264       "PdbParser::getSerial: atomid "+toString(atomid)+" not present in Map.");
    265   const PdbAtomInfoContainer &atomInfo = additionalAtomData.at(atomid);
    266 
    267   return toSize_t(atomInfo.get(PdbKey::serial));
    268 }
    269 
    270 /** Retrieves a value from PdbParser::atomIdMap.
    271  * \param atomid key
    272  * \return value
    273  */
    274 size_t PdbParser::getAtomId(const size_t atomid) const
    275355{
    276356  ASSERT(atomIdMap.find(atomid) != atomIdMap.end(), "PdbParser::getAtomId: atomid not present in Map.");
     
    283363 * \return true - key not present, false - value present
    284364 */
    285 void PdbParser::setAtomId(const size_t localatomid, const size_t atomid)
     365void PdbParser::setSerial(const size_t localatomid, const size_t atomid)
    286366{
    287367  pair<std::map<size_t,size_t>::iterator, bool > inserter;
    288   DoLog(1) && (Log() << Verbose(1) << "PdbParser::setAtomId() - Inserting ("
    289       << localatomid << " -> " << atomid << ")." << std::endl);
     368//  DoLog(1) && (Log() << Verbose(1) << "PdbParser::setAtomId() - Inserting ("
     369//      << localatomid << " -> " << atomid << ")." << std::endl);
    290370  inserter = atomIdMap.insert( make_pair(localatomid, atomid) );
    291371  ASSERT(inserter.second, "PdbParser::setAtomId: atomId already present in Map.");
     
    307387  stringstream lineStream;
    308388  atom* newAtom = World::getInstance().createAtom();
    309   additionalAtomData[newAtom->getId()] = *(new PdbAtomInfoContainer);
    310   PdbAtomInfoContainer &atomInfo = additionalAtomData[newAtom->getId()];
     389  PdbAtomInfoContainer &atomInfo = getadditionalAtomData(newAtom);
    311390  string word;
    312391  ConvertTo<size_t> toSize_t;
     
    314393
    315394  lineStream << line;
     395  atomInfo.set(PdbKey::token, line.substr(0,6));
    316396  atomInfo.set(PdbKey::serial, line.substr(6,5));
    317397  std::pair< std::set<size_t>::const_iterator, bool> Inserter =
    318     SerialSet.insert(toSize_t(atomInfo.get(PdbKey::serial)));
     398    SerialSet.insert(toSize_t(atomInfo.get<std::string>(PdbKey::serial)));
    319399  ASSERT(Inserter.second,
    320400      "PdbParser::readAtomDataLine() - ATOM contains entry with serial "
    321       +atomInfo.get(PdbKey::serial)+" already present!");
     401      +atomInfo.get<std::string>(PdbKey::serial)+" already present!");
    322402  // assign hightest+1 instead, but then beware of CONECT entries! Another map needed!
    323403//  if (!Inserter.second) {
     
    326406//    atomInfo.set(PdbKey::serial, toString(id));
    327407//    DoeLog(2) && (eLog() << Verbose(2)
    328 //        << "Serial " << atomInfo.get(PdbKey::serial) << " already present, "
     408//        << "Serial " << atomInfo.get<std::string>(PdbKey::serial) << " already present, "
    329409//        << "assigning " << toString(id) << " instead." << std::endl);
    330410//  }
     
    348428//      << line.substr(78,2) << std::endl);
    349429
    350   setAtomId(toSize_t(atomInfo.get(PdbKey::serial)), newAtom->getId());
     430  setSerial(toSize_t(atomInfo.get<std::string>(PdbKey::serial)), newAtom->getId());
    351431  atomInfo.set(PdbKey::name, line.substr(12,4));
    352   atomInfo.set(PdbKey::altloc, line.substr(16,1));
     432  atomInfo.set(PdbKey::altLoc, line.substr(16,1));
    353433  atomInfo.set(PdbKey::resName, line.substr(17,3));
    354434  atomInfo.set(PdbKey::chainID, line.substr(21,1));
     
    364444  atomInfo.set(PdbKey::tempFactor, line.substr(60,6));
    365445  atomInfo.set(PdbKey::charge, line.substr(78,2));
    366   PdbAtomInfoContainer::ScanKey(word, line.substr(76,2));
    367   newAtom->setType(World::getInstance().getPeriode()->FindElement(word));
     446  atomInfo.set(PdbKey::element, line.substr(76,2));
     447  const element *elem = World::getInstance().getPeriode()
     448      ->FindElement(atomInfo.get<std::string>(PdbKey::element));
     449  ASSERT(elem != NULL,
     450      "PdbParser::readAtomDataLine() - element "+atomInfo.get<std::string>(PdbKey::element)+" is unknown!");
     451  newAtom->setType(elem);
    368452
    369453  if (newmol != NULL)
     
    381465
    382466  DoLog(1) && (Log() << Verbose(1) << "We know about atom " << newAtom->getId() << ":" << std::endl);
    383   DoLog(1) && (Log() << Verbose(1) << "\tserial is " << atomInfo.get(PdbKey::serial) << std::endl);
    384   DoLog(1) && (Log() << Verbose(1) << "\tname is " << atomInfo.get(PdbKey::name) << std::endl);
    385   DoLog(1) && (Log() << Verbose(1) << "\taltloc is " << atomInfo.get(PdbKey::altloc) << std::endl);
    386   DoLog(1) && (Log() << Verbose(1) << "\tresName is " << atomInfo.get(PdbKey::resName) << std::endl);
    387   DoLog(1) && (Log() << Verbose(1) << "\tchainID is " << atomInfo.get(PdbKey::chainID) << std::endl);
    388   DoLog(1) && (Log() << Verbose(1) << "\tresSeq is " << atomInfo.get(PdbKey::resSeq) << std::endl);
    389   DoLog(1) && (Log() << Verbose(1) << "\tiCode is " << atomInfo.get(PdbKey::iCode) << std::endl);
    390   DoLog(1) && (Log() << Verbose(1) << "\tx is " << newAtom->getPosition() << std::endl);
    391   DoLog(1) && (Log() << Verbose(1) << "\toccupancy is " << atomInfo.get(PdbKey::occupancy) << std::endl);
    392   DoLog(1) && (Log() << Verbose(1) << "\ttempFactor is " << atomInfo.get(PdbKey::tempFactor) << std::endl);
     467  DoLog(1) && (Log() << Verbose(1) << "\ttoken is " << atomInfo.get<std::string>(PdbKey::token) << std::endl);
     468  DoLog(1) && (Log() << Verbose(1) << "\tserial is " << atomInfo.get<int>(PdbKey::serial) << std::endl);
     469  DoLog(1) && (Log() << Verbose(1) << "\tname is " << atomInfo.get<std::string>(PdbKey::name) << std::endl);
     470  DoLog(1) && (Log() << Verbose(1) << "\taltLoc is " << atomInfo.get<std::string>(PdbKey::altLoc) << std::endl);
     471  DoLog(1) && (Log() << Verbose(1) << "\tresName is " << atomInfo.get<std::string>(PdbKey::resName) << std::endl);
     472  DoLog(1) && (Log() << Verbose(1) << "\tchainID is " << atomInfo.get<std::string>(PdbKey::chainID) << std::endl);
     473  DoLog(1) && (Log() << Verbose(1) << "\tresSeq is " << atomInfo.get<int>(PdbKey::resSeq) << std::endl);
     474  DoLog(1) && (Log() << Verbose(1) << "\tiCode is " << atomInfo.get<std::string>(PdbKey::iCode) << std::endl);
     475  DoLog(1) && (Log() << Verbose(1) << "\tX is " << atomInfo.get<double>(PdbKey::X) << std::endl);
     476  DoLog(1) && (Log() << Verbose(1) << "\tY is " << atomInfo.get<double>(PdbKey::Y) << std::endl);
     477  DoLog(1) && (Log() << Verbose(1) << "\tZ is " << atomInfo.get<double>(PdbKey::Z) << std::endl);
     478  DoLog(1) && (Log() << Verbose(1) << "\toccupancy is " << atomInfo.get<double>(PdbKey::occupancy) << std::endl);
     479  DoLog(1) && (Log() << Verbose(1) << "\ttempFactor is " << atomInfo.get<double>(PdbKey::tempFactor) << std::endl);
    393480  DoLog(1) && (Log() << Verbose(1) << "\telement is '" << *(newAtom->getType()) << "'" << std::endl);
    394   DoLog(1) && (Log() << Verbose(1) << "\tcharge is " << atomInfo.get(PdbKey::charge) << std::endl);
     481  DoLog(1) && (Log() << Verbose(1) << "\tcharge is " << atomInfo.get<int>(PdbKey::charge) << std::endl);
    395482}
    396483
     
    426513
    427514  // add neighbours
    428   atom *_atom = World::getInstance().getAtom(AtomById(getAtomId(id)));
     515  atom *_atom = World::getInstance().getAtom(AtomById(getSerial(id)));
    429516  for (std::list<size_t>::const_iterator iter = ListOfNeighbors.begin();
    430517      iter != ListOfNeighbors.end();
    431518      ++iter) {
    432519//    DoLog(1) && (Log() << Verbose(1) << "Adding Bond (" << getAtomId(id) << "," << getAtomId(*iter) << ")" << std::endl);
    433     atom * const _Otheratom = World::getInstance().getAtom(AtomById(getAtomId(*iter)));
     520    atom * const _Otheratom = World::getInstance().getAtom(AtomById(getSerial(*iter)));
    434521    _atom->addBond(_Otheratom);
    435522  }
     
    478565      const PdbAtomInfoContainer &OtheratomInfo = b.additionalAtomData.at((*iter)->getId());
    479566
    480       status = status && (atomInfo.get(PdbKey::serial) == OtheratomInfo.get(PdbKey::serial));
     567      status = status && (atomInfo.get<std::string>(PdbKey::serial) == OtheratomInfo.get<std::string>(PdbKey::serial));
    481568      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in serials!" << std::endl);
    482       status = status && (atomInfo.get(PdbKey::name) == OtheratomInfo.get(PdbKey::name));
     569      status = status && (atomInfo.get<std::string>(PdbKey::name) == OtheratomInfo.get<std::string>(PdbKey::name));
    483570      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in names!" << std::endl);
    484       status = status && (atomInfo.get(PdbKey::altloc) == OtheratomInfo.get(PdbKey::altloc));
    485       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in altlocs!" << std::endl);
    486       status = status && (atomInfo.get(PdbKey::resName) == OtheratomInfo.get(PdbKey::resName));
     571      status = status && (atomInfo.get<std::string>(PdbKey::altLoc) == OtheratomInfo.get<std::string>(PdbKey::altLoc));
     572      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in altLocs!" << std::endl);
     573      status = status && (atomInfo.get<std::string>(PdbKey::resName) == OtheratomInfo.get<std::string>(PdbKey::resName));
    487574      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in resNames!" << std::endl);
    488       status = status && (atomInfo.get(PdbKey::chainID) == OtheratomInfo.get(PdbKey::chainID));
     575      status = status && (atomInfo.get<std::string>(PdbKey::chainID) == OtheratomInfo.get<std::string>(PdbKey::chainID));
    489576      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in chainIDs!" << std::endl);
    490       status = status && (atomInfo.get(PdbKey::resSeq) == OtheratomInfo.get(PdbKey::resSeq));
     577      status = status && (atomInfo.get<std::string>(PdbKey::resSeq) == OtheratomInfo.get<std::string>(PdbKey::resSeq));
    491578      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in resSeqs!" << std::endl);
    492       status = status && (atomInfo.get(PdbKey::iCode) == OtheratomInfo.get(PdbKey::iCode));
     579      status = status && (atomInfo.get<std::string>(PdbKey::iCode) == OtheratomInfo.get<std::string>(PdbKey::iCode));
    493580      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in iCodes!" << std::endl);
    494       status = status && (atomInfo.get(PdbKey::occupancy) == OtheratomInfo.get(PdbKey::occupancy));
     581      status = status && (atomInfo.get<std::string>(PdbKey::occupancy) == OtheratomInfo.get<std::string>(PdbKey::occupancy));
    495582      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in occupancies!" << std::endl);
    496       status = status && (atomInfo.get(PdbKey::tempFactor) == OtheratomInfo.get(PdbKey::tempFactor));
     583      status = status && (atomInfo.get<std::string>(PdbKey::tempFactor) == OtheratomInfo.get<std::string>(PdbKey::tempFactor));
    497584      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in tempFactors!" << std::endl);
    498       status = status && (atomInfo.get(PdbKey::charge) == OtheratomInfo.get(PdbKey::charge));
     585      status = status && (atomInfo.get<std::string>(PdbKey::charge) == OtheratomInfo.get<std::string>(PdbKey::charge));
    499586      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in charges!" << std::endl);
    500587    }
  • src/Parser/PdbParser.hpp

    rdd97a9 r5d6f38  
    2323  ~PdbParser();
    2424  void load(std::istream* file);
    25   void save(std::ostream* file);
     25  void save(std::ostream* file, const std::vector<atom *> &atoms);
    2626
    2727  bool operator==(const PdbParser& b) const;
     
    3838  bool isUsedField(std::string fieldName);
    3939  void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
    40   void saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResdueNo);
     40  void saveLine(ostream* file, const PdbAtomInfoContainer &atomInfo);
    4141
    4242  // internal getter and setter
     43  PdbAtomInfoContainer& getadditionalAtomData(atom *_atom);
    4344  size_t getSerial(const size_t atomid) const;
    44   size_t getAtomId(const size_t atomid) const;
    45   void setAtomId(const size_t localatomid, const size_t atomid);
     45  void setSerial(const size_t localatomid, const size_t atomid);
     46
     47  /**
     48   * argh, why can't just PdbKey::X+(size_t)i
     49   */
     50  std::map<size_t, PdbKey::PdbDataKey> PositionEnumMap;
    4651
    4752  /**
  • src/Parser/TremoloAtomInfoContainer.cpp

    rdd97a9 r5d6f38  
    4242  GrpTypeNo("0"),
    4343  torsion("-"),
    44   neighbors(std::vector<int>(0, 5))
     44  neighbors(std::vector<int>(0, 5)),
     45  neighbors_processed(false)
    4546{}
    4647
  • src/Parser/TremoloAtomInfoContainer.hpp

    rdd97a9 r5d6f38  
    3939  std::string torsion;
    4040  std::vector<int> neighbors;
     41  bool neighbors_processed;
    4142};
    4243
  • src/Parser/TremoloParser.cpp

    rdd97a9 r5d6f38  
    9090  string::size_type location;
    9191
     92  // reset atomIdMap, for we now get new serials
     93  atomIdMap.clear();
    9294  usedFields.clear();
     95
    9396  molecule *newmol = World::getInstance().createMolecule();
    9497  newmol->ActiveFlag = true;
     
    114117
    115118/**
    116  * Saves the World's current state into as a tremolo file.
     119 * Saves the \a atoms into as a tremolo file.
    117120 *
    118121 * \param file where to save the state
    119  */
    120 void TremoloParser::save(ostream* file) {
     122 * \param atoms atoms to store
     123 */
     124void TremoloParser::save(ostream* file, const std::vector<atom *> &AtomList) {
    121125  DoLog(0) && (Log() << Verbose(0) << "Saving changes to tremolo." << std::endl);
    122126
    123   vector<atom*>::iterator atomIt;
     127  vector<atom*>::const_iterator atomIt;
    124128  vector<string>::iterator it;
    125129
     
    129133  }
    130134  *file << endl;
    131   vector<atom *> AtomList = World::getInstance().getAllAtoms();
    132135  for (atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
    133136    saveLine(file, *atomIt);
     
    220223        ? (*currentBond)->GetOtherAtom(currentAtom)->getId()+1 : 0) << "\t";
    221224    if (currentBond != currentAtom->ListOfBonds.end())
    222       currentBond++;
     225      ++currentBond;
    223226  }
    224227}
     
    259262  atom* newAtom = World::getInstance().createAtom();
    260263  TremoloAtomInfoContainer *atomInfo = NULL;
    261   additionalAtomData[newAtom->getId()] = *(new TremoloAtomInfoContainer);
     264  additionalAtomData[newAtom->getId()] = TremoloAtomInfoContainer(); // fill with default values
    262265  atomInfo = &additionalAtomData[newAtom->getId()];
    263266  TremoloKey::atomDataKey currentField;
     
    310313 * Reads neighbor information for one atom from the input.
    311314 *
    312  * \param stream where to read the information from
    313  * \param number of neighbors to read
    314  * \param world id of the atom the information belongs to
     315 * \param line stream where to read the information from
     316 * \param numberOfNeighbors number of neighbors to read
     317 * \param atomid world id of the atom the information belongs to
    315318 */
    316319void TremoloParser::readNeighbors(stringstream* line, int numberOfNeighbors, int atomId) {
     
    320323    // 0 is used to fill empty neighbor positions in the tremolo file.
    321324    if (neighborId > 0) {
     325//      std::cout << "Atom with global id " << atomId << " has neighbour with serial " << neighborId << std::endl;
    322326      additionalAtomData[atomId].neighbors.push_back(neighborId);
    323327    }
     
    356360    currentInfo != additionalAtomData.end(); currentInfo++
    357361  ) {
    358     for(vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
    359       neighbor != currentInfo->second.neighbors.end(); neighbor++
    360     ) {
    361       World::getInstance().getAtom(AtomById(currentInfo->first))
    362           ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
     362    if (!currentInfo->second.neighbors_processed) {
     363      for(vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
     364        neighbor != currentInfo->second.neighbors.end(); neighbor++
     365      ) {
     366//        std::cout << "Creating bond between ("
     367//            << currentInfo->first
     368//            << ") and ("
     369//            << atomIdMap[*neighbor] << "|" << *neighbor << ")" << std::endl;
     370        World::getInstance().getAtom(AtomById(currentInfo->first))
     371            ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
     372      }
     373      currentInfo->second.neighbors_processed = true;
    363374    }
    364375  }
  • src/Parser/TremoloParser.hpp

    rdd97a9 r5d6f38  
    2626  ~TremoloParser();
    2727  void load(std::istream* file);
    28   void save(std::ostream* file);
     28  void save(std::ostream* file, const std::vector<atom *> &atoms);
    2929  void setFieldsForSave(std::string atomDataLine);
    3030
  • src/Parser/XyzParser.cpp

    rdd97a9 r5d6f38  
    7878
    7979/**
    80  * Saves the current state of the World into the given XYZ file.
     80 * Saves the \a atoms into as a XYZ file.
    8181 *
    82  * \param XYZ file
     82 * \param file where to save the state
     83 * \param atoms atoms to store
    8384 */
    84 void XyzParser::save(ostream* file) {
     85void XyzParser::save(ostream* file, const std::vector<atom *> &atoms) {
    8586  DoLog(0) && (Log() << Verbose(0) << "Saving changes to xyz." << std::endl);
    8687  //if (comment == "") {
     
    9596      comment += time;
    9697  //}
    97   *file << World::getInstance().numAtoms() << endl << "\t" << comment << endl;
     98  *file << atoms.size() << endl << "\t" << comment << endl;
    9899
    99   vector<atom*> atoms = World::getInstance().getAllAtoms();
    100   for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) {
     100  for(vector<atom*>::const_iterator it = atoms.begin(); it != atoms.end(); it++) {
    101101    *file << noshowpoint << (*it)->getType()->getSymbol() << "\t" << (*it)->at(0) << "\t" << (*it)->at(1) << "\t" << (*it)->at(2) << endl;
    102102  }
  • src/Parser/XyzParser.hpp

    rdd97a9 r5d6f38  
    2020  ~XyzParser();
    2121  void load(std::istream* file);
    22   void save(std::ostream* file);
     22  void save(std::ostream* file, const std::vector<atom *> &atoms);
    2323
    2424private:
  • src/Patterns/Singleton_impl.hpp

    rdd97a9 r5d6f38  
    99#define SINGLETON_IMPL_HPP_
    1010
     11#include "Helpers/Assert.hpp"
    1112#include "Patterns/Singleton.hpp"
    1213
  • src/ThermoStatContainer.cpp

    rdd97a9 r5d6f38  
    5454  ThermostatTraits<Thermostat> *WoodcockTrait = new ThermostatTraits<Woodcock>();
    5555  availThermostats[WoodcockTrait->getName()] = WoodcockTrait;
    56   for(traitsMap::iterator iter = availThermostats.begin();iter!=availThermostats.end();++iter){
    57     cout << iter->first << endl;
    58   }
     56
     57  // for debugging: list all thermostats
     58//  cout << "List of known thermostats: ";
     59//  for(traitsMap::iterator iter = availThermostats.begin();iter!=availThermostats.end();++iter){
     60//    cout << iter->first << " ";
     61//  }
     62//  cout << endl;
     63
    5964  ASSERT(availThermostats.size()==6,"Not all implemented thermostats referenced!\nDid you check the names in the traits?");
    6065  activeThermostat=new Berendsen();
  • src/UIElements/CommandLineUI/CommandLineParser.cpp

    rdd97a9 r5d6f38  
    9797      const OptionTrait* const currentOption = OptionRegistry::getInstance().getOptionByName(optioniter->first);
    9898      // add the option
    99       std::cout << "Registering Option "
    100           << currentOption->getName()
    101           << " with type '" << currentOption->getTypeName() << "' "
    102           << " with description '" << currentOption->getDescription() << "' ";
    103       if (currentOption->hasShortForm())
    104         std::cout << ", with short form " << currentOption->getShortForm();
    105       else
    106         std::cout << ", with no short form ";
    107       if (currentOption->hasDefaultValue())
    108         std::cout << ", with default value " << currentOption->getDefaultValue();
    109       else
    110         std::cout << ", with no default value ";
    111       std::cout << std::endl;
     99//      std::cout << "Registering Option "
     100//          << currentOption->getName()
     101//          << " with type '" << currentOption->getTypeName() << "' "
     102//          << " with description '" << currentOption->getDescription() << "' ";
     103//      if (currentOption->hasShortForm())
     104//        std::cout << ", with short form " << currentOption->getShortForm();
     105//      else
     106//        std::cout << ", with no short form ";
     107//      if (currentOption->hasDefaultValue())
     108//        std::cout << ", with default value " << currentOption->getDefaultValue();
     109//      else
     110//        std::cout << ", with no default value ";
     111//      std::cout << std::endl;
    112112
    113113      AddOptionToParser(currentOption, (CmdParserLookup["options"]));
     
    116116    if (!ActionAlreadyAdded_flag) {
    117117      // add the action
    118       std::cout << "Registering Action "
    119           << currentAction->Traits.getName()
    120           << " in menu " << currentAction->Traits.getMenuName()
    121           << " with type '" << currentAction->Traits.getTypeName() << "' "
    122           << " with description '" << currentAction->Traits.getDescription() << "' ";
    123       if (currentAction->Traits.hasShortForm())
    124         std::cout << ", with short form " << currentAction->Traits.getShortForm();
    125       else
    126         std::cout << ", with no short form ";
    127       if (currentAction->Traits.hasDefaultValue())
    128         std::cout << ", with default value " << currentAction->Traits.getDefaultValue();
    129       else
    130         std::cout << ", with no default value ";
    131       std::cout  << std::endl;
     118//      std::cout << "Registering Action "
     119//          << currentAction->Traits.getName()
     120//          << " in menu " << currentAction->Traits.getMenuName()
     121//          << " with type '" << currentAction->Traits.getTypeName() << "' "
     122//          << " with description '" << currentAction->Traits.getDescription() << "' ";
     123//      if (currentAction->Traits.hasShortForm())
     124//        std::cout << ", with short form " << currentAction->Traits.getShortForm();
     125//      else
     126//        std::cout << ", with no short form ";
     127//      if (currentAction->Traits.hasDefaultValue())
     128//        std::cout << ", with default value " << currentAction->Traits.getDefaultValue();
     129//      else
     130//        std::cout << ", with no default value ";
     131//      std::cout  << std::endl;
    132132
    133133      ASSERT(CmdParserLookup.find(currentAction->Traits.getMenuName()) != CmdParserLookup.end(),
     
    156156  ASSERT(currentOption != NULL, "CommandLineParser::AddOptionToParser() - currentOption is NULL!");
    157157  // add other options
    158   std::cout << "Adding Action " << currentOption->getName() << " with type " << currentOption->getType()->name() << " and KeyandShortform " << currentOption->getKeyAndShortForm() << " to CommandLineParser." << std::endl;
     158  //std::cout << "Adding Action " << currentOption->getName() << " with type " << currentOption->getType()->name() << " and KeyandShortform " << currentOption->getKeyAndShortForm() << " to CommandLineParser." << std::endl;
    159159  switch(TypeToEnums.getEnumforType(currentOption->getType())) {
    160160    default:
     
    369369{
    370370  std::map <std::string, std::string> ShortFormToActionMap = getShortFormToActionMap();
     371  DoLog(0) && (Log() << Verbose(0) << "Scanning command line arguments and recognizing Actions." << std::endl);
    371372  // go through all arguments
    372373  for (int i=1;i<argc;i++) {
    373     (std::cout << Verbose(1) << "Checking on " << argv[i] << std::endl);
     374    DoLog(2) && (Log() << Verbose(2) << "Checking on " << argv[i] << std::endl);
    374375    // check whether they
    375376    if (argv[i][0] == '-') { // .. begin with -
    376       (cout << Verbose(1) << "Possible argument: " << argv[i] << endl);
     377      DoLog(2) && (Log() << Verbose(2) << "Possible argument: " << argv[i] << endl);
    377378      if (argv[i][1] == '-') { // .. or --
    378         (cout << Verbose(1) << "Putting " << argv[i] << " into the sequence." << endl);
     379        DoLog(1) && (Log() << Verbose(1) << "Putting " << argv[i] << " into the sequence." << endl);
    379380        SequenceOfActions.push_back(&(argv[i][2]));
    380381        //  .. and check that next letter is not numeric, if so insert
     
    382383        std::map <std::string, std::string>::iterator iter = ShortFormToActionMap.find(&(argv[i][1]));
    383384        if (iter != ShortFormToActionMap.end()) {
    384           (cout << Verbose(1) << "Putting " << iter->second << " for " << iter->first << " into the sequence." << endl);
     385          DoLog(1) && (Log() << Verbose(1) << "Putting " << iter->second << " for " << iter->first << " into the sequence." << endl);
    385386          SequenceOfActions.push_back(iter->second);
    386387        }
     
    404405 * \return map from Action's ShortForm to token.
    405406 */
    406 std::map <std::string, std::string> CommandLineParser::getShortFormToActionMap()
     407std::map <std::string, std::string> CommandLineParser::getShortFormToActionMap() const
    407408{
    408409  std::map <std::string, std::string> result;
  • src/UIElements/CommandLineUI/CommandLineParser.hpp

    rdd97a9 r5d6f38  
    143143
    144144  // creates a map from short forms to action tokens needed to parse command line
    145   std::map <std::string, std::string> getShortFormToActionMap();
     145  std::map <std::string, std::string> getShortFormToActionMap() const;
    146146
    147147  // lookup list from "configmenus" to the ones of CommandLineParser
  • src/UIElements/CommandLineUI/CommandLineWindow.cpp

    rdd97a9 r5d6f38  
    2525#include "CommandLineUI/CommandLineStatusIndicator.hpp"
    2626
     27#include "Helpers/Log.hpp"
     28#include "Helpers/Verbose.hpp"
     29
    2730#include "Actions/Action.hpp"
    2831#include "Actions/ActionRegistry.hpp"
     
    5053
    5154  // go through all possible actions
     55  DoLog(0) && (Log() << Verbose(0) << "Calling Actions ... " << std::endl);
    5256  for (std::list<std::string>::iterator CommandRunner = CommandLineParser::getInstance().SequenceOfActions.begin(); CommandRunner != CommandLineParser::getInstance().SequenceOfActions.end(); ++CommandRunner) {
    53     cout << "Checking presence of " << *CommandRunner << ": ";
    5457    if (ActionRegistry::getInstance().isActionPresentByName(*CommandRunner)) {
    55       cout << "calling " << *CommandRunner << endl;
     58      DoLog(1) && (Log() << Verbose(1)
     59          << "Checking presence of " << *CommandRunner << ": "
     60          << "calling " << *CommandRunner << endl);
    5661      ActionRegistry::getInstance().getActionByName(*CommandRunner)->call();
    5762    } else {
    58       cout << "absent." << endl;
     63      DoLog(1) && (Log() << Verbose(1)
     64          << "Checking presence of " << *CommandRunner << ": "
     65          << "absent." << endl);
    5966    }
    6067  }
  • src/UIElements/CommandLineUI/TypeEnumContainer.cpp

    rdd97a9 r5d6f38  
    6464  TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElementsType;
    6565
    66   ListAllKnownTypes();
     66  // for debugging: list all stored types
     67  //ListAllKnownTypes();
    6768};
    6869
     
    8384    std::cout << " Known type is " << (iter->first)->name() << " or enum " << iter->second << std::endl;
    8485  }
    85   std::cout << "BoxVector type is " << typeid(BoxVector).name() << std::endl;
    86   std::cout << "Vector type is " << typeid(Vector).name() << std::endl;
    87   std::cout << "VectorValue type is " << typeid(VectorValue).name() << std::endl;
    8886}
    8987
     
    9492enum TypeEnumContainer::EnumOfTypes TypeEnumContainer::getEnumforType(const std::type_info *_type)
    9593{
    96   std::cout << "Looking for type " << _type->name() << std::endl;
     94  //std::cout << "Looking for type " << _type->name() << std::endl;
    9795  ASSERT(TypeEnumMap.find(_type) != TypeEnumMap.end(),
    9896      "CommandLineParser::getEnumforType() - cannot find the type as enum!.");
  • src/UIElements/Menu/Menu.cpp

    rdd97a9 r5d6f38  
    7676        const std::string &TopName = iter->second.first;
    7777        const int &MenuPosition = iter->second.second;
    78         std::cout << "MenuName is " << MenuName
    79             << ", TopName is " << TopName
    80             << " and Position is " << MenuPosition
    81             << std::endl;
     78//        std::cout << "MenuName is " << MenuName
     79//            << ", TopName is " << TopName
     80//            << " and Position is " << MenuPosition
     81//            << std::endl;
    8282
    8383        // does it belong to us?
     
    125125void Menu::addSeparator()
    126126{
    127   std::cout << "Creating separator at position " << TopPosition << std::endl;
     127//  std::cout << "Creating separator at position " << TopPosition << std::endl;
    128128  ASSERT( LastItem != SeparatorItem,
    129129      "Menu::populate() - adding another separator after a separator!");
     
    135135void Menu::addSubmenu(const std::string &MenuName, const int MenuPosition)
    136136{
    137   std::cout << "Creating top-level menu " << MenuName
    138       << " at position " << TopPosition << std::endl;
     137//  std::cout << "Creating top-level menu " << MenuName
     138//      << " at position " << TopPosition << std::endl;
    139139  ASSERT (!isPresent(MenuName),
    140140      "Menu::addSubmenu() - trying to add menu "+MenuName+" with already present token!");
  • src/UIElements/Menu/MenuDescription.cpp

    rdd97a9 r5d6f38  
    8989MenuDescription::~MenuDescription()
    9090{
    91   std::cout << "MenuDescription: clearing maps ... " << std::endl;
     91  //std::cout << "MenuDescription: clearing maps ... " << std::endl;
    9292  for (IterableMap::iterator iter = MenuPositionMap->begin(); !MenuPositionMap->empty(); iter = MenuPositionMap->begin())
    9393    MenuPositionMap->erase(iter);
  • src/UIElements/Menu/Qt4/QtMenu.hpp

    rdd97a9 r5d6f38  
    7272        CharRunner != ActionName.end();
    7373        ++CharRunner) {
    74       std::cout << "Current char is " << *CharRunner << std::endl;
     74//      std::cout << "Current char is " << *CharRunner << std::endl;
    7575      if (!Inserted) {
    7676        Inserter = ShortcutMap.insert(
     
    7878            );
    7979        if (Inserter.second) {
    80           std::cout << "Accelerator is " << *CharRunner << std::endl;
     80//          std::cout << "Accelerator is " << *CharRunner << std::endl;
    8181          newname += '&';
    8282          Inserted = true;
  • src/builder.cpp

    rdd97a9 r5d6f38  
    7373#endif
    7474
    75 #include "Helpers/MemDebug.hpp"
    76 
    77 #include "bondgraph.hpp"
    78 #include "config.hpp"
    79 #include "Helpers/Log.hpp"
    80 #include "molecule.hpp"
    81 #include "periodentafel.hpp"
    82 #include "tesselationhelpers.hpp"
    83 #include "UIElements/UIFactory.hpp"
    84 #include "UIElements/Menu/MenuDescription.hpp"
    85 #include "UIElements/TextUI/TextUIFactory.hpp"
    86 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
    87 #include "UIElements/CommandLineUI/CommandLineParser.hpp"
    88 #ifdef USE_GUI_QT
    89 #include "UIElements/Qt4/QtUIFactory.hpp"
    90 #endif
    91 #include "UIElements/MainWindow.hpp"
    92 #include "UIElements/Dialog.hpp"
    93 //#include "Menu/ActionMenuItem.hpp"
    94 #include "Helpers/Verbose.hpp"
    95 #include "World.hpp"
    96 
    97 #include "Actions/ActionRegistry.hpp"
    98 #include "Actions/ActionHistory.hpp"
    99 
    100 #include "Parser/ChangeTracker.hpp"
    101 #include "Parser/FormatParserStorage.hpp"
    102 
    103 #include "UIElements/UIFactory.hpp"
    104 #include "UIElements/TextUI/TextUIFactory.hpp"
    105 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
    106 #include "UIElements/MainWindow.hpp"
    107 #include "UIElements/Dialog.hpp"
    108 
    109 #include "version.h"
    110 
     75#include "builder_init.hpp"
    11176
    11277/********************************************** Main routine **************************************/
    11378
    114 /** In this function all dynamicly allocated member variables to static/global
    115  * variables are added to the ignore list of Memory/MemDebug.
    116  *
    117  * Use this to prevent their listing in the Memory::getState() at the end of the
    118  * program. Check with valgrind that truely no memory leak occurs!
    119  */
    120 void AddStaticEntitiestoIgnoreList()
    121 {
    122   // zeroVec and unitVec are global variables (on the stack) but vectorContent
    123   // within is situated on the heap and has to be ignored
    124   Memory::ignore(zeroVec.get());
    125   Memory::ignore(unitVec[0].get());
    126   Memory::ignore(unitVec[1].get());
    127   Memory::ignore(unitVec[2].get());
    128 }
    129 
    130 /** Cleans all singleton instances in an orderly fashion.
    131  * C++ does not guarantee any specific sequence of removal of single instances
    132  * which have static/global variables. Some singletons depend on others hence we
    133  * acertain a specific ordering here, which is is used via the atexit() hook.
    134  */
    135 void cleanUp(){
    136   FormatParserStorage::purgeInstance();
    137   ChangeTracker::purgeInstance();
    138   World::purgeInstance();
    139   MenuDescription::purgeInstance();
    140   UIFactory::purgeInstance();
    141   ValueStorage::purgeInstance();
    142   CommandLineParser::purgeInstance();
    143   ActionRegistry::purgeInstance();
    144   OptionRegistry::purgeInstance();
    145   ActionHistory::purgeInstance();
    146   // we have to remove these two static as otherwise their boost::shared_ptrs are still present
    147   Action::removeStaticStateEntities();
    148   // put some static variables' dynamic contents on the Memory::ignore map to avoid their
    149   // admonishing lateron
    150   AddStaticEntitiestoIgnoreList();
    151   logger::purgeInstance();
    152   errorLogger::purgeInstance();
    153 #ifdef LOG_OBSERVER
    154   cout << observerLog().getLog();
    155 #endif
    156   Memory::getState();
    157 }
    158 
    159 void dumpMemory(){
    160   ofstream ost("molecuilder.memdump");
    161   Memory::dumpMemory(ost);
    162 }
    163 
    16479int main(int argc, char **argv)
    16580{
    166   // while we are non interactive, we want to abort from asserts
    167   ASSERT_DO(Assert::Abort);
    168   ASSERT_HOOK(dumpMemory);
    169   string line;
    170   char **Arguments = NULL;
    171   int ArgcSize = 0;
    172   int ExitFlag = 0;
    173   bool ArgumentsCopied = false;
    174   std::string BondGraphFileName("\n");
     81  initGeneral();
    17582
    176   // print version check and copyright notice
    177   cout << MOLECUILDERVERSION << endl;
    178   cout << "MoleCuilder comes with ABSOLUTELY NO WARRANTY; for details type" << endl;
    179   cout << "`molecuilder --warranty'." << endl;
    180   cout << "`MoleCuilder - to create and alter molecular systems." << endl;
    181   cout << "Copyright (C) 2010  University Bonn. All rights reserved." << endl;
     83  initUI(argc,argv);
    18284
    183   setVerbosity(0);
    184   // need to init the history before any action is created
    185   ActionHistory::init();
     85  doUI();
    18686
    187   // from this moment on, we need to be sure to deeinitialize in the correct order
    188   // this is handled by the cleanup function
    189   atexit(cleanUp);
    190 
    191   // Parse command line options and if present create respective UI
    192   {
    193     // construct bond graph
    194     if (World::getInstance().getConfig()->BG == NULL) {
    195       World::getInstance().getConfig()->BG = new BondGraph(World::getInstance().getConfig()->GetIsAngstroem());
    196       if (World::getInstance().getConfig()->BG->LoadBondLengthTable(BondGraphFileName)) {
    197         DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
    198       } else {
    199         DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
    200       }
    201     }
    202     // handle remaining arguments by CommandLineParser
    203     if (argc>1) {
    204       CommandLineParser::getInstance().InitializeCommandArguments();
    205       CommandLineParser::getInstance().Run(argc,argv);
    206       DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
    207       UIFactory::registerFactory(new CommandLineUIFactory::description());
    208       UIFactory::makeUserInterface("CommandLine");
    209     } else {
    210       // In the interactive mode, we can leave the user the choice in case of error
    211       ASSERT_DO(Assert::Ask);
    212       #ifdef USE_GUI_QT
    213         DoLog(0) && (Log() << Verbose(0) << "Setting UI to Qt4." << endl);
    214         UIFactory::registerFactory(new QtUIFactory::description());
    215         UIFactory::makeUserInterface("Qt4");
    216       #else
    217         DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
    218         cout << MOLECUILDERVERSION << endl;
    219         UIFactory::registerFactory(new TextUIFactory::description());
    220         UIFactory::makeUserInterface("Text");
    221       #endif
    222     }
    223   }
    224 
    225   {
    226     MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow();
    227     mainWindow->display();
    228     delete mainWindow;
    229   }
    230 
    231   FormatParserStorage::getInstance().SaveAll();
    232   ChangeTracker::getInstance().saveStatus();
    233 
    234   // free the new argv
    235   if (ArgumentsCopied) {
    236     for (int i=0; i<ArgcSize;i++)
    237       delete[](Arguments[i]);
    238     delete[](Arguments);
    239   }
    240   //delete[](ConfigFileName);
    241 
    242   ExitFlag = World::getInstance().getExitFlag();
    243   return (ExitFlag == 1 ? 0 : ExitFlag);
     87  return saveAll();
    24488}
    24589
  • src/molecule_dynamics.cpp

    rdd97a9 r5d6f38  
    484484           atoms.end(),
    485485           boost::bind(&atom::EvaluateConstrainedForce,_1,startstep,endstep,PermutationMap,Force));
    486   //ActOnAllAtoms( &atom::EvaluateConstrainedForce, startstep, endstep, PermutationMap, Force );
    487486  DoLog(1) && (Log() << Verbose(1) << "done." << endl);
    488487};
     
    617616    // and perform Verlet integration for each atom with position, velocity and force vector
    618617    // check size of vectors
    619     //ActOnAllAtoms( &atom::ResizeTrajectory, MDSteps+10 );
    620618    for_each(atoms.begin(),
    621619             atoms.end(),
  • src/periodentafel.cpp

    rdd97a9 r5d6f38  
    307307    //cout << "First header: " << header1tmp << endl;
    308308    //cout << "Second header: " << header2tmp << endl;
    309     DoLog(0) && (Log() << Verbose(0) <<  "Parsed elements:");
     309//    DoLog(0) && (Log() << Verbose(0) <<  "Parsed elements:");
    310310    while (!input.eof()) {
    311311      element *neues = new element;
     
    332332      if ((neues->getNumber() > 0) && (neues->getNumber() < MAX_ELEMENTS)) {
    333333        parsedElements[neues->Z] = neues;
    334         DoLog(0) && (Log() << Verbose(0) << " " << *neues);
     334//        DoLog(0) && (Log() << Verbose(0) << " " << *neues);
    335335      } else {
    336336        DoeLog(2) && (eLog() << Verbose(2) << "Detected empty line or invalid element in elements db, discarding." << endl);
     
    345345      }
    346346    }
    347     DoLog(0) && (Log() << Verbose(0) << endl);
     347//    DoLog(0) && (Log() << Verbose(0) << endl);
    348348  } else {
    349349    DoeLog(1) && (eLog() << Verbose(1) << "Could not open the database." << endl);
  • src/periodentafel.hpp

    rdd97a9 r5d6f38  
    1313#include <string>
    1414
    15 #include "unittests/periodentafelTest.hpp"
     15#include "unittests/PeriodentafelUnitTest.hpp"
    1616#include "Helpers/defs.hpp"
    1717#include "types.hpp"
  • src/tesselationhelpers.cpp

    rdd97a9 r5d6f38  
    2929#include "Helpers/Info.hpp"
    3030#include "linkedcell.hpp"
    31 #include "LinearAlgebra/linearsystemofequations.hpp"
     31#include "LinearAlgebra/LinearSystemOfEquations.hpp"
    3232#include "Helpers/Log.hpp"
    3333#include "tesselation.hpp"
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    rdd97a9 r5d6f38  
    2727
    2828#include "analysis_correlation.hpp"
    29 #include "AnalysisCorrelationToPointUnitTest.hpp"
    3029
    3130#include "Descriptors/MoleculeDescriptor.hpp"
     
    3736#include "periodentafel.hpp"
    3837#include "World.hpp"
     38
     39#include "AnalysisCorrelationToPointUnitTest.hpp"
    3940
    4041#ifdef HAVE_TESTRUNNER
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    rdd97a9 r5d6f38  
    2727
    2828#include "analysis_correlation.hpp"
    29 #include "AnalysisCorrelationToSurfaceUnitTest.hpp"
    30 
    3129#include "Descriptors/MoleculeDescriptor.hpp"
    3230
     
    4139#include "Helpers/Assert.hpp"
    4240
    43 #include "Helpers/Assert.hpp"
     41#include "AnalysisCorrelationToSurfaceUnitTest.hpp"
    4442
    4543#ifdef HAVE_TESTRUNNER
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    rdd97a9 r5d6f38  
    2727
    2828#include "analysis_correlation.hpp"
    29 #include "AnalysisPairCorrelationUnitTest.hpp"
    30 
    3129#include "Descriptors/MoleculeDescriptor.hpp"
    3230
     
    4038#include "tesselation.hpp"
    4139#include "World.hpp"
     40
     41#include "AnalysisPairCorrelationUnitTest.hpp"
    4242
    4343#ifdef HAVE_TESTRUNNER
  • src/unittests/CountBondsUnitTest.cpp

    rdd97a9 r5d6f38  
    3838#include "periodentafel.hpp"
    3939#include "World.hpp"
     40
    4041#include "CountBondsUnitTest.hpp"
    4142
  • src/unittests/LinkedCellUnitTest.cpp

    rdd97a9 r5d6f38  
    3333#include "molecule.hpp"
    3434#include "periodentafel.hpp"
     35#include "World.hpp"
     36
    3537#include "LinkedCellUnitTest.hpp"
    36 #include "World.hpp"
    3738
    3839#ifdef HAVE_TESTRUNNER
  • src/unittests/Makefile.am

    rdd97a9 r5d6f38  
    11# PLEASE adhere to the alphabetical ordering in this Makefile!
    22# Also indentation by a single tab
     3
     4SUBDIRS = \
     5        ../Actions/unittests \
     6        ../Descriptors/unittests \
     7        ../Helpers/unittests \
     8        ../LinearAlgebra/unittests \
     9        ../Parser/unittests \
     10        ../Patterns/unittests \
     11        ../UIElements/Menu/unittests
    312
    413INCLUDES = -I$(top_srcdir)/src
     
    918
    1019TESTS = \
    11   ActionSequenceTest \
    12   ActOnAllUnitTest \
    13   AnalysisBondsUnitTests \
     20  AnalysisBondsUnitTest \
    1421  AnalysisCorrelationToPointUnitTest \
    1522  AnalysisCorrelationToSurfaceUnitTest \
    1623  AnalysisPairCorrelationUnitTest \
    17   atomsCalculationTest \
    18   AtomDescriptorTest \
    1924  BondGraphUnitTest \
    20   BoxUnittest \
    21   CacheableTest \
     25  BoxUnitTest \
    2226  CountBondsUnitTest \
    2327  FormulaUnittest \
    24   InfoUnitTest \
    25   LinearSystemOfEquationsUnitTest \
    26   LineUnittest \
    2728  LinkedCellUnitTest \
    2829  ListOfBondsUnitTest \
    29   LogUnitTest \
    30   manipulateAtomsTest \
    31   MatrixContentSymmetricUnitTest \
    32   MatrixContentUnitTest \
    33   MatrixUnittest \
    34   MenuDescriptionUnitTest \
    35   MoleculeDescriptorTest \
    36   ObserverTest \
    37   ParserCommonUnitTest \
    38   ParserTremoloUnitTest \
    39   periodentafelTest \
    40   PlaneUnittest \
    41   Registry \
    42   ShapeUnittest \
    43   SingletonTest \
     30  PeriodentafelUnitTest \
    4431  SubspaceFactorizerUnitTest \
    4532  TesselationUnitTest \
    4633  Tesselation_BoundaryTriangleUnitTest \
    47   Tesselation_InOutsideUnitTest \
    48   VectorContentUnitTest \
    49   VectorUnitTest
     34  Tesselation_InOutsideUnitTest
    5035
    5136
     
    7055
    7156TESTSOURCES = \
    72   ActOnAllUnitTest.cpp \
    73   ActionSequenceTest.cpp \
    74   analysisbondsunittest.cpp \
     57  ../Actions/unittests/ActionRegistryUnitTest.cpp \
     58  ../Actions/unittests/ActionSequenceUnitTest.cpp \
     59  AnalysisBondsUnitTest.cpp \
    7560  AnalysisCorrelationToPointUnitTest.cpp \
    7661  AnalysisCorrelationToSurfaceUnitTest.cpp  \
    7762  AnalysisPairCorrelationUnitTest.cpp \
    78   AtomDescriptorTest.cpp \
    79   atomsCalculationTest.cpp \
    80   bondgraphunittest.cpp \
    81   BoxUnittest.cpp \
    82   CacheableTest.cpp \
     63  ../Descriptors/unittests/AtomDescriptorUnitTest.cpp \
     64  ../Actions/unittests/AtomsCalculationUnitTest.cpp \
     65  BondGraphUnitTest.cpp \
     66  BoxUnitTest.cpp \
     67  ../Patterns/unittests/CacheableUnitTest.cpp \
    8368  CountBondsUnitTest.cpp \
    84   FormulaUnittest.cpp \
    85   infounittest.cpp \
    86   linearsystemofequationsunittest.cpp \
    87   LineUnittest.cpp \
     69  FormulaUnitTest.cpp \
     70  ../Helpers/unittests/InfoUnitTest.cpp \
     71  ../LinearAlgebra/unittests/LinearSystemOfEquationsUnitTest.cpp \
     72  ../LinearAlgebra/unittests/LineUnitTest.cpp \
    8873  LinkedCellUnitTest.cpp \
    89   listofbondsunittest.cpp \
    90   logunittest.cpp \
    91   MatrixContentSymmetricUnittest.cpp \
    92   MatrixContentUnittest.cpp \
    93   MatrixUnittest.cpp \
    94   manipulateAtomsTest.cpp \
    95   MenuDescriptionUnitTest.cpp \
    96   MoleculeDescriptorTest.cpp \
    97   ObserverTest.cpp \
    98   ParserCommonUnitTest.cpp \
    99   ParserTremoloUnitTest.cpp \
    100   periodentafelTest.cpp \
    101   PlaneUnittest.cpp \
    102   RegistryUnitTest.cpp \
    103   ShapeUnittest.cpp \
    104   SingletonTest.cpp \
    105   tesselationunittest.cpp \
    106   tesselation_boundarytriangleunittest.cpp \
    107   tesselation_insideoutsideunittest.cpp \
    108   VectorContentUnittest.cpp \
    109   vectorunittest.cpp
     74  ListOfBondsUnitTest.cpp \
     75  ../Helpers/unittests/LogUnitTest.cpp \
     76  ../Actions/unittests/ManipulateAtomsUnitTest.cpp \
     77  ../LinearAlgebra/unittests/MatrixContentSymmetricUnitTest.cpp \
     78  ../LinearAlgebra/unittests/MatrixContentUnitTest.cpp \
     79  ../LinearAlgebra/unittests/MatrixUnitTest.cpp \
     80  ../UIElements/Menu/unittests/MenuDescriptionUnitTest.cpp \
     81  ../Descriptors/unittests/MoleculeDescriptorUnitTest.cpp \
     82  ../Patterns/unittests/ObserverUnitTest.cpp \
     83  ../Parser/unittests/ParserCommonUnitTest.cpp \
     84  ../Parser/unittests/ParserTremoloUnitTest.cpp \
     85  PeriodentafelUnitTest.cpp \
     86  ../LinearAlgebra/unittests/PlaneUnitTest.cpp \
     87  ../Patterns/unittests/RegistryUnitTest.cpp \
     88  ../Shapes/unittests/ShapeUnitTest.cpp \
     89  ../Patterns/unittests/SingletonUnitTest.cpp \
     90  TesselationUnitTest.cpp \
     91  Tesselation_BoundaryTriangleUnitTest.cpp \
     92  Tesselation_InsideOutsideUnitTest.cpp \
     93  ../LinearAlgebra/unittests/VectorContentUnitTest.cpp \
     94  ../LinearAlgebra/unittests/VectorUnitTest.cpp
    11095
    11196TESTHEADERS = \
    112   ActOnAllUnitTest.hpp \
    113   ActionSequenceTest.hpp \
    114   analysisbondsunittest.hpp \
     97  ../Actions/unittests/ActionRegistryUnitTest.hpp \
     98  ../Actions/unittests/ActionSequenceUnitTest.hpp \
     99  AnalysisBondsUnitTest.hpp \
    115100  AnalysisCorrelationToPointUnitTest.hpp \
    116101  AnalysisCorrelationToSurfaceUnitTest.hpp  \
    117102  AnalysisPairCorrelationUnitTest.hpp \
    118   AtomDescriptorTest.hpp \
    119   atomsCalculationTest.hpp \
    120   bondgraphunittest.hpp \
    121   BoxUnittest.hpp \
    122   CacheableTest.hpp \
     103  ../Descriptors/unittests/AtomDescriptorUnitTest.hpp \
     104  ../Actions/unittests/AtomsCalculationUnitTest.hpp \
     105  BondGraphUnitTest.hpp \
     106  BoxUnitTest.hpp \
     107  ../Patterns/unittests/CacheableUnitTest.hpp \
    123108  CountBondsUnitTest.hpp \
    124   FormulaUnittest.hpp \
    125   infounittest.hpp \
    126   linearsystemofequationsunittest.hpp \
    127   LineUnittest.hpp \
     109  FormulaUnitTest.hpp \
     110  ../Helpers/unittests/InfoUnitTest.hpp \
     111  ../LinearAlgebra/unittests/LinearSystemOfEquationsUnitTest.hpp \
     112  ../LinearAlgebra/unittests/LineUnitTest.hpp \
    128113  LinkedCellUnitTest.hpp \
    129   listofbondsunittest.hpp \
    130   logunittest.hpp \
    131   manipulateAtomsTest.hpp \
    132   MatrixContentSymmetricUnittest.hpp \
    133   MatrixContentUnittest.hpp \
    134   MatrixUnittest.hpp \
    135   MenuDescriptionUnitTest.hpp \
    136   MoleculeDescriptorTest.hpp \
    137   ObserverTest.hpp \
    138   periodentafelTest.hpp \
    139   ParserCommonUnitTest.hpp \
    140   ParserTremoloUnitTest.hpp \
    141   PlaneUnittest.hpp \
    142   RegistryUnitTest.hpp \
    143   SingletonTest.hpp \
    144   tesselationunittest.hpp \
    145   tesselation_boundarytriangleunittest.hpp \
    146   tesselation_insideoutsideunittest.hpp \
    147   VectorContentUnittest.hpp \
    148   vectorunittest.hpp
     114  ListOfBondsUnitTest.hpp \
     115  ../Helpers/unittests/LogUnitTest.hpp \
     116  ../Actions/unittests/ManipulateAtomsUnitTest.hpp \
     117  ../LinearAlgebra/unittests/MatrixContentSymmetricUnitTest.hpp \
     118  ../LinearAlgebra/unittests/MatrixContentUnitTest.hpp \
     119  ../LinearAlgebra/unittests/MatrixUnitTest.hpp \
     120  ../UIElements/Menu/unittests/MenuDescriptionUnitTest.hpp \
     121  ../Descriptors/unittests/MoleculeDescriptorUnitTest.hpp \
     122  ../Patterns/unittests/ObserverUnitTest.hpp \
     123  ../Parser/unittests/ParserCommonUnitTest.hpp \
     124  ../Parser/unittests/ParserTremoloUnitTest.hpp \
     125  PeriodentafelUnitTest.hpp \
     126  ../LinearAlgebra/unittests/PlaneUnitTest.hpp \
     127  ../Patterns/unittests/RegistryUnitTest.hpp \
     128  ../Shapes/unittests/ShapeUnitTest.hpp \
     129  ../Patterns/unittests/SingletonUnitTest.hpp \
     130  TesselationUnitTest.hpp \
     131  Tesselation_BoundaryTriangleUnitTest.hpp \
     132  Tesselation_InsideOutsideUnitTest.hpp \
     133  ../LinearAlgebra/unittests/VectorContentUnitTest.hpp \
     134  ../LinearAlgebra/unittests/VectorUnitTest.hpp
    149135 
    150136
    151 ActionSequenceTest_SOURCES = UnitTestMain.cpp ActionSequenceTest.cpp ActionSequenceTest.hpp
    152 ActionSequenceTest_LDADD = ${UILIBS} ${ALLLIBS}
    153 
    154 ActOnAllUnitTest_SOURCES = UnitTestMain.cpp ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp
    155 ActOnAllUnitTest_LDADD = ${ALLLIBS}
    156 
    157 AnalysisBondsUnitTests_SOURCES = UnitTestMain.cpp analysisbondsunittest.cpp analysisbondsunittest.hpp
    158 AnalysisBondsUnitTests_LDADD = ${ALLLIBS}
    159 
    160 AnalysisCorrelationToPointUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp
     137AnalysisBondsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     138        AnalysisBondsUnitTest.cpp \
     139        AnalysisBondsUnitTest.hpp
     140AnalysisBondsUnitTest_LDADD = ${ALLLIBS}
     141
     142AnalysisCorrelationToPointUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     143        analysis_correlation.hpp \
     144        AnalysisCorrelationToPointUnitTest.cpp \
     145        AnalysisCorrelationToPointUnitTest.hpp
    161146AnalysisCorrelationToPointUnitTest_LDADD = ${ALLLIBS}
    162147
    163 AnalysisCorrelationToSurfaceUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp
     148AnalysisCorrelationToSurfaceUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     149        analysis_correlation.hpp \
     150        AnalysisCorrelationToSurfaceUnitTest.cpp \
     151        AnalysisCorrelationToSurfaceUnitTest.hpp
    164152AnalysisCorrelationToSurfaceUnitTest_LDADD = ${ALLLIBS}
    165153
    166 AnalysisPairCorrelationUnitTest_SOURCES = UnitTestMain.cpp analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp
     154AnalysisPairCorrelationUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     155        analysis_correlation.hpp \
     156        AnalysisPairCorrelationUnitTest.cpp \
     157        AnalysisPairCorrelationUnitTest.hpp
    167158AnalysisPairCorrelationUnitTest_LDADD = ${ALLLIBS}
    168159
    169 atomsCalculationTest_SOURCES = UnitTestMain.cpp atomsCalculationTest.cpp atomsCalculationTest.hpp
    170 atomsCalculationTest_LDADD = ${ALLLIBS}
    171 
    172 AtomDescriptorTest_SOURCES = UnitTestMain.cpp AtomDescriptorTest.cpp AtomDescriptorTest.hpp
    173 AtomDescriptorTest_LDADD = ${ALLLIBS}
    174 
    175 BondGraphUnitTest_SOURCES = UnitTestMain.cpp bondgraphunittest.cpp bondgraphunittest.hpp
     160BondGraphUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     161        BondGraphUnitTest.cpp \
     162        BondGraphUnitTest.hpp
    176163BondGraphUnitTest_LDADD = ${ALLLIBS}
    177164
    178 BoxUnittest_SOURCES = UnitTestMain.cpp BoxUnittest.cpp BoxUnittest.hpp
    179 BoxUnittest_LDADD = ${ALLLIBS}
    180 
    181 CacheableTest_SOURCES = UnitTestMain.cpp CacheableTest.cpp CacheableTest.hpp
    182 CacheableTest_LDADD = ${ALLLIBS}
    183 
    184 CountBondsUnitTest_SOURCES = UnitTestMain.cpp CountBondsUnitTest.cpp CountBondsUnitTest.hpp
     165BoxUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     166        BoxUnitTest.cpp \
     167        BoxUnitTest.hpp
     168BoxUnitTest_LDADD = ${ALLLIBS}
     169
     170CountBondsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     171        CountBondsUnitTest.cpp \
     172        CountBondsUnitTest.hpp
    185173CountBondsUnitTest_LDADD = ${ALLLIBS}
    186174
    187 FormulaUnittest_SOURCES = UnitTestMain.cpp FormulaUnittest.cpp FormulaUnittest.hpp
     175FormulaUnittest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     176        FormulaUnitTest.cpp \
     177        FormulaUnitTest.hpp
    188178FormulaUnittest_LDADD = ${ALLLIBS}
    189179
    190 MatrixContentSymmetricUnitTest_SOURCES = UnitTestMain.cpp MatrixContentSymmetricUnittest.cpp MatrixContentSymmetricUnittest
    191 MatrixContentSymmetricUnitTest_LDADD = ${ALLLIBS}
    192 
    193 MatrixContentUnitTest_SOURCES = UnitTestMain.cpp MatrixContentUnittest.cpp MatrixContentUnittest.hpp
    194 MatrixContentUnitTest_LDADD = ${ALLLIBS}
    195 
    196 InfoUnitTest_SOURCES = UnitTestMain.cpp infounittest.cpp infounittest.hpp
    197 InfoUnitTest_LDADD = ${ALLLIBS}
    198 
    199 LinearSystemOfEquationsUnitTest_SOURCES = UnitTestMain.cpp linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp
    200 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}
    201 
    202 LineUnittest_SOURCES = UnitTestMain.cpp LineUnittest.cpp LineUnittest.hpp
    203 LineUnittest_LDADD = ${ALLLIBS}
    204 
    205 LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp
     180LinkedCellUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     181        LinkedCellUnitTest.cpp \
     182        LinkedCellUnitTest.hpp
    206183LinkedCellUnitTest_LDADD = ${ALLLIBS}
    207184
    208 ListOfBondsUnitTest_SOURCES = UnitTestMain.cpp listofbondsunittest.cpp listofbondsunittest.hpp
     185ListOfBondsUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     186        ListOfBondsUnitTest.cpp \
     187        ListOfBondsUnitTest.hpp
    209188ListOfBondsUnitTest_LDADD = ${ALLLIBS}
    210189
    211 LogUnitTest_SOURCES = UnitTestMain.cpp logunittest.cpp logunittest.hpp
    212 LogUnitTest_LDADD = ${ALLLIBS}
    213 
    214 manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp
    215 manipulateAtomsTest_LDADD = ${UILIBS} ${ALLLIBS}
    216 
    217 MatrixUnittest_SOURCES = UnitTestMain.cpp MatrixUnittest.cpp MatrixUnittest.hpp
    218 MatrixUnittest_LDADD = ${ALLLIBS}
    219 
    220 MenuDescriptionUnitTest_SOURCES = UnitTestMain.cpp MenuDescriptionUnitTest.cpp   MenuDescriptionUnitTest.hpp
    221 MenuDescriptionUnitTest_LDADD = ${ALLLIBS}
    222 
    223 MoleculeDescriptorTest_SOURCES = UnitTestMain.cpp MoleculeDescriptorTest.cpp MoleculeDescriptorTest.hpp
    224 MoleculeDescriptorTest_LDADD = ${ALLLIBS}
    225 
    226 ObserverTest_SOURCES = UnitTestMain.cpp ObserverTest.cpp ObserverTest.hpp
    227 ObserverTest_LDADD = ${ALLLIBS}
    228 
    229 ParserCommonUnitTest_SOURCES = UnitTestMain.cpp ParserCommonUnitTest.cpp ParserCommonUnitTest.hpp
    230 ParserCommonUnitTest_LDADD = ${ALLLIBS}
    231 
    232 ParserTremoloUnitTest_SOURCES = UnitTestMain.cpp ParserTremoloUnitTest.cpp ParserTremoloUnitTest.hpp
    233 ParserTremoloUnitTest_LDADD = ${ALLLIBS}
    234 
    235 periodentafelTest_SOURCES = UnitTestMain.cpp periodentafelTest.cpp periodentafelTest.hpp
    236 periodentafelTest_LDADD = ${ALLLIBS}
    237 
    238 PlaneUnittest_SOURCES = UnitTestMain.cpp PlaneUnittest.cpp PlaneUnittest.hpp
    239 PlaneUnittest_LDADD = ${ALLLIBS}
    240 
    241 Registry_SOURCES = UnitTestMain.cpp RegistryUnitTest.cpp RegistryUnitTest.hpp
    242 Registry_LDADD = ${ALLLIBS}
    243 
    244 ShapeUnittest_SOURCES = UnitTestMain.cpp ShapeUnittest.cpp ShapeUnittest.hpp
    245 ShapeUnittest_LDADD = ${ALLLIBS}
    246 
    247 SingletonTest_SOURCES = UnitTestMain.cpp SingletonTest.cpp SingletonTest.hpp
    248 SingletonTest_LDADD = ${ALLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
    249 
    250 SubspaceFactorizerUnitTest_SOURCES = UnitTestMain.cpp SubspaceFactorizerUnittest.cpp SubspaceFactorizerUnittest.hpp
     190PeriodentafelUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     191        PeriodentafelUnitTest.cpp \
     192        PeriodentafelUnitTest.hpp
     193PeriodentafelUnitTest_LDADD = ${ALLLIBS}
     194
     195SubspaceFactorizerUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     196        SubspaceFactorizerUnitTest.cpp \
     197        SubspaceFactorizerUnitTest.hpp
    251198SubspaceFactorizerUnitTest_LDADD = ${GSLLIBS}
    252199
    253 TesselationUnitTest_SOURCES = UnitTestMain.cpp tesselationunittest.cpp tesselationunittest.hpp
     200TesselationUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     201        TesselationUnitTest.cpp \
     202        TesselationUnitTest.hpp
    254203TesselationUnitTest_LDADD = ${ALLLIBS}
    255204
    256 Tesselation_BoundaryTriangleUnitTest_SOURCES = UnitTestMain.cpp tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp
     205Tesselation_BoundaryTriangleUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     206        Tesselation_BoundaryTriangleUnitTest.cpp \
     207        Tesselation_BoundaryTriangleUnitTest.hpp
    257208Tesselation_BoundaryTriangleUnitTest_LDADD = ${ALLLIBS}
    258209
    259 Tesselation_InOutsideUnitTest_SOURCES = UnitTestMain.cpp tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp
     210Tesselation_InOutsideUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     211        Tesselation_InsideOutsideUnitTest.cpp \
     212        Tesselation_InsideOutsideUnitTest.hpp
    260213Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS}
    261214
     
    263216TestRunner_LDADD = ${UILIBS} ${ALLLIBS}
    264217
    265 VectorContentUnitTest_SOURCES = UnitTestMain.cpp VectorContentUnittest.cpp VectorContentUnittest.hpp
    266 VectorContentUnitTest_LDADD = ${ALLLIBS}
    267 
    268 VectorUnitTest_SOURCES = UnitTestMain.cpp vectorunittest.cpp vectorunittest.hpp
    269 VectorUnitTest_LDADD = ${ALLLIBS}
    270 
    271218#AUTOMAKE_OPTIONS = parallel-tests
  • tests/Makefile.am

    rdd97a9 r5d6f38  
    1 SUBDIRS = regression Tesselations
     1SUBDIRS = CodeChecks regression Tesselations
    22
  • tests/regression/Makefile.am

    rdd97a9 r5d6f38  
    1111        Graph \
    1212        Molecules \
     13        Selection \
    1314        Simple_configuration \
    1415        Tesselation
    1516TESTSUITE = $(srcdir)/testsuite
     17
     18TESTSCRIPTS = \
     19        $(srcdir)/testsuite-analysis.at \
     20        $(srcdir)/testsuite-domain.at \
     21        $(srcdir)/testsuite-filling.at \
     22        $(srcdir)/testsuite-fragmentation.at \
     23        $(srcdir)/testsuite-graph.at \
     24        $(srcdir)/testsuite-molecules.at \
     25        $(srcdir)/testsuite-simple_configuration.at \
     26        $(srcdir)/Selection/testsuite-selection.at \
     27        $(srcdir)/Selection/Atoms/testsuite-selection-all-atoms.at \
     28        $(srcdir)/Selection/Atoms/testsuite-selection-atoms-by-element.at \
     29        $(srcdir)/Selection/Atoms/testsuite-selection-atom-by-id.at \
     30        $(srcdir)/Selection/Atoms/testsuite-selection-atoms-inside-cuboid.at \
     31        $(srcdir)/Selection/Atoms/testsuite-selection-atoms-inside-sphere.at \
     32        $(srcdir)/Selection/Atoms/testsuite-selection-atoms-of-molecule.at \
     33        $(srcdir)/Selection/Atoms/testsuite-selection-clear-atoms.at \
     34        $(srcdir)/Selection/Molecules/testsuite-selection-all-molecules.at \
     35        $(srcdir)/Selection/Molecules/testsuite-selection-clear-molecules.at \
     36        $(srcdir)/Selection/Molecules/testsuite-selection-molecules-by-formula.at \
     37        $(srcdir)/Selection/Molecules/testsuite-selection-molecule-by-id.at \
     38        $(srcdir)/Selection/Molecules/testsuite-selection-molecules-by-name.at \
     39        $(srcdir)/Selection/Molecules/testsuite-selection-molecules-of-atoms.at \
     40        $(srcdir)/testsuite-specifics.at \
     41        $(srcdir)/testsuite-standard_options.at \
     42        $(srcdir)/testsuite-tesselation.at
     43
    1644
    1745max_jobs = 4
     
    3664
    3765AUTOTEST = $(AUTOM4TE) --language=autotest
    38 $(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/testsuite-*.at
     66$(TESTSUITE): $(srcdir)/testsuite.at $(TESTSCRIPTS)
    3967        $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
    4068        mv $@.tmp $@
  • tests/regression/Simple_configuration/2/post/test.pdb

    rdd97a9 r5d6f38  
    1 REMARK created by molecuilder on Fri Aug 27 12:18:33 2010
    2 ATOM      1  H01 tes b   0        10.0    10.0    10.0   1.0   1.0         0 H 0
     1REMARK created by molecuilder on Tue Dec  7 13:11:31 2010
     2ATOM      1 H01 0pre b1         10.000  10.000  10.000  1.00  1.00          H 0
    33END
  • tests/regression/testsuite-molecules.at

    rdd97a9 r5d6f38  
    4545AT_KEYWORDS([Molecules])
    4646AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/pre/test.* .], 0)
    47 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecules-atoms 0 -t "1., 1., 1." --periodic 0], 0, [stdout], [stderr])
     47AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 --select-molecules-atoms -t "1., 1., 1." --periodic 0], 0, [stdout], [stderr])
    4848AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/post/$file], 0, [ignore], [ignore])
    4949AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/pre/test2.* .], 0)
    50 AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ --select-molecules-atoms 0 -t "-1., -1., -1." --periodic 0], 0, [stdout], [stderr])
     50AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 --select-molecules-atoms -t "-1., -1., -1." --periodic 0], 0, [stdout], [stderr])
    5151AT_CHECK([file=test2.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/post/$file], 0, [ignore], [ignore])
    5252AT_CLEANUP
  • tests/regression/testsuite-simple_configuration.at

    rdd97a9 r5d6f38  
    4343AT_SETUP([Simple configuration - saving conf file])
    4444AT_KEYWORDS([configuration])
    45 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o pcp -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.conf -s store.conf], 0, [ignore], [ignore])
     45AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o pcp -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.conf --output store.conf], 0, [ignore], [ignore])
    4646AT_CHECK([diff store.conf ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.conf], 0, [ignore], [ignore])
    4747AT_CLEANUP
    4848AT_SETUP([Simple configuration - saving mpqc (from parsed xyz) file])
    4949AT_KEYWORDS([configuration])
    50 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz -s store.in], 0, [ignore], [ignore])
     50AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz --output store.in], 0, [ignore], [ignore])
    5151AT_CHECK([diff store.in ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.in], 0, [ignore], [ignore])
    5252AT_CLEANUP
    5353AT_SETUP([Simple configuration - saving pdb file])
    5454AT_KEYWORDS([configuration])
    55 AT_CHECK([../../molecuilder -i test.pdb -e ${abs_top_srcdir}/src/ -o pdb -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.pdb -s store.pdb], 0, [ignore], [ignore])
     55AT_CHECK([../../molecuilder -i test.pdb -e ${abs_top_srcdir}/src/ -o pdb -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.pdb --output store.pdb], 0, [ignore], [ignore])
    5656AT_CHECK([diff -I '.*created by molecuilder.*' store.pdb ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.pdb], 0, [ignore], [ignore])
    5757AT_CLEANUP
    5858AT_SETUP([Simple configuration - saving xyz file])
    5959AT_KEYWORDS([configuration])
    60 AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o xyz -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz -s store.xyz], 0, [ignore], [ignore])
     60AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o xyz -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz --output store.xyz], 0, [ignore], [ignore])
    6161AT_CHECK([diff -I '.*Created by molecuilder.*' store.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.xyz], 0, [ignore], [ignore])
    6262AT_CLEANUP
  • tests/regression/testsuite-standard_options.at

    rdd97a9 r5d6f38  
    11AT_BANNER([MoleCuilder - standard options])
    22# 1. verbosity
    3 AT_SETUP([Standard Options - verbosity])
     3AT_SETUP([Standard Options - verbosity with Undo/Redo])
    44AT_KEYWORDS([options])
    55AT_CHECK([pwd],[ignore],[ignore])
    6 AT_CHECK([../../molecuilder -v 1], 0, [stdout], [ignore])
    7 AT_CHECK([grep "Setting verbosity from .* to 1" stdout], 0, [ignore], [ignore])
    8 AT_CLEANUP
    9 AT_SETUP([Standard Options - verbosity with Undo/Redo])
    10 AT_KEYWORDS([options])
    11 AT_CHECK([../../molecuilder -v 1 --undo], 0, [stdout], [ignore])
    12 AT_CHECK([grep "Setting verbosity from 1 to .*" stdout], 0, [ignore], [ignore])
    13 AT_CHECK([../../molecuilder -v 1 --undo --redo], 0, [stdout], [ignore])
    14 AT_CHECK([grep "Setting verbosity from .* to 1" stdout], 0, [ignore], [ignore])
     6AT_CHECK([../../molecuilder -v 9], 0, [stdout], [ignore])
     7AT_CHECK([grep "Setting verbosity from .* to 9" stdout], 0, [ignore], [ignore])
     8AT_CHECK([../../molecuilder -v 9 --undo], 0, [stdout], [ignore])
     9AT_CHECK([grep "Setting verbosity from 9 to .*" stdout], 0, [ignore], [ignore])
     10AT_CHECK([../../molecuilder -v 9 --undo --redo], 0, [stdout], [ignore])
     11AT_CHECK([grep "Setting verbosity from .* to 9" stdout], 0, [ignore], [ignore])
    1512AT_CLEANUP
    1613
  • tests/regression/testsuite.at

    rdd97a9 r5d6f38  
    1616m4_include(testsuite-simple_configuration.at)
    1717
     18m4_include(Selection/testsuite-selection.at)
     19
    1820m4_include(testsuite-domain.at)
    1921
Note: See TracChangeset for help on using the changeset viewer.