Changes in / [0d5dce:8f822c]


Ignore:
Files:
20 added
100 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/ActionRegistry.cpp

    r0d5dce r8f822c  
    1919using namespace std;
    2020
     21/** Constructor for class ActionRegistry.
     22 */
    2123ActionRegistry::ActionRegistry()
    2224{
    2325}
    2426
     27/** Destructor for class ActionRegistry.
     28 */
    2529ActionRegistry::~ActionRegistry()
    2630{
     
    3236}
    3337
     38/** Returns pointer to an action named by \a name.
     39 * \param name name of action
     40 * \return pointer to Action
     41 */
    3442Action* ActionRegistry::getActionByName(const std::string name){
    3543  map<const string,Action*>::iterator iter;
     
    3947}
    4048
     49/** States whether action is present or not.
     50 * \note This iss needed as ActionRegistry::getActionByName() ASSERT()s that action is in map.
     51 * \param name name of action
     52 * \return true - Action present, false - Action absent
     53 */
    4154bool ActionRegistry::isActionByNamePresent(const std::string name){
    4255  map<const string,Action*>::iterator iter;
     
    4558}
    4659
     60/** Registers an Action with the ActionRegistry.
     61 * \param *action pointer to Action.
     62 */
    4763void ActionRegistry::registerAction(Action* action){
    4864  pair<map<const string,Action*>::iterator,bool> ret;
     65  //cout << "Trying to register action with name " << action->getName() << "." << endl;
    4966  ret = actionMap.insert(pair<const string,Action*>(action->getName(),action));
    5067  ASSERT(ret.second,"Two actions with the same name added to registry");
    5168}
    5269
     70/** Unregisters an Action.
     71 * \param *action pointer to Action.
     72 */
    5373void ActionRegistry::unregisterAction(Action* action){
     74  //cout << "Unregistering action with name " << action->getName() << "." << endl;
    5475  actionMap.erase(action->getName());
    5576}
    5677
     78/** Returns an iterator pointing to the start of the map of Action's.
     79 * \return begin iterator
     80 */
    5781std::map<const std::string,Action*>::iterator ActionRegistry::getBeginIter()
    5882{
     
    6084}
    6185
     86/** Returns an iterator pointing to the end of the map of Action's.
     87 * \return end iterator
     88 */
    6289std::map<const std::string,Action*>::iterator ActionRegistry::getEndIter()
    6390{
     
    6592}
    6693
     94/** Returns a const iterator pointing to the start of the map of Action's.
     95 * \return constant begin iterator
     96 */
     97std::map<const std::string,Action*>::const_iterator ActionRegistry::getBeginIter() const
     98{
     99  return actionMap.begin();
     100}
     101
     102/** Returns a const iterator pointing to the end of the map of Action's.
     103 * \return constant end iterator
     104 */
     105std::map<const std::string,Action*>::const_iterator ActionRegistry::getEndIter() const
     106{
     107  return actionMap.end();
     108}
     109
     110/** Prints the contents of the ActionRegistry \a &m to \a &ost.
     111 * \param &ost output stream
     112 * \param &m reference to ActionRegistry
     113 * \return reference to the above out stream for concatenation
     114 */
     115ostream& operator<<(ostream& ost, const ActionRegistry& m)
     116{
     117  ost << "ActionRegistry contains:" << endl;
     118  for (std::map<const std::string,Action*>::const_iterator iter = m.getBeginIter(); iter != m.getEndIter(); ++iter) {
     119    ost << "\t" << iter->first << " with pointer " << iter->second << endl;
     120  }
     121  return ost;
     122};
     123
     124
     125
    67126CONSTRUCT_SINGLETON(ActionRegistry)
  • src/Actions/ActionRegistry.hpp

    r0d5dce r8f822c  
    99#define ACTIONREGISTRY_HPP_
    1010
     11#include <iostream>
    1112#include <string>
    1213#include <map>
     
    2627
    2728  std::map<const std::string,Action*>::iterator getBeginIter();
     29  std::map<const std::string,Action*>::const_iterator getBeginIter() const;
    2830  std::map<const std::string,Action*>::iterator getEndIter();
     31  std::map<const std::string,Action*>::const_iterator getEndIter() const;
    2932
    3033private:
     
    3639};
    3740
     41std::ostream& operator<<(std::ostream& ost, const ActionRegistry& m);
     42
    3843#endif /* ACTIONREGISTRY_HPP_ */
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r0d5dce r8f822c  
    6767  dialog = UIFactory::getInstance().makeDialog();
    6868  if (type == "P")
    69     dialog->queryVector("position", &Point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position"));
     69    dialog->queryVector("position", &Point, false, MapOfActions::getInstance().getDescription("position"));
    7070  if (type == "S")
    7171    dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
  • src/Actions/AtomAction/AddAction.cpp

    r0d5dce r8f822c  
    4141
    4242  dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME));
    43   dialog->queryVector("position", &position, World::getInstance().getDomain(), true, MapOfActions::getInstance().getDescription("position"));
     43  dialog->queryVector("position", &position, true, MapOfActions::getInstance().getDescription("position"));
    4444  cout << "pre-dialog" << endl;
    4545
  • src/Actions/CmdAction/BondLengthTableAction.cpp

    r0d5dce r8f822c  
    99
    1010#include "Actions/CmdAction/BondLengthTableAction.hpp"
     11#include "bondgraph.hpp"
    1112#include "config.hpp"
    1213#include "log.hpp"
  • src/Actions/FragmentationAction/DepthFirstSearchAction.cpp

    r0d5dce r8f822c  
    1010#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
    1111#include "atom.hpp"
     12#include "bondgraph.hpp"
    1213#include "config.hpp"
    1314#include "log.hpp"
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    r0d5dce r8f822c  
    1010#include "Actions/FragmentationAction/FragmentationAction.hpp"
    1111#include "atom.hpp"
     12#include "bondgraph.hpp"
    1213#include "config.hpp"
    1314#include "log.hpp"
     
    4142  double distance = -1.;
    4243  int order = 0;
     44  std::string path;
    4345  config *configuration = World::getInstance().getConfig();
    4446  int ExitFlag = 0;
    4547
    4648  cout << "pre-dialog"<< endl;
    47   dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));
     49  dialog->queryString(NAME, &path, MapOfActions::getInstance().getDescription(NAME));
     50  dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    4851  dialog->queryDouble("distance", &distance, MapOfActions::getInstance().getDescription("distance"));
    4952  dialog->queryInt("order", &order, MapOfActions::getInstance().getDescription("order"));
     
    5861    DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
    5962    if (mol->hasBondStructure()) {
    60       ExitFlag = mol->FragmentMolecule(order, configuration);
     63      ExitFlag = mol->FragmentMolecule(order, path);
    6164    }
    6265    World::getInstance().setExitFlag(ExitFlag);
  • src/Actions/Makefile.am

    r0d5dce r8f822c  
    120120  WorldAction/CenterOnEdgeAction.cpp \
    121121  WorldAction/ChangeBoxAction.cpp \
     122  WorldAction/InputAction.cpp \
     123  WorldAction/OutputAction.cpp \
    122124  WorldAction/RemoveSphereOfAtomsAction.cpp \
    123125  WorldAction/RepeatBoxAction.cpp \
     
    131133  WorldAction/CenterOnEdgeAction.hpp \
    132134  WorldAction/ChangeBoxAction.hpp \
     135  WorldAction/InputAction.hpp \
     136  WorldAction/OutputAction.hpp \
    133137  WorldAction/RemoveSphereOfAtomsAction.hpp \
    134138  WorldAction/RepeatBoxAction.hpp \
  • src/Actions/MapOfActions.cpp

    r0d5dce r8f822c  
    2222#include "verbose.hpp"
    2323
     24#include "Actions/ActionRegistry.hpp"
     25#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
     26#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
     27#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
     28#include "Actions/AtomAction/AddAction.hpp"
     29#include "Actions/AtomAction/ChangeElementAction.hpp"
     30#include "Actions/AtomAction/RemoveAction.hpp"
     31#include "Actions/CmdAction/BondLengthTableAction.hpp"
     32#include "Actions/CmdAction/ElementDbAction.hpp"
     33#include "Actions/CmdAction/FastParsingAction.hpp"
     34#include "Actions/CmdAction/HelpAction.hpp"
     35#include "Actions/CmdAction/VerboseAction.hpp"
     36#include "Actions/CmdAction/VersionAction.hpp"
     37#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
     38#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
     39#include "Actions/FragmentationAction/FragmentationAction.hpp"
     40#include "Actions/MoleculeAction/BondFileAction.hpp"
     41#include "Actions/MoleculeAction/ChangeNameAction.hpp"
     42#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
     43#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
     44#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
     45#include "Actions/MoleculeAction/SaveBondsAction.hpp"
     46#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
     47#include "Actions/MoleculeAction/TranslateAction.hpp"
     48#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
     49#include "Actions/ParserAction/LoadXyzAction.hpp"
     50#include "Actions/ParserAction/SaveXyzAction.hpp"
     51#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
     52#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
     53#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
     54#include "Actions/WorldAction/BoundInBoxAction.hpp"
     55#include "Actions/WorldAction/CenterInBoxAction.hpp"
     56#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
     57#include "Actions/WorldAction/ChangeBoxAction.hpp"
     58#include "Actions/WorldAction/InputAction.hpp"
     59#include "Actions/WorldAction/OutputAction.hpp"
     60#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
     61#include "Actions/WorldAction/RepeatBoxAction.hpp"
     62#include "Actions/WorldAction/ScaleBoxAction.hpp"
     63#include "Actions/WorldAction/SetDefaultNameAction.hpp"
     64#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
    2465#include "Actions/Values.hpp"
    2566
     
    83124  DescriptionMap["fragment-mol"] = "create for a given molecule into fragments up to given order";
    84125  DescriptionMap["help"] = "Give this help screen";
     126  DescriptionMap["input"] = "specify input files";
    85127  DescriptionMap["linear-interpolate"] = "linear interpolation in discrete steps between start and end position of a molecule";
    86128  DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule";
    87129  DescriptionMap["molecular-volume"] = "calculate the volume of a given molecule";
     130  DescriptionMap["output"] = "specify output formats";
    88131  DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements, element and point or element and surface";
    89132  DescriptionMap["parse-xyz"] = "parse xyz file into World";
     
    97140  DescriptionMap["save-bonds"] = "name of the bonds file to write to";
    98141  DescriptionMap["save-temperature"] = "name of the temperature file to write to";
     142  DescriptionMap["SaveXyz"] = "save world as xyz file";
    99143  DescriptionMap["scale-box"] = "scale box and atomic positions inside";
    100144  DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";
     
    185229  TypeMap["fastparsing"] = Boolean;
    186230  TypeMap["fill-molecule"] = String;
    187   TypeMap["fragment-mol"] = Molecule;
     231  TypeMap["fragment-mol"] = String;
    188232  TypeMap["input"] = String;
    189233  TypeMap["linear-interpolate"] = String;
    190234  TypeMap["molecular-volume"] = Molecule;
    191235  TypeMap["nonconvex-envelope"] = Molecule;
     236  TypeMap["output"] = String;
    192237  TypeMap["parse-xyz"] = String;
    193238  TypeMap["pair-correlation"] = String;
     
    242287  DefaultValue["periodic"] = "0";
    243288
    244 
    245   // list of generic actions
     289  // put action into each menu category
     290  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "molecular-volume") );
     291  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "pair-correlation") );
     292  MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "principal-axis-system") );
     293
     294  MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "add-atom") );
     295  MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "change-element") );
     296  MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "remove-atom") );
     297
     298  MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "bond-table") );
     299  MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "element-db") );
     300  MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "fastparsing") );
     301  MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "verbose") );
     302  MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "version") );
     303
     304  MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "depth-first-search") );
     305  MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "fragment-mol") );
     306  MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "subgraph-dissect") );
     307
     308  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "bond-file") );
     309  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "change-molname") );
     310  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-molecule") );
     311  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "linear-interpolate") );
     312  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-to-pas") );
     313  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-adjacency") );
     314  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-bonds") );
     315  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-temperature") );
     316  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "suspend-in-water") );
     317  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "translate-mol") );
     318  MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "verlet-integrate") );
     319
     320  MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "parse-xyz") );
     321  MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "SaveXyz") );
     322
     323  MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "convex-envelope") );
     324  MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "nonconvex-envelope") );
     325
     326  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "boundary") );
     327  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "bound-in-box") );
     328  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "center-in-box") );
     329  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "center-edge") );
     330  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "change-box") );
     331  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "input") );
     332  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "output") );
     333  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "remove-sphere") );
     334  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "repeat-box") );
     335  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "scale-box") );
     336  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "default-molname") );
     337  MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-basis") );
     338
     339  // put actions into command line category
    246340        generic.insert("add-atom");
    247341  generic.insert("bond-file");
     
    262356  generic.insert("fragment-mol");
    263357  generic.insert("help");
    264         generic.insert("linear-interpolate");
     358  generic.insert("input");
     359  generic.insert("linear-interpolate");
    265360//  generic.insert("molecular-volume");
    266361  generic.insert("nonconvex-envelope");
     362  generic.insert("output");
    267363        generic.insert("pair-correlation");
    268 //      generic.insert("parse-xyz");
     364        generic.insert("parse-xyz");
    269365//  generic.insert("principal-axis-system");
    270366  generic.insert("remove-atom");
     
    323419}
    324420
     421
     422void MapOfActions::populateActions()
     423{
     424  new AnalysisMolecularVolumeAction();
     425  new AnalysisPairCorrelationAction();
     426  new AnalysisPrincipalAxisSystemAction();
     427
     428  new AtomAddAction();
     429  new AtomChangeElementAction();
     430  new AtomRemoveAction();
     431
     432  new CommandLineBondLengthTableAction();
     433  new CommandLineElementDbAction();
     434  new CommandLineFastParsingAction();
     435  new CommandLineHelpAction();
     436  new CommandLineVerboseAction();
     437  new CommandLineVersionAction();
     438
     439  new FragmentationDepthFirstSearchAction();
     440  new FragmentationFragmentationAction();
     441  new FragmentationSubgraphDissectionAction();
     442
     443  new MoleculeBondFileAction();
     444  new MoleculeChangeNameAction();
     445  new MoleculeFillWithMoleculeAction();
     446  new MoleculeLinearInterpolationofTrajectoriesAction();
     447  new MoleculeSaveAdjacencyAction();
     448  new MoleculeSaveBondsAction();
     449  new MoleculeSaveTemperatureAction();
     450  new MoleculeTranslateAction();
     451  new MoleculeVerletIntegrationAction();
     452
     453  new ParserLoadXyzAction();
     454  new ParserSaveXyzAction();
     455
     456  new TesselationConvexEnvelopeAction();
     457  new TesselationNonConvexEnvelopeAction();
     458
     459  new WorldAddEmptyBoundaryAction();
     460  new WorldBoundInBoxAction();
     461  new WorldCenterInBoxAction();
     462  new WorldCenterOnEdgeAction();
     463  new WorldChangeBoxAction();
     464  new WorldInputAction();
     465  new WorldOutputAction();
     466  new WorldRemoveSphereOfAtomsAction();
     467  new WorldRepeatBoxAction();
     468  new WorldScaleBoxAction();
     469  new WorldSetDefaultNameAction();
     470  new WorldSetGaussianBasisAction();
     471}
     472
     473
    325474/** Adds all options to the CommandLineParser.
    326475 *
  • src/Actions/MapOfActions.hpp

    r0d5dce r8f822c  
    1111#include "Helpers/Assert.hpp"
    1212#include <boost/program_options.hpp>
     13
    1314#include <map>
    1415#include <set>
     
    2021namespace po = boost::program_options;
    2122
     23/** Central class for adding functionality to the code.
     24 *
     25 * In Molecuilder everything that can be done - such as adding atoms,
     26 * translating molecules, saving bind information - is an Action.
     27 *
     28 * In order to reference Action's with what the user sees, this class is the
     29 * mediator.
     30 *
     31 * An Action is described to the user by:
     32 * -# a name (this is the most important information)
     33 * -# a description
     34 * -# a shortform (single letter for use on the command line)
     35 * -# a text menu it resides in
     36 * -# the type of its argument
     37 * -# the command line category
     38 *
     39 * The Action::NAME is the most important information because every Action
     40 * registers itself automatically with the ActionRegistry and can be retrieved
     41 * therefrom and from this MapOfActions simply by knowing its name alone.
     42 *
     43 * In the constructor of MapOfActions all this is set.
     44 *
     45 * Note that Action will require input from the user. This is done via class
     46 * Query.
     47 *
     48 * And note also that MapOfActions actually contains more than just all
     49 * Actions: There are a number of names that actually are just arguments to
     50 * actions (e.g. "output-file").
     51 *
     52 * <h1> Howto add an Action</h1>
     53 *
     54 * Let us assume your new action (class) is called SuperDuperAction, consisting
     55 * of two files SuperDuperAction.cpp and SuperDuperAction.hpp.
     56 *
     57 * Furthermore, let's say you Action needs two values: a double value as a
     58 * upper threshold and a string which is the name of the output file.
     59 *
     60 * <h2> Command Line preliminaries </h2>
     61 *
     62 * You have to decide whether (for the command line) it makes sense to have an
     63 * extra argument requesting the arguments, or one should be the argument of
     64 * your action. I.e. your action name is "super-duper", then the use may
     65 * call your action like this:
     66 *
     67 * ./molecuilder --super-duper 4 --output-file test.dat
     68 *
     69 * Here, we have picked the threshold as the value for your action and the
     70 * name of the output file is given by an additional argument. Of course,
     71 * it can be the other way round or by two arguments such as here:
     72 *
     73 * ./molecuilder --super-duper --threshold 4 --output-file test.dat
     74 *
     75 * It depends on what possible arguments are already there (don't make up
     76 * new ones if present ones actually make sense for your action) and which
     77 * argument is more natural or closer to what your action does.
     78 *
     79 * <h2> Menu preliminaries </h2>
     80 *
     81 * Whatever you decide, your action will need some Query dialogs to request
     82 * the necessary information from the user, either via a command line
     83 * argument (--output-file) via a text dialog (referenced by "output-file")
     84 * or via a graphical dialog (same reference). And therein, the names
     85 * of the arguments have to re-appear.
     86 *
     87 * Then, the following steps have to be done to incorporate your Action:
     88 * -# create a unique name for your action (no capital letters) to reference
     89 *    it, this name has to appear in the file SuperDuperAction.cpp, e.g.
     90 *    "super-duper"
     91 * -# pick names the other required arguments, best if they are already
     92 *    present in the MapOfActions. They have to appear in Query's in the
     93 *    code of your Action.
     94 * -# With this name create entries in the following maps for the action
     95 *    name and for each names of a desired addtional argument if not present:
     96 *   -# DescriptionMap, a catchy description of what your action does
     97 *   -# TypeMap, see MapOfActions::OptionTypes for possible types of the single
     98 *      argument it takes.
     99 *   -# MenuContainsActionMap, in which menu should your action appear
     100 *   -# ShortFormMap (optional), single letter for command line call
     101 *   -# DefaultValueMap (optional), the default value (always a string)
     102 * -# add to one of the command line sets by the following categories
     103 *   -# generic - generic options (i.e. not one of the others)
     104 *   -# config - action/argument only considers internal bevahior, user
     105 *      does not have to see it while still having full functionality
     106 *   -# hidden - this should be hidden from the user
     107 *   -# visible - this should be visible to the user
     108 *   -# inputfile - this should only be parsed from an input file, not
     109 *      from command line
     110 * -# add to a menu, i.e. make an entry in MenuContainsActionMap.
     111 * -# add header file SuperDuperAction.hpp to MapOfActions.cpp and instantiate
     112 *    your action in populateMenu() (mind the sorting: 1. menu,
     113 *    2. alphabetical)
     114 *
     115 *  And that's.
     116 *
     117 *  Now, your action can be called from the command line, within the text
     118 *  menu and the graphical user interface.
     119 *
     120 */
    22121class MapOfActions : public Singleton<MapOfActions> {
    23122  friend class Singleton<MapOfActions>;
     
    27126
    28127  // getter for the action descriptions and short forms
    29   std::string getDescription(string actionname);
    30   std::string getKeyAndShortForm(string actionname);
    31   std::string getShortForm(string actionname);
    32   map <std::string, std::string> getShortFormToActionMap();
     128  std::string getDescription(std::string actionname);
     129  std::string getKeyAndShortForm(std::string actionname);
     130  std::string getShortForm(std::string actionname);
     131  std::map <std::string, std::string> getShortFormToActionMap();
    33132
    34133  void AddOptionsToParser();
    35134
    36135  // check presence and getter for action type
    37   bool hasValue(string actionname);
    38   bool isShortFormPresent(string shortform);
    39   enum OptionTypes getValueType(string actionname);
     136  bool hasValue(std::string actionname);
     137  bool isShortFormPresent(std::string shortform);
     138  enum OptionTypes getValueType(std::string actionname);
    40139
    41   set<string> generic;
    42   set<string> config;
    43   set<string> hidden;
    44   set<string> visible;
    45   set<string> inputfile;
     140  std::set<std::string> generic;
     141  std::set<std::string> config;
     142  std::set<std::string> hidden;
     143  std::set<std::string> visible;
     144  std::set<std::string> inputfile;
     145
     146  std::multimap <std::string, std::string> MenuContainsActionMap;
     147
     148  // instantiates and puts all known actions into the ActionRegistry
     149  void populateActions();
    46150
    47151private:
     
    51155
    52156  // lookup list from our configs to the ones of CommandLineParser
    53   map< set<std::string> *, po::options_description *> CmdParserLookup;
     157  std::map< std::set<std::string> *, po::options_description *> CmdParserLookup;
    54158
    55159  // map of the action names and their description
    56   map<std::string, std::string> DefaultValue;
    57   map<std::string, std::string> DescriptionMap;
    58   map<std::string, std::string> ShortFormMap;
    59   map<std::string, enum OptionTypes > TypeMap;
     160  std::map<std::string, std::string> DefaultValue;
     161  std::map<std::string, std::string> DescriptionMap;
     162  std::map<std::string, std::string> ShortFormMap;
     163  std::map<std::string, enum OptionTypes > TypeMap;
    60164};
    61165
  • src/Actions/MoleculeAction/ChangeNameAction.cpp

    r0d5dce r8f822c  
    3636};
    3737
    38 const char MoleculeChangeNameAction::NAME[] = "Change filename of Molecule";
     38const char MoleculeChangeNameAction::NAME[] = "change-molname";
    3939
    4040MoleculeChangeNameAction::MoleculeChangeNameAction() :
  • src/Actions/MoleculeAction/FillWithMoleculeAction.cpp

    r0d5dce r8f822c  
    6262
    6363  dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME));
    64   dialog->queryVector("distances", &distances, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("distances"));
    65   dialog->queryVector("lengths", &lengths, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("lengths"));
     64  dialog->queryVector("distances", &distances, false, MapOfActions::getInstance().getDescription("distances"));
     65  dialog->queryVector("lengths", &lengths, false, MapOfActions::getInstance().getDescription("lengths"));
    6666  dialog->queryBoolean("DoRotate", &DoRotate, MapOfActions::getInstance().getDescription("DoRotate"));
    6767  dialog->queryDouble("MaxDistance", &MaxDistance, MapOfActions::getInstance().getDescription("MaxDistance"));
     
    102102      World::getInstance().getMolecules()->insert(Filling);
    103103    }
     104    for (molecule::iterator iter = filler->begin(); !filler->empty(); iter = filler->begin()) {
     105      atom *Walker = *iter;
     106      filler->erase(iter);
     107      World::getInstance().destroyAtom(Walker);
     108    }
    104109    World::getInstance().destroyMolecule(filler);
    105110
  • src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp

    r0d5dce r8f822c  
    6969    if (IdMapping)
    7070      DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl);
    71     char outputname[MAXSTRINGSIZE];
    72     strcpy(outputname, filename.c_str());
    73     // TODO: LinearInterpolationBetweenConfiguration should use stream, not the filename directly! (better for unit test)
    74     if (!mol->LinearInterpolationBetweenConfiguration(start, end, outputname, *(World::getInstance().getConfig()), IdMapping))
    75       DoLog(2) && (Log() << Verbose(2) << "Could not store " << outputname << " files." << endl);
     71    if (!mol->LinearInterpolationBetweenConfiguration(start, end, filename, *(World::getInstance().getConfig()), IdMapping))
     72      DoLog(2) && (Log() << Verbose(2) << "Could not store " << filename << " files." << endl);
    7673    else
    7774      DoLog(2) && (Log() << Verbose(2) << "Steps created and " << filename << " files stored." << endl);
  • src/Actions/MoleculeAction/SaveAdjacencyAction.cpp

    r0d5dce r8f822c  
    6565    World::getInstance().getConfig()->BG->ConstructBondGraph(mol);
    6666    // TODO: sollte stream nicht filename benutzen, besser fuer unit test
    67     char outputname[MAXSTRINGSIZE];
    68     strcpy(outputname, filename.c_str());
    69     mol->StoreAdjacencyToFile(NULL, outputname);
     67    mol->StoreAdjacencyToFile(filename);
    7068    delete dialog;
    7169    return Action::success;
  • src/Actions/MoleculeAction/SaveBondsAction.cpp

    r0d5dce r8f822c  
    6464    DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << filename << "." << endl);
    6565    World::getInstance().getConfig()->BG->ConstructBondGraph(mol);
    66     // TODO: sollte stream, nicht filenamen direkt nutzen, beser fuer unit tests
    67     char outputname[MAXSTRINGSIZE];
    68     strcpy(outputname, filename.c_str());
    69     mol->StoreBondsToFile(NULL, outputname);
     66    // TODO: sollte stream, nicht filenamen direkt nutzen, besser fuer unit tests
     67    mol->StoreBondsToFile(filename);
    7068    delete dialog;
    7169    return Action::success;
  • src/Actions/MoleculeAction/TranslateAction.cpp

    r0d5dce r8f822c  
    5555  bool periodic = false;
    5656
    57   dialog->queryVector(NAME, &x, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     57  dialog->queryVector(NAME, &x, false, MapOfActions::getInstance().getDescription(NAME));
    5858  dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    5959  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
  • src/Actions/ParserAction/LoadXyzAction.cpp

    r0d5dce r8f822c  
    88#include "Helpers/MemDebug.hpp"
    99
     10using namespace std;
     11
    1012#include "Actions/ParserAction/LoadXyzAction.hpp"
    1113#include "Parser/XyzParser.hpp"
    1214
    1315#include <iostream>
     16#include <set>
    1417#include <string>
     18#include <vector>
    1519
    16 using namespace std;
    1720
    1821#include "UIElements/UIFactory.hpp"
     
    2124
    2225#include "atom.hpp"
     26#include "log.hpp"
    2327#include "molecule.hpp"
     28#include "verbose.hpp"
     29#include "World.hpp"
    2430
    2531/****** ParserLoadXyzAction *****/
     
    3743//};
    3844
    39 const char ParserLoadXyzAction::NAME[] = "LoadXyz";
     45const char ParserLoadXyzAction::NAME[] = "parse-xyz";
    4046
    4147ParserLoadXyzAction::ParserLoadXyzAction() :
     
    4854Action::state_ptr ParserLoadXyzAction::performCall() {
    4955  string filename;
    50   XyzParser parser;
    5156  Dialog *dialog = UIFactory::getInstance().makeDialog();
    5257
    53   dialog->queryString("filename",&filename, "Filename of the xyz file");
     58  dialog->queryString(NAME,&filename, NAME);
    5459
    5560  if(dialog->display()) {
     61    DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
    5662    // parse xyz file
    5763    ifstream input;
    5864    input.open(filename.c_str());
    59     if (!input.fail())
     65    if (!input.fail()) {
     66      // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
     67      set <atom*> UniqueList;
     68      {
     69        vector<atom *> ListBefore = World::getInstance().getAllAtoms();
     70        for (vector<atom *>::iterator runner = ListBefore.begin();runner != ListBefore.end(); ++runner)
     71          UniqueList.insert(*runner);
     72      }
     73      XyzParser parser; // briefly instantiate a parser which is removed at end of focus
    6074      parser.load(&input);
     75      {
     76        vector<atom *> ListAfter = World::getInstance().getAllAtoms();
     77        pair< set<atom *>::iterator, bool > Inserter;
     78        if (UniqueList.size() != ListAfter.size()) { // only create if new atoms have been parsed
     79          MoleculeListClass *molecules = World::getInstance().getMolecules();
     80          molecule *mol= NULL;
     81          if (molecules->ListOfMolecules.empty()) {
     82            mol = World::getInstance().createMolecule();
     83            molecules->insert(mol);
     84          } else {
     85            mol = *(molecules->ListOfMolecules.begin());
     86          }
     87          for (vector<atom *>::iterator runner = ListAfter.begin(); runner != ListAfter.end(); ++runner) {
     88            Inserter = UniqueList.insert(*runner);
     89            if (Inserter.second) { // if not present, then new (just parsed) atom, add ...
     90              cout << "Adding new atom " << **runner << " to new mol." << endl;
     91              mol->AddAtom(*runner);
     92            }
     93          }
     94          mol->doCountAtoms();
     95        } else {
     96          cout << "No atoms parsed?" << endl;
     97        }
     98      }
     99    } else {
     100      DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << filename << "." << endl);
     101    }
    61102    input.close();
    62103  }
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    r0d5dce r8f822c  
    4141  int j=0;
    4242
    43   dialog->queryVector(NAME, &boundary, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     43  dialog->queryVector(NAME, &boundary, false, MapOfActions::getInstance().getDescription(NAME));
    4444
    4545  if(dialog->display()) {
     
    5959    }
    6060    // set new box size
    61     double * const cell_size = World::getInstance().getDomain();
     61    double * const cell_size = new double[6];
    6262    for (j=0;j<6;j++)
    6363      cell_size[j] = 0.;
     
    6767      cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]);
    6868    }
     69    World::getInstance().setDomain(cell_size);
     70    delete[] cell_size;
    6971    // translate all atoms, such that Min is aty (0,0,0)
    7072    AtomRunner = AllAtoms.begin();
  • src/Actions/WorldAction/CenterInBoxAction.cpp

    r0d5dce r8f822c  
    3434  Dialog *dialog = UIFactory::getInstance().makeDialog();
    3535
    36   double * cell_size = World::getInstance().getDomain();
     36  Box& cell_size = World::getInstance().getDomain();
    3737  dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME));
    3838
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    r0d5dce r8f822c  
    1313#include "vector.hpp"
    1414#include "World.hpp"
     15#include "Matrix.hpp"
    1516
    1617#include <iostream>
     
    3738  Vector Min;
    3839  Vector Max;
    39   int j=0;
    4040
    4141  dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
     
    5757    }
    5858    // set new box size
    59     double * const cell_size = World::getInstance().getDomain();
    60     for (j=0;j<6;j++)
    61       cell_size[j] = 0.;
    62     j=-1;
     59    Matrix domain;
    6360    for (int i=0;i<NDIM;i++) {
    64       j += i+1;
    65       cell_size[j] = (Max[i]-Min[i]);
     61      double tmp = Max[i]-Min[i];
     62      tmp = fabs(tmp)>=1. ? tmp : 1.0;
     63      domain.at(i,i) = tmp;
    6664    }
     65    cout << "new domain is: " << domain << endl;
     66    World::getInstance().setDomain(domain);
    6767    // translate all atoms, such that Min is aty (0,0,0)
    6868    for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
  • src/Actions/WorldAction/ChangeBoxAction.cpp

    r0d5dce r8f822c  
    1212#include "verbose.hpp"
    1313#include "World.hpp"
     14#include "Box.hpp"
     15#include "Matrix.hpp"
    1416
    1517#include <iostream>
     
    3436  Dialog *dialog = UIFactory::getInstance().makeDialog();
    3537
    36   double * cell_size = World::getInstance().getDomain();
     38  Box& cell_size = World::getInstance().getDomain();
    3739  dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME));
    3840
    3941  if(dialog->display()) {
    40     DoLog(0) && (Log() << Verbose(0) << "Setting box domain to " << cell_size[0] << "," << cell_size[1] << "," << cell_size[2] << "," << cell_size[3] << "," << cell_size[4] << "," << cell_size[5] << "," << endl);
     42    DoLog(0) && (Log() << Verbose(0) << "Setting box domain to " << cell_size.getM() << endl);
    4143    delete dialog;
    4244    return Action::success;
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    r0d5dce r8f822c  
    4141
    4242  dialog->queryDouble(NAME, &radius, MapOfActions::getInstance().getDescription(NAME));
    43   dialog->queryVector("position", &point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position"));
     43  dialog->queryVector("position", &point, false, MapOfActions::getInstance().getDescription("position"));
    4444
    4545  if(dialog->display()) {
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    r0d5dce r8f822c  
    1313#include "molecule.hpp"
    1414#include "vector.hpp"
     15#include "Matrix.hpp"
    1516#include "verbose.hpp"
    1617#include "World.hpp"
     18#include "Box.hpp"
    1719
    1820#include <iostream>
     
    4648  MoleculeListClass *molecules = World::getInstance().getMolecules();
    4749
    48   dialog->queryVector(NAME, &Repeater, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     50  dialog->queryVector(NAME, &Repeater, false, MapOfActions::getInstance().getDescription(NAME));
    4951  //dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id"));
    5052  vector<molecule *> AllMolecules;
     
    5961  if(dialog->display()) {
    6062    (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl);
    61     double * const cell_size = World::getInstance().getDomain();
    62     double *M = ReturnFullMatrixforSymmetric(cell_size);
     63    Matrix M = World::getInstance().getDomain().getM();
     64    Matrix newM = M;
    6365    Vector x,y;
    6466    int n[NDIM];
     67    Matrix repMat;
    6568    for (int axis = 0; axis < NDIM; axis++) {
    6669      Repeater[axis] = floor(Repeater[axis]);
     
    6972        Repeater[axis] = 1;
    7073      }
    71       cell_size[(abs(axis+1) == 2) ? 2 : ((abs(axis+2) == 3) ? 5 : 0)] *= Repeater[axis];
     74      repMat.at(axis,axis) = Repeater[axis];
    7275    }
     76    newM *= repMat;
     77    World::getInstance().setDomain(newM);
    7378
    7479    molecule *newmol = NULL;
     
    98103                DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    99104              x = y;
    100               x.MatrixMultiplication(M);
     105              x *= M;
    101106              newmol = World::getInstance().createMolecule();
    102107              molecules->insert(newmol);
     
    118123      }
    119124    }
    120     delete(M);
    121125    delete dialog;
    122126    return Action::success;
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    r0d5dce r8f822c  
    1414#include "verbose.hpp"
    1515#include "World.hpp"
     16#include "Box.hpp"
     17#include "Matrix.hpp"
    1618
    1719#include <iostream>
     
    3739  Vector Scaler;
    3840  double x[NDIM];
    39   int j=0;
    4041
    41   dialog->queryVector(NAME, &Scaler, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     42  dialog->queryVector(NAME, &Scaler, false, MapOfActions::getInstance().getDescription(NAME));
    4243
    4344  if(dialog->display()) {
     
    4950      (*AtomRunner)->x.ScaleAll(x);
    5051    }
    51     j = -1;
    52     double * const cell_size = World::getInstance().getDomain();
     52
     53    Matrix M = World::getInstance().getDomain().getM();
     54    Matrix scale;
     55
    5356    for (int i=0;i<NDIM;i++) {
    54       j += i+1;
    55       cell_size[j]*=x[i];
     57      scale.at(i,i) = x[i];
    5658    }
     59    M *= scale;
     60    World::getInstance().setDomain(M);
    5761
    5862    delete dialog;
  • src/CommandLineParser.cpp

    r0d5dce r8f822c  
    5656{
    5757  // go through all arguments
     58  cout << Verbose(1) << "By default putting input into the sequence." << endl;
     59  // TODO: This may be bad, because const string "input" is destroyed at end of function
     60  SequenceOfActions.push_back("input");
    5861  for (int i=1;i<argc;i++) {
    5962    (cout << Verbose(1) << "Checking on " << argv[i] << endl);
  • src/Descriptors/AtomDescriptor.cpp

    r0d5dce r8f822c  
    1212
    1313#include "World.hpp"
    14 
    1514#include "atom.hpp"
    1615
    1716#include <boost/bind.hpp>
    18 #include <cassert>
     17
    1918#include <iostream>
    2019
  • src/Descriptors/MoleculeDescriptor.cpp

    r0d5dce r8f822c  
    1616
    1717#include <boost/bind.hpp>
    18 #include <cassert>
    1918#include <iostream>
    2019
  • src/Helpers/MemDebug.cpp

    r0d5dce r8f822c  
    66 */
    77
    8 #ifndef NDBEGUG
    9 #ifndef NO_MEMDEBUG
     8// NDEBUG implies NO_MEMDEBUG
     9#ifdef NDEBUG
     10# ifndef NO_MEMDEBUG
     11#   define NO_MEMDEBUG
     12# endif
     13#endif
     14
     15// NO_MEMDEBUG and MEMDEBUG are mutually exclusive, but at least one must be set
     16#ifdef NO_MEMDEBUG
     17# ifdef MEMDEBUG
     18#   undef MEMDEBUG
     19# endif
     20#else
     21# ifndef MEMDEBUG
     22#   define MEMDEBUG
     23# endif
     24#endif
     25
     26#ifdef MEMDEBUG
    1027
    1128#include <iostream>
     
    489506}
    490507#endif
    491 #endif
  • src/Helpers/MemDebug.hpp

    r0d5dce r8f822c  
    2121 * your sourcefiles.
    2222 */
    23 #ifndef NDEBUG
    24 #ifndef NO_MEMDEBUG
    2523
    26 #ifndef MEMDEBUG
    27 #define MEMDEBUG
     24// Set all flags in a way that makes sense
     25
     26// NDEBUG implies NO_MEMDEBUG
     27#ifdef NDEBUG
     28# ifndef NO_MEMDEBUG
     29#   define NO_MEMDEBUG
     30# endif
    2831#endif
     32
     33// NO_MEMDEBUG and MEMDEBUG are mutually exclusive, but at least one must be set
     34#ifdef NO_MEMDEBUG
     35# ifdef MEMDEBUG
     36#   undef MEMDEBUG
     37# endif
     38#else
     39# ifndef MEMDEBUG
     40#   define MEMDEBUG
     41# endif
     42#endif
     43
     44#ifdef MEMDEBUG
    2945
    3046#include <new>
     
    8399#endif
    84100
    85 #endif
    86 #endif
    87 
    88 
    89 #ifdef NDEBUG
    90 #undef MEMDEBUG
    91 #endif
    92 
    93 #ifndef MEMDEBUG
     101#else
    94102// memory debugging was disabled
    95103
     
    104112
    105113#endif
     114
     115
    106116#endif /* MEMDEBUG_HPP_ */
  • src/Legacy/oldmenu.cpp

    r0d5dce r8f822c  
    609609{
    610610  int Order1;
     611  std::string path;
    611612  clock_t start, end;
    612613
     
    614615  Log() << Verbose(0) << "What's the desired bond order: ";
    615616  cin >> Order1;
     617  DoLog(0) && (Log() << Verbose(0) << "What's the output path and prefix [e.g. /home/foo/BondFragment]: ");
     618  cin >> path;
    616619  if (mol->hasBondStructure()) {
    617620    start = clock();
    618     mol->FragmentMolecule(Order1, configuration);
     621    mol->FragmentMolecule(Order1, path);
    619622    end = clock();
    620623    Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
  • src/Makefile.am

    r0d5dce r8f822c  
    3030  atom_trajectoryparticleinfo.hpp
    3131
     32EXCEPTIONSOURCE = Exceptions/CustomException.cpp \
     33                                  Exceptions/LinearDependenceException.cpp \
     34                                  Exceptions/MathException.cpp \
     35                                  Exceptions/NotInvertibleException.cpp \
     36                                  Exceptions/SkewException.cpp \
     37                                  Exceptions/ZeroVectorException.cpp
     38                                 
     39EXCEPTIONHEADER = Exceptions/CustomException.hpp \
     40                                  Exceptions/LinearDependenceException.hpp \
     41                                  Exceptions/MathException.hpp \
     42                                  Exceptions/NotInvertibleException.hpp \
     43                                  Exceptions/SkewException.hpp \
     44                                  Exceptions/ZeroVectorException.hpp
     45
     46# TODO: Move Exceptionsource back down, when transition is done
    3247LINALGSOURCE = \
     48  ${EXCEPTIONSOURCE} \
    3349  ${HELPERSOURCE} \
    3450  gslmatrix.cpp \
    3551  gslvector.cpp \
    3652  linearsystemofequations.cpp \
     53  Matrix.cpp \
    3754  Space.cpp \
    3855  vector.cpp
     56 
    3957                           
    40 LINALGHEADER = gslmatrix.hpp \
     58LINALGHEADER = \
     59  ${EXCEPTIONHEADER} \
     60  gslmatrix.hpp \
    4161  gslvector.hpp \
    4262  linearsystemofequations.hpp \
     63  Matrix.hpp \
    4364  Space.hpp \
    4465  vector.hpp
     
    6384
    6485ACTIONSHEADER = \
    65   ${ANALYSISACTIONHEADER} \
    66   ${ATOMACTIONHEADER} \
    67   ${CMDACTIONHEADER} \
    68   ${FRAGMENTATIONACTIONHEADER} \
    69   ${MOLECULEACTIONHEADER} \
    70   ${PARSERACTIONHEADER} \
    71   ${TESSELATIONACTIONHEADER} \
    72   ${WORLDACTIONHEADER} \
    7386  Actions/Action.hpp \
    7487  Actions/ActionHistory.hpp \
     
    88101  Parser/ChangeTracker.cpp \
    89102  Parser/FormatParser.cpp \
     103  Parser/FormatParserStorage.cpp \
     104  Parser/MpqcParser.cpp \
     105  Parser/PcpParser.cpp \
    90106  Parser/TremoloParser.cpp \
    91107  Parser/XyzParser.cpp
     108
    92109PARSERHEADER = \
    93110  Parser/ChangeTracker.hpp \
    94111  Parser/FormatParser.hpp \
     112  Parser/FormatParserStorage.hpp \
     113  Parser/MpqcParser.hpp \
     114  Parser/PcpParser.hpp \
    95115  Parser/TremoloParser.hpp \
    96116  Parser/XyzParser.hpp
     
    113133 
    114134
    115 # all these files are only used for legacy reasons while the transition is in progress
    116 # they are only needed to keep the program usable at any point of the transition and will be
    117 # deleted once everything is fully refactored
    118 LEGACYSOURCE = Legacy/oldmenu.cpp
    119 LEGACYHEADER = Legacy/oldmenu.hpp
    120 
    121135DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp \
    122136  Descriptors/AtomIdDescriptor.cpp \
     
    135149  Descriptors/MoleculeNameDescriptor.hpp \
    136150  Descriptors/MoleculePtrDescriptor.hpp
    137                                    
    138 EXCEPTIONSOURCE = Exceptions/CustomException.cpp \
    139                                   Exceptions/LinearDependenceException.cpp \
    140                                   Exceptions/MathException.cpp \
    141                                   Exceptions/SkewException.cpp \
    142                                   Exceptions/ZeroVectorException.cpp
    143                                  
    144 EXCEPTIONHEADER = Exceptions/CustomException.hpp \
    145                                   Exceptions/LinearDependenceException.hpp \
    146                                   Exceptions/MathException.hpp \
    147                                   Exceptions/SkewException.hpp \
    148                                   Exceptions/ZeroVectorException.hpp
    149 
     151
     152#TODO: Exceptionsource should go here, when the transisition makes this possible                                   
    150153SOURCE = \
    151154  ${ANALYSISSOURCE} \
     
    157160  ${DESCRIPTORSOURCE} \
    158161  ${HELPERSOURCE} \
    159   ${LEGACYSOURCE} \
    160   ${EXCEPTIONSOURCE} \
    161162  bond.cpp \
    162163  bondgraph.cpp \
    163164  boundary.cpp \
     165  Box.cpp \
    164166  CommandLineParser.cpp \
    165167  config.cpp \
     168  ConfigFileBuffer.cpp \
    166169  element.cpp \
    167170  elements_db.cpp \
     
    189192  tesselation.cpp \
    190193  tesselationhelpers.cpp \
     194  ThermoStatContainer.cpp \
    191195  triangleintersectionlist.cpp \
    192196  vector.cpp \
     
    203207  ${SHAPEHEADER} \
    204208  ${DESCRIPTORHEADER} \
    205   ${EXCEPTIONHEADER} \
    206   ${LEGACYHEADER} \
    207209  bond.hpp \
    208210  bondgraph.hpp \
    209211  boundary.hpp \
     212  Box.hpp \
    210213  CommandLineParser.hpp \
    211214  config.hpp \
     215  ConfigFileBuffer.hpp \
    212216  defs.hpp \
    213217  element.hpp \
     
    232236  tesselation.hpp \
    233237  tesselationhelpers.hpp \
     238  ThermoStatContainer.hpp \
    234239  triangleintersectionlist.hpp \
    235240  verbose.hpp \
     
    246251INCLUDES = -I$(top_srcdir)/src/unittests -I$(top_srcdir)/src/Actions -I$(top_srcdir)/src/UIElements
    247252
    248 noinst_LIBRARIES = libmolecuilder.a libgslwrapper.a
     253noinst_LIBRARIES = libmolecuilder.a libgslwrapper.a libparser.a
    249254bin_PROGRAMS = molecuilder joiner analyzer
    250255molecuilderdir = ${bindir}
    251256libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER}
     257libparser_a_SOURCES = ${PARSERSOURCE} ${PARSERHEADER}
    252258libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER}
    253259molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
    254260molecuilder_LDFLAGS = $(BOOST_LDFLAGS)
    255261molecuilder_SOURCES = builder.cpp
    256 molecuilder_LDADD =  UIElements/libMolecuilderUI.a Actions/libMolecuilderActions.a libmolecuilder.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
     262molecuilder_LDADD =  UIElements/libMolecuilderUI.a Actions/libMolecuilderActions.a libmolecuilder.a libparser.a libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} ${BOOST_PROGRAM_OPTIONS_LIB}
    257263joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
    258264joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
  • src/Parser/ChangeTracker.cpp

    r0d5dce r8f822c  
    77
    88#include "Helpers/MemDebug.hpp"
     9#include "Parser/ChangeTracker.hpp"
     10#include "Patterns/Singleton_impl.hpp"
    911
    10 #include "ChangeTracker.hpp"
    11 
    12 ChangeTracker* ChangeTracker::instance = NULL;
    1312
    1413/**
     
    2726ChangeTracker::~ChangeTracker() {
    2827  World::getInstance().signOff(this);
    29 }
    30 
    31 /**
    32  * Returns the change tracker instance.
    33  *
    34  * \return this
    35  */
    36 ChangeTracker* ChangeTracker::get() {
    37   if (instance == NULL) {
    38     instance = new ChangeTracker();
    39   }
    40 
    41   return instance;
    42 }
    43 
    44 /**
    45  * Destroys the change tracker instance. Be careful, the change tracker is a
    46  * singleton and destruction might lead to a loss of consistency.
    47  */
    48 void ChangeTracker::destroy() {
    49   delete instance;
    50   instance = NULL;
    5128}
    5229
     
    7653  }
    7754}
     55
     56CONSTRUCT_SINGLETON(ChangeTracker)
  • src/Parser/ChangeTracker.hpp

    r0d5dce r8f822c  
    1818 * changes to it.
    1919 */
    20 class ChangeTracker : public Observable {
     20class ChangeTracker : public Singleton<ChangeTracker>, public Observable {
     21  friend class Singleton<ChangeTracker>;
    2122public:
    2223  void saveStatus();
     
    3132  bool isConsistent;
    3233  static ChangeTracker* instance;
     34
     35  // private constructor and destructor due to singleton
    3336  ChangeTracker();
    3437  ~ChangeTracker();
  • src/Parser/FormatParser.cpp

    r0d5dce r8f822c  
    1919  Observer("FormatParser")
    2020{
    21   ChangeTracker::get()->signOn(this);
     21  ChangeTracker::getInstance().signOn(this);
    2222  saveStream = NULL;
    2323}
     
    2727 */
    2828FormatParser::~FormatParser() {
    29   ChangeTracker::get()->signOff(this);
     29  ChangeTracker::getInstance().signOff(this);
    3030}
    3131
  • src/Parser/TremoloParser.cpp

    r0d5dce r8f822c  
    4949  knownKeys["GrpTypeNo"] = TremoloKey::GrpTypeNo;
    5050  knownKeys["torsion"] = TremoloKey::torsion;
     51
     52  // default behavior: use all possible keys on output
     53  for (std::map<std::string, TremoloKey::atomDataKey>::iterator iter = knownKeys.begin(); iter != knownKeys.end(); ++iter)
     54    usedFields.push_back(iter->first);
    5155}
    5256
     
    193197
    194198  lineStream << line.substr(offset);
     199  usedFields.clear();
    195200  while (lineStream.good()) {
    196201    lineStream >> keyword;
  • src/Parser/TremoloParser.hpp

    r0d5dce r8f822c  
    1010
    1111#include <string>
    12 #include "FormatParser.hpp"
     12#include "Parser/FormatParser.hpp"
    1313
    1414/**
  • src/Parser/XyzParser.cpp

    r0d5dce r8f822c  
    2727 */
    2828XyzParser::~XyzParser() {
    29   delete(&comment);
    3029}
    3130
     
    5857 */
    5958void XyzParser::save(ostream* file) {
     59  if (comment == "") {
     60    time_t now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
     61    comment = "\tCreated by molecuilder on ";
     62    // ctime ends in \n\0, we have to cut away the newline
     63    std::string time(ctime(&now));
     64    size_t pos = time.find('\n');
     65    if (pos != 0)
     66      comment += time.substr(0,pos);
     67    else
     68      comment += time;
     69  }
    6070  *file << World::getInstance().numAtoms() << endl << comment << endl;
    6171
    6272  vector<atom*> atoms = World::getInstance().getAllAtoms();
    6373  for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) {
    64     *file << fixed << (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;
     74    *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;
    6575  }
    6676}
  • src/Parser/XyzParser.hpp

    r0d5dce r8f822c  
    1010
    1111#include <string>
    12 #include "FormatParser.hpp"
     12#include "Parser/FormatParser.hpp"
    1313
    1414/**
  • src/Patterns/Singleton.hpp

    r0d5dce r8f822c  
    99#define SINGLETON_HPP_
    1010
    11 #include <cassert>
    1211#include <boost/thread.hpp>
    1312
     13#include "Helpers/Assert.hpp"
    1414#include "defs.hpp"
    1515
     
    181181
    182182    inline static void set(creator_T*&,creator_T*){
    183       assert(0 && "Cannot set the Instance for a singleton of this type");
     183      ASSERT(0, "Cannot set the Instance for a singleton of this type");
    184184    }
    185185  };
     
    191191  struct creator_t<creator_T,false>{
    192192    inline static creator_T* make(){
    193       assert(0 && "Cannot create a singleton of this type directly");
     193      ASSERT(0, "Cannot create a singleton of this type directly");
     194      return 0;
    194195    }
    195196    inline static void set(ptr_t& dest,creator_T* src){
  • src/Patterns/Singleton_impl.hpp

    r0d5dce r8f822c  
    7272template <class T,bool _may_create>
    7373void Singleton<T,_may_create>::setInstance(T* newInstance){
    74   assert(!theInstance.get() && "Trying to set the instance of an already created singleton");
     74  ASSERT(!theInstance.get(), "Trying to set the instance of an already created singleton");
    7575  boost::recursive_mutex::scoped_lock guard(instanceLock);
    7676  theInstance.reset(newInstance);
     
    8383template <class T, bool _may_create>
    8484Singleton<T,_may_create>::Singleton(const Singleton<T,_may_create>&){
    85   assert(0 && "Copy constructor of singleton template called");
     85  ASSERT(0, "Copy constructor of singleton template called");
    8686}
    8787
  • src/UIElements/CommandLineUI/CommandLineDialog.cpp

    r0d5dce r8f822c  
    2727#include "verbose.hpp"
    2828#include "World.hpp"
     29#include "Box.hpp"
    2930
    3031#include "atom.hpp"
     
    7374}
    7475
    75 void CommandLineDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string _description) {
    76   registerQuery(new VectorCommandLineQuery(title,target,cellSize,check, _description));
    77 }
    78 
    79 void CommandLineDialog::queryBox(const char* title, double ** const cellSize, string _description) {
     76void CommandLineDialog::queryVector(const char* title, Vector *target, bool check, string _description) {
     77  registerQuery(new VectorCommandLineQuery(title,target,check, _description));
     78}
     79
     80void CommandLineDialog::queryBox(const char* title, Box* cellSize, string _description) {
    8081  registerQuery(new BoxCommandLineQuery(title,cellSize,_description));
    8182}
     
    202203}
    203204
    204 CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, const double *const _cellSize, bool _check, string _description) :
    205     Dialog::VectorQuery(title,_target,_cellSize,_check, _description)
     205CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, bool _check, string _description) :
     206    Dialog::VectorQuery(title,_target,_check, _description)
    206207{}
    207208
     
    224225
    225226
    226 CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, double ** const _cellSize, string _description) :
     227CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, Box* _cellSize, string _description) :
    227228    Dialog::BoxQuery(title,_cellSize, _description)
    228229{}
  • src/UIElements/CommandLineUI/CommandLineDialog.hpp

    r0d5dce r8f822c  
    3434  virtual void queryAtom(const char*,atom**, std::string = "");
    3535  virtual void queryMolecule(const char*,molecule**,std::string = "");
    36   virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = "");
    37   virtual void queryBox(const char*,double ** const, std::string = "");
     36  virtual void queryVector(const char*,Vector *,bool, std::string = "");
     37  virtual void queryBox(const char*,Box *, std::string = "");
    3838  virtual void queryElement(const char*, std::vector<element *> *, std::string = "");
    3939
     
    9191  class VectorCommandLineQuery : public Dialog::VectorQuery {
    9292  public:
    93     VectorCommandLineQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = "");
     93    VectorCommandLineQuery(std::string title,Vector *_target,bool _check, std::string _description = "");
    9494    virtual ~VectorCommandLineQuery();
    9595    virtual bool handle();
     
    9898  class BoxCommandLineQuery : public Dialog::BoxQuery {
    9999  public:
    100     BoxCommandLineQuery(std::string title,double ** const _cellSize, std::string _description = "");
     100    BoxCommandLineQuery(std::string title,Box* _cellSize, std::string _description = "");
    101101    virtual ~BoxCommandLineQuery();
    102102    virtual bool handle();
  • src/UIElements/CommandLineUI/CommandLineWindow.cpp

    r0d5dce r8f822c  
    1313#include "CommandLineUI/CommandLineStatusIndicator.hpp"
    1414
     15#include "Actions/Action.hpp"
     16#include "Actions/MapOfActions.hpp"
    1517#include "Actions/ActionRegistry.hpp"
    16 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
    17 #include "Actions/AnalysisAction/PairCorrelationAction.hpp"
    18 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
    19 #include "Actions/AtomAction/AddAction.hpp"
    20 #include "Actions/AtomAction/ChangeElementAction.hpp"
    21 #include "Actions/AtomAction/RemoveAction.hpp"
    22 #include "Actions/CmdAction/BondLengthTableAction.hpp"
    23 #include "Actions/CmdAction/ElementDbAction.hpp"
    24 #include "Actions/CmdAction/FastParsingAction.hpp"
    25 #include "Actions/CmdAction/HelpAction.hpp"
    26 #include "Actions/CmdAction/VerboseAction.hpp"
    27 #include "Actions/CmdAction/VersionAction.hpp"
    28 #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
    29 #include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
    30 #include "Actions/FragmentationAction/FragmentationAction.hpp"
    31 #include "Actions/MoleculeAction/BondFileAction.hpp"
    32 #include "Actions/MoleculeAction/ChangeNameAction.hpp"
    33 #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
    34 #include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
    35 #include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
    36 #include "Actions/MoleculeAction/SaveBondsAction.hpp"
    37 #include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
    38 #include "Actions/MoleculeAction/TranslateAction.hpp"
    39 #include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
    40 #include "Actions/ParserAction/LoadXyzAction.hpp"
    41 #include "Actions/ParserAction/SaveXyzAction.hpp"
    42 #include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
    43 #include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
    44 #include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
    45 #include "Actions/WorldAction/BoundInBoxAction.hpp"
    46 #include "Actions/WorldAction/CenterInBoxAction.hpp"
    47 #include "Actions/WorldAction/CenterOnEdgeAction.hpp"
    48 #include "Actions/WorldAction/ChangeBoxAction.hpp"
    49 #include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
    50 #include "Actions/WorldAction/RepeatBoxAction.hpp"
    51 #include "Actions/WorldAction/ScaleBoxAction.hpp"
    52 #include "Actions/WorldAction/SetDefaultNameAction.hpp"
    53 #include "Actions/WorldAction/SetGaussianBasisAction.hpp"
     18
    5419#include "CommandLineParser.hpp"
    5520
     
    6227{
    6328  // create and register all command line callable actions
    64   populateAnalysisActions();
    65   populateAtomActions();
    66   populateCmdActions();
    67   populateFragmentationActions();
    68   populateMoleculeActions();
    69   populateParserActions();
    70   populateTesselationActions();
    71   populateWorldActions();
     29  MapOfActions::getInstance().populateActions();
    7230
    7331  // Add status indicators etc...
     
    8139
    8240void CommandLineWindow::display() {
     41  //cout << ActionRegistry::getInstance();
     42
    8343  // go through all possible actions
    8444  for (std::list<std::string>::iterator CommandRunner = CommandLineParser::getInstance().SequenceOfActions.begin(); CommandRunner != CommandLineParser::getInstance().SequenceOfActions.end(); ++CommandRunner) {
    85     cout << "Checking presence of " << *CommandRunner << endl;
    86     if (ActionRegistry::getInstance().isActionByNamePresent(*CommandRunner))
     45    cout << "Checking presence of " << *CommandRunner << ": ";
     46    if (ActionRegistry::getInstance().isActionByNamePresent(*CommandRunner)) {
     47      cout << "calling " << *CommandRunner << endl;
    8748      ActionRegistry::getInstance().getActionByName(*CommandRunner)->call();
     49    } else {
     50      cout << "absent." << endl;
     51    }
    8852  }
    8953}
    9054
    91 void CommandLineWindow::populateAnalysisActions()
    92 {
    93   new AnalysisMolecularVolumeAction();
    94   new AnalysisPairCorrelationAction();
    95   new AnalysisPrincipalAxisSystemAction();
    96 }
    97 
    98 void CommandLineWindow::populateAtomActions()
    99 {
    100   new AtomAddAction();
    101   new AtomChangeElementAction();
    102   new AtomRemoveAction();
    103 }
    104 
    105 void CommandLineWindow::populateCmdActions()
    106 {
    107   new CommandLineBondLengthTableAction();
    108   new CommandLineElementDbAction();
    109   new CommandLineFastParsingAction();
    110   new CommandLineHelpAction();
    111   new CommandLineVerboseAction();
    112   new CommandLineVersionAction();
    113 }
    114 
    115 void CommandLineWindow::populateFragmentationActions()
    116 {
    117   new FragmentationDepthFirstSearchAction();
    118   new FragmentationFragmentationAction();
    119   new FragmentationSubgraphDissectionAction();
    120 }
    121 
    122 void CommandLineWindow::populateMoleculeActions()
    123 {
    124   new MoleculeBondFileAction();
    125   new MoleculeChangeNameAction();
    126   new MoleculeFillWithMoleculeAction();
    127   new MoleculeLinearInterpolationofTrajectoriesAction();
    128   new MoleculeSaveAdjacencyAction();
    129   new MoleculeSaveBondsAction();
    130   new MoleculeSaveTemperatureAction();
    131   new MoleculeTranslateAction();
    132   new MoleculeVerletIntegrationAction();
    133 }
    134 
    135 void CommandLineWindow::populateParserActions()
    136 {
    137   new ParserLoadXyzAction();
    138   new ParserSaveXyzAction();
    139 }
    140 
    141 void CommandLineWindow::populateTesselationActions()
    142 {
    143   new TesselationConvexEnvelopeAction();
    144   new TesselationNonConvexEnvelopeAction();
    145 }
    146 
    147 void CommandLineWindow::populateWorldActions()
    148 {
    149   new WorldAddEmptyBoundaryAction();
    150   new WorldBoundInBoxAction();
    151   new WorldCenterInBoxAction();
    152   new WorldCenterOnEdgeAction();
    153   new WorldChangeBoxAction();
    154   new WorldRemoveSphereOfAtomsAction();
    155   new WorldRepeatBoxAction();
    156   new WorldScaleBoxAction();
    157   new WorldSetDefaultNameAction();
    158   new WorldSetGaussianBasisAction();
    159 }
  • src/UIElements/Dialog.cpp

    r0d5dce r8f822c  
    88#include "Helpers/MemDebug.hpp"
    99
    10 #include <cassert>
    11 
    1210#include "Dialog.hpp"
    1311
     
    1614#include "molecule.hpp"
    1715#include "vector.hpp"
     16#include "Matrix.hpp"
     17#include "Box.hpp"
    1818
    1919using namespace std;
     
    164164// Vector Queries
    165165
    166 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description) :
     166Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,bool _check, std::string _description) :
    167167  Query(title, _description),
    168   cellSize(_cellSize),
    169168  check(_check),
    170169  target(_target)
     
    184183// Box Queries
    185184
    186 Dialog::BoxQuery::BoxQuery(std::string title, double ** const _cellSize, std::string _description) :
     185Dialog::BoxQuery::BoxQuery(std::string title, Box* _cellSize, std::string _description) :
    187186  Query(title, _description),
    188187  target(_cellSize)
     
    197196
    198197void Dialog::BoxQuery::setResult() {
    199   for (int i=0;i<6;i++) {
    200     (*target)[i] = tmp[i];
    201   }
     198  (*target)= ReturnFullMatrixforSymmetric(tmp);
    202199}
    203200
  • src/UIElements/Dialog.hpp

    r0d5dce r8f822c  
    1414
    1515class atom;
     16class Box;
    1617class element;
    1718class molecule;
     
    3132  virtual void queryAtom(const char*,atom**,std::string = "")=0;
    3233  virtual void queryMolecule(const char*,molecule**, std::string = "")=0;
    33   virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0;
    34   virtual void queryBox(const char*,double ** const, std::string = "")=0;
     34  virtual void queryVector(const char*,Vector *,bool, std::string = "")=0;
     35  virtual void queryBox(const char*,Box*, std::string = "")=0;
    3536  virtual void queryElement(const char*, std::vector<element *> *, std::string = "")=0;
    3637
     
    148149  class VectorQuery : public Query {
    149150  public:
    150       VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = "");
     151      VectorQuery(std::string title,Vector *_target,bool _check, std::string _description = "");
    151152      virtual ~VectorQuery();
    152153      virtual bool handle()=0;
     
    154155    protected:
    155156      Vector *tmp;
    156       const double *const cellSize;
    157157      bool check;
    158158    private:
     
    162162  class BoxQuery : public Query {
    163163  public:
    164       BoxQuery(std::string title,double ** const _cellSize, std::string _description = "");
     164      BoxQuery(std::string title,Box *_cellSize, std::string _description = "");
    165165      virtual ~BoxQuery();
    166166      virtual bool handle()=0;
    167167      virtual void setResult();
    168168    protected:
    169       double *tmp;
     169      double* tmp;
    170170    private:
    171       double **target;
     171      Box* target;
    172172  };
    173173
  • src/UIElements/TextUI/TextDialog.cpp

    r0d5dce r8f822c  
    2525#include "molecule.hpp"
    2626#include "vector.hpp"
     27#include "Matrix.hpp"
     28#include "Box.hpp"
    2729
    2830using namespace std;
     
    6668}
    6769
    68 void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string description) {
    69   registerQuery(new VectorTextQuery(title,target,cellSize,check,description));
    70 }
    71 
    72 void TextDialog::queryBox(const char* title,double ** const cellSize, string description) {
     70void TextDialog::queryVector(const char* title, Vector *target, bool check, string description) {
     71  registerQuery(new VectorTextQuery(title,target,check,description));
     72}
     73
     74void TextDialog::queryBox(const char* title,Box* cellSize, string description) {
    7375  registerQuery(new BoxTextQuery(title,cellSize,description));
    7476}
     
    243245}
    244246
    245 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check, std::string _description) :
    246     Dialog::VectorQuery(title,_target,_cellSize,_check,_description)
     247TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, bool _check, std::string _description) :
     248    Dialog::VectorQuery(title,_target,_check,_description)
    247249{}
    248250
     
    253255  Log() << Verbose(0) << getTitle();
    254256
     257  const Matrix &M = World::getInstance().getDomain().getM();
    255258  char coords[3] = {'x','y','z'};
    256   int j = -1;
    257259  for (int i=0;i<3;i++) {
    258     j += i+1;
    259260    do {
    260       Log() << Verbose(0) << coords[i] << "[0.." << cellSize[j] << "]: ";
     261      Log() << Verbose(0) << coords[i] << "[0.." << M.at(i,i) << "]: ";
    261262      cin >> (*tmp)[i];
    262     } while ((((*tmp)[i] < 0) || ((*tmp)[i] >= cellSize[j])) && (check));
     263    } while ((((*tmp)[i] < 0) || ((*tmp)[i] >= M.at(i,i))) && (check));
    263264  }
    264265  return true;
    265266}
    266267
    267 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, double ** const _cellSize, std::string _description) :
     268TextDialog::BoxTextQuery::BoxTextQuery(std::string title, Box* _cellSize, std::string _description) :
    268269    Dialog::BoxQuery(title,_cellSize,_description)
    269270{}
  • src/UIElements/TextUI/TextDialog.hpp

    r0d5dce r8f822c  
    3131  virtual void queryAtom(const char*,atom**,std::string = "");
    3232  virtual void queryMolecule(const char*,molecule**,std::string = "");
    33   virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = "");
    34   virtual void queryBox(const char*,double ** const, std::string = "");
     33  virtual void queryVector(const char*,Vector *,bool, std::string = "");
     34  virtual void queryBox(const char*,Box*, std::string = "");
    3535  virtual void queryElement(const char*, std::vector<element *> *, std::string = "");
    3636
     
    8888  class VectorTextQuery : public Dialog::VectorQuery {
    8989  public:
    90     VectorTextQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = NULL);
     90    VectorTextQuery(std::string title,Vector *_target,bool _check, std::string _description = NULL);
    9191    virtual ~VectorTextQuery();
    9292    virtual bool handle();
     
    9595  class BoxTextQuery : public Dialog::BoxQuery {
    9696  public:
    97     BoxTextQuery(std::string title,double ** const _cellSize, std::string _description = NULL);
     97    BoxTextQuery(std::string title,Box* _cellSize, std::string _description = NULL);
    9898    virtual ~BoxTextQuery();
    9999    virtual bool handle();
  • src/UIElements/TextUI/TextWindow.cpp

    r0d5dce r8f822c  
    1212#include <boost/bind.hpp>
    1313
    14 
    15 // TODO: When done with refactoring most of these wont be needed anymore
    16 #include "analysis_correlation.hpp"
    17 #include "atom.hpp"
    18 #include "bond.hpp"
    19 #include "bondgraph.hpp"
    20 #include "boundary.hpp"
    21 #include "config.hpp"
    22 #include "element.hpp"
    23 #include "ellipsoid.hpp"
    24 #include "helpers.hpp"
    25 #include "leastsquaremin.hpp"
    26 #include "linkedcell.hpp"
    27 #include "log.hpp"
    28 #include "memoryusageobserver.hpp"
    29 #include "molecule.hpp"
    30 #include "periodentafel.hpp"
    31 #include "World.hpp"
    32 
    33 #include "Legacy/oldmenu.hpp"
    34 
    3514#include "Menu/Menu.hpp"
    3615#include "Menu/TextMenu.hpp"
     
    4019#include "Menu/SubMenuItem.hpp"
    4120#include "TextUI/TextStatusIndicator.hpp"
     21#include "Actions/MapOfActions.hpp"
    4222#include "Actions/MethodAction.hpp"
    43 #include "Actions/MoleculeAction/ChangeNameAction.hpp"
    4423#include "Actions/ErrorAction.hpp"
    4524#include "Actions/ActionRegistry.hpp"
     
    4726#include "Views/MethodStringView.hpp"
    4827
     28#include "defs.hpp"
     29#include "log.hpp"
     30#include "verbose.hpp"
     31
     32// all needed due to config::SaveAll()
     33#include "config.hpp"
     34#include "periodentafel.hpp"
     35
     36// config::SaveAll() and enumerate()
     37#include "molecule.hpp"
     38
    4939#include <iostream>
     40#include <map>
    5041
    5142using namespace std;
     
    5445TextWindow::TextWindow()
    5546{
    56   MoleculeListClass *molecules = World::getInstance().getMolecules();
    57   config *configuration = World::getInstance().getConfig();
    58   periodentafel *periode = World::getInstance().getPeriode();
    59   char *ConfigFileName = NULL;
    60   old_menu = new oldmenu;
     47  char ConfigFileName[MAXSTRINGSIZE];
     48  map <std::string, TextMenu *> NametoTextMenuMap;
     49
     50  // populate all actions
     51  MapOfActions::getInstance().populateActions();
    6152
    6253  // build the main menu
    6354  main_menu = new TextMenu(Log() << Verbose(0), "Main Menu");
    6455
    65   moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,molecules,_1));
     56  moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,World::getInstance().getMolecules(),_1));
    6657  new DisplayMenuItem(main_menu,moleculeView,"Molecule List");
    6758
     
    7667  new SeperatorItem(main_menu);
    7768
    78   Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,molecules));
     69  Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,World::getInstance().getMolecules()));
    7970  new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction);
    8071
    81   TextMenu *editMoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules");
    82   new SubMenuItem('e',"edit molecules (load, parse, save)",main_menu,editMoleculesMenu);
     72  TextMenu *AnalysisMenu = new TextMenu(Log() << Verbose(0), "Analysis");
     73  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("analysis", AnalysisMenu) );
     74  new SubMenuItem('A',"Analysis (pair correlation, volume)",main_menu,AnalysisMenu);
    8375
    84   Action *manipulateMoleculeAction = new MethodAction("manipulateMoleculeAction",boost::bind(&oldmenu::ManipulateMolecules,old_menu,periode, molecules, configuration));
    85   new ActionMenuItem('g',"globally manipulate atoms in molecule",main_menu,manipulateMoleculeAction);
     76  TextMenu *CommandMenu = new TextMenu(Log() << Verbose(0), "Configuration");
     77  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("command", CommandMenu) );
     78  new SubMenuItem('c',"configuration",main_menu,CommandMenu);
    8679
    87   Action *mergeMoleculeAction = new MethodAction("mergeMoleculeAction",boost::bind(&oldmenu::MergeMolecules,old_menu,periode, molecules));
    88   new ActionMenuItem('M',"Merge molecules",main_menu,mergeMoleculeAction);
     80  TextMenu *AtomMenu = new TextMenu(Log() << Verbose(0), "Atoms");
     81  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("atom", AtomMenu) );
     82  new SubMenuItem('e',"edit atoms",main_menu,AtomMenu);
    8983
    90   Action *manipulateAtomsAction = new MethodAction("manipulateAtomsAction",boost::bind(&oldmenu::ManipulateAtoms,old_menu,periode, molecules, configuration));
    91   new ActionMenuItem('m',"manipulate atoms",main_menu,manipulateAtomsAction);
     84  TextMenu *FragmentationMenu = new TextMenu(Log() << Verbose(0), "Fragmentation");
     85  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("fragmentation", FragmentationMenu) );
     86  new SubMenuItem('f',"fragmentation",main_menu,FragmentationMenu);
     87
     88  TextMenu *ParserMenu = new TextMenu(Log() << Verbose(0), "Parse files");
     89  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("parser", ParserMenu) );
     90  new SubMenuItem('p',"parse files into system",main_menu,ParserMenu);
     91
     92  TextMenu *MoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules");
     93  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("analysis", AnalysisMenu) );
     94  new SubMenuItem('m',"edit molecules (load, parse, save)",main_menu,MoleculesMenu);
     95
     96  TextMenu *TesselationMenu = new TextMenu(Log() << Verbose(0), "Tesselate Molecules");
     97  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("tesselation", TesselationMenu) );
     98  new SubMenuItem('t',"tesselate molecules",main_menu,TesselationMenu);
     99
     100  TextMenu *WorldMenu = new TextMenu(Log() << Verbose(0), "World");
     101  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("world", WorldMenu) );
     102  new SubMenuItem('w',"edit world",main_menu,WorldMenu);
    92103
    93104  new SeperatorItem(main_menu);
    94105
    95   Action *editConfigAction = new MethodAction("editConfigAction",boost::bind(&config::Edit,configuration));
    96   new ActionMenuItem('c',"edit the current configuration",main_menu,editConfigAction);
    97 
    98   new SeperatorItem(main_menu);
    99 
    100   Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules));
     106  Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,World::getInstance().getConfig(), ConfigFileName, World::getInstance().getPeriode(), World::getInstance().getMolecules()));
    101107  new ActionMenuItem('s',"save current setup to config file",main_menu,saveConfigAction);
    102 
    103   Action *doTestAction = new MethodAction("doTestAction",boost::bind(&oldmenu::testroutine,old_menu,molecules));
    104   new ActionMenuItem('T',"call the current test routine",main_menu,doTestAction);
    105108
    106109  quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false);
    107110  new ActionMenuItem('q',"quit",main_menu,quitAction);
    108111
    109   // call all functions used to build the submenus
    110 
    111   populateEditMoleculesMenu(editMoleculesMenu);
    112 
    113   Action *returnFromEditMoleculeAction = new TextMenu::LeaveAction(editMoleculesMenu);
    114   MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnFromEditMoleculeAction);
    115 
    116   editMoleculesMenu->addDefault(returnItem);
     112  // go through all menus and create them
     113  for (map <std::string, TextMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) {
     114    cout << "Creating Menu " << MenuRunner->first << "." << endl;
     115    populateMenu(MenuRunner->second, MenuRunner->first);
     116  }
    117117
    118118  // Add status indicators etc...
     
    123123TextWindow::~TextWindow()
    124124{
    125   delete old_menu;
    126125  delete quitAction;
    127126  delete moleculeView;
     
    134133}
    135134
    136 void TextWindow::populateEditMoleculesMenu(Menu* editMoleculesMenu)
     135char TextWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const
    137136{
    138   MoleculeListClass *molecules = World::getInstance().getMolecules();
    139   periodentafel *periode = World::getInstance().getPeriode();
     137  for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
     138    if (ShortcutList.find(*CharRunner) == ShortcutList.end())
     139      return *CharRunner;
     140  }
     141  DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);
     142  return ((char)(ShortcutList.size() % 10) + '0');
     143}
    140144
    141   // build the EditMoleculesMenu
    142   Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));
    143   new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);
    144 
    145   Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));
    146   new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);
    147 
    148   Action *changeFilenameAction = new MoleculeChangeNameAction();
    149   new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);
    150 
    151   Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));
    152   new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);
    153 
    154   Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));
    155   new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);
    156 
    157   Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));
    158   new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);
    159 
     145void TextWindow::populateMenu(TextMenu* Menu, const  std::string &MenuName)
     146{
     147  Action *ActionItem = NULL;
     148  set <char> ShortcutList;
     149  // through all actions for this menu
     150  pair < multimap <std::string, std::string>::iterator, multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
     151  for (multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
     152    cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;
     153    ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
     154    new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
     155  }
     156  // finally add default quit item
     157  Action *returnFromAction = new TextMenu::LeaveAction(Menu);
     158  MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);
     159  Menu->addDefault(returnFromItem);
    160160}
  • src/UIElements/TextUI/TextWindow.hpp

    r0d5dce r8f822c  
    1111#include "MainWindow.hpp"
    1212
     13#include <string>
     14#include <set>
     15
    1316class TextMenu;
    1417class Action;
    15 class oldmenu;
    1618class StringView;
    1719class TextStatusIndicator;
     
    2729private:
    2830  // populaters
    29   void populateEditMoleculesMenu(Menu* editMoleculesMenu);
     31  char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
     32  void populateMenu(TextMenu* Menu, const std::string &name);
    3033
    3134  TextMenu *main_menu;
     
    3639  StringView *moleculeView;
    3740  TextStatusIndicator *statusIndicator;
    38 
    39   // This class still contains a lot of scattered functionality
    40   oldmenu *old_menu;
    4141};
    4242
  • src/VectorSet.hpp

    r0d5dce r8f822c  
    1212#include <functional>
    1313#include <algorithm>
     14#include <limits>
    1415
    1516/**
     
    1920 */
    2021
    21 class Vector;
     22#include "vector.hpp"
     23#include <list>
    2224
    2325// this tests, whether we actually have a Vector
     
    4850  void translate(const Vector &translater){
    4951    // this is needed to allow template lookup
    50     transform(this->begin(),this->end(),this->begin(),bind1st(plus<Vector>(),translater));
     52    transform(this->begin(),this->end(),this->begin(),std::bind1st(std::plus<Vector>(),translater));
     53  }
     54
     55  double minDistSquared(const Vector &point){
     56    if(!this->size())
     57      return std::numeric_limits<double>::infinity();
     58    std::list<double> helper;
     59    helper.resize(this->size());
     60    transform(this->begin(),this->end(),
     61              helper.begin(),
     62              std::bind2nd(std::mem_fun_ref(&Vector::DistanceSquared),point));
     63    return *min_element(helper.begin(),helper.end());
    5164  }
    5265};
    5366
     67// allows simpler definition of VectorSets
     68#define VECTORSET(container_type) VectorSet<container_type<Vector> >
     69
    5470#endif /* VECTORSET_HPP_ */
  • src/World.cpp

    r0d5dce r8f822c  
    1414#include "molecule.hpp"
    1515#include "periodentafel.hpp"
     16#include "ThermoStatContainer.hpp"
    1617#include "Descriptors/AtomDescriptor.hpp"
    1718#include "Descriptors/AtomDescriptor_impl.hpp"
     
    2021#include "Descriptors/SelectiveIterator_impl.hpp"
    2122#include "Actions/ManipulateAtomsProcess.hpp"
     23#include "Helpers/Assert.hpp"
     24#include "Box.hpp"
     25#include "Matrix.hpp"
    2226
    2327#include "Patterns/Singleton_impl.hpp"
     
    7276// system
    7377
    74 double * World::getDomain() {
    75   return cell_size;
     78Box& World::getDomain() {
     79  return *cell_size;
     80}
     81
     82void World::setDomain(const Matrix &mat){
     83  *cell_size = mat;
    7684}
    7785
    7886void World::setDomain(double * matrix)
    7987{
    80 
     88  Matrix M = ReturnFullMatrixforSymmetric(matrix);
     89  cell_size->setM(M);
    8190}
    8291
     
    8998  defaultName = name;
    9099};
     100
     101class ThermoStatContainer * World::getThermostats()
     102{
     103  return Thermostats;
     104}
     105
    91106
    92107int World::getExitFlag() {
     
    105120  molecule *mol = NULL;
    106121  mol = NewMolecule();
    107   assert(!molecules.count(currMoleculeId));
     122  ASSERT(!molecules.count(currMoleculeId),"currMoleculeId did not specify an unused ID");
    108123  mol->setId(currMoleculeId++);
    109124  // store the molecule by ID
     
    121136  OBSERVE;
    122137  molecule *mol = molecules[id];
    123   assert(mol);
     138  ASSERT(mol,"Molecule id that was meant to be destroyed did not exist");
    124139  DeleteMolecule(mol);
    125140  molecules.erase(id);
    126141}
    127 
    128 double *World::cell_size = NULL;
    129142
    130143atom *World::createAtom(){
     
    157170  OBSERVE;
    158171  atom *atom = atoms[id];
    159   assert(atom);
     172  ASSERT(atom,"Atom ID that was meant to be destroyed did not exist");
    160173  DeleteAtom(atom);
    161174  atoms.erase(id);
     
    169182  if(!target){
    170183    target = atoms[oldId];
    171     assert(target && "Atom with that ID not found");
     184    ASSERT(target,"Atom with that ID not found");
    172185    return target->changeId(newId);
    173186  }
     
    281294    periode(new periodentafel),
    282295    configuration(new config),
     296    Thermostats(new ThermoStatContainer),
    283297    ExitFlag(0),
    284298    atoms(),
     
    288302    molecules_deprecated(new MoleculeListClass(this))
    289303{
    290   cell_size = new double[6];
    291   cell_size[0] = 20.;
    292   cell_size[1] = 0.;
    293   cell_size[2] = 20.;
    294   cell_size[3] = 0.;
    295   cell_size[4] = 0.;
    296   cell_size[5] = 20.;
     304  cell_size = new Box;
     305  Matrix domain;
     306  domain.at(0,0) = 20;
     307  domain.at(1,1) = 20;
     308  domain.at(2,2) = 20;
     309  cell_size->setM(domain);
    297310  defaultName = "none";
    298311  molecules_deprecated->signOn(this);
     
    302315{
    303316  molecules_deprecated->signOff(this);
    304   delete[] cell_size;
     317  delete cell_size;
    305318  delete molecules_deprecated;
    306319  delete periode;
    307320  delete configuration;
     321  delete Thermostats;
    308322  MoleculeSet::iterator molIter;
    309323  for(molIter=molecules.begin();molIter!=molecules.end();++molIter){
  • src/World.hpp

    r0d5dce r8f822c  
    3030
    3131// forward declarations
    32 class config;
    33 class periodentafel;
    34 class MoleculeListClass;
    3532class atom;
    36 class molecule;
    3733class AtomDescriptor;
    3834class AtomDescriptor_impl;
     35template<typename T> class AtomsCalculation;
     36class Box;
     37class config;
     38class ManipulateAtomsProcess;
     39class Matrix;
     40class molecule;
    3941class MoleculeDescriptor;
    4042class MoleculeDescriptor_impl;
    41 class ManipulateAtomsProcess;
    42 template<typename T>
    43 class AtomsCalculation;
     43class MoleculeListClass;
     44class periodentafel;
     45class ThermoStatContainer;
    4446
    4547/****************************************** forward declarations *****************************/
     
    125127   * get the domain size as a symmetric matrix (6 components)
    126128   */
    127   double * getDomain();
     129  Box& getDomain();
     130
     131  /**
     132   * Set the domain size from a matrix object
     133   *
     134   * Matrix needs to be symmetric
     135   */
     136  void setDomain(const Matrix &mat);
    128137
    129138  /**
     
    141150   */
    142151  void setDefaultName(std::string name);
     152
     153  /**
     154   * get pointer to World's ThermoStatContainer
     155   */
     156  ThermoStatContainer * getThermostats();
    143157
    144158  /*
     
    252266  periodentafel *periode;
    253267  config *configuration;
    254   static double *cell_size;
     268  Box *cell_size;
    255269  std::string defaultName;
     270  class ThermoStatContainer *Thermostats;
    256271  int ExitFlag;
    257272public:
  • src/analysis_correlation.cpp

    r0d5dce r8f822c  
    1919#include "triangleintersectionlist.hpp"
    2020#include "vector.hpp"
     21#include "Matrix.hpp"
    2122#include "verbose.hpp"
    2223#include "World.hpp"
     24#include "Box.hpp"
    2325
    2426
     
    3436  PairCorrelationMap *outmap = NULL;
    3537  double distance = 0.;
    36   double *domain = World::getInstance().getDomain();
     38  Box &domain = World::getInstance().getDomain();
    3739
    3840  if (molecules->ListOfMolecules.empty()) {
     
    7577                for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    7678                  if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    77                     distance = (*iter)->node->PeriodicDistance(*(*runner)->node,  domain);
     79                    distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node);
    7880                    //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
    7981                    outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
     
    135137  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){
    136138    if ((*MolWalker)->ActiveFlag) {
    137       double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    138       double * FullInverseMatrix = InverseMatrix(FullMatrix);
     139      Matrix FullMatrix = World::getInstance().getDomain().getM();
     140      Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
    139141      DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    140142      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
    141143      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    142144        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    143         periodicX = *(*iter)->node;
    144         periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     145        periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    145146        // go through every range in xyz and get distance
    146147        for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    147148          for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    148149            for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    149               checkX = Vector(n[0], n[1], n[2]) + periodicX;
    150               checkX.MatrixMultiplication(FullMatrix);
     150              checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    151151              for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){
    152152                if ((*MolOtherWalker)->ActiveFlag) {
     
    157157                      for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    158158                        if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    159                           periodicOtherX = *(*runner)->node;
    160                           periodicOtherX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     159                          periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
    161160                          // go through every range in xyz and get distance
    162161                          for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
    163162                            for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
    164163                              for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
    165                                 checkOtherX = Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX;
    166                                 checkOtherX.MatrixMultiplication(FullMatrix);
     164                                checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
    167165                                distance = checkX.distance(checkOtherX);
    168166                                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
     
    176174            }
    177175      }
    178       delete[](FullMatrix);
    179       delete[](FullInverseMatrix);
    180176    }
    181177  }
     
    195191  CorrelationToPointMap *outmap = NULL;
    196192  double distance = 0.;
    197   double *cell_size = World::getInstance().getDomain();
     193  Box &domain = World::getInstance().getDomain();
    198194
    199195  if (molecules->ListOfMolecules.empty()) {
     
    211207        for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    212208          if ((*type == NULL) || ((*iter)->type == *type)) {
    213             distance = (*iter)->node->PeriodicDistance(*point, cell_size);
     209            distance = domain.periodicDistance(*(*iter)->node,*point);
    214210            DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    215211            outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
     
    246242  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    247243    if ((*MolWalker)->ActiveFlag) {
    248       double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    249       double * FullInverseMatrix = InverseMatrix(FullMatrix);
     244      Matrix FullMatrix = World::getInstance().getDomain().getM();
     245      Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
    250246      DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    251247      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     
    253249        for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    254250          if ((*type == NULL) || ((*iter)->type == *type)) {
    255             periodicX = *(*iter)->node;
    256             periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     251            periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    257252            // go through every range in xyz and get distance
    258253            for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    259254              for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    260255                for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    261                   checkX = Vector(n[0], n[1], n[2]) + periodicX;
    262                   checkX.MatrixMultiplication(FullMatrix);
     256                  checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    263257                  distance = checkX.distance(*point);
    264258                  DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
     
    267261          }
    268262      }
    269       delete[](FullMatrix);
    270       delete[](FullInverseMatrix);
    271263    }
    272264
     
    352344  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    353345    if ((*MolWalker)->ActiveFlag) {
    354       double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    355       double * FullInverseMatrix = InverseMatrix(FullMatrix);
     346      Matrix FullMatrix = World::getInstance().getDomain().getM();
     347      Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv();
    356348      DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    357349      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     
    359351        for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    360352          if ((*type == NULL) || ((*iter)->type == *type)) {
    361             periodicX = *(*iter)->node;
    362             periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     353            periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    363354            // go through every range in xyz and get distance
    364355            ShortestDistance = -1.;
     
    366357              for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    367358                for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    368                   checkX = Vector(n[0], n[1], n[2]) + periodicX;
    369                   checkX.MatrixMultiplication(FullMatrix);
     359                  checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    370360                  TriangleIntersectionList Intersections(&checkX,Surface,LC);
    371361                  distance = Intersections.GetSmallestDistance();
     
    381371          }
    382372      }
    383       delete[](FullMatrix);
    384       delete[](FullInverseMatrix);
    385373    }
    386374
  • src/atom.cpp

    r0d5dce r8f822c  
    112112 * \return true - is inside, false - is not
    113113 */
    114 bool atom::IsInParallelepiped(const Vector offset, const double *parallelepiped) const
     114bool atom::IsInParallelepiped(const Vector offset, const Matrix& parallelepiped) const
    115115{
    116116  return (node->IsInParallelepiped(offset, parallelepiped));
     
    159159  * \return true - \a *out present, false - \a *out is NULL
    160160 */
    161 bool atom::OutputArrayIndexed(ofstream * const out, const int *ElementNo, int *AtomNo, const char *comment) const
     161bool atom::OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment) const
    162162{
    163163  AtomNo[type->Z]++;  // increment number
     
    236236 * \param *AtomNo pointer to atom counter that is increased by one
    237237 */
    238 void atom::OutputMPQCLine(ofstream * const out, const Vector *center, int *AtomNo = NULL) const
     238void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const
    239239{
    240240  *out << "\t\t" << type->symbol << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl;
  • src/atom.hpp

    r0d5dce r8f822c  
    5151
    5252  bool OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment = NULL) const;
    53   bool OutputArrayIndexed(ofstream * const out, const int *ElementNo, int *AtomNo, const char *comment = NULL) const;
     53  bool OutputArrayIndexed(ostream * const out, const int *ElementNo, int *AtomNo, const char *comment = NULL) const;
    5454  bool OutputXYZLine(ofstream *out) const;
    5555  bool OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const;
    5656  bool OutputTrajectoryXYZ(ofstream * const out, const int step) const;
    57   void OutputMPQCLine(ofstream * const out, const Vector *center, int *AtomNo) const;
     57  void OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo) const;
    5858
    5959  void InitComponentNr();
     
    6666  double DistanceToVector(const Vector &origin) const;
    6767  double DistanceSquaredToVector(const Vector &origin) const;
    68   bool IsInParallelepiped(const Vector offset, const double *parallelepiped) const;
     68  bool IsInParallelepiped(const Vector offset, const Matrix &parallelepiped) const;
    6969
    7070  // getter and setter
  • src/atom_trajectoryparticle.cpp

    r0d5dce r8f822c  
    1515#include "log.hpp"
    1616#include "parser.hpp"
     17#include "ThermoStatContainer.hpp"
    1718#include "verbose.hpp"
    1819
     
    197198void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)
    198199{
    199   double sigma  = sqrt(configuration->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
     200  double sigma  = sqrt(configuration->Thermostats->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
    200201  Vector &U = Trajectory.U.at(Step);
    201202  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    202203    // throw a dice to determine whether it gets hit by a heat bath particle
    203     if (((((rand()/(double)RAND_MAX))*configuration->TempFrequency) < 1.)) {
     204    if (((((rand()/(double)RAND_MAX))*configuration->Thermostats->TempFrequency) < 1.)) {
    204205      DoLog(3) && (Log() << Verbose(3) << "Particle " << *this << " was hit (sigma " << sigma << "): " << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << " -> ");
    205206      // pick three random numbers from a Boltzmann distribution around the desired temperature T for each momenta axis
     
    225226  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    226227    for (int d=0; d<NDIM; d++) {
    227       U[d] *= sqrt(1+(configuration->Deltat/configuration->TempFrequency)*(ScaleTempFactor-1));
     228      U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));
    228229      *ekin += 0.5*type->mass * U[d]*U[d];
    229230    }
     
    255256  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    256257    for (int d=0; d<NDIM; d++) {
    257         U[d] += configuration->Deltat/type->mass * (configuration->alpha * (U[d] * type->mass));
     258        U[d] += configuration->Deltat/type->mass * (configuration->Thermostats->alpha * (U[d] * type->mass));
    258259        *ekin += (0.5*type->mass) * U[d]*U[d];
    259260      }
  • src/boundary.cpp

    r0d5dce r8f822c  
    2222#include "World.hpp"
    2323#include "Plane.hpp"
     24#include "Matrix.hpp"
     25#include "Box.hpp"
    2426
    2527#include<gsl/gsl_poly.h>
     
    764766  int N[NDIM];
    765767  int n[NDIM];
    766   double *M =  ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
    767   double Rotations[NDIM*NDIM];
    768   double *MInverse = InverseMatrix(M);
     768  const Matrix &M = World::getInstance().getDomain().getM();
     769  Matrix Rotations;
     770  const Matrix &MInverse = World::getInstance().getDomain().getMinv();
    769771  Vector AtomTranslations;
    770772  Vector FillerTranslations;
     
    799801
    800802  // calculate filler grid in [0,1]^3
    801   FillerDistance = Vector(distance[0], distance[1], distance[2]);
    802   FillerDistance.InverseMatrixMultiplication(M);
     803  FillerDistance = MInverse * Vector(distance[0], distance[1], distance[2]);
    803804  for(int i=0;i<NDIM;i++)
    804805    N[i] = (int) ceil(1./FillerDistance[i]);
     
    813814      for (n[2] = 0; n[2] < N[2]; n[2]++) {
    814815        // calculate position of current grid vector in untransformed box
    815         CurrentPosition = Vector((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]);
    816         CurrentPosition.MatrixMultiplication(M);
     816        CurrentPosition = M * Vector((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]);
    817817        // create molecule random translation vector ...
    818818        for (int i=0;i<NDIM;i++)
     
    835835            }
    836836
    837             Rotations[0] =   cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2]));
    838             Rotations[3] =   sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2]));
    839             Rotations[6] =               cos(phi[1])*sin(phi[2])                                     ;
    840             Rotations[1] = - sin(phi[0])*cos(phi[1])                                                ;
    841             Rotations[4] =   cos(phi[0])*cos(phi[1])                                                ;
    842             Rotations[7] =               sin(phi[1])                                                ;
    843             Rotations[3] = - cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2]));
    844             Rotations[5] = - sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2]));
    845             Rotations[8] =               cos(phi[1])*cos(phi[2])                                     ;
     837            Rotations.set(0,0,  cos(phi[0])            *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2])));
     838            Rotations.set(0,1,  sin(phi[0])            *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2])));
     839            Rotations.set(0,2,              cos(phi[1])*sin(phi[2])                                        );
     840            Rotations.set(1,0, -sin(phi[0])*cos(phi[1])                                                    );
     841            Rotations.set(1,1,  cos(phi[0])*cos(phi[1])                                                    );
     842            Rotations.set(1,2,              sin(phi[1])                                                    );
     843            Rotations.set(2,0, -cos(phi[0])            *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2])));
     844            Rotations.set(2,1, -sin(phi[0])            *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2])));
     845            Rotations.set(2,2,              cos(phi[1])*cos(phi[2])                                        );
    846846          }
    847847
     
    849849          Inserter = (*iter)->x;
    850850          if (DoRandomRotation)
    851             Inserter.MatrixMultiplication(Rotations);
     851            Inserter *= Rotations;
    852852          Inserter += AtomTranslations + FillerTranslations + CurrentPosition;
    853853
    854854          // check whether inserter is inside box
    855           Inserter.MatrixMultiplication(MInverse);
     855          Inserter *= MInverse;
    856856          FillIt = true;
    857857          for (int i=0;i<NDIM;i++)
    858858            FillIt = FillIt && (Inserter[i] >= -MYEPSILON) && ((Inserter[i]-1.) <= MYEPSILON);
    859           Inserter.MatrixMultiplication(M);
     859          Inserter *= M;
    860860
    861861          // Check whether point is in- or outside
     
    892892            }
    893893      }
    894   delete[](M);
    895   delete[](MInverse);
    896894
    897895  return Filling;
  • src/builder.cpp

    r0d5dce r8f822c  
    11/** \file builder.cpp
    22 *
    3  * By stating absolute positions or binding angles and distances atomic positions of a molecule can be constructed.
    4  * The output is the complete configuration file for PCP for direct use.
    5  * Features:
    6  * -# Atomic data is retrieved from a file, if not found requested and stored there for later re-use
    7  * -# step-by-step construction of the molecule beginning either at a centre of with a certain atom
     3 *  date: Jan 1, 2007
     4 *  author: heber
    85 *
    96 */
    107
    11 /*! \mainpage Molecuilder - a molecular set builder
     8/*! \mainpage MoleCuilder - a molecular set builder
    129 *
    13  * This introductory shall briefly make aquainted with the program, helping in installing and a first run.
     10 * This introductory shall briefly make acquainted with the program, helping in installing and a first run.
    1411 *
    1512 * \section about About the Program
    1613 *
    17  *  Molecuilder is a short program, written in C++, that enables the construction of a coordinate set for the
    18  *  atoms making up an molecule by the successive statement of binding angles and distances and referencing to
    19  *  already constructed atoms.
     14 *  MoleCuilder is a program, written entirely in C++, that enables the construction of a coordinate set for the
     15 *  atoms making up an molecule. It allows for both building of simple molecules by adding atom-wise giving bond
     16 *  angles and distances or absolute coordinates, but also using them as templates. Regions can be specified and
     17 *  ordered to be filled with a molecule in a certain manner. Greater conglomerations of molecules can be tesselated
     18 *  and recognized as a region themselves to be subsequently surrounded by other (surface solvated) molecules.
     19 *  In the end, MoleCuilder allows the construction of arbitrary nano structures, whether they be crystalline or
     20 *  amorphic in nature.
    2021 *
    21  *  A configuration file may be written that is compatible to the format used by PCP - a parallel Car-Parrinello
    22  *  molecular dynamics implementation.
    2322 *
    2423 * \section install Installation
     
    3231 *  -# make clean uninstall: deletes .o-files and removes executable from the given binary directory\n
    3332 *  -# make doxygen-doc: Creates these html pages out of the documented source
     33 *  -# make check: Runs an extensive set of unit tests and a testsuite which also gives a good overview on the set of
     34 *                 functions.
    3435 *
    3536 * \section run Running
     
    3738 *  The program can be executed by running: ./molecuilder
    3839 *
    39  *  Note, that it uses a database, called "elements.db", in the executable's directory. If the file is not found,
    40  *  it is created and any given data on elements of the periodic table will be stored therein and re-used on
    41  *  later re-execution.
     40 *  MoleCuilder has three interfaces at your disposal:
     41 *  -# Textmenu: A simple interactive console-based menu, where awaits your choices and inputs in order to set atoms
     42 *               as you like
     43 *  -# CommandLineUI: Every command can also be chained up as a sequence of actions on the command line to be executed
     44 *               with any user interaction.
     45 *  -# GraphicalUI: A graphical user interface that also display the molecular structure being built and lots of other
     46 *               informations to ease the construction of bigger geometries.
    4247 *
    43  * \section ref References
    44  *
    45  *  For the special configuration file format, see the documentation of pcp.
     48 *  The supported output formats right now are:
     49 *  -# mpqc: Configuration files of the Massively Parallel Quantum Chemistry package (Sandia labs)
     50 *  -# pcp: Configuration files of the Parallel Car-Parrinello program (Institute for Numerical Simulation)
     51 *  -# tremolo: Configuration files of TREMOLO (Institute for Numerical Simulation)
     52 *  -# xyz: the most basic format for the 3d arrangement of atoms consisting of a list of element and 3 coordinates.
    4653 *
    4754 */
     
    4956#include "Helpers/MemDebug.hpp"
    5057
    51 #include <boost/bind.hpp>
    52 
    53 using namespace std;
    54 
    55 #include <cstring>
    56 #include <cstdlib>
    57 
    58 #include "analysis_bonds.hpp"
    59 #include "analysis_correlation.hpp"
    60 #include "atom.hpp"
    61 #include "bond.hpp"
    6258#include "bondgraph.hpp"
    63 #include "boundary.hpp"
    6459#include "CommandLineParser.hpp"
    6560#include "config.hpp"
    66 #include "element.hpp"
    67 #include "ellipsoid.hpp"
    68 #include "helpers.hpp"
    69 #include "leastsquaremin.hpp"
    70 #include "linkedcell.hpp"
    7161#include "log.hpp"
    72 #include "memoryusageobserver.hpp"
    73 #include "molecule.hpp"
    74 #include "periodentafel.hpp"
     62#include "verbose.hpp"
     63#include "World.hpp"
     64
     65#include "Actions/ActionRegistry.hpp"
     66#include "Actions/ActionHistory.hpp"
     67#include "Actions/MapOfActions.hpp"
     68
     69#include "Parser/ChangeTracker.hpp"
     70#include "Parser/FormatParserStorage.hpp"
     71
    7572#include "UIElements/UIFactory.hpp"
    7673#include "UIElements/TextUI/TextUIFactory.hpp"
     
    7875#include "UIElements/MainWindow.hpp"
    7976#include "UIElements/Dialog.hpp"
    80 #include "Menu/ActionMenuItem.hpp"
    81 #include "Actions/ActionRegistry.hpp"
    82 #include "Actions/ActionHistory.hpp"
    83 #include "Actions/MapOfActions.hpp"
    84 #include "Actions/MethodAction.hpp"
    85 #include "Actions/MoleculeAction/ChangeNameAction.hpp"
    86 #include "World.hpp"
     77
    8778#include "version.h"
    88 #include "World.hpp"
    8979
    90 
    91 /********************************************* Subsubmenu routine ************************************/
    92 #if 0
    93 /** Submenu for adding atoms to the molecule.
    94  * \param *periode periodentafel
    95  * \param *molecule molecules with atoms
    96  */
    97 static void AddAtoms(periodentafel *periode, molecule *mol)
    98 {
    99   atom *first, *second, *third, *fourth;
    100   Vector **atoms;
    101   Vector x,y,z,n;  // coordinates for absolute point in cell volume
    102   double a,b,c;
    103   char choice;  // menu choice char
    104   bool valid;
    105 
    106   cout << Verbose(0) << "===========ADD ATOM============================" << endl;
    107   cout << Verbose(0) << " a - state absolute coordinates of atom" << endl;
    108   cout << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
    109   cout << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
    110   cout << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
    111   cout << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
    112   cout << Verbose(0) << "all else - go back" << endl;
    113   cout << Verbose(0) << "===============================================" << endl;
    114   cout << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
    115   cout << Verbose(0) << "INPUT: ";
    116   cin >> choice;
    117 
    118   switch (choice) {
    119     default:
    120       DoeLog(2) && (eLog()<< Verbose(2) << "Not a valid choice." << endl);
    121       break;
    122       case 'a': // absolute coordinates of atom
    123         cout << Verbose(0) << "Enter absolute coordinates." << endl;
    124         first = new atom;
    125         first->x.AskPosition(World::getInstance().getDomain(), false);
    126         first->type = periode->AskElement();  // give type
    127         mol->AddAtom(first);  // add to molecule
    128         break;
    129 
    130       case 'b': // relative coordinates of atom wrt to reference point
    131         first = new atom;
    132         valid = true;
    133         do {
    134           if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
    135           cout << Verbose(0) << "Enter reference coordinates." << endl;
    136           x.AskPosition(World::getInstance().getDomain(), true);
    137           cout << Verbose(0) << "Enter relative coordinates." << endl;
    138           first->x.AskPosition(World::getInstance().getDomain(), false);
    139           first->x.AddVector((const Vector *)&x);
    140           cout << Verbose(0) << "\n";
    141         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    142         first->type = periode->AskElement();  // give type
    143         mol->AddAtom(first);  // add to molecule
    144         break;
    145 
    146       case 'c': // relative coordinates of atom wrt to already placed atom
    147         first = new atom;
    148         valid = true;
    149         do {
    150           if (!valid) DoeLog(2) && (eLog()<< Verbose(2) << "Resulting position out of cell." << endl);
    151           second = mol->AskAtom("Enter atom number: ");
    152           DoLog(0) && (Log() << Verbose(0) << "Enter relative coordinates." << endl);
    153           first->x.AskPosition(World::getInstance().getDomain(), false);
    154           for (int i=NDIM;i--;) {
    155             first->x.x[i] += second->x.x[i];
    156           }
    157         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    158         first->type = periode->AskElement();  // give type
    159         mol->AddAtom(first);  // add to molecule
    160         break;
    161 
    162     case 'd': // two atoms, two angles and a distance
    163         first = new atom;
    164         valid = true;
    165         do {
    166           if (!valid) {
    167             DoeLog(2) && (eLog()<< Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl);
    168           }
    169           cout << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
    170           second = mol->AskAtom("Enter central atom: ");
    171           third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
    172           fourth = mol->AskAtom("Enter third atom (specifying a plane for second angle): ");
    173           a = ask_value("Enter distance between central (first) and new atom: ");
    174           b = ask_value("Enter angle between new, first and second atom (degrees): ");
    175           b *= M_PI/180.;
    176           bound(&b, 0., 2.*M_PI);
    177           c = ask_value("Enter second angle between new and normal vector of plane defined by first, second and third atom (degrees): ");
    178           c *= M_PI/180.;
    179           bound(&c, -M_PI, M_PI);
    180           cout << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
    181 /*
    182           second->Output(1,1,(ofstream *)&cout);
    183           third->Output(1,2,(ofstream *)&cout);
    184           fourth->Output(1,3,(ofstream *)&cout);
    185           n.MakeNormalvector((const vector *)&second->x, (const vector *)&third->x, (const vector *)&fourth->x);
    186           x.Copyvector(&second->x);
    187           x.SubtractVector(&third->x);
    188           x.Copyvector(&fourth->x);
    189           x.SubtractVector(&third->x);
    190 
    191           if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
    192          coutg() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
    193             continue;
    194           }
    195           DoLog(0) && (Log() << Verbose(0) << "resulting relative coordinates: ");
    196           z.Output();
    197           DoLog(0) && (Log() << Verbose(0) << endl);
    198           */
    199           // calc axis vector
    200           x.CopyVector(&second->x);
    201           x.SubtractVector(&third->x);
    202           x.Normalize();
    203           Log() << Verbose(0) << "x: ",
    204           x.Output();
    205           DoLog(0) && (Log() << Verbose(0) << endl);
    206           z.MakeNormalVector(&second->x,&third->x,&fourth->x);
    207           Log() << Verbose(0) << "z: ",
    208           z.Output();
    209           DoLog(0) && (Log() << Verbose(0) << endl);
    210           y.MakeNormalVector(&x,&z);
    211           Log() << Verbose(0) << "y: ",
    212           y.Output();
    213           DoLog(0) && (Log() << Verbose(0) << endl);
    214 
    215           // rotate vector around first angle
    216           first->x.CopyVector(&x);
    217           first->x.RotateVector(&z,b - M_PI);
    218           Log() << Verbose(0) << "Rotated vector: ",
    219           first->x.Output();
    220           DoLog(0) && (Log() << Verbose(0) << endl);
    221           // remove the projection onto the rotation plane of the second angle
    222           n.CopyVector(&y);
    223           n.Scale(first->x.ScalarProduct(&y));
    224           Log() << Verbose(0) << "N1: ",
    225           n.Output();
    226           DoLog(0) && (Log() << Verbose(0) << endl);
    227           first->x.SubtractVector(&n);
    228           Log() << Verbose(0) << "Subtracted vector: ",
    229           first->x.Output();
    230           DoLog(0) && (Log() << Verbose(0) << endl);
    231           n.CopyVector(&z);
    232           n.Scale(first->x.ScalarProduct(&z));
    233           Log() << Verbose(0) << "N2: ",
    234           n.Output();
    235           DoLog(0) && (Log() << Verbose(0) << endl);
    236           first->x.SubtractVector(&n);
    237           Log() << Verbose(0) << "2nd subtracted vector: ",
    238           first->x.Output();
    239           DoLog(0) && (Log() << Verbose(0) << endl);
    240 
    241           // rotate another vector around second angle
    242           n.CopyVector(&y);
    243           n.RotateVector(&x,c - M_PI);
    244           Log() << Verbose(0) << "2nd Rotated vector: ",
    245           n.Output();
    246           DoLog(0) && (Log() << Verbose(0) << endl);
    247 
    248           // add the two linear independent vectors
    249           first->x.AddVector(&n);
    250           first->x.Normalize();
    251           first->x.Scale(a);
    252           first->x.AddVector(&second->x);
    253 
    254           DoLog(0) && (Log() << Verbose(0) << "resulting coordinates: ");
    255           first->x.Output();
    256           DoLog(0) && (Log() << Verbose(0) << endl);
    257         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    258         first->type = periode->AskElement();  // give type
    259         mol->AddAtom(first);  // add to molecule
    260         break;
    261 
    262       case 'e': // least square distance position to a set of atoms
    263         first = new atom;
    264         atoms = new (Vector*[128]);
    265         valid = true;
    266         for(int i=128;i--;)
    267           atoms[i] = NULL;
    268         int i=0, j=0;
    269         cout << Verbose(0) << "Now we need at least three molecules.\n";
    270         do {
    271           cout << Verbose(0) << "Enter " << i+1 << "th atom: ";
    272           cin >> j;
    273           if (j != -1) {
    274             second = mol->FindAtom(j);
    275             atoms[i++] = &(second->x);
    276           }
    277         } while ((j != -1) && (i<128));
    278         if (i >= 2) {
    279           first->x.LSQdistance((const Vector **)atoms, i);
    280           first->x.Output();
    281           first->type = periode->AskElement();  // give type
    282           mol->AddAtom(first);  // add to molecule
    283         } else {
    284           delete first;
    285           cout << Verbose(0) << "Please enter at least two vectors!\n";
    286         }
    287         break;
    288   };
    289 };
    290 
    291 /** Submenu for centering the atoms in the molecule.
    292  * \param *mol molecule with all the atoms
    293  */
    294 static void CenterAtoms(molecule *mol)
    295 {
    296   Vector x, y, helper;
    297   char choice;  // menu choice char
    298 
    299   cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
    300   cout << Verbose(0) << " a - on origin" << endl;
    301   cout << Verbose(0) << " b - on center of gravity" << endl;
    302   cout << Verbose(0) << " c - within box with additional boundary" << endl;
    303   cout << Verbose(0) << " d - within given simulation box" << endl;
    304   cout << Verbose(0) << "all else - go back" << endl;
    305   cout << Verbose(0) << "===============================================" << endl;
    306   cout << Verbose(0) << "INPUT: ";
    307   cin >> choice;
    308 
    309   switch (choice) {
    310     default:
    311       cout << Verbose(0) << "Not a valid choice." << endl;
    312       break;
    313     case 'a':
    314       cout << Verbose(0) << "Centering atoms in config file on origin." << endl;
    315       mol->CenterOrigin();
    316       break;
    317     case 'b':
    318       cout << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
    319       mol->CenterPeriodic();
    320       break;
    321     case 'c':
    322       cout << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
    323       for (int i=0;i<NDIM;i++) {
    324         cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    325         cin >> y.x[i];
    326       }
    327       mol->CenterEdge(&x);  // make every coordinate positive
    328       mol->Center.AddVector(&y); // translate by boundary
    329       helper.CopyVector(&y);
    330       helper.Scale(2.);
    331       helper.AddVector(&x);
    332       mol->SetBoxDimension(&helper);  // update Box of atoms by boundary
    333       break;
    334     case 'd':
    335       cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
    336       for (int i=0;i<NDIM;i++) {
    337         cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    338         cin >> x.x[i];
    339       }
    340       // update Box of atoms by boundary
    341       mol->SetBoxDimension(&x);
    342       // center
    343       mol->CenterInBox();
    344       break;
    345   }
    346 };
    347 
    348 /** Submenu for aligning the atoms in the molecule.
    349  * \param *periode periodentafel
    350  * \param *mol molecule with all the atoms
    351  */
    352 static void AlignAtoms(periodentafel *periode, molecule *mol)
    353 {
    354   atom *first, *second, *third;
    355   Vector x,n;
    356   char choice;  // menu choice char
    357 
    358   cout << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
    359   cout << Verbose(0) << " a - state three atoms defining align plane" << endl;
    360   cout << Verbose(0) << " b - state alignment vector" << endl;
    361   cout << Verbose(0) << " c - state two atoms in alignment direction" << endl;
    362   cout << Verbose(0) << " d - align automatically by least square fit" << endl;
    363   cout << Verbose(0) << "all else - go back" << endl;
    364   cout << Verbose(0) << "===============================================" << endl;
    365   cout << Verbose(0) << "INPUT: ";
    366   cin >> choice;
    367 
    368   switch (choice) {
    369     default:
    370     case 'a': // three atoms defining mirror plane
    371       first = mol->AskAtom("Enter first atom: ");
    372       second = mol->AskAtom("Enter second atom: ");
    373       third = mol->AskAtom("Enter third atom: ");
    374 
    375       n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
    376       break;
    377     case 'b': // normal vector of mirror plane
    378       cout << Verbose(0) << "Enter normal vector of mirror plane." << endl;
    379       n.AskPosition(World::getInstance().getDomain(),0);
    380       n.Normalize();
    381       break;
    382     case 'c': // three atoms defining mirror plane
    383       first = mol->AskAtom("Enter first atom: ");
    384       second = mol->AskAtom("Enter second atom: ");
    385 
    386       n.CopyVector((const Vector *)&first->x);
    387       n.SubtractVector((const Vector *)&second->x);
    388       n.Normalize();
    389       break;
    390     case 'd':
    391       char shorthand[4];
    392       Vector a;
    393       struct lsq_params param;
    394       do {
    395         fprintf(stdout, "Enter the element of atoms to be chosen: ");
    396         fscanf(stdin, "%3s", shorthand);
    397       } while ((param.type = periode->FindElement(shorthand)) == NULL);
    398       cout << Verbose(0) << "Element is " << param.type->name << endl;
    399       mol->GetAlignvector(&param);
    400       for (int i=NDIM;i--;) {
    401         x.x[i] = gsl_vector_get(param.x,i);
    402         n.x[i] = gsl_vector_get(param.x,i+NDIM);
    403       }
    404       gsl_vector_free(param.x);
    405       cout << Verbose(0) << "Offset vector: ";
    406       x.Output();
    407       DoLog(0) && (Log() << Verbose(0) << endl);
    408       n.Normalize();
    409       break;
    410   };
    411   DoLog(0) && (Log() << Verbose(0) << "Alignment vector: ");
    412   n.Output();
    413   DoLog(0) && (Log() << Verbose(0) << endl);
    414   mol->Align(&n);
    415 };
    416 
    417 /** Submenu for mirroring the atoms in the molecule.
    418  * \param *mol molecule with all the atoms
    419  */
    420 static void MirrorAtoms(molecule *mol)
    421 {
    422   atom *first, *second, *third;
    423   Vector n;
    424   char choice;  // menu choice char
    425 
    426   DoLog(0) && (Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl);
    427   DoLog(0) && (Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl);
    428   DoLog(0) && (Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl);
    429   DoLog(0) && (Log() << Verbose(0) << " c - state two atoms in normal direction" << endl);
    430   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    431   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    432   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    433   cin >> choice;
    434 
    435   switch (choice) {
    436     default:
    437     case 'a': // three atoms defining mirror plane
    438       first = mol->AskAtom("Enter first atom: ");
    439       second = mol->AskAtom("Enter second atom: ");
    440       third = mol->AskAtom("Enter third atom: ");
    441 
    442       n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
    443       break;
    444     case 'b': // normal vector of mirror plane
    445       DoLog(0) && (Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl);
    446       n.AskPosition(World::getInstance().getDomain(),0);
    447       n.Normalize();
    448       break;
    449     case 'c': // three atoms defining mirror plane
    450       first = mol->AskAtom("Enter first atom: ");
    451       second = mol->AskAtom("Enter second atom: ");
    452 
    453       n.CopyVector((const Vector *)&first->x);
    454       n.SubtractVector((const Vector *)&second->x);
    455       n.Normalize();
    456       break;
    457   };
    458   DoLog(0) && (Log() << Verbose(0) << "Normal vector: ");
    459   n.Output();
    460   DoLog(0) && (Log() << Verbose(0) << endl);
    461   mol->Mirror((const Vector *)&n);
    462 };
    463 
    464 /** Submenu for removing the atoms from the molecule.
    465  * \param *mol molecule with all the atoms
    466  */
    467 static void RemoveAtoms(molecule *mol)
    468 {
    469   atom *first, *second;
    470   int axis;
    471   double tmp1, tmp2;
    472   char choice;  // menu choice char
    473 
    474   DoLog(0) && (Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl);
    475   DoLog(0) && (Log() << Verbose(0) << " a - state atom for removal by number" << endl);
    476   DoLog(0) && (Log() << Verbose(0) << " b - keep only in radius around atom" << endl);
    477   DoLog(0) && (Log() << Verbose(0) << " c - remove this with one axis greater value" << endl);
    478   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    479   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    480   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    481   cin >> choice;
    482 
    483   switch (choice) {
    484     default:
    485     case 'a':
    486       if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
    487         DoLog(1) && (Log() << Verbose(1) << "Atom removed." << endl);
    488       else
    489         DoLog(1) && (Log() << Verbose(1) << "Atom not found." << endl);
    490       break;
    491     case 'b':
    492       second = mol->AskAtom("Enter number of atom as reference point: ");
    493       DoLog(0) && (Log() << Verbose(0) << "Enter radius: ");
    494       cin >> tmp1;
    495       first = mol->start;
    496       second = first->next;
    497       while(second != mol->end) {
    498         first = second;
    499         second = first->next;
    500         if (first->x.DistanceSquared((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
    501           mol->RemoveAtom(first);
    502       }
    503       break;
    504     case 'c':
    505       DoLog(0) && (Log() << Verbose(0) << "Which axis is it: ");
    506       cin >> axis;
    507       DoLog(0) && (Log() << Verbose(0) << "Lower boundary: ");
    508       cin >> tmp1;
    509       DoLog(0) && (Log() << Verbose(0) << "Upper boundary: ");
    510       cin >> tmp2;
    511       first = mol->start;
    512       second = first->next;
    513       while(second != mol->end) {
    514         first = second;
    515         second = first->next;
    516         if ((first->x.x[axis] < tmp1) || (first->x.x[axis] > tmp2)) {// out of boundary ...
    517           //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    518           mol->RemoveAtom(first);
    519         }
    520       }
    521       break;
    522   };
    523   //mol->Output();
    524   choice = 'r';
    525 };
    526 
    527 /** Submenu for measuring out the atoms in the molecule.
    528  * \param *periode periodentafel
    529  * \param *mol molecule with all the atoms
    530  */
    531 static void MeasureAtoms(periodentafel *periode, molecule *mol, config *configuration)
    532 {
    533   atom *first, *second, *third;
    534   Vector x,y;
    535   double min[256], tmp1, tmp2, tmp3;
    536   int Z;
    537   char choice;  // menu choice char
    538 
    539   DoLog(0) && (Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl);
    540   DoLog(0) && (Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl);
    541   DoLog(0) && (Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl);
    542   DoLog(0) && (Log() << Verbose(0) << " c - calculate bond angle" << endl);
    543   DoLog(0) && (Log() << Verbose(0) << " d - calculate principal axis of the system" << endl);
    544   DoLog(0) && (Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl);
    545   DoLog(0) && (Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl);
    546   DoLog(0) && (Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl);
    547   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    548   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    549   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    550   cin >> choice;
    551 
    552   switch(choice) {
    553     default:
    554       DoLog(1) && (Log() << Verbose(1) << "Not a valid choice." << endl);
    555       break;
    556     case 'a':
    557       first = mol->AskAtom("Enter first atom: ");
    558       for (int i=MAX_ELEMENTS;i--;)
    559         min[i] = 0.;
    560 
    561       second = mol->start;
    562       while ((second->next != mol->end)) {
    563         second = second->next; // advance
    564         Z = second->type->Z;
    565         tmp1 = 0.;
    566         if (first != second) {
    567           x.CopyVector((const Vector *)&first->x);
    568           x.SubtractVector((const Vector *)&second->x);
    569           tmp1 = x.Norm();
    570         }
    571         if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
    572         //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;
    573       }
    574       for (int i=MAX_ELEMENTS;i--;)
    575         if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
    576       break;
    577 
    578     case 'b':
    579       first = mol->AskAtom("Enter first atom: ");
    580       second = mol->AskAtom("Enter second atom: ");
    581       for (int i=NDIM;i--;)
    582         min[i] = 0.;
    583       x.CopyVector((const Vector *)&first->x);
    584       x.SubtractVector((const Vector *)&second->x);
    585       tmp1 = x.Norm();
    586       DoLog(1) && (Log() << Verbose(1) << "Distance vector is ");
    587       x.Output();
    588       DoLog(0) && (Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl);
    589       break;
    590 
    591     case 'c':
    592       DoLog(0) && (Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl);
    593       first = mol->AskAtom("Enter first atom: ");
    594       second = mol->AskAtom("Enter central atom: ");
    595       third  = mol->AskAtom("Enter last atom: ");
    596       tmp1 = tmp2 = tmp3 = 0.;
    597       x.CopyVector((const Vector *)&first->x);
    598       x.SubtractVector((const Vector *)&second->x);
    599       y.CopyVector((const Vector *)&third->x);
    600       y.SubtractVector((const Vector *)&second->x);
    601       DoLog(0) && (Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ");
    602       DoLog(0) && (Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl);
    603       break;
    604     case 'd':
    605       DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl);
    606       DoLog(0) && (Log() << Verbose(0) << "Shall we rotate? [0/1]: ");
    607       cin >> Z;
    608       if ((Z >=0) && (Z <=1))
    609         mol->PrincipalAxisSystem((bool)Z);
    610       else
    611         mol->PrincipalAxisSystem(false);
    612       break;
    613     case 'e':
    614       {
    615         DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
    616         class Tesselation *TesselStruct = NULL;
    617         const LinkedCell *LCList = NULL;
    618         LCList = new LinkedCell(mol, 10.);
    619         FindConvexBorder(mol, TesselStruct, LCList, NULL);
    620         double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
    621         DoLog(0) && (Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl);\
    622         delete(LCList);
    623         delete(TesselStruct);
    624       }
    625       break;
    626     case 'f':
    627       mol->OutputTemperatureFromTrajectories((ofstream *)&cout, mol->MDSteps-1, mol->MDSteps);
    628       break;
    629     case 'g':
    630       {
    631         char filename[255];
    632         DoLog(0) && (Log() << Verbose(0) << "Please enter filename: " << endl);
    633         cin >> filename;
    634         DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);
    635         ofstream *output = new ofstream(filename, ios::trunc);
    636         if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
    637           DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl);
    638         else
    639           DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    640         output->close();
    641         delete(output);
    642       }
    643       break;
    644   }
    645 };
    646 
    647 /** Submenu for measuring out the atoms in the molecule.
    648  * \param *mol molecule with all the atoms
    649  * \param *configuration configuration structure for the to be written config files of all fragments
    650  */
    651 static void FragmentAtoms(molecule *mol, config *configuration)
    652 {
    653   int Order1;
    654   clock_t start, end;
    655 
    656   DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);
    657   DoLog(0) && (Log() << Verbose(0) << "What's the desired bond order: ");
    658   cin >> Order1;
    659   if (mol->first->next != mol->last) {  // there are bonds
    660     start = clock();
    661     mol->FragmentMolecule(Order1, configuration);
    662     end = clock();
    663     DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
    664   } else
    665     DoLog(0) && (Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl);
    666 };
    667 
    668 /********************************************** Submenu routine **************************************/
    669 
    670 /** Submenu for manipulating atoms.
    671  * \param *periode periodentafel
    672  * \param *molecules list of molecules whose atoms are to be manipulated
    673  */
    674 static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
    675 {
    676   atom *first, *second, *third;
    677   molecule *mol = NULL;
    678   Vector x,y,z,n; // coordinates for absolute point in cell volume
    679   double *factor; // unit factor if desired
    680   double bond, minBond;
    681   char choice;  // menu choice char
    682   bool valid;
    683 
    684   DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl);
    685   DoLog(0) && (Log() << Verbose(0) << "a - add an atom" << endl);
    686   DoLog(0) && (Log() << Verbose(0) << "r - remove an atom" << endl);
    687   DoLog(0) && (Log() << Verbose(0) << "b - scale a bond between atoms" << endl);
    688   DoLog(0) && (Log() << Verbose(0) << "t - turn an atom round another bond" << endl);
    689   DoLog(0) && (Log() << Verbose(0) << "u - change an atoms element" << endl);
    690   DoLog(0) && (Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl);
    691   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    692   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    693   if (molecules->NumberOfActiveMolecules() > 1)
    694     DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl);
    695   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    696   cin >> choice;
    697 
    698   switch (choice) {
    699     default:
    700       DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    701       break;
    702 
    703     case 'a': // add atom
    704       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    705         if ((*ListRunner)->ActiveFlag) {
    706         mol = *ListRunner;
    707         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    708         AddAtoms(periode, mol);
    709       }
    710       break;
    711 
    712     case 'b': // scale a bond
    713       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    714         if ((*ListRunner)->ActiveFlag) {
    715         mol = *ListRunner;
    716         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    717         DoLog(0) && (Log() << Verbose(0) << "Scaling bond length between two atoms." << endl);
    718         first = mol->AskAtom("Enter first (fixed) atom: ");
    719         second = mol->AskAtom("Enter second (shifting) atom: ");
    720         minBond = 0.;
    721         for (int i=NDIM;i--;)
    722           minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
    723         minBond = sqrt(minBond);
    724         DoLog(0) && (Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl);
    725         DoLog(0) && (Log() << Verbose(0) << "Enter new bond length [a.u.]: ");
    726         cin >> bond;
    727         for (int i=NDIM;i--;) {
    728           second->x.x[i] -= (second->x.x[i]-first->x.x[i])/minBond*(minBond-bond);
    729         }
    730         //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
    731         //second->Output(second->type->No, 1);
    732       }
    733       break;
    734 
    735     case 'c': // unit scaling of the metric
    736       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    737         if ((*ListRunner)->ActiveFlag) {
    738         mol = *ListRunner;
    739         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    740        DoLog(0) && (Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl);
    741        DoLog(0) && (Log() << Verbose(0) << "Enter three factors: ");
    742        factor = new double[NDIM];
    743        cin >> factor[0];
    744        cin >> factor[1];
    745        cin >> factor[2];
    746        valid = true;
    747        mol->Scale((const double ** const)&factor);
    748        delete[](factor);
    749       }
    750      break;
    751 
    752     case 'l': // measure distances or angles
    753       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    754         if ((*ListRunner)->ActiveFlag) {
    755         mol = *ListRunner;
    756         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    757         MeasureAtoms(periode, mol, configuration);
    758       }
    759       break;
    760 
    761     case 'r': // remove atom
    762       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    763         if ((*ListRunner)->ActiveFlag) {
    764         mol = *ListRunner;
    765         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    766         RemoveAtoms(mol);
    767       }
    768       break;
    769 
    770     case 't': // turn/rotate atom
    771       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    772         if ((*ListRunner)->ActiveFlag) {
    773           mol = *ListRunner;
    774           DoLog(0) && (Log() << Verbose(0) << "Turning atom around another bond - first is atom to turn, second (central) and third specify bond" << endl);
    775           first = mol->AskAtom("Enter turning atom: ");
    776           second = mol->AskAtom("Enter central atom: ");
    777           third  = mol->AskAtom("Enter bond atom: ");
    778           cout << Verbose(0) << "Enter new angle in degrees: ";
    779           double tmp = 0.;
    780           cin >> tmp;
    781           // calculate old angle
    782           x.CopyVector((const Vector *)&first->x);
    783           x.SubtractVector((const Vector *)&second->x);
    784           y.CopyVector((const Vector *)&third->x);
    785           y.SubtractVector((const Vector *)&second->x);
    786           double alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);
    787           cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    788           cout << Verbose(0) << alpha << " degrees" << endl;
    789           // rotate
    790           z.MakeNormalVector(&x,&y);
    791           x.RotateVector(&z,(alpha-tmp)*M_PI/180.);
    792           x.AddVector(&second->x);
    793           first->x.CopyVector(&x);
    794           // check new angle
    795           x.CopyVector((const Vector *)&first->x);
    796           x.SubtractVector((const Vector *)&second->x);
    797           alpha = (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.);
    798           cout << Verbose(0) << "new Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    799           cout << Verbose(0) << alpha << " degrees" << endl;
    800         }
    801       break;
    802 
    803     case 'u': // change an atom's element
    804       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    805         if ((*ListRunner)->ActiveFlag) {
    806         int Z;
    807         mol = *ListRunner;
    808         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    809         first = NULL;
    810         do {
    811           DoLog(0) && (Log() << Verbose(0) << "Change the element of which atom: ");
    812           cin >> Z;
    813         } while ((first = mol->FindAtom(Z)) == NULL);
    814         DoLog(0) && (Log() << Verbose(0) << "New element by atomic number Z: ");
    815         cin >> Z;
    816         first->type = periode->FindElement(Z);
    817         DoLog(0) && (Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl);
    818       }
    819       break;
    820   }
    821 };
    822 
    823 /** Submenu for manipulating molecules.
    824  * \param *periode periodentafel
    825  * \param *molecules list of molecule to manipulate
    826  */
    827 static void ManipulateMolecules(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
    828 {
    829   atom *first = NULL;
    830   Vector x,y,z,n; // coordinates for absolute point in cell volume
    831   int j, axis, count, faktor;
    832   char choice;  // menu choice char
    833   molecule *mol = NULL;
    834   element **Elements;
    835   Vector **vectors;
    836   MoleculeLeafClass *Subgraphs = NULL;
    837 
    838   DoLog(0) && (Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl);
    839   DoLog(0) && (Log() << Verbose(0) << "c - scale by unit transformation" << endl);
    840   DoLog(0) && (Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl);
    841   DoLog(0) && (Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl);
    842   DoLog(0) && (Log() << Verbose(0) << "g - center atoms in box" << endl);
    843   DoLog(0) && (Log() << Verbose(0) << "i - realign molecule" << endl);
    844   DoLog(0) && (Log() << Verbose(0) << "m - mirror all molecules" << endl);
    845   DoLog(0) && (Log() << Verbose(0) << "o - create connection matrix" << endl);
    846   DoLog(0) && (Log() << Verbose(0) << "t - translate molecule by vector" << endl);
    847   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    848   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    849   if (molecules->NumberOfActiveMolecules() > 1)
    850     DoeLog(2) && (eLog()<< Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl);
    851   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    852   cin >> choice;
    853 
    854   switch (choice) {
    855     default:
    856       DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    857       break;
    858 
    859     case 'd': // duplicate the periodic cell along a given axis, given times
    860       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    861         if ((*ListRunner)->ActiveFlag) {
    862         mol = *ListRunner;
    863         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    864         DoLog(0) && (Log() << Verbose(0) << "State the axis [(+-)123]: ");
    865         cin >> axis;
    866         DoLog(0) && (Log() << Verbose(0) << "State the factor: ");
    867         cin >> faktor;
    868 
    869         mol->CountAtoms(); // recount atoms
    870         if (mol->getAtomCount() != 0) {  // if there is more than none
    871           count = mol->getAtomCount();  // is changed becausing of adding, thus has to be stored away beforehand
    872           Elements = new element *[count];
    873           vectors = new Vector *[count];
    874           j = 0;
    875           first = mol->start;
    876           while (first->next != mol->end) { // make a list of all atoms with coordinates and element
    877             first = first->next;
    878             Elements[j] = first->type;
    879             vectors[j] = &first->x;
    880             j++;
    881           }
    882           if (count != j)
    883             DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    884           x.Zero();
    885           y.Zero();
    886           y.x[abs(axis)-1] = World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
    887           for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    888             x.AddVector(&y); // per factor one cell width further
    889             for (int k=count;k--;) { // go through every atom of the original cell
    890               first = new atom(); // create a new body
    891               first->x.CopyVector(vectors[k]);  // use coordinate of original atom
    892               first->x.AddVector(&x);     // translate the coordinates
    893               first->type = Elements[k];  // insert original element
    894               mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
    895             }
    896           }
    897           if (mol->first->next != mol->last) // if connect matrix is present already, redo it
    898             mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    899           // free memory
    900           delete[](Elements);
    901           delete[](vectors);
    902           // correct cell size
    903           if (axis < 0) { // if sign was negative, we have to translate everything
    904             x.Zero();
    905             x.AddVector(&y);
    906             x.Scale(-(faktor-1));
    907             mol->Translate(&x);
    908           }
    909           World::getInstance().getDomain()[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    910         }
    911       }
    912       break;
    913 
    914     case 'f':
    915       FragmentAtoms(mol, configuration);
    916       break;
    917 
    918     case 'g': // center the atoms
    919       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    920         if ((*ListRunner)->ActiveFlag) {
    921         mol = *ListRunner;
    922         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    923         CenterAtoms(mol);
    924       }
    925       break;
    926 
    927     case 'i': // align all atoms
    928       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    929         if ((*ListRunner)->ActiveFlag) {
    930         mol = *ListRunner;
    931         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    932         AlignAtoms(periode, mol);
    933       }
    934       break;
    935 
    936     case 'm': // mirror atoms along a given axis
    937       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    938         if ((*ListRunner)->ActiveFlag) {
    939         mol = *ListRunner;
    940         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    941         MirrorAtoms(mol);
    942       }
    943       break;
    944 
    945     case 'o': // create the connection matrix
    946       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    947         if ((*ListRunner)->ActiveFlag) {
    948           mol = *ListRunner;
    949           double bonddistance;
    950           clock_t start,end;
    951           DoLog(0) && (Log() << Verbose(0) << "What's the maximum bond distance: ");
    952           cin >> bonddistance;
    953           start = clock();
    954           mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
    955           end = clock();
    956           DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);
    957         }
    958       break;
    959 
    960     case 't': // translate all atoms
    961       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    962         if ((*ListRunner)->ActiveFlag) {
    963         mol = *ListRunner;
    964         DoLog(0) && (Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl);
    965         DoLog(0) && (Log() << Verbose(0) << "Enter translation vector." << endl);
    966         x.AskPosition(World::getInstance().getDomain(),0);
    967         mol->Center.AddVector((const Vector *)&x);
    968      }
    969      break;
    970   }
    971   // Free all
    972   if (Subgraphs != NULL) {  // free disconnected subgraph list of DFS analysis was performed
    973     while (Subgraphs->next != NULL) {
    974       Subgraphs = Subgraphs->next;
    975       delete(Subgraphs->previous);
    976     }
    977     delete(Subgraphs);
    978   }
    979 };
    980 
    981 
    982 /** Submenu for creating new molecules.
    983  * \param *periode periodentafel
    984  * \param *molecules list of molecules to add to
    985  */
    986 static void EditMolecules(periodentafel *periode, MoleculeListClass *molecules)
    987 {
    988   char choice;  // menu choice char
    989   Vector center;
    990   int nr, count;
    991   molecule *mol = NULL;
    992 
    993   DoLog(0) && (Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl);
    994   DoLog(0) && (Log() << Verbose(0) << "c - create new molecule" << endl);
    995   DoLog(0) && (Log() << Verbose(0) << "l - load molecule from xyz file" << endl);
    996   DoLog(0) && (Log() << Verbose(0) << "n - change molecule's name" << endl);
    997   DoLog(0) && (Log() << Verbose(0) << "N - give molecules filename" << endl);
    998   DoLog(0) && (Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl);
    999   DoLog(0) && (Log() << Verbose(0) << "r - remove a molecule" << endl);
    1000   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    1001   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    1002   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    1003   cin >> choice;
    1004 
    1005   switch (choice) {
    1006     default:
    1007       DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    1008       break;
    1009     case 'c':
    1010       mol = World::getInstance().createMolecule();
    1011       molecules->insert(mol);
    1012       break;
    1013 
    1014     case 'l': // load from XYZ file
    1015       {
    1016         char filename[MAXSTRINGSIZE];
    1017         DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl);
    1018         mol = World::getInstance().createMolecule();
    1019         do {
    1020           DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    1021           cin >> filename;
    1022         } while (!mol->AddXYZFile(filename));
    1023         mol->SetNameFromFilename(filename);
    1024         // center at set box dimensions
    1025         mol->CenterEdge(&center);
    1026         double * const cell_size = World::getInstance().getDomain();
    1027         cell_size[0] = center.x[0];
    1028         cell_size[1] = 0;
    1029         cell_size[2] = center.x[1];
    1030         cell_size[3] = 0;
    1031         cell_size[4] = 0;
    1032         cell_size[5] = center.x[2];
    1033         molecules->insert(mol);
    1034       }
    1035       break;
    1036 
    1037     case 'n':
    1038       {
    1039         char filename[MAXSTRINGSIZE];
    1040         do {
    1041           DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    1042           cin >> nr;
    1043           mol = molecules->ReturnIndex(nr);
    1044         } while (mol == NULL);
    1045         DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    1046         cin >> filename;
    1047         strcpy(mol->name, filename);
    1048       }
    1049       break;
    1050 
    1051     case 'N':
    1052       {
    1053         char filename[MAXSTRINGSIZE];
    1054         do {
    1055           DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    1056           cin >> nr;
    1057           mol = molecules->ReturnIndex(nr);
    1058         } while (mol == NULL);
    1059         DoLog(0) && (Log() << Verbose(0) << "Enter name: ");
    1060         cin >> filename;
    1061         mol->SetNameFromFilename(filename);
    1062       }
    1063       break;
    1064 
    1065     case 'p': // parse XYZ file
    1066       {
    1067         char filename[MAXSTRINGSIZE];
    1068         mol = NULL;
    1069         do {
    1070           DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    1071           cin >> nr;
    1072           mol = molecules->ReturnIndex(nr);
    1073         } while (mol == NULL);
    1074         DoLog(0) && (Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl);
    1075         do {
    1076           DoLog(0) && (Log() << Verbose(0) << "Enter file name: ");
    1077           cin >> filename;
    1078         } while (!mol->AddXYZFile(filename));
    1079         mol->SetNameFromFilename(filename);
    1080       }
    1081       break;
    1082 
    1083     case 'r':
    1084       DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule: ");
    1085       cin >> nr;
    1086       count = 1;
    1087       for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    1088         if (nr == (*ListRunner)->IndexNr) {
    1089           mol = *ListRunner;
    1090           molecules->ListOfMolecules.erase(ListRunner);
    1091           delete(mol);
    1092           break;
    1093         }
    1094       break;
    1095   }
    1096 };
    1097 
    1098 
    1099 /** Submenu for merging molecules.
    1100  * \param *periode periodentafel
    1101  * \param *molecules list of molecules to add to
    1102  */
    1103 static void MergeMolecules(periodentafel *periode, MoleculeListClass *molecules)
    1104 {
    1105   char choice;  // menu choice char
    1106 
    1107   DoLog(0) && (Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl);
    1108   DoLog(0) && (Log() << Verbose(0) << "a - simple add of one molecule to another" << endl);
    1109   DoLog(0) && (Log() << Verbose(0) << "b - count the number of bonds of two elements" << endl);
    1110   DoLog(0) && (Log() << Verbose(0) << "B - count the number of bonds of three elements " << endl);
    1111   DoLog(0) && (Log() << Verbose(0) << "e - embedding merge of two molecules" << endl);
    1112   DoLog(0) && (Log() << Verbose(0) << "h - count the number of hydrogen bonds" << endl);
    1113   DoLog(0) && (Log() << Verbose(0) << "b - count the number of hydrogen bonds" << endl);
    1114   DoLog(0) && (Log() << Verbose(0) << "m - multi-merge of all molecules" << endl);
    1115   DoLog(0) && (Log() << Verbose(0) << "s - scatter merge of two molecules" << endl);
    1116   DoLog(0) && (Log() << Verbose(0) << "t - simple merge of two molecules" << endl);
    1117   DoLog(0) && (Log() << Verbose(0) << "all else - go back" << endl);
    1118   DoLog(0) && (Log() << Verbose(0) << "===============================================" << endl);
    1119   DoLog(0) && (Log() << Verbose(0) << "INPUT: ");
    1120   cin >> choice;
    1121 
    1122   switch (choice) {
    1123     default:
    1124       DoLog(0) && (Log() << Verbose(0) << "Not a valid choice." << endl);
    1125       break;
    1126 
    1127     case 'a':
    1128       {
    1129         int src, dest;
    1130         molecule *srcmol = NULL, *destmol = NULL;
    1131         {
    1132           do {
    1133             DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    1134             cin >> dest;
    1135             destmol = molecules->ReturnIndex(dest);
    1136           } while ((destmol == NULL) && (dest != -1));
    1137           do {
    1138             DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to add from: ");
    1139             cin >> src;
    1140             srcmol = molecules->ReturnIndex(src);
    1141           } while ((srcmol == NULL) && (src != -1));
    1142           if ((src != -1) && (dest != -1))
    1143             molecules->SimpleAdd(srcmol, destmol);
    1144         }
    1145       }
    1146       break;
    1147 
    1148     case 'b':
    1149       {
    1150         const int nr = 2;
    1151         char *names[nr] = {"first", "second"};
    1152         int Z[nr];
    1153         element *elements[nr];
    1154         for (int i=0;i<nr;i++) {
    1155           Z[i] = 0;
    1156           do {
    1157             cout << "Enter " << names[i] << " element: ";
    1158             cin >> Z[i];
    1159           } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS));
    1160           elements[i] = periode->FindElement(Z[i]);
    1161         }
    1162         const int count = CountBondsOfTwo(molecules, elements[0], elements[1]);
    1163         cout << endl << "There are " << count << " ";
    1164         for (int i=0;i<nr;i++) {
    1165           if (i==0)
    1166             cout << elements[i]->symbol;
    1167           else
    1168             cout << "-" << elements[i]->symbol;
    1169         }
    1170         cout << " bonds." << endl;
    1171       }
    1172     break;
    1173 
    1174     case 'B':
    1175       {
    1176         const int nr = 3;
    1177         char *names[nr] = {"first", "second", "third"};
    1178         int Z[nr];
    1179         element *elements[nr];
    1180         for (int i=0;i<nr;i++) {
    1181           Z[i] = 0;
    1182           do {
    1183             cout << "Enter " << names[i] << " element: ";
    1184             cin >> Z[i];
    1185           } while ((Z[i] <= 0) && (Z[i] > MAX_ELEMENTS));
    1186           elements[i] = periode->FindElement(Z[i]);
    1187         }
    1188         const int count = CountBondsOfThree(molecules, elements[0], elements[1], elements[2]);
    1189         cout << endl << "There are " << count << " ";
    1190         for (int i=0;i<nr;i++) {
    1191           if (i==0)
    1192             cout << elements[i]->symbol;
    1193           else
    1194             cout << "-" << elements[i]->symbol;
    1195         }
    1196         cout << " bonds." << endl;
    1197       }
    1198     break;
    1199 
    1200     case 'e':
    1201       {
    1202         int src, dest;
    1203         molecule *srcmol = NULL, *destmol = NULL;
    1204         do {
    1205           DoLog(0) && (Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ");
    1206           cin >> src;
    1207           srcmol = molecules->ReturnIndex(src);
    1208         } while ((srcmol == NULL) && (src != -1));
    1209         do {
    1210           DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ");
    1211           cin >> dest;
    1212           destmol = molecules->ReturnIndex(dest);
    1213         } while ((destmol == NULL) && (dest != -1));
    1214         if ((src != -1) && (dest != -1))
    1215           molecules->EmbedMerge(destmol, srcmol);
    1216       }
    1217       break;
    1218 
    1219     case 'h':
    1220       {
    1221         int Z;
    1222         cout << "Please enter interface element: ";
    1223         cin >> Z;
    1224         element * const InterfaceElement = periode->FindElement(Z);
    1225         cout << endl << "There are " << CountHydrogenBridgeBonds(molecules, InterfaceElement) << " hydrogen bridges with connections to " << (InterfaceElement != 0 ? InterfaceElement->name : "None") << "." << endl;
    1226       }
    1227       break;
    1228 
    1229     case 'm':
    1230       {
    1231         int nr;
    1232         molecule *mol = NULL;
    1233         do {
    1234           DoLog(0) && (Log() << Verbose(0) << "Enter index of molecule to merge into: ");
    1235           cin >> nr;
    1236           mol = molecules->ReturnIndex(nr);
    1237         } while ((mol == NULL) && (nr != -1));
    1238         if (nr != -1) {
    1239           int N = molecules->ListOfMolecules.size()-1;
    1240           int *src = new int(N);
    1241           for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    1242             if ((*ListRunner)->IndexNr != nr)
    1243               src[N++] = (*ListRunner)->IndexNr;       
    1244           molecules->SimpleMultiMerge(mol, src, N);
    1245           delete[](src);
    1246         }
    1247       }
    1248       break;
    1249 
    1250     case 's':
    1251       DoLog(0) && (Log() << Verbose(0) << "Not implemented yet." << endl);
    1252       break;
    1253 
    1254     case 't':
    1255       {
    1256         int src, dest;
    1257         molecule *srcmol = NULL, *destmol = NULL;
    1258         {
    1259           do {
    1260             DoLog(0) && (Log() << Verbose(0) << "Enter index of destination molecule: ");
    1261             cin >> dest;
    1262             destmol = molecules->ReturnIndex(dest);
    1263           } while ((destmol == NULL) && (dest != -1));
    1264           do {
    1265             DoLog(0) && (Log() << Verbose(0) << "Enter index of source molecule to merge into: ");
    1266             cin >> src;
    1267             srcmol = molecules->ReturnIndex(src);
    1268           } while ((srcmol == NULL) && (src != -1));
    1269           if ((src != -1) && (dest != -1))
    1270             molecules->SimpleMerge(srcmol, destmol);
    1271         }
    1272       }
    1273       break;
    1274   }
    1275 };
    1276 
    1277 /********************************************** Test routine **************************************/
    1278 
    1279 /** Is called always as option 'T' in the menu.
    1280  * \param *molecules list of molecules
    1281  */
    1282 static void testroutine(MoleculeListClass *molecules)
    1283 {
    1284   // the current test routine checks the functionality of the KeySet&Graph concept:
    1285   // We want to have a multiindex (the KeySet) describing a unique subgraph
    1286   int i, comp, counter=0;
    1287 
    1288   // create a clone
    1289   molecule *mol = NULL;
    1290   if (molecules->ListOfMolecules.size() != 0) // clone
    1291     mol = (molecules->ListOfMolecules.front())->CopyMolecule();
    1292   else {
    1293     DoeLog(0) && (eLog()<< Verbose(0) << "I don't have anything to test on ... ");
    1294     performCriticalExit();
    1295     return;
    1296   }
    1297   atom *Walker = mol->start;
    1298 
    1299   // generate some KeySets
    1300   DoLog(0) && (Log() << Verbose(0) << "Generating KeySets." << endl);
    1301   KeySet TestSets[mol->getAtomCount()+1];
    1302   i=1;
    1303   while (Walker->next != mol->end) {
    1304     Walker = Walker->next;
    1305     for (int j=0;j<i;j++) {
    1306       TestSets[j].insert(Walker->nr);
    1307     }
    1308     i++;
    1309   }
    1310   DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl);
    1311   KeySetTestPair test;
    1312   test = TestSets[mol->getAtomCount()-1].insert(Walker->nr);
    1313   if (test.second) {
    1314     DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    1315   } else {
    1316     DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl);
    1317   }
    1318   TestSets[mol->getAtomCount()].insert(mol->end->previous->nr);
    1319   TestSets[mol->getAtomCount()].insert(mol->end->previous->previous->previous->nr);
    1320 
    1321   // constructing Graph structure
    1322   DoLog(0) && (Log() << Verbose(0) << "Generating Subgraph class." << endl);
    1323   Graph Subgraphs;
    1324 
    1325   // insert KeySets into Subgraphs
    1326   DoLog(0) && (Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl);
    1327   for (int j=0;j<mol->getAtomCount();j++) {
    1328     Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
    1329   }
    1330   DoLog(0) && (Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl);
    1331   GraphTestPair test2;
    1332   test2 = Subgraphs.insert(GraphPair (TestSets[mol->getAtomCount()],pair<int, double>(counter++, 1.)));
    1333   if (test2.second) {
    1334     DoLog(1) && (Log() << Verbose(1) << "Insertion worked?!" << endl);
    1335   } else {
    1336     DoLog(1) && (Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl);
    1337   }
    1338 
    1339   // show graphs
    1340   DoLog(0) && (Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl);
    1341   Graph::iterator A = Subgraphs.begin();
    1342   while (A !=  Subgraphs.end()) {
    1343     DoLog(0) && (Log() << Verbose(0) << (*A).second.first << ": ");
    1344     KeySet::iterator key = (*A).first.begin();
    1345     comp = -1;
    1346     while (key != (*A).first.end()) {
    1347       if ((*key) > comp)
    1348         DoLog(0) && (Log() << Verbose(0) << (*key) << " ");
    1349       else
    1350         DoLog(0) && (Log() << Verbose(0) << (*key) << "! ");
    1351       comp = (*key);
    1352       key++;
    1353     }
    1354     DoLog(0) && (Log() << Verbose(0) << endl);
    1355     A++;
    1356   }
    1357   delete(mol);
    1358 };
    1359 
    1360 
    1361 /** Tries given filename or standard on saving the config file.
    1362  * \param *ConfigFileName name of file
    1363  * \param *configuration pointer to configuration structure with all the values
    1364  * \param *periode pointer to periodentafel structure with all the elements
    1365  * \param *molecules list of molecules structure with all the atoms and coordinates
    1366  */
    1367 static void SaveConfig(char *ConfigFileName, config *configuration, periodentafel *periode, MoleculeListClass *molecules)
    1368 {
    1369   char filename[MAXSTRINGSIZE];
    1370   ofstream output;
    1371   molecule *mol = World::getInstance().createMolecule();
    1372   mol->SetNameFromFilename(ConfigFileName);
    1373 
    1374   if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1375     DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
    1376   }
    1377 
    1378 
    1379   // first save as PDB data
    1380   if (ConfigFileName != NULL)
    1381     strcpy(filename, ConfigFileName);
    1382   if (output == NULL)
    1383     strcpy(filename,"main_pcp_linux");
    1384   DoLog(0) && (Log() << Verbose(0) << "Saving as pdb input ");
    1385   if (configuration->SavePDB(filename, molecules))
    1386     DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    1387   else
    1388     DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    1389 
    1390   // then save as tremolo data file
    1391   if (ConfigFileName != NULL)
    1392     strcpy(filename, ConfigFileName);
    1393   if (output == NULL)
    1394     strcpy(filename,"main_pcp_linux");
    1395   DoLog(0) && (Log() << Verbose(0) << "Saving as tremolo data input ");
    1396   if (configuration->SaveTREMOLO(filename, molecules))
    1397     DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    1398   else
    1399     DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    1400 
    1401   // translate each to its center and merge all molecules in MoleculeListClass into this molecule
    1402   int N = molecules->ListOfMolecules.size();
    1403   int *src = new int[N];
    1404   N=0;
    1405   for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
    1406     src[N++] = (*ListRunner)->IndexNr;
    1407     (*ListRunner)->Translate(&(*ListRunner)->Center);
    1408   }
    1409   molecules->SimpleMultiAdd(mol, src, N);
    1410   delete[](src);
    1411 
    1412   // ... and translate back
    1413   for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
    1414     (*ListRunner)->Center.Scale(-1.);
    1415     (*ListRunner)->Translate(&(*ListRunner)->Center);
    1416     (*ListRunner)->Center.Scale(-1.);
    1417   }
    1418 
    1419   DoLog(0) && (Log() << Verbose(0) << "Storing configuration ... " << endl);
    1420   // get correct valence orbitals
    1421   mol->CalculateOrbitals(*configuration);
    1422   configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble;
    1423   if (ConfigFileName != NULL) { // test the file name
    1424     strcpy(filename, ConfigFileName);
    1425     output.open(filename, ios::trunc);
    1426   } else if (strlen(configuration->configname) != 0) {
    1427     strcpy(filename, configuration->configname);
    1428     output.open(configuration->configname, ios::trunc);
    1429     } else {
    1430       strcpy(filename, DEFAULTCONFIG);
    1431       output.open(DEFAULTCONFIG, ios::trunc);
    1432     }
    1433   output.close();
    1434   output.clear();
    1435   DoLog(0) && (Log() << Verbose(0) << "Saving of config file ");
    1436   if (configuration->Save(filename, periode, mol))
    1437     DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    1438   else
    1439     DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    1440 
    1441   // and save to xyz file
    1442   if (ConfigFileName != NULL) {
    1443     strcpy(filename, ConfigFileName);
    1444     strcat(filename, ".xyz");
    1445     output.open(filename, ios::trunc);
    1446   }
    1447   if (output == NULL) {
    1448     strcpy(filename,"main_pcp_linux");
    1449     strcat(filename, ".xyz");
    1450     output.open(filename, ios::trunc);
    1451   }
    1452   DoLog(0) && (Log() << Verbose(0) << "Saving of XYZ file ");
    1453   if (mol->MDSteps <= 1) {
    1454     if (mol->OutputXYZ(&output))
    1455       DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    1456     else
    1457       DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    1458   } else {
    1459     if (mol->OutputTrajectoriesXYZ(&output))
    1460       DoLog(0) && (Log() << Verbose(0) << "successful." << endl);
    1461     else
    1462       DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    1463   }
    1464   output.close();
    1465   output.clear();
    1466 
    1467   // and save as MPQC configuration
    1468   if (ConfigFileName != NULL)
    1469     strcpy(filename, ConfigFileName);
    1470   if (output == NULL)
    1471     strcpy(filename,"main_pcp_linux");
    1472   DoLog(0) && (Log() << Verbose(0) << "Saving as mpqc input ");
    1473   if (configuration->SaveMPQC(filename, mol))
    1474     DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    1475   else
    1476     DoLog(0) && (Log() << Verbose(0) << "failed." << endl);
    1477 
    1478   if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1479     DoeLog(2) && (eLog()<< Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl);
    1480   }
    1481 
    1482   World::getInstance().destroyMolecule(mol);
    1483 };
    1484 
    1485 #endif
    1486 
    1487 /** Parses the command line options.
    1488  * Note that this function is from now on transitional. All commands that are not passed
    1489  * here are handled by CommandLineParser and the actions of CommandLineUIFactory.
    1490  * \param argc argument count
    1491  * \param **argv arguments array
    1492  * \param *molecules list of molecules structure
    1493  * \param *periode elements structure
    1494  * \param configuration config file structure
    1495  * \param *ConfigFileName pointer to config file name in **argv
    1496  * \param *PathToDatabases pointer to db's path in **argv
    1497  * \param &ArgcList list of arguments that we do not parse here
    1498  * \return exit code (0 - successful, all else - something's wrong)
    1499  */
    1500 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,
    1501                                    config& configuration, char **ConfigFileName, set<int> &ArgcList)
    1502 {
    1503   Vector x,y,z,n;  // coordinates for absolute point in cell volume
    1504   ifstream test;
    1505   ofstream output;
    1506   string line;
    1507   bool SaveFlag = false;
    1508   int ExitFlag = 0;
    1509   int j;
    1510   double volume = 0.;
    1511   enum ConfigStatus configPresent = absent;
    1512   int argptr;
    1513   molecule *mol = NULL;
    1514   string BondGraphFileName("\n");
    1515 
    1516   if (argc > 1) { // config file specified as option
    1517     // 1. : Parse options that just set variables or print help
    1518     argptr = 1;
    1519     do {
    1520       if (argv[argptr][0] == '-') {
    1521         DoLog(0) && (Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n");
    1522         argptr++;
    1523         switch(argv[argptr-1][1]) {
    1524           case 'h':
    1525           case 'H':
    1526           case '?':
    1527             ArgcList.insert(argptr-1);
    1528             return(1);
    1529             break;
    1530           case 'v':
    1531             if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1532               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying verbosity: -v <level>" << endl);
    1533               performCriticalExit();
    1534             } else {
    1535               setVerbosity(atoi(argv[argptr]));
    1536               ArgcList.insert(argptr-1);
    1537               ArgcList.insert(argptr);
    1538               argptr++;
    1539             }
    1540             break;
    1541           case 'V':
    1542             ArgcList.insert(argptr-1);
    1543             return(1);
    1544             break;
    1545           case 'B':
    1546             if (ExitFlag == 0) ExitFlag = 1;
    1547             if ((argptr+5 >= argc)) {
    1548               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for setting Box: -B <xx> <<xy> <<xz> <yy> <yz> <zz>" << endl);
    1549               performCriticalExit();
    1550             } else {
    1551               ArgcList.insert(argptr-1);
    1552               ArgcList.insert(argptr);
    1553               ArgcList.insert(argptr+1);
    1554               ArgcList.insert(argptr+2);
    1555               ArgcList.insert(argptr+3);
    1556               ArgcList.insert(argptr+4);
    1557               ArgcList.insert(argptr+5);
    1558               argptr+=6;
    1559             }
    1560             break;
    1561           case 'e':
    1562             if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1563               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl);
    1564               performCriticalExit();
    1565             } else {
    1566               ArgcList.insert(argptr-1);
    1567               ArgcList.insert(argptr);
    1568               argptr+=1;
    1569             }
    1570             break;
    1571           case 'g':
    1572             if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1573               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl);
    1574               performCriticalExit();
    1575             } else {
    1576               ArgcList.insert(argptr-1);
    1577               ArgcList.insert(argptr);
    1578               argptr+=1;
    1579             }
    1580             break;
    1581           case 'M':
    1582             if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1583               ExitFlag = 255;
    1584               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -M <basis name>" << endl);
    1585               performCriticalExit();
    1586             } else {
    1587               ArgcList.insert(argptr-1);
    1588               ArgcList.insert(argptr);
    1589               argptr+=1;
    1590             }
    1591             break;
    1592           case 'n':
    1593             if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1594               ExitFlag = 255;
    1595               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting fast-parsing: -n <0/1>" << endl);
    1596               performCriticalExit();
    1597             } else {
    1598               ArgcList.insert(argptr-1);
    1599               ArgcList.insert(argptr);
    1600               argptr+=1;
    1601             }
    1602             break;
    1603           case 'X':
    1604             if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1605               ExitFlag = 255;
    1606               DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for setting default molecule name: -X <name>" << endl);
    1607               performCriticalExit();
    1608             } else {
    1609               ArgcList.insert(argptr-1);
    1610               ArgcList.insert(argptr);
    1611               argptr+=1;
    1612             }
    1613             break;
    1614           default:   // no match? Step on
    1615             argptr++;
    1616             break;
    1617         }
    1618       } else
    1619         argptr++;
    1620     } while (argptr < argc);
    1621 
    1622     // 3b. Find config file name and parse if possible, also BondGraphFileName
    1623     if (argv[1][0] != '-') {
    1624       // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
    1625       DoLog(0) && (Log() << Verbose(0) << "Config file given." << endl);
    1626       test.open(argv[1], ios::in);
    1627       if (test == NULL) {
    1628         //return (1);
    1629         output.open(argv[1], ios::out);
    1630         if (output == NULL) {
    1631           DoLog(1) && (Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl);
    1632           configPresent = absent;
    1633         } else {
    1634           DoLog(0) && (Log() << Verbose(0) << "Empty configuration file." << endl);
    1635           strcpy(*ConfigFileName, argv[1]);
    1636           configPresent = empty;
    1637           output.close();
    1638         }
    1639       } else {
    1640         test.close();
    1641         strcpy(*ConfigFileName, argv[1]);
    1642         DoLog(1) && (Log() << Verbose(1) << "Specified config file found, parsing ... ");
    1643         switch (configuration.TestSyntax(*ConfigFileName, periode)) {
    1644           case 1:
    1645             DoLog(0) && (Log() << Verbose(0) << "new syntax." << endl);
    1646             configuration.Load(*ConfigFileName, BondGraphFileName, periode, molecules);
    1647             configPresent = present;
    1648             break;
    1649           case 0:
    1650             DoLog(0) && (Log() << Verbose(0) << "old syntax." << endl);
    1651             configuration.LoadOld(*ConfigFileName, BondGraphFileName, periode, molecules);
    1652             configPresent = present;
    1653             break;
    1654           default:
    1655             DoLog(0) && (Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl);
    1656             configPresent = empty;
    1657        }
    1658       }
    1659     } else
    1660       configPresent = absent;
    1661      // set mol to first active molecule
    1662      if (molecules->ListOfMolecules.size() != 0) {
    1663        for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
    1664          if ((*ListRunner)->ActiveFlag) {
    1665            mol = *ListRunner;
    1666            break;
    1667          }
    1668      }
    1669      if (mol == NULL) {
    1670        mol = World::getInstance().createMolecule();
    1671        mol->ActiveFlag = true;
    1672        if (*ConfigFileName != NULL)
    1673          mol->SetNameFromFilename(*ConfigFileName);
    1674        molecules->insert(mol);
    1675      }
    1676 
    1677     // 4. parse again through options, now for those depending on elements db and config presence
    1678     argptr = 1;
    1679     do {
    1680       DoLog(0) && (Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl);
    1681       if (argv[argptr][0] == '-') {
    1682         argptr++;
    1683         if ((configPresent == present) || (configPresent == empty)) {
    1684           switch(argv[argptr-1][1]) {
    1685             case 'p':
    1686               if (ExitFlag == 0) ExitFlag = 1;
    1687               if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1688                 ExitFlag = 255;
    1689                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl);
    1690                 performCriticalExit();
    1691               } else {
    1692                 SaveFlag = true;
    1693                 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
    1694                 if (!mol->AddXYZFile(argv[argptr]))
    1695                   DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    1696                 else {
    1697                   DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    1698                   configPresent = present;
    1699                 }
    1700               }
    1701               break;
    1702             case 'a':
    1703               if (ExitFlag == 0) ExitFlag = 1;
    1704               if ((argptr+4 >= argc) || (argv[argptr][0] == '-')) {
    1705                 ExitFlag = 255;
    1706                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for adding atom: -a <Z> --position <x> <y> <z>" << endl);
    1707                 performCriticalExit();
    1708               } else {
    1709                 ArgcList.insert(argptr-1);
    1710                 ArgcList.insert(argptr);
    1711                 ArgcList.insert(argptr+1);
    1712                 ArgcList.insert(argptr+2);
    1713                 ArgcList.insert(argptr+3);
    1714                 ArgcList.insert(argptr+4);
    1715                 argptr+=5;
    1716               }
    1717               break;
    1718             default:   // no match? Don't step on (this is done in next switch's default)
    1719               break;
    1720           }
    1721         }
    1722         if (configPresent == present) {
    1723           switch(argv[argptr-1][1]) {
    1724             case 'D':
    1725               if (ExitFlag == 0) ExitFlag = 1;
    1726               if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1727                 ExitFlag = 255;
    1728                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for depth-first-search analysis: -D <max. bond distance>" << endl);
    1729                 performCriticalExit();
    1730               } else {
    1731                 ArgcList.insert(argptr-1);
    1732                 ArgcList.insert(argptr);
    1733                 argptr+=1;
    1734               }
    1735               break;
    1736             case 'I':
    1737               DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl);
    1738               ArgcList.insert(argptr-1);
    1739               argptr+=0;
    1740               break;
    1741             case 'C':
    1742               {
    1743                 if (ExitFlag == 0) ExitFlag = 1;
    1744                 if ((argptr+11 >= argc)) {
    1745                   ExitFlag = 255;
    1746                   DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C[p] <type: E/P/S> [more params] <output> <bin output> <BinStart> <BinEnd>" << endl);
    1747                   performCriticalExit();
    1748                 } else {
    1749                   switch(argv[argptr][0]) {
    1750                     case 'E':
    1751                       ArgcList.insert(argptr-1);
    1752                       ArgcList.insert(argptr);
    1753                       ArgcList.insert(argptr+1);
    1754                       ArgcList.insert(argptr+2);
    1755                       ArgcList.insert(argptr+3);
    1756                       ArgcList.insert(argptr+4);
    1757                       ArgcList.insert(argptr+5);
    1758                       ArgcList.insert(argptr+6);
    1759                       ArgcList.insert(argptr+7);
    1760                       ArgcList.insert(argptr+8);
    1761                       ArgcList.insert(argptr+9);
    1762                       ArgcList.insert(argptr+10);
    1763                       ArgcList.insert(argptr+11);
    1764                       argptr+=12;
    1765                       break;
    1766 
    1767                     case 'P':
    1768                       ArgcList.insert(argptr-1);
    1769                       ArgcList.insert(argptr);
    1770                       ArgcList.insert(argptr+1);
    1771                       ArgcList.insert(argptr+2);
    1772                       ArgcList.insert(argptr+3);
    1773                       ArgcList.insert(argptr+4);
    1774                       ArgcList.insert(argptr+5);
    1775                       ArgcList.insert(argptr+6);
    1776                       ArgcList.insert(argptr+7);
    1777                       ArgcList.insert(argptr+8);
    1778                       ArgcList.insert(argptr+9);
    1779                       ArgcList.insert(argptr+10);
    1780                       ArgcList.insert(argptr+11);
    1781                       ArgcList.insert(argptr+12);
    1782                       ArgcList.insert(argptr+13);
    1783                       ArgcList.insert(argptr+14);
    1784                       argptr+=15;
    1785                       break;
    1786 
    1787                     case 'S':
    1788                       ArgcList.insert(argptr-1);
    1789                       ArgcList.insert(argptr);
    1790                       ArgcList.insert(argptr+1);
    1791                       ArgcList.insert(argptr+2);
    1792                       ArgcList.insert(argptr+3);
    1793                       ArgcList.insert(argptr+4);
    1794                       ArgcList.insert(argptr+5);
    1795                       ArgcList.insert(argptr+6);
    1796                       ArgcList.insert(argptr+7);
    1797                       ArgcList.insert(argptr+8);
    1798                       ArgcList.insert(argptr+9);
    1799                       ArgcList.insert(argptr+10);
    1800                       ArgcList.insert(argptr+11);
    1801                       ArgcList.insert(argptr+12);
    1802                       ArgcList.insert(argptr+13);
    1803                       ArgcList.insert(argptr+14);
    1804                       argptr+=15;
    1805                       break;
    1806 
    1807                     default:
    1808                       ExitFlag = 255;
    1809                       DoeLog(0) && (eLog()<< Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl);
    1810                       performCriticalExit();
    1811                       break;
    1812                   }
    1813                 }
    1814                 break;
    1815               }
    1816             case 'E':
    1817               if (ExitFlag == 0) ExitFlag = 1;
    1818               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr]))) {
    1819                 ExitFlag = 255;
    1820                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> --element <Z>" << endl);
    1821                 performCriticalExit();
    1822               } else {
    1823                 ArgcList.insert(argptr-1);
    1824                 ArgcList.insert(argptr);
    1825                 ArgcList.insert(argptr+1);
    1826                 ArgcList.insert(argptr+2);
    1827                 argptr+=3;
    1828               }
    1829               break;
    1830             case 'F':
    1831               if (ExitFlag == 0) ExitFlag = 1;
    1832               if ((argptr+12 >= argc) || (argv[argptr][0] == '-')) {
    1833                 ExitFlag = 255;
    1834                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for filling with molecule: -F <filler xyz file> --MaxDistance <distance or -1> --distances <x> <y> <z>  --lengths <surface> <randatm> <randmol> --DoRotate <0/1>" << endl);
    1835                 performCriticalExit();
    1836               } else {
    1837                 ArgcList.insert(argptr-1);
    1838                 ArgcList.insert(argptr);
    1839                 ArgcList.insert(argptr+1);
    1840                 ArgcList.insert(argptr+2);
    1841                 ArgcList.insert(argptr+3);
    1842                 ArgcList.insert(argptr+4);
    1843                 ArgcList.insert(argptr+5);
    1844                 ArgcList.insert(argptr+6);
    1845                 ArgcList.insert(argptr+7);
    1846                 ArgcList.insert(argptr+8);
    1847                 ArgcList.insert(argptr+9);
    1848                 ArgcList.insert(argptr+10);
    1849                 ArgcList.insert(argptr+11);
    1850                 ArgcList.insert(argptr+12);
    1851                 argptr+=13;
    1852               }
    1853               break;
    1854             case 'A':
    1855               if (ExitFlag == 0) ExitFlag = 1;
    1856               if ((argptr+2 >= argc) || (argv[argptr][0] == '-')) {
    1857                 ExitFlag =255;
    1858                 DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile> --molecule-by-id <molecule_id>" << endl);
    1859                 performCriticalExit();
    1860               } else {
    1861                 ArgcList.insert(argptr-1);
    1862                 ArgcList.insert(argptr);
    1863                 ArgcList.insert(argptr+1);
    1864                 ArgcList.insert(argptr+2);
    1865                 argptr+=3;
    1866               }
    1867               break;
    1868 
    1869             case 'J':
    1870               if (ExitFlag == 0) ExitFlag = 1;
    1871               if ((argptr+2 >= argc) || (argv[argptr][0] == '-')) {
    1872                 ExitFlag =255;
    1873                 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -J <path> --molecule-by-id <molecule_id>" << endl);
    1874                 performCriticalExit();
    1875               } else {
    1876                 ArgcList.insert(argptr-1);
    1877                 ArgcList.insert(argptr);
    1878                 ArgcList.insert(argptr+1);
    1879                 ArgcList.insert(argptr+2);
    1880                 argptr+=3;
    1881               }
    1882               break;
    1883 
    1884             case 'j':
    1885               if (ExitFlag == 0) ExitFlag = 1;
    1886               if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    1887                 ExitFlag =255;
    1888                 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path> --molecule-by-id <molecule_id>" << endl);
    1889                 performCriticalExit();
    1890               } else {
    1891                 ArgcList.insert(argptr-1);
    1892                 ArgcList.insert(argptr);
    1893                 ArgcList.insert(argptr+1);
    1894                 ArgcList.insert(argptr+2);
    1895                 argptr+=3;
    1896               }
    1897               break;
    1898 
    1899             case 'N':
    1900               if (ExitFlag == 0) ExitFlag = 1;
    1901               if ((argptr+4 >= argc) || (argv[argptr][0] == '-')){
    1902                 ExitFlag = 255;
    1903                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -N <molecule_id> --sphere-radius <radius> --nonconvex-file <output prefix>" << endl);
    1904                 performCriticalExit();
    1905               } else {
    1906                 ArgcList.insert(argptr-1);
    1907                 ArgcList.insert(argptr);
    1908                 ArgcList.insert(argptr+1);
    1909                 ArgcList.insert(argptr+2);
    1910                 ArgcList.insert(argptr+3);
    1911                 ArgcList.insert(argptr+4);
    1912                 argptr+=5;
    1913               }
    1914               break;
    1915             case 'S':
    1916               if (ExitFlag == 0) ExitFlag = 1;
    1917               if ((argptr+2 >= argc) || (argv[argptr][0] == '-')) {
    1918                 ExitFlag = 255;
    1919                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file> --molecule-by-id 0" << endl);
    1920                 performCriticalExit();
    1921               } else {
    1922                 ArgcList.insert(argptr-1);
    1923                 ArgcList.insert(argptr);
    1924                 ArgcList.insert(argptr+1);
    1925                 ArgcList.insert(argptr+2);
    1926                 argptr+=3;
    1927               }
    1928               break;
    1929             case 'L':
    1930               if (ExitFlag == 0) ExitFlag = 1;
    1931               if ((argptr+8 >= argc) || (argv[argptr][0] == '-')) {
    1932                 ExitFlag = 255;
    1933                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for linear interpolation: -L <prefix> --start-step <step0> --end-step <step1> --molecule-by-id 0 --id-mapping <0/1>" << endl);
    1934                 performCriticalExit();
    1935               } else {
    1936                 ArgcList.insert(argptr-1);
    1937                 ArgcList.insert(argptr);
    1938                 ArgcList.insert(argptr+1);
    1939                 ArgcList.insert(argptr+2);
    1940                 ArgcList.insert(argptr+3);
    1941                 ArgcList.insert(argptr+4);
    1942                 ArgcList.insert(argptr+5);
    1943                 ArgcList.insert(argptr+6);
    1944                 ArgcList.insert(argptr+7);
    1945                 ArgcList.insert(argptr+8);
    1946                 argptr+=9;
    1947               }
    1948               break;
    1949             case 'P':
    1950               if (ExitFlag == 0) ExitFlag = 1;
    1951               if ((argptr+2 >= argc) || (argv[argptr][0] == '-')) {
    1952                 ExitFlag = 255;
    1953                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file> --molecule-by-id <molecule_id>" << endl);
    1954                 performCriticalExit();
    1955               } else {
    1956                 ArgcList.insert(argptr-1);
    1957                 ArgcList.insert(argptr);
    1958                 ArgcList.insert(argptr+1);
    1959                 ArgcList.insert(argptr+2);
    1960                 argptr+=3;
    1961               }
    1962               break;
    1963             case 'R':
    1964               if (ExitFlag == 0) ExitFlag = 1;
    1965               if ((argptr+4 >= argc) || (argv[argptr][0] == '-'))  {
    1966                 ExitFlag = 255;
    1967                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <distance> --position <x> <y> <z>" << endl);
    1968                 performCriticalExit();
    1969               } else {
    1970                 ArgcList.insert(argptr-1);
    1971                 ArgcList.insert(argptr);
    1972                 ArgcList.insert(argptr+1);
    1973                 ArgcList.insert(argptr+2);
    1974                 ArgcList.insert(argptr+3);
    1975                 ArgcList.insert(argptr+4);
    1976                 argptr+=5;
    1977               }
    1978               break;
    1979             case 't':
    1980               if (ExitFlag == 0) ExitFlag = 1;
    1981               if ((argptr+4 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    1982                 ExitFlag = 255;
    1983                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z> --molecule-by-id <molecule_id> --periodic <0/1>" << endl);
    1984                 performCriticalExit();
    1985               } else {
    1986                 ArgcList.insert(argptr-1);
    1987                 ArgcList.insert(argptr);
    1988                 ArgcList.insert(argptr+1);
    1989                 ArgcList.insert(argptr+2);
    1990                 ArgcList.insert(argptr+3);
    1991                 ArgcList.insert(argptr+4);
    1992                 ArgcList.insert(argptr+5);
    1993                 ArgcList.insert(argptr+6);
    1994                 argptr+=7;
    1995               }
    1996               break;
    1997             case 's':
    1998               if (ExitFlag == 0) ExitFlag = 1;
    1999               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    2000                 ExitFlag = 255;
    2001                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl);
    2002                 performCriticalExit();
    2003               } else {
    2004                 ArgcList.insert(argptr-1);
    2005                 ArgcList.insert(argptr);
    2006                 ArgcList.insert(argptr+1);
    2007                 ArgcList.insert(argptr+2);
    2008                 argptr+=3;
    2009               }
    2010               break;
    2011             case 'b':
    2012               if (ExitFlag == 0) ExitFlag = 1;
    2013               if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
    2014                 ExitFlag = 255;
    2015                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
    2016                 performCriticalExit();
    2017               } else {
    2018                 ArgcList.insert(argptr-1);
    2019                 ArgcList.insert(argptr);
    2020                 ArgcList.insert(argptr+1);
    2021                 ArgcList.insert(argptr+2);
    2022                 ArgcList.insert(argptr+3);
    2023                 ArgcList.insert(argptr+4);
    2024                 ArgcList.insert(argptr+5);
    2025                 argptr+=6;
    2026               }
    2027               break;
    2028             case 'B':
    2029               if (ExitFlag == 0) ExitFlag = 1;
    2030               if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
    2031                 ExitFlag = 255;
    2032                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl);
    2033                 performCriticalExit();
    2034               } else {
    2035                 ArgcList.insert(argptr-1);
    2036                 ArgcList.insert(argptr);
    2037                 ArgcList.insert(argptr+1);
    2038                 ArgcList.insert(argptr+2);
    2039                 ArgcList.insert(argptr+3);
    2040                 ArgcList.insert(argptr+4);
    2041                 ArgcList.insert(argptr+5);
    2042                 argptr+=6;
    2043               }
    2044               break;
    2045             case 'c':
    2046               if (ExitFlag == 0) ExitFlag = 1;
    2047               if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    2048                 ExitFlag = 255;
    2049                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl);
    2050                 performCriticalExit();
    2051               } else {
    2052                 ArgcList.insert(argptr-1);
    2053                 ArgcList.insert(argptr);
    2054                 ArgcList.insert(argptr+1);
    2055                 ArgcList.insert(argptr+2);
    2056                 argptr+=3;
    2057               }
    2058               break;
    2059             case 'O':
    2060               if (ExitFlag == 0) ExitFlag = 1;
    2061               ArgcList.insert(argptr-1);
    2062               argptr+=0;
    2063               break;
    2064             case 'r':
    2065               if (ExitFlag == 0) ExitFlag = 1;
    2066               if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])))  {
    2067                 ExitFlag = 255;
    2068                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl);
    2069                 performCriticalExit();
    2070               } else {
    2071                 ArgcList.insert(argptr-1);
    2072                 ArgcList.insert(argptr);
    2073                 argptr+=1;
    2074               }
    2075               break;
    2076             case 'f':
    2077               if (ExitFlag == 0) ExitFlag = 1;
    2078               if ((argptr+1 >= argc) || (argv[argptr][0] == '-')) {
    2079                 ExitFlag = 255;
    2080                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl);
    2081                 performCriticalExit();
    2082               } else {
    2083                 ArgcList.insert(argptr-1);
    2084                 ArgcList.insert(argptr);
    2085                 ArgcList.insert(argptr+1);
    2086                 ArgcList.insert(argptr+2);
    2087                 ArgcList.insert(argptr+3);
    2088                 ArgcList.insert(argptr+4);
    2089                 argptr+=5;
    2090               }
    2091               break;
    2092             case 'm':
    2093               if (ExitFlag == 0) ExitFlag = 1;
    2094               j = atoi(argv[argptr++]);
    2095               if ((j<0) || (j>1)) {
    2096                 DoeLog(1) && (eLog()<< Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl);
    2097                 j = 0;
    2098               }
    2099               if (j) {
    2100                 SaveFlag = true;
    2101                 DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl);
    2102                 mol->PrincipalAxisSystem((bool)j);
    2103               } else
    2104                 ArgcList.insert(argptr-1);
    2105                 argptr+=0;
    2106               break;
    2107             case 'o':
    2108               if (ExitFlag == 0) ExitFlag = 1;
    2109               if ((argptr+4 >= argc) || (argv[argptr][0] == '-')){
    2110                 ExitFlag = 255;
    2111                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <molecule_id> --output-file <output file> --output-file <binned output file>" << endl);
    2112                 performCriticalExit();
    2113               } else {
    2114                 ArgcList.insert(argptr-1);
    2115                 ArgcList.insert(argptr);
    2116                 ArgcList.insert(argptr+1);
    2117                 ArgcList.insert(argptr+2);
    2118                 ArgcList.insert(argptr+3);
    2119                 ArgcList.insert(argptr+4);
    2120                 argptr+=5;
    2121               }
    2122               break;
    2123             case 'U':
    2124               if (ExitFlag == 0) ExitFlag = 1;
    2125               if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) {
    2126                 ExitFlag = 255;
    2127                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl);
    2128                 performCriticalExit();
    2129               } else {
    2130                 volume = atof(argv[argptr++]);
    2131                 DoLog(0) && (Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl);
    2132               }
    2133             case 'u':
    2134               if (ExitFlag == 0) ExitFlag = 1;
    2135               if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) ) {
    2136                 if (volume != -1)
    2137                   ExitFlag = 255;
    2138                   DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl);
    2139                   performCriticalExit();
    2140               } else {
    2141                 ArgcList.insert(argptr-1);
    2142                 ArgcList.insert(argptr);
    2143                 argptr+=1;
    2144               }
    2145               break;
    2146             case 'd':
    2147               if (ExitFlag == 0) ExitFlag = 1;
    2148               if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
    2149                 ExitFlag = 255;
    2150                 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl);
    2151                 performCriticalExit();
    2152               } else {
    2153                 ArgcList.insert(argptr-1);
    2154                 ArgcList.insert(argptr);
    2155                 ArgcList.insert(argptr+1);
    2156                 ArgcList.insert(argptr+2);
    2157                 argptr+=3;
    2158               }
    2159               break;
    2160             default:   // no match? Step on
    2161               if ((argptr < argc) && (argv[argptr][0] != '-')) // if it started with a '-' we've already made a step!
    2162                 argptr++;
    2163               break;
    2164           }
    2165         }
    2166       } else argptr++;
    2167     } while (argptr < argc);
    2168     if (SaveFlag)
    2169       configuration.SaveAll(*ConfigFileName, periode, molecules);
    2170   } else {  // no arguments, hence scan the elements db
    2171     if (periode->LoadPeriodentafel(configuration.databasepath))
    2172       DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl);
    2173     else
    2174       DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl);
    2175     configuration.RetrieveConfigPathAndName("main_pcp_linux");
    2176   }
    2177   return(ExitFlag);
    2178 };
    217980
    218081/********************************************** Main routine **************************************/
    218182
    218283void cleanUp(){
     84  FormatParserStorage::purgeInstance();
     85  ChangeTracker::purgeInstance();
    218386  World::purgeInstance();
    218487  logger::purgeInstance();
     
    2197100int main(int argc, char **argv)
    2198101{
    2199     // while we are non interactive, we want to abort from asserts
    2200     //ASSERT_DO(Assert::Abort);
    2201     Vector x, y, z, n;
    2202     ifstream test;
    2203     ofstream output;
    2204     string line;
    2205     char **Arguments = NULL;
    2206     int ArgcSize = 0;
    2207     int ExitFlag = 0;
    2208     bool ArgumentsCopied = false;
    2209     char *ConfigFileName = new char[MAXSTRINGSIZE];
     102  // while we are non interactive, we want to abort from asserts
     103  //ASSERT_DO(Assert::Abort);
     104  string line;
     105  char **Arguments = NULL;
     106  int ArgcSize = 0;
     107  int ExitFlag = 0;
     108  bool ArgumentsCopied = false;
     109  std::string BondGraphFileName("\n");
     110  FormatParserStorage::getInstance().addMpqc();
     111  FormatParserStorage::getInstance().addPcp();
     112  FormatParserStorage::getInstance().addXyz();
    2210113
    2211     // print version check whether arguments are present at all
    2212     cout << ESPACKVersion << endl;
    2213     if (argc < 2) {
    2214       cout << "Obtain help with " << argv[0] << " -h." << endl;
    2215       cleanUp();
    2216       Memory::getState();
    2217       return(1);
     114  // print version check whether arguments are present at all
     115  cout << ESPACKVersion << endl;
     116
     117  setVerbosity(0);
     118  // need to init the history before any action is created
     119  ActionHistory::init();
     120
     121  // In the interactive mode, we can leave the user the choice in case of error
     122  ASSERT_DO(Assert::Ask);
     123
     124  // from this moment on, we need to be sure to deeinitialize in the correct order
     125  // this is handled by the cleanup function
     126  atexit(cleanUp);
     127
     128  // Parse command line options and if present create respective UI
     129  {
     130    // construct bond graph
     131    if (World::getInstance().getConfig()->BG == NULL) {
     132      World::getInstance().getConfig()->BG = new BondGraph(World::getInstance().getConfig()->GetIsAngstroem());
     133      if (World::getInstance().getConfig()->BG->LoadBondLengthTable(BondGraphFileName)) {
     134        DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
     135      } else {
     136        DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
     137      }
    2218138    }
    2219 
    2220 
    2221     setVerbosity(0);
    2222     // need to init the history before any action is created
    2223     ActionHistory::init();
    2224 
    2225     // In the interactive mode, we can leave the user the choice in case of error
    2226     ASSERT_DO(Assert::Ask);
    2227 
    2228     // from this moment on, we need to be sure to deeinitialize in the correct order
    2229     // this is handled by the cleanup function
    2230     atexit(cleanUp);
    2231 
    2232     // Parse command line options and if present create respective UI
    2233     {
    2234       set<int> ArgcList;
    2235       ArgcList.insert(0); // push back program!
    2236       ArgcList.insert(1); // push back config file name
    2237       // handle arguments by ParseCommandLineOptions()
    2238       ExitFlag = ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), &ConfigFileName, ArgcList);
    2239       World::getInstance().setExitFlag(ExitFlag);
    2240       // copy all remaining arguments to a new argv
    2241       Arguments = new char *[ArgcList.size()];
    2242       cout << "The following arguments are handled by CommandLineParser: ";
    2243       for (set<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {
    2244         Arguments[ArgcSize] = new char[strlen(argv[*ArgcRunner])+2];
    2245         strcpy(Arguments[ArgcSize], argv[*ArgcRunner]);
    2246         cout << " " << argv[*ArgcRunner];
    2247         ArgcSize++;
    2248       }
    2249       cout << endl;
    2250       ArgumentsCopied = true;
    2251       // handle remaining arguments by CommandLineParser
     139    // handle remaining arguments by CommandLineParser
     140    if (argc>1) {
    2252141      MapOfActions::getInstance().AddOptionsToParser();
    2253142      map <std::string, std::string> ShortFormToActionMap = MapOfActions::getInstance().getShortFormToActionMap();
    2254       CommandLineParser::getInstance().Run(ArgcSize,Arguments, ShortFormToActionMap);
    2255       if (!CommandLineParser::getInstance().isEmpty()) {
    2256         DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
    2257         UIFactory::registerFactory(new CommandLineUIFactory::description());
    2258         UIFactory::makeUserInterface("CommandLine");
    2259       } else {
    2260         DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
    2261         UIFactory::registerFactory(new TextUIFactory::description());
    2262         UIFactory::makeUserInterface("Text");
    2263       }
     143      CommandLineParser::getInstance().Run(argc,argv, ShortFormToActionMap);
     144      DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
     145      UIFactory::registerFactory(new CommandLineUIFactory::description());
     146      UIFactory::makeUserInterface("CommandLine");
     147    } else {
     148      DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
     149      UIFactory::registerFactory(new TextUIFactory::description());
     150      UIFactory::makeUserInterface("Text");
    2264151    }
     152  }
    2265153
    2266     {
    2267       MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow();
    2268       mainWindow->display();
    2269       delete mainWindow;
    2270     }
     154  {
     155    MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow();
     156    mainWindow->display();
     157    delete mainWindow;
     158  }
    2271159
    2272     Log() << Verbose(0) << "Saving to " << ConfigFileName << "." << endl;
    2273     World::getInstance().getConfig()->SaveAll(ConfigFileName, World::getInstance().getPeriode(), World::getInstance().getMolecules());
     160  FormatParserStorage::getInstance().SaveAll();
     161  ChangeTracker::getInstance().saveStatus();
    2274162
    2275163  // free the new argv
     
    2279167    delete[](Arguments);
    2280168  }
    2281   delete[](ConfigFileName);
     169  //delete[](ConfigFileName);
    2282170
    2283171  ExitFlag = World::getInstance().getExitFlag();
  • src/config.cpp

    r0d5dce r8f822c  
    1010#include <cstring>
    1111
    12 #include "World.hpp"
    1312#include "atom.hpp"
    1413#include "bond.hpp"
     14#include "bondgraph.hpp"
    1515#include "config.hpp"
     16#include "ConfigFileBuffer.hpp"
    1617#include "element.hpp"
    1718#include "helpers.hpp"
     
    2324#include "molecule.hpp"
    2425#include "periodentafel.hpp"
     26#include "ThermoStatContainer.hpp"
    2527#include "World.hpp"
    26 
    27 /******************************** Functions for class ConfigFileBuffer **********************/
    28 
    29 /** Structure containing compare function for Ion_Type sorting.
    30  */
    31 struct IonTypeCompare {
    32   bool operator()(const char* s1, const char *s2) const {
    33     char number1[8];
    34     char number2[8];
    35     const char *dummy1, *dummy2;
    36     //Log() << Verbose(0) << s1 << "  " << s2 << endl;
    37     dummy1 = strchr(s1, '_')+sizeof(char)*5;  // go just after "Ion_Type"
    38     dummy2 = strchr(dummy1, '_');
    39     strncpy(number1, dummy1, dummy2-dummy1); // copy the number
    40     number1[dummy2-dummy1]='\0';
    41     dummy1 = strchr(s2, '_')+sizeof(char)*5;  // go just after "Ion_Type"
    42     dummy2 = strchr(dummy1, '_');
    43     strncpy(number2, dummy1, dummy2-dummy1); // copy the number
    44     number2[dummy2-dummy1]='\0';
    45     if (atoi(number1) != atoi(number2))
    46       return (atoi(number1) < atoi(number2));
    47     else {
    48       dummy1 = strchr(s1, '_')+sizeof(char);
    49       dummy1 = strchr(dummy1, '_')+sizeof(char);
    50       dummy2 = strchr(dummy1, ' ') < strchr(dummy1, '\t') ? strchr(dummy1, ' ') : strchr(dummy1, '\t');
    51       strncpy(number1, dummy1, dummy2-dummy1); // copy the number
    52       number1[dummy2-dummy1]='\0';
    53       dummy1 = strchr(s2, '_')+sizeof(char);
    54       dummy1 = strchr(dummy1, '_')+sizeof(char);
    55       dummy2 = strchr(dummy1, ' ') < strchr(dummy1, '\t') ? strchr(dummy1, ' ') : strchr(dummy1, '\t');
    56       strncpy(number2, dummy1, dummy2-dummy1); // copy the number
    57       number2[dummy2-dummy1]='\0';
    58       return (atoi(number1) < atoi(number2));
    59     }
    60   }
    61 };
    62 
    63 /** Constructor for ConfigFileBuffer class.
    64  */
    65 ConfigFileBuffer::ConfigFileBuffer() : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
    66 {
    67 };
    68 
    69 /** Constructor for ConfigFileBuffer class with filename to be parsed.
    70  * \param *filename file name
    71  */
    72 ConfigFileBuffer::ConfigFileBuffer(const char * const filename) : buffer(NULL), LineMapping(NULL), CurrentLine(0), NoLines(0)
    73 {
    74   ifstream *file = NULL;
    75   char line[MAXSTRINGSIZE];
    76 
    77   // prescan number of lines
    78   file= new ifstream(filename);
    79   if (file == NULL) {
    80     DoeLog(1) && (eLog()<< Verbose(1) << "config file " << filename << " missing!" << endl);
    81     return;
    82   }
    83   NoLines = 0; // we're overcounting by one
    84   long file_position = file->tellg(); // mark current position
    85   do {
    86     file->getline(line, 256);
    87     NoLines++;
    88   } while (!file->eof());
    89   file->clear();
    90   file->seekg(file_position, ios::beg);
    91   DoLog(1) && (Log() << Verbose(1) << NoLines-1 << " lines were recognized." << endl);
    92 
    93   // allocate buffer's 1st dimension
    94   if (buffer != NULL) {
    95     DoeLog(1) && (eLog()<< Verbose(1) << "FileBuffer->buffer is not NULL!" << endl);
    96     return;
    97   } else
    98     buffer = new char *[NoLines];
    99 
    100   // scan each line and put into buffer
    101   int lines=0;
    102   int i;
    103   do {
    104     buffer[lines] = new char[MAXSTRINGSIZE];
    105     file->getline(buffer[lines], MAXSTRINGSIZE-1);
    106     i = strlen(buffer[lines]);
    107     buffer[lines][i] = '\n';
    108     buffer[lines][i+1] = '\0';
    109     lines++;
    110   } while((!file->eof()) && (lines < NoLines));
    111   DoLog(1) && (Log() << Verbose(1) << lines-1 << " lines were read into the buffer." << endl);
    112 
    113   // close and exit
    114   file->close();
    115   file->clear();
    116   delete(file);
    117 }
    118 
    119 /** Destructor for ConfigFileBuffer class.
    120  */
    121 ConfigFileBuffer::~ConfigFileBuffer()
    122 {
    123   for(int i=0;i<NoLines;++i)
    124     delete[](buffer[i]);
    125   delete[](buffer);
    126   delete[](LineMapping);
    127 }
    128 
    129 
    130 /** Create trivial mapping.
    131  */
    132 void ConfigFileBuffer::InitMapping()
    133 {
    134   LineMapping = new int[NoLines];
    135   for (int i=0;i<NoLines;i++)
    136     LineMapping[i] = i;
    137 }
    138 
    139 /** Creates a mapping for the \a *FileBuffer's lines containing the Ion_Type keyword such that they are sorted.
    140  * \a *map on return contains a list of NoAtom entries such that going through the list, yields indices to the
    141  * lines in \a *FileBuffer in a sorted manner of the Ion_Type?_? keywords. We assume that ConfigFileBuffer::CurrentLine
    142  * points to first Ion_Type entry.
    143  * \param *FileBuffer pointer to buffer structure
    144  * \param NoAtoms of subsequent lines to look at
    145  */
    146 void ConfigFileBuffer::MapIonTypesInBuffer(const int NoAtoms)
    147 {
    148   map<const char *, int, IonTypeCompare> IonTypeLineMap;
    149   if (LineMapping == NULL) {
    150     DoeLog(0) && (eLog()<< Verbose(0) << "map pointer is NULL: " << LineMapping << endl);
    151     performCriticalExit();
    152     return;
    153   }
    154 
    155   // put all into hashed map
    156   for (int i=0; i<NoAtoms; ++i) {
    157     IonTypeLineMap.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i));
    158   }
    159 
    160   // fill map
    161   int nr=0;
    162   for (map<const char *, int, IonTypeCompare>::iterator runner = IonTypeLineMap.begin(); runner != IonTypeLineMap.end(); ++runner) {
    163     if (CurrentLine+nr < NoLines)
    164       LineMapping[CurrentLine+(nr++)] = runner->second;
    165     else {
    166       DoeLog(0) && (eLog()<< Verbose(0) << "config::MapIonTypesInBuffer - NoAtoms is wrong: We are past the end of the file!" << endl);
    167       performCriticalExit();
    168     }
    169   }
    170 }
     28#include "Matrix.hpp"
     29#include "Box.hpp"
    17130
    17231/************************************* Functions for class config ***************************/
     
    17433/** Constructor for config file class.
    17534 */
    176 config::config() : BG(NULL), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL),
    177     configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), Thermostat(4), ThermostatImplemented(NULL),
    178     ThermostatNames(NULL), TempFrequency(2.5), alpha(0.), HooverMass(0.), TargetTemp(0.00095004455), ScaleTempStep(25),  mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
     35config::config() : BG(NULL), Thermostats(0), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1),
     36    configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
    17937    DoOutVis(0), DoOutMes(1), DoOutNICS(0), DoOutOrbitals(0), DoOutCurrent(0), DoFullCurrent(0), DoPerturbation(0), DoWannier(0), CommonWannier(0), SawtoothStart(0.01),
    18038    VectorPlane(0), VectorCut(0.), UseAddGramSch(1), Seed(1), OutVisStep(10), OutSrcStep(5), MaxPsiStep(0), EpsWannier(1e-7), MaxMinStep(100), RelEpsTotalEnergy(1e-7),
     
    18644  pseudopotpath = new char[MAXSTRINGSIZE];
    18745  databasepath = new char[MAXSTRINGSIZE];
    188   configpath = new char[MAXSTRINGSIZE];
    18946  configname = new char[MAXSTRINGSIZE];
     47  Thermostats = new ThermoStatContainer();
    19048  strcpy(mainname,"pcp");
    19149  strcpy(defaultpath,"not specified");
    19250  strcpy(pseudopotpath,"not specified");
    193   configpath[0]='\0';
    19451  configname[0]='\0';
    19552  basis = "3-21G";
    196 
    197   InitThermostats();
    19853};
    19954
     
    20661  delete[](pseudopotpath);
    20762  delete[](databasepath);
    208   delete[](configpath);
    20963  delete[](configname);
    210   delete[](ThermostatImplemented);
    211   for (int j=0;j<MaxThermostats;j++)
    212     delete[](ThermostatNames[j]);
    213   delete[](ThermostatNames);
     64  if (Thermostats != NULL)
     65    delete(Thermostats);
    21466
    21567  if (BG != NULL)
    21668    delete(BG);
    21769};
    218 
    219 /** Initialises variables in class config for Thermostats.
    220  */
    221 void config::InitThermostats()
    222 {
    223   ThermostatImplemented = new int[MaxThermostats];
    224   ThermostatNames = new char *[MaxThermostats];
    225   for (int j=0;j<MaxThermostats;j++)
    226     ThermostatNames[j] = new char[12];
    227 
    228   strcpy(ThermostatNames[0],"None");
    229   ThermostatImplemented[0] = 1;
    230   strcpy(ThermostatNames[1],"Woodcock");
    231   ThermostatImplemented[1] = 1;
    232   strcpy(ThermostatNames[2],"Gaussian");
    233   ThermostatImplemented[2] = 1;
    234   strcpy(ThermostatNames[3],"Langevin");
    235   ThermostatImplemented[3] = 1;
    236   strcpy(ThermostatNames[4],"Berendsen");
    237   ThermostatImplemented[4] = 1;
    238   strcpy(ThermostatNames[5],"NoseHoover");
    239   ThermostatImplemented[5] = 1;
    240 };
    241 
    242 /** Readin of Thermostat related values from parameter file.
    243  * \param *fb file buffer containing the config file
    244  */
    245 void config::ParseThermostats(class ConfigFileBuffer * const fb)
    246 {
    247   char * const thermo = new char[12];
    248   const int verbose = 0;
    249 
    250   // read desired Thermostat from file along with needed additional parameters
    251   if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
    252     if (strcmp(thermo, ThermostatNames[0]) == 0) { // None
    253       if (ThermostatImplemented[0] == 1) {
    254         Thermostat = None;
    255       } else {
    256         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    257         Thermostat = None;
    258       }
    259     } else if (strcmp(thermo, ThermostatNames[1]) == 0) { // Woodcock
    260       if (ThermostatImplemented[1] == 1) {
    261         Thermostat = Woodcock;
    262         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read scaling frequency
    263       } else {
    264         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    265         Thermostat = None;
    266       }
    267     } else if (strcmp(thermo, ThermostatNames[2]) == 0) { // Gaussian
    268       if (ThermostatImplemented[2] == 1) {
    269         Thermostat = Gaussian;
    270         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &ScaleTempStep, 1, critical); // read collision rate
    271       } else {
    272         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    273         Thermostat = None;
    274       }
    275     } else if (strcmp(thermo, ThermostatNames[3]) == 0) { // Langevin
    276       if (ThermostatImplemented[3] == 1) {
    277         Thermostat = Langevin;
    278         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read gamma
    279         if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &alpha, 1, optional)) {
    280           DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << alpha << "." << endl);
    281         } else {
    282           alpha = 1.;
    283         }
    284       } else {
    285         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    286         Thermostat = None;
    287       }
    288     } else if (strcmp(thermo, ThermostatNames[4]) == 0) { // Berendsen
    289       if (ThermostatImplemented[4] == 1) {
    290         Thermostat = Berendsen;
    291         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &TempFrequency, 1, critical); // read \tau_T
    292       } else {
    293         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    294         Thermostat = None;
    295       }
    296     } else if (strcmp(thermo, ThermostatNames[5]) == 0) { // Nose-Hoover
    297       if (ThermostatImplemented[5] == 1) {
    298         Thermostat = NoseHoover;
    299         ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &HooverMass, 1, critical); // read Hoovermass
    300         alpha = 0.;
    301       } else {
    302         DoLog(1) && (Log() << Verbose(1) << "Warning: " << ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
    303         Thermostat = None;
    304       }
    305     } else {
    306       DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl);
    307       Thermostat = None;
    308     }
    309   } else {
    310     if ((MaxOuterStep > 0) && (TargetTemp != 0))
    311       DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl);
    312     Thermostat = None;
    313   }
    314   delete[](thermo);
    315 };
    316 
    31770
    31871/** Displays menu for editing each entry of the config file.
     
    629382};
    630383
    631 /** Retrieves the path in the given config file name.
    632  * \param filename config file string
    633  */
    634 void config::RetrieveConfigPathAndName(const string filename)
    635 {
    636   char *ptr = NULL;
    637   char *buffer = new char[MAXSTRINGSIZE];
    638   strncpy(buffer, filename.c_str(), MAXSTRINGSIZE);
    639   int last = -1;
    640   for(last=MAXSTRINGSIZE;last--;) {
    641     if (buffer[last] == '/')
    642       break;
    643   }
    644   if (last == -1) { // no path in front, set to local directory.
    645     strcpy(configpath, "./");
    646     ptr = buffer;
    647   } else {
    648     strncpy(configpath, buffer, last+1);
    649     ptr = &buffer[last+1];
    650     if (last < 254)
    651       configpath[last+1]='\0';
    652   }
    653   strcpy(configname, ptr);
    654   DoLog(0) && (Log() << Verbose(0) << "Found configpath: " << configpath << ", dir slash was found at " << last << ", config name is " << configname << "." << endl);
    655   delete[](buffer);
    656 };
    657 
    658 /** Initializes ConfigFileBuffer from a file.
    659  * \param *file input file stream being the opened config file
    660  * \param *FileBuffer pointer to FileBuffer on return, should point to NULL
    661  */
    662 void PrepareFileBuffer(const char * const filename, struct ConfigFileBuffer *&FileBuffer)
    663 {
    664   if (FileBuffer != NULL) {
    665     DoeLog(2) && (eLog()<< Verbose(2) << "deleting present FileBuffer in PrepareFileBuffer()." << endl);
    666     delete(FileBuffer);
    667   }
    668   FileBuffer = new ConfigFileBuffer(filename);
    669 
    670   FileBuffer->InitMapping();
    671 };
    672 
    673384/** Loads a molecule from a ConfigFileBuffer.
    674385 * \param *mol molecule to load
     
    864575  file->close();
    865576  delete(file);
    866   RetrieveConfigPathAndName(filename);
    867577
    868578  // ParseParameterFile
    869   struct ConfigFileBuffer *FileBuffer = NULL;
    870   PrepareFileBuffer(filename,FileBuffer);
     579  class ConfigFileBuffer *FileBuffer = new ConfigFileBuffer(filename);
    871580
    872581  /* Oeffne Hauptparameterdatei */
     
    877586  int verbose = 0;
    878587 
     588  //TODO: This is actually sensible?: if (MaxOuterStep > 0)
    879589  ParseThermostats(FileBuffer);
    880590 
     
    941651  ParseForParameter(verbose,FileBuffer,"OutVisStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
    942652  ParseForParameter(verbose,FileBuffer,"OutSrcStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
    943   ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(config::TargetTemp), 1, optional);
     653  ParseForParameter(verbose,FileBuffer,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
    944654  //ParseForParameter(verbose,FileBuffer,"Thermostat", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional);
    945655  if (!ParseForParameter(verbose,FileBuffer,"EpsWannier", 0, 1, 1, double_type, &(config::EpsWannier), 1, optional))
     
    971681  // Unit cell and magnetic field
    972682  ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    973   double * const cell_size = World::getInstance().getDomain();
     683  double * cell_size = new double[6];
    974684  cell_size[0] = BoxLength[0];
    975685  cell_size[1] = BoxLength[3];
     
    978688  cell_size[4] = BoxLength[7];
    979689  cell_size[5] = BoxLength[8];
     690  World::getInstance().setDomain(cell_size);
     691  delete cell_size;
    980692  //if (1) fprintf(stderr,"\n");
    981693
     
    1101813    return;
    1102814  }
    1103   RetrieveConfigPathAndName(filename);
    1104815  // ParseParameters
    1105816
     
    1150861  ParseForParameter(verbose,file,"VisOuterStep", 0, 1, 1, int_type, &(config::OutVisStep), 1, optional);
    1151862  ParseForParameter(verbose,file,"VisSrcOuterStep", 0, 1, 1, int_type, &(config::OutSrcStep), 1, optional);
    1152   ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(config::TargetTemp), 1, optional);
    1153   ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(config::ScaleTempStep), 1, optional);
     863  ParseForParameter(verbose,file,"TargetTemp", 0, 1, 1, double_type, &(Thermostats->TargetTemp), 1, optional);
     864  ParseForParameter(verbose,file,"ScaleTempStep", 0, 1, 1, int_type, &(Thermostats->ScaleTempStep), 1, optional);
    1154865  config::EpsWannier = 1e-8;
    1155866
     
    1176887
    1177888  ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    1178   double * const cell_size = World::getInstance().getDomain();
     889  double * cell_size = new double[6];
    1179890  cell_size[0] = BoxLength[0];
    1180891  cell_size[1] = BoxLength[3];
     
    1183894  cell_size[4] = BoxLength[7];
    1184895  cell_size[5] = BoxLength[8];
     896  World::getInstance().setDomain(cell_size);
     897  delete[] cell_size;
    1185898  if (1) fprintf(stderr,"\n");
    1186899  config::DoPerturbation = 0;
     
    13201033  // bring MaxTypes up to date
    13211034  mol->CountElements();
    1322   const double * const cell_size = World::getInstance().getDomain();
     1035  const Matrix &domain = World::getInstance().getDomain().getM();
    13231036  ofstream * const output = new ofstream(filename, ios::out);
    13241037  if (output != NULL) {
     
    13391052    *output << "DoFullCurrent\t" << config::DoFullCurrent << "\t# Do full perturbation" << endl;
    13401053    *output << "DoConstrainedMD\t" << config::DoConstrainedMD << "\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD" << endl;
    1341     *output << "Thermostat\t" << ThermostatNames[Thermostat] << "\t";
    1342     switch(Thermostat) {
     1054    *output << "Thermostat\t" << Thermostats->ThermostatNames[Thermostats->Thermostat] << "\t";
     1055    switch(Thermostats->Thermostat) {
    13431056      default:
    13441057      case None:
    13451058        break;
    13461059      case Woodcock:
    1347         *output << ScaleTempStep;
     1060        *output << Thermostats->ScaleTempStep;
    13481061        break;
    13491062      case Gaussian:
    1350         *output << ScaleTempStep;
     1063        *output << Thermostats->ScaleTempStep;
    13511064        break;
    13521065      case Langevin:
    1353         *output << TempFrequency << "\t" << alpha;
     1066        *output << Thermostats->TempFrequency << "\t" << Thermostats->alpha;
    13541067        break;
    13551068      case Berendsen:
    1356         *output << TempFrequency;
     1069        *output << Thermostats->TempFrequency;
    13571070        break;
    13581071      case NoseHoover:
    1359         *output << HooverMass;
     1072        *output << Thermostats->HooverMass;
    13601073        break;
    13611074    };
     
    13721085    *output << "OutVisStep\t" << config::OutVisStep << "\t# Output visual data every ...th step" << endl;
    13731086    *output << "OutSrcStep\t" << config::OutSrcStep << "\t# Output \"restart\" data every ..th step" << endl;
    1374     *output << "TargetTemp\t" << config::TargetTemp << "\t# Target temperature" << endl;
     1087    *output << "TargetTemp\t" << Thermostats->TargetTemp << "\t# Target temperature" << endl;
    13751088    *output << "MaxPsiStep\t" << config::MaxPsiStep << "\t# number of Minimisation steps per state (0 - default)" << endl;
    13761089    *output << "EpsWannier\t" << config::EpsWannier << "\t# tolerance value for spread minimisation of orbitals" << endl;
     
    13911104    *output << endl;
    13921105    *output << "BoxLength\t\t\t# (Length of a unit cell)" << endl;
    1393     *output << cell_size[0] << "\t" << endl;
    1394     *output << cell_size[1] << "\t" << cell_size[2] << "\t" << endl;
    1395     *output << cell_size[3] << "\t" << cell_size[4] << "\t" << cell_size[5] << "\t" << endl;
     1106    *output << domain.at(0,0) << "\t" << endl;
     1107    *output << domain.at(1,0) << "\t" << domain.at(1,1) << "\t" << endl;
     1108    *output << domain.at(2,0) << "\t" << domain.at(2,1) << "\t" << domain.at(2,2) << "\t" << endl;
    13961109    // FIXME
    13971110    *output << endl;
     
    14831196    // output of atoms
    14841197    AtomNo = 0;
    1485     mol->ActOnAllAtoms( &atom::OutputMPQCLine, output, (const Vector *)center, &AtomNo );
     1198    mol->ActOnAllAtoms( &atom::OutputMPQCLine, (ostream * const) output, (const Vector *)center, &AtomNo );
    14861199    delete(center);
    14871200    *output << "\t}" << endl;
     
    15251238    // output of atoms
    15261239    AtomNo = 0;
    1527     mol->ActOnAllAtoms( &atom::OutputMPQCLine, output, (const Vector *)center, &AtomNo );
     1240    mol->ActOnAllAtoms( &atom::OutputMPQCLine, (ostream * const) output, (const Vector *)center, &AtomNo );
    15281241    delete(center);
    15291242    *output << "\t}" << endl;
     
    17861499  molecule *mol = NULL;
    17871500
    1788   if (!strcmp(configpath, GetDefaultPath())) {
    1789     eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    1790   }
    1791 
    1792 
    17931501  // first save as PDB data
    17941502  if (ConfigFileName != NULL)
     
    18271535    mol->doCountAtoms();
    18281536    mol->CountElements();
    1829     mol->CalculateOrbitals(*this);
     1537    //mol->CalculateOrbitals(*this);
    18301538    delete[](src);
    18311539  } else {
     
    18331541      mol = *(molecules->ListOfMolecules.begin());
    18341542      mol->doCountAtoms();
    1835       mol->CalculateOrbitals(*this);
     1543      //mol->CalculateOrbitals(*this);
    18361544    } else {
    18371545      DoeLog(1) && (eLog() << Verbose(1) << "There are no molecules to save!" << endl);
     
    18951603  else
    18961604    Log() << Verbose(0) << "\t... failed." << endl;
    1897 
    1898   if (!strcmp(configpath, GetDefaultPath())) {
    1899     eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    1900   }
    19011605
    19021606  // don't destroy molecule as it contains all our atoms
     
    23462050  return (found); // true if found, false if not
    23472051}
     2052
     2053/** Reading of Thermostat related values from parameter file.
     2054 * \param *fb file buffer containing the config file
     2055 */
     2056void config::ParseThermostats(class ConfigFileBuffer * const fb)
     2057{
     2058  char * const thermo = new char[12];
     2059  const int verbose = 0;
     2060
     2061  // read desired Thermostat from file along with needed additional parameters
     2062  if (ParseForParameter(verbose,fb,"Thermostat", 0, 1, 1, string_type, thermo, 1, optional)) {
     2063    if (strcmp(thermo, Thermostats->ThermostatNames[0]) == 0) { // None
     2064      if (Thermostats->ThermostatImplemented[0] == 1) {
     2065        Thermostats->Thermostat = None;
     2066      } else {
     2067        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
     2068        Thermostats->Thermostat = None;
     2069      }
     2070    } else if (strcmp(thermo, Thermostats->ThermostatNames[1]) == 0) { // Woodcock
     2071      if (Thermostats->ThermostatImplemented[1] == 1) {
     2072        Thermostats->Thermostat = Woodcock;
     2073        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read scaling frequency
     2074      } else {
     2075        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
     2076        Thermostats->Thermostat = None;
     2077      }
     2078    } else if (strcmp(thermo, Thermostats->ThermostatNames[2]) == 0) { // Gaussian
     2079      if (Thermostats->ThermostatImplemented[2] == 1) {
     2080        Thermostats->Thermostat = Gaussian;
     2081        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, int_type, &Thermostats->ScaleTempStep, 1, critical); // read collision rate
     2082      } else {
     2083        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
     2084        Thermostats->Thermostat = None;
     2085      }
     2086    } else if (strcmp(thermo, Thermostats->ThermostatNames[3]) == 0) { // Langevin
     2087      if (Thermostats->ThermostatImplemented[3] == 1) {
     2088        Thermostats->Thermostat = Langevin;
     2089        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read gamma
     2090        if (ParseForParameter(verbose,fb,"Thermostat", 0, 3, 1, double_type, &Thermostats->alpha, 1, optional)) {
     2091          DoLog(2) && (Log() << Verbose(2) << "Extended Stochastic Thermostat detected with interpolation coefficient " << Thermostats->alpha << "." << endl);
     2092        } else {
     2093          Thermostats->alpha = 1.;
     2094        }
     2095      } else {
     2096        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
     2097        Thermostats->Thermostat = None;
     2098      }
     2099    } else if (strcmp(thermo, Thermostats->ThermostatNames[4]) == 0) { // Berendsen
     2100      if (Thermostats->ThermostatImplemented[4] == 1) {
     2101        Thermostats->Thermostat = Berendsen;
     2102        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->TempFrequency, 1, critical); // read \tau_T
     2103      } else {
     2104        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
     2105        Thermostats->Thermostat = None;
     2106      }
     2107    } else if (strcmp(thermo, Thermostats->ThermostatNames[5]) == 0) { // Nose-Hoover
     2108      if (Thermostats->ThermostatImplemented[5] == 1) {
     2109        Thermostats->Thermostat = NoseHoover;
     2110        ParseForParameter(verbose,fb,"Thermostat", 0, 2, 1, double_type, &Thermostats->HooverMass, 1, critical); // read Hoovermass
     2111        Thermostats->alpha = 0.;
     2112      } else {
     2113        DoLog(1) && (Log() << Verbose(1) << "Warning: " << Thermostats->ThermostatNames[0] << " thermostat not implemented, falling back to None." << endl);
     2114        Thermostats->Thermostat = None;
     2115      }
     2116    } else {
     2117      DoLog(1) && (Log() << Verbose(1) << " Warning: thermostat name was not understood!" << endl);
     2118      Thermostats->Thermostat = None;
     2119    }
     2120  } else {
     2121    if ((Thermostats->TargetTemp != 0))
     2122      DoLog(2) && (Log() << Verbose(2) <<  "No thermostat chosen despite finite temperature MD, falling back to None." << endl);
     2123    Thermostats->Thermostat = None;
     2124  }
     2125  delete[](thermo);
     2126};
     2127
  • src/config.hpp

    r0d5dce r8f822c  
    2020#include <string>
    2121
    22 #include "bondgraph.hpp"
    23 
    2422/****************************************** forward declarations *****************************/
    2523
     24class BondGraph;
     25class ConfigFileBuffer;
    2626class molecule;
    2727class MoleculeListClass;
    2828class periodentafel;
     29class ThermoStatContainer;
    2930
    3031/********************************************** declarations *******************************/
    31 
    32 class ConfigFileBuffer {
    33   public:
    34     char **buffer;
    35     int *LineMapping;
    36     int CurrentLine;
    37     int NoLines;
    38 
    39     ConfigFileBuffer();
    40     ConfigFileBuffer(const char * const filename);
    41     ~ConfigFileBuffer();
    42 
    43     void InitMapping();
    44     void MapIonTypesInBuffer(const int NoAtoms);
    45 };
    4632
    4733/** The config file.
     
    5137  public:
    5238    class BondGraph *BG;
     39    class ThermoStatContainer *Thermostats;
    5340
    5441    int PsiType;
     
    6047    int ProcPEGamma;
    6148    int ProcPEPsi;
    62     char *configpath;
    6349    char *configname;
    6450    bool FastParsing;
     
    7056    int DoConstrainedMD;
    7157    int MaxOuterStep;
    72     int Thermostat;
    73     int *ThermostatImplemented;
    74     char **ThermostatNames;
    75     double TempFrequency;
    76     double alpha;
    77     double HooverMass;
    78     double TargetTemp;
    79     int ScaleTempStep;
    8058
    8159  private:
     
    138116  void Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList);
    139117  void LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList);
    140   void RetrieveConfigPathAndName(const string filename);
    141118  bool Save(const char * const filename, const periodentafel * const periode, molecule * const mol) const;
    142119  bool SaveMPQC(const char * const filename, const molecule * const mol) const;
     
    152129  char *GetDefaultPath() const;
    153130  void SetDefaultPath(const char * const path);
    154   void InitThermostats();
    155131  void ParseThermostats(class ConfigFileBuffer * const fb);
    156132};
  • src/ellipsoid.cpp

    r0d5dce r8f822c  
    2121#include "tesselation.hpp"
    2222#include "vector.hpp"
     23#include "Matrix.hpp"
    2324#include "verbose.hpp"
    2425
     
    3435  Vector helper, RefPoint;
    3536  double distance = -1.;
    36   double Matrix[NDIM*NDIM];
     37  Matrix Matrix;
    3738  double InverseLength[3];
    3839  double psi,theta,phi; // euler angles in ZX'Z'' convention
     
    5152  theta = EllipsoidAngle[1];
    5253  phi = EllipsoidAngle[2];
    53   Matrix[0] = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi);
    54   Matrix[1] = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi);
    55   Matrix[2] = sin(psi)*sin(theta);
    56   Matrix[3] = sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi);
    57   Matrix[4] = cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi);
    58   Matrix[5] = -cos(psi)*sin(theta);
    59   Matrix[6] = sin(theta)*sin(phi);
    60   Matrix[7] = sin(theta)*cos(phi);
    61   Matrix[8] = cos(theta);
    62   helper.MatrixMultiplication(Matrix);
     54  Matrix.set(0,0, cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi));
     55  Matrix.set(1,0, -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi));
     56  Matrix.set(2,0, sin(psi)*sin(theta));
     57  Matrix.set(0,1, sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi));
     58  Matrix.set(1,1, cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi));
     59  Matrix.set(2,1, -cos(psi)*sin(theta));
     60  Matrix.set(0,2, sin(theta)*sin(phi));
     61  Matrix.set(1,2, sin(theta)*cos(phi));
     62  Matrix.set(2,2, cos(theta));
     63  helper *= Matrix;
    6364  helper.ScaleAll(InverseLength);
    6465  //Log() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl;
     
    7374  phi = -EllipsoidAngle[2];
    7475  helper.ScaleAll(EllipsoidLength);
    75   Matrix[0] = cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi);
    76   Matrix[1] = -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi);
    77   Matrix[2] = sin(psi)*sin(theta);
    78   Matrix[3] = sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi);
    79   Matrix[4] = cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi);
    80   Matrix[5] = -cos(psi)*sin(theta);
    81   Matrix[6] = sin(theta)*sin(phi);
    82   Matrix[7] = sin(theta)*cos(phi);
    83   Matrix[8] = cos(theta);
    84   helper.MatrixMultiplication(Matrix);
     76  Matrix.set(0,0, cos(psi)*cos(phi) - sin(psi)*cos(theta)*sin(phi));
     77  Matrix.set(1,0, -cos(psi)*sin(phi) - sin(psi)*cos(theta)*cos(phi));
     78  Matrix.set(2,0, sin(psi)*sin(theta));
     79  Matrix.set(0,1, sin(psi)*cos(phi) + cos(psi)*cos(theta)*sin(phi));
     80  Matrix.set(1,1, cos(psi)*cos(theta)*cos(phi) - sin(psi)*sin(phi));
     81  Matrix.set(2,1, -cos(psi)*sin(theta));
     82  Matrix.set(0,2, sin(theta)*sin(phi));
     83  Matrix.set(1,2, sin(theta)*cos(phi));
     84  Matrix.set(2,2, cos(theta));
     85  helper *= Matrix;
    8586  //Log() << Verbose(4) << "Intersection is at " << helper << "." << endl;
    8687
  • src/helpers.cpp

    r0d5dce r8f822c  
    117117};
    118118
    119 /** Blows the 6-dimensional \a cell_size array up to a full NDIM by NDIM matrix.
    120  * \param *symm 6-dim array of unique symmetric matrix components
    121  * \return allocated NDIM*NDIM array with the symmetric matrix
    122  */
    123 double * ReturnFullMatrixforSymmetric(const double * const symm)
    124 {
    125   double *matrix = new double[NDIM * NDIM];
    126   matrix[0] = symm[0];
    127   matrix[1] = symm[1];
    128   matrix[2] = symm[3];
    129   matrix[3] = symm[1];
    130   matrix[4] = symm[2];
    131   matrix[5] = symm[4];
    132   matrix[6] = symm[3];
    133   matrix[7] = symm[4];
    134   matrix[8] = symm[5];
    135   return matrix;
    136 };
    137 
    138 /** Calculate the inverse of a 3x3 matrix.
    139  * \param *matrix NDIM_NDIM array
    140  */
    141 double * InverseMatrix( const double * const A)
    142 {
    143   double *B = new double[NDIM * NDIM];
    144   double detA = RDET3(A);
    145   double detAReci;
    146 
    147   for (int i=0;i<NDIM*NDIM;++i)
    148     B[i] = 0.;
    149   // calculate the inverse B
    150   if (fabs(detA) > MYEPSILON) {;  // RDET3(A) yields precisely zero if A irregular
    151     detAReci = 1./detA;
    152     B[0] =  detAReci*RDET2(A[4],A[5],A[7],A[8]);    // A_11
    153     B[1] = -detAReci*RDET2(A[1],A[2],A[7],A[8]);    // A_12
    154     B[2] =  detAReci*RDET2(A[1],A[2],A[4],A[5]);    // A_13
    155     B[3] = -detAReci*RDET2(A[3],A[5],A[6],A[8]);    // A_21
    156     B[4] =  detAReci*RDET2(A[0],A[2],A[6],A[8]);    // A_22
    157     B[5] = -detAReci*RDET2(A[0],A[2],A[3],A[5]);    // A_23
    158     B[6] =  detAReci*RDET2(A[3],A[4],A[6],A[7]);    // A_31
    159     B[7] = -detAReci*RDET2(A[0],A[1],A[6],A[7]);    // A_32
    160     B[8] =  detAReci*RDET2(A[0],A[1],A[3],A[4]);    // A_33
    161   }
    162   return B;
    163 };
    164 
    165 
    166 
    167119/** Comparison function for GSL heapsort on distances in two molecules.
    168120 * \param *a
  • src/helpers.hpp

    r0d5dce r8f822c  
    5252bool IsValidNumber( const char *string);
    5353int CompareDoubles (const void * a, const void * b);
    54 double * ReturnFullMatrixforSymmetric(const double * const cell_size);
    55 double * InverseMatrix(const double * const A);
    5654void performCriticalExit();
    5755
  • src/molecule.cpp

    r0d5dce r8f822c  
    99#include <cstring>
    1010#include <boost/bind.hpp>
     11#include <boost/foreach.hpp>
    1112
    1213#include "World.hpp"
     
    2728#include "tesselation.hpp"
    2829#include "vector.hpp"
     30#include "Matrix.hpp"
    2931#include "World.hpp"
     32#include "Box.hpp"
    3033#include "Plane.hpp"
    3134#include "Exceptions/LinearDependenceException.hpp"
     
    7982void molecule::setName(const std::string _name){
    8083  OBSERVE;
     84  cout << "Set name of molecule " << getId() << " to " << _name << endl;
    8185  strncpy(name,_name.c_str(),MAXSTRINGSIZE);
    8286}
     
    154158molecule::const_iterator molecule::erase( atom * key )
    155159{
    156   cout << "trying to erase atom" << endl;
    157160  molecule::const_iterator iter = find(key);
    158161  if (iter != end()){
     
    284287  Vector Orthovector1, Orthovector2;  // temporary vectors in coordination construction
    285288  Vector InBondvector;    // vector in direction of *Bond
    286   double *matrix = NULL;
     289  const Matrix &matrix =  World::getInstance().getDomain().getM();
    287290  bond *Binder = NULL;
    288   double * const cell_size = World::getInstance().getDomain();
    289291
    290292//  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
     
    307309      } // (signs are correct, was tested!)
    308310    }
    309     matrix = ReturnFullMatrixforSymmetric(cell_size);
    310     Orthovector1.MatrixMultiplication(matrix);
     311    Orthovector1 *= matrix;
    311312    InBondvector -= Orthovector1; // subtract just the additional translation
    312     delete[](matrix);
    313313    bondlength = InBondvector.Norm();
    314314//    Log() << Verbose(4) << "Corrected InBondvector is now: ";
     
    541541      break;
    542542  }
    543   delete[](matrix);
    544543
    545544//  Log() << Verbose(3) << "End of AddHydrogenReplacementAtom." << endl;
     
    660659 * @param three vectors forming the matrix that defines the shape of the parallelpiped
    661660 */
    662 molecule* molecule::CopyMoleculeFromSubRegion(const Vector offset, const double *parallelepiped) const {
     661molecule* molecule::CopyMoleculeFromSubRegion(const Vector offset, const Matrix &parallelepiped) const {
    663662  molecule *copy = World::getInstance().createMolecule();
    664663
    665   ActOnCopyWithEachAtomIfTrue ( &molecule::AddCopyAtom, copy, &atom::IsInParallelepiped, offset, parallelepiped );
     664  BOOST_FOREACH(atom *iter,atoms){
     665    if(iter->IsInParallelepiped(offset,parallelepiped)){
     666      copy->AddCopyAtom(iter);
     667    }
     668  }
    666669
    667670  //TODO: copy->BuildInducedSubgraph(this);
     
    740743  else
    741744    length = strlen(molname) - strlen(endname);
     745  cout << "Set name of molecule " << getId() << " to " << molname << endl;
    742746  strncpy(name, molname, length);
    743747  name[length]='\0';
     
    749753void molecule::SetBoxDimension(Vector *dim)
    750754{
    751   double * const cell_size = World::getInstance().getDomain();
    752   cell_size[0] = dim->at(0);
    753   cell_size[1] = 0.;
    754   cell_size[2] = dim->at(1);
    755   cell_size[3] = 0.;
    756   cell_size[4] = 0.;
    757   cell_size[5] = dim->at(2);
     755  Matrix domain;
     756  for(int i =0; i<NDIM;++i)
     757    domain.at(i,i) = dim->at(i);
     758  World::getInstance().setDomain(domain);
    758759};
    759760
     
    848849bool molecule::CheckBounds(const Vector *x) const
    849850{
    850   double * const cell_size = World::getInstance().getDomain();
     851  const Matrix &domain = World::getInstance().getDomain().getM();
    851852  bool result = true;
    852   int j =-1;
    853853  for (int i=0;i<NDIM;i++) {
    854     j += i+1;
    855     result = result && ((x->at(i) >= 0) && (x->at(i) < cell_size[j]));
     854    result = result && ((x->at(i) >= 0) && (x->at(i) < domain.at(i,i)));
    856855  }
    857856  //return result;
     
    881880        ElementNo[i] = current++;
    882881    }
    883     ActOnAllAtoms( &atom::OutputArrayIndexed, output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL );
     882    ActOnAllAtoms( &atom::OutputArrayIndexed, (ostream * const) output, (const int *)ElementNo, (int *)AtomNo, (const char *) NULL );
    884883    return true;
    885884  }
     
    10041003  for(int i=MAX_ELEMENTS;i--;)
    10051004    ElementCount += (ElementsInMolecule[i] != 0 ? 1 : 0);
    1006 };
    1007 
    1008 
    1009 /** Counts necessary number of valence electrons and returns number and SpinType.
    1010  * \param configuration containing everything
    1011  */
    1012 void molecule::CalculateOrbitals(class config &configuration)
    1013 {
    1014   configuration.MaxPsiDouble = configuration.PsiMaxNoDown = configuration.PsiMaxNoUp = configuration.PsiType = 0;
    1015   for(int i=MAX_ELEMENTS;i--;) {
    1016     if (ElementsInMolecule[i] != 0) {
    1017       //Log() << Verbose(0) << "CalculateOrbitals: " << elemente->FindElement(i)->name << " has a valence of " << (int)elemente->FindElement(i)->Valence << " and there are " << ElementsInMolecule[i] << " of it." << endl;
    1018       configuration.MaxPsiDouble += ElementsInMolecule[i]*((int)elemente->FindElement(i)->Valence);
    1019     }
    1020   }
    1021   configuration.PsiMaxNoDown = configuration.MaxPsiDouble/2 + (configuration.MaxPsiDouble % 2);
    1022   configuration.PsiMaxNoUp = configuration.MaxPsiDouble/2;
    1023   configuration.MaxPsiDouble /= 2;
    1024   configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1;
    1025   if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) {
    1026     configuration.ProcPEGamma /= 2;
    1027     configuration.ProcPEPsi *= 2;
    1028   } else {
    1029     configuration.ProcPEGamma *= configuration.ProcPEPsi;
    1030     configuration.ProcPEPsi = 1;
    1031   }
    1032   cout << configuration.PsiMaxNoDown << ">" << configuration.PsiMaxNoUp << endl;
    1033   if (configuration.PsiMaxNoDown > configuration.PsiMaxNoUp) {
    1034     configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoDown;
    1035     cout << configuration.PsiMaxNoDown << " " << configuration.InitMaxMinStopStep << endl;
    1036   } else {
    1037     configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoUp;
    1038     cout << configuration.PsiMaxNoUp << " " << configuration.InitMaxMinStopStep << endl;
    1039   }
    10401005};
    10411006
  • src/molecule.hpp

    r0d5dce r8f822c  
    8080  double *PenaltyConstants;   //!<  penalty constant in front of each term
    8181};
    82 
    83 #define MaxThermostats 6      //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
    84 enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover };   //!< Thermostat names for output
    85 
    8682
    8783/** The complete molecule.
     
    265261  /// Count and change present atoms' coordination.
    266262  void CountElements();
    267   void CalculateOrbitals(class config &configuration);
    268263  bool CenterInBox();
    269264  bool BoundInBox();
     
    292287  double MinimiseConstrainedPotential(atom **&permutation, int startstep, int endstep, bool IsAngstroem);
    293288  void EvaluateConstrainedForces(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
    294   bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, const char *prefix, config &configuration, bool MapByIdentity);
     289  bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity);
    295290       
    296291  bool CheckBounds(const Vector *x) const;
     
    321316
    322317  molecule *CopyMolecule();
    323   molecule* CopyMoleculeFromSubRegion(const Vector offset, const double *parallelepiped) const;
     318  molecule* CopyMoleculeFromSubRegion(const Vector offset, const Matrix &parallelepiped) const;
    324319
    325320  /// Fragment molecule by two different approaches:
    326   int FragmentMolecule(int Order, config *configuration);
    327   bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path = NULL);
    328   bool StoreBondsToFile(char *path, char *filename);
    329   bool StoreAdjacencyToFile(char *path, char *filename);
    330   bool CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms);
    331   bool ParseOrderAtSiteFromFile(char *path);
    332   bool StoreOrderAtSiteFile(char *path);
    333   bool StoreForcesFile(MoleculeListClass *BondFragments, char *path, int *SortIndex);
     321  int FragmentMolecule(int Order, std::string &prefix);
     322  bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, std::string path = "");
     323  bool StoreBondsToFile(std::string &filename, std::string path = "");
     324  bool StoreAdjacencyToFile(std::string &filename, std::string path = "");
     325  bool CheckAdjacencyFileAgainstMolecule(std::string &path, atom **ListOfAtoms);
     326  bool ParseOrderAtSiteFromFile(std::string &path);
     327  bool StoreOrderAtSiteFile(std::string &path);
     328  bool StoreForcesFile(MoleculeListClass *BondFragments, std::string &path, int *SortIndex);
    334329  bool CreateMappingLabelsToConfigSequence(int *&SortIndex);
    335330  bool CreateFatherLookupTable(atom **&LookupTable, int count = 0);
     
    380375  ~MoleculeListClass();
    381376
    382   bool AddHydrogenCorrection(char *path);
    383   bool StoreForcesFile(char *path, int *SortIndex);
     377  bool AddHydrogenCorrection(std::string &path);
     378  bool StoreForcesFile(std::string &path, int *SortIndex);
    384379  void insert(molecule *mol);
    385380  void erase(molecule *mol);
    386381  molecule * ReturnIndex(int index);
    387   bool OutputConfigForListOfFragments(config *configuration, int *SortIndex);
     382  bool OutputConfigForListOfFragments(std::string &prefix, int *SortIndex);
    388383  int NumberOfActiveMolecules();
    389384  void Enumerate(ostream *out);
  • src/molecule_dynamics.cpp

    r0d5dce r8f822c  
    1818#include "parser.hpp"
    1919#include "Plane.hpp"
     20#include "ThermoStatContainer.hpp"
    2021
    2122/************************************* Functions for class molecule *********************************/
     
    472473 * \param startstep stating initial configuration in molecule::Trajectories
    473474 * \param endstep stating final configuration in molecule::Trajectories
     475 * \param &prefix path and prefix
    474476 * \param &config configuration structure
    475477 * \param MapByIdentity if true we just use the identity to map atoms in start config to end config, if not we find mapping by \sa MinimiseConstrainedPotential()
    476478 * \return true - success in writing step files, false - error writing files or only one step in molecule::Trajectories
    477479 */
    478 bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, const char *prefix, config &configuration, bool MapByIdentity)
     480bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity)
    479481{
    480482  molecule *mol = NULL;
     
    524526  for (int i=getAtomCount(); i--; )
    525527    SortIndex[i] = i;
    526   status = MoleculePerStep->OutputConfigForListOfFragments(&configuration, SortIndex);
     528
     529  status = MoleculePerStep->OutputConfigForListOfFragments(prefix, SortIndex);
    527530  delete[](SortIndex);
    528531
     
    643646
    644647  // calculate scale configuration
    645   ScaleTempFactor = configuration.TargetTemp/ActualTemp;
     648  ScaleTempFactor = configuration.Thermostats->TargetTemp/ActualTemp;
    646649
    647650  // differentating between the various thermostats
     
    651654      break;
    652655     case Woodcock:
    653       if ((configuration.ScaleTempStep > 0) && ((MDSteps-1) % configuration.ScaleTempStep == 0)) {
     656      if ((configuration.Thermostats->ScaleTempStep > 0) && ((MDSteps-1) % configuration.Thermostats->ScaleTempStep == 0)) {
    654657        DoLog(2) && (Log() << Verbose(2) <<  "Applying Woodcock thermostat..." << endl);
    655658        ActOnAllAtoms( &atom::Thermostat_Woodcock, sqrt(ScaleTempFactor), MDSteps, &ekin );
     
    684687      delta_alpha = 0.;
    685688      ActOnAllAtoms( &atom::Thermostat_NoseHoover_init, MDSteps, &delta_alpha );
    686       delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass);
    687       configuration.alpha += delta_alpha*configuration.Deltat;
    688       DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.alpha << "." << endl);
     689      delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.Thermostats->TargetTemp)/(configuration.Thermostats->HooverMass*Units2Electronmass);
     690      configuration.Thermostats->alpha += delta_alpha*configuration.Deltat;
     691      DoLog(3) && (Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.Thermostats->alpha << "." << endl);
    689692      // apply updated alpha as additional force
    690693      ActOnAllAtoms( &atom::Thermostat_NoseHoover_scale, MDSteps, &ekin, &configuration );
  • src/molecule_fragmentation.cpp

    r0d5dce r8f822c  
    2222#include "periodentafel.hpp"
    2323#include "World.hpp"
     24#include "Matrix.hpp"
     25#include "Box.hpp"
    2426
    2527/************************************* Functions for class molecule *********************************/
     
    8284 * -# Scans TEFactors file and sets the TEFactor of each key set in the temporary graph accordingly
    8385 * Finally, the temporary graph is inserted into the given \a FragmentList for return.
    84  * \param *out output stream for debugging
    85  * \param *path path to file
     86 * \param &path path to file
    8687 * \param *FragmentList empty, filled on return
    8788 * \return true - parsing successfully, false - failure on parsing (FragmentList will be NULL)
    8889 */
    89 bool ParseKeySetFile(char *path, Graph *&FragmentList)
     90bool ParseKeySetFile(std::string &path, Graph *&FragmentList)
    9091{
    9192  bool status = true;
     
    9495  GraphTestPair testGraphInsert;
    9596  int NumberOfFragments = 0;
    96   char filename[MAXSTRINGSIZE];
     97  string filename;
    9798
    9899  if (FragmentList == NULL) { // check list pointer
     
    102103  // 1st pass: open file and read
    103104  DoLog(1) && (Log() << Verbose(1) << "Parsing the KeySet file ... " << endl);
    104   sprintf(filename, "%s/%s%s", path, FRAGMENTPREFIX, KEYSETFILE);
    105   InputFile.open(filename);
    106   if (InputFile != NULL) {
     105  filename = path + KEYSETFILE;
     106  InputFile.open(filename.c_str());
     107  if (InputFile.good()) {
    107108    // each line represents a new fragment
    108109    char buffer[MAXSTRINGSIZE];
     
    181182
    182183/** Stores key sets to file.
    183  * \param *out output stream for debugging
    184184 * \param KeySetList Graph with Keysets
    185  * \param *path path to file
     185 * \param &path path to file
    186186 * \return true - file written successfully, false - writing failed
    187187 */
    188 bool StoreKeySetFile(Graph &KeySetList, char *path)
    189 {
    190   ofstream output;
     188bool StoreKeySetFile(Graph &KeySetList, std::string &path)
     189{
    191190  bool status =  true;
    192   string line;
     191  string line = path + KEYSETFILE;
     192  ofstream output(line.c_str());
    193193
    194194  // open KeySet file
    195   line = path;
    196   line.append("/");
    197   line += FRAGMENTPREFIX;
    198   line += KEYSETFILE;
    199   output.open(line.c_str(), ios::out);
    200195  DoLog(1) && (Log() << Verbose(1) << "Saving key sets of the total graph ... ");
    201   if(output != NULL) {
     196  if(output.good()) {
    202197    for(Graph::iterator runner = KeySetList.begin(); runner != KeySetList.end(); runner++) {
    203198      for (KeySet::iterator sprinter = (*runner).first.begin();sprinter != (*runner).first.end(); sprinter++) {
     
    302297
    303298/** Scans the adaptive order file and insert (index, value) into map.
    304  * \param *out output stream for debugging
    305  * \param *path path to ENERGYPERFRAGMENT file (may be NULL if Order is non-negative)
     299 * \param &path path to ENERGYPERFRAGMENT file (may be NULL if Order is non-negative)
    306300 * \param &IndexedKeySetList list to find key set for a given index \a No
    307301 * \return adaptive criteria list from file
    308302 */
    309 map<int, pair<double,int> > * ScanAdaptiveFileIntoMap(char *path, map<int,KeySet> &IndexKeySetList)
     303map<int, pair<double,int> > * ScanAdaptiveFileIntoMap(std::string &path, map<int,KeySet> &IndexKeySetList)
    310304{
    311305  map<int, pair<double,int> > *AdaptiveCriteriaList = new map<int, pair<double,int> >;
     
    313307  double Value = 0.;
    314308  char buffer[MAXSTRINGSIZE];
    315   sprintf(buffer, "%s/%s%s.dat", path, FRAGMENTPREFIX, ENERGYPERFRAGMENT);
    316   ifstream InputFile(buffer, ios::in);
     309  string filename = path + ENERGYPERFRAGMENT;
     310  ifstream InputFile(filename.c_str());
     311
     312  if (InputFile.fail()) {
     313    DoeLog(1) && (eLog() << Verbose(1) << "Cannot find file " << filename << "." << endl);
     314    return AdaptiveCriteriaList;
     315  }
    317316
    318317  if (CountLinesinFile(InputFile) > 0) {
     
    419418
    420419/** Checks whether the OrderAtSite is still below \a Order at some site.
    421  * \param *out output stream for debugging
    422420 * \param *AtomMask defines true/false per global Atom::nr to mask in/out each nuclear site, used to activate given number of site to increment order adaptively
    423421 * \param *GlobalKeySetList list of keysets with global ids (valid in "this" molecule) needed for adaptive increase
    424422 * \param Order desired Order if positive, desired exponent in threshold criteria if negative (0 is single-step)
    425423 * \param *MinimumRingSize array of max. possible order to avoid loops
    426  * \param *path path to ENERGYPERFRAGMENT file (may be NULL if Order is non-negative)
     424 * \param path path to ENERGYPERFRAGMENT file (may be NULL if Order is non-negative)
    427425 * \return true - needs further fragmentation, false - does not need fragmentation
    428426 */
    429 bool molecule::CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, char *path)
     427bool molecule::CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, std::string path)
    430428{
    431429  bool status = false;
     
    585583 * of vertex indices: Global always means the index in "this" molecule, whereas local refers to the molecule or
    586584 * subgraph in the MoleculeListClass.
    587  * \param *out output stream for debugging
    588585 * \param Order up to how many neighbouring bonds a fragment contains in BondOrderScheme::BottumUp scheme
    589  * \param *configuration configuration for writing config files for each fragment
     586 * \param &prefix path and prefix of the bond order configs to be written
    590587 * \return 1 - continue, 2 - stop (no fragmentation occured)
    591588 */
    592 int molecule::FragmentMolecule(int Order, config *configuration)
     589int molecule::FragmentMolecule(int Order, std::string &prefix)
    593590{
    594591  MoleculeListClass *BondFragments = NULL;
     
    624621
    625622  // === compare it with adjacency file ===
    626   FragmentationToDo = FragmentationToDo && CheckAdjacencyFileAgainstMolecule(configuration->configpath, ListOfAtoms);
     623  FragmentationToDo = FragmentationToDo && CheckAdjacencyFileAgainstMolecule(prefix, ListOfAtoms);
    627624  delete[](ListOfAtoms);
    628625
     
    658655
    659656  // ===== 3. if structure still valid, parse key set file and others =====
    660   FragmentationToDo = FragmentationToDo && ParseKeySetFile(configuration->configpath, ParsedFragmentList);
     657  FragmentationToDo = FragmentationToDo && ParseKeySetFile(prefix, ParsedFragmentList);
    661658
    662659  // ===== 4. check globally whether there's something to do actually (first adaptivity check)
    663   FragmentationToDo = FragmentationToDo && ParseOrderAtSiteFromFile(configuration->configpath);
     660  FragmentationToDo = FragmentationToDo && ParseOrderAtSiteFromFile(prefix);
    664661
    665662  // =================================== Begin of FRAGMENTATION ===============================
     
    672669  AtomMask[getAtomCount()] = false;
    673670  FragmentationToDo = false;  // if CheckOrderAtSite just ones recommends fragmentation, we will save fragments afterwards
    674   while ((CheckOrder = CheckOrderAtSite(AtomMask, ParsedFragmentList, Order, MinimumRingSize, configuration->configpath))) {
     671  while ((CheckOrder = CheckOrderAtSite(AtomMask, ParsedFragmentList, Order, MinimumRingSize, prefix))) {
    675672    FragmentationToDo = FragmentationToDo || CheckOrder;
    676673    AtomMask[getAtomCount()] = true;   // last plus one entry is used as marker that we have been through this loop once already in CheckOrderAtSite()
     
    727724    KeySet test = (*runner).first;
    728725    DoLog(0) && (Log() << Verbose(0) << "Fragment No." << (*runner).second.first << " with TEFactor " << (*runner).second.second << "." << endl);
    729     BondFragments->insert(StoreFragmentFromKeySet(test, configuration));
     726    BondFragments->insert(StoreFragmentFromKeySet(test, World::getInstance().getConfig()));
    730727    k++;
    731728  }
     
    739736
    740737    DoLog(1) && (Log() << Verbose(1) << "Writing " << BondFragments->ListOfMolecules.size() << " possible bond fragmentation configs" << endl);
    741     if (BondFragments->OutputConfigForListOfFragments(configuration, SortIndex))
     738    if (BondFragments->OutputConfigForListOfFragments(prefix, SortIndex))
    742739      DoLog(1) && (Log() << Verbose(1) << "All configs written." << endl);
    743740    else
     
    745742
    746743    // store force index reference file
    747     BondFragments->StoreForcesFile(configuration->configpath, SortIndex);
     744    BondFragments->StoreForcesFile(prefix, SortIndex);
    748745
    749746    // store keysets file
    750     StoreKeySetFile(TotalGraph, configuration->configpath);
     747    StoreKeySetFile(TotalGraph, prefix);
    751748
    752749    {
    753750      // store Adjacency file
    754       char filename[MAXSTRINGSIZE];
    755       strcpy(filename, FRAGMENTPREFIX);
    756       strcat(filename, ADJACENCYFILE);
    757       StoreAdjacencyToFile(configuration->configpath, filename);
     751      std::string filename = prefix + ADJACENCYFILE;
     752      StoreAdjacencyToFile(filename);
    758753    }
    759754
    760755    // store Hydrogen saturation correction file
    761     BondFragments->AddHydrogenCorrection(configuration->configpath);
     756    BondFragments->AddHydrogenCorrection(prefix);
    762757
    763758    // store adaptive orders into file
    764     StoreOrderAtSiteFile(configuration->configpath);
     759    StoreOrderAtSiteFile(prefix);
    765760
    766761    // restore orbital and Stop values
    767     CalculateOrbitals(*configuration);
     762    //CalculateOrbitals(*configuration);
    768763
    769764    // free memory for bond part
     
    782777/** Stores pairs (Atom::nr, Atom::AdaptiveOrder) into file.
    783778 * Atoms not present in the file get "-1".
    784  * \param *out output stream for debugging
    785  * \param *path path to file ORDERATSITEFILE
     779 * \param &path path to file ORDERATSITEFILE
    786780 * \return true - file writable, false - not writable
    787781 */
    788 bool molecule::StoreOrderAtSiteFile(char *path)
    789 {
    790   stringstream line;
     782bool molecule::StoreOrderAtSiteFile(std::string &path)
     783{
     784  string line;
    791785  ofstream file;
    792786
    793   line << path << "/" << FRAGMENTPREFIX << ORDERATSITEFILE;
    794   file.open(line.str().c_str());
     787  line = path + ORDERATSITEFILE;
     788  file.open(line.c_str());
    795789  DoLog(1) && (Log() << Verbose(1) << "Writing OrderAtSite " << ORDERATSITEFILE << " ... " << endl);
    796   if (file != NULL) {
     790  if (file.good()) {
    797791    ActOnAllAtoms( &atom::OutputOrder, &file );
    798792    file.close();
     
    800794    return true;
    801795  } else {
    802     DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
     796    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line << "." << endl);
    803797    return false;
    804798  }
     
    807801/** Parses pairs(Atom::nr, Atom::AdaptiveOrder) from file and stores in molecule's Atom's.
    808802 * Atoms not present in the file get "0".
    809  * \param *out output stream for debugging
    810  * \param *path path to file ORDERATSITEFILEe
     803 * \param &path path to file ORDERATSITEFILEe
    811804 * \return true - file found and scanned, false - file not found
    812805 * \sa ParseKeySetFile() and CheckAdjacencyFileAgainstMolecule() as this is meant to be used in conjunction with the two
    813806 */
    814 bool molecule::ParseOrderAtSiteFromFile(char *path)
     807bool molecule::ParseOrderAtSiteFromFile(std::string &path)
    815808{
    816809  unsigned char *OrderArray = new unsigned char[getAtomCount()];
     
    818811  bool status;
    819812  int AtomNr, value;
    820   stringstream line;
     813  string line;
    821814  ifstream file;
    822815
     
    827820
    828821  DoLog(1) && (Log() << Verbose(1) << "Begin of ParseOrderAtSiteFromFile" << endl);
    829   line << path << "/" << FRAGMENTPREFIX << ORDERATSITEFILE;
    830   file.open(line.str().c_str());
    831   if (file != NULL) {
     822  line = path + ORDERATSITEFILE;
     823  file.open(line.c_str());
     824  if (file.good()) {
    832825    while (!file.eof()) { // parse from file
    833826      AtomNr = -1;
     
    850843    status = true;
    851844  } else {
    852     DoLog(1) && (Log() << Verbose(1) << "\t ... failed to open file " << line.str() << "." << endl);
     845    DoLog(1) && (Log() << Verbose(1) << "\t ... failed to open file " << line << "." << endl);
    853846    status = false;
    854847  }
     
    17171710  atom *Walker = NULL;
    17181711  atom *OtherWalker = NULL;
    1719   double * const cell_size = World::getInstance().getDomain();
    1720   double *matrix = ReturnFullMatrixforSymmetric(cell_size);
     1712  Matrix matrix = World::getInstance().getDomain().getM();
    17211713  enum Shading *ColorList = NULL;
    17221714  double tmp;
     
    17581750          Translationvector[i] = (tmp < 0) ? +1. : -1.;
    17591751      }
    1760       Translationvector.MatrixMultiplication(matrix);
     1752      Translationvector *= matrix;
    17611753      //Log() << Verbose(3) << "Translation vector is ";
    17621754      Log() << Verbose(0) << Translationvector <<  endl;
     
    17891781  delete(AtomStack);
    17901782  delete[](ColorList);
    1791   delete[](matrix);
    17921783  DoLog(2) && (Log() << Verbose(2) << "End of ScanForPeriodicCorrection." << endl);
    17931784};
  • src/molecule_geometry.cpp

    r0d5dce r8f822c  
    1919#include "World.hpp"
    2020#include "Plane.hpp"
     21#include "Matrix.hpp"
     22#include "Box.hpp"
    2123#include <boost/foreach.hpp>
    2224
     
    3335  const Vector *Center = DetermineCenterOfAll();
    3436  const Vector *CenterBox = DetermineCenterOfBox();
    35   double * const cell_size = World::getInstance().getDomain();
    36   double *M = ReturnFullMatrixforSymmetric(cell_size);
    37   double *Minv = InverseMatrix(M);
     37  Box &domain = World::getInstance().getDomain();
    3838
    3939  // go through all atoms
    4040  ActOnAllVectors( &Vector::SubtractVector, *Center);
    4141  ActOnAllVectors( &Vector::SubtractVector, *CenterBox);
    42   ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv);
    43 
    44   delete[](M);
    45   delete[](Minv);
     42  BOOST_FOREACH(atom* iter, atoms){
     43    *iter->node = domain.WrapPeriodically(*iter->node);
     44  }
     45
    4646  delete(Center);
    4747  return status;
     
    5555{
    5656  bool status = true;
    57   double * const cell_size = World::getInstance().getDomain();
    58   double *M = ReturnFullMatrixforSymmetric(cell_size);
    59   double *Minv = InverseMatrix(M);
     57  Box &domain = World::getInstance().getDomain();
    6058
    6159  // go through all atoms
    62   ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv);
    63 
    64   delete[](M);
    65   delete[](Minv);
     60  BOOST_FOREACH(atom* iter, atoms){
     61    *iter->node = domain.WrapPeriodically(*iter->node);
     62  }
     63
    6664  return status;
    6765};
     
    152150{
    153151  Vector *a = new Vector(0.5,0.5,0.5);
    154 
    155   const double *cell_size = World::getInstance().getDomain();
    156   double *M = ReturnFullMatrixforSymmetric(cell_size);
    157   a->MatrixMultiplication(M);
    158   delete[](M);
    159 
     152  const Matrix &M = World::getInstance().getDomain().getM();
     153  (*a) *= M;
    160154  return a;
    161155};
     
    243237void molecule::TranslatePeriodically(const Vector *trans)
    244238{
    245   double * const cell_size = World::getInstance().getDomain();
    246   double *M = ReturnFullMatrixforSymmetric(cell_size);
    247   double *Minv = InverseMatrix(M);
     239  Box &domain = World::getInstance().getDomain();
    248240
    249241  // go through all atoms
    250242  ActOnAllVectors( &Vector::AddVector, *trans);
    251   ActOnAllVectors( &Vector::WrapPeriodically, (const double *)M, (const double *)Minv);
    252 
    253   delete[](M);
    254   delete[](Minv);
     243  BOOST_FOREACH(atom* iter, atoms){
     244    *iter->node = domain.WrapPeriodically(*iter->node);
     245  }
     246
    255247};
    256248
     
    263255  OBSERVE;
    264256  Plane p(*n,0);
    265   BOOST_FOREACH( atom* iter, atoms ){
     257  BOOST_FOREACH(atom* iter, atoms ){
    266258    (*iter->node) = p.mirrorVector(*iter->node);
    267259  }
     
    273265void molecule::DeterminePeriodicCenter(Vector &center)
    274266{
    275   double * const cell_size = World::getInstance().getDomain();
    276   double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    277   double *inversematrix = InverseMatrix(matrix);
     267  const Matrix &matrix = World::getInstance().getDomain().getM();
     268  const Matrix &inversematrix = World::getInstance().getDomain().getM();
    278269  double tmp;
    279270  bool flag;
     
    287278      if ((*iter)->type->Z != 1) {
    288279#endif
    289         Testvector = (*iter)->x;
    290         Testvector.MatrixMultiplication(inversematrix);
     280        Testvector = inversematrix * (*iter)->x;
    291281        Translationvector.Zero();
    292282        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
     
    305295        }
    306296        Testvector += Translationvector;
    307         Testvector.MatrixMultiplication(matrix);
     297        Testvector *= matrix;
    308298        Center += Testvector;
    309299        Log() << Verbose(1) << "vector is: " << Testvector << endl;
     
    312302        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    313303          if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
    314             Testvector = (*Runner)->GetOtherAtom((*iter))->x;
    315             Testvector.MatrixMultiplication(inversematrix);
     304            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->x;
    316305            Testvector += Translationvector;
    317             Testvector.MatrixMultiplication(matrix);
     306            Testvector *= matrix;
    318307            Center += Testvector;
    319308            Log() << Verbose(1) << "Hydrogen vector is: " << Testvector << endl;
     
    324313    }
    325314  } while (!flag);
    326   delete[](matrix);
    327   delete[](inversematrix);
    328315
    329316  Center.Scale(1./static_cast<double>(getAtomCount()));
     
    387374    DoLog(1) && (Log() << Verbose(1) << "Transforming molecule into PAS ... ");
    388375    // the eigenvectors specify the transformation matrix
    389     ActOnAllVectors( &Vector::MatrixMultiplication, (const double *) evec->data );
     376    Matrix M = Matrix(evec->data);
     377    BOOST_FOREACH(atom* iter, atoms){
     378      (*iter->node) *= M;
     379    }
    390380    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    391381
  • src/molecule_graph.cpp

    r0d5dce r8f822c  
    1212#include "bondgraph.hpp"
    1313#include "config.hpp"
     14#include "defs.hpp"
    1415#include "element.hpp"
    1516#include "helpers.hpp"
     
    2324#include "Helpers/fast_functions.hpp"
    2425#include "Helpers/Assert.hpp"
     26#include "Matrix.hpp"
     27#include "Box.hpp"
    2528
    2629
     
    120123  LinkedCell *LC = NULL;
    121124  bool free_BG = false;
    122   double * const cell_size = World::getInstance().getDomain();
     125  Box &domain = World::getInstance().getDomain();
    123126
    124127  if (BG == NULL) {
     
    177180                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    178181                          (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    179                           const double distance = OtherWalker->x.PeriodicDistanceSquared(Walker->x,cell_size);
     182                          const double distance = domain.periodicDistanceSquared(OtherWalker->x,Walker->x);
    180183                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
    181184//                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
     
    10241027/** Storing the bond structure of a molecule to file.
    10251028 * Simply stores Atom::nr and then the Atom::nr of all bond partners per line.
    1026  * \param *path path to file
    1027  * \param *filename name of file
     1029 * \param &filename name of file
     1030 * \param path path to file, defaults to empty
    10281031 * \return true - file written successfully, false - writing failed
    10291032 */
    1030 bool molecule::StoreAdjacencyToFile(char *path, char *filename)
     1033bool molecule::StoreAdjacencyToFile(std::string &filename, std::string path)
    10311034{
    10321035  ofstream AdjacencyFile;
    1033   stringstream line;
     1036  string line;
    10341037  bool status = true;
    10351038
    1036   if (path != NULL)
    1037     line << path << "/" << filename;
     1039  if (path != "")
     1040    line = path + "/" + filename;
    10381041  else
    1039     line << filename;
    1040   AdjacencyFile.open(line.str().c_str(), ios::out);
     1042    line = filename;
     1043  AdjacencyFile.open(line.c_str(), ios::out);
    10411044  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl);
    1042   if (AdjacencyFile != NULL) {
     1045  if (AdjacencyFile.good()) {
    10431046    AdjacencyFile << "m\tn" << endl;
    10441047    ActOnAllAtoms(&atom::OutputAdjacency, &AdjacencyFile);
     
    10461049    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
    10471050  } else {
    1048     DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line.str() << "." << endl);
     1051    DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line << "." << endl);
    10491052    status = false;
    10501053  }
     
    10561059/** Storing the bond structure of a molecule to file.
    10571060 * Simply stores Atom::nr and then the Atom::nr of all bond partners, one per line.
    1058  * \param *path path to file
    1059  * \param *filename name of file
     1061 * \param &filename name of file
     1062 * \param path path to file, defaults to empty
    10601063 * \return true - file written successfully, false - writing failed
    10611064 */
    1062 bool molecule::StoreBondsToFile(char *path, char *filename)
     1065bool molecule::StoreBondsToFile(std::string &filename, std::string path)
    10631066{
    10641067  ofstream BondFile;
    1065   stringstream line;
     1068  string line;
    10661069  bool status = true;
    10671070
    1068   if (path != NULL)
    1069     line << path << "/" << filename;
     1071  if (path != "")
     1072    line = path + "/" + filename;
    10701073  else
    1071     line << filename;
    1072   BondFile.open(line.str().c_str(), ios::out);
     1074    line = filename;
     1075  BondFile.open(line.c_str(), ios::out);
    10731076  DoLog(1) && (Log() << Verbose(1) << "Saving adjacency list ... " << endl);
    1074   if (BondFile != NULL) {
     1077  if (BondFile.good()) {
    10751078    BondFile << "m\tn" << endl;
    10761079    ActOnAllAtoms(&atom::OutputBonds, &BondFile);
     
    10781081    DoLog(1) && (Log() << Verbose(1) << "\t... done." << endl);
    10791082  } else {
    1080     DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line.str() << "." << endl);
     1083    DoLog(1) && (Log() << Verbose(1) << "\t... failed to open file " << line << "." << endl);
    10811084    status = false;
    10821085  }
     
    10861089;
    10871090
    1088 bool CheckAdjacencyFileAgainstMolecule_Init(char *path, ifstream &File, int *&CurrentBonds)
    1089 {
    1090   stringstream filename;
    1091   filename << path << "/" << FRAGMENTPREFIX << ADJACENCYFILE;
    1092   File.open(filename.str().c_str(), ios::out);
     1091bool CheckAdjacencyFileAgainstMolecule_Init(std::string &path, ifstream &File, int *&CurrentBonds)
     1092{
     1093  string filename;
     1094  filename = path + ADJACENCYFILE;
     1095  File.open(filename.c_str(), ios::out);
    10931096  DoLog(1) && (Log() << Verbose(1) << "Looking at bond structure stored in adjacency file and comparing to present one ... " << endl);
    1094   if (File == NULL)
     1097  if (File.fail())
    10951098    return false;
    10961099
     
    11461149 * \return true - structure is equal, false - not equivalence
    11471150 */
    1148 bool molecule::CheckAdjacencyFileAgainstMolecule(char *path, atom **ListOfAtoms)
     1151bool molecule::CheckAdjacencyFileAgainstMolecule(std::string &path, atom **ListOfAtoms)
    11491152{
    11501153  ifstream File;
  • src/moleculelist.cpp

    r0d5dce r8f822c  
    1212#include "atom.hpp"
    1313#include "bond.hpp"
     14#include "bondgraph.hpp"
    1415#include "boundary.hpp"
    1516#include "config.hpp"
     
    2324#include "periodentafel.hpp"
    2425#include "Helpers/Assert.hpp"
     26#include "Matrix.hpp"
     27#include "Box.hpp"
    2528
    2629#include "Helpers/Assert.hpp"
     
    379382 * bonded to the same atom, then we add for this pair a correction term constructed from a Morse
    380383 * potential function fit to QM calculations with respecting to the interatomic hydrogen distance.
    381  * \param *out output stream for debugging
    382  * \param *path path to file
    383  */
    384 bool MoleculeListClass::AddHydrogenCorrection(char *path)
     384 * \param &path path to file
     385 */
     386bool MoleculeListClass::AddHydrogenCorrection(std::string &path)
    385387{
    386388  bond *Binder = NULL;
     
    400402  // 0a. find dimension of matrices with constants
    401403  line = path;
    402   line.append("/");
    403   line += FRAGMENTPREFIX;
    404404  line += "1";
    405405  line += FITCONSTANTSUFFIX;
    406406  input.open(line.c_str());
    407   if (input == NULL) {
     407  if (input.fail()) {
    408408    DoLog(1) && (Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl);
    409409    return false;
     
    569569
    570570/** Store force indices, i.e. the connection between the nuclear index in the total molecule config and the respective atom in fragment config.
    571  * \param *out output stream for debugging
    572  * \param *path path to file
     571 * \param &path path to file
    573572 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
    574573 * \return true - file written successfully, false - writing failed
    575574 */
    576 bool MoleculeListClass::StoreForcesFile(char *path,
    577     int *SortIndex)
     575bool MoleculeListClass::StoreForcesFile(std::string &path, int *SortIndex)
    578576{
    579577  bool status = true;
    580   ofstream ForcesFile;
    581   stringstream line;
     578  string filename(path);
     579  filename += FORCESFILE;
     580  ofstream ForcesFile(filename.c_str());
    582581  periodentafel *periode=World::getInstance().getPeriode();
    583582
    584583  // open file for the force factors
    585584  DoLog(1) && (Log() << Verbose(1) << "Saving  force factors ... ");
    586   line << path << "/" << FRAGMENTPREFIX << FORCESFILE;
    587   ForcesFile.open(line.str().c_str(), ios::out);
    588   if (ForcesFile != NULL) {
     585  if (!ForcesFile.fail()) {
    589586    //Log() << Verbose(1) << "Final AtomicForcesList: ";
    590587    //output << prefix << "Forces" << endl;
     
    611608  } else {
    612609    status = false;
    613     DoLog(1) && (Log() << Verbose(1) << "failed to open file " << line.str() << "." << endl);
     610    DoLog(1) && (Log() << Verbose(1) << "failed to open file " << filename << "." << endl);
    614611  }
    615612  ForcesFile.close();
     
    620617/** Writes a config file for each molecule in the given \a **FragmentList.
    621618 * \param *out output stream for debugging
    622  * \param *configuration standard configuration to attach atoms in fragment molecule to.
     619 * \param &prefix path and prefix to the fragment config files
    623620 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
    624621 * \return true - success (each file was written), false - something went wrong.
    625622 */
    626 bool MoleculeListClass::OutputConfigForListOfFragments(config *configuration, int *SortIndex)
     623bool MoleculeListClass::OutputConfigForListOfFragments(std::string &prefix, int *SortIndex)
    627624{
    628625  ofstream outputFragment;
    629   char FragmentName[MAXSTRINGSIZE];
     626  std::string FragmentName;
    630627  char PathBackup[MAXSTRINGSIZE];
    631628  bool result = true;
     
    636633  int FragmentCounter = 0;
    637634  ofstream output;
    638   double cell_size_backup[6];
    639   double * const cell_size = World::getInstance().getDomain();
    640 
    641   // backup cell_size
    642   for (int i=0;i<6;i++)
    643     cell_size_backup[i] = cell_size[i];
     635  Matrix cell_size = World::getInstance().getDomain().getM();
     636  Matrix cell_size_backup = cell_size;
     637
    644638  // store the fragments as config and as xyz
    645639  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    646640    // save default path as it is changed for each fragment
    647     path = configuration->GetDefaultPath();
     641    path = World::getInstance().getConfig()->GetDefaultPath();
    648642    if (path != NULL)
    649643      strcpy(PathBackup, path);
     
    658652    // output xyz file
    659653    FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), FragmentCounter++);
    660     sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    661     outputFragment.open(FragmentName, ios::out);
     654    FragmentName = prefix + FragmentNumber + ".conf.xyz";
     655    outputFragment.open(FragmentName.c_str(), ios::out);
    662656    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...");
    663657    if ((intermediateResult = (*ListRunner)->OutputXYZ(&outputFragment)))
     
    679673    (*ListRunner)->CenterEdge(&BoxDimension);
    680674    (*ListRunner)->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary
    681     int j = -1;
    682675    for (int k = 0; k < NDIM; k++) {
    683       j += k + 1;
    684       BoxDimension[k] = 2.5 * (configuration->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
    685       cell_size[j] = BoxDimension[k] * 2.;
    686     }
     676      BoxDimension[k] = 2.5 * (World::getInstance().getConfig()->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
     677      cell_size.at(k,k) = BoxDimension[k] * 2.;
     678    }
     679    World::getInstance().setDomain(cell_size);
    687680    (*ListRunner)->Translate(&BoxDimension);
    688681
    689682    // also calculate necessary orbitals
    690683    (*ListRunner)->CountElements(); // this is a bugfix, atoms should shoulds actually be added correctly to this fragment
    691     (*ListRunner)->CalculateOrbitals(*configuration);
     684    //(*ListRunner)->CalculateOrbitals(*World::getInstance().getConfig);
    692685
    693686    // change path in config
    694     //strcpy(PathBackup, configuration->configpath);
    695     sprintf(FragmentName, "%s/%s%s/", PathBackup, FRAGMENTPREFIX, FragmentNumber);
    696     configuration->SetDefaultPath(FragmentName);
     687    FragmentName = PathBackup;
     688    FragmentName += "/";
     689    FragmentName += FRAGMENTPREFIX;
     690    FragmentName += FragmentNumber;
     691    FragmentName += "/";
     692    World::getInstance().getConfig()->SetDefaultPath(FragmentName.c_str());
    697693
    698694    // and save as config
    699     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     695    FragmentName = prefix + FragmentNumber + ".conf";
    700696    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...");
    701     if ((intermediateResult = configuration->Save(FragmentName, (*ListRunner)->elemente, (*ListRunner))))
     697    if ((intermediateResult = World::getInstance().getConfig()->Save(FragmentName.c_str(), (*ListRunner)->elemente, (*ListRunner))))
    702698      DoLog(0) && (Log() << Verbose(0) << " done." << endl);
    703699    else
     
    706702
    707703    // restore old config
    708     configuration->SetDefaultPath(PathBackup);
     704    World::getInstance().getConfig()->SetDefaultPath(PathBackup);
    709705
    710706    // and save as mpqc input file
    711     sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
     707    FragmentName = prefix + FragmentNumber + ".conf";
    712708    DoLog(2) && (Log() << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...");
    713     if ((intermediateResult = configuration->SaveMPQC(FragmentName, (*ListRunner))))
     709    if ((intermediateResult = World::getInstance().getConfig()->SaveMPQC(FragmentName.c_str(), (*ListRunner))))
    714710      DoLog(2) && (Log() << Verbose(2) << " done." << endl);
    715711    else
     
    727723
    728724  // restore cell_size
    729   for (int i=0;i<6;i++)
    730     cell_size[i] = cell_size_backup[i];
     725  World::getInstance().setDomain(cell_size_backup);
    731726
    732727  return result;
     
    767762
    768763  // 1. dissect the molecule into connected subgraphs
    769   if (!configuration->BG->ConstructBondGraph(mol)) {
    770     World::getInstance().destroyMolecule(mol);
    771     DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     764  if (configuration->BG != NULL) {
     765    if (!configuration->BG->ConstructBondGraph(mol)) {
     766      World::getInstance().destroyMolecule(mol);
     767      DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     768      return;
     769    }
     770  } else {
     771    DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
    772772    return;
    773773  }
     
    884884  // center at set box dimensions
    885885  mol->CenterEdge(&center);
    886   World::getInstance().getDomain()[0] = center[0];
    887   World::getInstance().getDomain()[1] = 0;
    888   World::getInstance().getDomain()[2] = center[1];
    889   World::getInstance().getDomain()[3] = 0;
    890   World::getInstance().getDomain()[4] = 0;
    891   World::getInstance().getDomain()[5] = center[2];
     886  Matrix domain;
     887  for(int i =0;i<NDIM;++i)
     888    domain.at(i,i) = center[i];
     889  World::getInstance().setDomain(domain);
    892890  insert(mol);
    893891}
  • src/periodentafel.cpp

    r0d5dce r8f822c  
    3232periodentafel::periodentafel()
    3333{
    34   bool status = true;
    35   status = LoadElementsDatabase(new stringstream(elementsDB,ios_base::in));
    36   ASSERT(status,  "General element initialization failed");
    37   status = LoadValenceDatabase(new stringstream(valenceDB,ios_base::in));
    38   ASSERT(status, "Valence entry of element initialization failed");
    39   status = LoadOrbitalsDatabase(new stringstream(orbitalsDB,ios_base::in));
    40   ASSERT(status, "Orbitals entry of element initialization failed");
    41   status = LoadHBondAngleDatabase(new stringstream(HbondangleDB,ios_base::in));
    42   ASSERT(status, "HBond angle entry of element initialization failed");
    43   status = LoadHBondLengthsDatabase(new stringstream(HbonddistanceDB,ios_base::in));
    44   ASSERT(status, "HBond distance entry of element initialization failed");
     34  {
     35    stringstream input(elementsDB,ios_base::in);
     36    bool status = LoadElementsDatabase(&input);
     37    ASSERT(status,  "General element initialization failed");
     38  }
     39  {
     40    stringstream input(valenceDB,ios_base::in);
     41    bool status = LoadValenceDatabase(&input);
     42    ASSERT(status, "Valence entry of element initialization failed");
     43  }
     44  {
     45    stringstream input(orbitalsDB,ios_base::in);
     46    bool status = LoadOrbitalsDatabase(&input);
     47    ASSERT(status, "Orbitals entry of element initialization failed");
     48  }
     49  {
     50    stringstream input(HbondangleDB,ios_base::in);
     51    bool status = LoadHBondAngleDatabase(&input);
     52    ASSERT(status, "HBond angle entry of element initialization failed");
     53  }
     54  {
     55    stringstream input(HbonddistanceDB,ios_base::in);
     56    bool status = LoadHBondLengthsDatabase(&input);
     57    ASSERT(status, "HBond distance entry of element initialization failed");
     58  }
    4559};
    4660
     
    333347          ASSERT(Elemental != NULL, "element should be present but is not??");
    334348          *Elemental = *neues;
     349          delete(neues);
     350          neues = Elemental;
    335351        } else {
    336352          InserterTest = elements.insert(pair <atomicNumber_t,element*> (neues->getNumber(), neues));
  • src/tesselation.cpp

    r0d5dce r8f822c  
    99
    1010#include <fstream>
    11 #include <assert.h>
    1211
    1312#include "helpers.hpp"
     
    2423#include "Plane.hpp"
    2524#include "Exceptions/LinearDependenceException.hpp"
    26 #include "Helpers/Assert.hpp"
    27 
    2825#include "Helpers/Assert.hpp"
    2926
     
    25272524    baseline = Runner->second;
    25282525    if (baseline->pointlist.empty()) {
    2529       assert((baseline->BaseLine->triangles.size() == 1) && ("Open line without exactly one attached triangle"));
     2526      ASSERT((baseline->BaseLine->triangles.size() == 1),"Open line without exactly one attached triangle");
    25302527      T = (((baseline->BaseLine->triangles.begin()))->second);
    25312528      DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl);
  • src/unittests/LineUnittest.cpp

    r0d5dce r8f822c  
    1717
    1818#include <iostream>
     19#include <cmath>
    1920
    2021using namespace std;
  • src/unittests/LinkedCellUnitTest.cpp

    r0d5dce r8f822c  
    264264  Vector tester;
    265265  LinkedCell::LinkedNodes *ListOfPoints = NULL;
    266   atom *Walker = NULL;
    267266  size_t size = 0;
    268267
     
    326325  Vector tester;
    327326  LinkedCell::LinkedNodes *ListOfPoints = NULL;
    328   atom *Walker = NULL;
    329327  size_t size = 0;
    330328
  • src/unittests/Makefile.am

    r0d5dce r8f822c  
    5353GSLLIBS = ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB}
    5454ALLLIBS = ../libmolecuilder.a ${GSLLIBS}
     55PARSERLIBS = ../libparser.a ${ALLLIBS}
    5556
    5657TESTSOURCES = \
     
    203204
    204205ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp
    205 ParserUnitTest_LDADD = ${ALLLIBS}
     206ParserUnitTest_LDADD = ${PARSERLIBS}
    206207
    207208periodentafelTest_SOURCES = UnitTestMain.cpp periodentafelTest.cpp periodentafelTest.hpp
     
    215216
    216217SingletonTest_SOURCES = UnitTestMain.cpp SingletonTest.cpp SingletonTest.hpp
    217 SingletonTest_LDADD = $(BOOST_LIB) ${BOOST_THREAD_LIB}
     218SingletonTest_LDADD = ${ALLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}
    218219
    219220StackClassUnitTest_SOURCES = UnitTestMain.cpp stackclassunittest.cpp stackclassunittest.hpp
  • src/unittests/ObserverTest.cpp

    r0d5dce r8f822c  
    382382  // make this Observable its own subject. NEVER DO THIS IN ACTUAL CODE
    383383  simpleObservable1->signOn(simpleObservable1);
     384#ifndef NDEBUG
    384385  CPPUNIT_ASSERT_THROW(simpleObservable1->changeMethod(),Assert::AssertionFailure);
     386#else
     387  simpleObservable1->changeMethod();
     388#endif
    385389
    386390  // more complex test
     
    388392  simpleObservable1->signOn(simpleObservable2);
    389393  simpleObservable2->signOn(simpleObservable1);
     394#ifndef NDEBUG
    390395  CPPUNIT_ASSERT_THROW(simpleObservable1->changeMethod(),Assert::AssertionFailure);
     396#else
     397  simpleObservable1->changeMethod();
     398#endif
     399
     400
    391401  simpleObservable1->signOff(simpleObservable2);
    392402  simpleObservable2->signOff(simpleObservable1);
  • src/unittests/ParserUnitTest.cpp

    r0d5dce r8f822c  
    1212#include <cppunit/ui/text/TestRunner.h>
    1313
     14#include "Parser/MpqcParser.hpp"
     15#include "Parser/PcpParser.hpp"
     16#include "Parser/TremoloParser.hpp"
    1417#include "Parser/XyzParser.hpp"
    15 #include "Parser/TremoloParser.hpp"
    1618#include "World.hpp"
    1719#include "atom.hpp"
     
    2931CPPUNIT_TEST_SUITE_REGISTRATION( ParserUnitTest );
    3032
     33static string waterPcp = "# ParallelCarParinello - main configuration file - created with molecuilder\n\
     34\n\
     35mainname\tpcp\t# programm name (for runtime files)\n\
     36defaultpath\not specified\t# where to put files during runtime\n\
     37pseudopotpath\not specified\t# where to find pseudopotentials\n\
     38\n\
     39ProcPEGamma\t8\t# for parallel computing: share constants\n\
     40ProcPEPsi\t1\t# for parallel computing: share wave functions\n\
     41DoOutVis\t0\t# Output data for OpenDX\n\
     42DoOutMes\t1\t# Output data for measurements\n\
     43DoOutOrbitals\t0\t# Output all Orbitals\n\
     44DoOutCurr\t0\t# Ouput current density for OpenDx\n\
     45DoOutNICS\t0\t# Output Nucleus independent current shieldings\n\
     46DoPerturbation\t0\t# Do perturbation calculate and determine susceptibility and shielding\n\
     47DoFullCurrent\t0\t# Do full perturbation\n\
     48DoConstrainedMD\t0\t# Do perform a constrained (>0, relating to current MD step) instead of unconstrained (0) MD\n\
     49Thermostat\tBerendsen\t2.5\t# Which Thermostat and its parameters to use in MD case.\n\
     50CommonWannier\t0\t# Put virtual centers at indivual orbits, all common, merged by variance, to grid point, to cell center\n\
     51SawtoothStart\t0.01\t# Absolute value for smooth transition at cell border \n\
     52VectorPlane\t0\t# Cut plane axis (x, y or z: 0,1,2) for two-dim current vector plot\n\
     53VectorCut\t0\t# Cut plane axis value\n\
     54AddGramSch\t1\t# Additional GramSchmidtOrtogonalization to be safe\n\
     55Seed\t1\t# initial value for random seed for Psi coefficients\n\
     56\n\
     57MaxOuterStep\t0\t# number of MolecularDynamics/Structure optimization steps\n\
     58Deltat\t0.01\t# time per MD step\n\
     59OutVisStep\t10\t# Output visual data every ...th step\n\
     60OutSrcStep\t5\t# Output \"restart\" data every ..th step\n\
     61TargetTemp\t0.000950045\t# Target temperature\n\
     62MaxPsiStep\t3\t# number of Minimisation steps per state (0 - default)\n\
     63EpsWannier\t1e-07\t# tolerance value for spread minimisation of orbitals\n\
     64# Values specifying when to stop\n\
     65MaxMinStep\t100\t# Maximum number of steps\n\
     66RelEpsTotalE\t1e-07\t# relative change in total energy\n\
     67RelEpsKineticE\t1e-05\t# relative change in kinetic energy\n\
     68MaxMinStopStep\t2\t# check every ..th steps\n\
     69MaxMinGapStopStep\t1\t# check every ..th steps\n\
     70\n\
     71# Values specifying when to stop for INIT, otherwise same as above\n\
     72MaxInitMinStep\t100\t# Maximum number of steps\n\
     73InitRelEpsTotalE\t1e-05\t# relative change in total energy\n\
     74InitRelEpsKineticE\t0.0001\t# relative change in kinetic energy\n\
     75InitMaxMinStopStep\t2\t# check every ..th steps\n\
     76InitMaxMinGapStopStep\t1\t# check every ..th steps\n\
     77\n\
     78BoxLength\t# (Length of a unit cell)\n\
     7920\n\
     800\t20\n\
     810\t0\t20\n\
     82\n\
     83ECut\t128\t# energy cutoff for discretization in Hartrees\n\
     84MaxLevel\t5\t# number of different levels in the code, >=2\n\
     85Level0Factor\t2\t# factor by which node number increases from S to 0 level\n\
     86RiemannTensor\t0\t# (Use metric)\n\
     87PsiType\t0\t# 0 - doubly occupied, 1 - SpinUp,SpinDown\n\
     88MaxPsiDouble\t2\t# here: specifying both maximum number of SpinUp- and -Down-states\n\
     89PsiMaxNoUp\t2\t# here: specifying maximum number of SpinUp-states\n\
     90PsiMaxNoDown\t2\t# here: specifying maximum number of SpinDown-states\n\
     91AddPsis\t0\t# Additional unoccupied Psis for bandgap determination\n\
     92\n\
     93RCut\t20\t# R-cut for the ewald summation\n\
     94StructOpt\t0\t# Do structure optimization beforehand\n\
     95IsAngstroem\t1\t# 0 - Bohr, 1 - Angstroem\n\
     96RelativeCoord\t0\t# whether ion coordinates are relative (1) or absolute (0)\n\
     97MaxTypes\t2\t# maximum number of different ion types\n\
     98\n\
     99# Ion type data (PP = PseudoPotential, Z = atomic number)\n\
     100#Ion_TypeNr.\tAmount\tZ\tRGauss\tL_Max(PP)L_Loc(PP)IonMass\t# chemical name, symbol\n\
     101Ion_Type1\t2\t1\t1.0\t3\t3\t1.008\tHydrogen\tH\n\
     102Ion_Type2\t1\t8\t1.0\t3\t3\t15.999\tOxygen\tO\n\
     103#Ion_TypeNr._Nr.R[0]\tR[1]\tR[2]\tMoveType (0 MoveIon, 1 FixedIon)\n\
     104Ion_Type2_1\t0.000000000\t0.000000000\t0.000000000\t0 # molecule nr 0\n\
     105Ion_Type1_1\t0.758602\t0.000000000\t0.504284\t0 # molecule nr 1\n\
     106Ion_Type1_2\t0.758602\t0.000000000\t-0.504284\t0 # molecule nr 2\n";
     107static string waterMpqc ="% Created by MoleCuilder\n\
     108mpqc: (\n\
     109\tsavestate = no\n\
     110\tdo_gradient = yes\n\
     111\tmole<MBPT2>: (\n\
     112\t\tmaxiter = 200\n\
     113\t\tbasis = $:basis\n\
     114\t\tmolecule = $:molecule\n\
     115\t\treference<CLHF>: (\n\
     116\t\t\tbasis = $:basis\n\
     117\t\t\tmolecule = $:molecule\n\
     118\t\t)\n\
     119\t)\n\
     120)\n\
     121molecule<Molecule>: (\n\
     122\tunit = angstrom\n\
     123\t{ atoms geometry } = {\n\
     124\t\tO [ -0.505735\t0\t0 ]\n\
     125\t\tH [ 0.252867\t0\t0.504284 ]\n\
     126\t\tH [ 0.252867\t0\t-0.504284 ]\n\
     127\t}\n\
     128)\n\
     129basis<GaussianBasisSet>: (\n\
     130\tname = \"3-21G\"\n\
     131\tmolecule = $:molecule\n\
     132)\n";
     133static string waterXyz = "3\nH2O: water molecule\nO\t0\t0\t0\nH\t0.758602\t0\t0.504284\nH\t0.758602\t0\t-0.504284\n";
     134static string Tremolo_Atomdata1 = "# ATOMDATA\tId\tname\tType\tx=3\n";
     135static string Tremolo_Atomdata2 = "#\n#ATOMDATA Id name Type x=3\n1 hydrogen H 3.0 4.5 0.1\n\n";
     136static string Tremolo_invalidkey = "#\n#ATOMDATA Id name foo Type x=3\n\n\n";
     137static string Tremolo_velocity = "#\n#ATOMDATA Id name Type u=3\n1 hydrogen H 3.0 4.5 0.1\n\n";
     138static string Tremolo_neighbours = "#\n#ATOMDATA Id Type neighbors=2\n1 H 3 0\n2 H 3 0\n3 O 1 2\n";
     139static string Tremolo_improper = "#\n#ATOMDATA Id Type imprData\n8 H 9-10\n9 H 10-8,8-10\n10 O -\n";
     140static string Tremolo_torsion = "#\n#ATOMDATA Id Type torsion\n8 H 9-10\n9 H 10-8,8-10\n10 O -\n";
     141static string Tremolo_full = "# ATOMDATA\tx=3\tu=3\tF\tstress\tId\tneighbors=5\timprData\tGroupMeasureTypeNo\tType\textType\tname\tresName\tchainID\tresSeq\toccupancy\ttempFactor\tsegID\tCharge\tcharge\tGrpTypeNo\ttorsion\n0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t-\t0\tH\t-\t-\t-\t0\t0\t0\t0\t0\t0\t0\t0\t-\t\n";
    31142
    32143void ParserUnitTest::setUp() {
    33144  World::getInstance();
     145
     146  // we need hydrogens and oxygens in the following tests
     147  CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(1) != NULL);
     148  CPPUNIT_ASSERT(World::getInstance().getPeriode()->FindElement(8) != NULL);
    34149}
    35150
    36151void ParserUnitTest::tearDown() {
     152  ChangeTracker::purgeInstance();
    37153  World::purgeInstance();
    38154}
     
    43159  cout << "Testing the XYZ parser." << endl;
    44160  XyzParser* testParser = new XyzParser();
    45   string waterXyz = "3\nH2O: water molecule\nO\t0.000000\t0.000000\t0.000000\nH\t0.758602\t0.000000\t0.504284\nH\t0.758602\t0.000000\t-0.504284\n";
    46161  stringstream input;
    47162  input << waterXyz;
     
    62177  TremoloParser* testParser = new TremoloParser();
    63178  stringstream input, output;
    64   string waterTremolo;
    65179
    66180  // Atomdata beginning with "# ATOMDATA"
    67   waterTremolo = "# ATOMDATA\tId\tname\tType\tx=3\n";
    68   input << waterTremolo;
    69   testParser->load(&input);
    70   testParser->save(&output);
    71   CPPUNIT_ASSERT(waterTremolo == output.str());
     181  input << Tremolo_Atomdata1;
     182  testParser->load(&input);
     183  testParser->save(&output);
     184  CPPUNIT_ASSERT(Tremolo_Atomdata1 == output.str());
    72185  input.clear();
    73186  output.clear();
    74187
    75188  // Atomdata beginning with "#ATOMDATA"
    76   waterTremolo = "#\n#ATOMDATA Id name Type x=3\n1 hydrogen H 3.0 4.5 0.1\n\n";
    77   input << waterTremolo;
     189  input << Tremolo_Atomdata2;
    78190  testParser->load(&input);
    79191  testParser->save(&output);
     
    83195
    84196  // Invalid key in Atomdata line
    85   waterTremolo = "#\n#ATOMDATA Id name foo Type x=3\n\n\n";
    86   input << waterTremolo;
     197  input << Tremolo_invalidkey;
    87198  testParser->load(&input);
    88199  //TODO: proove invalidity
     
    93204  TremoloParser* testParser = new TremoloParser();
    94205  stringstream input;
    95   string waterTremolo;
    96206
    97207  // One simple data line
    98   waterTremolo = "#\n#ATOMDATA Id name Type x=3\n1 hydrogen H 3.0 4.5 0.1\n\n";
    99   input << waterTremolo;
     208  input << Tremolo_Atomdata2;
    100209  testParser->load(&input);
    101210  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->x[0] == 3.0);
     
    106215  TremoloParser* testParser = new TremoloParser();
    107216  stringstream input;
    108   string waterTremolo;
    109217
    110218  // One simple data line
    111   waterTremolo = "#\n#ATOMDATA Id name Type u=3\n1 hydrogen H 3.0 4.5 0.1\n\n";
    112   input << waterTremolo;
     219  input << Tremolo_velocity;
    113220  testParser->load(&input);
    114221  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->v[0] == 3.0);
     
    119226  TremoloParser* testParser = new TremoloParser();
    120227  stringstream input;
    121   string waterTremolo;
    122228
    123229  // Neighbor data
    124   waterTremolo = "#\n#ATOMDATA Id Type neighbors=2\n1 H 3 0\n2 H 3 0\n3 O 1 2\n";
    125   input << waterTremolo;
     230  input << Tremolo_neighbours;
    126231  testParser->load(&input);
    127232
     
    135240  TremoloParser* testParser = new TremoloParser();
    136241  stringstream input, output;
    137   string waterTremolo;
    138242
    139243  // Neighbor data
    140   waterTremolo = "#\n#ATOMDATA Id Type imprData\n8 H 9-10\n9 H 10-8,8-10\n10 O -\n";
    141   input << waterTremolo;
     244  input << Tremolo_improper;
    142245  testParser->load(&input);
    143246  testParser->save(&output);
     
    151254  TremoloParser* testParser = new TremoloParser();
    152255  stringstream input, output;
    153   string waterTremolo;
    154256
    155257  // Neighbor data
    156   waterTremolo = "#\n#ATOMDATA Id Type torsion\n8 H 9-10\n9 H 10-8,8-10\n10 O -\n";
    157   input << waterTremolo;
     258  input << Tremolo_torsion;
    158259  testParser->load(&input);
    159260  testParser->save(&output);
     
    173274  testParser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo Type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");
    174275  testParser->save(&output);
    175   CPPUNIT_ASSERT(output.str() == "# ATOMDATA\tx=3\tu=3\tF\tstress\tId\tneighbors=5\timprData\tGroupMeasureTypeNo\tType\textType\tname\tresName\tchainID\tresSeq\toccupancy\ttempFactor\tsegID\tCharge\tcharge\tGrpTypeNo\ttorsion\n0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t-\t0\tH\t-\t-\t-\t0\t0\t0\t0\t0\t0\t0\t0\t-\t\n");
     276  CPPUNIT_ASSERT(output.str() == Tremolo_full);
    176277
    177278  cout << "testing the tremolo parser is done" << endl;
    178279}
     280
     281void ParserUnitTest::readwritePcpTest() {
     282  stringstream input(waterPcp);
     283  PcpParser* testParser = new PcpParser();
     284  testParser->load(&input);
     285  input.clear();
     286
     287  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     288
     289  string newWaterPcp = "";
     290  stringstream output;
     291  testParser->save(&output);
     292
     293  input << output;
     294  PcpParser* testParser2 = new PcpParser();
     295  testParser2->load(&input);
     296
     297  CPPUNIT_ASSERT_EQUAL(6, World::getInstance().numAtoms());
     298
     299  CPPUNIT_ASSERT(*testParser == *testParser2);
     300}
     301
     302void ParserUnitTest::writeMpqcTest() {
     303  // build up water molecule
     304  atom *Walker = NULL;
     305  Walker = World::getInstance().createAtom();
     306  Walker->type = World::getInstance().getPeriode()->FindElement(8);
     307  Walker->x = Vector(0,0,0);
     308  Walker = World::getInstance().createAtom();
     309  Walker->type = World::getInstance().getPeriode()->FindElement(1);
     310  Walker->x = Vector(0.758602,0,0.504284);
     311  Walker = World::getInstance().createAtom();
     312  Walker->type = World::getInstance().getPeriode()->FindElement(1);
     313  Walker->x = Vector(0.758602,0,-0.504284);
     314  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     315
     316  // create two stringstreams, one stored, one created
     317  stringstream input(waterMpqc);
     318  MpqcParser* testParser = new MpqcParser();
     319  stringstream output;
     320  testParser->save(&output);
     321
     322  // compare both configs
     323  string first = input.str();
     324  string second = output.str();
     325  CPPUNIT_ASSERT(first == second);
     326}
  • src/unittests/ParserUnitTest.hpp

    r0d5dce r8f822c  
    2222  CPPUNIT_TEST ( readAndWriteTremoloTorsionInformationTest );
    2323  CPPUNIT_TEST ( writeTremoloTest );
     24  CPPUNIT_TEST ( readwritePcpTest );
     25  CPPUNIT_TEST ( writeMpqcTest );
    2426  CPPUNIT_TEST_SUITE_END();
    2527
     
    3638  void readAndWriteTremoloTorsionInformationTest();
    3739  void writeTremoloTest();
     40  void readwritePcpTest();
     41  void writeMpqcTest();
    3842};
    3943
  • src/unittests/PlaneUnittest.cpp

    r0d5dce r8f822c  
    1111#include <cppunit/extensions/TestFactoryRegistry.h>
    1212#include <cppunit/ui/text/TestRunner.h>
     13
     14#include <cmath>
    1315
    1416#ifdef HAVE_TESTRUNNER
  • src/unittests/linearsystemofequationsunittest.cpp

    r0d5dce r8f822c  
    1212#include <cppunit/extensions/TestFactoryRegistry.h>
    1313#include <cppunit/ui/text/TestRunner.h>
     14#include <cmath>
    1415
    1516#include "linearsystemofequationsunittest.hpp"
  • src/unittests/manipulateAtomsTest.cpp

    r0d5dce r8f822c  
    8787static void operation(atom* _atom){
    8888  AtomStub *atom = dynamic_cast<AtomStub*>(_atom);
    89   assert(atom);
     89  CPPUNIT_ASSERT(atom);
    9090  atom->doSomething();
    9191}
     
    100100    AtomStub *atom;
    101101    atom = dynamic_cast<AtomStub*>(*iter);
    102     assert(atom);
     102    CPPUNIT_ASSERT(atom);
    103103    CPPUNIT_ASSERT(atom->manipulated);
    104104  }
     
    114114    AtomStub *atom;
    115115    atom = dynamic_cast<AtomStub*>(*iter);
    116     assert(atom);
     116    CPPUNIT_ASSERT(atom);
    117117    if(atom->getId()!=(int)ATOM_COUNT/2)
    118118      CPPUNIT_ASSERT(atom->manipulated);
  • src/unittests/vectorunittest.cpp

    r0d5dce r8f822c  
    2121#include "Plane.hpp"
    2222#include "Exceptions/LinearDependenceException.hpp"
     23#include "Matrix.hpp"
    2324
    2425#ifdef HAVE_TESTRUNNER
     
    221222void VectorTest::IsInParallelepipedTest()
    222223{
    223   double parallelepiped[NDIM*NDIM];
    224   parallelepiped[0] = 1;
    225   parallelepiped[1] = 0;
    226   parallelepiped[2] = 0;
    227   parallelepiped[3] = 0;
    228   parallelepiped[4] = 1;
    229   parallelepiped[5] = 0;
    230   parallelepiped[6] = 0;
    231   parallelepiped[7] = 0;
    232   parallelepiped[8] = 1;
     224  Matrix parallelepiped;
     225  parallelepiped.at(0,0) = 1;
     226  parallelepiped.at(1,0) = 0;
     227  parallelepiped.at(2,0) = 0;
     228  parallelepiped.at(0,1) = 0;
     229  parallelepiped.at(1,1) = 1;
     230  parallelepiped.at(2,1) = 0;
     231  parallelepiped.at(0,2) = 0;
     232  parallelepiped.at(1,2) = 0;
     233  parallelepiped.at(2,2) = 1;
    233234
    234235  fixture = zero;
  • src/vector.cpp

    r0d5dce r8f822c  
    88
    99#include "vector.hpp"
     10#include "Matrix.hpp"
    1011#include "verbose.hpp"
    1112#include "World.hpp"
    1213#include "Helpers/Assert.hpp"
    1314#include "Helpers/fast_functions.hpp"
     15#include "Exceptions/MathException.hpp"
    1416
    1517#include <iostream>
     18#include <gsl/gsl_blas.h>
     19
    1620
    1721using namespace std;
     
    3438{
    3539  content = gsl_vector_alloc(NDIM);
    36   gsl_vector_set(content,0,src[0]);
    37   gsl_vector_set(content,1,src[1]);
    38   gsl_vector_set(content,2,src[2]);
     40  gsl_vector_memcpy(content, src.content);
    3941}
    4042
     
    4951};
    5052
     53Vector::Vector(gsl_vector *_content) :
     54  content(_content)
     55{}
     56
    5157/**
    5258 * Assignment operator
     
    5561  // check for self assignment
    5662  if(&src!=this){
    57     gsl_vector_set(content,0,src[0]);
    58     gsl_vector_set(content,1,src[1]);
    59     gsl_vector_set(content,2,src[2]);
     63    gsl_vector_memcpy(content, src.content);
    6064  }
    6165  return *this;
     
    9498}
    9599
    96 /** Calculates distance between this and another vector in a periodic cell.
    97  * \param *y array to second vector
    98  * \param *cell_size 6-dimensional array with (xx, xy, yy, xz, yz, zz) entries specifying the periodic cell
    99  * \return \f$| x - y |\f$
    100  */
    101 double Vector::PeriodicDistance(const Vector &y, const double * const cell_size) const
    102 {
    103   double res = distance(y), tmp, matrix[NDIM*NDIM];
    104     Vector Shiftedy, TranslationVector;
    105     int N[NDIM];
    106     matrix[0] = cell_size[0];
    107     matrix[1] = cell_size[1];
    108     matrix[2] = cell_size[3];
    109     matrix[3] = cell_size[1];
    110     matrix[4] = cell_size[2];
    111     matrix[5] = cell_size[4];
    112     matrix[6] = cell_size[3];
    113     matrix[7] = cell_size[4];
    114     matrix[8] = cell_size[5];
    115     // in order to check the periodic distance, translate one of the vectors into each of the 27 neighbouring cells
    116     for (N[0]=-1;N[0]<=1;N[0]++)
    117       for (N[1]=-1;N[1]<=1;N[1]++)
    118         for (N[2]=-1;N[2]<=1;N[2]++) {
    119           // create the translation vector
    120           TranslationVector.Zero();
    121           for (int i=NDIM;i--;)
    122             TranslationVector[i] = (double)N[i];
    123           TranslationVector.MatrixMultiplication(matrix);
    124           // add onto the original vector to compare with
    125           Shiftedy = y + TranslationVector;
    126           // get distance and compare with minimum so far
    127           tmp = distance(Shiftedy);
    128           if (tmp < res) res = tmp;
    129         }
    130     return (res);
    131 };
    132 
    133 /** Calculates distance between this and another vector in a periodic cell.
    134  * \param *y array to second vector
    135  * \param *cell_size 6-dimensional array with (xx, xy, yy, xz, yz, zz) entries specifying the periodic cell
    136  * \return \f$| x - y |^2\f$
    137  */
    138 double Vector::PeriodicDistanceSquared(const Vector &y, const double * const cell_size) const
    139 {
    140   double res = DistanceSquared(y), tmp, matrix[NDIM*NDIM];
    141     Vector Shiftedy, TranslationVector;
    142     int N[NDIM];
    143     matrix[0] = cell_size[0];
    144     matrix[1] = cell_size[1];
    145     matrix[2] = cell_size[3];
    146     matrix[3] = cell_size[1];
    147     matrix[4] = cell_size[2];
    148     matrix[5] = cell_size[4];
    149     matrix[6] = cell_size[3];
    150     matrix[7] = cell_size[4];
    151     matrix[8] = cell_size[5];
    152     // in order to check the periodic distance, translate one of the vectors into each of the 27 neighbouring cells
    153     for (N[0]=-1;N[0]<=1;N[0]++)
    154       for (N[1]=-1;N[1]<=1;N[1]++)
    155         for (N[2]=-1;N[2]<=1;N[2]++) {
    156           // create the translation vector
    157           TranslationVector.Zero();
    158           for (int i=NDIM;i--;)
    159             TranslationVector[i] = (double)N[i];
    160           TranslationVector.MatrixMultiplication(matrix);
    161           // add onto the original vector to compare with
    162           Shiftedy = y + TranslationVector;
    163           // get distance and compare with minimum so far
    164           tmp = DistanceSquared(Shiftedy);
    165           if (tmp < res) res = tmp;
    166         }
    167     return (res);
    168 };
    169 
    170 /** Keeps the vector in a periodic cell, defined by the symmetric \a *matrix.
    171  * \param *out ofstream for debugging messages
    172  * Tries to translate a vector into each adjacent neighbouring cell.
    173  */
    174 void Vector::KeepPeriodic(const double * const matrix)
    175 {
    176   //  int N[NDIM];
    177   //  bool flag = false;
    178     //vector Shifted, TranslationVector;
    179   //  Log() << Verbose(1) << "Begin of KeepPeriodic." << endl;
    180   //  Log() << Verbose(2) << "Vector is: ";
    181   //  Output(out);
    182   //  Log() << Verbose(0) << endl;
    183     InverseMatrixMultiplication(matrix);
    184     for(int i=NDIM;i--;) { // correct periodically
    185       if (at(i) < 0) {  // get every coefficient into the interval [0,1)
    186         at(i) += ceil(at(i));
    187       } else {
    188         at(i) -= floor(at(i));
    189       }
    190     }
    191     MatrixMultiplication(matrix);
    192   //  Log() << Verbose(2) << "New corrected vector is: ";
    193   //  Output(out);
    194   //  Log() << Verbose(0) << endl;
    195   //  Log() << Verbose(1) << "End of KeepPeriodic." << endl;
    196 };
    197 
    198100/** Calculates scalar product between this and another vector.
    199101 * \param *y array to second vector
     
    203105{
    204106  double res = 0.;
    205   for (int i=NDIM;i--;)
    206     res += at(i)*y[i];
     107  gsl_blas_ddot(content, y.content, &res);
    207108  return (res);
    208109};
     
    461362};
    462363
     364Vector &Vector::operator*=(const Matrix &mat){
     365  (*this) = mat*(*this);
     366  return *this;
     367}
     368
     369Vector operator*(const Matrix &mat,const Vector &vec){
     370  gsl_vector *res = gsl_vector_calloc(NDIM);
     371  gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content, vec.content, 0.0, res);
     372  return Vector(res);
     373}
     374
     375
    463376/** Factors given vector \a a times \a m.
    464377 * \param a vector
     
    508421void Vector::Scale(const double factor)
    509422{
    510   for (int i=NDIM;i--;)
    511     at(i) *= factor;
    512 };
    513 
    514 /** Given a box by its matrix \a *M and its inverse *Minv the vector is made to point within that box.
    515  * \param *M matrix of box
    516  * \param *Minv inverse matrix
    517  */
    518 void Vector::WrapPeriodically(const double * const M, const double * const Minv)
    519 {
    520   MatrixMultiplication(Minv);
    521   // truncate to [0,1] for each axis
    522   for (int i=0;i<NDIM;i++) {
    523     //at(i) += 0.5;  // set to center of box
    524     while (at(i) >= 1.)
    525       at(i) -= 1.;
    526     while (at(i) < 0.)
    527       at(i) += 1.;
    528   }
    529   MatrixMultiplication(M);
     423  gsl_vector_scale(content,factor);
    530424};
    531425
     
    546440  return make_pair(res,helper);
    547441}
    548 
    549 /** Do a matrix multiplication.
    550  * \param *matrix NDIM_NDIM array
    551  */
    552 void Vector::MatrixMultiplication(const double * const M)
    553 {
    554   Vector tmp;
    555   // do the matrix multiplication
    556   for(int i=NDIM;i--;)
    557     tmp[i] = M[i]*at(0)+M[i+3]*at(1)+M[i+6]*at(2);
    558 
    559   (*this) = tmp;
    560 };
    561 
    562 /** Do a matrix multiplication with the \a *A' inverse.
    563  * \param *matrix NDIM_NDIM array
    564  */
    565 bool Vector::InverseMatrixMultiplication(const double * const A)
    566 {
    567   double B[NDIM*NDIM];
    568   double detA = RDET3(A);
    569   double detAReci;
    570 
    571   // calculate the inverse B
    572   if (fabs(detA) > MYEPSILON) {;  // RDET3(A) yields precisely zero if A irregular
    573     detAReci = 1./detA;
    574     B[0] =  detAReci*RDET2(A[4],A[5],A[7],A[8]);    // A_11
    575     B[1] = -detAReci*RDET2(A[1],A[2],A[7],A[8]);    // A_12
    576     B[2] =  detAReci*RDET2(A[1],A[2],A[4],A[5]);    // A_13
    577     B[3] = -detAReci*RDET2(A[3],A[5],A[6],A[8]);    // A_21
    578     B[4] =  detAReci*RDET2(A[0],A[2],A[6],A[8]);    // A_22
    579     B[5] = -detAReci*RDET2(A[0],A[2],A[3],A[5]);    // A_23
    580     B[6] =  detAReci*RDET2(A[3],A[4],A[6],A[7]);    // A_31
    581     B[7] = -detAReci*RDET2(A[0],A[1],A[6],A[7]);    // A_32
    582     B[8] =  detAReci*RDET2(A[0],A[1],A[3],A[4]);    // A_33
    583 
    584     MatrixMultiplication(B);
    585 
    586     return true;
    587   } else {
    588     return false;
    589   }
    590 };
    591 
    592442
    593443/** Creates this vector as the b y *factors' components scaled linear combination of the given three.
     
    679529void Vector::AddVector(const Vector &y)
    680530{
    681   for(int i=NDIM;i--;)
    682     at(i) += y[i];
     531  gsl_vector_add(content, y.content);
    683532}
    684533
     
    688537void Vector::SubtractVector(const Vector &y)
    689538{
    690   for(int i=NDIM;i--;)
    691     at(i) -= y[i];
     539  gsl_vector_sub(content, y.content);
    692540}
    693541
     
    699547 * @param three vectors forming the matrix that defines the shape of the parallelpiped
    700548 */
    701 bool Vector::IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const
    702 {
    703   Vector a = (*this)-offset;
    704   a.InverseMatrixMultiplication(parallelepiped);
     549bool Vector::IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const
     550{
     551  Matrix parallelepiped = _parallelepiped.invert();
     552  Vector a = parallelepiped * ((*this)-offset);
    705553  bool isInside = true;
    706554
  • src/vector.hpp

    r0d5dce r8f822c  
    1313#include <iostream>
    1414#include <gsl/gsl_vector.h>
    15 #include <gsl/gsl_multimin.h>
    1615
    1716#include <memory>
     
    2423
    2524class Vector;
     25class Matrix;
    2626
    2727typedef std::vector<Vector> pointset;
     
    3131 */
    3232class Vector : public Space{
     33  friend Vector operator*(const Matrix&,const Vector&);
    3334public:
    34 
    3535  Vector();
    3636  Vector(const double x1, const double x2, const double x3);
     
    4242  double DistanceSquared(const Vector &y) const;
    4343  double DistanceToSpace(const Space& space) const;
    44   double PeriodicDistance(const Vector &y, const double * const cell_size) const;
    45   double PeriodicDistanceSquared(const Vector &y, const double * const cell_size) const;
    4644  double ScalarProduct(const Vector &y) const;
    4745  double Angle(const Vector &y) const;
     
    5957  void ScaleAll(const double *factor);
    6058  void Scale(const double factor);
    61   void MatrixMultiplication(const double * const M);
    62   bool InverseMatrixMultiplication(const double * const M);
    63   void KeepPeriodic(const double * const matrix);
    6459  bool GetOneNormalVector(const Vector &x1);
    6560  bool MakeNormalTo(const Vector &y1);
    66   bool IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const;
    67   void WrapPeriodically(const double * const M, const double * const Minv);
     61  bool IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const;
    6862  std::pair<Vector,Vector> partition(const Vector&) const;
    6963  std::pair<pointset,Vector> partition(const pointset&) const;
     
    9690  Vector const operator+(const Vector& b) const;
    9791  Vector const operator-(const Vector& b) const;
     92  Vector& operator*=(const Matrix&);
    9893
    9994  // Methods inherited from Space
     
    10499
    105100private:
     101  Vector(gsl_vector *);
    106102  gsl_vector *content;
    107103
     
    118114Vector const operator*(const Vector& a, const double m);
    119115Vector const operator*(const double m, const Vector& a);
     116Vector operator*(const Matrix&,const Vector&);
     117
    120118
    121119#endif /*VECTOR_HPP_*/
  • src/vector_ops.cpp

    r0d5dce r8f822c  
    2323#include <gsl/gsl_permutation.h>
    2424#include <gsl/gsl_vector.h>
     25#include <gsl/gsl_multimin.h>
    2526
    2627/**
  • tests/regression/Domain/4/post/test.conf

    r0d5dce r8f822c  
    4747BoxLength                       # (Length of a unit cell)
    48481       
    49 0       0       
     490       1       
    50500       0       2       
    5151
  • tests/regression/Domain/6/post/test-x.conf.xyz

    r0d5dce r8f822c  
    1122
    22        Created by molecuilder on Mon May 31 19:07:16 2010
    3 H       9.78209 2.64589 2.64589 
    4 C       27.2836 3.27519 3.53589 
    5 C       28.5328 4.15859 3.53589 
    6 C       29.7821 3.27519 3.53589 
    7 H       27.2836 2.64589 4.42589 
    8 H       9.78209 2.64589 4.42589 
    9 H       10.672  3.90454 3.53589 
    10 H       8.53279 4.78789 2.64589 
    11 H       27.2836 2.64589 2.64589 
    12 H       26.3936 3.90454 3.53589 
    13 H       28.5328 4.78789 4.42589 
    14 H       28.5328 4.78789 2.64589 
    15 H       30.672  3.90454 3.53589 
    16 H       29.7821 2.64589 4.42589 
    17 H       29.7821 2.64589 2.64589 
    18 H       8.53279 4.78789 4.42589 
    19 H       6.39363 3.90454 3.53589 
    20 H       7.28359 2.64589 2.64589 
    21 H       7.28359 2.64589 4.42589 
    22 C       9.78209 3.27519 3.53589 
    23 C       8.53279 4.15859 3.53589 
    24 C       7.28359 3.27519 3.53589 
     3H       9.78209 2.64589 2.64589
     4C       27.2836 3.27519 3.53589
     5C       28.5328 4.15859 3.53589
     6C       29.7821 3.27519 3.53589
     7H       27.2836 2.64589 4.42589
     8H       9.78209 2.64589 4.42589
     9H       10.672  3.90454 3.53589
     10H       8.53279 4.78789 2.64589
     11H       27.2836 2.64589 2.64589
     12H       26.3936 3.90454 3.53589
     13H       28.5328 4.78789 4.42589
     14H       28.5328 4.78789 2.64589
     15H       30.672  3.90454 3.53589
     16H       29.7821 2.64589 4.42589
     17H       29.7821 2.64589 2.64589
     18H       8.53279 4.78789 4.42589
     19H       6.39363 3.90454 3.53589
     20H       7.28359 2.64589 2.64589
     21H       7.28359 2.64589 4.42589
     22C       9.78209 3.27519 3.53589
     23C       8.53279 4.15859 3.53589
     24C       7.28359 3.27519 3.53589
  • tests/regression/Domain/6/post/test-y.conf.xyz

    r0d5dce r8f822c  
    1122
    22        Created by molecuilder on Mon May 31 19:07:16 2010
    3 H       9.78209 2.64589 2.64589 
    4 C       7.28359 23.2752 3.53589 
    5 C       8.53279 24.1586 3.53589 
    6 C       9.78209 23.2752 3.53589 
    7 H       7.28359 22.6459 4.42589 
    8 H       9.78209 2.64589 4.42589 
    9 H       10.672  3.90454 3.53589 
    10 H       8.53279 4.78789 2.64589 
    11 H       7.28359 22.6459 2.64589 
    12 H       6.39363 23.9045 3.53589 
    13 H       8.53279 24.7879 4.42589 
    14 H       8.53279 24.7879 2.64589 
    15 H       10.672  23.9045 3.53589 
    16 H       9.78209 22.6459 4.42589 
    17 H       9.78209 22.6459 2.64589 
    18 H       8.53279 4.78789 4.42589 
    19 H       6.39363 3.90454 3.53589 
    20 H       7.28359 2.64589 2.64589 
    21 H       7.28359 2.64589 4.42589 
    22 C       9.78209 3.27519 3.53589 
    23 C       8.53279 4.15859 3.53589 
    24 C       7.28359 3.27519 3.53589 
     3H       9.78209 2.64589 2.64589
     4C       7.28359 23.2752 3.53589
     5C       8.53279 24.1586 3.53589
     6C       9.78209 23.2752 3.53589
     7H       7.28359 22.6459 4.42589
     8H       9.78209 2.64589 4.42589
     9H       10.672  3.90454 3.53589
     10H       8.53279 4.78789 2.64589
     11H       7.28359 22.6459 2.64589
     12H       6.39363 23.9045 3.53589
     13H       8.53279 24.7879 4.42589
     14H       8.53279 24.7879 2.64589
     15H       10.672  23.9045 3.53589
     16H       9.78209 22.6459 4.42589
     17H       9.78209 22.6459 2.64589
     18H       8.53279 4.78789 4.42589
     19H       6.39363 3.90454 3.53589
     20H       7.28359 2.64589 2.64589
     21H       7.28359 2.64589 4.42589
     22C       9.78209 3.27519 3.53589
     23C       8.53279 4.15859 3.53589
     24C       7.28359 3.27519 3.53589
  • tests/regression/Domain/6/post/test-z.conf.xyz

    r0d5dce r8f822c  
    1122
    22        Created by molecuilder on Mon May 31 19:07:16 2010
    3 H       9.78209 2.64589 2.64589 
    4 C       7.28359 3.27519 23.5359 
    5 C       8.53279 4.15859 23.5359 
    6 C       9.78209 3.27519 23.5359 
    7 H       7.28359 2.64589 24.4259 
    8 H       9.78209 2.64589 4.42589 
    9 H       10.672  3.90454 3.53589 
    10 H       8.53279 4.78789 2.64589 
    11 H       7.28359 2.64589 22.6459 
    12 H       6.39363 3.90454 23.5359 
    13 H       8.53279 4.78789 24.4259 
    14 H       8.53279 4.78789 22.6459 
    15 H       10.672  3.90454 23.5359 
    16 H       9.78209 2.64589 24.4259 
    17 H       9.78209 2.64589 22.6459 
    18 H       8.53279 4.78789 4.42589 
    19 H       6.39363 3.90454 3.53589 
    20 H       7.28359 2.64589 2.64589 
    21 H       7.28359 2.64589 4.42589 
    22 C       9.78209 3.27519 3.53589 
    23 C       8.53279 4.15859 3.53589 
    24 C       7.28359 3.27519 3.53589 
     3H       9.78209 2.64589 2.64589
     4C       7.28359 3.27519 23.5359
     5C       8.53279 4.15859 23.5359
     6C       9.78209 3.27519 23.5359
     7H       7.28359 2.64589 24.4259
     8H       9.78209 2.64589 4.42589
     9H       10.672  3.90454 3.53589
     10H       8.53279 4.78789 2.64589
     11H       7.28359 2.64589 22.6459
     12H       6.39363 3.90454 23.5359
     13H       8.53279 4.78789 24.4259
     14H       8.53279 4.78789 22.6459
     15H       10.672  3.90454 23.5359
     16H       9.78209 2.64589 24.4259
     17H       9.78209 2.64589 22.6459
     18H       8.53279 4.78789 4.42589
     19H       6.39363 3.90454 3.53589
     20H       7.28359 2.64589 2.64589
     21H       7.28359 2.64589 4.42589
     22C       9.78209 3.27519 3.53589
     23C       8.53279 4.15859 3.53589
     24C       7.28359 3.27519 3.53589
  • tests/regression/Domain/6/post/test.conf.xyz

    r0d5dce r8f822c  
    1111
    22        Created by molecuilder on Mon May 31 19:21:12 2010
    3 H       9.78209 2.64589 2.64589 
    4 H       9.78209 2.64589 4.42589 
    5 H       10.672  3.90454 3.53589 
    6 H       8.53279 4.78789 2.64589 
    7 H       8.53279 4.78789 4.42589 
    8 H       6.39363 3.90454 3.53589 
    9 H       7.28359 2.64589 2.64589 
    10 H       7.28359 2.64589 4.42589 
    11 C       9.78209 3.27519 3.53589 
    12 C       8.53279 4.15859 3.53589 
    13 C       7.28359 3.27519 3.53589 
     3H       9.78209 2.64589 2.64589
     4H       9.78209 2.64589 4.42589
     5H       10.672  3.90454 3.53589
     6H       8.53279 4.78789 2.64589
     7H       8.53279 4.78789 4.42589
     8H       6.39363 3.90454 3.53589
     9H       7.28359 2.64589 2.64589
     10H       7.28359 2.64589 4.42589
     11C       9.78209 3.27519 3.53589
     12C       8.53279 4.15859 3.53589
     13C       7.28359 3.27519 3.53589
  • tests/regression/Filling/1/post/test.conf

    r0d5dce r8f822c  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  1350    # check every ..th steps
     37MaxMinStopStep  680     # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      1350    # check every ..th steps
     44InitMaxMinStopStep      680     # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5555RiemannTensor   0       # (Use metric)
    5656PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    1350    # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      1350    # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    1350    # here: specifying maximum number of SpinDown-states
     57MaxPsiDouble    680     # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      680     # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    680     # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Simple_configuration/2/post/test.conf.xyz

    r0d5dce r8f822c  
    111
    22        Created by molecuilder on Tue Oct  6 18:34:23 2009
    3 H       10      10      10     
     3H       10      10      10
  • tests/regression/Simple_configuration/3/post/test.conf.xyz

    r0d5dce r8f822c  
    111
    22        Created by molecuilder on Tue Oct  6 18:34:23 2009
    3 H       10      10      10     
     3H       10      10      10
  • tests/regression/Simple_configuration/4/post/test.conf

    r0d5dce r8f822c  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  1       # check every ..th steps
     37MaxMinStopStep  2       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      1       # check every ..th steps
     44InitMaxMinStopStep      2       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    57 MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    58 PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
     56PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     57MaxPsiDouble    2       # here: specifying both maximum number of SpinUp- and -Down-states
     58PsiMaxNoUp      2       # here: specifying maximum number of SpinUp-states
     59PsiMaxNoDown    2       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Simple_configuration/4/post/test.conf.xyz

    r0d5dce r8f822c  
    111
    22        Created by molecuilder on Tue Oct  6 18:31:23 2009
    3 C       10      10      10     
     3C       10      10      10
  • tests/regression/Simple_configuration/5/post/test.conf

    r0d5dce r8f822c  
    3535RelEpsTotalE    1e-07   # relative change in total energy
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    37 MaxMinStopStep  1       # check every ..th steps
     37MaxMinStopStep  0       # check every ..th steps
    3838MaxMinGapStopStep       1       # check every ..th steps
    3939
     
    4242InitRelEpsTotalE        1e-05   # relative change in total energy
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    44 InitMaxMinStopStep      1       # check every ..th steps
     44InitMaxMinStopStep      0       # check every ..th steps
    4545InitMaxMinGapStopStep   1       # check every ..th steps
    4646
     
    5454Level0Factor    2       # factor by which node number increases from S to 0 level
    5555RiemannTensor   0       # (Use metric)
    56 PsiType         1       # 0 - doubly occupied, 1 - SpinUp,SpinDown
     56PsiType         0       # 0 - doubly occupied, 1 - SpinUp,SpinDown
    5757MaxPsiDouble    0       # here: specifying both maximum number of SpinUp- and -Down-states
    5858PsiMaxNoUp      0       # here: specifying maximum number of SpinUp-states
    59 PsiMaxNoDown    1       # here: specifying maximum number of SpinDown-states
     59PsiMaxNoDown    0       # here: specifying maximum number of SpinDown-states
    6060AddPsis         0       # Additional unoccupied Psis for bandgap determination
    6161
  • tests/regression/Simple_configuration/8/post/test.conf.xyz

    r0d5dce r8f822c  
    11144
    22        Created by molecuilder on Mon May 31 18:50:20 2010
    3 H       9.78209 2.64589 2.64589 
    4 H       9.78209 2.64589 4.42589 
    5 H       10.672  3.90454 3.53589 
    6 H       8.53279 4.78789 2.64589 
    7 H       8.53279 4.78789 4.42589 
    8 H       6.39363 3.90454 3.53589 
    9 H       7.28359 2.64589 2.64589 
    10 H       7.28359 2.64589 4.42589 
    11 H       0.758602        2.85714 3.86571 
    12 H       0.758602        2.85714 2.85714 
    13 H       0.758602        2.85714 5.71429 
    14 H       0.758602        5.71429 3.86571 
    15 H       0.758602        5.71429 2.85714 
    16 H       3.61574 0       1.00857 
    17 H       3.61574 0       0       
    18 H       3.61574 0       3.86571 
    19 H       3.61574 0       2.85714 
    20 H       3.61574 0       6.72285 
    21 H       3.61574 0       5.71429 
    22 H       3.61574 2.85714 1.00857 
    23 H       3.61574 2.85714 0       
    24 H       3.61574 2.85714 3.86571 
    25 H       3.61574 2.85714 2.85714 
    26 H       3.61574 2.85714 6.72285 
    27 H       3.61574 2.85714 5.71429 
    28 H       3.61574 2.85714 8.57143 
    29 H       3.61574 5.71429 1.00857 
    30 H       3.61574 5.71429 0       
    31 H       3.61574 5.71429 3.86571 
    32 H       3.61574 5.71429 2.85714 
    33 H       3.61574 5.71429 6.72285 
    34 H       3.61574 5.71429 5.71429 
    35 H       3.61574 5.71429 8.57143 
    36 H       3.61574 8.57143 1.00857 
    37 H       3.61574 8.57143 3.86571 
    38 H       3.61574 8.57143 2.85714 
    39 H       3.61574 8.57143 5.71429 
    40 H       6.47289 0       1.00857 
    41 H       6.47289 0       0       
    42 H       6.47289 0       3.86571 
    43 H       6.47289 0       2.85714 
    44 H       6.47289 0       6.72285 
    45 H       6.47289 0       5.71429 
    46 H       6.47289 0       9.58   
    47 H       6.47289 0       8.57143 
    48 H       6.47289 2.85714 0       
    49 H       6.47289 2.85714 6.72285 
    50 H       6.47289 2.85714 9.58   
    51 H       6.47289 2.85714 8.57143 
    52 H       6.47289 5.71429 1.00857 
    53 H       6.47289 5.71429 0       
    54 H       6.47289 5.71429 6.72285 
    55 H       6.47289 5.71429 5.71429 
    56 H       6.47289 5.71429 9.58   
    57 H       6.47289 5.71429 8.57143 
    58 H       6.47289 8.57143 1.00857 
    59 H       6.47289 8.57143 0       
    60 H       6.47289 8.57143 3.86571 
    61 H       6.47289 8.57143 2.85714 
    62 H       6.47289 8.57143 6.72285 
    63 H       6.47289 8.57143 5.71429 
    64 H       9.33003 0       1.00857 
    65 H       9.33003 0       0       
    66 H       9.33003 0       3.86571 
    67 H       9.33003 0       2.85714 
    68 H       9.33003 0       6.72285 
    69 H       9.33003 0       5.71429 
    70 H       9.33003 0       8.57143 
    71 H       9.33003 2.85714 0       
    72 H       9.33003 2.85714 6.72285 
    73 H       9.33003 2.85714 9.58   
    74 H       9.33003 2.85714 8.57143 
    75 H       9.33003 5.71429 0       
    76 H       9.33003 5.71429 6.72285 
    77 H       9.33003 5.71429 9.58   
    78 H       9.33003 5.71429 8.57143 
    79 H       9.33003 8.57143 1.00857 
    80 H       9.33003 8.57143 0       
    81 H       9.33003 8.57143 3.86571 
    82 H       9.33003 8.57143 2.85714 
    83 H       9.33003 8.57143 6.72285 
    84 H       9.33003 8.57143 5.71429 
    85 H       12.1872 0       1.00857 
    86 H       12.1872 0       0       
    87 H       12.1872 0       3.86571 
    88 H       12.1872 0       2.85714 
    89 H       12.1872 0       6.72285 
    90 H       12.1872 0       5.71429 
    91 H       12.1872 2.85714 1.00857 
    92 H       12.1872 2.85714 0       
    93 H       12.1872 2.85714 6.72285 
    94 H       12.1872 2.85714 5.71429 
    95 H       12.1872 5.71429 1.00857 
    96 H       12.1872 5.71429 0       
    97 H       12.1872 5.71429 3.86571 
    98 H       12.1872 5.71429 2.85714 
    99 H       12.1872 5.71429 6.72285 
    100 H       12.1872 5.71429 5.71429 
    101 C       9.78209 3.27519 3.53589 
    102 C       8.53279 4.15859 3.53589 
    103 C       7.28359 3.27519 3.53589 
    104 O       2.85714 0       0.504284       
    105 O       2.85714 0       3.36143 
    106 O       2.85714 0       6.21857 
    107 O       2.85714 2.85714 0.504284       
    108 O       2.85714 2.85714 3.36143 
    109 O       2.85714 2.85714 6.21857 
    110 O       2.85714 5.71429 0.504284       
    111 O       2.85714 5.71429 3.36143 
    112 O       2.85714 5.71429 6.21857 
    113 O       2.85714 8.57143 3.36143 
    114 O       5.71429 0       0.504284       
    115 O       5.71429 0       3.36143 
    116 O       5.71429 0       6.21857 
    117 O       5.71429 0       9.07571 
    118 O       5.71429 2.85714 0.504284       
    119 O       5.71429 2.85714 6.21857 
    120 O       5.71429 2.85714 9.07571 
    121 O       5.71429 5.71429 0.504284       
    122 O       5.71429 5.71429 6.21857 
    123 O       5.71429 5.71429 9.07571 
    124 O       5.71429 8.57143 0.504284       
    125 O       5.71429 8.57143 3.36143 
    126 O       5.71429 8.57143 6.21857 
    127 O       8.57143 0       0.504284       
    128 O       8.57143 0       3.36143 
    129 O       8.57143 0       6.21857 
    130 O       8.57143 0       9.07571 
    131 O       8.57143 2.85714 0.504284       
    132 O       8.57143 2.85714 9.07571 
    133 O       8.57143 5.71429 0.504284       
    134 O       8.57143 5.71429 9.07571 
    135 O       8.57143 8.57143 0.504284       
    136 O       8.57143 8.57143 3.36143 
    137 O       8.57143 8.57143 6.21857 
    138 O       11.4286 0       0.504284       
    139 O       11.4286 0       3.36143 
    140 O       11.4286 0       6.21857 
    141 O       11.4286 2.85714 0.504284       
    142 O       11.4286 2.85714 6.21857 
    143 O       11.4286 2.85714 9.07571 
    144 O       11.4286 5.71429 0.504284       
    145 O       11.4286 5.71429 6.21857 
    146 O       11.4286 8.57143 3.36143 
     3H       9.78209 2.64589 2.64589
     4H       9.78209 2.64589 4.42589
     5H       10.672  3.90454 3.53589
     6H       8.53279 4.78789 2.64589
     7H       8.53279 4.78789 4.42589
     8H       6.39363 3.90454 3.53589
     9H       7.28359 2.64589 2.64589
     10H       7.28359 2.64589 4.42589
     11H       0.758602        2.85714 3.86571
     12H       0.758602        2.85714 2.85714
     13H       0.758602        2.85714 5.71429
     14H       0.758602        5.71429 3.86571
     15H       0.758602        5.71429 2.85714
     16H       3.61574 0       1.00857
     17H       3.61574 0       0
     18H       3.61574 0       3.86571
     19H       3.61574 0       2.85714
     20H       3.61574 0       6.72285
     21H       3.61574 0       5.71429
     22H       3.61574 2.85714 1.00857
     23H       3.61574 2.85714 0
     24H       3.61574 2.85714 3.86571
     25H       3.61574 2.85714 2.85714
     26H       3.61574 2.85714 6.72285
     27H       3.61574 2.85714 5.71429
     28H       3.61574 2.85714 8.57143
     29H       3.61574 5.71429 1.00857
     30H       3.61574 5.71429 0
     31H       3.61574 5.71429 3.86571
     32H       3.61574 5.71429 2.85714
     33H       3.61574 5.71429 6.72285
     34H       3.61574 5.71429 5.71429
     35H       3.61574 5.71429 8.57143
     36H       3.61574 8.57143 1.00857
     37H       3.61574 8.57143 3.86571
     38H       3.61574 8.57143 2.85714
     39H       3.61574 8.57143 5.71429
     40H       6.47289 0       1.00857
     41H       6.47289 0       0
     42H       6.47289 0       3.86571
     43H       6.47289 0       2.85714
     44H       6.47289 0       6.72285
     45H       6.47289 0       5.71429
     46H       6.47289 0       9.58
     47H       6.47289 0       8.57143
     48H       6.47289 2.85714 0
     49H       6.47289 2.85714 6.72285
     50H       6.47289 2.85714 9.58
     51H       6.47289 2.85714 8.57143
     52H       6.47289 5.71429 1.00857
     53H       6.47289 5.71429 0
     54H       6.47289 5.71429 6.72285
     55H       6.47289 5.71429 5.71429
     56H       6.47289 5.71429 9.58
     57H       6.47289 5.71429 8.57143
     58H       6.47289 8.57143 1.00857
     59H       6.47289 8.57143 0
     60H       6.47289 8.57143 3.86571
     61H       6.47289 8.57143 2.85714
     62H       6.47289 8.57143 6.72285
     63H       6.47289 8.57143 5.71429
     64H       9.33003 0       1.00857
     65H       9.33003 0       0
     66H       9.33003 0       3.86571
     67H       9.33003 0       2.85714
     68H       9.33003 0       6.72285
     69H       9.33003 0       5.71429
     70H       9.33003 0       8.57143
     71H       9.33003 2.85714 0
     72H       9.33003 2.85714 6.72285
     73H       9.33003 2.85714 9.58
     74H       9.33003 2.85714 8.57143
     75H       9.33003 5.71429 0
     76H       9.33003 5.71429 6.72285
     77H       9.33003 5.71429 9.58
     78H       9.33003 5.71429 8.57143
     79H       9.33003 8.57143 1.00857
     80H       9.33003 8.57143 0
     81H       9.33003 8.57143 3.86571
     82H       9.33003 8.57143 2.85714
     83H       9.33003 8.57143 6.72285
     84H       9.33003 8.57143 5.71429
     85H       12.1872 0       1.00857
     86H       12.1872 0       0
     87H       12.1872 0       3.86571
     88H       12.1872 0       2.85714
     89H       12.1872 0       6.72285
     90H       12.1872 0       5.71429
     91H       12.1872 2.85714 1.00857
     92H       12.1872 2.85714 0
     93H       12.1872 2.85714 6.72285
     94H       12.1872 2.85714 5.71429
     95H       12.1872 5.71429 1.00857
     96H       12.1872 5.71429 0
     97H       12.1872 5.71429 3.86571
     98H       12.1872 5.71429 2.85714
     99H       12.1872 5.71429 6.72285
     100H       12.1872 5.71429 5.71429
     101C       9.78209 3.27519 3.53589
     102C       8.53279 4.15859 3.53589
     103C       7.28359 3.27519 3.53589
     104O       2.85714 0       0.504284
     105O       2.85714 0       3.36143
     106O       2.85714 0       6.21857
     107O       2.85714 2.85714 0.504284
     108O       2.85714 2.85714 3.36143
     109O       2.85714 2.85714 6.21857
     110O       2.85714 5.71429 0.504284
     111O       2.85714 5.71429 3.36143
     112O       2.85714 5.71429 6.21857
     113O       2.85714 8.57143 3.36143
     114O       5.71429 0       0.504284
     115O       5.71429 0       3.36143
     116O       5.71429 0       6.21857
     117O       5.71429 0       9.07571
     118O       5.71429 2.85714 0.504284
     119O       5.71429 2.85714 6.21857
     120O       5.71429 2.85714 9.07571
     121O       5.71429 5.71429 0.504284
     122O       5.71429 5.71429 6.21857
     123O       5.71429 5.71429 9.07571
     124O       5.71429 8.57143 0.504284
     125O       5.71429 8.57143 3.36143
     126O       5.71429 8.57143 6.21857
     127O       8.57143 0       0.504284
     128O       8.57143 0       3.36143
     129O       8.57143 0       6.21857
     130O       8.57143 0       9.07571
     131O       8.57143 2.85714 0.504284
     132O       8.57143 2.85714 9.07571
     133O       8.57143 5.71429 0.504284
     134O       8.57143 5.71429 9.07571
     135O       8.57143 8.57143 0.504284
     136O       8.57143 8.57143 3.36143
     137O       8.57143 8.57143 6.21857
     138O       11.4286 0       0.504284
     139O       11.4286 0       3.36143
     140O       11.4286 0       6.21857
     141O       11.4286 2.85714 0.504284
     142O       11.4286 2.85714 6.21857
     143O       11.4286 2.85714 9.07571
     144O       11.4286 5.71429 0.504284
     145O       11.4286 5.71429 6.21857
     146O       11.4286 8.57143 3.36143
  • tests/regression/testsuite-fragmentation.at

    r0d5dce r8f822c  
    1212AT_SETUP([Fragmentation - Fragmentation])
    1313AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/2/pre/test.conf .], 0)
    14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f 0 --distance 1.55 --order 2], 0, [ignore], [ignore])
     14AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f ./BondFragment --molecule-by-id 0 --distance 1.55 --order 2], 0, [ignore], [ignore])
    1515AT_CHECK([ls -l BondFragment*.conf | wc -l], 0, [5
    1616], [ignore])
     
    2121AT_SETUP([Fragmentation - BROKEN: Fragmentation is at MaxOrder])
    2222AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/3/pre/test.conf .], 0)
    23 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f 0 --distance 1.55 --order 2], 0, [ignore], [ignore])
    24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f 0 --distance 1.55 --order 2], [ignore], [ignore], [ignore])
     23AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f ./BondFragment --molecule-by-id 0 --distance 1.55 --order 2], 0, [ignore], [ignore])
     24AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f ./BondFragment --molecule-by-id 0 --distance 1.55 --order 2], [ignore], [ignore], [ignore])
    2525AT_CLEANUP
  • tests/regression/testsuite-simple_configuration.at

    r0d5dce r8f822c  
    5252AT_SETUP([Simple configuration - invalid commands on empty configs])
    5353AT_KEYWORDS([configuration])
    54 AT_CHECK([../../molecuilder empty.conf -e ${abs_top_srcdir}/src/ -t -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
    55 AT_CHECK([fgrep -c "Not enough" stderr], 0, [1
    56 ], [ignore])
     54AT_CHECK([../../molecuilder empty.conf -e ${abs_top_srcdir}/src/ -t -s -b -E -c -b -a -U -T -u], 134, [ignore], [stderr])
    5755AT_CLEANUP
    5856
     
    6159AT_KEYWORDS([configuration])
    6260AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/7/pre/test.conf .], 0)
    63 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t], 255, [ignore], [stderr])
    64 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    65 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
    66 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    67 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
    68 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    69 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E -c -b -a -U -T -u], 255, [ignore], [stderr])
    70 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    71 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -c -b -a -U -T -u], 255, [ignore], [stderr])
    72 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    73 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -a -U -T -u], 255, [ignore], [stderr])
    74 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    75 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a -U -T -u], 255, [ignore], [stderr])
    76 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    77 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -U -T -u], 255, [ignore], [stderr])
    78 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    79 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T -u], 255, [ignore], [stderr])
    80 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
    81 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -u], 255, [ignore], [stderr])
    82 AT_CHECK([fgrep -c "CRITICAL: Not enough" stderr], 0, [ignore], [ignore])
     61AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t], 134, [ignore], [stderr])
     62AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -s -b -E -c -b -a -U -T -u], 134, [ignore], [stderr])
     63AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -E -c -b -a -U -T -u], 134, [ignore], [stderr])
     64AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E -c -b -a -U -T -u], 134, [ignore], [stderr])
     65AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -c -b -a -U -T -u], 134, [ignore], [stderr])
     66AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -a -U -T -u], 134, [ignore], [stderr])
     67AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a -U -T -u], 134, [ignore], [stderr])
     68AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -U -T -u], 134, [ignore], [stderr])
     69AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T -u], 134, [ignore], [stderr])
     70AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -u], 134, [ignore], [stderr])
    8371AT_CLEANUP
    8472
  • tests/regression/testsuite-standard_options.at

    r0d5dce r8f822c  
    1818AT_SETUP([Standard Options - no element database])
    1919AT_KEYWORDS([options])
    20 AT_CHECK([../../molecuilder -e], 255, [ignore], [stderr])
    21 AT_CHECK([fgrep "Not enough or invalid arguments" stderr], 0, [ignore], [ignore])
     20AT_CHECK([../../molecuilder -e], 134, [ignore], [stderr])
    2221AT_CLEANUP
    2322
Note: See TracChangeset for help on using the changeset viewer.