Changeset 57d8b0 for src


Ignore:
Timestamp:
Oct 15, 2008, 5:16:43 PM (16 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:
19f3d6
Parents:
2b4a40
Message:

molecule::VerletForceIntegration() different code, same algorithm (still bug-hunting)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecules.cpp

    r2b4a40 r57d8b0  
    10261026  string token;
    10271027  stringstream item;
    1028   double a, IonMass, Vector[NDIM];
     1028  double a, IonMass;
    10291029  ForceMatrix Force;
     1030  Vector tmpvector;
    10301031
    10311032  CountElements();  // make sure ElementsInMolecule is up to date
     
    10451046    }
    10461047    // correct Forces
    1047     for(int d=0;d<NDIM;d++)
    1048       Vector[d] = 0.;
    1049     for(int i=0;i<AtomCount;i++)
    1050       for(int d=0;d<NDIM;d++) {
    1051         Vector[d] += Force.Matrix[0][i][d+5];
    1052       }
    1053     for(int i=0;i<AtomCount;i++)
    1054       for(int d=0;d<NDIM;d++) {
    1055         Force.Matrix[0][i][d+5] -= Vector[d]/(double)AtomCount;
    1056       }
     1048//    for(int d=0;d<NDIM;d++)
     1049//      tmpvector.x[d] = 0.;
     1050//    for(int i=0;i<AtomCount;i++)
     1051//      for(int d=0;d<NDIM;d++) {
     1052//        tmpvector.x[d] += Force.Matrix[0][i][d+5];
     1053//      }
     1054//    for(int i=0;i<AtomCount;i++)
     1055//      for(int d=0;d<NDIM;d++) {
     1056//        Force.Matrix[0][i][d+5] -= tmpvector.x[d]/(double)AtomCount;
     1057//      }
    10571058    // and perform Verlet integration for each atom with position, velocity and force vector
    10581059    runner = elemente->start;
     
    10741075              Trajectories[walker].F.resize(MDSteps+10);
    10751076            }
    1076            
    1077             // Update R (and F)
     1077            // 1. calculate x(t+\delta t)
    10781078            for (int d=0; d<NDIM; d++) {
    1079               Trajectories[walker].F.at(MDSteps).x[d] = -Force.Matrix[0][AtomNo][d+5]*(IsAngstroem ? AtomicLengthToAngstroem : 1.);
     1079              Trajectories[walker].F.at(MDSteps).x[d] = -Force.Matrix[0][AtomNo][d+5];
    10801080              Trajectories[walker].R.at(MDSteps).x[d] = Trajectories[walker].R.at(MDSteps-1).x[d];
    10811081              Trajectories[walker].R.at(MDSteps).x[d] += delta_t*(Trajectories[walker].U.at(MDSteps-1).x[d]);
    1082               Trajectories[walker].R.at(MDSteps).x[d] += delta_t*a*(Trajectories[walker].F.at(MDSteps).x[d]);     // F = m * a and s = 0.5 * F/m * t^2 = F * a * t
     1082              Trajectories[walker].R.at(MDSteps).x[d] += 0.5*delta_t*delta_t*(Trajectories[walker].F.at(MDSteps-1).x[d])/IonMass;     // F = m * a and s = 0.5 * F/m * t^2 = F * a * t
    10831083            }
    1084             // Update U
     1084            // 2. Calculate v(t+\delta t)
    10851085            for (int d=0; d<NDIM; d++) {
    1086               Trajectories[walker].U.at(MDSteps).x[d] = Trajectories[walker].U.at(MDSteps-1).x[d]; 
    1087               Trajectories[walker].U.at(MDSteps).x[d] += a * (Trajectories[walker].F.at(MDSteps).x[d]+Trajectories[walker].F.at(MDSteps-1).x[d]);
     1086              Trajectories[walker].U.at(MDSteps).x[d] = Trajectories[walker].U.at(MDSteps-1).x[d];
     1087              Trajectories[walker].U.at(MDSteps).x[d] += 0.5*delta_t*(Trajectories[walker].F.at(MDSteps-1).x[d]+Trajectories[walker].F.at(MDSteps).x[d])/IonMass;
    10881088            }
    10891089//            cout << "Integrated position&velocity of step " << (MDSteps) << ": (";
     
    11021102  }
    11031103//  // correct velocities (rather momenta) so that center of mass remains motionless
    1104 //  for(int d=0;d<NDIM;d++)
    1105 //    Vector[d] = 0.;
     1104//  tmpvector.zero()
    11061105//  IonMass = 0.;
    11071106//  walker = start;
     
    11101109//    IonMass += walker->type->mass;  // sum up total mass
    11111110//    for(int d=0;d<NDIM;d++) {
    1112 //      Vector[d] += Trajectories[walker].U.at(MDSteps).x[d]*walker->type->mass;
     1111//      tmpvector.x[d] += Trajectories[walker].U.at(MDSteps).x[d]*walker->type->mass;
    11131112//    }
    11141113//  }
     
    11171116//    walker = walker->next;
    11181117//    for(int d=0;d<NDIM;d++) {
    1119 //      Trajectories[walker].U.at(MDSteps).x[d] -= Vector[d]*walker->type->mass/IonMass;
     1118//      Trajectories[walker].U.at(MDSteps).x[d] -= tmpvector.x[d]*walker->type->mass/IonMass;
    11201119//    }
    11211120//  }
Note: See TracChangeset for help on using the changeset viewer.