Changeset 71b20e for src/boundary.cpp


Ignore:
Timestamp:
Dec 19, 2009, 7:32:24 PM (16 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, 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:
c15ca2
Parents:
3930eb
Message:

Attempt to fix the embedding.

Basically it would be working, but there was some failures with the FindClosestTriangleToPoint() routines.
We get triangles wrong if we start looking for the closest point. Actually, we should really look at each
triangle and check the distance. Now, we look at least at each line, but code is unfinished and crashes at the end
unexplainedly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r3930eb r71b20e  
    654654 * \param *out output stream for debugging
    655655 * \param *mol molecule with atoms and bonds
    656  * \param *&TesselStruct Tesselation with boundary triangles
     656 * \param *TesselStruct Tesselation with boundary triangles
    657657 * \param *filename prefix of filename
    658658 * \param *extraSuffix intermediate suffix
    659659 */
    660 void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix)
     660void StoreTrianglesinFile(const molecule * const mol, const Tesselation * const TesselStruct, const char *filename, const char *extraSuffix)
    661661{
    662662        Info FunctionInfo(__func__);
     
    789789 * \param configuration contains box dimensions
    790790 * \param distance[NDIM] distance between filling molecules in each direction
     791 * \param epsilon distance to surface which is not filled
    791792 * \param RandAtomDisplacement maximum distance for random displacement per atom
    792793 * \param RandMolDisplacement maximum distance for random displacement per filler molecule
     
    794795 * \return *mol pointer to new molecule with filled atoms
    795796 */
    796 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation)
     797molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double distance[NDIM], const double epsilon, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation)
    797798{
    798799        Info FunctionInfo(__func__);
     
    817818  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
    818819    Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl;
    819     LCList[i] = new LinkedCell((*ListRunner), 5.); // get linked cell list
    820     if (TesselStruct[i] == NULL) {
    821       Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl;
    822       FindNonConvexBorder((*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL);
    823     }
     820    LCList[i] = new LinkedCell((*ListRunner), 10.); // get linked cell list
     821    Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl;
     822    TesselStruct[i] = NULL;
     823    FindNonConvexBorder((*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL);
    824824    i++;
    825825  }
     
    835835  FillerDistance.Init(distance[0], distance[1], distance[2]);
    836836  FillerDistance.InverseMatrixMultiplication(M);
    837   Log() << Verbose(1) << "INFO: Grid steps are ";
    838   for(int i=0;i<NDIM;i++) {
     837  for(int i=0;i<NDIM;i++)
    839838    N[i] = (int) ceil(1./FillerDistance.x[i]);
    840     Log() << Verbose(1) << N[i];
    841     if (i != NDIM-1)
    842       Log() << Verbose(1)<< ", ";
    843     else
    844       Log() << Verbose(1) << "." << endl;
    845   }
     839  Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl;
    846840
    847841  // go over [0,1]^3 filler grid
     
    862856            FillIt = false;
    863857          } else {
    864             FillIt = FillIt && (!TesselStruct[i]->IsInnerPoint(CurrentPosition, LCList[i]));
     858            const bool FillResult = (!TesselStruct[i]->IsInnerPoint(CurrentPosition, LCList[i], epsilon));
     859            FillIt = FillIt && FillResult;
     860            if (FillResult) {
     861              Log() << Verbose(1) << "INFO: Position at " << CurrentPosition << " is outer point." << endl;
     862            } else {
     863              Log() << Verbose(1) << "INFO: Position at " << CurrentPosition << " is inner point." << endl;
     864            }
    865865            i++;
    866866          }
    867867        }
    868868
    869         if (FillIt) {
     869        if (!FillIt) {
    870870          // fill in Filler
    871871          Log() << Verbose(2) << "Space at " << CurrentPosition << " is unoccupied by any molecule, filling in." << endl;
     
    931931      }
    932932  Free(&M);
     933
     934  // output to file
     935  TesselStruct[0]->LastTriangle = NULL;
     936  StoreTrianglesinFile(Filling, TesselStruct[0], "Tesselated", ".dat");
     937
    933938  for (size_t i=0;i<List->ListOfMolecules.size();i++) {
    934939        delete(LCList[i]);
Note: See TracChangeset for help on using the changeset viewer.