Changeset 0a4f7f for src/boundary.cpp
- Timestamp:
- Apr 7, 2010, 3:45:38 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:
- 72e7fa
- Parents:
- f9352d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
rf9352d r0a4f7f 18 18 #include "tesselation.hpp" 19 19 #include "tesselationhelpers.hpp" 20 #include "Plane.hpp" 20 21 21 22 #include<gsl/gsl_poly.h> … … 80 81 DistanceVector.SubtractVector(&Neighbour->second.second->x); 81 82 do { // seek for neighbour pair where it flips 82 OldComponent = DistanceVector .x[Othercomponent];83 OldComponent = DistanceVector[Othercomponent]; 83 84 Neighbour++; 84 85 if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around … … 88 89 //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl; 89 90 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 90 OldComponent) - DistanceVector .x[Othercomponent] / fabs(91 DistanceVector .x[Othercomponent])) < MYEPSILON)); // as long as sign does not flip91 OldComponent) - DistanceVector[Othercomponent] / fabs( 92 DistanceVector[Othercomponent])) < MYEPSILON)); // as long as sign does not flip 92 93 if (runner != Neighbour) { 93 94 OtherNeighbour = Neighbour; … … 102 103 //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl; 103 104 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 104 w1 = fabs(OtherVector .x[Othercomponent]);105 w2 = fabs(DistanceVector .x[Othercomponent]);106 tmp = fabs((w1 * DistanceVector .x[component] + w2107 * OtherVector .x[component]) / (w1 + w2));105 w1 = fabs(OtherVector[Othercomponent]); 106 w2 = fabs(DistanceVector[Othercomponent]); 107 tmp = fabs((w1 * DistanceVector[component] + w2 108 * OtherVector[component]) / (w1 + w2)); 108 109 // mark if it has greater diameter 109 110 //Log() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl; … … 159 160 AngleReferenceVector.Zero(); 160 161 AngleReferenceNormalVector.Zero(); 161 AxisVector .x[axis] = 1.;162 AngleReferenceVector .x[(axis + 1) % NDIM] = 1.;163 AngleReferenceNormalVector .x[(axis + 2) % NDIM] = 1.;162 AxisVector[axis] = 1.; 163 AngleReferenceVector[(axis + 1) % NDIM] = 1.; 164 AngleReferenceNormalVector[(axis + 2) % NDIM] = 1.; 164 165 165 166 Log() << Verbose(1) << "Axisvector is " << AxisVector << " and AngleReferenceVector is " << AngleReferenceVector << ", and AngleReferenceNormalVector is " << AngleReferenceNormalVector << "." << endl; … … 636 637 const double c = sqrt(runner->second->endpoints[2]->node->node->DistanceSquared(runner->second->endpoints[1]->node->node)); 637 638 const double G = sqrt(((a + b + c) * (a + b + c) - 2 * (a * a + b * b + c * c)) / 16.); // area of tesselated triangle 638 x.MakeNormalVector(runner->second->endpoints[0]->node->node, runner->second->endpoints[1]->node->node, runner->second->endpoints[2]->node->node); 639 x = Plane(*(runner->second->endpoints[0]->node->node), 640 *(runner->second->endpoints[1]->node->node), 641 *(runner->second->endpoints[2]->node->node)).getNormal(); 639 642 x.Scale(runner->second->endpoints[1]->node->node->ScalarProduct(&x)); 640 643 const double h = x.Norm(); // distance of CoG to triangle … … 751 754 Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl; 752 755 for (int i = 0; i < NDIM; i++) 753 BoxLengths .x[i] = GreatestDiameter[i];756 BoxLengths[i] = GreatestDiameter[i]; 754 757 mol->CenterEdge(&BoxLengths); 755 758 } else { 756 BoxLengths .x[0] = (repetition[0] * GreatestDiameter[0] + repetition[1] * GreatestDiameter[1] + repetition[2] * GreatestDiameter[2]);757 BoxLengths .x[1] = (repetition[0] * repetition[1] * GreatestDiameter[0] * GreatestDiameter[1] + repetition[0] * repetition[2] * GreatestDiameter[0] * GreatestDiameter[2] + repetition[1] * repetition[2] * GreatestDiameter[1] * GreatestDiameter[2]);758 BoxLengths .x[2] = minimumvolume - cellvolume;759 BoxLengths[0] = (repetition[0] * GreatestDiameter[0] + repetition[1] * GreatestDiameter[1] + repetition[2] * GreatestDiameter[2]); 760 BoxLengths[1] = (repetition[0] * repetition[1] * GreatestDiameter[0] * GreatestDiameter[1] + repetition[0] * repetition[2] * GreatestDiameter[0] * GreatestDiameter[2] + repetition[1] * repetition[2] * GreatestDiameter[1] * GreatestDiameter[2]); 761 BoxLengths[2] = minimumvolume - cellvolume; 759 762 double x0 = 0.; 760 763 double x1 = 0.; 761 764 double x2 = 0.; 762 if (gsl_poly_solve_cubic(BoxLengths .x[0], BoxLengths.x[1], BoxLengths.x[2], &x0, &x1, &x2) == 1) // either 1 or 3 on return765 if (gsl_poly_solve_cubic(BoxLengths[0], BoxLengths[1], BoxLengths[2], &x0, &x1, &x2) == 1) // either 1 or 3 on return 763 766 Log() << Verbose(0) << "RESULT: The resulting spacing is: " << x0 << " ." << endl; 764 767 else { … … 769 772 cellvolume = 1.; 770 773 for (int i = 0; i < NDIM; i++) { 771 BoxLengths .x[i] = repetition[i] * (x0 + GreatestDiameter[i]);772 cellvolume *= BoxLengths .x[i];774 BoxLengths[i] = repetition[i] * (x0 + GreatestDiameter[i]); 775 cellvolume *= BoxLengths[i]; 773 776 } 774 777 … … 780 783 // update Box of atoms by boundary 781 784 mol->SetBoxDimension(&BoxLengths); 782 Log() << Verbose(0) << "RESULT: The resulting cell dimensions are: " << BoxLengths .x[0] << " and " << BoxLengths.x[1] << " and " << BoxLengths.x[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl;785 Log() << Verbose(0) << "RESULT: The resulting cell dimensions are: " << BoxLengths[0] << " and " << BoxLengths[1] << " and " << BoxLengths[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl; 783 786 }; 784 787 … … 839 842 FillerDistance.InverseMatrixMultiplication(M); 840 843 for(int i=0;i<NDIM;i++) 841 N[i] = (int) ceil(1./FillerDistance.x[i]);844 N[i] = static_cast<int>(ceil(1./FillerDistance[i])); 842 845 Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl; 843 846 … … 880 883 // create molecule random translation vector ... 881 884 for (int i=0;i<NDIM;i++) 882 FillerTranslations .x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);885 FillerTranslations[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.); 883 886 Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl; 884 887 … … 892 895 // create atomic random translation vector ... 893 896 for (int i=0;i<NDIM;i++) 894 AtomTranslations .x[i] = RandomAtomDisplacement*(rand()/(RAND_MAX/2.) - 1.);897 AtomTranslations[i] = RandomAtomDisplacement*(rand()/(RAND_MAX/2.) - 1.); 895 898 896 899 // ... and rotation matrix
Note:
See TracChangeset
for help on using the changeset viewer.