Changeset d9e1d1


Ignore:
Timestamp:
Apr 23, 2021, 8:34:11 PM (5 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
ef0f8f
Parents:
addb51
git-author:
Frederik Heber <frederik.heber@…> (10/03/20 21:20:26)
git-committer:
Frederik Heber <frederik.heber@…> (04/23/21 20:34:11)
Message:

Extending PairCorrelation to correlate element and set of atoms.

  • one may also correlate an element with a selected set of atoms.
  • TEST: Added regression test case.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • doc/userguide/userguide.xml

    raddb51 rd9e1d1  
    17431743          of a hydrogen and an oxygen atom can be found within its distance
    17441744          interval. These data files can be used for plotting the distribution right away in order to check on the correlation between the elements.</para>
     1745          <para>The action may also be called with just a single element in the
     1746          option <emphasis>elements</emphasis>. This will then trigger a pair
     1747          correlation between all atoms of this element and the set of
     1748          currently selected atoms.</para>
    17451749        </section>
    17461750        <section xml:id="analysis.dipole-correlation">
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    raddb51 rd9e1d1  
    6868  binoutput.open(params.binoutputname.get().string().c_str());
    6969  PairCorrelationMap *correlationmap = NULL;
    70   ASSERT(params.elements.get().size() == 2,
    71       "AnalysisPairCorrelationAction::performCall() - Exactly two elements are required for pair correlation.");
    72   std::vector<const element *>::const_iterator elemiter = params.elements.get().begin();
    73   const World::ConstAtomComposite atoms_first =
    74       const_cast<const World &>(World::getInstance()).getAllAtoms(AtomByType(*(elemiter++)));
    75   const World::ConstAtomComposite atoms_second =
    76       const_cast<const World &>(World::getInstance()).getAllAtoms(AtomByType(*(elemiter++)));
    77   ASSERT(elemiter == params.elements.get().end(),
    78       "AnalysisPairCorrelationAction::performCall() - Exactly two elements are required for pair correlation.");
     70  World::ConstAtomComposite atoms_first;
     71  World::ConstAtomComposite atoms_second;
     72  if (params.elements.get().size() == 2) {
     73    std::vector<const element *>::const_iterator elemiter = params.elements.get().begin();
     74    atoms_first = World::getConstInstance().getAllAtoms(AtomByType(*(elemiter++)));
     75    if (elemiter != params.elements.get().end()) {
     76      atoms_second = World::getConstInstance().getAllAtoms(AtomByType(*(elemiter++)));
     77    } else {
     78      atoms_second = World::getConstInstance().getSelectedAtoms();
     79    }
     80  } else if (params.elements.get().size() == 1) {
     81    std::vector<const element *>::const_iterator elemiter = params.elements.get().begin();
     82    atoms_first = World::getConstInstance().getSelectedAtoms();
     83    atoms_second = World::getConstInstance().getAllAtoms(AtomByType(*(elemiter++)));
     84  } else {
     85    STATUS("Either one or two elements must be given.");
     86    return Action::failure;
     87  }
    7988  double max_distance = params.BinEnd.get();
    8089  if (params.BinEnd.get() <= 0.) {
  • src/Actions/AnalysisAction/PairCorrelationAction.def

    raddb51 rd9e1d1  
    2929#define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(0.5))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(false))
    3030#define paramvalids \
    31 (STLVectorValidator< std::vector<const element *> >(2,2, ElementValidator())) \
     31(STLVectorValidator< std::vector<const element *> >(1,2, ElementValidator())) \
    3232(BoxLengthValidator()) \
    3333(BoxLengthValidator()) \
     
    4545
    4646// finally the information stored in the ActionTrait specialization
    47 #define DESCRIPTION "pair correlation analysis between two elements"
     47#define DESCRIPTION "pair correlation analysis between all atoms of two given elements, or between the selected atoms and the atoms of the single given element"
    4848#define SHORTFORM "C"
  • tests/regression/Analysis/PairCorrelation/testsuite-analysis-pair-correlation.at

    raddb51 rd9e1d1  
    3535AT_CLEANUP
    3636
     37
     38AT_SETUP([Analysis - pair correlation against element])
     39AT_KEYWORDS([analysis correlation pair-correlation element])
     40
     41# here, we correlate all atoms against all of a single element
     42AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Analysis/PairCorrelation/pre/test.conf .], 0)
     43AT_CHECK([../../molecuilder -i test.conf  -v 3 --set-boundary-conditions Wrap Wrap Wrap --pair-correlation --elements 8 --output-file output.csv --bin-output-file bin_output.csv --bin-start 0 --bin-end 20], 0, [stdout], [stderr])
     44AT_CHECK([fgrep "Begin of PairCorrelation" stdout], 0, [ignore], [ignore])
     45#AT_CHECK([file=output.csv; diff $file ${abs_top_srcdir}/tests/regression/Analysis/PairCorrelation/post/output.csv], 0, [ignore], [ignore])
     46AT_CHECK([file=bin_output.csv; diff $file ${abs_top_srcdir}/tests/regression/Analysis/PairCorrelation/post/bin_output.csv], 0, [ignore], [ignore])
     47sum=0;
     48for num in `tail -n 41 bin_output.csv | awk -F" " {'print $4'}`; do
     49        let sum=$sum+$num;
     50done;
     51# 31 oxygens on 62 hydrogens yields 1922 values
     52AT_CHECK([test $sum -eq 1922], 0, [ignore], [ignore])
     53
     54AT_CLEANUP
     55
     56
Note: See TracChangeset for help on using the changeset viewer.