ESPResSo 3.2.0-64-g5125f6e-git
Extensible Simulation Package for Soft Matter Research
interaction_data.h
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2010,2011,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 _INTERACTION_DATA_H
00022 #define _INTERACTION_DATA_H
00023 /** \file interaction_data.h
00024     Various procedures concerning interactions between particles.
00025 */
00026 
00027 #include "utils.h"
00028 #include "particle_data.h" /* needed for constraints */
00029 
00030 /** \name Type codes of bonded interactions
00031     Enumeration of implemented bonded interactions.
00032 */
00033 /************************************************************/
00034 /*@{*/
00035 
00036 /** This bonded interaction was not set. */
00037 #define BONDED_IA_NONE     -1
00038 /** Type of bonded interaction is a FENE potential 
00039     (to be combined with Lennard Jones). */
00040 #define BONDED_IA_FENE      0
00041 /** Type of bonded interaction is a HARMONIC potential. */
00042 #define BONDED_IA_HARMONIC  1
00043 /** Type of bonded interaction is a bond angle potential. */
00044 #define BONDED_IA_ANGLE_OLD     2
00045 /** Type of bonded interaction is a dihedral potential. */
00046 #define BONDED_IA_DIHEDRAL  3
00047 /** Type of tabulated bonded interaction potential, 
00048     may be of bond length, of bond angle or of dihedral type. */
00049 #define BONDED_IA_TABULATED 4
00050 /** Type of bonded interaction is a (-LJ) potential. */
00051 #define BONDED_IA_SUBT_LJ   5
00052 /** Type of a Rigid/Constrained bond*/
00053 #define BONDED_IA_RIGID_BOND  6
00054 /** Type of a virtual bond*/
00055 #define BONDED_IA_VIRTUAL_BOND  7
00056 /** Type of bonded interaction is a bond angle -- constraint distance potential. */
00057 #define BONDED_IA_ANGLEDIST     8
00058 /** Type of bonded interaction is a bond angle -- chain ends have angle with wall constraint */
00059 #define BONDED_IA_ENDANGLEDIST    9
00060 /** Type of overlapped bonded interaction potential, 
00061     may be of bond length, of bond angle or of dihedral type. */
00062 #define BONDED_IA_OVERLAPPED 10
00063 /** Type of bonded interaction is a bond angle cosine potential. */ 
00064 #define BONDED_IA_ANGLE_HARMONIC 11
00065 /** Type of bonded interaction is a bond angle cosine potential. */ 
00066 #define BONDED_IA_ANGLE_COSINE 12
00067 /** Type of bonded interaction is a bond angle cosine potential. */ 
00068 #define BONDED_IA_ANGLE_COSSQUARE 13
00069 /** Type of bonded interaction is a stretching force. */
00070 #define BONDED_IA_STRETCHING_FORCE 14
00071 /** Type of bonded interaction is a local area force. */
00072 #define BONDED_IA_AREA_FORCE_LOCAL 15 
00073 /** Type of bonded interaction is a bending force. */
00074 #define BONDED_IA_BENDING_FORCE 16 
00075 /** Type of bonded interaction is a bending force. */
00076 #define BONDED_IA_VOLUME_FORCE 17 
00077 /** Type of bonded interaction is a global area force. */
00078 #define BONDED_IA_AREA_FORCE_GLOBAL 18 
00079 
00080 /** Specify tabulated bonded interactions  */
00081 #define TAB_UNKNOWN          0
00082 #define TAB_BOND_LENGTH      1
00083 #define TAB_BOND_ANGLE       2
00084 #define TAB_BOND_DIHEDRAL    3
00085 
00086 /** Specify overlapped bonded interactions  */
00087 #define OVERLAP_UNKNOWN          0
00088 #define OVERLAP_BOND_LENGTH      1
00089 #define OVERLAP_BOND_ANGLE       2
00090 #define OVERLAP_BOND_DIHEDRAL    3
00091 
00092 /** cutoff for deactivated interactions. Below 0, so that even particles on
00093     top of each other don't interact by chance. */
00094 #define INACTIVE_CUTOFF -1.0
00095 
00096 /*@}*/
00097 
00098 /** \name Type codes for the type of Coulomb interaction
00099     Enumeration of implemented methods for the electrostatic
00100     interaction.
00101 */
00102 /************************************************************/
00103 /*@{*/
00104 
00105 #ifdef ELECTROSTATICS
00106   /** Coulomb interation switched off (NONE). */
00107   #define COULOMB_NONE    0
00108   /** Coulomb method is Debye-Hueckel. */
00109   #define COULOMB_DH      1
00110   /** Coulomb method is Debye-Hueckel with parallel separate calculation. */
00111   #define COULOMB_DH_PW   2
00112   /** Coulomb method is P3M. */
00113   #define COULOMB_P3M     3
00114   /** Coulomb method is one-dimensional MMM */
00115   #define COULOMB_MMM1D   4
00116  /** Coulomb method is two-dimensional MMM */
00117   #define COULOMB_MMM2D   5
00118   /** Coulomb method is "Maggs" */
00119   #define COULOMB_MAGGS   6
00120   /** Coulomb method is P3M plus ELC. */
00121   #define COULOMB_ELC_P3M 8
00122   /** Coulomb method is Reaction-Field. */
00123   #define COULOMB_RF 9
00124   /** Coulomb method is Reaction-Field BUT as interactions */
00125   #define COULOMB_INTER_RF 10
00126   /** Coulomb method is P3M with GPU based long range part calculation */
00127   #define COULOMB_P3M_GPU 11
00128 #endif
00129 /*@}*/
00130 
00131 
00132 #ifdef  DIPOLES
00133   /** \name Type codes for the type of dipolar interaction
00134     Enumeration of implemented methods for the magnetostatic
00135     interaction.
00136    */
00137   /************************************************************/
00138   /*@{*/
00139 
00140   /** dipolar interation switched off (NONE). */
00141    #define DIPOLAR_NONE       0
00142    /** dipolar method is P3M. */
00143    #define DIPOLAR_P3M        1
00144    /** Dipolar method is P3M plus DLC. */
00145    #define DIPOLAR_MDLC_P3M    2
00146    /** Dipolar method is all with all and no replicas */
00147    #define DIPOLAR_ALL_WITH_ALL_AND_NO_REPLICA  3
00148    /** Dipolar method is magnetic dipolar direct sum */
00149    #define DIPOLAR_DS  4
00150    /** Dipolar method is direct sum plus DLC. */
00151    #define DIPOLAR_MDLC_DS  5
00152 
00153    /*@}*/
00154 #endif 
00155 
00156 
00157 
00158 /** \name Type codes for constraints
00159     Enumeration of implemented constraint types.
00160 */
00161 /************************************************************/
00162 /*@{*/
00163 
00164 /** No constraint applied */
00165 #define CONSTRAINT_NONE 0
00166 /** wall constraint applied */
00167 #define CONSTRAINT_WAL 1
00168 /** spherical constraint applied */
00169 #define CONSTRAINT_SPH 2
00170 /** (finite) cylinder shaped constraint applied */
00171 #define CONSTRAINT_CYL 3
00172 /** Rod-like charge. */
00173 #define CONSTRAINT_ROD 4
00174 /** Plate-like charge. */
00175 #define CONSTRAINT_PLATE 5
00176 /** maze-like constraint applied */
00177 #define CONSTRAINT_MAZE 6
00178 /** pore constraint applied */
00179 #define CONSTRAINT_PORE 7
00180 //ER
00181 /** External magnetic field constraint applied */
00182 #define CONSTRAINT_EXT_MAGN_FIELD 8
00183 //end ER
00184 /** Constraint for tunable-lsip boundary conditions */
00185 #define CONSTRAINT_PLANE 9
00186 /** Constraint for tunable-lsip boundary conditions */
00187 #define CONSTRAINT_RHOMBOID 10
00188 /*@}*/
00189 
00190 /* Data Types */
00191 /************************************************************/
00192 
00193 /** field containing the interaction parameters for
00194  *  nonbonded interactions. Access via
00195  * get_ia_param(i, j), i,j < n_particle_types */
00196 typedef struct {
00197 
00198   /** flag that tells whether there is any short-ranged interaction,
00199    i.e. one that contributes to the "nonbonded" section of the
00200    energy/pressure. Note that even if there is no short-ranged
00201    interaction present, the \ref max_cut can be non-zero due to
00202    e.g. electrostatics. */
00203   int particlesInteract;
00204 
00205   /** maximal cutoff for this pair of particle types. This contains
00206       contributions from the short-ranged interactions, plus any
00207       cutoffs from global interactions like electrostatics.
00208   */
00209   double max_cut;
00210 
00211 #ifdef LENNARD_JONES
00212   /** \name Lennard-Jones with shift */
00213   /*@{*/
00214   double LJ_eps;
00215   double LJ_sig;
00216   double LJ_cut;
00217   double LJ_shift;
00218   double LJ_offset;
00219   double LJ_capradius;
00220   double LJ_min;
00221   /*@}*/
00222 #endif
00223 
00224 #ifdef LENNARD_JONES_GENERIC
00225   /** \name Generic Lennard-Jones with shift */
00226   /*@{*/
00227   double LJGEN_eps;
00228   double LJGEN_sig;
00229   double LJGEN_cut;
00230   double LJGEN_shift;
00231   double LJGEN_offset;
00232   double LJGEN_capradius;
00233   int LJGEN_a1;
00234   int LJGEN_a2;
00235   double LJGEN_b1;
00236   double LJGEN_b2;
00237   /*@}*/
00238 #endif
00239 
00240 #ifdef LJ_ANGLE
00241   /** \name Directional Lennard-Jones */
00242   /*@{*/
00243   double LJANGLE_eps;
00244   double LJANGLE_sig;
00245   double LJANGLE_cut;
00246   /* Locate bonded partners */
00247   int LJANGLE_bonded1type; 
00248   int LJANGLE_bonded1pos;
00249   int LJANGLE_bonded1neg;
00250   int LJANGLE_bonded2pos;
00251   int LJANGLE_bonded2neg;
00252   /* Cap */
00253   double LJANGLE_capradius;
00254   /* Optional 2nd environment */
00255   double LJANGLE_z0;
00256   double LJANGLE_dz;
00257   double LJANGLE_kappa;
00258   double LJANGLE_epsprime;
00259   /*@}*/
00260 #endif
00261 
00262 #ifdef SMOOTH_STEP
00263   /** \name smooth step potential */
00264   /*@{*/
00265   double SmSt_eps;
00266   double SmSt_sig;
00267   double SmSt_cut;
00268   double SmSt_d;
00269   int    SmSt_n;
00270   double SmSt_k0;
00271   /*@}*/
00272 #endif
00273 
00274 #ifdef HERTZIAN
00275   /** \name Hertzian potential */
00276   /*@{*/
00277   double Hertzian_eps;
00278   double Hertzian_sig;
00279   /*@}*/
00280 #endif
00281 
00282 #ifdef GAUSSIAN
00283   /** \name Gaussian potential */
00284   /*@{*/
00285   double Gaussian_eps;
00286   double Gaussian_sig;
00287   double Gaussian_cut;
00288   /*@}*/
00289 #endif
00290 
00291 #ifdef BMHTF_NACL
00292   /** \name BMHTF NaCl potential */
00293   /*@{*/
00294   double BMHTF_A;
00295   double BMHTF_B;
00296   double BMHTF_C;
00297   double BMHTF_D;
00298   double BMHTF_sig;
00299   double BMHTF_cut;
00300   double BMHTF_computed_shift;
00301   /*@}*/
00302 #endif
00303 
00304 #ifdef MORSE 
00305   /** \name Morse potential */
00306   /*@{*/
00307   double MORSE_eps;
00308   double MORSE_alpha;
00309   double MORSE_rmin;
00310   double MORSE_cut;
00311   double MORSE_rest;
00312   double MORSE_capradius;
00313   /*@}*/
00314 #endif
00315 
00316 #ifdef BUCKINGHAM
00317   /** \name Buckingham potential */
00318   /*@{*/
00319   double BUCK_A;
00320   double BUCK_B;
00321   double BUCK_C;
00322   double BUCK_D;
00323   double BUCK_cut;
00324   double BUCK_discont;
00325   double BUCK_shift;
00326   double BUCK_capradius;
00327   double BUCK_F1;
00328   double BUCK_F2;
00329   /*@}*/
00330 #endif
00331 
00332 #ifdef SOFT_SPHERE
00333   /** \name soft-sphere potential */
00334   /*@{*/
00335   double soft_a;
00336   double soft_n;
00337   double soft_cut;
00338   double soft_offset;
00339   /*@}*/
00340 #endif
00341 
00342 #ifdef HAT
00343   /** \name hat potential */
00344   /*@{*/
00345   double HAT_Fmax;
00346   double HAT_r;
00347   /*@}*/
00348 #endif
00349 
00350 #ifdef LJCOS
00351   /** \name Lennard-Jones+Cos potential */
00352   /*@{*/
00353   double LJCOS_eps;
00354   double LJCOS_sig;
00355   double LJCOS_cut;
00356   double LJCOS_offset;
00357   double LJCOS_alfa;
00358   double LJCOS_beta;
00359   double LJCOS_rmin;
00360   /*@}*/
00361 #endif
00362 
00363 #ifdef LJCOS2
00364   /** \name Lennard-Jones with a different Cos potential */
00365   /*@{*/
00366   double LJCOS2_eps;
00367   double LJCOS2_sig;
00368   double LJCOS2_cut;
00369   double LJCOS2_offset;
00370   double LJCOS2_w;
00371   double LJCOS2_rchange;
00372   double LJCOS2_capradius;
00373   /*@}*/
00374 #endif
00375   
00376 #ifdef GAY_BERNE
00377   /** \name Gay-Berne potential */
00378   /*@{*/
00379   double GB_eps;
00380   double GB_sig;
00381   double GB_cut;
00382   double GB_k1;
00383   double GB_k2;
00384   double GB_mu;
00385   double GB_nu;
00386   double GB_chi1;
00387   double GB_chi2;
00388   /*@}*/  
00389 #endif
00390 
00391 #ifdef TABULATED
00392   /** \name Tabulated potential */
00393   /*@{*/
00394   int TAB_npoints;
00395   int TAB_startindex;
00396   double TAB_minval;
00397   double TAB_minval2;
00398   double TAB_maxval;
00399   double TAB_stepsize;
00400   /** The maximum allowable filename length for a tabulated potential file*/
00401 #define MAXLENGTH_TABFILE_NAME 256
00402   char TAB_filename[MAXLENGTH_TABFILE_NAME];
00403   /*@}*/  
00404 #endif
00405 
00406 #ifdef COMFORCE
00407   /** \name center of mass directed force */
00408   /*@{*/
00409   int COMFORCE_flag;
00410   int COMFORCE_dir;
00411   double COMFORCE_force;
00412   double COMFORCE_fratio;
00413   /*@}*/
00414 #endif
00415   
00416 #ifdef COMFIXED
00417   /** \name center of mass directed force */
00418   /*@{*/
00419   int COMFIXED_flag;
00420   /*@}*/
00421 #endif
00422 
00423 #ifdef INTER_DPD
00424   /** \name DPD as interaction */
00425   /*@{*/
00426   double dpd_gamma;
00427   double dpd_r_cut;
00428   int dpd_wf;
00429   double dpd_pref1;
00430   double dpd_pref2;
00431   double dpd_tgamma;
00432   double dpd_tr_cut;
00433   int dpd_twf;
00434   double dpd_pref3;
00435   double dpd_pref4;
00436   /*@}*/  
00437 #endif
00438 
00439 #ifdef INTER_RF
00440   int rf_on;
00441 #endif
00442 
00443 #ifdef MOL_CUT
00444   int mol_cut_type;
00445   double mol_cut_cutoff;
00446 #endif
00447   
00448 #if defined(ADRESS) && defined(INTERFACE_CORRECTION)
00449   /** \name Tabulated potential */
00450   /*@{*/
00451   int ADRESS_TAB_npoints;
00452   int ADRESS_TAB_startindex;
00453   double ADRESS_TAB_minval;
00454   double ADRESS_TAB_maxval;
00455   double ADRESS_TAB_stepsize;
00456   /** The maximum allowable filename length for a tabulated potential file*/
00457 #define MAXLENGTH_ADRESSTABFILE_NAME 256
00458   char ADRESS_TAB_filename[MAXLENGTH_ADRESSTABFILE_NAME];
00459   /*@}*/    
00460 #endif
00461 
00462 #ifdef TUNABLE_SLIP
00463   double TUNABLE_SLIP_temp;
00464   double TUNABLE_SLIP_gamma;
00465   double TUNABLE_SLIP_r_cut;
00466   double TUNABLE_SLIP_time;
00467   double TUNABLE_SLIP_vx;
00468   double TUNABLE_SLIP_vy;
00469   double TUNABLE_SLIP_vz;
00470 #endif
00471 
00472 #ifdef CATALYTIC_REACTIONS
00473   double REACTION_range;
00474 #endif
00475 
00476 } IA_parameters;
00477 
00478 /** thermodynamic force parameters */
00479 
00480 #ifdef ADRESS
00481 /* #ifdef THERMODYNAMIC_FORCE */
00482 typedef struct{
00483   int TF_TAB_npoints;
00484   int TF_TAB_startindex;
00485   
00486   double TF_prefactor;
00487   double TF_TAB_minval;
00488   double TF_TAB_maxval;
00489   double TF_TAB_stepsize;
00490 #define MAXLENGTH_TF_FILENAME 256
00491   char TF_TAB_filename[MAXLENGTH_TF_FILENAME];
00492   
00493 } TF_parameters;
00494 /* #endif */
00495 #endif
00496 
00497 /** \name Compounds for Coulomb interactions */
00498 /*@{*/
00499 
00500 /** field containing the interaction parameters for
00501  *  the coulomb  interaction.  */
00502 typedef struct {
00503 
00504  #ifdef ELECTROSTATICS
00505   /** Bjerrum length. */
00506   double bjerrum;
00507   /** bjerrum length times temperature. */
00508   double prefactor;
00509   
00510   /** Method to treat coulomb interaction. See \ref COULOMB_NONE "Type codes for Coulomb" */
00511   int method;
00512  #endif
00513 
00514  #ifdef DIPOLES
00515   double Dbjerrum;
00516   double Dprefactor;
00517   int    Dmethod;
00518  #endif
00519 
00520 
00521 } Coulomb_parameters;
00522 
00523 /*@}*/
00524 
00525 /** Defines parameters for a bonded interaction. */
00526 typedef struct {
00527   /** bonded interaction type. See \ref BONDED_IA_FENE "Type code for bonded" */
00528   int type;
00529   /** (Number of particles - 1) interacting for that type */ 
00530   int num;
00531   /** union to store the different bonded interaction parameters. */
00532   union {
00533     /** Parameters for FENE bond Potential.
00534         k - spring constant.
00535         drmax - maximal bond streching.
00536         r0 - equilibrium bond length.
00537         drmax2 - square of drmax (internal parameter). 
00538     */
00539     struct {
00540       double k;
00541       double drmax;
00542       double r0;
00543       double drmax2;
00544       double drmax2i;
00545     } fene;
00546 
00547     /** Parameters for stretching_force */
00548     struct {
00549           double r0;
00550       double ks;
00551     } stretching_force;
00552     /** Parameters for area_force_local */
00553     struct {
00554           double A0_l;
00555       double ka_l;
00556     } area_force_local;
00557     /** Parameters for area_force_global */
00558     struct {
00559           double A0_g;
00560       double ka_g;
00561     } area_force_global;
00562     /** Parameters for bending_force */
00563     struct {
00564           double phi0;
00565       double kb;
00566     } bending_force;
00567     /** Parameters for volume_force */
00568     struct {
00569           double V0;
00570       double kv;
00571     } volume_force;
00572 
00573     /** Parameters for harmonic bond Potential */
00574     struct {
00575       double k;
00576       double r;
00577       double r_cut;
00578     } harmonic;
00579 
00580 #ifdef BOND_ANGLE_OLD
00581     /** Parameters for three body angular potential (bond-angle potentials). 
00582         ATTENTION: Note that there are different implementations of the bond angle
00583         potential which you may chose with a compiler flag in the file \ref config.h !
00584         bend - bending constant.
00585         phi0 - equilibrium angle (default is 180 degrees / Pi) */
00586     struct {
00587       double bend;
00588       double phi0;
00589 #ifdef BOND_ANGLE_COSINE
00590       double cos_phi0;
00591       double sin_phi0;
00592 #endif
00593 #ifdef BOND_ANGLE_COSSQUARE
00594       double cos_phi0;
00595 #endif
00596     } angle;
00597 #endif
00598 
00599 #ifdef BOND_ANGLE
00600     /** Parameters for three body angular potential (bond_angle_harmonic). 
00601         bend - bending constant.
00602         phi0 - equilibrium angle (default is 180 degrees / Pi) */
00603     struct {
00604       double bend;
00605       double phi0;
00606     } angle_harmonic;
00607 
00608     /** Parameters for three body angular potential (bond_angle_cosine). 
00609         bend - bending constant.
00610         phi0 - equilibrium angle (default is 180 degrees / Pi) */
00611     struct {
00612       double bend;
00613       double phi0;
00614       double cos_phi0;
00615       double sin_phi0;
00616     } angle_cosine;
00617 
00618     /** Parameters for three body angular potential (bond_angle_cossquare). 
00619         bend - bending constant.
00620         phi0 - equilibrium angle (default is 180 degrees / Pi) */
00621     struct {
00622       double bend;
00623       double phi0;
00624       double cos_phi0;
00625     } angle_cossquare;
00626 #endif
00627 
00628    /** Parameters for four body angular potential (dihedral-angle potentials). */
00629     struct {
00630       double mult;
00631       double bend;
00632       double phase;
00633     } dihedral;
00634 #ifdef TABULATED
00635     /** Parameters for n-body tabulated potential (n=2,3,4). */
00636     struct {
00637       char   *filename;
00638       int    type;
00639       int    npoints;
00640       double minval;
00641       double maxval;
00642       double invstepsize;
00643       double *f;
00644       double *e;
00645     } tab;
00646 #endif
00647 #ifdef OVERLAPPED 
00648     /** Parameters for n-body overlapped potential (n=2,3,4). */
00649     struct {
00650       char   *filename;
00651       int    type;
00652       double maxval;
00653       int    noverlaps;
00654       double *para_a;
00655       double *para_b;
00656       double *para_c;
00657     } overlap;
00658 #endif
00659     /** Dummy parameters for -LJ Potential */
00660     struct {
00661       double k;
00662       double r;
00663       double r2;
00664     } subt_lj;  
00665     /**Parameters for the rigid_bond/SHAKE/RATTLE ALGORITHM*/
00666     struct {
00667       /**Length of rigid bond/Constrained Bond*/
00668       //double d;
00669       /**Square of the length of Constrained Bond*/
00670       double d2;
00671       /**Positional Tolerance/Accuracy value for termination of RATTLE/SHAKE iterations during position corrections*/
00672       double p_tol;
00673       /**Velocity Tolerance/Accuracy for termination of RATTLE/SHAKE iterations during velocity corrections */
00674       double v_tol;
00675     } rigid_bond;
00676 
00677 #ifdef BOND_ANGLEDIST
00678     /** Parameters for three body angular potential (bond-angle potentials) that 
00679         depends on distance to wall constraint.
00680         ATTENTION: Note that there are different implementations of the bond angle
00681         potential which you may chose with a compiler flag in the file \ref config.h !
00682         bend - bending constant.
00683         phi0 - equilibrium angle (default is 180 degrees / Pi)
00684         dist0 - equilibrium distance (no default) */
00685     struct {
00686       double bend;
00687       double phimin;
00688       double distmin;
00689       double phimax;
00690       double distmax;
00691 #ifdef BOND_ANGLE_COSINE
00692       double cos_phi0;
00693       double sin_phi0;
00694 #endif
00695 #ifdef BOND_ANGLE_COSSQUARE
00696       double cos_phi0;
00697 #endif
00698     } angledist;
00699 #endif
00700 
00701 #ifdef BONDED_IA_ENDANGLEDIST
00702     /** Parameters for chainend angular potential with wall  */
00703     struct {
00704       double bend;
00705       double phi0;
00706       double distmin;
00707       double distmax;
00708     } endangledist;
00709 #endif
00710   } p;
00711 } Bonded_ia_parameters;
00712 
00713 #ifdef CONSTRAINTS
00714 /** \name Compounds for constraints */
00715 /*@{*/
00716 
00717 /** Parameters for a WALL constraint (or a plane if you like that more). */
00718 typedef struct {
00719   /** normal vector on the plane. */
00720   double n[3];
00721   /** distance of the wall from the origin. */
00722   double d;
00723   /** whether the constraint is penetrable 1 or not 0*/
00724   int penetrable; 
00725   int reflecting;
00726 } Constraint_wall;
00727 
00728 /** Parameters for a SPHERE constraint. */
00729 typedef struct {
00730   /** sphere center. */
00731   double pos[3];
00732   /** sphere radius. */
00733   double rad;  
00734   /** sphere direction. (+1 outside -1 inside interaction direction)*/
00735   double direction;
00736   /** whether the constraint is penetrable 1 or not 0*/
00737   int penetrable; 
00738   int reflecting;
00739 } Constraint_sphere;
00740 
00741 /** Parameters for a CYLINDER constraint. */
00742 typedef struct {
00743   /** center of the cylinder. */
00744   double pos[3];
00745   /** Axis of the cylinder .*/
00746   double axis[3];
00747   /** cylinder radius. */
00748   double rad;
00749   /** cylinder length. (!!!NOTE this is only the half length of the cylinder.)*/
00750   double length;
00751   /** cylinder direction. (+1 outside -1 inside interaction direction)*/
00752   double direction;
00753   /** whether the constraint is penetrable 1 or not 0*/
00754   int penetrable; 
00755   int reflecting;
00756 } Constraint_cylinder;
00757 
00758 /** Parameters for a RHOMBOID constraint. */
00759 typedef struct {
00760   /** corner of the rhomboid */
00761   double pos[3];
00762   /** edges adjacent to the corner */
00763   double a[3];
00764   double b[3];
00765   double c[3];
00766   /** rhomboid direction. (+1 outside -1 inside interaction direction)*/
00767   double direction;
00768   /** whether the constraint is penetrable 1 or not 0*/
00769   int penetrable; 
00770   int reflecting;
00771 } Constraint_rhomboid;
00772 
00773 /** Parameters for a PORE constraint. */
00774 typedef struct {
00775   /** center of the cylinder. */
00776   double pos[3];
00777   /** Axis of the cylinder .*/
00778   double axis[3];
00779   /** cylinder radius. */
00780   double rad_left;
00781   double rad_right;
00782   double smoothing_radius;
00783   /** cylinder length. (!!!NOTE this is only the half length of the cylinder.)*/
00784   double length;
00785   int reflecting;
00786 } Constraint_pore;
00787 
00788 /** Parameters for a ROD constraint. */
00789 typedef struct {
00790   /** center of the cylinder in the x-y plane. */
00791   double pos[2];
00792   /** line charge density. Only makes sense if the axis along the rod is
00793       periodically replicated and only with MMM1D. */
00794   double lambda;
00795 } Constraint_rod;
00796 
00797 /** Parameters for a PLATE constraint. */
00798 typedef struct {
00799   /** height of plane in z-axis. */
00800   double pos;
00801   /** charge density. Only makes sense if the axis along the rod is
00802       periodically replicated and only with MMM2D. */
00803   double sigma;
00804 } Constraint_plate;
00805 
00806 /** Parameters for a MAZE constraint. */
00807 typedef struct {
00808   /** number of spheres. */
00809   double nsphere;
00810   /** dimension of the maze. */
00811   double dim;
00812   /** sphere radius. */
00813   double sphrad;
00814   /** cylinder (connecting the spheres) radius*/
00815   double cylrad;
00816   /** whether the constraint is penetrable 1 or not 0*/
00817   int penetrable; 
00818 } Constraint_maze;
00819 
00820 //ER
00821 /** Parameters for a EXTERNAL MAGNETIC FIELD constraint */
00822 typedef struct{
00823   /** vector (direction and magnitude) of the external magnetic field */
00824   double ext_magn_field[3];
00825 } Constraint_ext_magn_field;
00826 //end ER
00827 
00828 /** Parameters for a plane constraint which is needed for tunable-slip boundary conditions. */
00829 typedef struct {
00830   /** Position of the plain. Negative values mean non-existing in that direction. */
00831   double pos[3];
00832 } Constraint_plane;
00833 
00834 /** Structure to specify a constraint. */
00835 typedef struct {
00836   /** type of the constraint. */
00837   int type;
00838 
00839   union {
00840     Constraint_wall wal;
00841     Constraint_sphere sph;
00842     Constraint_cylinder cyl;
00843     Constraint_rhomboid rhomboid;
00844     Constraint_rod rod;
00845     Constraint_plate plate;
00846     Constraint_maze maze;
00847     Constraint_pore pore;
00848     //ER
00849     Constraint_ext_magn_field emfield;
00850     //end ER
00851     Constraint_plane plane;
00852   } c;
00853 
00854   /** particle representation of this constraint. Actually needed are only the identity,
00855       the type and the force. */
00856   Particle part_rep;
00857 } Constraint;
00858 /*@}*/
00859 #endif
00860 
00861 
00862 /************************************************
00863  * exported variables
00864  ************************************************/
00865 
00866 /** Maximal particle type seen so far. */
00867 extern int n_particle_types;
00868 /* Number of nonbonded (short range) interactions. Not used so far.*/
00869 extern int n_interaction_types;
00870 
00871 /** Structure containing the coulomb parameters. */
00872 extern Coulomb_parameters coulomb;
00873 
00874 /** number of bonded interactions. Not used so far. */
00875 extern int n_bonded_ia;
00876 /** Field containing the paramters of the bonded ia types */
00877 extern Bonded_ia_parameters *bonded_ia_params;
00878 
00879 /** Array containing all tabulated forces*/
00880 extern DoubleList tabulated_forces;
00881 /** Array containing all tabulated energies*/
00882 extern DoubleList tabulated_energies;
00883 
00884 #ifdef ADRESS
00885 #ifdef INTERFACE_CORRECTION
00886 /** Array containing all adress tabulated forces*/
00887 extern DoubleList adress_tab_forces;
00888 /** Array containing all adress tabulated energies*/
00889 extern DoubleList adress_tab_energies;
00890 #endif
00891 /* #ifdef THERMODYNAMIC_FORCE */
00892 extern DoubleList thermodynamic_forces;
00893 
00894 extern DoubleList thermodynamic_f_energies;
00895 /* #endif */
00896 #endif
00897 
00898 /** Maximal interaction cutoff (real space/short range interactions). */
00899 extern double max_cut;
00900 /** Maximal interaction cutoff (real space/short range non-bonded interactions). */
00901 extern double max_cut_nonbonded;
00902 /** Maximal interaction cutoff (real space/short range bonded interactions). */
00903 extern double max_cut_bonded;
00904 /** Minimal global interaction cutoff. Particles with a distance
00905     smaller than this are guaranteed to be available on the same node
00906     (through ghosts).  */
00907 extern double min_global_cut;
00908 
00909 /** Switch for nonbonded interaction exclusion */
00910 extern int ia_excl;
00911 
00912 /************************************************
00913  * exported functions
00914  ************************************************/
00915 /** Function for initializing force and energy tables */
00916 void force_and_energy_tables_init();
00917 
00918 #ifdef ELECTROSTATICS
00919 int coulomb_set_bjerrum(double bjerrum);
00920 #endif
00921 
00922 #ifdef DIPOLES
00923 int dipolar_set_Dbjerrum(double bjerrum);
00924 #endif
00925 
00926 #ifdef ADRESS
00927 #ifdef INTERFACE_CORRECTION
00928 /** Function for initializing adress force and energy tables */
00929 void adress_force_and_energy_tables_init();
00930 #endif
00931 /* #ifdef THERMODYNAMIC_FORCE */
00932 void tf_tables_init();
00933 /* #endif */
00934 
00935 #endif
00936 
00937 /** copy a set of interaction parameters. */
00938 void copy_ia_params(IA_parameters *dst, IA_parameters *src);
00939 
00940 /** get interaction parameters between particle sorts i and j */
00941 MDINLINE IA_parameters *get_ia_param(int i, int j) {
00942   extern IA_parameters *ia_params;
00943   extern int n_particle_types;
00944   return &ia_params[i*n_particle_types + j];
00945 }
00946 
00947 /** get interaction parameters between particle sorts i and j.
00948     Slower than @ref get_ia_param, but can also be used on not
00949     yet present particle types*/
00950 IA_parameters *get_ia_param_safe(int i, int j);
00951 
00952 #ifdef ADRESS 
00953 MDINLINE TF_parameters *get_tf_param(int i) {
00954   extern TF_parameters *tf_params;
00955   return &tf_params[i];
00956 }
00957 #endif
00958 
00959 /** Makes sure that ia_params is large enough to cover interactions
00960     for this particle type. The interactions are initialized with values
00961     such that no physical interaction occurs. */
00962 void make_particle_type_exist(int type);
00963 
00964 /** Makes sure that \ref bonded_ia_params is large enough to cover the
00965     parameters for the bonded interaction type. Attention: 1: There is
00966     no initialization done here. 2: Use only in connection with
00967     creating new or overwriting old bond types*/
00968 void make_bond_type_exist(int type);
00969 
00970 /** This function increases the LOCAL ia_params field
00971     to the given size. Better use
00972     \ref make_particle_type_exist since it takes care of
00973     the other nodes.  */
00974 void realloc_ia_params(int nsize);
00975 
00976 #ifdef ADRESS
00977 void realloc_tf_params(int nsize);
00978 #endif
00979 
00980 /** calculates the maximal cutoff of all real space
00981     interactions. these are: bonded, non bonded + real space
00982     electrostatics. The result is stored in the global variable
00983     max_cut. The maximal cutoff of the non-bonded + real space
00984     electrostatic interactions is stored in max_cut_non_bonded. This
00985     value is used in the verlet pair list algorithm (see \ref
00986     verlet.h). */
00987 void recalc_maximal_cutoff();
00988 
00989 /** call when the temperature changes, for Bjerrum length adjusting. */
00990 void recalc_coulomb_prefactor();
00991 
00992 /** check whether all force calculation routines are properly initialized. */
00993 int check_obs_calc_initialized();
00994 
00995 /**  check if a non bonded interaction is defined */
00996 MDINLINE int checkIfInteraction(IA_parameters *data) {
00997   return data->particlesInteract;
00998 }
00999 
01000 /** check if the types of particles i and j have any non bonded
01001     interaction defined. */
01002 MDINLINE int checkIfParticlesInteract(int i, int j) {
01003   return checkIfInteraction(get_ia_param(i, j));
01004 }
01005 
01006 ///
01007 char *get_name_of_bonded_ia(int i);
01008 
01009 #ifdef ADRESS
01010 int checkIfTF(TF_parameters *data);
01011 #endif
01012 
01013 #ifdef BOND_VIRTUAL
01014 int virtual_set_params(int bond_type);
01015 #endif
01016 
01017 #endif