Changeset 450d63 for src/boundary.cpp


Ignore:
Timestamp:
Oct 18, 2008, 2:03:57 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:
51695c, 5621c3, 674220, 85d278
Parents:
65de9b
Message:

VolumeOfConvexEnvelope() has new parameter with tecplot ofstream and the file is stored there and not in Tesselation::Tesselation().

+ BUGFIX: As we shift the molecule to the center of gravity for the "projection onto axis planes" method to work, we forgot about shifting it back before storing nodes and triangles in the tecplot file. Now, we store the data to file in VolumeOfConvexEnvelope(), where the molecule has been shifted back already.
+ VolumeOfConvexEnvelope() now gets an additional parameter with the tecplot ofstream, so that the name of the tecplot file may be chosen on the command line (with checks whether the argument was given or not)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r65de9b r450d63  
    456456 * Determines first the convex envelope, then tesselates it and calculates its volume.
    457457 * \param *out output stream for debugging
     458 * \param *tecplot output stream for tecplot data
    458459 * \param *configuration needed for path to store convex envelope file
    459460 * \param *BoundaryPoints NDIM set of boundary points on the projected plane per axis, on return if desired
    460461 * \param *mol molecule structure representing the cluster
     462 * \return determined volume of the cluster in cubed config:GetIsAngstroem()
    461463 */
    462 double VolumeOfConvexEnvelope(ofstream *out, config *configuration, Boundaries *BoundaryPtr, molecule *mol)
     464double VolumeOfConvexEnvelope(ofstream *out, ofstream *tecplot, config *configuration, Boundaries *BoundaryPtr, molecule *mol)
    463465{
    464466  bool IsAngstroem = configuration->GetIsAngstroem();
     
    501503  *out << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
    502504  // now we have the whole set of edge points in the BoundaryList
    503 
    504505
    505506  // listing for debugging
     
    547548    Walker->x.Translate(CenterOfGravity);
    548549  }
     550 
     551  // 8. Store triangles in tecplot file
     552  if (tecplot != NULL) {
     553    *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl;
     554    *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\"" << endl;
     555    *tecplot << "ZONE T=\"TRIANGLES\", N=" <<  TesselStruct->PointsOnBoundaryCount << ", E=" <<  TesselStruct->TrianglesOnBoundaryCount << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
     556    int *LookupList = new int[mol->AtomCount];
     557    for (int i=0;i<mol->AtomCount;i++)
     558      LookupList[i] = -1;
     559   
     560    // print atom coordinates
     561    *out << Verbose(2) << "The following triangles were created:";
     562    int Counter = 1;
     563    atom *Walker = NULL;
     564    for (PointMap::iterator target =  TesselStruct->PointsOnBoundary.begin(); target !=  TesselStruct->PointsOnBoundary.end(); target++) {
     565      Walker = target->second->node;
     566      LookupList[Walker->nr] = Counter++;
     567      *tecplot << Walker->x.x[0] << " " << Walker->x.x[1] << " " << Walker->x.x[2] << " " << endl;
     568    }
     569    *tecplot << endl;
     570      // print connectivity
     571    for (TriangleMap::iterator runner =  TesselStruct->TrianglesOnBoundary.begin(); runner !=  TesselStruct->TrianglesOnBoundary.end(); runner++) {
     572      *out << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;
     573      *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
     574    }
     575    delete[](LookupList);
     576    *out << endl;
     577  }
    549578
    550579  // free reference lists
     
    574603  double clustervolume;
    575604  if (ClusterVolume == 0)
    576     clustervolume = VolumeOfConvexEnvelope(out, configuration, BoundaryPoints, mol);
     605    clustervolume = VolumeOfConvexEnvelope(out, NULL, configuration, BoundaryPoints, mol);
    577606  else
    578607    clustervolume = ClusterVolume;
     
    952981  } while (flag);
    953982 
    954   stringstream line;
    955   line << configuration->configpath << "/" << CONVEXENVELOPE;
    956   *out << Verbose(1) << "Storing convex envelope in tecplot data file " << line.str() << "." << endl;
    957   ofstream output(line.str().c_str());
    958   output << "TITLE = \"3D CONVEX SHELL\"" << endl;
    959   output << "VARIABLES = \"X\" \"Y\" \"Z\"" << endl;
    960   output << "ZONE T=\"TRIANGLES\", N=" << PointsOnBoundaryCount << ", E=" << TrianglesOnBoundaryCount << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
    961   int *LookupList = new int[mol->AtomCount];
    962   for (int i=0;i<mol->AtomCount;i++)
    963     LookupList[i] = -1;
    964  
    965   // print atom coordinates
    966   *out << Verbose(2) << "The following triangles were created:";
    967   int Counter = 1;
    968   atom *Walker = NULL;
    969   for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) {
    970     Walker = target->second->node;
    971     LookupList[Walker->nr] = Counter++;
    972     output << Walker->x.x[0] << " " << Walker->x.x[1] << " " << Walker->x.x[2] << " " << endl;
    973   }
    974   output << endl;
    975     // print connectivity
    976   for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) {
    977     *out << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;
    978     output << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
    979   }
    980   output.close();
    981   delete[](LookupList);
    982   *out << endl;
    983983};
    984984
Note: See TracChangeset for help on using the changeset viewer.