ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
reaction_field.c
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 /** \file reaction_field.c
00022  *
00023  *  Implementation of \ref reaction_field.h
00024  */
00025 #include "reaction_field.h"
00026 
00027 #ifdef ELECTROSTATICS
00028 #include "communication.h"
00029 
00030 int rf_set_params(double kappa,double epsilon1,double epsilon2, double r_cut)
00031 {
00032   rf_params.kappa = kappa;
00033   rf_params.epsilon1 = epsilon1;
00034   rf_params.epsilon2 = epsilon2;
00035   rf_params.r_cut = r_cut;
00036   rf_params.B =(2*(epsilon1-epsilon2)*(1+kappa*r_cut)-epsilon2*kappa*kappa*r_cut*r_cut)/((epsilon1+2*epsilon2)*(1+kappa*r_cut)+epsilon2*kappa*kappa*r_cut*r_cut);
00037   if(rf_params.epsilon1 < 0.0)
00038     return -1;
00039 
00040   if(rf_params.epsilon2 < 0.0)
00041     return -1;
00042 
00043   if(rf_params.r_cut < 0.0)
00044     return -2;
00045 
00046   mpi_bcast_coulomb_params();
00047 
00048   return 1;
00049 }
00050 
00051 #ifdef INTER_RF
00052 
00053 int interrf_set_params(int part_type_a, int part_type_b,int rf_on)
00054 {
00055   IA_parameters *data = get_ia_param_safe(part_type_a, part_type_b);
00056 
00057   if (!data) return ES_ERROR;
00058 
00059   data->rf_on = rf_on;
00060 
00061   /* broadcast interaction parameters */
00062   mpi_bcast_ia_params(part_type_a, part_type_b);
00063 
00064   return ES_OK;
00065 }
00066 
00067 #endif
00068 
00069 #endif