Changeset a5028f for src/ellipsoid.cpp
- Timestamp:
- Feb 3, 2011, 9:59:58 AM (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, Candidate_v1.7.0, 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:
- 5817ef
- Parents:
- 63839f
- git-author:
- Frederik Heber <heber@…> (01/07/11 15:38:52)
- git-committer:
- Frederik Heber <heber@…> (02/03/11 09:59:58)
- File:
-
- 1 edited
-
src/ellipsoid.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ellipsoid.cpp
r63839f ra5028f 36 36 #include "LinearAlgebra/RealSpaceMatrix.hpp" 37 37 #include "CodePatterns/Verbose.hpp" 38 39 #include "RandomNumbers/RandomNumberGeneratorFactory.hpp" 40 #include "RandomNumbers/RandomNumberGenerator.hpp" 38 41 39 42 /** Determines squared distance for a given point \a x to surface of ellipsoid. … … 258 261 } 259 262 263 RandomNumberGenerator &random = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator("mt19937", "uniform_int"); 264 // check that random number generator's bounds are ok 265 ASSERT(random.min() == 0, 266 "PickRandomNeighbouredPointSet: Chosen RandomNumberGenerator's min " 267 +toString(random.min())+" is not 0!"); 268 ASSERT(random.max() >= LC->N[0], 269 "PickRandomNeighbouredPointSet: Chosen RandomNumberGenerator's max " 270 +toString(random.max())+" is too small"+toString(LC->N[0]) 271 +" for axis 0!"); 272 ASSERT(random.max() >= LC->N[1], 273 "PickRandomNeighbouredPointSet: Chosen RandomNumberGenerator's max " 274 +toString(random.max())+" is too small"+toString(LC->N[1]) 275 +" for axis 1!"); 276 ASSERT(random.max() >= LC->N[2], 277 "PickRandomNeighbouredPointSet: Chosen RandomNumberGenerator's max " 278 +toString(random.max())+" is too small"+toString(LC->N[2]) 279 +" for axis 2!"); 280 260 281 do { 261 282 for(int i=0;i<NDIM;i++) // pick three random indices 262 LC->n[i] = ( rand() % LC->N[i]);283 LC->n[i] = ((int)random() % LC->N[i]); 263 284 DoLog(2) && (Log() << Verbose(2) << "INFO: Center cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " ... "); 264 285 // get random cell … … 293 314 PickedAtomNrs.clear(); 294 315 do { 295 index = ( rand() % PointsLeft);316 index = (((int)random()) % PointsLeft); 296 317 current = PickedAtomNrs.find(index); // not present? 297 318 if (current == PickedAtomNrs.end()) { … … 358 379 } 359 380 381 RandomNumberGenerator &random = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator("mt19937", "uniform_int"); 382 const double rng_min = random.min(); 383 const double rng_max = random.max(); 360 384 if (List != NULL) 361 385 for (PointMap::iterator Runner = List->begin(); Runner != List->end(); Runner++) { 362 386 threshold = 1. - (double)(PointsToPick - PointsPicked)/(double)PointsLeft; 363 value = (double)rand ()/(double)RAND_MAX;387 value = (double)random()/(double)(rng_max-rng_min); 364 388 //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": "; 365 389 if (value > threshold) {
Note:
See TracChangeset
for help on using the changeset viewer.
