clustering  0.12
Clustering suite for molecular dynamics trajectories.
 All Classes Namespaces Files Functions Variables Typedefs
Typedefs | Functions
Clustering::Tools Namespace Reference

additional tools used throughout the clustering package More...

Typedefs

using Neighbor = std::pair< std::size_t, float >
 matches neighbor's frame id to distance
 
using Neighborhood = std::map< std::size_t, Clustering::Tools::Neighbor >
 map frame id to neighbors
 

Functions

void write_fes (std::string fname, std::vector< float > fes)
 write free energies as column into given file
 
void write_pops (std::string fname, std::vector< std::size_t > pops)
 write populations as column into given file
 
std::vector< std::size_t > read_clustered_trajectory (std::string filename)
 read states from trajectory (given as plain text file)
 
void write_clustered_trajectory (std::string filename, std::vector< std::size_t > traj)
 write state trajectory into plain text file
 
std::string stringprintf (const std::string &str,...)
 printf-version for std::string More...
 
std::vector< float > read_free_energies (std::string filename)
 read free energies from plain text file
 
std::pair< Neighborhood,
Neighborhood
read_neighborhood (const std::string fname)
 
void write_neighborhood (const std::string fname, const Neighborhood &nh, const Neighborhood &nh_high_dens)
 
std::map< std::size_t,
std::size_t > 
microstate_populations (std::vector< std::size_t > traj)
 compute microstate populations from clustered trajectory
 
template<typename NUM >
std::vector< NUM > read_single_column (std::string filename)
 read single column of numbers from given file. number type (int, float, ...) given as template parameter
 
template<typename NUM >
void write_single_column (std::string filename, std::vector< NUM > dat, bool with_scientific_format=false)
 write single column of numbers to given file. number type (int, float, ...) given as template parameter
 
template<typename KEY , typename VAL >
void write_map (std::string filename, std::map< KEY, VAL > mapping)
 write key-value map to plain text file with key as first and value as second column
 
template<typename NUM >
std::tuple< NUM *, std::size_t,
std::size_t > 
read_coords (std::string filename, std::vector< std::size_t > usecols=std::vector< std::size_t >())
 
template<typename NUM >
void free_coords (NUM *coords)
 free memory pointing to coordinates
 
template<typename NUM >
NUM string_to_num (const std::string &s)
 convert std::string to number of given template format
 

Detailed Description

additional tools used throughout the clustering package

Function Documentation

template<typename NUM >
std::tuple< NUM *, std::size_t, std::size_t > Clustering::Tools::read_coords ( std::string  filename,
std::vector< std::size_t >  usecols = std::vector<std::size_t>() 
)

read coordinates from space-separated ASCII file. will write data with precision of NUM-type into memory. format: [row * n_cols + col] return value: tuple of {data (unique_ptr<NUM> with custom deleter), n_rows (size_t), n_cols (size_t)}.

Definition at line 39 of file tools.hxx.

std::pair< Neighborhood, Neighborhood > Clustering::Tools::read_neighborhood ( const std::string  fname)

read neighborhood info from plain text file (two different neighborhoods: nearest neighbor (NN) and NN with higher density)

Definition at line 116 of file tools.cpp.

std::string Clustering::Tools::stringprintf ( const std::string &  str,
  ... 
)

printf-version for std::string

behaves like sprintf(char*, ...), but with c++ strings and returns the result

Parameters
strpattern to be printed to
Returns
resulting string The function internally calls sprintf, but converts the result to a c++ string and returns that one. Problems of memory allocation are taken care of automatically.

Definition at line 95 of file tools.cpp.

void Clustering::Tools::write_neighborhood ( const std::string  fname,
const Neighborhood &  nh,
const Neighborhood &  nh_high_dens 
)

write neighborhood info to plain text file (two different neighborhoods: nearest neighbor (NN) and NN with higher density)

Definition at line 145 of file tools.cpp.