ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
statistics_chain.h
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2010,2012,2013 The ESPResSo project
00003   Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 
00004     Max-Planck-Institute for Polymer Research, Theory Group
00005   
00006   This file is part of ESPResSo.
00007   
00008   ESPResSo is free software: you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation, either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   ESPResSo is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with this program.  If not, see <http://www.gnu.org/licenses/>. 
00020 */
00021 #ifndef STATISTICS_CHAIN_H
00022 #define STATISTICS_CHAIN_H
00023 /** \file statistics_chain.h 
00024 
00025     This file contains the code for statistics on the data using the
00026     molecule information set with analyse set chains.
00027 */
00028 
00029 /** \name Exported Variables */
00030 /************************************************************/
00031 /** Particles' initial positions (needed for g1(t), g2(t), g3(t) in \ref tclcommand_analyze) */
00032 /*@{*/
00033 extern float *partCoord_g;
00034 extern float *partCM_g;
00035 extern int n_part_g;
00036 extern int n_chains_g;
00037 /*@}*/
00038 
00039 /** data for a system consisting of chains. TBRS. */
00040 /*@{*/
00041 extern int chain_start;
00042 extern int chain_n_chains;
00043 extern int chain_length;
00044 /*@}*/
00045 
00046 
00047 /** \name Exported Functions */
00048 /************************************************************/
00049 /*@{*/
00050 
00051 /** calculate the end-to-end-distance. chain information \ref chain_start etc. must be set!
00052     @return the end-to-end-distance */
00053 void calc_re(double **re);
00054 
00055 /** calculate the end-to-end-distance averaged over all configurations stored in \ref #configs. 
00056     Chain information \ref chain_start etc. must be set!
00057     @return the averaged end-to-end-distance */
00058 void calc_re_av(double **re);
00059 
00060 /** calculate the radius of gyration. chain information \ref chain_start etc. must be set!
00061     @return the radius of gyration */
00062 void calc_rg(double **rg);
00063 
00064 /** calculate the radius of gyration averaged over all configurations stored in \ref #configs. 
00065     Chain information \ref chain_start etc. must be set!
00066     @return the averaged radius of gyration */
00067 void calc_rg_av(double **rg);
00068 
00069 /** calculate the hydrodynamic radius (ref. Kirkwood-Zimm theory). chain information \ref chain_start etc. must be set!
00070     @return the hydrodynamic radius */
00071 void calc_rh(double **rh);
00072 
00073 /** calculate the hydrodynamic radius averaged over all configurations stored in \ref #configs. 
00074     Chain information \ref chain_start etc. must be set!
00075     @return the averaged hydrodynamic radius */
00076 void calc_rh_av(double **rh);
00077 
00078 /** calculates the internal distances within a chain. Chain information \ref chain_start etc. must be set!
00079     @param idf contains <tt>idf[0],...,idf[chain_length-1]</tt> */
00080 void calc_internal_dist(double **idf);
00081 
00082 /** calculates the internal distances within a chain averaged over all configurations stored in \ref #configs.
00083     Chain information \ref chain_start etc. must be set!
00084     @param idf contains <tt>idf[0],...,idf[chain_length-1]</tt> */
00085 void calc_internal_dist_av(double **idf);
00086 
00087 /** calculates the bond length between two neighbouring monomers (i.e. idf[1] in \ref calc_internal_dist).
00088     Chain information \ref chain_start etc. must be set!
00089     @param bond_l returns the bond length */
00090 void calc_bond_l(double **bond_l);
00091 
00092 /** calculates the averaged bond length between two neighbouring monomers (i.e. idf[1] in \ref calc_internal_dist_av).
00093     Chain information \ref chain_start etc. must be set!
00094     @param bond_l returns the bond length */
00095 void calc_bond_l_av(double **bond_l);
00096 
00097 /** calculates the internal distances within a chain measured from monomer <ind_n>.
00098     Chain information \ref chain_start etc. must be set!
00099     @param bdf   contains <tt>bdf[0],...,bdf[(chain_length-1) - ind_n]</tt> 
00100     @param ind_n the index of the monomer from where all distances are taken */
00101 void calc_bond_dist(double **bdf, int ind_n);
00102 
00103 /** calculates the internal distances within a chain measured from monomer <ind_n> averaged over all configurations stored in \ref #configs.
00104     Chain information \ref chain_start etc. must be set!
00105     @param bdf contains <tt>bdf[0],...,bdf[(chain_length-1) - ind_n]</tt> 
00106     @param ind_n the index of the monomer from where all distances are taken */
00107 void calc_bond_dist_av(double **bdf, int ind_n);
00108 
00109 /** calculate g123. chain information \ref chain_start etc. must be set!
00110     @param g1 contains g1
00111     @param g2 contains g2
00112     @param g3 contains g3
00113 */
00114 void calc_g123(double *g1, double *g2, double *g3);
00115 
00116 /** calculate <g1> averaged over all configurations stored in \ref #configs. 
00117     Chain information \ref chain_start etc. must be set!
00118     @param _g1     contains <tt>g1[0],...,g1[n_configs-1]</tt>
00119     @param window  if large than 0, the window size for a sliding window analysis
00120     @param weights weights for the different coordinates, basically to allow to calculate 2d g1
00121 */
00122 void calc_g1_av(double **_g1, int window, double weights[3]);
00123 
00124 /** calculate <g2> averaged over all configurations stored in \ref #configs. 
00125     Chain information \ref chain_start etc. must be set!
00126     @param _g2 contains <tt>g2[0],...,g2[n_configs-1]</tt>
00127     @param window  if large than 0, the window size for a sliding window analysis
00128     @param weights weights for the different coordinates, basically to allow to calculate 2d g1
00129 */
00130 void calc_g2_av(double **_g2, int window, double weights[3]);
00131 
00132 /** calculate <g3> averaged over all configurations stored in \ref #configs. 
00133     Chain information \ref chain_start etc. must be set!
00134     @param _g3 contains <tt>g3[0],...,g3[n_configs-1]</tt>
00135     @param window  if large than 0, the window size for a sliding window analysis
00136     @param weights weights for the different coordinates, basically to allow to calculate 2d g1
00137 */
00138 void calc_g3_av(double **_g3, int window, double weights[3]);
00139 //void calc_g3_av(double **g3);
00140 
00141 /** set the start configuration for g123.
00142     chain information \ref chain_start etc. must be set!
00143 */
00144 void init_g123();
00145 
00146 /** Derives the spherically averaged formfactor S(q) = 1/chain_length * Sum(i,j=1..chain_length)[sin(q*r_ij)/q*r_ij] of a single chain,
00147     averaged over all \ref chain_n_chains currently allocated (-> chain information must be set!).
00148     @param qmin  smallest q-vector to look at (qmin > 0)
00149     @param qmax  biggest q-vector to look at (qmax > qmin)
00150     @param qbins decides how many S(q) are derived (note that the qbins+1 values will be logarithmically spaced)
00151     @param _ff   contains S(q) as an array of size qbins */
00152 void analyze_formfactor(double qmin, double qmax, int qbins, double **_ff);
00153 
00154 /** Derives the spherically averaged formfactor S(q) = 1/chain_length * Sum(i,j=1..chain_length)[sin(q*r_ij)/q*r_ij] of a single chain,
00155     averaged over all \ref chain_n_chains of all \ref n_configs stored configurations in \ref #configs.
00156     @param qmin  smallest q-vector to look at (qmin > 0)
00157     @param qmax  biggest q-vector to look at (qmax > qmin)
00158     @param qbins decides how many S(q) are derived (note that the qbins+1 values will be logarithmically spaced)
00159     @param _ff   contains S(q) as an array of size qbins */
00160 void analyze_formfactor_av(double qmin, double qmax, int qbins, double **_ff);
00161 
00162 /** Calculates monomer-monomer distribution between monomers of different chains. 
00163     @param r_min   minimal distance for the distribution.
00164     @param r_max   maximal distance for the distribution.
00165     @param r_bins  the number of bins
00166     @param _rdf    contains the monomer-monomer distribution 
00167     @param _rdf_cm contains the distribution of centers of mass of the chains
00168     @param _rdf_d  contains the distribution of closest distances between the chains
00169     */
00170 void analyze_rdfchain(double r_min, double r_max, int r_bins, double **_rdf, double **_rdf_cm, double **_rdf_d);
00171 
00172 #ifdef ELECTROSTATICS
00173 /** Calculates the (charge weighted) velocity auto-correlation function from the stored configurations.
00174  *  The charge weighted velocity auto-correlation function is used to determine
00175  *  the electrophoretic mobility of a chain using Green-Kubo relation.
00176  * 
00177  *  cwvac(tau) = < sum_i^N ( q_i*v_i(t0)*v_CM(t0+tau) ) >
00178   @param maxtau maximal tau
00179   @param interval step between t0, sampling frequency
00180   @param _avac contains the averaged(=over all chains in the system) velocity auto-correlation
00181   @param _evac contains the error associated with the averaged velocity auto-correlation function
00182   */
00183 void analyze_cwvac(int maxtau, int interval, double **_avac, double **_evac); 
00184 #endif
00185 
00186 /** sets the particle mol_id according to the chain_structure info*/
00187 void update_mol_ids_setchains();
00188 
00189 
00190 #endif