| 1 |
tim |
333 |
/* |
| 2 |
|
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
| 3 |
|
|
* |
| 4 |
|
|
* The University of Notre Dame grants you ("Licensee") a |
| 5 |
|
|
* non-exclusive, royalty free, license to use, modify and |
| 6 |
|
|
* redistribute this software in source and binary code form, provided |
| 7 |
|
|
* that the following conditions are met: |
| 8 |
|
|
* |
| 9 |
gezelter |
1390 |
* 1. Redistributions of source code must retain the above copyright |
| 10 |
tim |
333 |
* notice, this list of conditions and the following disclaimer. |
| 11 |
|
|
* |
| 12 |
gezelter |
1390 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
tim |
333 |
* notice, this list of conditions and the following disclaimer in the |
| 14 |
|
|
* documentation and/or other materials provided with the |
| 15 |
|
|
* distribution. |
| 16 |
|
|
* |
| 17 |
|
|
* This software is provided "AS IS," without a warranty of any |
| 18 |
|
|
* kind. All express or implied conditions, representations and |
| 19 |
|
|
* warranties, including any implied warranty of merchantability, |
| 20 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
| 21 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
| 22 |
|
|
* be liable for any damages suffered by licensee as a result of |
| 23 |
|
|
* using, modifying or distributing the software or its |
| 24 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
| 25 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
| 26 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
| 27 |
|
|
* damages, however caused and regardless of the theory of liability, |
| 28 |
|
|
* arising out of the use of or inability to use software, even if the |
| 29 |
|
|
* University of Notre Dame has been advised of the possibility of |
| 30 |
|
|
* such damages. |
| 31 |
gezelter |
1390 |
* |
| 32 |
|
|
* SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your |
| 33 |
|
|
* research, please cite the appropriate papers when you publish your |
| 34 |
|
|
* work. Good starting points are: |
| 35 |
|
|
* |
| 36 |
|
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
|
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
gezelter |
1665 |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
|
|
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
tim |
333 |
*/ |
| 42 |
|
|
#ifndef APPLICATIONS_DYNAMICPROPS_TIMECORRFUNC_HPP |
| 43 |
|
|
#define APPLICATIONS_DYNAMICPROPS_TIMECORRFUNC_HPP |
| 44 |
|
|
|
| 45 |
|
|
#include <string> |
| 46 |
|
|
#include <vector> |
| 47 |
|
|
|
| 48 |
|
|
#include "brains/SimInfo.hpp" |
| 49 |
|
|
#include "brains/BlockSnapshotManager.hpp" |
| 50 |
|
|
|
| 51 |
|
|
#include "primitives/StuntDouble.hpp" |
| 52 |
|
|
#include "selection/SelectionEvaluator.hpp" |
| 53 |
|
|
#include "selection/SelectionManager.hpp" |
| 54 |
|
|
|
| 55 |
gezelter |
1390 |
namespace OpenMD { |
| 56 |
tim |
333 |
|
| 57 |
gezelter |
507 |
/** |
| 58 |
|
|
* @class TimeCorrFunc TimeCorrFunc.hpp "applications/dynamicProps/TimeCorrFunc" |
| 59 |
|
|
* @brief Base class for Correlation function |
| 60 |
|
|
*/ |
| 61 |
tim |
333 |
|
| 62 |
gezelter |
507 |
class TimeCorrFunc { |
| 63 |
|
|
public: |
| 64 |
|
|
TimeCorrFunc(SimInfo* info, const std::string& filename, |
| 65 |
gezelter |
1629 |
const std::string& sele1, const std::string& sele2, |
| 66 |
|
|
int storageLayout, long long int memSize); |
| 67 |
gezelter |
1686 |
|
| 68 |
|
|
virtual ~TimeCorrFunc(){ } |
| 69 |
gezelter |
507 |
void doCorrelate(); |
| 70 |
tim |
333 |
|
| 71 |
|
|
|
| 72 |
gezelter |
507 |
void setOutputName(const std::string& filename) { |
| 73 |
|
|
outputFilename_ = filename; |
| 74 |
|
|
} |
| 75 |
tim |
333 |
|
| 76 |
gezelter |
507 |
const std::string& getOutputFileName() const { |
| 77 |
|
|
return outputFilename_; |
| 78 |
|
|
} |
| 79 |
tim |
333 |
|
| 80 |
|
|
|
| 81 |
gezelter |
507 |
const std::string& getCorrFuncType() const { |
| 82 |
|
|
return corrFuncType_; |
| 83 |
|
|
} |
| 84 |
tim |
333 |
|
| 85 |
gezelter |
507 |
void setCorrFuncType(const std::string& type) { |
| 86 |
|
|
corrFuncType_ = type; |
| 87 |
|
|
} |
| 88 |
tim |
333 |
|
| 89 |
gezelter |
507 |
void setExtraInfo(const std::string& extra) { |
| 90 |
|
|
extra_ = extra; |
| 91 |
|
|
} |
| 92 |
tim |
333 |
|
| 93 |
gezelter |
507 |
protected: |
| 94 |
tim |
333 |
|
| 95 |
gezelter |
507 |
virtual void preCorrelate(); |
| 96 |
|
|
virtual void postCorrelate(); |
| 97 |
|
|
virtual void updateFrame(int frame); |
| 98 |
tim |
333 |
|
| 99 |
tim |
963 |
RealType deltaTime_; |
| 100 |
gezelter |
507 |
int nTimeBins_; |
| 101 |
tim |
963 |
std::vector<RealType> histogram_; |
| 102 |
gezelter |
507 |
std::vector<int> count_; |
| 103 |
gezelter |
1629 |
std::vector<RealType> time_; |
| 104 |
tim |
333 |
|
| 105 |
gezelter |
507 |
SimInfo* info_; |
| 106 |
|
|
int storageLayout_; |
| 107 |
gezelter |
1629 |
long long int memSize_; |
| 108 |
gezelter |
507 |
std::string dumpFilename_; |
| 109 |
|
|
SelectionManager seleMan1_; |
| 110 |
|
|
SelectionManager seleMan2_; |
| 111 |
tim |
333 |
|
| 112 |
gezelter |
507 |
BlockSnapshotManager* bsMan_; |
| 113 |
tim |
333 |
|
| 114 |
gezelter |
507 |
private: |
| 115 |
tim |
333 |
|
| 116 |
gezelter |
507 |
void correlateBlocks(int block1, int block2); |
| 117 |
|
|
virtual void correlateFrames(int frame1, int frame2) = 0; |
| 118 |
tim |
333 |
|
| 119 |
gezelter |
507 |
virtual void writeCorrelate(); |
| 120 |
tim |
333 |
|
| 121 |
gezelter |
507 |
virtual void validateSelection(const SelectionManager& seleMan) {} |
| 122 |
tim |
333 |
|
| 123 |
|
|
|
| 124 |
gezelter |
507 |
std::string selectionScript1_; |
| 125 |
|
|
std::string selectionScript2_; |
| 126 |
tim |
333 |
|
| 127 |
gezelter |
507 |
SelectionEvaluator evaluator1_; |
| 128 |
|
|
SelectionEvaluator evaluator2_; |
| 129 |
tim |
333 |
|
| 130 |
|
|
|
| 131 |
gezelter |
507 |
std::string outputFilename_; |
| 132 |
tim |
333 |
|
| 133 |
gezelter |
507 |
std::string corrFuncType_; |
| 134 |
|
|
std::string extra_; |
| 135 |
|
|
}; |
| 136 |
tim |
333 |
|
| 137 |
|
|
} |
| 138 |
|
|
#endif |