votca 2024.2-dev
Loading...
Searching...
No Matches
votca::csg::TabulatedPotential Class Reference

Tabulated Potential calculates histograms of bead interactions. More...

#include <tabulatedpotential.h>

Inheritance diagram for votca::csg::TabulatedPotential:
Collaboration diagram for votca::csg::TabulatedPotential:

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, IndexgetSmoothIterations () 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.
 

Detailed Description

Tabulated Potential calculates histograms of bead interactions.

There are two histograms that can be created:

  • the first is a potential distribution table specified with the 'tab' keyword (for table). This uses boltzmann inversion to calculate the potential from a selection of bead interactions.
  • the second is a histogram of the beads interactions specified with the 'hist' keyword.

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.

Constructor & Destructor Documentation

◆ TabulatedPotential()

votca::csg::TabulatedPotential::TabulatedPotential ( )

Definition at line 39 of file tabulatedpotential.cc.

◆ ~TabulatedPotential()

votca::csg::TabulatedPotential::~TabulatedPotential ( )
overridedefault

Member Function Documentation

◆ BoltzmannInvert_()

void votca::csg::TabulatedPotential::BoltzmannInvert_ ( std::vector< double > & data)
private

Definition at line 342 of file tabulatedpotential.cc.

◆ CalcForce_()

void votca::csg::TabulatedPotential::CalcForce_ ( std::vector< double > & U,
std::vector< double > & F,
double dx,
bool bPeriodic )
private

Definition at line 294 of file tabulatedpotential.cc.

◆ Command()

void votca::csg::TabulatedPotential::Command ( BondedStatistics & bs,
const std::string & cmd,
std::vector< std::string > & args )
overridevirtual

Implements votca::csg::AnalysisTool.

Definition at line 49 of file tabulatedpotential.cc.

◆ getSmoothIterations()

pair< Index, Index > votca::csg::TabulatedPotential::getSmoothIterations ( ) const

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.

Returns
pair of integers containing the number of smoothing iteratiosn before and after boltzmann inversion.

Definition at line 193 of file tabulatedpotential.cc.

◆ getTemperature()

double votca::csg::TabulatedPotential::getTemperature ( ) const

Returns the temperature used during the bolzmann inversion.

Returns
temperature in kelvin

Definition at line 191 of file tabulatedpotential.cc.

◆ Help()

void votca::csg::TabulatedPotential::Help ( const std::string & cmd,
std::vector< std::string > & args )
overridevirtual

Implements votca::csg::AnalysisTool.

Definition at line 86 of file tabulatedpotential.cc.

◆ Register()

void votca::csg::TabulatedPotential::Register ( std::map< std::string, AnalysisTool * > & lib)
overridevirtual

Implements votca::csg::AnalysisTool.

Definition at line 44 of file tabulatedpotential.cc.

◆ SetOption_() [1/2]

bool votca::csg::TabulatedPotential::SetOption_ ( const std::vector< std::string > & args)
private

◆ SetOption_() [2/2]

bool votca::csg::TabulatedPotential::SetOption_ ( votca::tools::Histogram::options_t & op,
const std::vector< std::string > & args )
private

Definition at line 255 of file tabulatedpotential.cc.

◆ Smooth_()

void votca::csg::TabulatedPotential::Smooth_ ( std::vector< double > & data,
bool bPeriodic )
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.

Parameters
[in,out]datavector of doubles that is smoothed
[in]bPeriodicboolean determining if the smoothing will use periodic boundary conditions

Definition at line 310 of file tabulatedpotential.cc.

◆ WriteHistogram()

void votca::csg::TabulatedPotential::WriteHistogram ( BondedStatistics & bs,
std::vector< std::string > & args )

Definition at line 197 of file tabulatedpotential.cc.

◆ WritePotential()

void votca::csg::TabulatedPotential::WritePotential ( BondedStatistics & bs,
std::vector< std::string > & args )

Definition at line 215 of file tabulatedpotential.cc.

Member Data Documentation

◆ hist_options_

votca::tools::Histogram::options_t votca::csg::TabulatedPotential::hist_options_
private

Definition at line 160 of file tabulatedpotential.h.

◆ tab_options_

votca::tools::Histogram::options_t votca::csg::TabulatedPotential::tab_options_
private

Definition at line 159 of file tabulatedpotential.h.

◆ tab_smooth1_

Index votca::csg::TabulatedPotential::tab_smooth1_
private

How many times the data is smoothed before the histogram is boltzmann inverted.

Definition at line 164 of file tabulatedpotential.h.

◆ tab_smooth2_

Index votca::csg::TabulatedPotential::tab_smooth2_
private

How many times the data is smoothed after the histogram is boltzmann inverted.

Definition at line 167 of file tabulatedpotential.h.

◆ Temperature_

double votca::csg::TabulatedPotential::Temperature_
private

Temperature in units of Kelvin.

Definition at line 169 of file tabulatedpotential.h.


The documentation for this class was generated from the following files: