ESPResSo 3.2.0-167-g2c9ead1-git
Extensible Simulation Package for Soft Matter Research
bmhtf-nacl.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 BMHTF_NACL_H
00022 #define BMHTF_NACL_H
00023 /** \file bmhtf-nacl.h
00024  *  Routines to calculate the Born-Meyer-Huggins-Tosi-Fumi energy and/or force 
00025  *  for a particle pair.
00026  *  \ref forces.c
00027 */
00028 
00029 #include "utils.h"
00030 #include "interaction_data.h"
00031 #include "particle_data.h"
00032 #include "mol_cut.h"
00033 
00034 #ifdef BMHTF_NACL
00035 
00036 ///
00037 int BMHTF_set_params(int part_type_a, int part_type_b,
00038                      double A, double B, double C,
00039                      double D, double sig, double cut);
00040 
00041 /** Calculate smooth step force between particle p1 and p2 */
00042 MDINLINE void add_BMHTF_pair_force(Particle *p1, Particle *p2, IA_parameters *ia_params,
00043                                    double d[3], double dist, double dist2, double force[3])
00044 {
00045   int j;
00046   double pw8, fac = 0.0;
00047   if(CUTOFF_CHECK(dist < ia_params->BMHTF_cut)) {
00048     pw8 = dist2*dist2*dist2*dist2;
00049     fac = ia_params->BMHTF_A*ia_params->BMHTF_B*
00050       exp(ia_params->BMHTF_B*(ia_params->BMHTF_sig - dist))/dist -
00051       6*ia_params->BMHTF_C/pw8 - 8*ia_params->BMHTF_D/pw8/dist2;
00052 
00053     for(j=0;j<3;j++) force[j] += fac * d[j];
00054   }
00055 }
00056 
00057 /** calculate smooth step potential energy between particle p1 and p2. */
00058 MDINLINE double BMHTF_pair_energy(Particle *p1, Particle *p2, IA_parameters *ia_params,
00059                                   double d[3], double dist, double dist2)
00060 {
00061   double pw6;
00062  
00063   if(CUTOFF_CHECK(dist < ia_params->BMHTF_cut)) {
00064     pw6 = dist2*dist2*dist2;
00065     return ia_params->BMHTF_A*
00066       exp(ia_params->BMHTF_B*(ia_params->BMHTF_sig - dist)) -
00067       ia_params->BMHTF_C/pw6 - ia_params->BMHTF_D/pw6/dist2 + ia_params->BMHTF_computed_shift;
00068   }
00069   return 0.0;
00070 }
00071 
00072 #endif
00073 #endif