- Timestamp:
- Jun 2, 2010, 4:17:17 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:
- 3610bb
- Parents:
- 584a2a
- git-author:
- Frederik Heber <heber@…> (06/02/10 15:41:52)
- git-committer:
- Frederik Heber <heber@…> (06/02/10 16:17:17)
- Location:
- src
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
r584a2a re30ce8 153 153 TypeMap["remove-atom"] = Atom; 154 154 TypeMap["remove-sphere"] = Atom; 155 TypeMap["repeat-box"] = ListOfInts;155 TypeMap["repeat-box"] = Vector; 156 156 TypeMap["rotate-to-pas"] = Molecule; 157 157 TypeMap["save-adjacency"] = String; … … 165 165 TypeMap["verlet-integrate"] = String; 166 166 TypeMap["verbose"] = Integer; 167 167 168 // value types for the values 168 169 TypeMap["bin-output-file"] = String; … … 180 181 TypeMap["periodic"] = Boolean; 181 182 TypeMap["position"] = Vector; 183 184 // default values for any action that needs one (always string!) 185 DefaultValue["molecule-by-id"] = "-1"; 186 182 187 183 188 // list of generic actions … … 210 215 // generic.insert("remove-atom"); 211 216 // generic.insert("remove-sphere"); 217 generic.insert("repeat-box"); 212 218 // generic.insert("rotate-to-pas"); 213 219 // generic.insert("save-adjacency"); … … 271 277 case Boolean: 272 278 ListRunner->second->add_options() 273 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< bool >(), getDescription(*OptionRunner).c_str()) 279 (getKeyAndShortForm(*OptionRunner).c_str(), 280 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 281 po::value< bool >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 282 po::value< bool >(), 283 getDescription(*OptionRunner).c_str()) 274 284 ; 275 285 break; 276 286 case Integer: 277 287 ListRunner->second->add_options() 278 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str()) 288 (getKeyAndShortForm(*OptionRunner).c_str(), 289 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 290 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 291 po::value< int >(), 292 getDescription(*OptionRunner).c_str()) 279 293 ; 280 294 break; 281 295 case ListOfInts: 282 296 ListRunner->second->add_options() 283 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str()) 297 (getKeyAndShortForm(*OptionRunner).c_str(), 298 po::value< vector<int> >()->multitoken(), 299 getDescription(*OptionRunner).c_str()) 284 300 ; 285 301 break; 286 302 case Double: 287 303 ListRunner->second->add_options() 288 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< double >(), getDescription(*OptionRunner).c_str()) 304 (getKeyAndShortForm(*OptionRunner).c_str(), 305 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 306 po::value< double >()->default_value(atof(DefaultValue[*OptionRunner].c_str())) : 307 po::value< double >(), 308 getDescription(*OptionRunner).c_str()) 289 309 ; 290 310 break; 291 311 case ListOfDoubles: 292 312 ListRunner->second->add_options() 293 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >()->multitoken(), getDescription(*OptionRunner).c_str()) 313 (getKeyAndShortForm(*OptionRunner).c_str(), 314 po::value< vector<double> >()->multitoken(), 315 getDescription(*OptionRunner).c_str()) 294 316 ; 295 317 break; 296 318 case String: 297 319 ListRunner->second->add_options() 298 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< std::string >(), getDescription(*OptionRunner).c_str()) 320 (getKeyAndShortForm(*OptionRunner).c_str(), 321 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 322 po::value< std::string >()->default_value(DefaultValue[*OptionRunner]) : 323 po::value< std::string >(), 324 getDescription(*OptionRunner).c_str()) 299 325 ; 300 326 break; 301 327 case Axis: 302 328 ListRunner->second->add_options() 303 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str()) 329 (getKeyAndShortForm(*OptionRunner).c_str(), 330 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 331 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 332 po::value< int >(), 333 getDescription(*OptionRunner).c_str()) 304 334 ; 305 335 break; 306 336 case Vector: 307 337 ListRunner->second->add_options() 308 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >()->multitoken(), getDescription(*OptionRunner).c_str()) 338 (getKeyAndShortForm(*OptionRunner).c_str(), 339 po::value< vector<double> >()->multitoken(), 340 getDescription(*OptionRunner).c_str()) 309 341 ; 310 342 break; 311 343 case Box: 312 344 ListRunner->second->add_options() 313 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >(), getDescription(*OptionRunner).c_str()) 345 (getKeyAndShortForm(*OptionRunner).c_str(), 346 po::value< vector<double> >(), 347 getDescription(*OptionRunner).c_str()) 314 348 ; 315 349 break; 316 350 case Molecule: 317 351 ListRunner->second->add_options() 318 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str()) 352 (getKeyAndShortForm(*OptionRunner).c_str(), 353 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 354 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 355 po::value< int >(), 356 getDescription(*OptionRunner).c_str()) 319 357 ; 320 358 break; 321 359 case ListOfMolecules: 322 360 ListRunner->second->add_options() 323 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str()) 361 (getKeyAndShortForm(*OptionRunner).c_str(), 362 po::value< vector<int> >()->multitoken(), 363 getDescription(*OptionRunner).c_str()) 324 364 ; 325 365 break; 326 366 case Atom: 327 367 ListRunner->second->add_options() 328 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str()) 368 (getKeyAndShortForm(*OptionRunner).c_str(), 369 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 370 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 371 po::value< int >(), 372 getDescription(*OptionRunner).c_str()) 329 373 ; 330 374 break; 331 375 case ListOfAtoms: 332 376 ListRunner->second->add_options() 333 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str()) 377 (getKeyAndShortForm(*OptionRunner).c_str(), 378 po::value< vector<int> >()->multitoken(), 379 getDescription(*OptionRunner).c_str()) 334 380 ; 335 381 break; 336 382 case Element: 337 383 ListRunner->second->add_options() 338 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str()) 384 (getKeyAndShortForm(*OptionRunner).c_str(), 385 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 386 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 387 po::value< int >(), 388 getDescription(*OptionRunner).c_str()) 339 389 ; 340 390 break; 341 391 case ListOfElements: 342 392 ListRunner->second->add_options() 343 (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str()) 393 (getKeyAndShortForm(*OptionRunner).c_str(), 394 po::value< vector<int> >()->multitoken(), 395 getDescription(*OptionRunner).c_str()) 344 396 ; 345 397 break; -
src/Actions/MapOfActions.hpp
r584a2a re30ce8 53 53 54 54 // map of the action names and their description 55 map<std::string, std::string> DefaultValue; 55 56 map<std::string, std::string> DescriptionMap; 56 57 map<std::string, std::string> ShortFormMap; -
src/Actions/WorldAction/RepeatBoxAction.cpp
r584a2a re30ce8 23 23 #include "UIElements/Dialog.hpp" 24 24 #include "Actions/MapOfActions.hpp" 25 #include "Descriptors/MoleculeDescriptor.hpp" 26 #include "Descriptors/MoleculePtrDescriptor.hpp" 25 27 26 28 const char WorldRepeatBoxAction::NAME[] = "repeat-box"; … … 41 43 int j = 0; 42 44 atom *Walker = NULL; 45 MoleculeListClass *molecules = World::getInstance().getMolecules(); 43 46 44 47 dialog->queryVector(NAME, &Repeater, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME)); 45 dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id")); 48 //dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id")); 49 vector<molecule *> AllMolecules; 50 if (mol != NULL) { 51 DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl); 52 AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol)); 53 } else { 54 DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl); 55 AllMolecules = World::getInstance().getAllMolecules(); 56 } 46 57 47 58 if(dialog->display()) { 59 (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl); 48 60 double * const cell_size = World::getInstance().getDomain(); 61 double *M = ReturnFullMatrixforSymmetric(cell_size); 49 62 Vector x,y; 50 for (int axis = 1; axis <= NDIM; axis++) {51 Vector ** vectors;63 int n[NDIM]; 64 for (int axis = 0; axis < NDIM; axis++) { 52 65 Repeater[axis] = floor(Repeater[axis]); 53 66 if (Repeater[axis] < 1) { … … 55 68 Repeater[axis] = 1; 56 69 } 57 if (mol->getAtomCount() != 0) { // if there is more than none 58 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 59 Elements = new const element *[count]; 60 vectors = new Vector *[count]; 61 j = 0; 62 for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) { 63 Elements[j] = (*AtomRunner)->type; 64 vectors[j] = &(*AtomRunner)->x; 65 j++; 66 } 67 if (count != j) 68 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 69 x.Zero(); 70 y.Zero(); 71 y[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 72 for (int i=1;i<Repeater[axis];i++) { // then add this list with respective translation factor times 73 x += y; // per factor one cell width further 74 for (int k=count;k--;) { // go through every atom of the original cell 75 Walker = World::getInstance().createAtom(); // create a new body 76 Walker->x = (*vectors[k]) + x; 77 Walker->type = Elements[k]; // insert original element 78 mol->AddAtom(Walker); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) 70 cell_size[(abs(axis+1) == 2) ? 2 : ((abs(axis+2) == 3) ? 5 : 0)] *= Repeater[axis]; 71 } 72 73 molecule *newmol = NULL; 74 Vector ** vectors = NULL; 75 for (n[0] = 0; n[0] < Repeater[0]; n[0]++) { 76 y[0] = n[0]; 77 for (n[1] = 0; n[1] < Repeater[1]; n[1]++) { 78 y[1] = n[1]; 79 for (n[2] = 0; n[2] < Repeater[2]; n[2]++) { 80 y[2] = n[2]; 81 if (n[0] == n[1] == n[2] == 0) 82 continue; 83 for (vector<molecule *>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) { 84 mol = *MolRunner; 85 DoLog(1) && (Log() << Verbose(1) << "Current mol is " << mol->name << "." << endl); 86 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 87 if (count != 0) { // if there is more than none 88 Elements = new const element *[count]; 89 vectors = new Vector *[count]; 90 j = 0; 91 for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) { 92 Elements[j] = (*AtomRunner)->type; 93 vectors[j] = &(*AtomRunner)->x; 94 j++; 95 } 96 if (count != j) 97 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 98 x = y; 99 x.MatrixMultiplication(M); 100 newmol = World::getInstance().createMolecule(); 101 molecules->insert(newmol); 102 for (int k=count;k--;) { // go through every atom of the original cell 103 Walker = World::getInstance().createAtom(); // create a new body 104 Walker->x = (*vectors[k]) + x; 105 Walker->type = Elements[k]; // insert original element 106 cout << "new atom is " << *Walker << endl; 107 newmol->AddAtom(Walker); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) 108 } 109 // free memory 110 delete[](Elements); 111 delete[](vectors); 112 } else { 113 DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl); 114 } 79 115 } 80 116 } 81 // free memory82 delete[](Elements);83 delete[](vectors);84 // correct cell size85 if (axis < 0) { // if sign was negative, we have to translate everything86 x =(-(Repeater[axis]-1)) * y;87 mol->Translate(&x);88 }89 cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= Repeater[axis];90 117 } 91 118 } 119 delete(M); 92 120 delete dialog; 93 121 return Action::success; -
src/Makefile.am
r584a2a re30ce8 113 113 Descriptors/AtomTypeDescriptor.cpp \ 114 114 Descriptors/MoleculeDescriptor.cpp \ 115 Descriptors/MoleculeIdDescriptor.cpp 115 Descriptors/MoleculeIdDescriptor.cpp \ 116 Descriptors/MoleculePtrDescriptor.cpp 116 117 117 118 … … 120 121 Descriptors/AtomTypeDescriptor.hpp \ 121 122 Descriptors/MoleculeDescriptor.hpp \ 122 Descriptors/MoleculeIdDescriptor.hpp 123 Descriptors/MoleculeIdDescriptor.hpp \ 124 Descriptors/MoleculePtrDescriptor.hpp 123 125 124 126 EXCEPTIONSOURCE = Exceptions/CustomException.cpp \ -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r584a2a re30ce8 192 192 if (CommandLineParser::getInstance().vm.count(getTitle())) { 193 193 IdxOfMol = CommandLineParser::getInstance().vm[getTitle()].as<int>(); 194 tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol)); 194 cout << "IdxOfMol " << IdxOfMol << endl; 195 if (IdxOfMol >= 0) 196 tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol)); 197 else 198 tmp = NULL; 195 199 return true; 196 200 } else -
src/builder.cpp
r584a2a re30ce8 2354 2354 performCriticalExit(); 2355 2355 } else { 2356 SaveFlag = true; 2357 double * const cell_size = World::getInstance().getDomain(); 2358 for (int axis = 1; axis <= NDIM; axis++) { 2359 int faktor = atoi(argv[argptr++]); 2360 int count; 2361 const element ** Elements; 2362 Vector ** vectors; 2363 if (faktor < 1) { 2364 DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl); 2365 faktor = 1; 2366 } 2367 if (mol->getAtomCount() != 0) { // if there is more than none 2368 count = mol->getAtomCount(); // is changed becausing of adding, thus has to be stored away beforehand 2369 Elements = new const element *[count]; 2370 vectors = new Vector *[count]; 2371 j = 0; 2372 for(molecule::iterator iter = mol->begin();iter!=mol->end();++iter){ 2373 Elements[j] = (*iter)->type; 2374 vectors[j] = &(*iter)->x; 2375 j++; 2376 } 2377 if (count != j) 2378 DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl); 2379 x.Zero(); 2380 y.Zero(); 2381 y[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 2382 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 2383 x += y; // per factor one cell width further 2384 for (int k=count;k--;) { // go through every atom of the original cell 2385 first = World::getInstance().createAtom(); // create a new body 2386 first->x = (*vectors[k]) + x; 2387 first->type = Elements[k]; // insert original element 2388 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) 2389 } 2390 } 2391 // free memory 2392 delete[](Elements); 2393 delete[](vectors); 2394 // correct cell size 2395 if (axis < 0) { // if sign was negative, we have to translate everything 2396 x =(-(faktor-1)) * y; 2397 mol->Translate(&x); 2398 } 2399 cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 2400 } 2401 } 2356 ArgcList.insert(argptr-1); 2357 ArgcList.insert(argptr); 2358 ArgcList.insert(argptr+1); 2359 ArgcList.insert(argptr+2); 2360 argptr+=3; 2402 2361 } 2403 2362 break;
Note:
See TracChangeset
for help on using the changeset viewer.