- Timestamp:
- Oct 7, 2009, 1:11:28 PM (16 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:
- 681a8a
- Parents:
- e9f8f9
- git-author:
- Frederik Heber <heber@…> (10/07/09 12:14:15)
- git-committer:
- Frederik Heber <heber@…> (10/07/09 13:11:28)
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/atom.cpp
re9f8f9 rfcd7b6 64 64 Free<int>(&ComponentNr, "atom::~atom: *ComponentNr"); 65 65 Free<char>(&Name, "atom::~atom: *Name"); 66 Trajectory.R.clear(); 67 Trajectory.U.clear(); 68 Trajectory.F.clear(); 66 69 }; 67 70 … … 118 121 * \param *comment commentary after '#' sign 119 122 */ 120 bool atom::Output( int ElementNo, int AtomNo, ofstream *out, const char *comment) const123 bool atom::Output(ofstream *out, int ElementNo, int AtomNo, const char *comment) const 121 124 { 122 125 if (out != NULL) { … … 134 137 return false; 135 138 }; 136 bool atom::Output( int *ElementNo, int *AtomNo, ofstream *out, const char *comment)139 bool atom::Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment) 137 140 { 138 141 AtomNo[type->Z]++; // increment number … … 164 167 }; 165 168 169 /** Output of a single atom as one lin in xyz file. 170 * \param *out stream to output to 171 */ 172 bool atom::OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const 173 { 174 AtomNo[type->Z]++; 175 if (out != NULL) { 176 *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t" << fixed << setprecision(9) << showpoint; 177 *out << Trajectory.R.at(step).x[0] << "\t" << Trajectory.R.at(step).x[1] << "\t" << Trajectory.R.at(step).x[2]; 178 *out << "\t" << FixedIon; 179 if (Trajectory.U.at(step).Norm() > MYEPSILON) 180 *out << "\t" << scientific << setprecision(6) << Trajectory.U.at(step).x[0] << "\t" << Trajectory.U.at(step).x[1] << "\t" << Trajectory.U.at(step).x[2] << "\t"; 181 if (Trajectory.F.at(step).Norm() > MYEPSILON) 182 *out << "\t" << scientific << setprecision(6) << Trajectory.F.at(step).x[0] << "\t" << Trajectory.F.at(step).x[1] << "\t" << Trajectory.F.at(step).x[2] << "\t"; 183 *out << "\t# Number in molecule " << nr << endl; 184 return true; 185 } else 186 return false; 187 }; 188 166 189 ostream & operator << (ostream &ost, const atom &a) 167 190 { -
src/atom.hpp
re9f8f9 rfcd7b6 18 18 19 19 #include <iostream> 20 #include <vector> 20 21 21 22 #include "element.hpp" … … 28 29 class atom : public TesselPoint { 29 30 public: 30 Vector x; //!< coordinate array of atom, giving position within cell 31 Vector v; //!< velocity array of atom 31 struct 32 { 33 vector<Vector> R; //!< position vector 34 vector<Vector> U; //!< velocity vector 35 vector<Vector> F; //!< last force vector 36 } Trajectory; 37 38 Vector x; //!< coordinate vector of atom, giving last position within cell 39 Vector v; //!< velocity vector of atom, giving last velocity within cell 40 Vector F; //!< Force vector of atom, giving last force within cell 32 41 element *type; //!< pointing to element 33 42 atom *previous; //!< previous atom in molecule list … … 51 60 virtual ~atom(); 52 61 53 bool Output( int ElementNo, int AtomNo, ofstream *out, const char *comment = NULL) const;54 bool Output( int *ElementNo, int *AtomNo, ofstream *out, const char *comment = NULL);62 bool Output(ofstream *out, int ElementNo, int AtomNo, const char *comment = NULL) const; 63 bool Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment = NULL); 55 64 bool OutputXYZLine(ofstream *out) const; 65 bool OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const; 56 66 void EqualsFather ( atom *ptr, atom **res ); 57 67 void CorrectFather(); … … 66 76 }; 67 77 78 68 79 ostream & operator << (ostream &ost, const atom &a); 69 80 -
src/boundary.cpp
re9f8f9 rfcd7b6 1029 1029 1030 1030 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1031 mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList);1031 //mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList); 1032 1032 // mol->GoToFirst(); 1033 1033 // class TesselPoint *Runner = NULL; -
src/boundary.hpp
re9f8f9 rfcd7b6 16 16 17 17 #define DEBUG 1 18 #define DoSingleStepOutput 118 #define DoSingleStepOutput 0 19 19 #define SingleStepWidth 1 20 20 -
src/config.cpp
re9f8f9 rfcd7b6 964 964 965 965 // check size of vectors 966 if ( mol->Trajectories[neues].R.size() <= (unsigned int)(repetition)) {966 if (neues->Trajectory.R.size() <= (unsigned int)(repetition)) { 967 967 //cout << "Increasing size for trajectory array of " << keyword << " to " << (repetition+10) << "." << endl; 968 mol->Trajectories[neues].R.resize(repetition+10);969 mol->Trajectories[neues].U.resize(repetition+10);970 mol->Trajectories[neues].F.resize(repetition+10);968 neues->Trajectory.R.resize(repetition+10); 969 neues->Trajectory.U.resize(repetition+10); 970 neues->Trajectory.F.resize(repetition+10); 971 971 } 972 972 973 973 // put into trajectories list 974 974 for (int d=0;d<NDIM;d++) 975 mol->Trajectories[neues].R.at(repetition).x[d] = neues->x.x[d];975 neues->Trajectory.R.at(repetition).x[d] = neues->x.x[d]; 976 976 977 977 // parse velocities if present … … 983 983 neues->v.x[2] = 0.; 984 984 for (int d=0;d<NDIM;d++) 985 mol->Trajectories[neues].U.at(repetition).x[d] = neues->v.x[d];985 neues->Trajectory.U.at(repetition).x[d] = neues->v.x[d]; 986 986 987 987 // parse forces if present … … 993 993 value[2] = 0.; 994 994 for (int d=0;d<NDIM;d++) 995 mol->Trajectories[neues].F.at(repetition).x[d] = value[d];995 neues->Trajectory.F.at(repetition).x[d] = value[d]; 996 996 997 997 // cout << "Parsed position of step " << (repetition) << ": ("; 998 998 // for (int d=0;d<NDIM;d++) 999 // cout << mol->Trajectories[neues].R.at(repetition).x[d] << " "; // next step999 // cout << neues->Trajectory.R.at(repetition).x[d] << " "; // next step 1000 1000 // cout << ")\t("; 1001 1001 // for (int d=0;d<NDIM;d++) 1002 // cout << mol->Trajectories[neues].U.at(repetition).x[d] << " "; // next step1002 // cout << neues->Trajectory.U.at(repetition).x[d] << " "; // next step 1003 1003 // cout << ")\t("; 1004 1004 // for (int d=0;d<NDIM;d++) 1005 // cout << mol->Trajectories[neues].F.at(repetition).x[d] << " "; // next step1005 // cout << neues->Trajectory.F.at(repetition).x[d] << " "; // next step 1006 1006 // cout << ")" << endl; 1007 1007 } -
src/molecule.cpp
re9f8f9 rfcd7b6 458 458 Walker->type = elemente->FindElement(1); 459 459 } 460 if ( Trajectories[Walker].R.size() <= (unsigned int)MDSteps) {461 Trajectories[Walker].R.resize(MDSteps+10);462 Trajectories[Walker].U.resize(MDSteps+10);463 Trajectories[Walker].F.resize(MDSteps+10);460 if (Walker->Trajectory.R.size() <= (unsigned int)MDSteps) { 461 Walker->Trajectory.R.resize(MDSteps+10); 462 Walker->Trajectory.U.resize(MDSteps+10); 463 Walker->Trajectory.F.resize(MDSteps+10); 464 464 } 465 465 for(j=NDIM;j--;) { 466 466 Walker->x.x[j] = x[j]; 467 Trajectories[Walker].R.at(MDSteps-1).x[j] = x[j];468 Trajectories[Walker].U.at(MDSteps-1).x[j] = 0;469 Trajectories[Walker].F.at(MDSteps-1).x[j] = 0;467 Walker->Trajectory.R.at(MDSteps-1).x[j] = x[j]; 468 Walker->Trajectory.U.at(MDSteps-1).x[j] = 0; 469 Walker->Trajectory.F.at(MDSteps-1).x[j] = 0; 470 470 } 471 471 AddAtom(Walker); // add to molecule … … 624 624 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 625 625 ElementCount--; 626 Trajectories.erase(pointer);627 626 return remove(pointer, start, end); 628 627 }; … … 642 641 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 643 642 ElementCount--; 644 Trajectories.erase(pointer);645 643 unlink(pointer); 646 644 return true; … … 726 724 ElementNo[i] = current++; 727 725 } 728 ActOnAllAtoms( &atom::Output, ElementNo, AtomNo, out, (const char *) NULL ); // (bool (atom::*)(int *, int *, ofstream *, const char *))726 ActOnAllAtoms( &atom::Output, out, ElementNo, AtomNo, (const char *) NULL ); // (bool (atom::*)(int *, int *, ofstream *, const char *)) 729 727 return true; 730 728 } … … 759 757 ElementNo[i] = current++; 760 758 } 761 walker = start; 762 while (walker->next != end) { // go through every atom of this element 763 walker = walker->next; 764 AtomNo[walker->type->Z]++; 765 *out << "Ion_Type" << ElementNo[walker->type->Z] << "_" << AtomNo[walker->type->Z] << "\t" << fixed << setprecision(9) << showpoint; 766 *out << Trajectories[walker].R.at(step).x[0] << "\t" << Trajectories[walker].R.at(step).x[1] << "\t" << Trajectories[walker].R.at(step).x[2]; 767 *out << "\t" << walker->FixedIon; 768 if (Trajectories[walker].U.at(step).Norm() > MYEPSILON) 769 *out << "\t" << scientific << setprecision(6) << Trajectories[walker].U.at(step).x[0] << "\t" << Trajectories[walker].U.at(step).x[1] << "\t" << Trajectories[walker].U.at(step).x[2] << "\t"; 770 if (Trajectories[walker].F.at(step).Norm() > MYEPSILON) 771 *out << "\t" << scientific << setprecision(6) << Trajectories[walker].F.at(step).x[0] << "\t" << Trajectories[walker].F.at(step).x[1] << "\t" << Trajectories[walker].F.at(step).x[2] << "\t"; 772 *out << "\t# Number in molecule " << walker->nr << endl; 773 } 759 ActOnAllAtoms( &atom::OutputTrajectory, out, ElementNo, AtomNo, step ); // (bool (atom::*)(int *, int *, ofstream *, const char *)) 774 760 } 775 761 return true; … … 829 815 while (walker->next != end) { // go through every atom of this element 830 816 walker = walker->next; 831 *out << walker->type->symbol << "\t" << Trajectories[walker].R.at(step).x[0] << "\t" << Trajectories[walker].R.at(step).x[1] << "\t" << Trajectories[walker].R.at(step).x[2] << endl;817 *out << walker->type->symbol << "\t" << walker->Trajectory.R.at(step).x[0] << "\t" << walker->Trajectory.R.at(step).x[1] << "\t" << walker->Trajectory.R.at(step).x[2] << endl; 832 818 } 833 819 } … … 1237 1223 Walker = Walker->next; 1238 1224 for (int i=NDIM;i--;) 1239 temperature += Walker->type->mass * Trajectories[Walker].U.at(step).x[i]* Trajectories[Walker].U.at(step).x[i];1225 temperature += Walker->type->mass * Walker->Trajectory.U.at(step).x[i]* Walker->Trajectory.U.at(step).x[i]; 1240 1226 } 1241 1227 *output << step << "\t" << temperature*AtomicEnergyToKelvin << "\t" << temperature << endl; -
src/molecule.hpp
re9f8f9 rfcd7b6 65 65 { 66 66 bool operator() (const KeySet SubgraphA, const KeySet SubgraphB) const; 67 };68 69 struct Trajectory70 {71 vector<Vector> R; //!< position vector72 vector<Vector> U; //!< velocity vector73 vector<Vector> F; //!< last force vector74 atom *ptr; //!< pointer to atom whose trajectory we contain75 67 }; 76 68 … … 101 93 bond *last; //!< end of bond list 102 94 bond ***ListOfBondsPerAtom; //!< pointer list for each atom and each bond it has 103 map<atom *, struct Trajectory> Trajectories; //!< contains old trajectory points104 95 int MDSteps; //!< The number of MD steps in Trajectories 105 96 int *NumberOfBondsPerAtom; //!< Number of Bonds each atom has -
src/molecule_dynamics.cpp
re9f8f9 rfcd7b6 46 46 // first term: distance to target 47 47 Runner = PermutationMap[Walker->nr]; // find target point 48 tmp = ( Trajectories[Walker].R.at(startstep).Distance(&Trajectories[Runner].R.at(endstep)));48 tmp = (Walker->Trajectory.R.at(startstep).Distance(&Runner->Trajectory.R.at(endstep))); 49 49 tmp *= IsAngstroem ? 1. : 1./AtomicLengthToAngstroem; 50 50 result += constants[0] * tmp; … … 59 59 // determine normalized trajectories direction vector (n1, n2) 60 60 Sprinter = PermutationMap[Walker->nr]; // find first target point 61 trajectory1.CopyVector(& Trajectories[Sprinter].R.at(endstep));62 trajectory1.SubtractVector(& Trajectories[Walker].R.at(startstep));61 trajectory1.CopyVector(&Sprinter->Trajectory.R.at(endstep)); 62 trajectory1.SubtractVector(&Walker->Trajectory.R.at(startstep)); 63 63 trajectory1.Normalize(); 64 64 Norm1 = trajectory1.Norm(); 65 65 Sprinter = PermutationMap[Runner->nr]; // find second target point 66 trajectory2.CopyVector(& Trajectories[Sprinter].R.at(endstep));67 trajectory2.SubtractVector(& Trajectories[Runner].R.at(startstep));66 trajectory2.CopyVector(&Sprinter->Trajectory.R.at(endstep)); 67 trajectory2.SubtractVector(&Runner->Trajectory.R.at(startstep)); 68 68 trajectory2.Normalize(); 69 69 Norm2 = trajectory1.Norm(); 70 70 // check whether either is zero() 71 71 if ((Norm1 < MYEPSILON) && (Norm2 < MYEPSILON)) { 72 tmp = Trajectories[Walker].R.at(startstep).Distance(&Trajectories[Runner].R.at(startstep));72 tmp = Walker->Trajectory.R.at(startstep).Distance(&Runner->Trajectory.R.at(startstep)); 73 73 } else if (Norm1 < MYEPSILON) { 74 74 Sprinter = PermutationMap[Walker->nr]; // find first target point 75 trajectory1.CopyVector(& Trajectories[Sprinter].R.at(endstep)); // copy first offset76 trajectory1.SubtractVector(& Trajectories[Runner].R.at(startstep)); // subtract second offset75 trajectory1.CopyVector(&Sprinter->Trajectory.R.at(endstep)); // copy first offset 76 trajectory1.SubtractVector(&Runner->Trajectory.R.at(startstep)); // subtract second offset 77 77 trajectory2.Scale( trajectory1.ScalarProduct(&trajectory2) ); // trajectory2 is scaled to unity, hence we don't need to divide by anything 78 78 trajectory1.SubtractVector(&trajectory2); // project the part in norm direction away … … 80 80 } else if (Norm2 < MYEPSILON) { 81 81 Sprinter = PermutationMap[Runner->nr]; // find second target point 82 trajectory2.CopyVector(& Trajectories[Sprinter].R.at(endstep)); // copy second offset83 trajectory2.SubtractVector(& Trajectories[Walker].R.at(startstep)); // subtract first offset82 trajectory2.CopyVector(&Sprinter->Trajectory.R.at(endstep)); // copy second offset 83 trajectory2.SubtractVector(&Walker->Trajectory.R.at(startstep)); // subtract first offset 84 84 trajectory1.Scale( trajectory2.ScalarProduct(&trajectory1) ); // trajectory1 is scaled to unity, hence we don't need to divide by anything 85 85 trajectory2.SubtractVector(&trajectory1); // project the part in norm direction away … … 90 90 // *out << " and "; 91 91 // *out << trajectory2; 92 tmp = Trajectories[Walker].R.at(startstep).Distance(&Trajectories[Runner].R.at(startstep));92 tmp = Walker->Trajectory.R.at(startstep).Distance(&Runner->Trajectory.R.at(startstep)); 93 93 // *out << " with distance " << tmp << "." << endl; 94 94 } else { // determine distance by finding minimum distance … … 109 109 gsl_matrix_set(A, 1, i, trajectory2.x[i]); 110 110 gsl_matrix_set(A, 2, i, normal.x[i]); 111 gsl_vector_set(x,i, ( Trajectories[Walker].R.at(startstep).x[i] - Trajectories[Runner].R.at(startstep).x[i]));111 gsl_vector_set(x,i, (Walker->Trajectory.R.at(startstep).x[i] - Runner->Trajectory.R.at(startstep).x[i])); 112 112 } 113 113 // solve the linear system by Householder transformations … … 117 117 // *out << " with distance " << tmp << "." << endl; 118 118 // test whether we really have the intersection (by checking on c_1 and c_2) 119 TestVector.CopyVector(& Trajectories[Runner].R.at(startstep));119 TestVector.CopyVector(&Runner->Trajectory.R.at(startstep)); 120 120 trajectory2.Scale(gsl_vector_get(x,1)); 121 121 TestVector.AddVector(&trajectory2); 122 122 normal.Scale(gsl_vector_get(x,2)); 123 123 TestVector.AddVector(&normal); 124 TestVector.SubtractVector(& Trajectories[Walker].R.at(startstep));124 TestVector.SubtractVector(&Walker->Trajectory.R.at(startstep)); 125 125 trajectory1.Scale(gsl_vector_get(x,0)); 126 126 TestVector.SubtractVector(&trajectory1); … … 148 148 Sprinter = PermutationMap[Walker->nr]; 149 149 // *out << *Walker << " and " << *Runner << " are heading to the same target at "; 150 // *out << Trajectories[Sprinter].R.at(endstep);150 // *out << Sprinter->Trajectory.R.at(endstep); 151 151 // *out << ", penalting." << endl; 152 152 result += constants[2]; … … 240 240 while(Runner->next != end) { 241 241 Runner = Runner->next; 242 DistanceList[Walker->nr]->insert( DistancePair( Trajectories[Walker].R.at(startstep).Distance(&Trajectories[Runner].R.at(endstep)), Runner) );242 DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(startstep).Distance(&Runner->Trajectory.R.at(endstep)), Runner) ); 243 243 } 244 244 } … … 398 398 // set forces 399 399 for (int i=NDIM;i++;) 400 Force->Matrix[0][Walker->nr][5+i] += 2.*constant*sqrt( Trajectories[Walker].R.at(startstep).Distance(&Trajectories[Sprinter].R.at(endstep)));400 Force->Matrix[0][Walker->nr][5+i] += 2.*constant*sqrt(Walker->Trajectory.R.at(startstep).Distance(&Sprinter->Trajectory.R.at(endstep))); 401 401 } 402 402 *out << Verbose(1) << "done." << endl; … … 436 436 while (Walker->next != end) { 437 437 Walker = Walker->next; 438 if ( Trajectories[Walker].R.size() <= (unsigned int)(MaxSteps)) {438 if (Walker->Trajectory.R.size() <= (unsigned int)(MaxSteps)) { 439 439 //cout << "Increasing size for trajectory array of " << keyword << " to " << (MaxSteps+1) << "." << endl; 440 Trajectories[Walker].R.resize(MaxSteps+1);441 Trajectories[Walker].U.resize(MaxSteps+1);442 Trajectories[Walker].F.resize(MaxSteps+1);440 Walker->Trajectory.R.resize(MaxSteps+1); 441 Walker->Trajectory.U.resize(MaxSteps+1); 442 Walker->Trajectory.F.resize(MaxSteps+1); 443 443 } 444 444 } … … 448 448 Walker = Walker->next; 449 449 for (int n=NDIM;n--;) { 450 Trajectories[Walker].R.at(MaxSteps).x[n] = Trajectories[Walker].R.at(endstep).x[n];451 Trajectories[Walker].U.at(MaxSteps).x[n] = Trajectories[Walker].U.at(endstep).x[n];452 Trajectories[Walker].F.at(MaxSteps).x[n] = Trajectories[Walker].F.at(endstep).x[n];450 Walker->Trajectory.R.at(MaxSteps).x[n] = Walker->Trajectory.R.at(endstep).x[n]; 451 Walker->Trajectory.U.at(MaxSteps).x[n] = Walker->Trajectory.U.at(endstep).x[n]; 452 Walker->Trajectory.F.at(MaxSteps).x[n] = Walker->Trajectory.F.at(endstep).x[n]; 453 453 } 454 454 } … … 466 466 Sprinter = mol->AddCopyAtom(Walker); 467 467 for (int n=NDIM;n--;) { 468 Sprinter->x.x[n] = Trajectories[Walker].R.at(startstep).x[n] + (Trajectories[PermutationMap[Walker->nr]].R.at(endstep).x[n] - Trajectories[Walker].R.at(startstep).x[n])*((double)step/(double)MaxSteps);468 Sprinter->x.x[n] = Walker->Trajectory.R.at(startstep).x[n] + (PermutationMap[Walker->nr]->Trajectory.R.at(endstep).x[n] - Walker->Trajectory.R.at(startstep).x[n])*((double)step/(double)MaxSteps); 469 469 // add to Trajectories 470 470 //*out << Verbose(3) << step << ">=" << MDSteps-1 << endl; 471 471 if (step < MaxSteps) { 472 Trajectories[Walker].R.at(step).x[n] = Trajectories[Walker].R.at(startstep).x[n] + (Trajectories[PermutationMap[Walker->nr]].R.at(endstep).x[n] - Trajectories[Walker].R.at(startstep).x[n])*((double)step/(double)MaxSteps);473 Trajectories[Walker].U.at(step).x[n] = 0.;474 Trajectories[Walker].F.at(step).x[n] = 0.;472 Walker->Trajectory.R.at(step).x[n] = Walker->Trajectory.R.at(startstep).x[n] + (PermutationMap[Walker->nr]->Trajectory.R.at(endstep).x[n] - Walker->Trajectory.R.at(startstep).x[n])*((double)step/(double)MaxSteps); 473 Walker->Trajectory.U.at(step).x[n] = 0.; 474 Walker->Trajectory.F.at(step).x[n] = 0.; 475 475 } 476 476 } … … 554 554 //a = configuration.Deltat*0.5/walker->type->mass; // (F+F_old)/2m = a and thus: v = (F+F_old)/2m * t = (F + F_old) * a 555 555 // check size of vectors 556 if ( Trajectories[walker].R.size() <= (unsigned int)(MDSteps)) {556 if (walker->Trajectory.R.size() <= (unsigned int)(MDSteps)) { 557 557 //out << "Increasing size for trajectory array of " << *walker << " to " << (size+10) << "." << endl; 558 Trajectories[walker].R.resize(MDSteps+10);559 Trajectories[walker].U.resize(MDSteps+10);560 Trajectories[walker].F.resize(MDSteps+10);558 walker->Trajectory.R.resize(MDSteps+10); 559 walker->Trajectory.U.resize(MDSteps+10); 560 walker->Trajectory.F.resize(MDSteps+10); 561 561 } 562 562 563 563 // Update R (and F) 564 564 for (int d=0; d<NDIM; d++) { 565 Trajectories[walker].F.at(MDSteps).x[d] = -Force.Matrix[0][walker->nr][d+5]*(configuration.GetIsAngstroem() ? AtomicLengthToAngstroem : 1.);566 Trajectories[walker].R.at(MDSteps).x[d] = Trajectories[walker].R.at(MDSteps-1).x[d];567 Trajectories[walker].R.at(MDSteps).x[d] += configuration.Deltat*(Trajectories[walker].U.at(MDSteps-1).x[d]); // s(t) = s(0) + v * deltat + 1/2 a * deltat^2568 Trajectories[walker].R.at(MDSteps).x[d] += 0.5*configuration.Deltat*configuration.Deltat*(Trajectories[walker].F.at(MDSteps).x[d]/walker->type->mass); // F = m * a and s = 0.5 * F/m * t^2 = F * a * t565 walker->Trajectory.F.at(MDSteps).x[d] = -Force.Matrix[0][walker->nr][d+5]*(configuration.GetIsAngstroem() ? AtomicLengthToAngstroem : 1.); 566 walker->Trajectory.R.at(MDSteps).x[d] = walker->Trajectory.R.at(MDSteps-1).x[d]; 567 walker->Trajectory.R.at(MDSteps).x[d] += configuration.Deltat*(walker->Trajectory.U.at(MDSteps-1).x[d]); // s(t) = s(0) + v * deltat + 1/2 a * deltat^2 568 walker->Trajectory.R.at(MDSteps).x[d] += 0.5*configuration.Deltat*configuration.Deltat*(walker->Trajectory.F.at(MDSteps).x[d]/walker->type->mass); // F = m * a and s = 0.5 * F/m * t^2 = F * a * t 569 569 } 570 570 // Update U 571 571 for (int d=0; d<NDIM; d++) { 572 Trajectories[walker].U.at(MDSteps).x[d] = Trajectories[walker].U.at(MDSteps-1).x[d];573 Trajectories[walker].U.at(MDSteps).x[d] += configuration.Deltat * (Trajectories[walker].F.at(MDSteps).x[d]+Trajectories[walker].F.at(MDSteps-1).x[d]/walker->type->mass); // v = F/m * t572 walker->Trajectory.U.at(MDSteps).x[d] = walker->Trajectory.U.at(MDSteps-1).x[d]; 573 walker->Trajectory.U.at(MDSteps).x[d] += configuration.Deltat * (walker->Trajectory.F.at(MDSteps).x[d]+walker->Trajectory.F.at(MDSteps-1).x[d]/walker->type->mass); // v = F/m * t 574 574 } 575 575 // out << "Integrated position&velocity of step " << (MDSteps) << ": ("; 576 576 // for (int d=0;d<NDIM;d++) 577 // out << Trajectories[walker].R.at(MDSteps).x[d] << " "; // next step577 // out << walker->Trajectory.R.at(MDSteps).x[d] << " "; // next step 578 578 // out << ")\t("; 579 579 // for (int d=0;d<NDIM;d++) 580 // cout << Trajectories[walker].U.at(MDSteps).x[d] << " "; // next step580 // cout << walker->Trajectory.U.at(MDSteps).x[d] << " "; // next step 581 581 // out << ")" << endl; 582 582 // next atom … … 592 592 IonMass += walker->type->mass; // sum up total mass 593 593 for(int d=0;d<NDIM;d++) { 594 Vector[d] += Trajectories[walker].U.at(MDSteps).x[d]*walker->type->mass;594 Vector[d] += walker->Trajectory.U.at(MDSteps).x[d]*walker->type->mass; 595 595 } 596 596 } … … 603 603 walker = walker->next; 604 604 for(int d=0;d<NDIM;d++) { 605 Trajectories[walker].U.at(MDSteps).x[d] -= Vector[d];606 ActualTemp += 0.5 * walker->type->mass * Trajectories[walker].U.at(MDSteps).x[d] * Trajectories[walker].U.at(MDSteps).x[d];605 walker->Trajectory.U.at(MDSteps).x[d] -= Vector[d]; 606 ActualTemp += 0.5 * walker->type->mass * walker->Trajectory.U.at(MDSteps).x[d] * walker->Trajectory.U.at(MDSteps).x[d]; 607 607 } 608 608 } … … 663 663 walker = walker->next; 664 664 IonMass = walker->type->mass; 665 U = Trajectories[walker].U.at(MDSteps).x;665 U = walker->Trajectory.U.at(MDSteps).x; 666 666 if (walker->FixedIon == 0) // even FixedIon moves, only not by other's forces 667 667 for (d=0; d<NDIM; d++) { … … 678 678 walker = walker->next; 679 679 IonMass = walker->type->mass; 680 U = Trajectories[walker].U.at(MDSteps).x;681 F = Trajectories[walker].F.at(MDSteps).x;680 U = walker->Trajectory.U.at(MDSteps).x; 681 F = walker->Trajectory.F.at(MDSteps).x; 682 682 if (walker->FixedIon == 0) // even FixedIon moves, only not by other's forces 683 683 for (d=0; d<NDIM; d++) { … … 691 691 walker = walker->next; 692 692 IonMass = walker->type->mass; 693 U = Trajectories[walker].U.at(MDSteps).x;694 F = Trajectories[walker].F.at(MDSteps).x;693 U = walker->Trajectory.U.at(MDSteps).x; 694 F = walker->Trajectory.F.at(MDSteps).x; 695 695 if (walker->FixedIon == 0) // even FixedIon moves, only not by other's forces 696 696 for (d=0; d<NDIM; d++) { … … 713 713 IonMass = walker->type->mass; 714 714 sigma = sqrt(configuration.TargetTemp/IonMass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime) 715 U = Trajectories[walker].U.at(MDSteps).x;716 F = Trajectories[walker].F.at(MDSteps).x;715 U = walker->Trajectory.U.at(MDSteps).x; 716 F = walker->Trajectory.F.at(MDSteps).x; 717 717 if (walker->FixedIon == 0) { // even FixedIon moves, only not by other's forces 718 718 // throw a dice to determine whether it gets hit by a heat bath particle … … 736 736 walker = walker->next; 737 737 IonMass = walker->type->mass; 738 U = Trajectories[walker].U.at(MDSteps).x;739 F = Trajectories[walker].F.at(MDSteps).x;738 U = walker->Trajectory.U.at(MDSteps).x; 739 F = walker->Trajectory.F.at(MDSteps).x; 740 740 if (walker->FixedIon == 0) { // even FixedIon moves, only not by other's forces 741 741 for (d=0; d<NDIM; d++) { … … 754 754 walker = walker->next; 755 755 IonMass = walker->type->mass; 756 U = Trajectories[walker].U.at(MDSteps).x;756 U = walker->Trajectory.U.at(MDSteps).x; 757 757 if (walker->FixedIon == 0) { // even FixedIon moves, only not by other's forces 758 758 for (d=0; d<NDIM; d++) { … … 769 769 walker = walker->next; 770 770 IonMass = walker->type->mass; 771 U = Trajectories[walker].U.at(MDSteps).x;771 U = walker->Trajectory.U.at(MDSteps).x; 772 772 if (walker->FixedIon == 0) { // even FixedIon moves, only not by other's forces 773 773 for (d=0; d<NDIM; d++) { -
src/molecule_geometry.cpp
re9f8f9 rfcd7b6 200 200 ptr = ptr->next; 201 201 for (int j=0;j<MDSteps;j++) 202 Trajectories[ptr].R.at(j).Scale(factor);202 ptr->Trajectory.R.at(j).Scale(factor); 203 203 ptr->x.Scale(factor); 204 204 } … … 215 215 ptr = ptr->next; 216 216 for (int j=0;j<MDSteps;j++) 217 Trajectories[ptr].R.at(j).Translate(trans);217 ptr->Trajectory.R.at(j).Translate(trans); 218 218 ptr->x.Translate(trans); 219 219 } … … 438 438 ptr->x.x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x.x[2]; 439 439 for (int j=0;j<MDSteps;j++) { 440 tmp = Trajectories[ptr].R.at(j).x[0];441 Trajectories[ptr].R.at(j).x[0] = cos(alpha) * tmp + sin(alpha) * Trajectories[ptr].R.at(j).x[2];442 Trajectories[ptr].R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * Trajectories[ptr].R.at(j).x[2];440 tmp = ptr->Trajectory.R.at(j).x[0]; 441 ptr->Trajectory.R.at(j).x[0] = cos(alpha) * tmp + sin(alpha) * ptr->Trajectory.R.at(j).x[2]; 442 ptr->Trajectory.R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->Trajectory.R.at(j).x[2]; 443 443 } 444 444 } … … 461 461 ptr->x.x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->x.x[2]; 462 462 for (int j=0;j<MDSteps;j++) { 463 tmp = Trajectories[ptr].R.at(j).x[1];464 Trajectories[ptr].R.at(j).x[1] = cos(alpha) * tmp + sin(alpha) * Trajectories[ptr].R.at(j).x[2];465 Trajectories[ptr].R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * Trajectories[ptr].R.at(j).x[2];463 tmp = ptr->Trajectory.R.at(j).x[1]; 464 ptr->Trajectory.R.at(j).x[1] = cos(alpha) * tmp + sin(alpha) * ptr->Trajectory.R.at(j).x[2]; 465 ptr->Trajectory.R.at(j).x[2] = -sin(alpha) * tmp + cos(alpha) * ptr->Trajectory.R.at(j).x[2]; 466 466 } 467 467 }
Note:
See TracChangeset
for help on using the changeset viewer.