ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
Defines | Functions | Variables
elc.c File Reference

For more information about ELC, see elc.h. More...

#include <math.h>
#include <mpi.h>
#include "utils.h"
#include "communication.h"
#include "particle_data.h"
#include "interaction_data.h"
#include "cells.h"
#include "elc.h"
#include "mmm-common.h"
#include "pressure.h"
#include "p3m.h"
#include "errorhandling.h"
Include dependency graph for elc.c:

Go to the source code of this file.

Defines

#define MAXIMAL_FAR_CUT   50
 Largest reasonable cutoff for far formula.
#define checkpoint(text, p, q, size)
#define clear_log_forces(w)
Product decomposition data organization

For the cell blocks it is assumed that the lower blocks part is in the lower half.

This has to have positive sign, so that has to be first.

#define POQESP   0
#define POQECP   1
#define POQESM   2
#define POQECM   3
#define PQESSP   0
#define PQESCP   1
#define PQECSP   2
#define PQECCP   3
#define PQESSM   4
#define PQESCM   5
#define PQECSM   6
#define PQECCM   7

Functions

void ELC_setup_constants ()
MDINLINE void clear_vec (double *pdc, int size)
MDINLINE void copy_vec (double *pdc_d, double *pdc_s, int size)
MDINLINE void add_vec (double *pdc_d, double *pdc_s1, double *pdc_s2, int size)
MDINLINE void addscale_vec (double *pdc_d, double scale, double *pdc_s1, double *pdc_s2, int size)
MDINLINE void scale_vec (double scale, double *pdc, int size)
MDINLINE double * block (double *p, int index, int size)
MDINLINE double image_sum_b (double q, double z)
MDINLINE double image_sum_t (double q, double z)
void ELC_add_force ()
 the force calculation
double ELC_energy ()
 the energy calculation
int ELC_tune (double error)
int ELC_sanity_checks ()
 check the ELC parameters
void ELC_init ()
 initialize the ELC constants
void ELC_on_resort_particles ()
 resize the particle buffers
int ELC_set_params (double maxPWerror, double gap_size, double far_cut, int neutralize, double top, double mid, double bot)
 set parameters for ELC.
void ELC_P3M_self_forces ()
 forces of particles in border layers with themselves
void ELC_p3m_charge_assign_both ()
 assign the additional, virtual charges, used only in energy.c
void ELC_p3m_charge_assign_image ()
 assign the additional, virtual charges, used only in energy.c
void ELC_P3M_dielectric_layers_force_contribution (Particle *p1, Particle *p2, double force1[3], double force2[3])
 pairwise contributions from the lowest and top layers to the force
double ELC_P3M_dielectric_layers_energy_contribution (Particle *p1, Particle *p2)
 pairwise contributions from the lowest and top layers to the energy
double ELC_P3M_dielectric_layers_energy_self ()
 self energies of top and bottom layers with their virtual images
void ELC_P3M_modify_p3m_sums_both ()
 take into account the virtual charges in the charge sums, used in energy.c
void ELC_P3M_modify_p3m_sums_image ()
 take into account the virtual charges in the charge sums, used in energy.c
void ELC_P3M_restore_p3m_sums ()
 assign the additional, virtual charges, used only in energy.c
sin/cos storage
static void prepare_scx_cache ()
static void prepare_scy_cache ()
common code
static void distribute (int size)
p=0 per frequency code
static void setup_P (int p, double omega)
static void add_P_force ()
static double P_energy (double omega)
q=0 per frequency code
static void setup_Q (int q, double omega)
static void add_Q_force ()
static double Q_energy (double omega)
p,q <> 0 per frequency code
static void setup_PQ (int p, int q, double omega)
static void add_PQ_force (int p, int q, double omega)
static double PQ_energy (double omega)
static void add_dipole_force ()
static double dipole_energy ()
static double z_energy ()
static void add_z_force ()

Variables

ELC_struct elc_params = { 1e100, 10, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 }
static int n_localpart = 0
 number of local particles, equals the size of elc::partblk.
static double * partblk = NULL
 temporary buffers for product decomposition
static double gblcblk [8]
 collected data from the other cells
Inverse box dimensions and derived constants
static double ux
static double ux2
static double uy
static double uy2
static double uz
sin/cos caching
static SCCache * scxcache = NULL
static int n_scxcache
static SCCache * scycache = NULL
static int n_scycache

Detailed Description

For more information about ELC, see elc.h.

Definition in file elc.c.


Define Documentation

#define checkpoint (   text,
  p,
  q,
  size 
)

Definition at line 281 of file elc.c.

Referenced by ELC_add_force(), and ELC_energy().

#define clear_log_forces (   w)

Definition at line 303 of file elc.c.

Referenced by ELC_add_force().

