Changeset e9b8bb for src/builder.cpp
- Timestamp:
- Aug 6, 2008, 9:02:01 AM (17 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:
- 5e0d1f
- Parents:
- d7e30c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
rd7e30c re9b8bb 63 63 { 64 64 atom *first, *second, *third, *fourth; 65 vector **atoms;66 vector x,y,z,n; // coordinates for absolute point in cell volume65 Vector **atoms; 66 Vector x,y,z,n; // coordinates for absolute point in cell volume 67 67 double a,b,c; 68 68 char choice; // menu choice char … … 99 99 cout << Verbose(0) << "Enter relative coordinates." << endl; 100 100 first->x.AskPosition(mol->cell_size, false); 101 first->x.AddVector((const vector *)&x);101 first->x.AddVector((const Vector *)&x); 102 102 cout << Verbose(0) << "\n"; 103 } while (!(valid = mol->CheckBounds((const vector *)&first->x)));103 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 104 104 first->type = periode->AskElement(); // give type 105 105 mol->AddAtom(first); // add to molecule … … 117 117 first->x.x[i] += second->x.x[i]; 118 118 } 119 } while (!(valid = mol->CheckBounds((const vector *)&first->x)));119 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 120 120 first->type = periode->AskElement(); // give type 121 121 mol->AddAtom(first); // add to molecule … … 219 219 first->x.Output((ofstream *)&cout); 220 220 cout << Verbose(0) << endl; 221 } while (!(valid = mol->CheckBounds((const vector *)&first->x)));221 } while (!(valid = mol->CheckBounds((const Vector *)&first->x))); 222 222 first->type = periode->AskElement(); // give type 223 223 mol->AddAtom(first); // add to molecule … … 226 226 case 'e': // least square distance position to a set of atoms 227 227 first = new atom; 228 atoms = new ( vector*[128]);228 atoms = new (Vector*[128]); 229 229 valid = true; 230 230 for(int i=128;i--;) … … 259 259 static void CenterAtoms(molecule *mol) 260 260 { 261 vector x, y;261 Vector x, y; 262 262 char choice; // menu choice char 263 263 … … 315 315 { 316 316 atom *first, *second, *third; 317 vector x,n;317 Vector x,n; 318 318 char choice; // menu choice char 319 319 … … 335 335 third = mol->AskAtom("Enter third atom: "); 336 336 337 n.MakeNormalVector((const vector *)&first->x,(const vector *)&second->x,(const vector *)&third->x);337 n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x); 338 338 break; 339 339 case 'b': // normal vector of mirror plane … … 346 346 second = mol->AskAtom("Enter second atom: "); 347 347 348 n.CopyVector((const vector *)&first->x);349 n.SubtractVector((const vector *)&second->x);348 n.CopyVector((const Vector *)&first->x); 349 n.SubtractVector((const Vector *)&second->x); 350 350 n.Normalize(); 351 351 break; 352 352 case 'd': 353 353 char shorthand[4]; 354 vector a;354 Vector a; 355 355 struct lsq_params param; 356 356 do { … … 383 383 { 384 384 atom *first, *second, *third; 385 vector n;385 Vector n; 386 386 char choice; // menu choice char 387 387 … … 402 402 third = mol->AskAtom("Enter third atom: "); 403 403 404 n.MakeNormalVector((const vector *)&first->x,(const vector *)&second->x,(const vector *)&third->x);404 n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x); 405 405 break; 406 406 case 'b': // normal vector of mirror plane … … 413 413 second = mol->AskAtom("Enter second atom: "); 414 414 415 n.CopyVector((const vector *)&first->x);416 n.SubtractVector((const vector *)&second->x);415 n.CopyVector((const Vector *)&first->x); 416 n.SubtractVector((const Vector *)&second->x); 417 417 n.Normalize(); 418 418 break; … … 421 421 n.Output((ofstream *)&cout); 422 422 cout << Verbose(0) << endl; 423 mol->Mirror((const vector *)&n);423 mol->Mirror((const Vector *)&n); 424 424 }; 425 425 … … 458 458 while(first->next != mol->end) { 459 459 first = first->next; 460 if (first->x.Distance((const vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...460 if (first->x.Distance((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ... 461 461 mol->RemoveAtom(first); 462 462 } … … 488 488 { 489 489 atom *first, *second, *third; 490 vector x,y;490 Vector x,y; 491 491 double min[256], tmp1, tmp2, tmp3; 492 492 int Z; … … 519 519 tmp1 = 0.; 520 520 if (first != second) { 521 x.CopyVector((const vector *)&first->x);522 x.SubtractVector((const vector *)&second->x);521 x.CopyVector((const Vector *)&first->x); 522 x.SubtractVector((const Vector *)&second->x); 523 523 tmp1 = x.Norm(); 524 524 } … … 535 535 for (int i=NDIM;i--;) 536 536 min[i] = 0.; 537 x.CopyVector((const vector *)&first->x);538 x.SubtractVector((const vector *)&second->x);537 x.CopyVector((const Vector *)&first->x); 538 x.SubtractVector((const Vector *)&second->x); 539 539 tmp1 = x.Norm(); 540 540 cout << Verbose(1) << "Distance vector is "; … … 549 549 third = mol->AskAtom("Enter last atom: "); 550 550 tmp1 = tmp2 = tmp3 = 0.; 551 x.CopyVector((const vector *)&first->x);552 x.SubtractVector((const vector *)&second->x);553 y.CopyVector((const vector *)&third->x);554 y.SubtractVector((const vector *)&second->x);551 x.CopyVector((const Vector *)&first->x); 552 x.SubtractVector((const Vector *)&second->x); 553 y.CopyVector((const Vector *)&third->x); 554 y.SubtractVector((const Vector *)&second->x); 555 555 cout << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": "; 556 cout << Verbose(0) << (acos(x.ScalarProduct((const vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;556 cout << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; 557 557 break; 558 558 case 'd': … … 727 727 static int ParseCommandLineOptions(int argc, char **argv, molecule *&mol, periodentafel *&periode, config& configuration, char *&ConfigFileName, char *&PathToDatabases) 728 728 { 729 vector x,y,z,n; // coordinates for absolute point in cell volume729 Vector x,y,z,n; // coordinates for absolute point in cell volume 730 730 double *factor; // unit factor if desired 731 731 ifstream test; … … 889 889 for (int i=NDIM;i--;) 890 890 x.x[i] = atof(argv[argptr+i]); 891 mol->Translate((const vector *)&x);891 mol->Translate((const Vector *)&x); 892 892 argptr+=3; 893 893 break; … … 958 958 mol->cell_size[j] += x.x[i]*2.; 959 959 } 960 mol->Translate((const vector *)&x);960 mol->Translate((const Vector *)&x); 961 961 break; 962 962 case 'O': … … 1034 1034 int count; 1035 1035 element ** Elements; 1036 vector ** vectors;1036 Vector ** vectors; 1037 1037 if (faktor < 1) { 1038 1038 cerr << Verbose(0) << "ERROR: Repetition faktor mus be greater than 1!" << endl; … … 1043 1043 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 1044 1044 Elements = new element *[count]; 1045 vectors = new vector *[count];1045 vectors = new Vector *[count]; 1046 1046 j = 0; 1047 1047 first = mol->start; … … 1117 1117 atom *first, *second; 1118 1118 char choice; // menu choice char 1119 vector x,y,z,n; // coordinates for absolute point in cell volume1119 Vector x,y,z,n; // coordinates for absolute point in cell volume 1120 1120 double *factor; // unit factor if desired 1121 1121 bool valid; // flag if input was valid or not … … 1132 1132 clock_t start,end; 1133 1133 element **Elements; 1134 vector **vectors;1134 Vector **vectors; 1135 1135 1136 1136 // =========================== PARSE COMMAND LINE OPTIONS ==================================== … … 1231 1231 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 1232 1232 Elements = new element *[count]; 1233 vectors = new vector *[count];1233 vectors = new Vector *[count]; 1234 1234 j = 0; 1235 1235 first = mol->start; … … 1335 1335 cout << Verbose(0) << "Enter translation vector." << endl; 1336 1336 x.AskPosition(mol->cell_size,0); 1337 mol->Translate((const vector *)&x);1337 mol->Translate((const Vector *)&x); 1338 1338 break; 1339 1339
Note:
See TracChangeset
for help on using the changeset viewer.