Ignore:
Timestamp:
Sep 10, 2014, 7:10:26 PM (11 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:
5a9f4c
Parents:
aa55d0
git-author:
Frederik Heber <heber@…> (09/07/14 16:50:10)
git-committer:
Frederik Heber <heber@…> (09/10/14 19:10:26)
Message:

Removed PrepareClustersInWater().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tesselation/boundary.cpp

    raa55d0 r2b7375  
    654654};
    655655
    656 /** Creates multiples of the by \a *mol given cluster and suspends them in water with a given final density.
    657  * We get cluster volume by Tesselation::getVolumeOfConvexEnvelope() and its diameters by GetDiametersOfCluster()
    658  * TODO: Here, we need a VolumeOfGeneralEnvelope (i.e. non-convex one)
    659  * \param *out output stream for debugging
    660  * \param *configuration needed for path to store convex envelope file
    661  * \param *mol molecule structure representing the cluster
    662  * \param *&TesselStruct Tesselation structure with triangles on return
    663  * \param ClusterVolume guesstimated cluster volume, if equal 0 we used Tesselation::getVolumeOfConvexEnvelope() instead.
    664  * \param celldensity desired average density in final cell
    665  */
    666 void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity)
    667 {
    668         //Info FunctionInfo(__func__);
    669   bool IsAngstroem = true;
    670   double *GreatestDiameter = NULL;
    671   Boundaries *BoundaryPoints = NULL;
    672   class Tesselation *TesselStruct = NULL;
    673   Vector BoxLengths;
    674   int repetition[NDIM] = { 1, 1, 1 };
    675   int TotalNoClusters = 1;
    676   double totalmass = 0.;
    677   double clustervolume = 0.;
    678   double cellvolume = 0.;
    679 
    680   // transform to PAS by Action
    681   Vector MainAxis(0.,0.,1.);
    682   mol->RotateToPrincipalAxisSystem(MainAxis);
    683 
    684   IsAngstroem = configuration->GetIsAngstroem();
    685   BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    686   GreatestDiameter = GetDiametersOfCluster(BoundaryPoints, mol, TesselStruct, IsAngstroem);
    687   PointCloudAdaptor< molecule > cloud(mol, mol->name);
    688   LinkedCell_deprecated *LCList = new LinkedCell_deprecated(cloud, 10.);
    689   FindConvexBorder(mol, BoundaryPoints, TesselStruct, (const LinkedCell_deprecated *&)LCList, NULL);
    690   delete (LCList);
    691   delete[] BoundaryPoints;
    692 
    693 
    694   // some preparations beforehand
    695   if (ClusterVolume == 0)
    696     clustervolume = TesselStruct->getVolumeOfConvexEnvelope(configuration->GetIsAngstroem());
    697   else
    698     clustervolume = ClusterVolume;
    699 
    700   delete TesselStruct;
    701 
    702   for (int i = 0; i < NDIM; i++)
    703     TotalNoClusters *= repetition[i];
    704 
    705   // sum up the atomic masses
    706   for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    707       totalmass += (*iter)->getType()->getMass();
    708   }
    709   LOG(0, "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit.");
    710   LOG(0, "RESULT: The average density is " << setprecision(10) << totalmass / clustervolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3.");
    711 
    712   // solve cubic polynomial
    713   LOG(1, "Solving equidistant suspension in water problem ...");
    714   if (IsAngstroem)
    715     cellvolume = (TotalNoClusters * totalmass / SOLVENTDENSITY_A - (totalmass / clustervolume)) / (celldensity - 1);
    716   else
    717     cellvolume = (TotalNoClusters * totalmass / SOLVENTDENSITY_a0 - (totalmass / clustervolume)) / (celldensity - 1);
    718   LOG(1, "Cellvolume needed for a density of " << celldensity << " g/cm^3 is " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3.");
    719 
    720   double minimumvolume = TotalNoClusters * (GreatestDiameter[0] * GreatestDiameter[1] * GreatestDiameter[2]);
    721   LOG(1, "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3.");
    722   if (minimumvolume > cellvolume) {
    723     ELOG(1, "the containing box already has a greater volume than the envisaged cell volume!");
    724     LOG(0, "Setting Box dimensions to minimum possible, the greatest diameters.");
    725     for (int i = 0; i < NDIM; i++)
    726       BoxLengths[i] = GreatestDiameter[i];
    727     mol->CenterEdge();
    728   } else {
    729     BoxLengths[0] = (repetition[0] * GreatestDiameter[0] + repetition[1] * GreatestDiameter[1] + repetition[2] * GreatestDiameter[2]);
    730     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]);
    731     BoxLengths[2] = minimumvolume - cellvolume;
    732     double x0 = 0.;
    733     double x1 = 0.;
    734     double x2 = 0.;
    735     if (gsl_poly_solve_cubic(BoxLengths[0], BoxLengths[1], BoxLengths[2], &x0, &x1, &x2) == 1) // either 1 or 3 on return
    736       LOG(0, "RESULT: The resulting spacing is: " << x0 << " .");
    737     else {
    738       LOG(0, "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " .");
    739       x0 = x2; // sorted in ascending order
    740     }
    741 
    742     cellvolume = 1.;
    743     for (int i = 0; i < NDIM; i++) {
    744       BoxLengths[i] = repetition[i] * (x0 + GreatestDiameter[i]);
    745       cellvolume *= BoxLengths[i];
    746     }
    747 
    748     // set new box dimensions
    749     LOG(0, "Translating to box with these boundaries.");
    750     {
    751       RealSpaceMatrix domain;
    752       for(int i =0; i<NDIM;++i)
    753         domain.at(i,i) = BoxLengths[i];
    754       World::getInstance().setDomain(domain);
    755     }
    756     mol->CenterInBox();
    757   }
    758   delete[] GreatestDiameter;
    759   // update Box of atoms by boundary
    760   {
    761     RealSpaceMatrix domain;
    762     for(int i =0; i<NDIM;++i)
    763       domain.at(i,i) = BoxLengths[i];
    764     World::getInstance().setDomain(domain);
    765   }
    766   LOG(0, "RESULT: The resulting cell dimensions are: " << BoxLengths[0] << " and " << BoxLengths[1] << " and " << BoxLengths[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3.");
    767 };
    768 
    769656/** Tesselates the non convex boundary by rolling a virtual sphere along the surface of the molecule.
    770657 * \param *out output stream for debugging
Note: See TracChangeset for help on using the changeset viewer.