#define MAXIMAL_FAR_CUT   50

Largest reasonable cutoff for far formula.

Definition at line 48 of file elc.c.

Referenced by ELC_tune().

#define POQECM   3

Definition at line 73 of file elc.c.

Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().

#define POQECP   1

Definition at line 71 of file elc.c.

Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().

#define POQESM   2

Definition at line 72 of file elc.c.

Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().

#define POQESP   0

Definition at line 70 of file elc.c.

Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().

#define PQECCM   7

Definition at line 82 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQECCP   3

Definition at line 78 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQECSM   6

Definition at line 81 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQECSP   2

Definition at line 77 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQESCM   5

Definition at line 80 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQESCP   1

Definition at line 76 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQESSM   4

Definition at line 79 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().

#define PQESSP   0

Definition at line 75 of file elc.c.

Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().


Function Documentation

static void add_dipole_force ( ) [static]
static void add_P_force ( ) [static]
static void add_PQ_force ( int  p,
int  q,
double  omega 
) [static]
static void add_Q_force ( ) [static]
MDINLINE void add_vec ( double *  pdc_d,
double *  pdc_s1,
double *  pdc_s2,
int  size 
)

Definition at line 220 of file elc.c.

References i.

Referenced by setup_P(), setup_PQ(), and setup_Q().

static void add_z_force ( ) [static]
MDINLINE void addscale_vec ( double *  pdc_d,
double  scale,
double *  pdc_s1,
double *  pdc_s2,
int  size 
)

Definition at line 227 of file elc.c.

References i.

Referenced by distribute(), setup_P(), setup_PQ(), and setup_Q().

MDINLINE double* block ( double *  p,
int  index,
int  size 
)
MDINLINE void clear_vec ( double *  pdc,
int  size 
)
MDINLINE void copy_vec ( double *  pdc_d,
double *  pdc_s,
int  size 
)

Definition at line 213 of file elc.c.

References i.

Referenced by distribute(), gather_image_contributions(), and setup_z_energy().

static double dipole_energy ( ) [static]
void distribute ( int  size) [static]
void ELC_add_force ( )
double ELC_energy ( )
void ELC_init ( )
void ELC_on_resort_particles ( )

resize the particle buffers

Definition at line 1257 of file elc.c.

References cells_get_n_particles(), ELC_struct::far_cut, n_scxcache, n_scycache, partblk, realloc, scxcache, scycache, ux, and uy.

Referenced by on_resort_particles().

void ELC_p3m_charge_assign_both ( )
void ELC_p3m_charge_assign_image ( )
double ELC_P3M_dielectric_layers_energy_contribution ( Particle p1,
Particle p2 
)

pairwise contributions from the lowest and top layers to the energy

Definition at line 1490 of file elc.c.

References ELC_struct::di_mid_bot, ELC_struct::di_mid_top, get_mi_vector(), ELC_struct::h, ParticlePosition::p, Particle::p, p3m_pair_energy(), ParticleProperties::q, Particle::r, ELC_struct::space_layer, and sqrlen().

Referenced by add_non_bonded_pair_energy().

double ELC_P3M_dielectric_layers_energy_self ( )
void ELC_P3M_dielectric_layers_force_contribution ( Particle p1,
Particle p2,
double  force1[3],
double  force2[3] 
)

pairwise contributions from the lowest and top layers to the force

Definition at line 1443 of file elc.c.

References ELC_struct::di_mid_bot, ELC_struct::di_mid_top, get_mi_vector(), ELC_struct::h, ParticlePosition::p, Particle::p, p3m_add_pair_force(), ParticleProperties::q, Particle::r, ELC_struct::space_layer, and sqrlen().

Referenced by add_non_bonded_pair_force().

void ELC_P3M_modify_p3m_sums_both ( )
void ELC_P3M_modify_p3m_sums_image ( )
void ELC_P3M_restore_p3m_sums ( )
void ELC_P3M_self_forces ( )
int ELC_sanity_checks ( )

check the ELC parameters

Definition at line 1201 of file elc.c.

References ERROR_SPRINTF, PERIODIC, and runtime_error().

Referenced by check_obs_calc_initialized().

int ELC_set_params ( double  maxPWerror,
double  min_dist,
double  far_cut,
int  neutralize,
double  top,
double  mid,
double  bottom 
)

set parameters for ELC.

Parameters:
maxPWerrorthe required accuracy of the potential and the force. Note that this counts for the plain 1/r contribution alone, without the Bjerrum length and the charge prefactor.
min_distthe gap size.
far_cutthe cutoff of the exponential sum. If -1, the cutoff is automatically calculated using the error formulas.
neutralizewhether to add a neutralizing background. WARNING: This background exerts forces, which are dependent on the simulation box; especially the gap size enters into the value of the forces.
topdielectric constant of upper part
middielectric constant of center part
bottomdielectric constant of lower part

