Changeset d30402 for src/boundary.cpp
- Timestamp:
- Jul 27, 2009, 8:16:03 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, 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:
- a20e6a
- Parents:
- 36ec71
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r36ec71 rd30402 760 760 } 761 761 762 /** Determines the volume of a cluster. 763 * Determines first the convex envelope, then tesselates it and calculates its volume. 762 /** Tesselates the convex boundary by finding all boundary points. 764 763 * \param *out output stream for debugging 764 * \param *mol molecule structure with Atom's and Bond's 765 * \param *TesselStruct Tesselation filled with points, lines and triangles on boundary on return 766 * \param *LCList atoms in LinkedCell list 765 767 * \param *filename filename prefix for output of vertex data 766 * \param *configuration needed for path to store convex envelope file 767 * \param *BoundaryPoints NDIM set of boundary points on the projected plane per axis, on return if desired 768 * \param *mol molecule structure representing the cluster 769 * \return determined volume of the cluster in cubed config:GetIsAngstroem() 770 */ 771 double 772 VolumeOfConvexEnvelope(ofstream *out, const char *filename, config *configuration, 773 Boundaries *BoundaryPtr, molecule *mol) 774 { 775 bool IsAngstroem = configuration->GetIsAngstroem(); 768 * \return *TesselStruct is filled with convex boundary and tesselation is stored under \a *filename. 769 */ 770 void Find_convex_border(ofstream *out, molecule* mol, class Tesselation *&TesselStruct, class LinkedCell *LCList, const char *filename) 771 { 776 772 atom *Walker = NULL; 777 struct Tesselation *TesselStruct = new Tesselation;778 773 bool BoundaryFreeFlag = false; 779 Boundaries *BoundaryPoints = BoundaryPtr; 780 double volume = 0.; 781 double PyramidVolume = 0.; 782 double G, h; 783 Vector x, y; 784 double a, b, c; 785 786 //Find_non_convex_border(out, tecplot, *TesselStruct, mol); // Is now called from command line. 774 Boundaries *BoundaryPoints = NULL; 775 776 if (TesselStruct != NULL) // free if allocated 777 delete(TesselStruct); 778 TesselStruct = new class Tesselation; 787 779 788 780 // 1. calculate center of gravity … … 793 785 *out << Verbose(1) << "Translating system to Center of Gravity." << endl; 794 786 Walker = mol->start; 795 while (Walker->next != mol->end) 796 { 797 Walker = Walker->next; 798 Walker->x.Translate(CenterOfGravity); 799 } 787 while (Walker->next != mol->end) { 788 Walker = Walker->next; 789 Walker->x.Translate(CenterOfGravity); 790 } 800 791 801 792 // 3. Find all points on the boundary 802 if (BoundaryPoints == NULL) 803 { 793 if (BoundaryPoints == NULL) { 804 794 BoundaryFreeFlag = true; 805 795 BoundaryPoints = GetBoundaryPoints(out, mol); 806 } 807 else 808 { 796 } else { 809 797 *out << Verbose(1) << "Using given boundary points set." << endl; 810 798 } 811 799 812 800 // 4. fill the boundary point list 813 801 for (int axis = 0; axis < NDIM; axis++) 814 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner 815 != BoundaryPoints[axis].end(); runner++) 816 { 802 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) 817 803 TesselStruct->AddPoint(runner->second.second); 818 }819 804 820 805 *out << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount … … 833 818 834 819 // 5b. go through all lines, that are not yet part of two triangles (only of one so far) 835 TesselStruct->TesselateOnBoundary(out, configuration,mol);820 TesselStruct->TesselateOnBoundary(out, mol); 836 821 837 822 *out << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundaryCount … … 839 824 << " lines and " << TesselStruct->PointsOnBoundaryCount << " points." 840 825 << endl; 826 827 // 6. translate all points back from CoG 828 *out << Verbose(1) << "Translating system back from Center of Gravity." 829 << endl; 830 CenterOfGravity->Scale(-1); 831 Walker = mol->start; 832 while (Walker->next != mol->end) 833 { 834 Walker = Walker->next; 835 Walker->x.Translate(CenterOfGravity); 836 } 837 838 // 7. Store triangles in tecplot file 839 if (filename != NULL) { 840 string OutputName(filename); 841 OutputName.append(TecplotSuffix); 842 ofstream *tecplot = new ofstream(OutputName.c_str()); 843 write_tecplot_file(out, tecplot, TesselStruct, mol, 0); 844 tecplot->close(); 845 delete(tecplot); 846 ofstream *rasterplot = new ofstream(OutputName.c_str()); 847 write_raster3d_file(out, rasterplot, TesselStruct, mol); 848 rasterplot->close(); 849 delete(rasterplot); 850 } 851 852 // free reference lists 853 if (BoundaryFreeFlag) 854 delete[] (BoundaryPoints); 855 856 }; 857 858 859 /** Determines the volume of a cluster. 860 * Determines first the convex envelope, then tesselates it and calculates its volume. 861 * \param *out output stream for debugging 862 * \param *TesselStruct Tesselation filled with points, lines and triangles on boundary on return 863 * \param *configuration needed for path to store convex envelope file 864 * \return determined volume of the cluster in cubed config:GetIsAngstroem() 865 */ 866 double 867 VolumeOfConvexEnvelope(ofstream *out, class Tesselation *TesselStruct, class config *configuration) 868 { 869 bool IsAngstroem = configuration->GetIsAngstroem(); 870 double volume = 0.; 871 double PyramidVolume = 0.; 872 double G, h; 873 Vector x, y; 874 double a, b, c; 841 875 842 876 // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes … … 874 908 << endl; 875 909 876 // 7. translate all points back from CoG877 *out << Verbose(1) << "Translating system back from Center of Gravity."878 << endl;879 CenterOfGravity->Scale(-1);880 Walker = mol->start;881 while (Walker->next != mol->end)882 {883 Walker = Walker->next;884 Walker->x.Translate(CenterOfGravity);885 }886 887 // 8. Store triangles in tecplot file888 string OutputName(filename);889 OutputName.append(TecplotSuffix);890 ofstream *tecplot = new ofstream(OutputName.c_str());891 write_tecplot_file(out, tecplot, TesselStruct, mol, 0);892 tecplot->close();893 delete(tecplot);894 895 // free reference lists896 if (BoundaryFreeFlag)897 delete[] (BoundaryPoints);898 899 910 return volume; 900 911 } … … 919 930 bool IsAngstroem = configuration->GetIsAngstroem(); 920 931 Boundaries *BoundaryPoints = GetBoundaryPoints(out, mol); 932 class Tesselation *TesselStruct = NULL; 933 LinkedCell LCList(mol, 10.); 934 Find_convex_border(out, mol, TesselStruct, &LCList, NULL); 921 935 double clustervolume; 922 936 if (ClusterVolume == 0) 923 clustervolume = VolumeOfConvexEnvelope(out, NULL, configuration, 924 BoundaryPoints, mol); 937 clustervolume = VolumeOfConvexEnvelope(out, TesselStruct, configuration); 925 938 else 926 939 clustervolume = ClusterVolume; 927 double *GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, 928 IsAngstroem); 940 double *GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, IsAngstroem); 929 941 Vector BoxLengths; 930 942 int repetition[NDIM] = … … 1229 1241 */ 1230 1242 void 1231 Tesselation::TesselateOnBoundary(ofstream *out, config *configuration, 1232 molecule *mol) 1243 Tesselation::TesselateOnBoundary(ofstream *out, molecule *mol) 1233 1244 { 1234 1245 bool flag; … … 2792 2803 * \param *mol molecule structure with Atom's and Bond's 2793 2804 * \param *Tess Tesselation filled with points, lines and triangles on boundary on return 2805 * \param *LCList atoms in LinkedCell list 2794 2806 * \param *filename filename prefix for output of vertex data 2795 2807 * \para RADIUS radius of the virtual sphere
Note:
See TracChangeset
for help on using the changeset viewer.