mdcore  0.1.5
/home/pedro/work/mdcore/src/potential.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of mdcore.
00003  * Coypright (c) 2010 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
00004  * 
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU Lesser General Public License as published
00007  * by the Free Software Foundation, either version 3 of the License, or
00008  * (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  * 
00018  ******************************************************************************/
00019 
00020 
00021 /* potential error codes */
00022 #define potential_err_ok                    0
00023 #define potential_err_null                  -1
00024 #define potential_err_malloc                -2
00025 #define potential_err_bounds                -3
00026 #define potential_err_nyi                   -4
00027 #define potential_err_ivalsmax              -5
00028 
00029 
00030 /* some constants */
00031 #define potential_degree                    5
00032 #define potential_chunk                     (potential_degree+3)
00033 #define potential_ivalsa                    1
00034 #define potential_ivalsb                    10
00035 #define potential_N                         100
00036 #define potential_align                     64
00037 #define potential_align                     64
00038 #define potential_ivalsmax                  320
00039 
00040 #define potential_escale                    (0.079577471545947667882)
00041 // #define potential_escale                    1.0
00042 
00043 
00044 /* potential flags */
00045 #define potential_flag_none                  0
00046 #define potential_flag_LJ126                 1
00047 #define potential_flag_Ewald                 2
00048 #define potential_flag_Coulomb               4
00049 #define potential_flag_single                6
00050 
00051 
00053 extern int potential_err;
00054 
00055 
00057 struct potential {
00058 
00060     FPTYPE alpha[4];
00061     
00063     FPTYPE *c;
00064     
00066     double a, b;
00067     
00069     unsigned int flags;
00070     
00072     int n;
00073     
00074     };
00075     
00076 
00078 extern struct potential potential_null;
00079 
00080 
00081 /* associated functions */
00082 void potential_clear ( struct potential *p );
00083 int potential_init ( struct potential *p , double (*f)( double ) , double (*fp)( double ) , double (*f6p)( double ) , FPTYPE a , FPTYPE b , FPTYPE tol );
00084 int potential_getcoeffs ( double (*f)( double ) , double (*fp)( double ) , FPTYPE *xi , int n , FPTYPE *c , FPTYPE *err );
00085 double potential_getalpha ( double (*f6p)( double ) , double a , double b );
00086 struct potential *potential_create_LJ126 ( double a , double b , double A , double B , double tol );
00087 struct potential *potential_create_LJ126_Ewald ( double a , double b , double A , double B , double q , double kappa , double tol );
00088 struct potential *potential_create_LJ126_Coulomb ( double a , double b , double A , double B , double q , double tol );
00089 struct potential *potential_create_Ewald ( double a , double b , double q , double kappa , double tol );
00090 struct potential *potential_create_Coulomb ( double a , double b , double q , double tol );
00091 struct potential *potential_create_harmonic ( double a , double b , double K , double r0 , double tol );
00092 struct potential *potential_create_harmonic_angle ( double a , double b , double K , double theta0 , double tol );
00093 struct potential *potential_create_harmonic_dihedral ( double K , int n , double delta , double tol );
00094 
00095 /* These functions are now all in potential_eval.h. */
00096 /*
00097     void potential_eval ( struct potential *p , FPTYPE r2 , FPTYPE *e , FPTYPE *f );
00098     void potential_eval_expl ( struct potential *p , FPTYPE r2 , FPTYPE *e , FPTYPE *f );
00099     void potential_eval_vec_4single ( struct potential *p[4] , float *r2 , float *e , float *f );
00100     void potential_eval_vec_4single_r ( struct potential *p[4] , float *r_in , float *e , float *f );
00101     void potential_eval_vec_8single ( struct potential *p[4] , float *r2 , float *e , float *f );
00102     void potential_eval_vec_2double ( struct potential *p[4] , FPTYPE *r2 , FPTYPE *e , FPTYPE *f );
00103     void potential_eval_vec_4double ( struct potential *p[4] , FPTYPE *r2 , FPTYPE *e , FPTYPE *f );
00104     void potential_eval_vec_4double_r ( struct potential *p[4] , FPTYPE *r , FPTYPE *e , FPTYPE *f );
00105     void potential_eval_r ( struct potential *p , FPTYPE r , FPTYPE *e , FPTYPE *f );
00106 */
00107 
00108 /* helper functions */
00109 double potential_LJ126 ( double r , double A , double B );
00110 double potential_LJ126_p ( double r , double A , double B );
00111 double potential_LJ126_6p ( double r , double A , double B );
00112 double potential_Ewald ( double r , double kappa );
00113 double potential_Ewald_p ( double r , double kappa );
00114 double potential_Ewald_6p ( double r , double kappa );
00115 double potential_Coulomb ( double r );
00116 double potential_Coulomb_p ( double r );
00117 double potential_Coulomb_6p ( double r );
 All Data Structures Files Functions Variables Typedefs Enumerator Defines