Changeset a1e929 for src


Ignore:
Timestamp:
Jun 21, 2010, 1:07:58 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
d3dff06
Parents:
2f40c0e
Message:

Case 'p' is now handled by CommandLineUI.

  • ~XyzParser() did destroy falsely its own comment.
  • TremoloParser and XyzParser used include with Parser path.
  • ParserLoadXyzAction:
    • corrected NAME.
    • uses XyzParser and adds all new atoms to the first present molecule.
  • CommandLineWindow::display() - now states when action is launched or found absent.
  • builder.cpp: cleanup() - purges ChangeTracker
  • ParseCommandLineOptions() - sets configPresent to present without check (as parsing is done afterwards, but arguments of other cases will be thrown away in case of empty world)
Location:
src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MapOfActions.cpp

    r2f40c0e ra1e929  
    266266  generic.insert("nonconvex-envelope");
    267267        generic.insert("pair-correlation");
    268 //      generic.insert("parse-xyz");
     268        generic.insert("parse-xyz");
    269269//  generic.insert("principal-axis-system");
    270270  generic.insert("remove-atom");
  • src/Actions/ParserAction/LoadXyzAction.cpp

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

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

    r2f40c0e ra1e929  
    2727 */
    2828XyzParser::~XyzParser() {
    29   delete(&comment);
    3029}
    3130
  • src/Parser/XyzParser.hpp

    r2f40c0e ra1e929  
    1010
    1111#include <string>
    12 #include "FormatParser.hpp"
     12#include "Parser/FormatParser.hpp"
    1313
    1414/**
  • src/UIElements/CommandLineUI/CommandLineWindow.cpp

    r2f40c0e ra1e929  
    8383  // go through all possible actions
    8484  for (std::list<std::string>::iterator CommandRunner = CommandLineParser::getInstance().SequenceOfActions.begin(); CommandRunner != CommandLineParser::getInstance().SequenceOfActions.end(); ++CommandRunner) {
    85     cout << "Checking presence of " << *CommandRunner << endl;
    86     if (ActionRegistry::getInstance().isActionByNamePresent(*CommandRunner))
     85    cout << "Checking presence of " << *CommandRunner << ": ";
     86    if (ActionRegistry::getInstance().isActionByNamePresent(*CommandRunner)) {
     87      cout << "calling " << *CommandRunner << endl;
    8788      ActionRegistry::getInstance().getActionByName(*CommandRunner)->call();
     89    } else {
     90      cout << "absent." << endl;
     91    }
    8892  }
    8993}
  • src/builder.cpp

    r2f40c0e ra1e929  
    7979#include "UIElements/Dialog.hpp"
    8080#include "Menu/ActionMenuItem.hpp"
     81#include "Parser/ChangeTracker.hpp"
    8182#include "Actions/ActionRegistry.hpp"
    8283#include "Actions/ActionHistory.hpp"
     
    16911692              } else {
    16921693                SaveFlag = true;
    1693                 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);
    1694                 if (!mol->AddXYZFile(argv[argptr]))
    1695                   DoLog(2) && (Log() << Verbose(2) << "File not found." << endl);
    1696                 else {
    1697                   DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl);
    1698                   configPresent = present;
    1699                 }
     1694                configPresent = present;
     1695                ArgcList.insert(argptr-1);
     1696                ArgcList.insert(argptr);
     1697                argptr+=1;
    17001698              }
    17011699              break;
     
    21812179
    21822180void cleanUp(){
     2181  ChangeTracker::purgeInstance();
    21832182  World::purgeInstance();
    21842183  logger::purgeInstance();
Note: See TracChangeset for help on using the changeset viewer.