Changes in / [3fa16b:19dfdf]


Ignore:
Files:
3 added
246 deleted
126 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r3fa16b r19dfdf  
    2323        cd doc && $(MAKE) doxygen-doc
    2424
    25 guicheck:
    26         cd tests && $(MAKE) guicheck
    2725extracheck:
    2826        cd tests && $(MAKE) extracheck
  • configure.ac

    r3fa16b r19dfdf  
    427427AC_CONFIG_FILES([tests/Fragmentations/molecuilder], [chmod +x tests/Fragmentations/molecuilder])
    428428
    429 AC_CONFIG_TESTDIR(tests/GuiChecks)
    430 AC_CONFIG_FILES([
    431         tests/GuiChecks/atlocal
    432         tests/GuiChecks/Makefile])
    433 AC_CONFIG_FILES([tests/GuiChecks/molecuilder], [chmod +x tests/GuiChecks/molecuilder])
    434 AC_CONFIG_FILES([tests/GuiChecks/molecuilderguitest], [chmod +x tests/GuiChecks/molecuilderguitest])
    435 
    436429AC_CONFIG_TESTDIR(tests/JobMarket)
    437430AC_CONFIG_FILES([
  • doc/userguide/userguide.xml

    r3fa16b r19dfdf  
    962962        </section>
    963963
    964         <section xml:id='atoms.saturate-atom'>
    965           <title xml:id='atoms.saturate-atom.title'>Saturating atoms</title>
    966 
    967           <para>Newly instantiated atoms have no bonds to any other atom. If
    968           you want to fill up their valence by a slew of hydrogen atoms
    969           residing on a sphere around this atom, use this action.</para>
    970 
    971           <programlisting>
    972                 ... --saturate-atoms
    973           </programlisting>
    974 
    975           <para>A number of hydrogen atoms is added. The number corrresponding
    976           to the valence of each selected atom. They are placed in the same
    977           distance to this atom and approximately with same distance to their
    978           nearest neighbors.</para>
    979         </section>
    980 
    981964        <section xml:id='atoms.translate-atom'>
    982965          <title xml:id='atoms.translate-atom.title'>Translating atoms</title>
     
    11501133        </section>
    11511134
    1152         <section xml:id='bond.adds-bond'>
    1153           <title xml:id='bond.adds-bond.title'>Adding a bond manually</title>
     1135        <section xml:id='bond.add-bond'>
     1136          <title xml:id='bond.add-bond.title'>Adding a bond manually</title>
    11541137
    11551138          <para>When the automatically created adjacency or bond graph
    11561139          contains faulty bonds or lacks some, you can add them manually.
    1157           </para>
    1158 
    1159           <programlisting>... --add-bonds</programlisting>
    1160 
    1161           <para>If two atoms are selected, the single bond in between, if not
    1162           present, is added. If more than two atoms are selected, than the
    1163           bond between any pair of these is added.</para>
    1164          <note><para>This is especially useful in conjunction with the
    1165           fragmentation scheme. If you want to know the contribution from
    1166           certain fragments whose subgraph is not connected you can simply
    1167           make the associated subset of atoms connected by selecting all
    1168           bonds and adding the bonds.</para>
    1169          </note>
    1170         </section>
    1171 
    1172         <section xml:id='bond.remove-bonds'>
    1173           <title xml:id='bond.remove-bonds.title'>Removing a bond manually
     1140          First, you must have selected two atoms.</para>
     1141
     1142          <programlisting>... --add-bond</programlisting>
     1143        </section>
     1144
     1145        <section xml:id='bond.remove-bond'>
     1146          <title xml:id='bond.remove-bond.title'>Removing a bond manually
    11741147          </title>
    11751148
     
    11771150          bond.</para>
    11781151
    1179           <programlisting>... --remove-bonds</programlisting>
    1180 
    1181           <para>Similarly, if more than two atoms are selected, then all bonds
    1182           found between any pair of these is removed.</para>
     1152          <programlisting>... --remove-bond</programlisting>
    11831153        </section>
    11841154
     
    25412511          <programlisting>... -v 4</programlisting>
    25422512        </section>
    2543        
    2544         <section xml:id='various.dry-run'>
    2545           <title xml:id='various.dry-run.title'>Dry runs</title>
    2546 
    2547           <para>A "dry run" refers to a test run where commands are not
    2548           actually executed. You may bracket a certain set of actions by
    2549           putting --dry-run before and --no-dry-run afterwards. Then, all
    2550           action in between will be looked at but not executed, i.e. they
    2551           make it to the history but nothing is changed in the World.</para>
    2552 
    2553           <para>As an example, the following listing contains the adding of a
    2554           hydrogen atom at position (5,5,5) inside the aforementioned dry run
    2555           statements. Hence, no hydrogen atom is added but the add action is
    2556           stored in the history and will make it to a stored session.</para>
    2557 
    2558           <programlisting>
    2559           ... --dry-run \
    2560           --add-atom 1 --domain-position "5,5,5"
    2561           --no-dry-run
    2562           </programlisting>
    2563 
    2564         </section>
    25652513
    25662514        <section xml:id='various.element-db'>
  • src/Actions/ActionQueue.cpp

    r3fa16b r19dfdf  
    6363    history(new ActionHistory),
    6464#ifndef HAVE_ACTION_THREAD
    65     lastActionOk(true),
     65    lastActionOk(true)
    6666#else
    6767    CurrentAction(0),
    6868    lastActionOk(true),
    6969    run_thread(boost::bind(&ActionQueue::run, this)),
    70     run_thread_isIdle(true),
    71 #endif
    72     dryrun_flag(false)
     70    run_thread_isIdle(true)
     71#endif
    7372{
    7473  // channels of observable
     
    110109#ifndef HAVE_ACTION_THREAD
    111110  try {
    112     if (!isDryRun(newaction))
    113       newaction->call();
     111    newaction->call();
    114112    lastActionOk = true;
    115113  } catch(ActionFailureException &e) {
     
    177175      LOG(0, "Calling Action " << actionqueue[CurrentAction]->getName() << " ... ");
    178176      try {
    179         if (!isDryRun(actionqueue[CurrentAction]))
    180           actionqueue[CurrentAction]->call();
     177        actionqueue[CurrentAction]->call();
    181178        pushStatus("SUCCESS: Action "+actionqueue[CurrentAction]->getName()+" successful.");
    182179        lastActionOk = true;
     
    383380}
    384381
    385 bool ActionQueue::isDryRun(const Action *_nextaction) const
    386 {
    387   bool status = dryrun_flag;
    388   status &= (_nextaction->getName() != "no-dry-run");
    389   return status;
    390 }
    391382
    392383CONSTRUCT_SINGLETON(ActionQueue)
  • src/Actions/ActionQueue.hpp

    r3fa16b r19dfdf  
    4040class ActionRegistry;
    4141class ActionTrait;
    42 class DryRunAdvocate;
    4342
    4443namespace Queuedetail {
     
    179178  { return StatusList; }
    180179
    181   /** Getter for isDryRun state flag.
    182    *
    183    * \return true - ActionQueue does not execute Actions but skips, false - else
    184    */
    185   bool getDryRun() const
    186   { return dryrun_flag; }
    187 
    188180private:
    189181  //!> grant Action access to internal history functions.
     
    191183  //!> grant CommandLineParser access to stop and clearQueue()
    192184  friend class ::CommandLineParser;
    193   //!> grant Advocate access to setting dryrun
    194   friend class DryRunAdvocate;
    195185
    196186  /** Wrapper function to add state to ActionHistory.
     
    265255  void insertAction(Action *_action, enum Action::QueryOptions state);
    266256
    267   /** Sets the current state of the \a isDryRun flag.
    268    *
    269    * \param _dryrun true - Actions will not get executed anymore, false - else
    270    */
    271   void setDryRun(const bool _dryrun)
    272   { dryrun_flag = _dryrun; }
    273 
    274   /** Checks whether next Action should be skipped or not.
    275    *
    276    * \param _nextaction next action to execute to inspect whether it unsets dryrun_flag
    277    * \return true - dryrun_flag set and \a _nextaction is not unsetting dry run
    278    */
    279   bool isDryRun(const Action *_nextaction) const;
    280 
    281257private:
    282258  /** Private cstor for ActionQueue.
     
    333309  //!> internal list of status messages from Actions for UIs to display
    334310  ActionStatusList StatusList;
    335 
    336   //!> internal flag whether to call or skip actions (i.e. do a dry run)
    337   bool dryrun_flag;
    338311};
    339312namespace Queuedetail {
  • src/Actions/ActionSequence.cpp

    r3fa16b r19dfdf  
    3737#include "Actions/ActionSequence.hpp"
    3838#include "Actions/Action.hpp"
    39 #include "Actions/ActionExceptions.hpp"
    4039#include "UIElements/Dialog.hpp"
    4140
     
    5453{
    5554  // we need to override copy cstor as we have pointer referenced objects
    56   for(actionSet::const_iterator it=_other.actions.begin(); it!=_other.actions.end(); it++){
     55  for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){
    5756    actions.push_back((*it)->clone());
    5857  }
     
    120119      // we bypass the normal call
    121120      ActionState::ptr state = (*it)->performCall();
    122       if (state == Action::failure)
    123         throw ActionFailureException() << ActionNameString((*it)->getName());
    124121      states.push_back(state);
    125122    }
  • src/Actions/ActionSequence.hpp

    r3fa16b r19dfdf  
    1919#include <deque>
    2020
    21 class ActionSequenceTest;
    22 
    2321namespace MoleCuilder {
    2422
     
    2927{
    3028  friend class MakroAction;
    31   //!> grant unit test access to private sequence
    32   friend class ::ActionSequenceTest;
    3329public:
    3430  typedef std::deque<Action*> actionSet;
  • src/Actions/Action_impl_pre.hpp

    r3fa16b r19dfdf  
    175175    << "\"" << toPythonString(params. \
    176176        BOOST_PP_SEQ_ELEM(n, paramreferences) \
    177         .getUnvalidated()) \
     177        .get()) \
    178178    << "\"";
    179179
  • src/Actions/BondAction/BondAddAction.cpp

    r3fa16b r19dfdf  
    5757ActionState::ptr BondAddAction::performCall() {
    5858  // check preconditions
    59   World& world = World::getInstance();
    60   if (world.countSelectedAtoms() <= 1) {
    61     STATUS("There must be at least two atoms selected for BondAction Add.");
     59  if (World::getInstance().countSelectedAtoms() != 2) {
     60    STATUS("Exactly two atoms must be selected for BondAction Add.");
    6261    return Action::failure;
    6362  }
    64 
    65   bondPairIds_t bondPairIds;
    66   for (World::AtomSelectionConstIterator firstiter = world.beginAtomSelection();
    67       firstiter != world.endAtomSelection(); ++firstiter) {
    68     for (World::AtomSelectionConstIterator seconditer = firstiter;
    69         seconditer != world.endAtomSelection(); ++seconditer) {
    70       if (firstiter == seconditer)
    71         continue;
    72       if (!(firstiter->second)->IsBondedTo(WorldTime::getTime(), seconditer->second))
    73         bondPairIds.push_back(
    74             std::make_pair((firstiter->second)->getId(), (seconditer->second)->getId()));
    75     }
    76   }
    77   if (bondPairIds.empty()) {
    78     STATUS("All bonds are already present.");
     63  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
     64  if (selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) {
     65    STATUS("There already is a bond in between the two selected atoms.");
    7966    return Action::failure;
    8067  }
    8168
    8269  // create undo
    83   BondAddState *UndoState = new BondAddState(bondPairIds, params);
     70  BondAddState *UndoState = new BondAddState(selected_atoms[0]->getId(), selected_atoms[1]->getId(), params);
    8471
    8572  // execute action
    86   for (bondPairIds_t::const_iterator iter = bondPairIds.begin();
    87       iter != bondPairIds.end(); ++iter) {
    88     atom *firstatom = world.getAtom(AtomById(iter->first));
    89     atom *secondatom = world.getAtom(AtomById(iter->second));
    90     ASSERT((firstatom != NULL) && (secondatom != NULL),
    91         "BondAddAction::performCall() - at least one of the ids "
    92         +toString(iter->first)+" or "+toString(iter->second)+" is not present.");
    93     firstatom->addBond(WorldTime::getTime(), secondatom);
    94     ASSERT( firstatom->IsBondedTo(WorldTime::getTime(), secondatom),
     73  selected_atoms[0]->addBond(WorldTime::getTime(), selected_atoms[1]);
     74  ASSERT( selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1]),
    9575      "BondAddAction::performCall() - adding bond in between "
    96       +toString(*firstatom)+" and "+toString(*secondatom)+" failed.");
    97   }
     76      +toString(*selected_atoms[0])+" and "+toString(*selected_atoms[1])+" failed.");
    9877
    9978  return ActionState::ptr(UndoState);
     
    10483
    10584  // check whether bond already existed
    106   World& world = World::getInstance();
    107   for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin();
    108       iter != state->bondPairIds.end(); ++iter) {
    109     atom *firstatom = world.getAtom(AtomById(iter->first));
    110     atom *secondatom = world.getAtom(AtomById(iter->second));
    111     ASSERT((firstatom != NULL) && (secondatom != NULL),
    112         "BondAddAction::performCall() - at least one of the ids "
    113         +toString(iter->first)+" or "+toString(iter->second)+" is not present.");
    114     if (firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) {
    115       firstatom->removeBond(WorldTime::getTime(), secondatom);
    116     } else {
    117       ELOG(2, "There is no bond in between "+toString(iter->first)
    118           +" and "+toString(iter->second)+".");
    119     }
     85  atom * const first = World::getInstance().getAtom(AtomById(state->firstId));
     86  atom * const second = World::getInstance().getAtom(AtomById(state->secondId));
     87  ASSERT((first != NULL) && (second != NULL),
     88      "BondAddAction::performUndo() - at least one of the ids "
     89      +toString(state->firstId)+" or "+toString(state->secondId)+" is not present.");
     90  if (first->IsBondedTo(WorldTime::getTime(), second)) {
     91    first->removeBond(WorldTime::getTime(), second);
     92  } else {
     93    ELOG(2, "There is no bond in between "+toString(state->firstId)
     94        +" and "+toString(state->secondId)+".");
    12095  }
    12196
     
    127102
    128103  // check whether bond already existed
    129   World& world = World::getInstance();
    130   for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin();
    131       iter != state->bondPairIds.end(); ++iter) {
    132     atom * const firstatom = world.getAtom(AtomById(iter->first));
    133     atom * const secondatom = world.getAtom(AtomById(iter->second));
    134     ASSERT((firstatom != NULL) && (secondatom != NULL),
    135         "BondAddAction::performCall() - at least one of the ids "
    136         +toString(iter->first)+" or "+toString(iter->second)+" is not present.");
    137     if (!firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) {
    138       firstatom->addBond(WorldTime::getTime(), secondatom);
    139     } else {
    140       ELOG(2, "There is already a bond in between "+toString(iter->first)
    141           +" and "+toString(iter->second)+".");
    142     }
     104  atom * const first = World::getInstance().getAtom(AtomById(state->firstId));
     105  atom * const second = World::getInstance().getAtom(AtomById(state->secondId));
     106  ASSERT((first != NULL) && (second != NULL),
     107      "BondAddAction::performRedo() - at least one of the ids "
     108      +toString(state->firstId)+" or "+toString(state->secondId)+" is not present.");
     109  if (!first->IsBondedTo(WorldTime::getTime(), second)) {
     110    first->addBond(WorldTime::getTime(), second);
     111  } else {
     112    ELOG(2, "There is already a bond in between "+toString(state->firstId)
     113        +" and "+toString(state->secondId)+".");
    143114  }
    144115
  • src/Actions/BondAction/BondAddAction.def

    r3fa16b r19dfdf  
    88// all includes and forward declarations necessary for non-integral types below
    99#include "types.hpp"
    10 #include <vector>
    11 #include <utility>
    12 
    13 typedef std::vector<std::pair<atomId_t,atomId_t> > bondPairIds_t;
    1410
    1511// i.e. there is an integer with variable name Z that can be found in
     
    2420#undef paramvalids
    2521
    26 #define statetypes (bondPairIds_t)
    27 #define statereferences (bondPairIds)
     22#define statetypes (atomId_t)(atomId_t)
     23#define statereferences (firstId)(secondId)
    2824
    2925// some defines for all the names, you may use ACTION, STATE and PARAMS
     
    3228#define MENUPOSITION 1
    3329#define ACTIONNAME Add
    34 #define TOKEN "add-bonds"
     30#define TOKEN "add-bond"
    3531
    3632// finally the information stored in the ActionTrait specialization
    37 #define DESCRIPTION "add bonds in between any number of selected atoms"
     33#define DESCRIPTION "add bond in between two selected atoms"
    3834#undef SHORTFORM
  • src/Actions/BondAction/BondRemoveAction.cpp

    r3fa16b r19dfdf  
    5757ActionState::ptr BondRemoveAction::performCall() {
    5858  // check preconditions
    59   World& world = World::getInstance();
    60   if (world.countSelectedAtoms() <= 1) {
    61     STATUS("At least two atoms must be selected for BondAction Remove.");
     59  if (World::getInstance().countSelectedAtoms() != 2) {
     60    STATUS("Exactly two atoms must be selected for BondAction Remove.");
    6261    return Action::failure;
    6362  }
    64 
    65   bondPairIds_t bondPairIds;
    66   for (World::AtomSelectionConstIterator firstiter = world.beginAtomSelection();
    67       firstiter != world.endAtomSelection(); ++firstiter) {
    68     for (World::AtomSelectionConstIterator seconditer = firstiter;
    69         seconditer != world.endAtomSelection(); ++seconditer) {
    70       if (firstiter == seconditer)
    71         continue;
    72       if ((firstiter->second)->IsBondedTo(WorldTime::getTime(), seconditer->second))
    73         bondPairIds.push_back(
    74             std::make_pair((firstiter->second)->getId(), (seconditer->second)->getId()));
    75     }
    76   }
    77   if (bondPairIds.empty()) {
    78     STATUS("No bonds are present.");
     63  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
     64  if (!selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) {
     65    STATUS("There is no bond in between the two selected atoms.");
    7966    return Action::failure;
    8067  }
    8168
    8269  // create undo
    83   BondRemoveState *UndoState = new BondRemoveState(bondPairIds, params);
     70  BondRemoveState *UndoState = new BondRemoveState(selected_atoms[0]->getId(), selected_atoms[1]->getId(), params);
    8471
    8572  // execute action
    86   for (bondPairIds_t::const_iterator iter = bondPairIds.begin();
    87       iter != bondPairIds.end(); ++iter) {
    88     atom *firstatom = world.getAtom(AtomById(iter->first));
    89     atom *secondatom = world.getAtom(AtomById(iter->second));
    90     ASSERT((firstatom != NULL) && (secondatom != NULL),
    91         "BondAddAction::performCall() - at least one of the ids "
    92         +toString(iter->first)+" or "+toString(iter->second)+" is not present.");
    93     firstatom->removeBond(WorldTime::getTime(), secondatom);
    94     ASSERT( !firstatom->IsBondedTo(WorldTime::getTime(), secondatom),
    95       "BondAddAction::performCall() - adding bond in between "
    96       +toString(*firstatom)+" and "+toString(*secondatom)+" failed.");
    97   }
     73  selected_atoms[0]->removeBond(WorldTime::getTime(), selected_atoms[1]);
     74  ASSERT( !selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1]),
     75      "BondRemoveAction::performCall() - removing bond in between "
     76      +toString(*selected_atoms[0])+" and "+toString(*selected_atoms[1])+" failed.");
    9877
    9978  return ActionState::ptr(UndoState);
     
    10382  BondRemoveState *state = assert_cast<BondRemoveState*>(_state.get());
    10483
    105   World& world = World::getInstance();
    106   for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin();
    107       iter != state->bondPairIds.end(); ++iter) {
    108     atom * const firstatom = world.getAtom(AtomById(iter->first));
    109     atom * const secondatom = world.getAtom(AtomById(iter->second));
    110     ASSERT((firstatom != NULL) && (secondatom != NULL),
    111         "BondAddAction::performCall() - at least one of the ids "
    112         +toString(iter->first)+" or "+toString(iter->second)+" is not present.");
    113     if (!firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) {
    114       firstatom->addBond(WorldTime::getTime(), secondatom);
    115     } else {
    116       ELOG(2, "There is already a bond in between "+toString(iter->first)
    117           +" and "+toString(iter->second)+".");
    118     }
     84  // check whether bond already existed
     85  atom * const first = World::getInstance().getAtom(AtomById(state->firstId));
     86  atom * const second = World::getInstance().getAtom(AtomById(state->secondId));
     87  ASSERT((first != NULL) && (second != NULL),
     88      "BondRemoveAction::performUndo() - at least one of the ids "
     89      +toString(state->firstId)+" or "+toString(state->secondId)+" is not present.");
     90  if (!first->IsBondedTo(WorldTime::getTime(), second)) {
     91    first->addBond(WorldTime::getTime(), second);
     92  } else {
     93    ELOG(2, "There is already a bond in between "+toString(state->firstId)
     94        +" and "+toString(state->secondId)+".");
    11995  }
    12096
     
    125101  BondRemoveState *state = assert_cast<BondRemoveState*>(_state.get());
    126102
    127   World& world = World::getInstance();
    128   for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin();
    129       iter != state->bondPairIds.end(); ++iter) {
    130     atom *firstatom = world.getAtom(AtomById(iter->first));
    131     atom *secondatom = world.getAtom(AtomById(iter->second));
    132     ASSERT((firstatom != NULL) && (secondatom != NULL),
    133         "BondAddAction::performCall() - at least one of the ids "
    134         +toString(iter->first)+" or "+toString(iter->second)+" is not present.");
    135     if (firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) {
    136       firstatom->removeBond(WorldTime::getTime(), secondatom);
    137     } else {
    138       ELOG(2, "There is no bond in between "+toString(iter->first)
    139           +" and "+toString(iter->second)+".");
    140     }
     103  // check whether bond already existed
     104  atom * const first = World::getInstance().getAtom(AtomById(state->firstId));
     105  atom * const second = World::getInstance().getAtom(AtomById(state->secondId));
     106  ASSERT((first != NULL) && (second != NULL),
     107      "BondRemoveAction::performRedo() - at least one of the ids "
     108      +toString(state->firstId)+" or "+toString(state->secondId)+" is not present.");
     109  if (first->IsBondedTo(WorldTime::getTime(), second)) {
     110    first->removeBond(WorldTime::getTime(), second);
     111  } else {
     112    ELOG(2, "There is no bond in between "+toString(state->firstId)
     113        +" and "+toString(state->secondId)+".");
    141114  }
    142115
  • src/Actions/BondAction/BondRemoveAction.def

    r3fa16b r19dfdf  
    77
    88// all includes and forward declarations necessary for non-integral types below
    9 #include "types.hpp"
    10 #include <vector>
    11 #include <utility>
    12 
    13 typedef std::vector<std::pair<atomId_t,atomId_t> > bondPairIds_t;
    149
    1510// i.e. there is an integer with variable name Z that can be found in
     
    2419#undef paramvalids
    2520
    26 #define statetypes (bondPairIds_t)
    27 #define statereferences (bondPairIds)
     21#define statetypes (atomId_t)(atomId_t)
     22#define statereferences (firstId)(secondId)
    2823
    2924// some defines for all the names, you may use ACTION, STATE and PARAMS
     
    3227#define MENUPOSITION 2
    3328#define ACTIONNAME Remove
    34 #define TOKEN "remove-bonds"
     29#define TOKEN "remove-bond"
    3530
    3631// finally the information stored in the ActionTrait specialization
    37 #define DESCRIPTION "remove all  bonds present between selected atoms"
     32#define DESCRIPTION "remove the bond in between two selected atoms"
    3833#undef SHORTFORM
  • src/Actions/CommandAction/LoadSessionAction.cpp

    r3fa16b r19dfdf  
    5858
    5959#ifdef HAVE_PYTHON
    60   if (executePythonScriptFile(params.filename.get()))
     60  if (executePythonScript(params.filename.get().string()))
    6161    return Action::success;
    6262  else {
  • src/Actions/CommandAction/VerboseAction.cpp

    r3fa16b r19dfdf  
    5252  unsigned int oldverbosity = getVerbosity();
    5353
    54   // prepare undo state
    55   CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params);
    56 
    5754  if (oldverbosity != params.verbosity.get()) {
     55    // prepare undo state
     56    CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params);
    5857    // set new verbosity
    5958    setVerbosity(params.verbosity.get());
    6059    LOG(0, "Setting verbosity from " << oldverbosity << " to " << params.verbosity.get() << ".");
     60    return ActionState::ptr(UndoState);
    6161  } else {
    6262    LOG(0, "Verbosity remains unchanged at " << oldverbosity << ".");
     63    return Action::success;
    6364  }
    64   return ActionState::ptr(UndoState);
    6565}
    6666
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    r3fa16b r19dfdf  
    129129    BondGraph *BG = World::getInstance().getBondGraph();
    130130    World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection());
    131     // check whether bond graph is correct
    132     if (!BG->checkBondDegree(Set))
    133       BG->CorrectBondDegree(Set);
    134     else
    135       LOG(1, "INFO: Bond degrees all valid, not correcting.");
     131    BG->CorrectBondDegree(Set);
    136132  }
    137133
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    r3fa16b r19dfdf  
    134134    // Phase One: obtain ids
    135135    mpqccontroller.requestIds(NumberJobs);
    136     if (mpqccontroller.getExitflag() != 0)
    137       return Action::failure;
    138136
    139137    // Phase Two: add MPQCJobs and send
     
    161159    wait_thread.join();
    162160    stop();
    163     if (mpqccontroller.getExitflag() != 0)
    164       return Action::failure;
    165 
    166161    mpqccontroller.getResults(shortrangedata);
    167     if (mpqccontroller.getExitflag() != 0)
    168       return Action::failure;
    169162
    170163    Exitflag += mpqccontroller.getExitflag();
     
    196189    mpqccontroller.run();
    197190    stop();
    198     if (mpqccontroller.getExitflag() != 0)
    199       return Action::failure;
    200191
    201192    // get back the results and place them in shortrangedata
     
    204195        "FragmentationFragmentationAutomationAction::performCall() - number of converted results "
    205196        +toString(shortrangedata.size())+" and number of jobs "+toString(NumberJobs)+ " differ.");
    206     if (mpqccontroller.getExitflag() != 0)
    207       return Action::failure;
    208197
    209198    Exitflag += mpqccontroller.getExitflag();
     
    245234    const size_t NoJobs = shortrangedata.size()+full_sample.size();
    246235    vmgcontroller.requestIds(2*NoJobs);
    247     if (vmgcontroller.getExitflag() != 0)
    248       return Action::failure;
    249236
    250237    // Phase Five a: create VMGJobs for electronic charge distribution
     
    267254    // Phase Six a: calculate result
    268255    vmgcontroller.waitforResults(NoJobs);
    269     if (vmgcontroller.getExitflag() != 0)
    270       return Action::failure;
    271256    vmgcontroller.getResults(longrangedata);
    272257    ASSERT( NoJobs == longrangedata.size(),
     
    297282      // Phase Six b: calculate result
    298283      vmgcontroller.waitforResults(NoJobs);
    299       if (vmgcontroller.getExitflag() != 0)
    300         return Action::failure;
    301284      vmgcontroller.getResults(longrangedata_both);
    302285      ASSERT( NoJobs == longrangedata_both.size(),
     
    304287          +toString(full_sample.size())+"="+toString(NoJobs)
    305288          +" and second VMGresults "+toString(longrangedata_both.size())+" don't match.");
    306       if (vmgcontroller.getExitflag() != 0)
    307         return Action::failure;
    308289      Exitflag += vmgcontroller.getExitflag();
    309290
  • src/Actions/FragmentationAction/MolecularDynamicsAction.cpp

    r3fa16b r19dfdf  
    5454
    5555// static instances
    56 ActionSequence FragmentationMolecularDynamicsAction::prototype_actions;
     56ActionSequence FragmentationMolecularDynamicsAction::actions;
    5757bool FragmentationMolecularDynamicsAction::isPrepared = false;
    5858
     
    6262  // present. If not, we still copy the position cleanly into a new step where then
    6363  // forces are set according to summed fragmentary contributions. This is much cleaner.
    64   prototype_actions.addAction(AR.getActionByName(std::string("verlet-integration")));
    65   prototype_actions.addAction(AR.getActionByName(std::string("output")));
    66   prototype_actions.addAction(AR.getActionByName(std::string("clear-fragment-results")));
    67   prototype_actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
    68   prototype_actions.addAction(AR.getActionByName(std::string("create-adjacency")));
    69   prototype_actions.addAction(AR.getActionByName(std::string("correct-bonddegree")));
    70   prototype_actions.addAction(AR.getActionByName(std::string("update-molecules")));
    71   prototype_actions.addAction(AR.getActionByName(std::string("fragment-molecule")));
    72   prototype_actions.addAction(AR.getActionByName(std::string("fragment-automation")));
    73   prototype_actions.addAction(AR.getActionByName(std::string("analyse-fragment-results")));
     64  actions.addAction(AR.getActionByName(std::string("verlet-integration")));
     65  actions.addAction(AR.getActionByName(std::string("output")));
     66  actions.addAction(AR.getActionByName(std::string("clear-fragment-results")));
     67  actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
     68  actions.addAction(AR.getActionByName(std::string("create-adjacency")));
     69  actions.addAction(AR.getActionByName(std::string("update-molecules")));
     70  actions.addAction(AR.getActionByName(std::string("fragment-molecule")));
     71  actions.addAction(AR.getActionByName(std::string("fragment-automation")));
     72  actions.addAction(AR.getActionByName(std::string("analyse-fragment-results")));
    7473  isPrepared = true;
    7574}
     
    7877{
    7978  // empty sequence
    80   while (prototype_actions.removeLastAction() != NULL);
     79  while (actions.removeLastAction() != NULL);
    8180  isPrepared = false;
    8281}
     
    107106#endif
    108107        removeAction(std::string("create-adjacency"));
    109 
    110 #ifndef NDEBUG
    111     status &=
    112 #endif
    113         removeAction(std::string("correct-bonddegree"));
    114108
    115109#ifndef NDEBUG
  • src/Actions/FragmentationAction/StructuralOptimizationAction.cpp

    r3fa16b r19dfdf  
    5454
    5555// static instances
    56 ActionSequence FragmentationStructuralOptimizationAction::prototype_actions;
     56ActionSequence FragmentationStructuralOptimizationAction::actions;
    5757bool FragmentationStructuralOptimizationAction::isPrepared = false;
    5858
     
    6262  // present. If not, we still copy the position cleanly into a new step where then
    6363  // forces are set according to summed fragmentary contributions. This is much cleaner.
    64   prototype_actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
    65   prototype_actions.addAction(AR.getActionByName(std::string("create-adjacency")));
    66   prototype_actions.addAction(AR.getActionByName(std::string("correct-bonddegree")));
    67   prototype_actions.addAction(AR.getActionByName(std::string("update-molecules")));
    68   prototype_actions.addAction(AR.getActionByName(std::string("fragment-molecule")));
    69   prototype_actions.addAction(AR.getActionByName(std::string("fragment-automation")));
    70   prototype_actions.addAction(AR.getActionByName(std::string("analyse-fragment-results")));
    71   prototype_actions.addAction(AR.getActionByName(std::string("force-annealing")));
    72   prototype_actions.addAction(AR.getActionByName(std::string("output")));
    73   prototype_actions.addAction(AR.getActionByName(std::string("clear-fragment-results")));
     64  actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
     65  actions.addAction(AR.getActionByName(std::string("create-adjacency")));
     66  actions.addAction(AR.getActionByName(std::string("update-molecules")));
     67  actions.addAction(AR.getActionByName(std::string("fragment-molecule")));
     68  actions.addAction(AR.getActionByName(std::string("fragment-automation")));
     69  actions.addAction(AR.getActionByName(std::string("analyse-fragment-results")));
     70  actions.addAction(AR.getActionByName(std::string("force-annealing")));
     71  actions.addAction(AR.getActionByName(std::string("output")));
     72  actions.addAction(AR.getActionByName(std::string("clear-fragment-results")));
    7473  isPrepared = true;
    7574}
     
    7877{
    7978  // empty sequence
    80   while (prototype_actions.removeLastAction() != NULL);
     79  while (actions.removeLastAction() != NULL);
    8180  isPrepared = false;
    8281}
     
    107106#endif
    108107        removeAction(std::string("create-adjacency"));
    109 
    110 #ifndef NDEBUG
    111     status &=
    112 #endif
    113         removeAction(std::string("correct-bonddegree"));
    114108
    115109#ifndef NDEBUG
  • src/Actions/GlobalListOfActions.hpp

    r3fa16b r19dfdf  
    3535  (AtomRemove) \
    3636  (AtomRotateAroundOriginByAngle) \
    37   (AtomSaturate) \
    3837  (AtomSaveSelectedAtoms) \
    3938  (AtomTranslate) \
     
    4140  (BondAdd) \
    4241  (BondRemove) \
    43   (CommandDryRun) \
    4442  (CommandElementDb) \
    4543  (CommandBondLengthTable) \
     
    4745  (CommandHelp) \
    4846  (CommandHelpRedistribute) \
    49   (CommandNoDryRun) \
    5047  (CommandSetRandomNumbersEngine) \
    5148  (CommandSetRandomNumbersDistribution) \
  • src/Actions/GraphAction/SubgraphDissectionAction.cpp

    r3fa16b r19dfdf  
    5858
    5959// static instances
    60 ActionSequence GraphSubgraphDissectionAction::prototype_actions;
     60ActionSequence GraphSubgraphDissectionAction::actions;
    6161bool GraphSubgraphDissectionAction::isPrepared = false;
    6262
    6363void GraphSubgraphDissectionAction::prepare(ActionRegistry &AR)
    6464{
    65   prototype_actions.addAction(AR.getActionByName(std::string("push-atom-selection")));
    66   prototype_actions.addAction(AR.getActionByName(std::string("select-all-atoms")));
    67   prototype_actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
    68   prototype_actions.addAction(AR.getActionByName(std::string("create-adjacency")));
    69   prototype_actions.addAction(AR.getActionByName(std::string("update-molecules")));
    70   prototype_actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));
     65  actions.addAction(AR.getActionByName(std::string("push-atom-selection")));
     66  actions.addAction(AR.getActionByName(std::string("select-all-atoms")));
     67  actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
     68  actions.addAction(AR.getActionByName(std::string("create-adjacency")));
     69  actions.addAction(AR.getActionByName(std::string("update-molecules")));
     70  actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));
    7171  isPrepared = true;
    7272}
     
    7575{
    7676  // empty sequence
    77   while (prototype_actions.removeLastAction() != NULL);
     77  while (actions.removeLastAction() != NULL);
    7878  isPrepared = false;
    7979}
  • src/Actions/Makefile.am

    r3fa16b r19dfdf  
    4141  Actions/Calculation.hpp \
    4242  Actions/Calculation_impl.hpp \
    43   Actions/DryRunAdvocate.hpp \
    4443  Actions/ErrorAction.hpp \
    4544  Actions/GlobalListOfActions.hpp \
     
    151150  Actions/AtomAction/RemoveAction.cpp \
    152151  Actions/AtomAction/RotateAroundOriginByAngleAction.cpp \
    153   Actions/AtomAction/SaturateAction.cpp \
    154152  Actions/AtomAction/SaveSelectedAtomsAction.cpp \
    155153  Actions/AtomAction/TranslateAction.cpp \
     
    161159  Actions/AtomAction/RemoveAction.hpp \
    162160  Actions/AtomAction/RotateAroundOriginByAngleAction.hpp \
    163   Actions/AtomAction/SaturateAction.hpp \
    164161  Actions/AtomAction/SaveSelectedAtomsAction.hpp \
    165162  Actions/AtomAction/TranslateAction.hpp \
     
    171168  Actions/AtomAction/RemoveAction.def \
    172169  Actions/AtomAction/RotateAroundOriginByAngleAction.def \
    173   Actions/AtomAction/SaturateAction.def \
    174170  Actions/AtomAction/SaveSelectedAtomsAction.def \
    175171  Actions/AtomAction/TranslateAction.def \
     
    188184CMDACTIONSOURCE = \
    189185  Actions/CommandAction/BondLengthTableAction.cpp \
    190   Actions/CommandAction/DryRunAction.cpp \
    191186  Actions/CommandAction/ElementDbAction.cpp \
    192187  Actions/CommandAction/FastParsingAction.cpp \
    193188  Actions/CommandAction/HelpAction.cpp \
    194189  Actions/CommandAction/HelpRedistributeAction.cpp \
    195   Actions/CommandAction/NoDryRunAction.cpp \
    196190  Actions/CommandAction/StoreSessionAction.cpp \
    197191  Actions/CommandAction/VerboseAction.cpp \
     
    200194CMDACTIONHEADER = \
    201195  Actions/CommandAction/BondLengthTableAction.hpp \
    202   Actions/CommandAction/DryRunAction.hpp \
    203196  Actions/CommandAction/ElementDbAction.hpp \
    204197  Actions/CommandAction/FastParsingAction.hpp \
    205198  Actions/CommandAction/HelpAction.hpp \
    206199  Actions/CommandAction/HelpRedistributeAction.hpp \
    207   Actions/CommandAction/NoDryRunAction.hpp \
    208200  Actions/CommandAction/StoreSessionAction.hpp \
    209201  Actions/CommandAction/VerboseAction.hpp \
     
    212204CMDACTIONDEFS = \
    213205  Actions/CommandAction/BondLengthTableAction.def \
    214   Actions/CommandAction/DryRunAction.def \
    215206  Actions/CommandAction/ElementDbAction.def \
    216207  Actions/CommandAction/FastParsingAction.def \
    217208  Actions/CommandAction/HelpAction.def \
    218209  Actions/CommandAction/HelpRedistributeAction.def \
    219   Actions/CommandAction/NoDryRunAction.def \
    220210  Actions/CommandAction/StoreSessionAction.def \
    221211  Actions/CommandAction/VerboseAction.def \
  • src/Actions/MakroAction.cpp

    r3fa16b r19dfdf  
    6060  ActionSequence::stateSet states;
    6161};
    62 
    63 MakroAction::MakroAction(const MakroAction &_instance) :
    64     Action(_instance.Traits),
    65     actions(_instance.actions)
    66 {}
    6762
    6863MakroAction::MakroAction(const ActionTrait &_trait,ActionSequence& _actions) :
  • src/Actions/MakroAction.hpp

    r3fa16b r19dfdf  
    1818
    1919#include "Actions/Action.hpp"
    20 #include "Actions/ActionSequence.hpp"
    21 
    22 class ActionSequenceTest;
    2320
    2421namespace MoleCuilder {
    2522  class ActionRegistry;
     23  class ActionSequence;
    2624
    2725/**
     
    3230class MakroAction : public Action
    3331{
    34   //!> grant unit test access to sequence
    35   friend class ::ActionSequenceTest;
    3632public:
    37   MakroAction(const MakroAction &_instance);
    3833  MakroAction(const ActionTrait &_trait,ActionSequence& _actions);
    3934  virtual ~MakroAction();
     
    8378  Dialog *fillDialog(Dialog *dialog);
    8479
    85   //!> this points to the instance of a specific MakroAction, we need to ref for callAll()
    8680  ActionSequence &actions;
    8781};
  • src/Actions/MakroAction_impl_header.hpp

    r3fa16b r19dfdf  
    263263  //!> flag to check whether actions have been prepared
    264264  static bool isPrepared;
    265   //!> sequence of prototype actions for this macro action
    266   static ActionSequence prototype_actions;
    267   //!> sequence of actions for this specific instance
    268   ActionSequence actions;
     265  //!> sequence of actions for this macro action
     266  static ActionSequence actions;
    269267
    270268private:
  • src/Actions/MakroAction_impl_pre.hpp

    r3fa16b r19dfdf  
    263263// =========== constructor ===========
    264264ACTION::ACTION () :
    265   MakroAction(ActionTraits< ACTION >(), actions),
    266   actions(prototype_actions)
     265  MakroAction(ActionTraits< ACTION >(), actions)
    267266{}
    268267
     
    295294Action* ACTION::clone(enum QueryOptions flag) const
    296295{
    297   return new ACTION();
     296  if (flag == Interactive)
     297    return new ACTION();
     298  else
     299    return new ACTION(*this);
    298300}
    299301
  • src/Actions/MoleculeAction/TranslateAction.cpp

    r3fa16b r19dfdf  
    5656
    5757// static instances
    58 ActionSequence MoleculeTranslateAction::prototype_actions;
     58ActionSequence MoleculeTranslateAction::actions;
    5959bool MoleculeTranslateAction::isPrepared = false;
    6060
     
    6363  // we simply have to select all the molecule's atoms and use the respective
    6464  // translate Action
    65   prototype_actions.addAction(AR.getActionByName(std::string("push-atom-selection")));
    66   prototype_actions.addAction(AR.getActionByName(std::string("select-molecules-atoms")));
    67   prototype_actions.addAction(AR.getActionByName(std::string("translate-atoms")));
    68   prototype_actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));
     65  actions.addAction(AR.getActionByName(std::string("push-atom-selection")));
     66  actions.addAction(AR.getActionByName(std::string("select-molecules-atoms")));
     67  actions.addAction(AR.getActionByName(std::string("translate-atoms")));
     68  actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));
    6969  isPrepared = true;
    7070}
     
    7373{
    7474  // empty sequence
    75   while (prototype_actions.removeLastAction() != NULL);
     75  while (actions.removeLastAction() != NULL);
    7676  isPrepared = false;
    7777}
  • src/Actions/ParserAction/SetParserParametersAction.cpp

    r3fa16b r19dfdf  
    6666  // obtain information
    6767  std::stringstream newparamstream;
    68   const std::vector< KeyValuePair > keyvalues = params.newparams.get();
     68  const std::vector< std::string > keyvalues = params.newparams.get();
    6969  std::for_each(keyvalues.begin(), keyvalues.end(), newparamstream << boost::lambda::_1 << ";");
    7070  newparamstream >> *parameters;
     
    9090  FormatParser_Parameters *parser = FormatParserStorage::getInstance().get(type).parameters;
    9191  std::stringstream newparamstream;
    92   const std::vector< KeyValuePair > keyvalues = state->params.newparams.get();
     92  const std::vector< std::string > keyvalues = state->params.newparams.get();
    9393  std::for_each(keyvalues.begin(), keyvalues.end(), newparamstream << boost::lambda::_1 << ";");
    9494  newparamstream >> *parser;
  • src/Actions/ParserAction/SetParserParametersAction.def

    r3fa16b r19dfdf  
    1313#include "Parameters/Validators/Specific/KeyValueValidator.hpp"
    1414#include "Parameters/Validators/Specific/ParserTypeValidator.hpp"
    15 #include "Parameters/Specifics/KeyValuePair.hpp"
    1615
    1716// i.e. there is an integer with variable name Z that can be found in
    1817// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1918// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    20 #define paramtypes (std::string)(std::vector<KeyValuePair>)
     19#define paramtypes (std::string)(std::vector<std::string>)
    2120#define paramtokens ("set-parser-parameters")("parser-parameters")
    2221#define paramdescriptions ("name of the parser to change")("parameter (key = value;)")
     
    2524#define paramvalids \
    2625(ParserTypeValidator())\
    27 (STLVectorValidator< std::vector<KeyValuePair> >(1, 99, KeyValueValidator()))
     26(STLVectorValidator< std::vector<std::string> >(1, 99, KeyValueValidator()))
    2827
    2928#define statetypes (std::string)
  • src/Actions/RandomNumbersAction/SetRandomNumbersDistributionAction.def

    r3fa16b r19dfdf  
    1111#include "Parameters/Validators/Specific/RandomNumberValidators.hpp"
    1212#include "Parameters/Validators/Specific/KeyValueValidator.hpp"
    13 #include "Parameters/Specifics/KeyValuePair.hpp"
    1413
    1514// i.e. there is an integer with variable name Z that can be found in
    1615// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1716// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    18 #define paramtypes (std::string)(KeyValuePair)
     17#define paramtypes (std::string)(std::string)
    1918#define paramtokens ("set-random-number-distribution")("random-number-distribution-parameters")
    2019#define paramdescriptions ("name of the distribution from boost::random")("parameter set for requested distribution")
    21 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(KeyValuePair("p=-1")))
     20#define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(std::string("p=-1")))
    2221#define paramreferences (distribution_type)(parameters)
    2322#define paramvalids \
  • src/Actions/RandomNumbersAction/SetRandomNumbersEngineAction.def

    r3fa16b r19dfdf  
    1010#include "Parameters/Validators/Specific/RandomNumberValidators.hpp"
    1111#include "Parameters/Validators/Specific/KeyValueValidator.hpp"
    12 #include "Parameters/Specifics/KeyValuePair.hpp"
    1312
    1413// i.e. there is an integer with variable name Z that can be found in
    1514// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1615// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    17 #define paramtypes (std::string)(KeyValuePair)
     16#define paramtypes (std::string)(std::string)
    1817#define paramtokens ("set-random-number-engine")("random-number-engine-parameters")
    1918#define paramdescriptions ("name of the pseudo-random engine from boost::random")("seed of the pseudo-random number sequence")
    20 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(KeyValuePair("seed=-1")))
     19#define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(std::string("seed=-1")))
    2120#define paramreferences (engine_type)(parameters)
    2221#define paramvalids \
  • src/Actions/SelectionAction/Atoms/PopAtomsAction.cpp

    r3fa16b r19dfdf  
    6363ActionState::ptr SelectionPopAtomsAction::performUndo(ActionState::ptr _state) {
    6464  SelectionPopAtomsState *state = static_cast<SelectionPopAtomsState *>(_state.get());
    65   LOG(1, "Pushing atom selection.");
     65  LOG(1, "Popping atom selection.");
    6666  World::getInstance().pushAtomSelection();
    6767
  • src/Actions/SelectionAction/Atoms/PushAtomsAction.cpp

    r3fa16b r19dfdf  
    5454
    5555ActionState::ptr SelectionPushAtomsAction::performUndo(ActionState::ptr _state) {
    56   LOG(1, "Popping atom selection.");
     56  LOG(1, "Pushing atom selection.");
    5757  World::getInstance().popAtomSelection();
    5858
  • src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp

    r3fa16b r19dfdf  
    5555ActionState::ptr SelectionMoleculeOfAtomAction::performCall() {
    5656  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    57   LOG(1, "Selecting molecule to currently selected atoms: " << World::getInstance().countSelectedAtoms());
     57  LOG(1, "Selecting molecule to currently selected atoms.");
    5858  World::getInstance().selectAllMolecules(MoleculesByAtomSelection());
    5959  LOG(0, World::getInstance().countSelectedMolecules() << " molecules selected.");
  • src/Actions/UndoRedoHelpers.cpp

    r3fa16b r19dfdf  
    131131{
    132132  bool status = true;
    133   std::vector< BondInfo >::const_iterator iter = bonds.begin();
    134   for(;iter != bonds.end(); ++iter) {
    135     if (!(*iter).RecreateBond()) {
     133  for(std::vector< BondInfo >::const_iterator iter = bonds.begin();
     134      iter != bonds.end(); ++iter)
     135    if (!(*iter).RecreateBond())
    136136      status = false;
    137       break;
    138     }
    139   }
    140   if (!status) {
    141     // remove all added bonds again
    142     for(std::vector< BondInfo >::const_iterator removeiter = bonds.begin();
    143         removeiter != iter; ++removeiter) {
    144       removeiter->RemoveBond();
    145     }
    146   }
    147137  return status;
    148138}
  • src/Actions/Values.cpp

    r3fa16b r19dfdf  
    3737#include "CodePatterns/Assert.hpp"
    3838
    39 #include "Box.hpp"
    4039#include "LinearAlgebra/BoxVector.hpp"
    4140#include "LinearAlgebra/RealSpaceMatrix.hpp"
    4241#include "LinearAlgebra/Vector.hpp"
     42#include "Box.hpp"
    4343
    4444#include "Values.hpp"
  • src/Actions/Values.hpp

    r3fa16b r19dfdf  
    1515
    1616#include "LinearAlgebra/defs.hpp"
    17 
    18 #include <string>
    1917
    2018class Box;
     
    4745};
    4846
     47
    4948#endif /* VALUES_HPP_ */
    50 
  • src/Actions/toCLIString.cpp

    r3fa16b r19dfdf  
    4040#include "LinearAlgebra/RealSpaceMatrix.hpp"
    4141#include "LinearAlgebra/Vector.hpp"
    42 #include "Parameters/Specifics/KeyValuePair.hpp"
    43 
    44 #include "Actions/toPythonString.hpp"
    4542
    4643template <>
     
    6865    << _value.at(2,0) << ","
    6966    << _value.at(2,1) << ","
    70     << _value.at(2,2)
    71     << "\"";
     67    << _value.at(2,2) << "\"";
    7268  return output.str();
    7369}
     
    7773{
    7874  std::stringstream output;
    79   output << "\"" << toPythonString(_value) << "\"";
     75  output << "\"" << _value[0] << "," << _value[1] << "," << _value[2] << "\"";
    8076  return output.str();
    8177}
     
    8884  return output.str();
    8985}
    90 
    91 template <>
    92 const std::string toCLIString( const KeyValuePair& _value)
    93 {
    94   std::stringstream output;
    95   output << "\"" << toPythonString(_value) << "\"";
    96   return output.str();
    97 }
  • src/Actions/toCLIString.hpp

    r3fa16b r19dfdf  
    2121
    2222class element;
    23 struct KeyValuePair;
    2423class RealSpaceMatrix;
    2524class Vector;
     
    7877template <> const std::string toCLIString( const std::string& _value);
    7978
    80 template <> const std::string toCLIString( const KeyValuePair& _value);
    81 
    8279#endif /* TOCLISTRING_HPP_ */
  • src/Actions/toPythonString.cpp

    r3fa16b r19dfdf  
    4141#include "LinearAlgebra/Vector.hpp"
    4242
    43 #include "Parameters/Specifics/KeyValuePair.hpp"
    44 
    4543template <>
    4644const std::string toPythonString( const boost::filesystem::path & _value)
     
    5452  std::stringstream output;
    5553  output << _value.getAtomicNumber();
    56   return output.str();
    57 }
    58 
    59 template <>
    60 const std::string toPythonString( const KeyValuePair & _value)
    61 {
    62   std::stringstream output;
    63   const char semicolon(';');
    64   const size_t semicolon_pos = _value.find_last_of(semicolon, std::string::npos);
    65   const size_t final_equality_pos = _value.find('=', semicolon_pos);
    66   output << _value;
    67   if ((semicolon_pos == std::string::npos)
    68       || (final_equality_pos != std::string::npos))
    69     output << semicolon;
    7054  return output.str();
    7155}
  • src/Actions/toPythonString.hpp

    r3fa16b r19dfdf  
    2121
    2222class element;
    23 struct KeyValuePair;
    2423class RealSpaceMatrix;
    2524class Vector;
     
    7271template <> const std::string toPythonString( const boost::filesystem::path & _value);
    7372
    74 template <> const std::string toPythonString( const KeyValuePair& _value);
    75 
    7673template <> const std::string toPythonString( const RealSpaceMatrix& _value);
    7774
  • src/Actions/unittests/ActionSequenceUnitTest.cpp

    r3fa16b r19dfdf  
    301301  ActionSequence *sequence = new ActionSequence();
    302302  ActionTrait wasCalledTrait("wasCalledActionStub");
    303   sequence->addAction(new wasCalledActionStub(wasCalledTrait));
    304   sequence->addAction(new wasCalledActionStub(wasCalledTrait));
     303  wasCalledActionStub *wasCalled1 = new wasCalledActionStub(wasCalledTrait);
     304  wasCalledActionStub *wasCalled2 = new wasCalledActionStub(wasCalledTrait);
     305  sequence->addAction(wasCalled1);
     306  sequence->addAction(wasCalled2);
    305307
    306308  ActionTrait MakroTrait("Test MakroAction");
    307309  MakroAction act(MakroTrait,*sequence);
    308   wasCalledActionStub *wasCalled1 =
    309       static_cast<wasCalledActionStub *>(act.actions.actions.front());
    310   wasCalledActionStub *wasCalled2 =
    311       static_cast<wasCalledActionStub *>(act.actions.actions.back());
    312310
    313311  act.call();
    314312
    315   CPPUNIT_ASSERT_EQUAL(true,
    316       static_cast<wasCalledActionStub *>(act.actions.actions.front())->wasCalled());
    317   CPPUNIT_ASSERT_EQUAL(true,
    318       static_cast<wasCalledActionStub *>(act.actions.actions.back())->wasCalled());
     313  CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled());
     314  CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled());
    319315
    320316  ActionQueue::getInstance().undoLast();
    321317
    322   CPPUNIT_ASSERT_EQUAL(false,
    323       static_cast<wasCalledActionStub *>(act.actions.actions.front())->wasCalled());
    324   CPPUNIT_ASSERT_EQUAL(false,
    325       static_cast<wasCalledActionStub *>(act.actions.actions.back())->wasCalled());
     318  CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled());
     319  CPPUNIT_ASSERT_EQUAL(false,wasCalled2->wasCalled());
    326320
    327321  delete sequence;
  • src/Actions/unittests/stubs/DummyUI.hpp

    r3fa16b r19dfdf  
    4747  virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = ""){};
    4848  virtual void queryFiles(Parameter< std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = ""){};
    49   virtual void queryKeyValuePair(Parameter<KeyValuePair> &, const std::string ="", const std::string = ""){};
    50   virtual void queryKeyValuePairs(Parameter<std::vector<KeyValuePair> > &, const std::string ="", const std::string = ""){};
     49  virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = ""){};
    5150};
    5251
  • src/Atom/AtomicInfo.cpp

    r3fa16b r19dfdf  
    3434
    3535#include "CodePatterns/MemDebug.hpp"
    36 
    37 #include "CodePatterns/Log.hpp"
    3836
    3937#include "atom.hpp"
     
    7371      "Atom "+toString(_atom.getId())+" is not associated with any molecule.");
    7472  MolId = mol->getId();
    75   // accumulate bond info
    76   const BondList &ListOfBonds = _atom.getListOfBonds();
    77   bonds.reserve(ListOfBonds.size());
    78   for (BondList::const_iterator bonditer = ListOfBonds.begin();
    79       bonditer != ListOfBonds.end(); ++bonditer) {
    80     const BondInfo bondinfo(*bonditer);
    81     bonds.push_back(bondinfo);
    82     LOG(3, "DEBUG: Storing info for bond " << bondinfo.leftid << "<->" << bondinfo.rightid);
    83   }
    8473}
    8574
     
    112101    }
    113102
    114     // set bonds
    115     for (std::vector<BondInfo>::const_iterator bonditer = bonds.begin();
    116         bonditer != bonds.end(); ++bonditer)
    117       (*bonditer).RecreateBond();
    118 
    119103    // setting molecule
    120104    molecule * const _mol = World::getInstance().getMolecule(MoleculeById(MolId));
  • src/Atom/AtomicInfo.hpp

    r3fa16b r19dfdf  
    1616#include "LinearAlgebra/Vector.hpp"
    1717#include "types.hpp"
    18 
    19 #include <vector>
    20 
    21 #include "Bond/BondInfo.hpp"
    2218
    2319class atom;
     
    4945  atomId_t Id;
    5046  int Nr;
    51   std::vector<BondInfo> bonds;
    5247};
    5348
  • src/Bond/BondInfo.cpp

    r3fa16b r19dfdf  
    6161  atom * const rightatom = World::getInstance().getAtom(AtomById(rightid));
    6262  if ((leftatom == NULL) || (rightatom == NULL)) {
    63 //    LOG(3, "DEBUG: Either of the two atoms " << leftid << " or "
    64 //        << rightid << " does not exist in the world.");
     63    ELOG(1, "Either of the two atoms " << leftid << " or "
     64        << rightid << " does not exists in the world.");
    6565    return false;
    6666  }
    6767  const BondList &leftbonds = leftatom->getListOfBonds();
     68  boost::function< bool (const bond::ptr )> predicate =
     69      boost::bind(static_cast<bool (bond::*)(const int) const>(&bond::Contains), _1, rightid);
     70  if (std::find_if(leftbonds.begin(), leftbonds.end(), predicate) != leftbonds.end())
     71    return false;
     72
    6873  const BondList &rightbonds = rightatom->getListOfBonds();
    69   boost::function< bool (const bond::ptr )> leftpredicate =
    70       boost::bind(static_cast<bool (bond::*)(const atomId_t) const>(&bond::ContainsId), _1, rightid);
    71   boost::function< bool (const bond::ptr )> rightpredicate =
    72       boost::bind(static_cast<bool (bond::*)(const atomId_t) const>(&bond::ContainsId), _1, leftid);
    73   if ((std::find_if(leftbonds.begin(), leftbonds.end(), leftpredicate) != leftbonds.end())
    74       || (std::find_if(rightbonds.begin(), rightbonds.end(), rightpredicate) != rightbonds.end())) {
    75 //    LOG(3, "DEBUG: Bond between atoms " << leftid << " or "111
    76 //        << rightid << " is already present in the world.");
    77     return true;
    78   }
     74  if (std::find_if(rightbonds.begin(), rightbonds.end(), predicate) != rightbonds.end())
     75    return false;
    7976
    8077  // create bond
     
    8481  return true;
    8582}
    86 
    87 void BondInfo::RemoveBond() const
    88 {
    89   atom * leftatom = World::getInstance().getAtom(AtomById(leftid));
    90   atom * rightatom = World::getInstance().getAtom(AtomById(rightid));
    91   leftatom->removeBond(rightatom);
    92 }
  • src/Bond/BondInfo.hpp

    r3fa16b r19dfdf  
    3737  bool RecreateBond() const;
    3838
    39   /** Removes the bond whose state is contained in this BondInfo.
    40    *
    41    */
    42   void RemoveBond() const;
    43 
    4439  //!> id of left bond partner
    4540  atomId_t leftid;
  • src/Bond/bond.cpp

    r3fa16b r19dfdf  
    125125 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise
    126126 */
    127 bool bond::ContainsNr(const int number) const
     127bool bond::Contains(const int number) const
    128128{
    129129  return ((leftatom->getNr() == number) || (rightatom->getNr() == number));
    130 };
    131 
    132 /** Checks if an atom exists in a bond.
    133  * \param Nr index of atom
    134  * \return true if it is either bond::leftatom or bond::rightatom, false otherwise
    135  */
    136 bool bond::ContainsId(const atomId_t number) const
    137 {
    138   return ((leftatom->getId() == number) || (rightatom->getId() == number));
    139130};
    140131
  • src/Bond/bond.hpp

    r3fa16b r19dfdf  
    1919
    2020#include <boost/shared_ptr.hpp>
    21 
    22 #include "types.hpp"
    2321
    2422#include "Bond/bond_observable.hpp"
     
    5351
    5452  bool Contains(const ParticleInfo * const ptr) const;
    55   bool ContainsNr(const int nr) const;
    56   bool ContainsId(const atomId_t nr) const;
     53  bool Contains(const int nr) const;
    5754  double GetDistance() const;
    5855  double GetDistanceSquared() const;
  • src/Fragmentation/Automation/MPQCCommandFragmentController.cpp

    r3fa16b r19dfdf  
    5959unsigned int MPQCCommandFragmentController::nextid = 0;
    6060
    61 unsigned int MPQCCommandFragmentController::addJobsFromQueue(
     61bool MPQCCommandFragmentController::addJobsFromQueue(
    6262    const MPQCData::DoLongrange_t _DoLongrange,
    6363    const MPQCData::DoValenceOnly_t _DoValenceOnly,
  • src/Fragmentation/Automation/MPQCCommandFragmentController.hpp

    r3fa16b r19dfdf  
    5353   * \param _DoValenceOnly whether to sample just the valence or the total elctron and nuclei density
    5454   * \param _command command to pass to jobs for execution
    55    * \return the number of jobs added to queue
     55   * \return true - jobs obtained, false - queue empty
    5656   */
    57   unsigned int addJobsFromQueue(
     57  bool addJobsFromQueue(
    5858      const MPQCData::DoLongrange_t _DoLongrange,
    5959      const MPQCData::DoValenceOnly_t _DoValenceOnly,
  • src/Fragmentation/Automation/ResultContainer_impl.hpp

    r3fa16b r19dfdf  
    5555  for(;resultiter != fragmentresults.end(); ++resultiter, ++dataiter) {
    5656    const JobId_t _id = (*resultiter)->getId();
    57     if ((*resultiter)->exitflag == 0) {
    5857#ifndef NDEBUG
    59       std::pair<typename std::map<JobId_t, T>::iterator, bool> inserter =
     58    std::pair<typename std::map<JobId_t, T>::iterator, bool> inserter =
    6059#endif
    61       IdData.insert( std::make_pair( _id, *dataiter) );
    62       ASSERT( inserter.second,
    63           "ResultContainer::insertResults() - result id "
    64           +toString(inserter.first->first)+" already present.");
    65     }
     60    IdData.insert( std::make_pair( _id, *dataiter) );
     61    ASSERT( inserter.second,
     62        "ResultContainer::insertResults() - result id "
     63        +toString(inserter.first->first)+" already present.");
    6664  }
    6765  ASSERT( dataiter == fragmentData.end(),
  • src/Fragmentation/Automation/SpecificFragmentController_ReceiveResultContainer_impl.hpp

    r3fa16b r19dfdf  
    5252  // wait but receive all results that are already done
    5353  size_t NoReceivedResults = 0;
    54   while ((NoReceivedResults != NoExpectedResults)
    55       && (callback.getExitflag() == 0)) {
     54  while (NoReceivedResults != NoExpectedResults) {
    5655    // wait a bit
    5756    boost::asio::deadline_timer timer(io_service);
     
    6160    callback.checkResults(callback.host, callback.port);
    6261    callback.RunService("Checking on results");
    63     if (callback.getExitflag() != 0)
    64       break;
    6562
    6663    const std::pair<size_t, size_t> JobStatus = callback.getJobStatus();
  • src/Fragmentation/Exporters/unittests/Makefile.am

    r3fa16b r19dfdf  
    1818
    1919TESTS += $(FRAGMENTATIONEXPORTERSTESTS)
    20 XFAIL_TESTS += SphericalPointDistributionUnitTest
    2120check_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS)
    2221noinst_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS)
     
    4544
    4645SaturationDistanceMaximizerUnitTest_SOURCES = \
     46        ../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp \
    4747        ../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp \
    4848        ../Fragmentation/Exporters/unittests/stubs/SaturatedBondStub.cpp
     
    5151        $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \
    5252        ${FRAGMENTATIONEXPORTERSLIBS}
    53 
     53       
    5454
    5555#AUTOMAKE_OPTIONS = parallel-tests
  • src/Fragmentation/Makefile.am

    r3fa16b r19dfdf  
    1010        Fragmentation/Exporters/SaturatedFragment.cpp \
    1111        Fragmentation/Exporters/SaturationDistanceMaximizer.cpp \
    12         Fragmentation/Exporters/SphericalPointDistribution.cpp \
    13         Fragmentation/Exporters/SphericalPointDistribution_getPoints.cpp \
    1412        Fragmentation/Homology/FragmentEdge.cpp \
    1513        Fragmentation/Homology/FragmentNode.cpp \
     
    4038        Fragmentation/Exporters/SaturatedFragment.hpp \
    4139        Fragmentation/Exporters/SaturationDistanceMaximizer.hpp \
    42         Fragmentation/Exporters/SphericalPointDistribution.hpp \
    4340        Fragmentation/Homology/FragmentEdge.hpp \
    4441        Fragmentation/Homology/FragmentNode.hpp \
  • src/Fragmentation/PowerSetGenerator.cpp

    r3fa16b r19dfdf  
    131131    for (TouchedList_t::const_iterator iter = TouchedList.begin();
    132132        iter != TouchedList.end(); ++iter) {
    133       if ((*Binder)->ContainsNr(*iter))   // if we added this very endpiece
     133      if ((*Binder)->Contains(*iter))   // if we added this very endpiece
    134134        SetDimension++;
    135135    }
  • src/Fragmentation/Summation/Containers/MPQCData.cpp

    r3fa16b r19dfdf  
    5252MPQCData::MPQCData() :
    5353  DoLongrange(DontSampleDensity),
    54   DoValenceOnly(DoSampleValenceOnly)
     54  DoValenceOnly(DoValenceOnly)
    5555{}
    5656
  • src/Graph/BondGraph.cpp

    r3fa16b r19dfdf  
    473473}
    474474
    475 bool BondGraph::checkBondDegree(const deltaatoms_t &allatoms) const
    476 {
    477   deltaatoms_t deltaatoms;
    478   return (gatherAllDeltaAtoms(allatoms, deltaatoms) == 0);
    479 }
    480 
    481475
    482476int BondGraph::calculateBondDegree(const deltaatoms_t &allatoms) const
  • src/Graph/BondGraph.hpp

    r3fa16b r19dfdf  
    359359  }
    360360
    361   /** Checks whether the bond degree for each atom on the set matches with its valency.
    362    *
    363    * @param Set Range with atoms
    364    * @return true - bond degrees match valency, false - bond degree correction is needed
    365    */
    366   template <class container_type,
    367             class iterator_type,
    368             class const_iterator_type>
    369   bool checkBondDegree(
    370       AtomSetMixin<container_type,iterator_type,const_iterator_type> &Set) const
    371   {
    372     std::set<atom *> allatoms;
    373     for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner)
    374       allatoms.insert(*AtomRunner);
    375     return checkBondDegree(allatoms);
    376   }
    377 
    378361  /** correct bond degree by comparing valence and bond degree.
    379362   * correct Bond degree of each bond by checking both bond partners for a mismatch between valence and current sum of bond degrees,
     
    489472  }
    490473
    491   bool checkBondDegree(const std::set<atom *> &allatoms) const;
    492 
    493474  /** Calculates the bond degree for each atom on the set.
    494475   *
  • src/Parameters/Makefile.am

    r3fa16b r19dfdf  
    4343        Parameters/ValueAsString.hpp \
    4444        Parameters/ValueInterface.hpp \
    45         Parameters/Specifics/KeyValuePair.hpp \
    4645        Parameters/Specifics/Value_atom.hpp \
    4746        Parameters/Specifics/Value_element.hpp \
  • src/Parameters/Parameter.hpp

    r3fa16b r19dfdf  
    5353  bool isValid(const T &_value) const throw(ParameterValidatorException);
    5454  const T & get() const throw(ParameterValueException);
    55   const T & getUnvalidated() const throw(ParameterValueException);
    5655  void set(const T & _value) throw(ParameterValueException);
    5756  bool isSet() const
  • src/Parameters/Parameter_impl.hpp

    r3fa16b r19dfdf  
    186186}
    187187
    188 
    189 /** Catch call to value.getUnvalidated() to add exception information.
    190  *
    191  * @return parameter value as string
    192  */
    193 template<typename T>
    194 inline const T & Parameter<T>::getUnvalidated() const throw(ParameterValueException)
    195 {
    196   try {
    197     return value.getUnvalidated();
    198   } catch(ParameterException &e) {
    199     e << ParameterName(ParameterInterface::getName());
    200     throw;
    201   }
    202 }
    203188
    204189/** Catch call to value.get() to add exception information.
  • src/Parameters/Validators/Specific/KeyValueValidator.cpp

    r3fa16b r19dfdf  
    3838#include "KeyValueValidator.hpp"
    3939
    40 bool KeyValueValidator::isValid(const KeyValuePair & _value) const
     40bool KeyValueValidator::isValid(const std::string & _value) const
    4141{
    4242  size_t keyvaluestart = 0;
     
    6666}
    6767
    68 bool KeyValueValidator::operator==(const Validator<KeyValuePair> &_instance) const
     68bool KeyValueValidator::operator==(const Validator<std::string> &_instance) const
    6969{
    7070  const KeyValueValidator *inst =
     
    7676}
    7777
    78 Validator< KeyValuePair >* KeyValueValidator::clone() const
     78Validator< std::string >* KeyValueValidator::clone() const
    7979{
    80   Validator< KeyValuePair > *inst =
     80  Validator< std::string > *inst =
    8181      new KeyValueValidator();
    8282  return inst;
  • src/Parameters/Validators/Specific/KeyValueValidator.hpp

    r3fa16b r19dfdf  
    1515#endif
    1616
    17 #include "Parameters/Specifics/KeyValuePair.hpp"
     17#include <string>
     18
    1819#include "Parameters/Validators/Validator.hpp"
    1920
     
    2122 * concatenation of the following pattern "...=...;"
    2223 */
    23 class KeyValueValidator : public Validator<KeyValuePair>
     24class KeyValueValidator : public Validator<std::string>
    2425{
    25   bool isValid(const KeyValuePair & _value) const;
    26   bool operator==(const Validator<KeyValuePair> &_instance) const;
    27   Validator< KeyValuePair >* clone() const;
     26  bool isValid(const std::string & _value) const;
     27  bool operator==(const Validator<std::string> &_instance) const;
     28  Validator< std::string >* clone() const;
    2829};
    2930
  • src/Parameters/Value.hpp

    r3fa16b r19dfdf  
    7777  // functions for ValueInterface
    7878  bool isValid(const T &_value) const throw(ParameterValidatorException);
    79   const T & getUnvalidated() const throw(ParameterValueException);
    8079  const T & get() const throw(ParameterValueException);
    8180  void set(const T & _value) throw(ParameterException);
  • src/Parameters/ValueInterface.hpp

    r3fa16b r19dfdf  
    3131  virtual bool isValid(const T & _value) const throw(ParameterValidatorException)=0;
    3232  virtual const T & get() const throw(ParameterValueException)=0;
    33   virtual const T & getUnvalidated() const throw(ParameterValueException)=0;
    3433  virtual void set(const T & _value) throw(ParameterException)=0;
    3534  virtual bool isSet() const=0;
  • src/Parameters/Value_impl.hpp

    r3fa16b r19dfdf  
    120120{
    121121  if (!isValid(value)) throw ParameterValueException();
    122   if (!ValueSet) throw ParameterValueException();
    123   return value;
    124 }
    125 
    126 /** Getter of value without any validation
    127  *
    128  * @return value
    129  */
    130 template <class T>
    131 inline const T & Value<T>::getUnvalidated() const throw(ParameterValueException)
    132 {
    133122  if (!ValueSet) throw ParameterValueException();
    134123  return value;
  • src/Python/PythonScripting.cpp

    r3fa16b r19dfdf  
    3939#include "CodePatterns/MemDebug.hpp"
    4040
    41 bool executePythonScriptFile(const boost::filesystem::path &pythonfilename)
     41bool executePythonScript(const std::string &pythonfilename_string)
    4242{
     43  boost::filesystem::path pythonfilename(pythonfilename_string);
    4344  if (exists(pythonfilename)) {
    4445    // parse in and execute the local and global config.py
     
    6061      std::string pythonscript( std::istreambuf_iterator<char>(pythonfile),
    6162          (std::istreambuf_iterator<char>()) );
    62       std::string enveloped_script("print \"BEGIN of "+pythonfilename.string()+":\"\n");
     63      std::string enveloped_script("print \"BEGIN of "+pythonfilename_string+":\"\n");
    6364      enveloped_script += pythonscript;
    64       enveloped_script += std::string("print \"END of "+pythonfilename.string()+":\"\n");
     65      enveloped_script += std::string("print \"END of "+pythonfilename_string+":\"\n");
    6566
    6667      boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(),
     
    7778  return false;
    7879}
    79 
    80 bool executePythonScript(const std::string &python_string, const std::string &python_scripttitle)
    81 {
    82   try {
    83     PyImport_AppendInittab( "pyMoleCuilder", &initpyMoleCuilder );
    84 
    85     Py_Initialize();
    86 
    87     boost::python::object main_module((
    88         boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("__main__")))));
    89 
    90     boost::python::object main_namespace = main_module.attr("__dict__");
    91 
    92     boost::python::object molecuilder_module( (boost::python::handle<>(PyImport_ImportModule("pyMoleCuilder"))) );
    93     main_namespace["pyMoleCuilder"] = molecuilder_module;
    94 
    95     std::string enveloped_script("print \"BEGIN of "+python_scripttitle+":\"\n");
    96     enveloped_script += python_string+std::string("\n");
    97     enveloped_script += std::string("print \"END of "+python_scripttitle+":\"\n");
    98 
    99     boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(),
    100         Py_file_input,
    101         main_namespace.ptr(),
    102         main_namespace.ptr() ) ));
    103 
    104   } catch( boost::python::error_already_set ) {
    105     PyErr_Print();
    106     return false;
    107   }
    108   return true;
    109 }
  • src/Python/PythonScripting.hpp

    r3fa16b r19dfdf  
    1515
    1616#include <string>
    17 #include <boost/filesystem/path.hpp>
    1817
    19 bool executePythonScriptFile(const boost::filesystem::path &pythonfilename);
    20 bool executePythonScript(const std::string &python_string, const std::string &python_scripttitle);
     18bool executePythonScript(const std::string &pythonfilename_string);
    2119
    2220#endif /* PYTHONSCRIPTING_HPP_ */
  • src/Python/PythonScripting_impl.hpp

    r3fa16b r19dfdf  
    66 */
    77
    8 #ifndef PYTHONSCRIPTING_IMPL_HPP_
    9 #define PYTHONSCRIPTING_IMPL_HPP_
     8#ifndef PYTHONSCRIPTING_HPP_
     9#define PYTHONSCRIPTING_HPP_
    1010
    1111
     
    131131
    132132
    133 #endif /* PYTHONSCRIPTING_IMPL_HPP_ */
     133#endif /* PYTHONSCRIPTING_HPP_ */
  • src/UIElements/CommandLineUI/CommandLineDialog.cpp

    r3fa16b r19dfdf  
    136136}
    137137
    138 void CommandLineDialog::queryKeyValuePair(Parameter<KeyValuePair> &param, const std::string title, const std::string description)
    139 {
    140   registerQuery(new KeyValuePairCommandLineQuery(param, title,description));
    141 }
    142 
    143 void CommandLineDialog::queryKeyValuePairs(Parameter< std::vector<KeyValuePair> > &param, const std::string title, const std::string description)
    144 {
    145   registerQuery(new KeyValuePairsCommandLineQuery(param, title,description));
     138void CommandLineDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &param, const std::string title, const std::string description){
     139  registerQuery(new RandomNumberDistribution_ParametersCommandLineQuery(param, title, description));
    146140}
    147141
  • src/UIElements/CommandLineUI/CommandLineDialog.hpp

    r3fa16b r19dfdf  
    3434
    3535  virtual void queryEmpty(const std::string ="", const std::string = "");
    36 
    37 protected:
    38 
     36  virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = "");
     37  virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = "");
     38  virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = "");
     39  virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = "");
     40  virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = "");
     41  virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = "");
     42  virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = "");
     43  virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = "");
     44  virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = "");
     45  virtual void queryAtom(Parameter<const atom *> &, const std::string ="", const std::string = "");
     46  virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string ="", const std::string = "");
     47  virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = "");
     48  virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = "");
     49  virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "");
     50  virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = "");
     51  virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = "");
     52  virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = "");
     53  virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = "");
     54  virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = "");
     55  virtual void queryFiles(Parameter<std::vector< boost::filesystem::path> > &, const std::string ="", const std::string = "");
     56  virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = "");
     57  // specialized stuff for command line queries
     58  // all placed into Query/CommandLineQuery.hpp
     59  // !please adhere to alphabetical ordering!
     60  class AtomCommandLineQuery;
     61  class AtomsCommandLineQuery;
     62  class BooleanCommandLineQuery;
     63  class DoubleCommandLineQuery;
     64  class DoublesCommandLineQuery;
     65  class ElementCommandLineQuery;
     66  class ElementsCommandLineQuery;
    3967  class EmptyCommandLineQuery;
    40 
    41   /** With the following boost::preprocessor code we generate virtual function
    42    * definitions and forward declarations for all desired query types in the
    43    * CommandLineUI specialization of class Dialog.
    44    */
    45 #include "UIElements/GlobalListOfParameterQueries.hpp"
    46 #include "UIElements/Dialog_impl_pre.hpp"
    47 
    48   #include <boost/preprocessor/facilities/empty.hpp>
    49 
    50   // iterate over all parameter query types for query declarations
    51   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    52   #define SUFFIX BOOST_PP_EMPTY()
    53   #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)
    54   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    55   #include BOOST_PP_LOCAL_ITERATE()
    56   #undef dialog_declaration
    57   #undef SUFFIX
    58   #endif
    59 
    60   // iterate over all parameter query types for forward declarations
    61   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    62   #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, CommandLineQuery)
    63   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    64   #include BOOST_PP_LOCAL_ITERATE()
    65   #undef forward_declaration
    66   #endif
    67 
    68 #include "Dialog_impl_undef.hpp"
    69   /* End of preprocessor code piece */
    70 
     68  class FileCommandLineQuery;
     69  class FilesCommandLineQuery;
     70  class IntCommandLineQuery;
     71  class IntsCommandLineQuery;
     72  class MoleculeCommandLineQuery;
     73  class MoleculesCommandLineQuery;
     74  class RealSpaceMatrixCommandLineQuery;
     75  class StringCommandLineQuery;
     76  class StringsCommandLineQuery;
     77  class UnsignedIntCommandLineQuery;
     78  class UnsignedIntsCommandLineQuery;
     79  class VectorCommandLineQuery;
     80  class VectorsCommandLineQuery;
     81  class RandomNumberDistribution_ParametersCommandLineQuery;
    7182};
    7283
  • src/UIElements/CommandLineUI/CommandLineParser.cpp

    r3fa16b r19dfdf  
    5252#include "CommandLineParser.hpp"
    5353#include "CommandLineParser_validate.hpp"
    54 #include "Parameters/Specifics/KeyValuePair.hpp"
    5554#include "World.hpp"
    5655
     
    403402        ;
    404403      break;
     404    case TypeEnumContainer::RandomNumberDistribution_ParametersType:
     405      OptionList->add_options()
     406        (currentOption->getKeyAndShortForm().c_str(),
     407            currentOption->hasDefaultValue() ?
     408                  (_DefaultAsImplicit ?
     409                      po::value < std::string >()->implicit_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) :
     410                      po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str()))) :
     411                  po::value < std::string >(),
     412                  currentOption->getDescription().c_str())
     413        ;
     414      break;
    405415    case TypeEnumContainer::RealSpaceMatrixType:
    406416      OptionList->add_options()
     
    409419//                  po::value < RealSpaceMatrixValue >()->default_value(boost::lexical_cast<BoxValue>(currentOption->getDefaultValue().c_str())) :
    410420                  po::value < RealSpaceMatrixValue >(),
    411                   currentOption->getDescription().c_str())
    412         ;
    413       break;
    414     case TypeEnumContainer::KeyValueType:
    415       OptionList->add_options()
    416         (currentOption->getKeyAndShortForm().c_str(),
    417             currentOption->hasDefaultValue() ?
    418                   (_DefaultAsImplicit ?
    419                       po::value < KeyValuePair >()->implicit_value(boost::lexical_cast< KeyValuePair >(currentOption->getDefaultValue().c_str())) :
    420                       po::value < KeyValuePair >()->default_value(boost::lexical_cast< KeyValuePair >(currentOption->getDefaultValue().c_str()))) :
    421                   po::value < KeyValuePair >(),
    422                   currentOption->getDescription().c_str())
    423         ;
    424       break;
    425     case TypeEnumContainer::ListOfKeyValuesType:
    426       OptionList->add_options()
    427         (currentOption->getKeyAndShortForm().c_str(),
    428 //            currentOption->hasDefaultValue() ?
    429 //                  po::value < std::vector<KeyValuePair> >()->default_value(boost::lexical_cast< std::vector<KeyValuePair> >(currentOption->getDefaultValue().c_str())) :
    430                   po::value < std::vector<KeyValuePair> >()->multitoken(),
    431421                  currentOption->getDescription().c_str())
    432422        ;
  • src/UIElements/CommandLineUI/CommandLineParser_validate.cpp

    r3fa16b r19dfdf  
    4242#include "Actions/Values.hpp"
    4343#include "CommandLineParser_validate.hpp"
    44 #include "Parameters/Specifics/KeyValuePair.hpp"
    4544
    4645/** boost::program_options validator specialization for VectorValue.
     
    158157void validate(boost::any& v, const std::vector<std::string>& values, boost::filesystem::path *, int)
    159158{
    160 //  std::cerr << "boost::filesystem::path validator used." << std::endl;
     159  boost::filesystem::path filename;
    161160
    162   // Make sure no previous assignment to 'a' was made.
    163   boost::program_options::validators::check_first_occurrence(v);
    164   // Extract the first string from 'values'. If there is more than
    165   // one string, it's an error, and exception will be thrown.
    166   const std::string& s = boost::program_options::validators::get_single_string(values);
    167 
    168   v = boost::any(boost::filesystem::path(s));
    169 }
    170 
    171 /** boost::program_options validator specialization for boost::filesystem::path.
    172  * \param &v  reference for return value
    173  * \param &values string vector of scanned options
    174  * \param *
    175  * \param
    176  *
    177  */
    178 void validate(boost::any& v, const std::vector<std::string>& values, KeyValuePair *, int)
    179 {
    180 //  std::cerr << "KeyValuePair validator used." << std::endl;
    181 
    182   // Make sure no previous assignment to 'a' was made.
    183   boost::program_options::validators::check_first_occurrence(v);
    184   // Extract the first string from 'values'. If there is more than
    185   // one string, it's an error, and exception will be thrown.
    186   const std::string& s = boost::program_options::validators::get_single_string(values);
    187 
    188   if (s.find("=") == std::string::npos) {
    189 #if BOOST_VERSION < 104200
    190     throw boost::program_options::validation_error("Invalid KeyValue given");
    191 #else
    192 throw boost::program_options::validation_error(
    193     boost::program_options::validation_error::invalid_option_value,
    194     std::string("value"),
    195     std::string("vector<KeyValuePair>")
    196     );
    197 #endif
    198   }
    199   v = boost::any(KeyValuePair(s));
    200 }
    201 
    202 /** boost::program_options validator specialization for boost::filesystem::path.
    203  * \param &v  reference for return value
    204  * \param &values string vector of scanned options
    205  * \param *
    206  * \param
    207  *
    208  */
    209 void validate(boost::any& v, const std::vector<std::string>& values, std::vector<KeyValuePair> *, int)
    210 {
    211 //  std::cerr << "vector<KeyValuePair> validator used." << std::endl;
     161  std::cerr << "boost::filesystem::path validator used." << std::endl;
    212162
    213163  // split comma-separated values
    214   if (values.size() > 1) {
     164  if (values.size() != 1) {
     165    std::cerr <<  "Not one file but " << values.size() << " given " << std::endl;
    215166#if BOOST_VERSION < 104200
    216167    throw boost::program_options::validation_error("Unequal to one file given");
     
    220171          boost::program_options::validation_error::at_least_one_value_required,
    221172          std::string("value"),
    222           std::string("vector<KeyValuePair>")
     173          std::string("boost::filesystem::path")
     174      );
     175    } else {
     176      throw boost::program_options::validation_error(
     177          boost::program_options::validation_error::multiple_values_not_allowed,
     178          std::string("value"),
     179          std::string("boost::filesystem::path")
    223180      );
    224181    }
    225182#endif
    226     for (std::vector<std::string>::const_iterator iter = values.begin();
    227         iter != values.end();++iter)
    228       if ((*iter).find("=") == std::string::npos) {
    229 #if BOOST_VERSION < 104200
    230     throw boost::program_options::validation_error("Invalid KeyValue given");
    231 #else
    232     throw boost::program_options::validation_error(
    233         boost::program_options::validation_error::invalid_option_value,
    234         std::string("value"),
    235         std::string("vector<KeyValuePair>")
    236     );
    237 #endif
    238       }
    239183  }
    240   std::vector<KeyValuePair> temp;
    241   for (std::vector<std::string>::const_iterator iter = values.begin();
    242       iter != values.end();++iter)
    243     temp.push_back(KeyValuePair(*iter));
    244   v = boost::any(temp);
     184  filename = values.at(0);
     185  v = boost::any(boost::filesystem::path(filename));
    245186}
     187
  • src/UIElements/CommandLineUI/CommandLineParser_validate.hpp

    r3fa16b r19dfdf  
    2222#include <boost/lexical_cast.hpp>
    2323
    24 struct KeyValuePair;
    2524class RealSpaceMatrixValue;
    2625class VectorValue;
    2726
    28 void validate(boost::any& v, const std::vector<std::string>& values, KeyValuePair *, int);
    29 void validate(boost::any& v, const std::vector<std::string>& values, std::vector<KeyValuePair> *, int);
    3027void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int);
    3128void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int);
  • src/UIElements/CommandLineUI/Query/CommandLineQuery.hpp

    r3fa16b r19dfdf  
    2424};
    2525
    26   /** With the following boost::preprocessor code we generate forward declarations
    27    * of query class for all desired query types in the Qt specialization class of
    28    * Dialog.
    29    */
    30 #include "UIElements/GlobalListOfParameterQueries.hpp"
    31 #include "UIElements/Dialog_impl_pre.hpp"
     26class CommandLineDialog::IntCommandLineQuery : public Dialog::TQuery<int> {
     27public:
     28  IntCommandLineQuery(Parameter<int> &_param, const std::string &_title, const std::string &_description = "");
     29  virtual ~IntCommandLineQuery();
     30  virtual bool handle();
     31};
    3232
    33   #include <boost/preprocessor/facilities/empty.hpp>
     33class CommandLineDialog::IntsCommandLineQuery : public Dialog::TQuery<std::vector<int> > {
     34public:
     35  IntsCommandLineQuery(Parameter<std::vector<int> > &_param, const std::string &_title, const std::string &_description = "");
     36  virtual ~IntsCommandLineQuery();
     37  virtual bool handle();
     38};
    3439
    35   // iterate over all parameter query types for forward declarations
    36   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    37   #define BOOST_PP_LOCAL_MACRO(n) queryclass_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type, CommandLine)
    38   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    39   #include BOOST_PP_LOCAL_ITERATE()
    40   #undef queryclass_definition
    41   #endif
     40class CommandLineDialog::UnsignedIntCommandLineQuery : public Dialog::TQuery<unsigned int> {
     41public:
     42  UnsignedIntCommandLineQuery(Parameter<unsigned int> &_param, const std::string &_title, const std::string &_description = "");
     43  virtual ~UnsignedIntCommandLineQuery();
     44  virtual bool handle();
     45};
    4246
    43 #include "Dialog_impl_undef.hpp"
    44   /* End of preprocessor code piece */
     47class CommandLineDialog::UnsignedIntsCommandLineQuery : public Dialog::TQuery<std::vector<unsigned int> > {
     48public:
     49  UnsignedIntsCommandLineQuery(Parameter<std::vector<unsigned int> > &_param, const std::string &_title, const std::string &_description = "");
     50  virtual ~UnsignedIntsCommandLineQuery();
     51  virtual bool handle();
     52};
    4553
     54class CommandLineDialog::BooleanCommandLineQuery : public Dialog::TQuery<bool> {
     55public:
     56  BooleanCommandLineQuery(Parameter<bool> &_param, const std::string &_title, const std::string &_description = "");
     57  virtual ~BooleanCommandLineQuery();
     58  virtual bool handle();
     59};
     60
     61class CommandLineDialog::DoubleCommandLineQuery : public Dialog::TQuery<double> {
     62public:
     63  DoubleCommandLineQuery(Parameter<double> &_param, const std::string &_title, const std::string &_description = "");
     64  virtual ~DoubleCommandLineQuery();
     65  virtual bool handle();
     66};
     67
     68class CommandLineDialog::DoublesCommandLineQuery : public Dialog::TQuery<std::vector<double> > {
     69public:
     70  DoublesCommandLineQuery(Parameter<std::vector<double> > &_param, const std::string &_title, const std::string &_description = "");
     71  virtual ~DoublesCommandLineQuery();
     72  virtual bool handle();
     73};
     74
     75class CommandLineDialog::StringCommandLineQuery : public Dialog::TQuery<std::string> {
     76public:
     77  StringCommandLineQuery(Parameter<std::string> &_param, const std::string &_title, const std::string &_description = "");
     78  virtual ~StringCommandLineQuery();
     79  virtual bool handle();
     80};
     81
     82class CommandLineDialog::StringsCommandLineQuery : public Dialog::TQuery<std::vector<std::string> > {
     83public:
     84  StringsCommandLineQuery(Parameter<std::vector<std::string> > &_param, const std::string &_title, const std::string &_description = "");
     85  virtual ~StringsCommandLineQuery();
     86  virtual bool handle();
     87};
     88
     89class CommandLineDialog::AtomCommandLineQuery : public Dialog::TQuery<const atom *> {
     90public:
     91  AtomCommandLineQuery(Parameter<const atom *> &_param, const std::string &_title, const std::string &_description = "");
     92  virtual ~AtomCommandLineQuery();
     93  virtual bool handle();
     94};
     95
     96class CommandLineDialog::AtomsCommandLineQuery : public Dialog::TQuery<std::vector<const atom*> > {
     97public:
     98  AtomsCommandLineQuery(Parameter<std::vector<const atom *> > &_param, const std::string &_title, const std::string &_description = "");
     99  virtual ~AtomsCommandLineQuery();
     100  virtual bool handle();
     101};
     102
     103class CommandLineDialog::MoleculeCommandLineQuery : public Dialog::TQuery<const molecule *> {
     104public:
     105  MoleculeCommandLineQuery(Parameter<const molecule *> &_param, const std::string &_title, const std::string &_description = "");
     106  virtual ~MoleculeCommandLineQuery();
     107  virtual bool handle();
     108};
     109
     110class CommandLineDialog::MoleculesCommandLineQuery : public Dialog::TQuery<std::vector<const molecule*> > {
     111public:
     112  MoleculesCommandLineQuery(Parameter<std::vector<const molecule *> > &_param, const std::string &_title, const std::string &_description = "");
     113  virtual ~MoleculesCommandLineQuery();
     114  virtual bool handle();
     115};
     116
     117class CommandLineDialog::VectorCommandLineQuery : public Dialog::TQuery<Vector> {
     118public:
     119  VectorCommandLineQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = "");
     120  virtual ~VectorCommandLineQuery();
     121  virtual bool handle();
     122};
     123
     124class CommandLineDialog::VectorsCommandLineQuery : public Dialog::TQuery<std::vector<Vector> > {
     125public:
     126  VectorsCommandLineQuery(Parameter<std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = "");
     127  virtual ~VectorsCommandLineQuery();
     128  virtual bool handle();
     129};
     130
     131class CommandLineDialog::RealSpaceMatrixCommandLineQuery : public Dialog::TQuery<RealSpaceMatrix> {
     132public:
     133  RealSpaceMatrixCommandLineQuery(Parameter<RealSpaceMatrix> &_param, const std::string &_title, const std::string &_description = "");
     134  virtual ~RealSpaceMatrixCommandLineQuery();
     135  virtual bool handle();
     136};
     137
     138class CommandLineDialog::ElementCommandLineQuery : public Dialog::TQuery<const element *> {
     139public:
     140  ElementCommandLineQuery(Parameter<const element *> &_param, const std::string &_title, const std::string &_description = "");
     141  virtual ~ElementCommandLineQuery();
     142  virtual bool handle();
     143};
     144
     145class CommandLineDialog::ElementsCommandLineQuery : public Dialog::TQuery<std::vector<const element *> > {
     146public:
     147  ElementsCommandLineQuery(Parameter<std::vector<const element *> > &_param, const std::string &_title, const std::string &_description = "");
     148  virtual ~ElementsCommandLineQuery();
     149  virtual bool handle();
     150};
     151
     152class CommandLineDialog::FileCommandLineQuery : public Dialog::TQuery<boost::filesystem::path> {
     153public:
     154  FileCommandLineQuery(Parameter<boost::filesystem::path> &_param, const std::string &_title, const std::string &_description = "");
     155  virtual ~FileCommandLineQuery();
     156  virtual bool handle();
     157};
     158
     159class CommandLineDialog::FilesCommandLineQuery : public Dialog::TQuery<std::vector<boost::filesystem::path> > {
     160public:
     161  FilesCommandLineQuery(Parameter<std::vector< boost::filesystem::path> > &param, const std::string &_title, const std::string &_description = "");
     162  virtual ~FilesCommandLineQuery();
     163  virtual bool handle();
     164};
     165
     166class CommandLineDialog::RandomNumberDistribution_ParametersCommandLineQuery : public Dialog::TQuery<RandomNumberDistribution_Parameters> {
     167public:
     168  RandomNumberDistribution_ParametersCommandLineQuery(Parameter<RandomNumberDistribution_Parameters> &_param, const std::string &_title, const std::string &_description = "");
     169  virtual ~RandomNumberDistribution_ParametersCommandLineQuery();
     170  virtual bool handle();
     171};
    46172
    47173#endif /* COMMANDLINEQUERY_HPP_ */
  • src/UIElements/CommandLineUI/TypeEnumContainer.cpp

    r3fa16b r19dfdf  
    5151#include "Element/element.hpp"
    5252#include "molecule.hpp"
    53 #include "Parameters/Specifics/KeyValuePair.hpp"
    5453#include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"
    5554
     
    8281  TypeEnumMap[&typeid(const element *)] = ElementType;
    8382  TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElementsType;
    84   TypeEnumMap[&typeid(KeyValuePair)] = KeyValueType;
    85   TypeEnumMap[&typeid(std::vector<KeyValuePair>)] = ListOfKeyValuesType;
     83  TypeEnumMap[&typeid(RandomNumberDistribution_Parameters)] = RandomNumberDistribution_ParametersType;
    8684
    8785  // for debugging: list all stored types
  • src/UIElements/CommandLineUI/TypeEnumContainer.hpp

    r3fa16b r19dfdf  
    4646        ElementType,
    4747        ListOfElementsType,
    48         RealSpaceMatrixType,
    49         KeyValueType,
    50         ListOfKeyValuesType
     48        RandomNumberDistribution_ParametersType,
     49        RealSpaceMatrixType
    5150  };
    5251
  • src/UIElements/Dialog.cpp

    r3fa16b r19dfdf  
    135135}*/
    136136
    137 /** With the following boost::preprocessor code we generate template
    138  * specializations for each desired query types in the abstract class Dialog.
    139  */
    140 #include "UIElements/GlobalListOfParameterQueries.hpp"
    141 #include "UIElements/Dialog_impl_pre.hpp"
    142 
    143   // print a template body
    144   #define dialog_definition(z,n,TOKENLIST,TYPELIST) \
    145   template <> void Dialog::query< \
    146     BOOST_PP_SEQ_ELEM(n, TYPELIST) \
    147   >(Parameter< \
    148     BOOST_PP_SEQ_ELEM(n, TYPELIST) \
    149   > &param, const std::string title, const std::string description) { \
    150   BOOST_PP_CAT(query, BOOST_PP_SEQ_ELEM(n, TOKENLIST)) \
    151   (param, title, description); }
    152 
    153   // print template specialization for every query type
    154   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    155   #define BOOST_PP_LOCAL_MACRO(n) dialog_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)
    156   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    157   #include BOOST_PP_LOCAL_ITERATE()
    158   #endif
    159 
    160   #undef dialog_definition
    161 
    162 #include "Dialog_impl_undef.hpp"
    163 /* End of preprocessor code piece */
    164 
    165 //template <> void Dialog::query< std::vector<KeyValuePair> >(Parameter< std::vector<KeyValuePair> > &param, const std::string title, const std::string description)
    166 //{
    167 //  queryKeyValuePairs(param, title, description);
    168 //}
     137template <> void Dialog::query<bool>(Parameter<bool> &param, const std::string title, const std::string description)
     138{
     139  queryBoolean(param, title, description);
     140}
     141
     142template <> void Dialog::query<int>(Parameter<int> &param, const std::string title, const std::string description)
     143{
     144  queryInt(param, title, description);
     145}
     146
     147template <> void Dialog::query< std::vector<int> >(Parameter<std::vector<int> > &param, const std::string title, const std::string description)
     148{
     149  queryInts(param, title, description);
     150}
     151
     152template <> void Dialog::query<unsigned int>(Parameter<unsigned int> &param, const std::string title, const std::string description)
     153{
     154  queryUnsignedInt(param, title, description);
     155}
     156
     157template <> void Dialog::query< std::vector<unsigned int> >(Parameter<std::vector<unsigned int> > &param, const std::string title, const std::string description)
     158{
     159  queryUnsignedInts(param, title, description);
     160}
     161
     162template <> void Dialog::query<double>(Parameter<double> &param, const std::string title, const std::string description)
     163{
     164  queryDouble(param, title, description);
     165}
     166
     167template <> void Dialog::query< std::vector<double> >(Parameter<std::vector<double> > &param, const std::string title, const std::string description)
     168{
     169  queryDoubles(param, title, description);
     170}
     171
     172template <> void Dialog::query<std::string>(Parameter<std::string> &param, const std::string title, const std::string description)
     173{
     174  queryString(param, title, description);
     175}
     176
     177template <> void Dialog::query< std::vector<std::string> >(Parameter<std::vector<std::string> > &param, const std::string title, const std::string description)
     178{
     179  queryStrings(param, title, description);
     180}
     181
     182template <> void Dialog::query<const atom *>(Parameter<const atom *> &param, const std::string title, const std::string description)
     183{
     184  queryAtom(param, title, description);
     185}
     186
     187template <> void Dialog::query< std::vector<const atom *> >(Parameter<std::vector<const atom *> > &param, const std::string title, const std::string description)
     188{
     189  queryAtoms(param, title, description);
     190}
     191
     192template <> void Dialog::query<const molecule *>(Parameter<const molecule *> &param, const std::string title, const std::string description)
     193{
     194  queryMolecule(param, title, description);
     195}
     196
     197template <> void Dialog::query< std::vector<const molecule *> >(Parameter<std::vector<const molecule *> > &param, const std::string title, const std::string description)
     198{
     199  queryMolecules(param, title, description);
     200}
     201
     202template <> void Dialog::query<Vector>(Parameter<Vector> &param, const std::string title, const std::string description)
     203{
     204  queryVector(param, title, description);
     205}
     206
     207template <> void Dialog::query< std::vector<Vector> >(Parameter<std::vector<Vector> > &param, const std::string title, const std::string description)
     208{
     209  queryVectors(param, title, description);
     210}
     211
     212template <> void Dialog::query<RealSpaceMatrix>(Parameter<RealSpaceMatrix> &param, const std::string title, const std::string description)
     213{
     214  queryRealSpaceMatrix(param, title, description);
     215}
     216
     217template <> void Dialog::query<const element *>(Parameter<const element *> &param, const std::string title, const std::string description)
     218{
     219  queryElement(param, title, description);
     220}
     221
     222template <> void Dialog::query< std::vector<const element *> >(Parameter<std::vector<const element *> > &param, const std::string title, const std::string description)
     223{
     224  queryElements(param, title, description);
     225}
     226
     227template <> void Dialog::query< boost::filesystem::path >(Parameter<boost::filesystem::path> &param, const std::string title, const std::string description)
     228{
     229  queryFile(param, title, description);
     230}
     231
     232template <> void Dialog::query< std::vector<boost::filesystem::path> >(Parameter<std::vector< boost::filesystem::path> > &param, const std::string title, const std::string description)
     233{
     234  queryFiles(param, title, description);
     235}
     236
     237template <> void Dialog::query< RandomNumberDistribution_Parameters >(Parameter<RandomNumberDistribution_Parameters> &param, const std::string title, const std::string description)
     238{
     239  queryRandomNumberDistribution_Parameters(param, title, description);
     240}
    169241
    170242/************************** Query Infrastructure ************************/
  • src/UIElements/Dialog.hpp

    r3fa16b r19dfdf  
    2222#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2323#include "LinearAlgebra/Vector.hpp"
     24#include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"
    2425#include "Parameters/Parameter.hpp"
    25 #include "Parameters/Specifics/KeyValuePair.hpp"
    2626
    2727class atom;
     
    2929class element;
    3030class molecule;
     31
    3132
    3233/** Dialog is one of the two main classes of the UIFactory base class.
     
    132133 * Due to the three present UI interfaces we have to add a specific Query for each, here
    133134 * is a list:
    134  *   -# add a token (i.e. a unique name for the query parameter) and its type to the
    135  *      global list in \ref GlobalListOfParameterQueries.hpp. This will via boost
    136  *      preprocessor magic add definitions and some intermediatr template specializations.
    137  *   -# add a specialization for each of the UI interfaces of Dialog::...Query class.
    138  *   -# add class declaration of QtDialog::...Query in \ref QtQuery.hpp
     135 *   -# add ValueStorage::setCurrentValue() and ValueStorage::queryCurrentValue() for
     136 *      both types
     137 *   -# add Dialog::query...()
     138 *   -# add Dialog::query<>() specialization calling the above function
     139 *   -# add CommandLineDialog::query...(), TextDialog::query...(), and QtDialog::query...(),
     140 *      i.e. for each of the three interface
     141 *   -# add empty definition DummyDialog::query...() to the stub for Action unittests in DummUI.hpp.
     142 *   -# add Dialog::...Query class with tmp value of desired type
    139143 *   -# add CommandLineDialog::...Query, TextDialog::...Query, QtDialog::...Query
    140  *   -# TypeEnumContainer add new type to query. Make the Type name match with the token
     144 *   -# you probably also need a QtDialog::...QueryPipe() to handle the signal/slot stuff,
     145 *      Qt's moc does not like nested classes. Hence, this has to go extra.
     146 *   -# TypeEnumContainer add new type to query
    141147 *   -# CommandLineParser::AddOptionToParser() add new type to query
    142148 *   -# CommandLineParser_valdiates.[ch]pp: If given above as a new type
    143149 *      program_options::value, define and implement a validate() function here.
    144  *
    145  * Note that the Empty..Query is always specificly present as it has not type and thus
    146  * does not fit into the preprocessor magic scheme (on the plus side it also serves
    147  * as a kind of visualization of what the preprocessor actually does).
    148150 *
    149151 */
     
    157159
    158160  virtual void queryEmpty(const std::string ="", const std::string = "")=0;
    159 
    160   /** With the following boost::preprocessor code we generate virtual function
    161    * definitions for all desired query types in the abstract class Dialog.
    162    */
    163 #include "UIElements/GlobalListOfParameterQueries.hpp"
    164 #include "UIElements/Dialog_impl_pre.hpp"
    165 
    166   // iterate over all parameter query types
    167   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    168   #define SUFFIX =0
    169   #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)
    170   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    171   #include BOOST_PP_LOCAL_ITERATE()
    172   #undef dialog_declaration
    173   #undef SUFFIX
    174   #endif
    175 
    176 #include "Dialog_impl_undef.hpp"
    177   /* End of preprocessor code piece */
     161  virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = "")=0;
     162  virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = "")=0;
     163  virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = "")=0;
     164  virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = "")=0;
     165  virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = "")=0;
     166  virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = "")=0;
     167  virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = "")=0;
     168  virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = "")=0;
     169  virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = "")=0;
     170  virtual void queryAtom(Parameter<const atom *> &, const std::string = "", const std::string = "")=0;
     171  virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string = "", const std::string = "")=0;
     172  virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = "")=0;
     173  virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = "")=0;
     174  virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "")=0;
     175  virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = "")=0;
     176  virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = "")=0;
     177  virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = "")=0;
     178  virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = "")=0;
     179  virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = "")=0;
     180  virtual void queryFiles(Parameter< std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = "")=0;
     181  virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = "")=0;
    178182
    179183  virtual bool display();
     
    282286};
    283287
     288
    284289#endif /* DIALOG_HPP_ */
  • src/UIElements/Makefile.am

    r3fa16b r19dfdf  
    1818  UIElements/CommandLineUI/Query/MoleculeCommandLineQuery.cpp \
    1919  UIElements/CommandLineUI/Query/MoleculesCommandLineQuery.cpp \
    20   UIElements/CommandLineUI/Query/KeyValuePairCommandLineQuery.cpp \
    21   UIElements/CommandLineUI/Query/KeyValuePairsCommandLineQuery.cpp \
    2220  UIElements/CommandLineUI/Query/RealSpaceMatrixCommandLineQuery.cpp \
    2321  UIElements/CommandLineUI/Query/StringCommandLineQuery.cpp \
     
    2725  UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp \
    2826  UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp \
     27  UIElements/CommandLineUI/Query/RandomNumberDistribution_ParametersCommandLineQuery.cpp \
    2928  UIElements/CommandLineUI/CommandLineDialog.cpp \
    3029  UIElements/CommandLineUI/CommandLineParser.cpp \
     
    9190  UIElements/TextUI/Query/MoleculesTextQuery.cpp \
    9291  UIElements/TextUI/Query/MoleculeTextQuery.cpp \
    93   UIElements/TextUI/Query/KeyValuePairTextQuery.cpp \
    94   UIElements/TextUI/Query/KeyValuePairsTextQuery.cpp \
    9592  UIElements/TextUI/Query/RealSpaceMatrixTextQuery.cpp \
    9693  UIElements/TextUI/Query/StringTextQuery.cpp \
     
    10097  UIElements/TextUI/Query/VectorTextQuery.cpp \
    10198  UIElements/TextUI/Query/VectorsTextQuery.cpp \
     99  UIElements/TextUI/Query/RandomNumberDistribution_ParametersTextQuery.cpp \
    102100  UIElements/TextUI/TextDialog.cpp \
    103101  UIElements/TextUI/TextStatusIndicator.cpp \
     
    140138  ${VIEWHEADER} \
    141139  UIElements/Dialog.hpp \
    142   UIElements/Dialog_impl_pre.hpp \
    143   UIElements/Dialog_impl_undef.hpp \
    144   UIElements/GlobalListOfParameterQueries.hpp \
    145140  UIElements/MainWindow.hpp
    146141
     
    161156  UIElements/Qt4/Query/MoleculesQtQuery.cpp \
    162157  UIElements/Qt4/Query/QtQueryList.cpp \
    163   UIElements/Qt4/Query/KeyValuePairQtQuery.cpp \
    164   UIElements/Qt4/Query/KeyValuePairsQtQuery.cpp \
    165158  UIElements/Qt4/Query/RealSpaceMatrixQtQuery.cpp \
    166159  UIElements/Qt4/Query/StringQtQuery.cpp \
     
    170163  UIElements/Qt4/Query/VectorQtQuery.cpp \
    171164  UIElements/Qt4/Query/VectorsQtQuery.cpp \
     165  UIElements/Qt4/Query/RandomNumberDistribution_ParametersQtQuery.cpp \
    172166  UIElements/Qt4/QtMainWindow.cpp \
    173167  UIElements/Qt4/QtDialog.cpp \
  • src/UIElements/Qt4/QtDialog.cpp

    r3fa16b r19dfdf  
    197197}
    198198
    199 void QtDialog::queryKeyValuePair(Parameter<KeyValuePair> &param, const std::string title, const std::string description)
    200 {
    201   registerQuery(new KeyValuePairQtQuery(param, title,description,inputLayout,this));
    202 }
    203 
    204 void QtDialog::queryKeyValuePairs(Parameter< std::vector<KeyValuePair> > &param, const std::string title, const std::string description)
    205 {
    206   registerQuery(new KeyValuePairsQtQuery(param, title,description,inputLayout,this));
     199void QtDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &param, const std::string title, const std::string description)
     200{
     201  registerQuery(new RandomNumberDistribution_ParametersQtQuery(param,title,description,inputLayout,this));
    207202}
    208203
  • src/UIElements/Qt4/QtDialog.hpp

    r3fa16b r19dfdf  
    3535
    3636  virtual void queryEmpty(const std::string ="", const std::string = "");
    37 
    38   /** With the following boost::preprocessor code we generate virtual function
    39    * definitions for all desired query types in the abstract class Dialog.
    40    */
    41 #include "UIElements/GlobalListOfParameterQueries.hpp"
    42 #include "UIElements/Dialog_impl_pre.hpp"
    43 
    44   #include <boost/preprocessor/facilities/empty.hpp>
    45 
    46   // iterate over all parameter query types
    47   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    48   #define SUFFIX BOOST_PP_EMPTY()
    49   #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)
    50   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    51   #include BOOST_PP_LOCAL_ITERATE()
    52   #undef dialog_declaration
    53   #undef SUFFIX
    54   #endif
    55 
    56 #include "Dialog_impl_undef.hpp"
    57   /* End of preprocessor code piece */
     37  virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = "");
     38  virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = "");
     39  virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = "");
     40  virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = "");
     41  virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = "");
     42  virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = "");
     43  virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = "");
     44  virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = "");
     45  virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = "");
     46  virtual void queryAtom(Parameter<const atom *> &, const std::string ="", const std::string = "");
     47  virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string ="", const std::string = "");
     48  virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = "");
     49  virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = "");
     50  virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "");
     51  virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = "");
     52  virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = "");
     53  virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = "");
     54  virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = "");
     55  virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = "");
     56  virtual void queryFiles(Parameter<std::vector< boost::filesystem::path> > &, const std::string ="", const std::string = "");
     57  virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = "");
    5858
    5959  virtual bool display();
     
    6262
    6363protected:
    64 
     64  class AtomQtQuery;
     65  class AtomsQtQuery;
     66  class BooleanQtQuery;
     67  class RealSpaceMatrixQtQuery;
     68  class DoubleQtQuery;
     69  class DoublesQtQuery;
     70  class ElementQtQuery;
     71  class ElementsQtQuery;
    6572  class EmptyQtQuery;
    66 
    67   /** With the following boost::preprocessor code we generate forward declarations
    68    * of query class for all desired query types in the Qt specialization class of
    69    * Dialog.
    70    */
    71 #include "UIElements/GlobalListOfParameterQueries.hpp"
    72 #include "UIElements/Dialog_impl_pre.hpp"
    73 
    74   #include <boost/preprocessor/facilities/empty.hpp>
    75 
    76   // iterate over all parameter query types for forward declarations
    77   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    78   #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, QtQuery)
    79   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    80   #include BOOST_PP_LOCAL_ITERATE()
    81   #undef forward_declaration
    82   #endif
    83 
    84 #include "Dialog_impl_undef.hpp"
    85   /* End of preprocessor code piece */
     73  class FileQtQuery;
     74  class FilesQtQuery;
     75  class IntQtQuery;
     76  class IntsQtQuery;
     77  class MoleculeQtQuery;
     78  class MoleculesQtQuery;
     79  class StringQtQuery;
     80  class StringsQtQuery;
     81  class UnsignedIntQtQuery;
     82  class UnsignedIntsQtQuery;
     83  class VectorQtQuery;
     84  class VectorsQtQuery;
     85  class RandomNumberDistribution_ParametersQtQuery;
    8686
    8787private:
  • src/UIElements/Qt4/QtMainWindow.cpp

    r3fa16b r19dfdf  
    7878#include "Actions/WorldAction/OutputAsAction.hpp"
    7979
    80 #include "version.h"
    8180
    8281using namespace MoleCuilder;
     
    8685{
    8786  Q_INIT_RESOURCE(icons);
    88   setWindowTitle(MOLECUILDERVERSION);
    8987  theApp->setWindowIcon(QIcon(QPixmap(":/molecuildergui_logo.png")));
    9088  QCoreApplication::setOrganizationName("ins");
  • src/UIElements/Qt4/QtUIFactory.cpp

    r3fa16b r19dfdf  
    3333#endif
    3434
     35#include <iostream>
    3536#include <cassert>
    36 #include <iostream>
    37 #include <fstream>
    38 #include <string.h>
    39 
    40 #include <boost/filesystem/path.hpp>
    4137
    4238#include <Qt/qapplication.h>
     
    4743#include "UIElements/Qt4/QtDialog.hpp"
    4844
    49 // boost::python uses placement new which is incompatible with MemDebug.
    50 #ifdef HAVE_PYTHON
    51 #include "Python/PythonScripting.hpp"
    52 #endif
    53 
    5445#include "CodePatterns/MemDebug.hpp"
    5546
     47#include "version.h"
    5648#include "Helpers/defs.hpp"
    5749
    5850using namespace std;
    5951
    60 QtUIFactory::QtUIFactory(int _argc, char **_argv) :
    61     argc(1),
    62     argv(new char*[1]),
    63     testlauncher_Interrupted(false),
    64     testlauncher_thread(NULL)
     52QtUIFactory::QtUIFactory() :
     53  argc(1)
    6554{
    66 
    67   // check whether we are in test mode
    68   if ((_argc > 1) && (isTestMode(_argv[1]))) {
    69 #ifdef HAVE_BOOST_THREAD_HPP
    70     std::vector<std::string> scripts;
    71     scripts.reserve(_argc-1);
    72     for (int i=2;i<_argc;++i)
    73       scripts.push_back(std::string(_argv[i]));
    74 
    75     // check for line-by-line execution
    76     const bool SingleLineStepping = (strncmp(&_argv[1][6], "single", 6) == 0);
    77 
    78     // prepare an extra thread
    79     std::cout << "TESTLAUNCHER: Preparing " << std::endl;
    80     testlauncher_thread = new boost::thread(
    81         boost::bind(&QtUIFactory::testrun, this, scripts, SingleLineStepping));
    82 #else
    83     std::cerr << "Boost::thread support missing! Cannot launch test scripts.\n";
    84 #endif
    85     // use fake commands to not pass test stuff
    86     const int length = strlen(_argv[0]);
    87     argv[0] = new char[length];
    88     strncpy(_argv[0],_argv[0], length);
    89     app = new QApplication(argc,argv);
    90   } else {
    91     app = new QApplication(_argc,_argv);
    92   }
     55  // For now we just fake the command line parameters to make QT happy
     56  argv = new char*[1];
     57  argv[0] = new char[256];
     58  strcpy(argv[0],MOLECUILDERVERSION);
     59  app = new QApplication(argc,argv);
    9360}
    9461
    9562QtUIFactory::~QtUIFactory()
    9663{
    97   if (testlauncher_thread != NULL) {
    98     // notify testlauncher_thread thread that we wish to terminate
    99     testlauncher_thread->interrupt();
    100     // wait till it ends
    101     testlauncher_thread->join();
    102     // and remove
    103     delete testlauncher_thread;
    104   }
    105   // free fake command line argument arrays
    106   delete[] argv[0];
    107   delete[] argv;
     64  //delete app;
     65  delete [] argv[0];
     66  delete [] argv;
    10867}
    10968
     
    11675}
    11776
    118 QtUIFactory::description::description(int _argc, char **_argv) :
    119     UIFactory::factoryDescription("Qt4"),
    120     argc(_argc),
    121     argv(_argv)
     77QtUIFactory::description::description() :
     78    UIFactory::factoryDescription("Qt4")
    12279{}
    12380
     
    12683
    12784UIFactory* QtUIFactory::description::makeFactory(){
    128   return new QtUIFactory(argc, argv);
     85  return new QtUIFactory();
    12986}
    130 
    131 bool QtUIFactory::isTestMode(const char *_argument)
    132 {
    133   return (strncmp(_argument,"--test", 6) == 0);
    134 }
    135 
    136 void QtUIFactory::testrun(const std::vector<std::string> _scripts, const bool _singleLineStepping) const
    137 {
    138   std::cout << "TESTLAUNCHER: Waiting for GUI to set up" << std::endl;
    139   testlauncher_sleep(boost::posix_time::seconds(3));
    140 
    141   std::vector<std::string>::const_iterator scriptiter = _scripts.begin();
    142   do {
    143     // then launch script
    144     std::cout << "TESTLAUNCHER: Launching script " << *scriptiter
    145         << (_singleLineStepping ? " line by line." : ".") <<std::endl;
    146     if (_singleLineStepping) {
    147       boost::filesystem::path scriptfilename(*scriptiter);
    148       ASSERT( boost::filesystem::exists(scriptfilename),
    149           "QtUIFactory::testrun() - given testmode script file "
    150           +toString(scriptfilename.string())+" does not exist.");
    151       std::ifstream scriptfile(scriptfilename.string().c_str());
    152       std::string scriptfile_line;
    153       const std::string testmode("testmode, line nr.");
    154       unsigned int line_nr = 0;
    155       while(std::getline(scriptfile, scriptfile_line)) {
    156         std::string scriptname = testmode+toString(++line_nr);
    157         executePythonScript(scriptfile_line, scriptname);
    158       }
    159     } else {
    160       executePythonScriptFile(*scriptiter);
    161     }
    162     ++scriptiter;
    163 
    164     std::cout << "TESTLAUNCHER: Sleeping after script" << std::endl;
    165     testlauncher_sleep(boost::posix_time::seconds(1.5));
    166 
    167   } while ((scriptiter != _scripts.end()) && (!testlauncher_Interrupted));
    168 
    169   // send quit signal
    170   std::cout << "TESTLAUNCHER: Quitting" << std::endl;
    171   app->quit();
    172 }
    173 
    174 void QtUIFactory::testlauncher_sleep(const boost::posix_time::time_duration& _period) const
    175 {
    176   try {
    177     // first sleep for four seconds
    178 #if BOOST_VERSION < 105000
    179     testlauncher_thread->sleep(boost::get_system_time() + _period);
    180 #else
    181     boost::this_thread::sleep_for(boost::chrono::seconds(4));
    182 #endif
    183   } catch(boost::thread_interrupted &e) {
    184     LOG(2, "INFO: testlauncher thread has received stop signal.");
    185   }
    186 }
  • src/UIElements/Qt4/QtUIFactory.hpp

    r3fa16b r19dfdf  
    1717#include "UIElements/UIFactory.hpp"
    1818
    19 #include <boost/thread.hpp>
    20 #include <string>
    21 #include <vector>
    22 
    2319class QApplication;
    2420
     
    3430
    3531  struct description : public UIFactory::factoryDescription {
    36     description(int _argc, char **_argv);
     32    description();
    3733    virtual ~description();
    3834
    3935    virtual UIFactory* makeFactory();
    40 
    41   private:
    42     int argc;
    43     char **argv;
    44  };
     36  };
    4537  virtual std::string getUIName(){  return "Qt4";  }
    4638
    47   static bool isTestMode(const char *_argument);
    48 
    4939protected:
    50   QtUIFactory(int _argc, char **_argv);
     40  QtUIFactory();
    5141
    5242private:
    53 
    54   void testrun(const std::vector<std::string> _scripts, const bool _singleLineStepping = false) const;
    55 
    56   void testlauncher_sleep(const boost::posix_time::time_duration& _period) const;
    57 
    58 private:
    59   QApplication *app;
    60 
     43  // faked command line arguments
    6144  int argc;
    6245  char **argv;
    63 
    64   //!> internal flag to tell testlauncher_thread to stop
    65   mutable bool testlauncher_Interrupted;
    66 
    67   //!> internal thread to call Actions
    68   boost::thread *testlauncher_thread;
     46  QApplication *app;
    6947};
    7048
  • src/UIElements/Qt4/Query/QtQuery.hpp

    r3fa16b r19dfdf  
    1717#include <Qt/qwidget.h>
    1818#include "Qt4/QtDialog.hpp"
     19#include "Parameters/Parameter.hpp"
    1920#include "QtQueryList.hpp"
    20 
    21 #include "Parameters/Parameter.hpp"
    2221
    2322class QHBoxLayout;
     
    301300};
    302301
    303 class QtDialog::KeyValuePairQtQuery : public QWidget, public QtQuery<KeyValuePair> {
    304   Q_OBJECT
    305 public:
    306   KeyValuePairQtQuery(Parameter<KeyValuePair> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
    307   virtual ~KeyValuePairQtQuery();
    308 
    309 public slots:
    310   void onUpdate(const QString&);
    311   void onUpdateCombo(int index);
    312 
    313 private:
    314   QBoxLayout *parent;
    315   QBoxLayout *thisLayout;
    316   QLabel *titleLabel;
    317   QLineEdit *inputBox;
    318   QComboBox *comboBox;
    319   Dialog *dialog;
    320 };
    321 
    322 class QtDialog::KeyValuePairsQtQuery : public QWidget, public QtQuery<std::vector<KeyValuePair> >, public QtQueryList<KeyValuePair> {
    323   Q_OBJECT
    324 public:
    325   KeyValuePairsQtQuery(Parameter<std::vector<KeyValuePair> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
    326   virtual ~KeyValuePairsQtQuery();
    327 
    328   virtual void onSubUpdate();
    329 
    330 public slots:
    331   void onAddElement();
    332   void onRemoveElement();
    333   void onElementSelected();
    334 
    335 private:
    336   KeyValuePairQtQuery *subQuery;
    337 };
    338 
    339302class QtDialog::StringQtQuery : public QWidget, public QtQuery<std::string> {
    340303  Q_OBJECT
     
    448411};
    449412
     413class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public QtQuery<RandomNumberDistribution_Parameters> {
     414  Q_OBJECT
     415public:
     416  RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, const std::string &_title, const std::string &_description,QBoxLayout *,Dialog *);
     417  virtual ~RandomNumberDistribution_ParametersQtQuery();
     418
     419public slots:
     420  void onUpdate();
     421
     422private:
     423  QBoxLayout *parent;
     424  QHBoxLayout *thisLayout;
     425  QLabel *titleLabel;
     426  QTextEdit *inputBox;
     427  QPushButton *okButton;
     428  Dialog *dialog;
     429};
     430
    450431#endif /* QTQUERY_HPP_ */
  • src/UIElements/Qt4/Query/QtQueryList.hpp

    r3fa16b r19dfdf  
    142142  virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string = "", const std::string = ""){}
    143143  virtual void queryFiles(Parameter<std::vector< boost::filesystem::path> > &, const std::string = "", const std::string = ""){}
    144   virtual void queryKeyValuePair(Parameter<KeyValuePair> &, const std::string = "", const std::string = ""){}
    145   virtual void queryKeyValuePairs(Parameter<std::vector<KeyValuePair> > &, const std::string = "", const std::string = ""){}
    146 
     144  virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string = "", const std::string = ""){}
    147145private:
    148146  QtQueryListUntyped *parent;
  • src/UIElements/TextUI/Query/TextQuery.hpp

    r3fa16b r19dfdf  
    1717#include "TextUI/TextDialog.hpp"
    1818
     19class TextDialog::AtomTextQuery : public Dialog::TQuery<const atom *> {
     20public:
     21  AtomTextQuery(Parameter<const atom *> &, const std::string &_title, const std::string &_description = NULL);
     22  virtual ~AtomTextQuery();
     23  virtual bool handle();
     24};
     25
     26class TextDialog::AtomsTextQuery : public Dialog::TQuery<std::vector<const atom *> > {
     27public:
     28  AtomsTextQuery(Parameter<std::vector<const atom *> > &, const std::string &_title, const std::string &_description = NULL);
     29  virtual ~AtomsTextQuery();
     30  virtual bool handle();
     31};
     32
     33class TextDialog::BooleanTextQuery : public Dialog::TQuery<bool> {
     34public:
     35  BooleanTextQuery(Parameter<bool> &, const std::string &_title, const std::string &_description = NULL);
     36  virtual ~BooleanTextQuery();
     37  virtual bool handle();
     38};
     39
     40class TextDialog::RealSpaceMatrixTextQuery : public Dialog::TQuery<RealSpaceMatrix> {
     41public:
     42  RealSpaceMatrixTextQuery(Parameter<RealSpaceMatrix> &, const std::string &_title, const std::string &_description = NULL);
     43  virtual ~RealSpaceMatrixTextQuery();
     44  virtual bool handle();
     45};
     46
     47class TextDialog::DoubleTextQuery : public Dialog::TQuery<double> {
     48public:
     49  DoubleTextQuery(Parameter<double> &, const std::string &_title, const std::string &_description = NULL);
     50  virtual ~DoubleTextQuery();
     51  virtual bool handle();
     52};
     53
     54class TextDialog::DoublesTextQuery : public Dialog::TQuery<std::vector<double> > {
     55public:
     56  DoublesTextQuery(Parameter<std::vector<double> > &, const std::string &_title, const std::string &_description = NULL);
     57  virtual ~DoublesTextQuery();
     58  virtual bool handle();
     59};
     60
     61class TextDialog::ElementTextQuery : public Dialog::TQuery<const element *> {
     62public:
     63  ElementTextQuery(Parameter<const element *> &, const std::string &_title, const std::string &_description = NULL);
     64  virtual ~ElementTextQuery();
     65  virtual bool handle();
     66};
     67
     68class TextDialog::ElementsTextQuery : public Dialog::TQuery<std::vector<const element *> > {
     69public:
     70  ElementsTextQuery(Parameter<std::vector<const element *> > &, const std::string &_title, const std::string &_description = NULL);
     71  virtual ~ElementsTextQuery();
     72  virtual bool handle();
     73};
     74
    1975class TextDialog::EmptyTextQuery : public Dialog::EmptyQuery {
    2076public:
     
    2480};
    2581
     82class TextDialog::FileTextQuery : public Dialog::TQuery<boost::filesystem::path> {
     83public:
     84  FileTextQuery(Parameter<boost::filesystem::path> &, const std::string &_title, const std::string &_description = NULL);
     85  virtual ~FileTextQuery();
     86  virtual bool handle();
     87};
    2688
    27   /** With the following boost::preprocessor code we generate forward declarations
    28    * of query class for all desired query types in the Qt specialization class of
    29    * Dialog.
    30    */
    31 #include "UIElements/GlobalListOfParameterQueries.hpp"
    32 #include "UIElements/Dialog_impl_pre.hpp"
     89class TextDialog::FilesTextQuery : public Dialog::TQuery<std::vector<boost::filesystem::path> > {
     90public:
     91  FilesTextQuery(Parameter<std::vector< boost::filesystem::path> > &param, const std::string &_title, const std::string &_description = NULL);
     92  virtual ~FilesTextQuery();
     93  virtual bool handle();
     94};
    3395
    34   #include <boost/preprocessor/facilities/empty.hpp>
     96class TextDialog::IntTextQuery : public Dialog::TQuery<int> {
     97public:
     98  IntTextQuery(Parameter<int> &, const std::string &_title, const std::string &_description = NULL);
     99  virtual ~IntTextQuery();
     100  virtual bool handle();
     101};
    35102
    36   // iterate over all parameter query types for forward declarations
    37   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    38   #define BOOST_PP_LOCAL_MACRO(n) queryclass_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type, Text)
    39   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    40   #include BOOST_PP_LOCAL_ITERATE()
    41   #undef queryclass_definition
    42   #endif
     103class TextDialog::IntsTextQuery : public Dialog::TQuery<std::vector<int> > {
     104public:
     105  IntsTextQuery(Parameter<std::vector<int> > &, const std::string &_title, const std::string &_description = NULL);
     106  virtual ~IntsTextQuery();
     107  virtual bool handle();
     108};
    43109
    44 #include "Dialog_impl_undef.hpp"
    45   /* End of preprocessor code piece */
     110class TextDialog::MoleculeTextQuery : public Dialog::TQuery<const molecule *> {
     111public:
     112  MoleculeTextQuery(Parameter<const molecule *> &, const std::string &_title, const std::string &_description = NULL);
     113  virtual ~MoleculeTextQuery();
     114  virtual bool handle();
     115};
    46116
     117class TextDialog::MoleculesTextQuery : public Dialog::TQuery<std::vector<const molecule *> > {
     118public:
     119  MoleculesTextQuery(Parameter<std::vector<const molecule *> > &, const std::string &_title, const std::string &_description = NULL);
     120  virtual ~MoleculesTextQuery();
     121  virtual bool handle();
     122};
     123
     124class TextDialog::StringTextQuery : public Dialog::TQuery<std::string> {
     125public:
     126  StringTextQuery(Parameter<std::string> &, const std::string &_title, const std::string &_description = NULL);
     127  virtual ~StringTextQuery();
     128  virtual bool handle();
     129};
     130
     131class TextDialog::StringsTextQuery : public Dialog::TQuery<std::vector<std::string> > {
     132public:
     133  StringsTextQuery(Parameter<std::vector<std::string> > &, const std::string &_title, const std::string &_description = NULL);
     134  virtual ~StringsTextQuery();
     135  virtual bool handle();
     136};
     137
     138class TextDialog::UnsignedIntTextQuery : public Dialog::TQuery<unsigned int> {
     139public:
     140  UnsignedIntTextQuery(Parameter<unsigned int> &, const std::string &_title, const std::string &_description = NULL);
     141  virtual ~UnsignedIntTextQuery();
     142  virtual bool handle();
     143};
     144
     145class TextDialog::UnsignedIntsTextQuery : public Dialog::TQuery<std::vector<unsigned int> > {
     146public:
     147  UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > &, const std::string &_title, const std::string &_description = NULL);
     148  virtual ~UnsignedIntsTextQuery();
     149  virtual bool handle();
     150};
     151
     152class TextDialog::VectorTextQuery : public Dialog::TQuery<Vector> {
     153public:
     154  VectorTextQuery(Parameter<Vector> &, const std::string &_title, const std::string &_description = NULL);
     155  virtual ~VectorTextQuery();
     156  virtual bool handle();
     157};
     158
     159class TextDialog::VectorsTextQuery : public Dialog::TQuery<std::vector<Vector> > {
     160public:
     161  VectorsTextQuery(Parameter<std::vector<Vector> > &, const std::string &_title, const std::string &_description = NULL);
     162  virtual ~VectorsTextQuery();
     163  virtual bool handle();
     164};
     165
     166class TextDialog::RandomNumberDistribution_ParametersTextQuery : public Dialog::TQuery<RandomNumberDistribution_Parameters> {
     167public:
     168  RandomNumberDistribution_ParametersTextQuery(Parameter<RandomNumberDistribution_Parameters> &, const std::string &_title, const std::string &_description = NULL);
     169  virtual ~RandomNumberDistribution_ParametersTextQuery();
     170  virtual bool handle();
     171};
    47172
    48173#endif /* TEXTQUERY_HPP_ */
  • src/UIElements/TextUI/TextDialog.cpp

    r3fa16b r19dfdf  
    134134}
    135135
    136 void TextDialog::queryKeyValuePair(Parameter<KeyValuePair> &param, const std::string title, const std::string description)
    137 {
    138   registerQuery(new KeyValuePairTextQuery(param, title,description));
     136void TextDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &_param, const std::string title, const std::string description){
     137  registerQuery(new RandomNumberDistribution_ParametersTextQuery(_param, title,description));
    139138}
    140139
    141 void TextDialog::queryKeyValuePairs(Parameter< std::vector<KeyValuePair> > &param, const std::string title, const std::string description)
    142 {
    143   registerQuery(new KeyValuePairsTextQuery(param, title,description));
    144 }
    145140
    146141/************************** Query Infrastructure ************************/
  • src/UIElements/TextUI/TextDialog.hpp

    r3fa16b r19dfdf  
    2222class element;
    2323class molecule;
    24 class KeyValuePair;
    2524class RealSpaceMatrix;
    2625class Vector;
     
    3332
    3433  virtual void queryEmpty(const std::string ="", const std::string = "");
    35 
    36   /** With the following boost::preprocessor code we generate virtual function
    37    * definitions for all desired query types in the abstract class Dialog.
    38    */
    39 #include "UIElements/GlobalListOfParameterQueries.hpp"
    40 #include "UIElements/Dialog_impl_pre.hpp"
    41 
    42   #include <boost/preprocessor/facilities/empty.hpp>
    43 
    44   // iterate over all parameter query types
    45   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    46   #define SUFFIX BOOST_PP_EMPTY()
    47   #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)
    48   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    49   #include BOOST_PP_LOCAL_ITERATE()
    50   #undef dialog_declaration
    51   #undef SUFFIX
    52   #endif
    53 
    54 #include "Dialog_impl_undef.hpp"
    55   /* End of preprocessor code piece */
     34  virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = "");
     35  virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = "");
     36  virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = "");
     37  virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = "");
     38  virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = "");
     39  virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = "");
     40  virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = "");
     41  virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = "");
     42  virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = "");
     43  virtual void queryAtom(Parameter<const atom *> &, const std::string = "",std::string = "");
     44  virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string = "",std::string = "");
     45  virtual void queryMolecule(Parameter<const molecule *> &, const std::string = "",std::string = "");
     46  virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string = "",std::string = "");
     47  virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "");
     48  virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = "");
     49  virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = "");
     50  virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = "");
     51  virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = "");
     52  virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = "");
     53  virtual void queryFiles(Parameter<std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = "");
     54  virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = "");
    5655
    5756protected:
    58 
     57  // specialized stuff for text queries
     58  // all placed into Query/TextQuery.hpp
     59  // !please adhere to alphabetical ordering!
     60  class AtomTextQuery;
     61  class AtomsTextQuery;
     62  class BooleanTextQuery;
     63  class DoubleTextQuery;
     64  class DoublesTextQuery;
     65  class ElementTextQuery;
     66  class ElementsTextQuery;
    5967  class EmptyTextQuery;
    60 
    61   /** With the following boost::preprocessor code we generate forward declarations
    62    * of query class for all desired query types in the Qt specialization class of
    63    * Dialog.
    64    */
    65 #include "UIElements/GlobalListOfParameterQueries.hpp"
    66 #include "UIElements/Dialog_impl_pre.hpp"
    67 
    68   #include <boost/preprocessor/facilities/empty.hpp>
    69 
    70   // iterate over all parameter query types for forward declarations
    71   #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type
    72   #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, TextQuery)
    73   #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1)
    74   #include BOOST_PP_LOCAL_ITERATE()
    75   #undef forward_declaration
    76   #endif
    77 
    78 #include "Dialog_impl_undef.hpp"
    79   /* End of preprocessor code piece */
    80 
     68  class FileTextQuery;
     69  class FilesTextQuery;
     70  class IntTextQuery;
     71  class IntsTextQuery;
     72  class MoleculeTextQuery;
     73  class MoleculesTextQuery;
     74  class RealSpaceMatrixTextQuery;
     75  class StringTextQuery;
     76  class StringsTextQuery;
     77  class UnsignedIntTextQuery;
     78  class UnsignedIntsTextQuery;
     79  class VectorTextQuery;
     80  class VectorsTextQuery;
     81  class RandomNumberDistribution_ParametersTextQuery;
    8182};
    8283
  • src/UIElements/Views/Qt4/QDebugStream.hpp

    r3fa16b r19dfdf  
    3333{
    3434public:
    35   QDebugStream(std::ostream &stream, QTextEdit* text_edit) :
    36     m_stream(stream),
    37     printing(false)
     35  QDebugStream(std::ostream &stream, QTextEdit* text_edit) : m_stream(stream)
    3836  {
    3937    log_window = text_edit;
     
    5654  {
    5755    if (v == '\n') {
    58       while (printing);
    59       printing = true;
    6056      log_window->append(m_string.c_str());
    6157      qDebug() << m_string.c_str();
    6258      m_string.erase(m_string.begin(), m_string.end());
    63       printing = false;
    6459    } else
    6560      m_string += v;
     
    7065  virtual std::streamsize xsputn(const char *p, std::streamsize n)
    7166  {
    72     while (printing);
    73     printing = true;
    7467    m_string.append(p, p + n);
    75     printing = false;
    7668
    7769    size_t pos = 0;
     
    8072      if (pos != std::string::npos) {
    8173        std::string tmp(m_string.begin(), m_string.begin() + pos);
    82         while (printing);
    83         printing = true;
    8474        log_window->append(tmp.c_str());
    8575        qDebug() << tmp.c_str();
    8676        m_string.erase(m_string.begin(), m_string.begin() + pos + 1);
    87         printing = false;
    8877      }
    8978    }
     
    9786  std::string m_string;
    9887
    99   bool printing;
    100 
    10188  QTextEdit* log_window;
    10289};
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp

    r3fa16b r19dfdf  
    169169   painter->modelViewMatrix().push();
    170170   painter->modelViewMatrix().translate(m_position);
     171   if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
     172     painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
    171173   if (m_rotationAngle != 0.0f)
    172174     painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);
    173    if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
    174      painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
    175175
    176176   // Apply the material and effect to the painter.
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp

    r3fa16b r19dfdf  
    329329    }
    330330  }
    331   if (DoResetPosition)
     331  if (DoResetPosition) {
    332332    resetPosition();
    333   if (DoResetWidth)
     333    emit changed();
     334  }
     335  if (DoResetWidth) {
    334336    resetWidth();
    335   if ((DoResetPosition) || (DoResetWidth))
    336337    emit changed();
     338  }
    337339}
    338340
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r3fa16b r19dfdf  
    7171  double minradius = 2.; // TODO: set to maximum bond length value
    7272  LOG(3, "DEBUG: Molecule fits into sphere of radius " << minradius);
    73   // check minimum bond radius in molecule
    74   double minlength = std::numeric_limits<double>::max();
    75   for (molecule::const_iterator iter = molref->begin();
    76       iter != molref->end(); ++iter) {
    77     const BondList &ListOfBonds = (*iter)->getListOfBonds();
    78     for (BondList::const_iterator bonditer = ListOfBonds.begin();
    79          bonditer != ListOfBonds.end(); ++bonditer) {
    80       const double bond_distance = (*bonditer)->GetDistance();
    81       minlength = std::min(bond_distance, minlength);
    82     }
    83   }
    84   minradius = std::max( std::max(minradius, minlength), 1.);
     73  if (minradius < 1.)
     74    minradius = 1.;
    8575
    8676  QGeometryData geo;
     
    467457    painter->modelViewMatrix().push();
    468458    painter->modelViewMatrix().translate(m_position);
     459    if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
     460      painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
    469461    if (m_rotationAngle != 0.0f)
    470462      painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);
    471     if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
    472       painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
    473463
    474464    // Draw a box around the mesh, if selected.
  • src/World.cpp

    r3fa16b r19dfdf  
    4848#include "Descriptors/AtomDescriptor.hpp"
    4949#include "Descriptors/AtomDescriptor_impl.hpp"
    50 #include "Descriptors/AtomIdDescriptor.hpp"
    5150#include "Descriptors/AtomSelectionDescriptor.hpp"
    5251#include "Descriptors/MoleculeDescriptor.hpp"
    5352#include "Descriptors/MoleculeDescriptor_impl.hpp"
    54 #include "Descriptors/MoleculeIdDescriptor.hpp"
    5553#include "Descriptors/MoleculeSelectionDescriptor.hpp"
    5654#include "Descriptors/SelectiveConstIterator_impl.hpp"
     
    228226    const atom * const Walker = (*bonditer)->leftatom;
    229227    const atom * const OtherWalker = (*bonditer)->rightatom;
    230     bond::ptr const _bond =
    231         const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker));
    232     _bond->setDegree((*bonditer)->getDegree());
     228    const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker));
    233229  }
    234230}
     
    563559  OBSERVE;
    564560  NOTIFY(SelectionChanged);
    565   const atomIdsVector_t atomids = selectedAtoms_Stack.top();
    566   boost::function<void (const atomId_t)> IdSelector =
    567       boost::bind(static_cast<void (World::*)(const atomId_t)>(&World::selectAtom), this, _1);
    568   selectedAtoms.clear();
    569   std::for_each(atomids.begin(),atomids.end(), IdSelector);
     561  selectedAtoms = selectedAtoms_Stack.top();
    570562  selectedAtoms_Stack.pop();
    571563}
     
    574566  OBSERVE;
    575567  NOTIFY(SelectionChanged);
    576   atomIdsVector_t atomids(countSelectedAtoms(), (atomId_t)-1);
    577   std::copy(
    578       MapKeyIterator<AtomSelectionConstIterator>(beginAtomSelection()),
    579       MapKeyIterator<AtomSelectionConstIterator>(endAtomSelection()),
    580       atomids.begin());
    581   selectedAtoms_Stack.push( atomids );
     568  selectedAtoms_Stack.push( selectedAtoms );
    582569  selectedAtoms.clear();
    583570}
     
    716703  OBSERVE;
    717704  NOTIFY(SelectionChanged);
    718   const moleculeIdsVector_t moleculeids = selectedMolecules_Stack.top();
    719   boost::function<void (const moleculeId_t)> IdSelector =
    720       boost::bind(static_cast<void (World::*)(const moleculeId_t)>(&World::selectMolecule), this, _1);
    721   selectedMolecules.clear();
    722   std::for_each(moleculeids.begin(),moleculeids.end(), IdSelector);
     705  selectedMolecules = selectedMolecules_Stack.top();
    723706  selectedMolecules_Stack.pop();
    724707}
     
    727710  OBSERVE;
    728711  NOTIFY(SelectionChanged);
    729   moleculeIdsVector_t moleculeids(countSelectedMolecules(), (moleculeId_t)-1);
    730   boost::function<moleculeId_t (const molecule*)> IdRetriever =
    731       boost::bind(&molecule::getId, _1);
    732   std::copy(
    733       MapKeyIterator<MoleculeSelectionConstIterator>(beginMoleculeSelection()),
    734       MapKeyIterator<MoleculeSelectionConstIterator>(endMoleculeSelection()),
    735       moleculeids.begin());
    736   selectedMolecules_Stack.push( moleculeids );
     712  selectedMolecules_Stack.push( selectedMolecules );
    737713  selectedMolecules.clear();
    738714}
  • src/World.hpp

    r3fa16b r19dfdf  
    491491  AtomSet atoms;
    492492  AtomSet selectedAtoms;
    493   typedef std::vector<atomId_t> atomIdsVector_t;
    494   std::stack<atomIdsVector_t> selectedAtoms_Stack;
     493  std::stack<AtomSet> selectedAtoms_Stack;
    495494  /**
    496495   * stores the pool for all available AtomIds below currAtomId
     
    502501  MoleculeSet molecules;
    503502  MoleculeSet selectedMolecules;
    504   typedef std::vector<moleculeId_t> moleculeIdsVector_t;
    505   std::stack<moleculeIdsVector_t> selectedMolecules_Stack;
     503  std::stack<MoleculeSet> selectedMolecules_Stack;
    506504  /**
    507505   * stores the pool for all available AtomIds below currAtomId
  • src/builder_init.cpp

    r3fa16b r19dfdf  
    126126  // if we have python, autoexecute a molecuilder script in current folder
    127127#ifdef HAVE_PYTHON
    128   const boost::filesystem::path pythonfilename("./molecuilder.py");
    129   executePythonScriptFile(pythonfilename);
     128  const std::string pythonfilename_string("./molecuilder.py");
     129  executePythonScript(pythonfilename_string);
    130130#endif
    131131
    132132  // handle remaining arguments by CommandLineParser
    133   // first argument of "--test" initializes special molecuilder gui test mode
    134   if ((argc>1)
    135 #ifdef USE_GUI_QT
    136       && !QtUIFactory::isTestMode(argv[1])
    137 #endif
    138   ) {
     133  if (argc>1) {
    139134    LOG(0, "Setting UI to CommandLine.");
    140135    CommandLineParser::getInstance().InitializeCommandArguments();
     
    144139  } else {
    145140    // In the interactive mode, we can leave the user the choice in case of error
     141    ASSERT_DO(Assert::Ask);
    146142    #ifdef USE_GUI_QT
    147     if ((argc>1) && (QtUIFactory::isTestMode(argv[1])))
    148       ASSERT_DO(Assert::Abort);
    149     else
    150       ASSERT_DO(Assert::Ask);
    151143      LOG(0, "Setting UI to Qt4.");
    152       UIFactory::registerFactory(new QtUIFactory::description(argc, argv));
     144      UIFactory::registerFactory(new QtUIFactory::description());
    153145      UIFactory::makeUserInterface("Qt4");
    154146    #else
    155       ASSERT_DO(Assert::Ask);
    156147      LOG(0, "Setting UI to Text.");
    157148      cout << MOLECUILDERVERSION << endl;
  • tests/Calculations/testsuite-calculations-1_2-dimethoxyethane.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-1_2-dimethylbenzene.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-2-methylcyclohexanone.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-N_N-dimethylacetamide.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-anthracene.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-benzene.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-cholesterol.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-coronene.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-cycloheptane.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-dimethyl_bromomalonate.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-glucose.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-heptan.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-isoleucine.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-mpqc.at

    r3fa16b r19dfdf  
    3030        ignore,
    3131        ignore)
    32 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    33 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
    34 
    3532AT_CLEANUP
  • tests/Calculations/testsuite-calculations-naphthalene.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-neohexane.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-phenanthrene.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-proline.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-putrescine.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Calculations/testsuite-calculations-tartaric_acid.at

    r3fa16b r19dfdf  
    4545         --fragment-resultfile ${FILENAME}_results.dat],
    4646         0, [stdout], [stderr])
    47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])
    48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)
     47AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0)
    4948
    5049AT_CLEANUP
     50
  • tests/Makefile.am

    r3fa16b r19dfdf  
    44        Calculations \
    55        CodeChecks \
    6         GuiChecks \
    76        regression \
    87        Fragmentations \
     
    1110        JobMarket
    1211
    13 .PHONY: extracheck guicheck installextracheck
     12.PHONY: extracheck installextracheck
    1413
    15 guicheck:
    16         cd GuiChecks && $(MAKE) guicheck
    1714extracheck:
    1815        cd Calculations && $(MAKE) extracheck
  • tests/regression/Atoms/testsuite-atoms.at

    r3fa16b r19dfdf  
    4444# mirror atoms
    4545m4_include([Atoms/Mirror/testsuite-atoms-mirror.at])
    46 
    47 # saturate atoms
    48 m4_include([Atoms/Saturate/testsuite-atoms-saturate_carbon.at])
    49 m4_include([Atoms/Saturate/testsuite-atoms-saturate_nitrogen.at])
  • tests/regression/Bond/Add/testsuite-bond-add.at

    r3fa16b r19dfdf  
    1919
    2020AT_SETUP([Bond - adding bond])
    21 AT_KEYWORDS([bond add-bonds])
     21AT_KEYWORDS([bond add-bond])
    2222file=test.pdb
    2323AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file $file], 0, [ignore], [ignore])
    2424AT_CHECK([chmod +w $file], 0, [ignore], [ignore])
    25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bonds], 0, [ignore], [ignore])
    26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/$file], 0, [ignore], [ignore])
     25AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond], 0, [ignore], [ignore])
     26AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/test.pdb], 0, [ignore], [ignore])
    2727AT_CLEANUP
    2828
    2929
    3030AT_SETUP([Bond - adding bond with Undo])
    31 AT_KEYWORDS([bond add-bonds undo])
     31AT_KEYWORDS([bond add-bond undo])
    3232file=test.pdb
    3333AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file $file], 0, [ignore], [ignore])
    3434AT_CHECK([chmod +w $file], 0, [ignore], [ignore])
    35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bonds --undo], 0, [ignore], [ignore])
    36 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file], 0, [ignore], [ignore])
     35AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond --undo], 0, [ignore], [ignore])
     36AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/pre/test.pdb], 0, [ignore], [ignore])
    3737AT_CLEANUP
    3838
    3939
    4040AT_SETUP([Bond - adding bond with Redo])
    41 AT_KEYWORDS([bond add-bonds redo])
     41AT_KEYWORDS([bond add-bond redo])
    4242file=test.pdb
    4343AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file $file], 0, [ignore], [ignore])
    4444AT_CHECK([chmod +w $file], 0, [ignore], [ignore])
    45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bonds --undo --redo], 0, [ignore], [ignore])
    46 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/$file], 0, [ignore], [ignore])
     45AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond --undo --redo], 0, [ignore], [ignore])
     46AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/test.pdb], 0, [ignore], [ignore])
    4747AT_CLEANUP
  • tests/regression/Bond/Remove/testsuite-bond-remove.at

    r3fa16b r19dfdf  
    1919
    2020AT_SETUP([Bond - removing bond])
    21 AT_KEYWORDS([bond remove-bonds])
     21AT_KEYWORDS([bond remove-bond])
    2222file=test.pdb
    2323AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file $file], 0, [ignore], [ignore])
    2424AT_CHECK([chmod +w $file], 0, [ignore], [ignore])
    25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bonds], 0, [ignore], [ignore])
    26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/$file], 0, [ignore], [ignore])
     25AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond], 0, [ignore], [ignore])
     26AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/test.pdb], 0, [ignore], [ignore])
    2727AT_CLEANUP
    2828
    2929
    3030AT_SETUP([Bond - removing bond with Undo])
    31 AT_KEYWORDS([bond remove-bonds undo])
     31AT_KEYWORDS([bond remove-bond undo])
    3232file=test.pdb
    3333AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file $file], 0, [ignore], [ignore])
    3434AT_CHECK([chmod +w $file], 0, [ignore], [ignore])
    35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bonds --undo], 0, [ignore], [ignore])
    36 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file], 0, [ignore], [ignore])
     35AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond --undo], 0, [ignore], [ignore])
     36AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/test.pdb], 0, [ignore], [ignore])
    3737AT_CLEANUP
    3838
    3939
    4040AT_SETUP([Bond - removing bond with Redo])
    41 AT_KEYWORDS([bond remove-bonds redo])
     41AT_KEYWORDS([bond remove-bond redo])
    4242file=test.pdb
    4343AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file $file], 0, [ignore], [ignore])
    4444AT_CHECK([chmod +w $file], 0, [ignore], [ignore])
    45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bonds --undo --redo], 0, [ignore], [ignore])
    46 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/$file], 0, [ignore], [ignore])
     45AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond --undo --redo], 0, [ignore], [ignore])
     46AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/test.pdb], 0, [ignore], [ignore])
    4747AT_CLEANUP
  • tests/regression/Bond/testsuite-bond.at

    r3fa16b r19dfdf  
    2020# add bond
    2121m4_include([Bond/Add/testsuite-bond-add.at])
    22 m4_include([Bond/Add/testsuite-bond-add_multiple.at])
    2322
    2423# remove bond
    2524m4_include([Bond/Remove/testsuite-bond-remove.at])
    26 m4_include([Bond/Remove/testsuite-bond-remove_multiple.at])
  • tests/regression/Makefile.am

    r3fa16b r19dfdf  
    4040        $(srcdir)/Atoms/RemoveSphere/testsuite-atoms-remove-sphere.at \
    4141        $(srcdir)/Atoms/SaveSelectedAtoms/testsuite-atoms-save-selected-atoms.at \
    42         $(srcdir)/Atoms/Saturate/testsuite-atoms-saturate_carbon.at \
    43         $(srcdir)/Atoms/Saturate/testsuite-atoms-saturate_nitrogen.at \
    4442        $(srcdir)/Atoms/Translation/testsuite-atoms-translation.at \
    4543        $(srcdir)/Atoms/TranslationToOrigin/testsuite-atoms-translation-to-origin.at \
    4644        $(srcdir)/Bond/testsuite-bond.at \
    4745        $(srcdir)/Bond/Add/testsuite-bond-add.at \
    48         $(srcdir)/Bond/Add/testsuite-bond-add_multiple.at \
    4946        $(srcdir)/Bond/Remove/testsuite-bond-remove.at \
    50         $(srcdir)/Bond/Remove/testsuite-bond-remove_multiple.at \
    5147        $(srcdir)/Analysis/testsuite-analysis.at \
    5248        $(srcdir)/Analysis/DipoleAngularCorrelation/testsuite-analysis-dipole-angular-correlation.at \
     
    116112        $(srcdir)/Options/testsuite-options.at \
    117113        $(srcdir)/Options/BondLengthTable/testsuite-options-bond-length-table.at \
    118         $(srcdir)/Options/DryRun/testsuite-options-dryrun.at \
    119         $(srcdir)/Options/DryRun/testsuite-options-dryrun-storesession.at \
    120         $(srcdir)/Options/DryRun/testsuite-options-no-dryrun.at \
    121114        $(srcdir)/Options/ElementsDb/testsuite-options-no-elements-db.at \
    122115        $(srcdir)/Options/ElementsDb/testsuite-options-elements-db.at \
  • tests/regression/Molecules/Remove/post/water_box.pdb

    r3fa16b r19dfdf  
    1 REMARK created by molecuilder on Tue Feb 10 10:29:29 2015, time step 0
     1REMARK created by molecuilder on Fri Dec 12 19:01:22 2014, time step 0
    22ATOM      1 O01 0non 01          1.590   2.000   2.000  0.00  0.00           O 0
    33ATOM      2 H01 0non 01          2.205   2.000   2.774  0.00  0.00           H 0
     
    2424ATOM     23 H01 0non 08          6.205   6.000   6.774  0.00  0.00           H 0
    2525ATOM     24 H02 0non 08          6.205   6.000   5.226  0.00  0.00           H 0
    26 CONECT    1    2    3                                                           
    27 CONECT    2    1                                                               
    28 CONECT    3    1                                                               
    2926CONECT    4    5    6                                                           
    3027CONECT    5    4                                                               
    3128CONECT    6    4                                                               
    32 CONECT    7    8    9                                                           
    33 CONECT    8    7                                                               
    34 CONECT    9    7                                                               
    3529CONECT   10   11   12                                                           
    3630CONECT   11   10                                                               
  • tests/regression/Options/FastParsing/testsuite-options-fast-parsing.at

    r3fa16b r19dfdf  
    3939
    4040AT_CHECK([../../molecuilder -i test.conf -n 1 --undo --redo], 0, [stdout], [stderr])
    41 AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, [ignore])
     41AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, 2
     42, [ignore])
    4243
    4344AT_CLEANUP
  • tests/regression/Options/testsuite-options.at

    r3fa16b r19dfdf  
    5353m4_include([Options/Session/testsuite-options-store-session-python.at])
    5454m4_include([Options/Session/testsuite-options-load-session-python.at])
    55 
    56 # test dry run
    57 m4_include([Options/DryRun/testsuite-options-dryrun.at])
    58 m4_include([Options/DryRun/testsuite-options-no-dryrun.at])
    59 m4_include([Options/DryRun/testsuite-options-dryrun-storesession.at])
Note: See TracChangeset for help on using the changeset viewer.