Changeset edb650 for src/boundary.cpp


Ignore:
Timestamp:
Jun 13, 2008, 2:26:50 PM (17 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:
14d4d4
Parents:
318bfd
Message:

some mor changes to fine-tune the cluster generation.

Sadly, VolumeOfConvexEnvelope() is not robust/stable, with Ratio1.4-1/1800K/compundH.*.xyz no usable convex envelope was found but points were connected right through the cluster.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r318bfd redb650  
    561561 * \param *configuration needed for path to store convex envelope file
    562562 * \param *mol molecule structure representing the cluster
     563 * \param ClusterVolume guesstimated cluster volume, if equal 0 we used VolumeOfConvexEnvelope() instead.
    563564 * \param celldensity desired average density in final cell
    564565 */
    565 void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double celldensity)
     566void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity)
    566567{
    567568  // transform to PAS
     
    571572  bool IsAngstroem = configuration->GetIsAngstroem();
    572573  Boundaries *BoundaryPoints = GetBoundaryPoints(out, mol);
    573   double clustervolume = VolumeOfConvexEnvelope(out, configuration, BoundaryPoints, mol);
     574  double clustervolume;
     575  if (ClusterVolume == 0)
     576    clustervolume = VolumeOfConvexEnvelope(out, configuration, BoundaryPoints, mol);
     577  else
     578    clustervolume = ClusterVolume;
    574579  double *GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, IsAngstroem);
    575580  vector BoxLengths;
     
    601606  double minimumvolume = TotalNoClusters*(GreatestDiameter[0]*GreatestDiameter[1]*GreatestDiameter[2]);
    602607  *out << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl;
    603   if (minimumvolume > cellvolume)
     608  if (minimumvolume > cellvolume) {
    604609    cerr << Verbose(0) << "ERROR: the containing box already has a greater volume than the envisaged cell volume!" << endl;
    605  
    606   BoxLengths.x[0] = (repetition[0]*GreatestDiameter[0] + repetition[1]*GreatestDiameter[1] + repetition[2]*GreatestDiameter[2]);
    607   BoxLengths.x[1] = (repetition[0]*repetition[1]*GreatestDiameter[0]*GreatestDiameter[1]
    608             + repetition[0]*repetition[2]*GreatestDiameter[0]*GreatestDiameter[2]
    609             + repetition[1]*repetition[2]*GreatestDiameter[1]*GreatestDiameter[2]);
    610   BoxLengths.x[2] = minimumvolume - cellvolume;
    611   double x0 = 0.,x1 = 0.,x2 = 0.;
    612   if (gsl_poly_solve_cubic(BoxLengths.x[0],BoxLengths.x[1],BoxLengths.x[2],&x0,&x1,&x2) == 1) // either 1 or 3 on return
    613     *out << Verbose(0) << "RESULT: The resulting spacing is: " << x0 << " ." << endl;
    614   else {
    615     *out << Verbose(0) << "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " ." << endl;
    616     x0 = x2;  // sorted in ascending order
    617   }
    618 
    619   cellvolume = 1;
    620   for(int i=0;i<NDIM;i++) {
    621     BoxLengths.x[i] = repetition[i] * (x0 + GreatestDiameter[i]);
    622     cellvolume *= BoxLengths.x[i];
    623   }
    624   *out << 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;
    625  
    626   // set new box dimensions
    627   *out << Verbose(0) << "Translating to box with these boundaries." << endl;
    628   mol->CenterInBox((ofstream *)&cout, &BoxLengths);
     610    cout << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl;
     611    for(int i=0;i<NDIM;i++)
     612      BoxLengths.x[i] = GreatestDiameter[i];
     613    mol->CenterEdge(out, &BoxLengths);
     614  } else {
     615    BoxLengths.x[0] = (repetition[0]*GreatestDiameter[0] + repetition[1]*GreatestDiameter[1] + repetition[2]*GreatestDiameter[2]);
     616    BoxLengths.x[1] = (repetition[0]*repetition[1]*GreatestDiameter[0]*GreatestDiameter[1]
     617              + repetition[0]*repetition[2]*GreatestDiameter[0]*GreatestDiameter[2]
     618              + repetition[1]*repetition[2]*GreatestDiameter[1]*GreatestDiameter[2]);
     619    BoxLengths.x[2] = minimumvolume - cellvolume;
     620    double x0 = 0.,x1 = 0.,x2 = 0.;
     621    if (gsl_poly_solve_cubic(BoxLengths.x[0],BoxLengths.x[1],BoxLengths.x[2],&x0,&x1,&x2) == 1) // either 1 or 3 on return
     622      *out << Verbose(0) << "RESULT: The resulting spacing is: " << x0 << " ." << endl;
     623    else {
     624      *out << Verbose(0) << "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " ." << endl;
     625      x0 = x2;  // sorted in ascending order
     626    }
     627 
     628    cellvolume = 1;
     629    for(int i=0;i<NDIM;i++) {
     630      BoxLengths.x[i] = repetition[i] * (x0 + GreatestDiameter[i]);
     631      cellvolume *= BoxLengths.x[i];
     632    }
     633 
     634    // set new box dimensions
     635    *out << Verbose(0) << "Translating to box with these boundaries." << endl;
     636    mol->CenterInBox((ofstream *)&cout, &BoxLengths);
     637  }
    629638  // update Box of atoms by boundary
    630639  mol->SetBoxDimension(&BoxLengths);
    631  
     640  *out << 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;
    632641};
    633642
Note: See TracChangeset for help on using the changeset viewer.