votca 2024.2-dev
|
Tabulated Potential calculates histograms of bead interactions. More...
#include <tabulatedpotential.h>
Public Member Functions | |
TabulatedPotential () | |
~TabulatedPotential () override=default | |
void | Register (std::map< std::string, AnalysisTool * > &lib) override |
void | Command (BondedStatistics &bs, const std::string &cmd, std::vector< std::string > &args) override |
void | Help (const std::string &cmd, std::vector< std::string > &args) override |
void | WriteHistogram (BondedStatistics &bs, std::vector< std::string > &args) |
void | WritePotential (BondedStatistics &bs, std::vector< std::string > &args) |
double | getTemperature () const |
Returns the temperature used during the bolzmann inversion. | |
std::pair< Index, Index > | getSmoothIterations () const |
Method returns the number of smoothing iterations used on the data. | |
Public Member Functions inherited from votca::csg::AnalysisTool | |
AnalysisTool ()=default | |
virtual | ~AnalysisTool ()=default |
Private Member Functions | |
bool | SetOption_ (votca::tools::Histogram::options_t &op, const std::vector< std::string > &args) |
bool | SetOption_ (const std::vector< std::string > &args) |
void | Smooth_ (std::vector< double > &data, bool bPeriodic) |
Smooths a vector of doubles. | |
void | BoltzmannInvert_ (std::vector< double > &data) |
void | CalcForce_ (std::vector< double > &U, std::vector< double > &F, double dx, bool bPeriodic) |
Private Attributes | |
votca::tools::Histogram::options_t | tab_options_ |
votca::tools::Histogram::options_t | hist_options_ |
Index | tab_smooth1_ |
Index | tab_smooth2_ |
double | Temperature_ |
Temperature in units of Kelvin. | |
Tabulated Potential calculates histograms of bead interactions.
There are two histograms that can be created:
As an example let us assume we already have a BondedStatistics object named 'bonded_statistics' with the correct data. We can write a histogram of the interactions using the following commands:
TabulatedPotential tabulated_potential; map<string,AnalysisTool *> commands; tabulated_potential.Register(commands); vector<string> arguments{"set","n","11"}; tabulated_potential.Command(bonded_statistics,"hist",arguments); vector<string> interactions{"file1.txt","bond1","bond2","bond3",...}; tabulated_potential.Command(bonded_statistics,"hist",interactions);
The above example creates the object it then proceeds to set one of the properties of the histogram. In this case the number of data points is specified with the keyword 'n', the 11 indicates we want the histogram to consist of 11 bins. To actually create the histogram the Command method is called a second time but because the 'set' keyword is not the first element in the vector of strings the tabulated potential object assumes it is a file name were the histogram will be written. The following labels ("bond1", "bond2", etc...) specify the interactions to be sorted into the histogram. Running this code should produce a file named file1.txt containing two columns.
column1 = the bin edge, column2 = the contents of the histogram
If the table potential is printed instead of the historgram of interactions than 3 columns are printed e.g. in the example below:
TabulatedPotential tabulated_potential; map<string,AnalysisTool *> commands; tabulated_potential.Register(commands); vector<string> arguments{"set","T","275"}; vector<string> arguments2{"set","smooth_pot","1"}; vector<string> arguments3{"set","periodic","1"}; tabulated_potential.Command(bonded_statistics,"tab",arguments); tabulated_potential.Command(bonded_statistics,"tab",arguments1); tabulated_potential.Command(bonded_statistics,"tab",arguments2); vector<string> interactions{"file2.txt","bond1","bond2","bond3",...}; tabulated_potential.Command(bonded_statistics,"tab",interactions);
Here, notice we are using the 'tab' keyword to indicate it is for the tabulated potential. We are also setting several properities. The temperature is changed from the default 300 Kelvin to 275 Kelvin. Smooth potential is set to 1 this has the affect of smoothing the potential after boltzmann inversion is done. If a value greater than 1 were used it would smooth the data several times upto the number specified. And the final setting was to make the tabulated potential periodic. The value "1" is converted to a boolean which is interpreted as true.
Finally, the data is printed to a file called "file2.txt" which contains three columns:
column1 = the bin edge, column2 = potential, column3 = the force
Definition at line 102 of file tabulatedpotential.h.
votca::csg::TabulatedPotential::TabulatedPotential | ( | ) |
Definition at line 39 of file tabulatedpotential.cc.
|
overridedefault |
|
private |
Definition at line 342 of file tabulatedpotential.cc.
|
private |
Definition at line 294 of file tabulatedpotential.cc.
|
overridevirtual |
Implements votca::csg::AnalysisTool.
Definition at line 49 of file tabulatedpotential.cc.
Method returns the number of smoothing iterations used on the data.
The first integer is the number of smoothing iterations before boltzmann inversion is done, and the second interger is the number of iterations done on the boltzmann inverted histogram.
Definition at line 193 of file tabulatedpotential.cc.
double votca::csg::TabulatedPotential::getTemperature | ( | ) | const |
Returns the temperature used during the bolzmann inversion.
Definition at line 191 of file tabulatedpotential.cc.
|
overridevirtual |
Implements votca::csg::AnalysisTool.
Definition at line 86 of file tabulatedpotential.cc.
|
overridevirtual |
Implements votca::csg::AnalysisTool.
Definition at line 44 of file tabulatedpotential.cc.
|
private |
|
private |
Definition at line 255 of file tabulatedpotential.cc.
|
private |
Smooths a vector of doubles.
This function uses a weighted smoothing algorithm using 5 data points, the weights are applied as 1:2:3:2:1 where the middle point becomes the average of these weighted values.
[in,out] | data | vector of doubles that is smoothed |
[in] | bPeriodic | boolean determining if the smoothing will use periodic boundary conditions |
Definition at line 310 of file tabulatedpotential.cc.
void votca::csg::TabulatedPotential::WriteHistogram | ( | BondedStatistics & | bs, |
std::vector< std::string > & | args ) |
Definition at line 197 of file tabulatedpotential.cc.
void votca::csg::TabulatedPotential::WritePotential | ( | BondedStatistics & | bs, |
std::vector< std::string > & | args ) |
Definition at line 215 of file tabulatedpotential.cc.
|
private |
Definition at line 160 of file tabulatedpotential.h.
|
private |
Definition at line 159 of file tabulatedpotential.h.
|
private |
How many times the data is smoothed before the histogram is boltzmann inverted.
Definition at line 164 of file tabulatedpotential.h.
|
private |
How many times the data is smoothed after the histogram is boltzmann inverted.
Definition at line 167 of file tabulatedpotential.h.
|
private |
Temperature in units of Kelvin.
Definition at line 169 of file tabulatedpotential.h.