Changeset ea7176 for src/molecule_dynamics.cpp
- Timestamp:
- Mar 19, 2010, 1:29:01 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:
- e0b6fd
- Parents:
- 80c63d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_dynamics.cpp
r80c63d rea7176 213 213 void FillDistanceList(molecule *mol, struct EvaluatePotential &Params) 214 214 { 215 for (int i=mol-> AtomCount; i--;) {215 for (int i=mol->getAtomCount(); i--;) { 216 216 Params.DistanceList[i] = new DistanceMap; // is the distance sorted target list per atom 217 217 Params.DistanceList[i]->clear(); … … 287 287 } 288 288 while ((Potential) > Params.PenaltyConstants[2]) { 289 PrintPermutationMap(mol-> AtomCount, Params);289 PrintPermutationMap(mol->getAtomCount(), Params); 290 290 iter++; 291 291 if (iter == mol->end()) // round-robin at the end … … 296 296 Potential = TryNextNearestNeighbourForInjectivePermutation(mol, (*iter), Potential, Params); 297 297 } 298 for (int i=mol-> AtomCount; i--;) // now each single entry in the DoubleList should be <=1298 for (int i=mol->getAtomCount(); i--;) // now each single entry in the DoubleList should be <=1 299 299 if (Params.DoubleList[i] > 1) { 300 300 eLog() << Verbose(0) << "Failed to create an injective PermutationMap!" << endl; … … 335 335 double Potential, OldPotential, OlderPotential; 336 336 struct EvaluatePotential Params; 337 Params.PermutationMap = Calloc<atom*>( AtomCount, "molecule::MinimiseConstrainedPotential: Params.**PermutationMap");338 Params.DistanceList = Malloc<DistanceMap*>( AtomCount, "molecule::MinimiseConstrainedPotential: Params.**DistanceList");339 Params.DistanceIterators = Malloc<DistanceMap::iterator>( AtomCount, "molecule::MinimiseConstrainedPotential: Params.*DistanceIterators");340 Params.DoubleList = Calloc<int>( AtomCount, "molecule::MinimiseConstrainedPotential: Params.*DoubleList");341 Params.StepList = Malloc<DistanceMap::iterator>( AtomCount, "molecule::MinimiseConstrainedPotential: Params.*StepList");337 Params.PermutationMap = Calloc<atom*>(getAtomCount(), "molecule::MinimiseConstrainedPotential: Params.**PermutationMap"); 338 Params.DistanceList = Malloc<DistanceMap*>(getAtomCount(), "molecule::MinimiseConstrainedPotential: Params.**DistanceList"); 339 Params.DistanceIterators = Malloc<DistanceMap::iterator>(getAtomCount(), "molecule::MinimiseConstrainedPotential: Params.*DistanceIterators"); 340 Params.DoubleList = Calloc<int>(getAtomCount(), "molecule::MinimiseConstrainedPotential: Params.*DoubleList"); 341 Params.StepList = Malloc<DistanceMap::iterator>(getAtomCount(), "molecule::MinimiseConstrainedPotential: Params.*StepList"); 342 342 int round; 343 343 atom *Sprinter = NULL; … … 372 372 iter = begin(); 373 373 for (; iter != end(); ++iter) { 374 PrintPermutationMap( AtomCount, Params);374 PrintPermutationMap(getAtomCount(), Params); 375 375 Sprinter = Params.DistanceIterators[(*iter)->nr]->second; // store initial partner 376 376 Strider = Params.DistanceIterators[(*iter)->nr]; //remember old iterator … … 400 400 Params.PermutationMap[(*iter)->nr] = Params.DistanceIterators[(*iter)->nr]->second; // put next farther distance into PermutationMap 401 401 Params.PermutationMap[(*runner)->nr] = Sprinter; // and hand the old target to its respective owner 402 PrintPermutationMap( AtomCount, Params);402 PrintPermutationMap(getAtomCount(), Params); 403 403 // calculate the new potential 404 404 //Log() << Verbose(2) << "Checking new potential ..." << endl; … … 438 438 439 439 /// free memory and return with evaluated potential 440 for (int i= AtomCount; i--;)440 for (int i=getAtomCount(); i--;) 441 441 Params.DistanceList[i]->clear(); 442 442 Free(&Params.DistanceList); … … 483 483 MinimiseConstrainedPotential(PermutationMap, startstep, endstep, configuration.GetIsAngstroem()); 484 484 else { 485 PermutationMap = Malloc<atom *>( AtomCount, "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap");485 PermutationMap = Malloc<atom *>(getAtomCount(), "molecule::LinearInterpolationBetweenConfiguration: **PermutationMap"); 486 486 SetIndexedArrayForEachAtomTo( PermutationMap, &atom::nr ); 487 487 } … … 516 516 517 517 // store the list to single step files 518 int *SortIndex = Malloc<int>( AtomCount, "molecule::LinearInterpolationBetweenConfiguration: *SortIndex");519 for (int i= AtomCount; i--; )518 int *SortIndex = Malloc<int>(getAtomCount(), "molecule::LinearInterpolationBetweenConfiguration: *SortIndex"); 519 for (int i=getAtomCount(); i--; ) 520 520 SortIndex[i] = i; 521 521 status = MoleculePerStep->OutputConfigForListOfFragments(&configuration, SortIndex); … … 561 561 return false; 562 562 } 563 if (Force.RowCounter[0] != AtomCount) {564 eLog() << Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << AtomCount<< "." << endl;563 if (Force.RowCounter[0] != getAtomCount()) { 564 eLog() << Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << getAtomCount() << "." << endl; 565 565 performCriticalExit(); 566 566 return false; … … 568 568 // correct Forces 569 569 Velocity.Zero(); 570 for(int i=0;i< AtomCount;i++)570 for(int i=0;i<getAtomCount();i++) 571 571 for(int d=0;d<NDIM;d++) { 572 572 Velocity.x[d] += Force.Matrix[0][i][d+5]; 573 573 } 574 for(int i=0;i< AtomCount;i++)574 for(int i=0;i<getAtomCount();i++) 575 575 for(int d=0;d<NDIM;d++) { 576 Force.Matrix[0][i][d+5] -= Velocity.x[d]/ (double)AtomCount;576 Force.Matrix[0][i][d+5] -= Velocity.x[d]/static_cast<double>(getAtomCount()); 577 577 } 578 578 // solve a constrained potential if we are meant to … … 677 677 delta_alpha = 0.; 678 678 ActOnAllAtoms( &atom::Thermostat_NoseHoover_init, MDSteps, &delta_alpha ); 679 delta_alpha = (delta_alpha - (3.* AtomCount+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass);679 delta_alpha = (delta_alpha - (3.*getAtomCount()+1.) * configuration.TargetTemp)/(configuration.HooverMass*Units2Electronmass); 680 680 configuration.alpha += delta_alpha*configuration.Deltat; 681 681 Log() << Verbose(3) << "alpha = " << delta_alpha << " * " << configuration.Deltat << " = " << configuration.alpha << "." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.