- Timestamp:
- Jun 11, 2010, 12:19:50 PM (15 years ago)
- 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:
- 54b953
- Parents:
- 6c7352
- git-author:
- Frederik Heber <heber@…> (06/11/10 10:22:45)
- git-committer:
- Frederik Heber <heber@…> (06/11/10 12:19:50)
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AtomAction/AddAction.cpp
r6c7352 rf0a3ec 10 10 #include "element.hpp" 11 11 #include "log.hpp" 12 #include " periodentafel.hpp"12 #include "molecule.hpp" 13 13 #include "vector.hpp" 14 14 #include "verbose.hpp" … … 35 35 Action::state_ptr AtomAddAction::performCall() { 36 36 Dialog *dialog = UIFactory::getInstance().makeDialog(); 37 int Z = -1;37 std::vector<element *> elements; 38 38 Vector position; 39 39 40 dialog->query Int(NAME, &Z, MapOfActions::getInstance().getDescription(NAME));40 dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME)); 41 41 dialog->queryVector("position", &position, World::getInstance().getDomain(), true, MapOfActions::getInstance().getDescription("position")); 42 cout << "pre-dialog" << endl; 42 43 43 44 if(dialog->display()) { 45 cout << "post-dialog" << endl; 44 46 delete dialog; 45 atom * first = World::getInstance().createAtom();46 first->type = World::getInstance().getPeriode()->FindElement(Z);47 first->x = position;48 if (first->type != NULL) {47 if (elements.size() == 1) { 48 atom * first = World::getInstance().createAtom(); 49 first->type = *(elements.begin()); 50 first->x = position; 49 51 DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl); 52 // TODO: remove when all of World's atoms are stored. 53 std::vector<molecule *> molecules = World::getInstance().getAllMolecules(); 54 if (!molecules.empty()) { 55 std::vector<molecule *>::iterator iter = molecules.begin(); 56 (*iter)->AddAtom(first); 57 } 50 58 return Action::success; 51 59 } else { 52 60 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 53 World::getInstance().destroyAtom(first);54 61 return Action::failure; 55 62 } -
src/Actions/MapOfActions.cpp
r6c7352 rf0a3ec 164 164 165 165 // value types for the actions 166 TypeMap["add-atom"] = Atom;166 TypeMap["add-atom"] = Element; 167 167 TypeMap["bond-file"] = String; 168 168 TypeMap["bond-table"] = String; … … 210 210 TypeMap["distances"] = Vector; 211 211 TypeMap["DoRotate"] = Boolean; 212 TypeMap["element s"] = Element;212 TypeMap["element"] = Element; 213 213 TypeMap["elements"] = ListOfElements; 214 214 TypeMap["length"] = Double; … … 230 230 231 231 // list of generic actions 232 //generic.insert("add-atom");232 generic.insert("add-atom"); 233 233 // generic.insert("bond-file"); 234 234 generic.insert("bond-table"); … … 434 434 ListRunner->second->add_options() 435 435 (getKeyAndShortForm(*OptionRunner).c_str(), 436 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 437 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 438 po::value< int >(), 436 po::value< vector<int> >(), 439 437 getDescription(*OptionRunner).c_str()) 440 438 ; -
src/builder.cpp
r6c7352 rf0a3ec 1681 1681 case 'a': 1682 1682 if (ExitFlag == 0) ExitFlag = 1; 1683 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) {1683 if ((argptr+4 >= argc) || (argv[argptr][0] == '-')) { 1684 1684 ExitFlag = 255; 1685 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element><x> <y> <z>" << endl);1685 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for adding atom: -a <Z> --position <x> <y> <z>" << endl); 1686 1686 performCriticalExit(); 1687 1687 } else { 1688 SaveFlag = true; 1689 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), "; 1690 first = World::getInstance().createAtom(); 1691 first->type = periode->FindElement(atoi(argv[argptr])); 1692 if (first->type != NULL) 1693 DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl); 1694 for (int i=NDIM;i--;) 1695 first->x[i] = atof(argv[argptr+1+i]); 1696 if (first->type != NULL) { 1697 mol->AddAtom(first); // add to molecule 1698 if ((configPresent == empty) && (mol->getAtomCount() != 0)) 1699 configPresent = present; 1700 } else 1701 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 1702 argptr+=4; 1688 ArgcList.insert(argptr-1); 1689 ArgcList.insert(argptr); 1690 ArgcList.insert(argptr+1); 1691 ArgcList.insert(argptr+2); 1692 ArgcList.insert(argptr+3); 1693 ArgcList.insert(argptr+4); 1694 argptr+=5; 1703 1695 } 1704 1696 break; … … 1738 1730 bool periodic = (argv[argptr-1][2] =='p'); 1739 1731 if (ExitFlag == 0) ExitFlag = 1; 1740 if ((argptr >= argc)) {1732 if ((argptr+11 >= argc)) { 1741 1733 ExitFlag = 255; 1742 1734 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C[p] <type: E/P/S> [more params] <output> <bin output> <BinStart> <BinEnd>" << endl);
Note:
See TracChangeset
for help on using the changeset viewer.