Definition at line 1268 of file elc.c.

References box_l, coulomb, COULOMB_ELC_P3M, COULOMB_P3M, ELC_struct::di_bot, ELC_struct::di_mid, ELC_struct::di_mid_bot, ELC_struct::di_mid_top, ELC_struct::di_top, ELC_struct::dielectric_contrast_on, dmin(), ELC_setup_constants(), ELC_tune(), p3m_parameter_struct::epsilon, ERROR_SPRINTF, ES_ERROR, ES_OK, ELC_struct::far_calculated, ELC_struct::far_cut, ELC_struct::far_cut2, ELC_struct::gap_size, ELC_struct::h, ELC_struct::maxPWerror, Coulomb_parameters::method, ELC_struct::minimal_dist, mpi_bcast_coulomb_params(), ELC_struct::neutralize, p3m, P3M_EPSILON_METALLIC, p3m_data_struct::params, runtime_error(), ELC_struct::space_box, ELC_struct::space_layer, SQR(), and top.

Referenced by tclcommand_inter_coulomb_parse_elc_params().

void ELC_setup_constants ( )

Definition at line 145 of file elc.c.

References box_l, ux, ux2, uy, uy2, and uz.

Referenced by ELC_init(), and ELC_set_params().

int ELC_tune ( double  error)
MDINLINE double image_sum_b ( double  q,
double  z 
)

Definition at line 478 of file elc.c.

References box_l, ELC_struct::di_mid_bot, and ELC_struct::di_mid_top.

Referenced by z_energy().

MDINLINE double image_sum_t ( double  q,
double  z 
)

Definition at line 487 of file elc.c.

References box_l, ELC_struct::di_mid_bot, and ELC_struct::di_mid_top.

Referenced by z_energy().

static double P_energy ( double  omega) [static]

Definition at line 836 of file elc.c.

References CellPList::cell, gblcblk, i, local_cells, CellPList::n, ParticleList::n, partblk, POQECM, POQECP, POQESM, and POQESP.

Referenced by ELC_energy().

static double PQ_energy ( double  omega) [static]

Definition at line 1051 of file elc.c.

References CellPList::cell, gblcblk, i, local_cells, CellPList::n, ParticleList::n, partblk, PQECCM, PQECCP, PQECSM, PQECSP, PQESCM, PQESCP, PQESSM, and PQESSP.

Referenced by ELC_energy().

static void prepare_scx_cache ( ) [static]
static void prepare_scy_cache ( ) [static]
static double Q_energy ( double  omega) [static]

Definition at line 877 of file elc.c.

References CellPList::cell, gblcblk, i, local_cells, CellPList::n, ParticleList::n, partblk, POQECM, POQECP, POQESM, and POQESP.

Referenced by ELC_energy().

MDINLINE void scale_vec ( double  scale,
double *  pdc,
int  size 
)

Definition at line 234 of file elc.c.

References i.

Referenced by setup_P(), setup_PQ(), setup_Q(), setup_z_energy(), and setup_z_force().

static void setup_P ( int  p,
double  omega 
) [static]
static void setup_PQ ( int  p,
int  q,
double  omega 
) [static]
static void setup_Q ( int  q,
double  omega 
) [static]
static double z_energy ( ) [static]

Variable Documentation

ELC_struct elc_params = { 1e100, 10, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 }
double gblcblk[8] [static]
int n_localpart = 0 [static]

number of local particles, equals the size of elc::partblk.

Definition at line 86 of file elc.c.

Referenced by prepare_scx_cache(), prepare_scy_cache(), and setup_PQ().

int n_scxcache [static]

Definition at line 101 of file elc.c.

Referenced by ELC_add_force(), ELC_energy(), ELC_on_resort_particles(), and prepare_scx_cache().

int n_scycache [static]

Definition at line 103 of file elc.c.

Referenced by ELC_add_force(), ELC_energy(), ELC_on_resort_particles(), and prepare_scy_cache().

double* partblk = NULL [static]

temporary buffers for product decomposition

Definition at line 89 of file elc.c.

Referenced by add_P_force(), add_PQ_force(), add_Q_force(), ELC_on_resort_particles(), P_energy(), PQ_energy(), Q_energy(), setup_P(), setup_PQ(), and setup_Q().

SCCache* scxcache = NULL [static]

Definition at line 100 of file elc.c.

Referenced by ELC_on_resort_particles(), prepare_scx_cache(), setup_P(), and setup_PQ().

SCCache* scycache = NULL [static]

Definition at line 102 of file elc.c.

Referenced by ELC_on_resort_particles(), prepare_scy_cache(), setup_PQ(), and setup_Q().

double ux [static]
double ux2
double uy
double uy2
double uz