Changeset 104524 for src/Actions


Ignore:
Timestamp:
Jun 9, 2010, 2:04:54 PM (15 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:
94d131
Parents:
c78d44
git-author:
Frederik Heber <heber@…> (06/09/10 11:21:58)
git-committer:
Frederik Heber <heber@…> (06/09/10 14:04:54)
Message:

Changed PairCorrelationAction to incorporate all three cases and handled different parameters needed for each, changed queryElement to list of elements.

PairCorrelationAction:

queryElement:

Others:

Location:
src/Actions
Files:
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    rc78d44 r104524  
    99#include "CommandLineParser.hpp"
    1010#include "analysis_correlation.hpp"
     11#include "boundary.hpp"
     12#include "linkedcell.hpp"
    1113#include "log.hpp"
    1214#include "element.hpp"
     15#include "molecule.hpp"
    1316#include "periodentafel.hpp"
     17#include "vector.hpp"
    1418#include "World.hpp"
    1519
     
    3539  Dialog *dialog = UIFactory::getInstance().makeDialog();
    3640  int ranges[3] = {1, 1, 1};
     41  double BinEnd = 0.;
    3742  double BinStart = 0.;
    38   double BinEnd = 0.;
     43  double BinWidth = 0.;
     44  molecule *Boundary = NULL;
    3945  string outputname;
    4046  string binoutputname;
     
    4248  ofstream output;
    4349  ofstream binoutput;
    44   const element *elemental1;
    45   const element *elemental2;
     50  std::vector< element *> elements;
     51  string type;
     52  Vector Point;
     53  BinPairMap *binmap = NULL;
     54  MoleculeListClass *molecules = World::getInstance().getMolecules();
    4655
    47   dialog->queryElement("elements", &elemental1, MapOfActions::getInstance().getDescription("elements"));
    48   dialog->queryElement("elements", &elemental2, MapOfActions::getInstance().getDescription("elements"));
     56  // first dialog: Obtain which type of correlation
     57  dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME));
     58  if(dialog->display()) {
     59    delete dialog;
     60  } else {
     61    delete dialog;
     62    return Action::failure;
     63  }
     64
     65  // second dialog: Obtain parameters specific to this type
     66  dialog = UIFactory::getInstance().makeDialog();
     67  if (type == "P")
     68    dialog->queryVector("position", &Point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position"));
     69  if (type == "S")
     70    dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
     71  dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
    4972  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
     73  dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
    5074  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
    5175  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
     
    5781    binoutput.open(binoutputname.c_str());
    5882    PairCorrelationMap *correlationmap = NULL;
    59     if (periodic)
    60       correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2, ranges);
    61     else
    62       correlationmap = PairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2);
    63     //OutputCorrelationToSurface(&output, correlationmap);
    64     BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd );
     83    if (type == "E") {
     84      PairCorrelationMap *correlationmap = NULL;
     85      if (periodic)
     86        correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges);
     87      else
     88        correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements);
     89      //OutputCorrelationToSurface(&output, correlationmap);
     90      binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
     91    } else if (type == "P")  {
     92      cout << "Point to correlate to is  " << Point << endl;
     93      CorrelationToPointMap *correlationmap = NULL;
     94      if (periodic)
     95        correlationmap  = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
     96      else
     97        correlationmap = CorrelationToPoint(molecules, elements, &Point);
     98      //OutputCorrelationToSurface(&output, correlationmap);
     99      binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
     100    } else if (type == "S") {
     101      ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
     102      const double radius = 4.;
     103      double LCWidth = 20.;
     104      if (BinEnd > 0) {
     105        if (BinEnd > 2.*radius)
     106            LCWidth = BinEnd;
     107        else
     108          LCWidth = 2.*radius;
     109      }
     110
     111      // get the boundary
     112      class Tesselation *TesselStruct = NULL;
     113      const LinkedCell *LCList = NULL;
     114      // find biggest molecule
     115      int counter  = molecules->ListOfMolecules.size();
     116      bool *Actives = new bool[counter];
     117      counter = 0;
     118      for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     119        Actives[counter++] = (*BigFinder)->ActiveFlag;
     120        (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
     121      }
     122      LCList = new LinkedCell(Boundary, LCWidth);
     123      FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
     124      CorrelationToSurfaceMap *surfacemap = NULL;
     125      if (periodic)
     126        surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges);
     127      else
     128        surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList);
     129      OutputCorrelationToSurface(&output, surfacemap);
     130      // check whether radius was appropriate
     131      {
     132        double start; double end;
     133        GetMinMax( surfacemap, start, end);
     134        if (LCWidth < end)
     135          DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
     136      }
     137      binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
     138    } else
     139      return Action::failure;
    65140    OutputCorrelation ( &binoutput, binmap );
    66141    output.close();
  • src/Actions/AtomAction/ChangeElementAction.cpp

    rc78d44 r104524  
    3434Action::state_ptr AtomChangeElementAction::performCall() {
    3535  Dialog *dialog = UIFactory::getInstance().makeDialog();
    36   int Z = -1;
    3736  atom *first = NULL;
    38   element *elemental = NULL;
     37  std::vector<element *> elements;
    3938
    40   dialog->queryElement(NAME, (const element **) &elemental, MapOfActions::getInstance().getDescription(NAME));
     39  dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME));
    4140  dialog->queryAtom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id"));
    4241
    4342  if(dialog->display()) {
    4443    delete dialog;
    45     DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elemental << "." << endl);
    46     if (elemental != NULL) {
    47       first->type = elemental;
     44    ASSERT(elements.size() == 1, "Unequal to one element specified when changing an atom's element");
     45    DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elements.at(0) << "." << endl);
     46    if (elements.at(0) != NULL) {
     47      first->type = elements.at(0);
    4848      return Action::success;
    4949    } else
  • src/Actions/Makefile.am

    rc78d44 r104524  
    3636  AnalysisAction/MolecularVolumeAction.cpp \
    3737  AnalysisAction/PairCorrelationAction.cpp \
    38   AnalysisAction/PairCorrelationToPointAction.cpp \
    39   AnalysisAction/PairCorrelationToSurfaceAction.cpp \
    4038  AnalysisAction/PrincipalAxisSystemAction.cpp
    4139ANALYSISACTIONHEADER = \
    4240  AnalysisAction/MolecularVolumeAction.hpp \
    4341  AnalysisAction/PairCorrelationAction.hpp \
    44   AnalysisAction/PairCorrelationToPointAction.hpp \
    45   AnalysisAction/PairCorrelationToSurfaceAction.hpp \
    4642  AnalysisAction/PrincipalAxisSystemAction.hpp
    4743
Note: See TracChangeset for help on using the changeset viewer.