![]() |
ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
|
MMM2D algorithm for long range coulomb interaction. More...
#include <math.h>#include <mpi.h>#include "utils.h"#include "communication.h"#include "grid.h"#include "particle_data.h"#include "interaction_data.h"#include "cells.h"#include "mmm2d.h"#include "mmm-common.h"#include "specfunc.h"#include "integrate.h"#include "layered.h"
Go to the source code of this file.
Defines | |
| #define | LOG_FORCES(x) |
| if you define this, the Besselfunctions are calculated up to machine precision, otherwise 10^-14, which should be definitely enough for daily life. | |
| #define | K0 LPK0 |
| #define | K1 LPK1 |
| #define | MAXIMAL_FAR_CUT 100 |
| Largest reasonable cutoff for far formula. | |
| #define | MAXIMAL_B_CUT 50 |
| Largest reasonable cutoff for Bessel function. | |
| #define | MAXIMAL_POLYGAMMA 100 |
| Largest reasonable order of polygamma series. | |
| #define | FARRELPREC 1e-6 |
| internal relative precision of far formula. | |
| #define | COMPLEX_STEP 16 |
| number of steps in the complex cutoff table | |
| #define | COMPLEX_FAC (COMPLEX_STEP/(.5 + 0.01)) |
| map numbers from 0 to 1/2 onto the complex cutoff table (with security margin) | |
| #define | checkpoint(text, p, q, size) |
| #define | ERROR_LARGE 1 |
| return codes for MMM2D_tune_near and MMM2D_tune_far | |
| #define | ERROR_BOXL 2 |
| box too large | |
| #define | ERROR_BESSEL 3 |
| no reasonable bessel cutoff found | |
| #define | ERROR_POLY 4 |
| no reasonable polygamma cutoff found | |
| #define | ERROR_FARC 5 |
| no reasonable cutoff for the far formula found | |
| #define | ERROR_SMALL 6 |
| cell too small | |
| #define | ERROR_ICL 7 |
| IC layer requirement. | |
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 |
| #define | QQEQQP 0 |
| #define | QQEQQM 1 |
| #define | ABEQQP 0 |
| #define | ABEQZP 1 |
| #define | ABEQQM 2 |
| #define | ABEQZM 3 |
Functions | |
| void | MMM2D_setup_constants () |
| MDINLINE void | clear_vec (double *pdc, int size) |
| pdc = 0 | |
| MDINLINE void | copy_vec (double *pdc_d, double *pdc_s, int size) |
| pdc_d = pdc_s | |
| MDINLINE void | add_vec (double *pdc_d, double *pdc_s1, double *pdc_s2, int size) |
| pdc_d = pdc_s1 + pdc_s2 | |
| MDINLINE void | addscale_vec (double *pdc_d, double scale, double *pdc_s1, double *pdc_s2, int size) |
| pdc_d = scale*pdc_s1 + pdc_s2 | |
| MDINLINE void | scale_vec (double scale, double *pdc, int size) |
| pdc_d = scale*pdc | |
| MDINLINE double * | block (double *p, int index, int size) |
| MDINLINE double * | blwentry (double *p, int index, int e_size) |
| MDINLINE double * | abventry (double *p, int index, int e_size) |
| static void | add_force_contribution (int p, int q) |
| static double | energy_contribution (int p, int q) |
| double | MMM2D_add_far (int f, int e) |
| the general long range force/energy calculation | |
| void | add_mmm2d_coulomb_pair_force (double charge_factor, double d[3], double dl2, double dl, double force[3]) |
| pairwise calculated parts of MMM2D force (near neighbors) | |
| MDINLINE double | calc_mmm2d_copy_pair_energy (double d[3]) |
| double | mmm2d_coulomb_pair_energy (double charge_factor, double dv[3], double d2, double d) |
| pairwise calculated parts of MMM2D force (near neighbors) | |
| int | MMM2D_set_params (double maxPWerror, double far_cut, double delta_top, double delta_bot) |
| set parameters for MMM2D. | |
| int | MMM2D_sanity_checks () |
| check that MMM2D can run with the current parameters | |
| void | MMM2D_init () |
| initialize the MMM2D constants | |
| void | MMM2D_on_resort_particles () |
| if the number of particles has changed (even per node), the particle buffers for the coefficients have to be resized. | |
| void | MMM2D_dielectric_layers_force_contribution () |
| force contribution from dielectric layers | |
| double | MMM2D_dielectric_layers_energy_contribution () |
| energy contribution from dielectric layers | |
Local functions for the near formula | |
| static void | prepareBernoulliNumbers (int nmax) |
| complex evaluation | |
| static int | MMM2D_tune_near (double error) |
| cutoff error setup. | |
| void | MMM2D_self_energy () |
| energy of all local particles with their copies | |
Local functions for the far formula | |
| static void | prepare_scx_cache () |
| sin/cos storage | |
| static void | prepare_scy_cache () |
| static void | clear_image_contributions (int size) |
| clear the image contributions if there is no dielectric contrast and no image charges | |
| static void | gather_image_contributions (int size) |
| gather the informations for the far away image charges | |
| static void | distribute (int size, double fac) |
| spread the top/bottom sums | |
| static void | setup_z_force () |
| 2 pi |z| code | |
| static void | setup_z_energy () |
| static void | add_z_force () |
| static double | z_energy () |
| static void | setup_P (int p, double omega, double fac) |
| p=0 per frequency code | |
| static void | add_P_force () |
| static double | P_energy (double omega) |
| static void | setup_Q (int q, double omega, double fac) |
| q=0 per frequency code | |
| static void | add_Q_force () |
| static double | Q_energy (double omega) |
| static void | setup_PQ (int p, int q, double omega, double fac) |
| p,q <> 0 per frequency code | |
| static void | add_PQ_force (int p, int q, double omega) |
| static double | PQ_energy (double omega) |
| static int | MMM2D_tune_far (double error) |
| cutoff error setup. | |
Variables | |
| char const * | mmm2d_errors [] |
| error messages, see above | |
| static double | part_error |
| up to that error the sums in the NF are evaluated | |
| static IntList | besselCutoff = {NULL, 0, 0} |
| cutoffs for the bessel sum | |
| static int | complexCutoff [COMPLEX_STEP+1] |
| cutoffs for the complex sum | |
| static DoubleList | bon = {NULL, 0, 0} |
| bernoulli numbers divided by n | |
| static double | self_energy |
| MMM2D_struct | mmm2d_params = { 1e100, 10, 1, 0, 0, 1, 1, 1 } |
| static int | n_localpart = 0 |
| number of local particles | |
| static double * | partblk = NULL |
| temporary buffers for product decomposition | |
| static double * | lclcblk = NULL |
| for all local cells including ghosts | |
| static double * | gblcblk = NULL |
| collected data from the cells above the top neighbor of a cell rsp. | |
| static double | lclimge [8] |
| contribution from the image charges | |
| static SCCache * | scxcache = NULL |
| sin/cos caching | |
| static int | n_scxcache |
| static SCCache * | scycache = NULL |
| sin/cos caching | |
| static int | n_scycache |
| static double | ux |
| inverse box dimensions | |
| static double | ux2 |
| static double | uy |
| static double | uy2 |
| static double | uz |
| static double | max_near |
| maximal z for near formula, minimal z for far formula. | |
| static double | min_far |
MMM2D algorithm for long range coulomb interaction.
For more information about MMM2D, see mmm2d.h.
Definition in file mmm2d.c.
| #define ABEQQM 2 |
Definition at line 178 of file mmm2d.c.
Referenced by z_energy().
| #define ABEQQP 0 |
Definition at line 176 of file mmm2d.c.
Referenced by setup_z_energy(), and z_energy().
| #define ABEQZM 3 |
Definition at line 179 of file mmm2d.c.
Referenced by z_energy().
| #define ABEQZP 1 |
Definition at line 177 of file mmm2d.c.
Referenced by setup_z_energy(), and z_energy().
| #define checkpoint | ( | text, | |
| p, | |||
| q, | |||
| size | |||
| ) |
Definition at line 538 of file mmm2d.c.
Referenced by add_force_contribution(), and energy_contribution().
| #define COMPLEX_FAC (COMPLEX_STEP/(.5 + 0.01)) |
map numbers from 0 to 1/2 onto the complex cutoff table (with security margin)
Definition at line 97 of file mmm2d.c.
Referenced by add_mmm2d_coulomb_pair_force(), calc_mmm2d_copy_pair_energy(), and MMM2D_tune_near().
| #define COMPLEX_STEP 16 |
number of steps in the complex cutoff table
Definition at line 94 of file mmm2d.c.
Referenced by add_mmm2d_coulomb_pair_force(), calc_mmm2d_copy_pair_energy(), and MMM2D_tune_near().
| #define ERROR_BESSEL 3 |
no reasonable bessel cutoff found
Definition at line 138 of file mmm2d.c.
Referenced by MMM2D_tune_near().
| #define ERROR_BOXL 2 |
| #define ERROR_FARC 5 |
no reasonable cutoff for the far formula found
Definition at line 142 of file mmm2d.c.
Referenced by MMM2D_tune_far().
| #define ERROR_ICL 7 |
| #define ERROR_LARGE 1 |
return codes for MMM2D_tune_near and MMM2D_tune_far
cell too large
Definition at line 134 of file mmm2d.c.
Referenced by MMM2D_tune_near().
| #define ERROR_POLY 4 |
no reasonable polygamma cutoff found
Definition at line 140 of file mmm2d.c.
Referenced by MMM2D_tune_near().
| #define ERROR_SMALL 6 |
| #define FARRELPREC 1e-6 |
internal relative precision of far formula.
This controls how many p,q vectors are done at once. This has nothing to do with the effective precision, but rather controls how different values can be we add up without loosing the smallest values. In principle one could choose smaller values, but that would not make things faster
Definition at line 91 of file mmm2d.c.
Referenced by MMM2D_add_far().
| #define LOG_FORCES | ( | x | ) |
if you define this, the Besselfunctions are calculated up to machine precision, otherwise 10^-14, which should be definitely enough for daily life.
Definition at line 61 of file mmm2d.c.
Referenced by add_P_force(), add_PQ_force(), add_Q_force(), and add_z_force().
| #define MAXIMAL_B_CUT 50 |
Largest reasonable cutoff for Bessel function.
The Bessel functions are quite slow, so do not make too large.
Definition at line 79 of file mmm2d.c.
Referenced by MMM2D_tune_near().
| #define MAXIMAL_FAR_CUT 100 |
Largest reasonable cutoff for far formula.
A double cannot overflow with this value.
Definition at line 75 of file mmm2d.c.
Referenced by MMM2D_tune_far().
| #define MAXIMAL_POLYGAMMA 100 |
Largest reasonable order of polygamma series.
These are pretty fast, so use more of them. Also, the real cutoff is determined at run time, so normally we are faster
Definition at line 84 of file mmm2d.c.
Referenced by MMM2D_tune_near().
| #define POQECM 3 |
Definition at line 162 of file mmm2d.c.
Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().
| #define POQECP 1 |
Definition at line 160 of file mmm2d.c.
Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().
| #define POQESM 2 |
Definition at line 161 of file mmm2d.c.
Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().
| #define POQESP 0 |
Definition at line 159 of file mmm2d.c.
Referenced by add_P_force(), add_Q_force(), P_energy(), Q_energy(), setup_P(), and setup_Q().
| #define PQECCM 7 |
Definition at line 171 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQECCP 3 |
Definition at line 167 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQECSM 6 |
Definition at line 170 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQECSP 2 |
Definition at line 166 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQESCM 5 |
Definition at line 169 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQESCP 1 |
Definition at line 165 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQESSM 4 |
Definition at line 168 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define PQESSP 0 |
Definition at line 164 of file mmm2d.c.
Referenced by add_PQ_force(), PQ_energy(), and setup_PQ().
| #define QQEQQM 1 |
Definition at line 174 of file mmm2d.c.
Referenced by add_z_force(), and setup_z_force().
| #define QQEQQP 0 |
Definition at line 173 of file mmm2d.c.
Referenced by add_z_force(), and setup_z_force().
| MDINLINE double* abventry | ( | double * | p, |
| int | index, | ||
| int | e_size | ||
| ) |
Definition at line 397 of file mmm2d.c.
Referenced by clear_image_contributions(), distribute(), gather_image_contributions(), setup_P(), setup_PQ(), setup_Q(), setup_z_energy(), and setup_z_force().
| static void add_force_contribution | ( | int | p, |
| int | q | ||
| ) | [static] |
Definition at line 1193 of file mmm2d.c.
References add_P_force(), add_PQ_force(), add_Q_force(), add_z_force(), C_2PI, checkpoint, clear_image_contributions(), MMM2D_struct::dielectric_contrast_on, distribute(), gather_image_contributions(), layer_h, setup_P(), setup_PQ(), setup_Q(), setup_z_force(), SQR(), ux, and uy.
Referenced by MMM2D_add_far().
| void add_mmm2d_coulomb_pair_force | ( | double | charge_factor, |
| double | d[3], | ||
| double | dl2, | ||
| double | dl, | ||
| double | force[3] | ||
| ) |
pairwise calculated parts of MMM2D force (near neighbors)
Definition at line 1511 of file mmm2d.c.
References box_l, C_2PI, COMPLEX_FAC, COMPLEX_STEP, complexCutoff, coulomb, IntList::e, DoubleList::e, ERROR_SPRINTF, i, K0, K1, LPK01(), mod_psi_even(), mod_psi_odd(), IntList::n, n_modPsi, part_error, Coulomb_parameters::prefactor, runtime_error(), ux, ux2, uy, and uy2.
Referenced by add_non_bonded_pair_force(), add_non_bonded_pair_force_iccp3m(), and MMM2D_dielectric_layers_force_contribution().
| static void add_P_force | ( | ) | [static] |
Definition at line 909 of file mmm2d.c.
References block(), cells, ParticleForce::f, Particle::f, gblcblk, i, LOG_FORCES, ParticleList::n, n_layers, part, ParticleList::part, partblk, POQECM, POQECP, POQESM, POQESP, and this_node.
Referenced by add_force_contribution().
| static void add_PQ_force | ( | int | p, |
| int | q, | ||
| double | omega | ||
| ) | [static] |
Definition at line 1127 of file mmm2d.c.
References block(), C_2PI, cells, ParticleForce::f, Particle::f, gblcblk, i, LOG_FORCES, ParticleList::n, n_layers, part, ParticleList::part, partblk, PQECCM, PQECCP, PQECSM, PQECSP, PQESCM, PQESCP, PQESSM, PQESSP, this_node, ux, and uy.
Referenced by add_force_contribution().
| static void add_Q_force | ( | ) | [static] |
Definition at line 959 of file mmm2d.c.
References block(), cells, ParticleForce::f, Particle::f, gblcblk, i, LOG_FORCES, ParticleList::n, n_layers, part, ParticleList::part, partblk, POQECM, POQECP, POQESM, POQESP, and this_node.
Referenced by add_force_contribution().
| MDINLINE void add_vec | ( | double * | pdc_d, |
| double * | pdc_s1, | ||
| double * | pdc_s2, | ||
| int | size | ||
| ) |
| static void add_z_force | ( | ) | [static] |
Definition at line 626 of file mmm2d.c.
References block(), cells, ParticleForce::f, Particle::f, gblcblk, i, LOG_FORCES, ParticleList::n, n_layers, Particle::p, part, ParticleList::part, ParticleProperties::q, QQEQQM, QQEQQP, and this_node.
Referenced by add_force_contribution().
| MDINLINE void addscale_vec | ( | double * | pdc_d, |
| double | scale, | ||
| double * | pdc_s1, | ||
| double * | pdc_s2, | ||
| int | size | ||
| ) |
| MDINLINE double* blwentry | ( | double * | p, |
| int | index, | ||
| int | e_size | ||
| ) |
Definition at line 392 of file mmm2d.c.
Referenced by clear_image_contributions(), distribute(), gather_image_contributions(), setup_P(), setup_PQ(), setup_Q(), setup_z_energy(), and setup_z_force().
| MDINLINE double calc_mmm2d_copy_pair_energy | ( | double | d[3] | ) |
Definition at line 1683 of file mmm2d.c.
References box_l, C_2PI, COMPLEX_FAC, COMPLEX_STEP, complexCutoff, IntList::e, DoubleList::e, K0, M_PI, mod_psi_even(), IntList::n, n_modPsi, part_error, ux, ux2, uy, and uy2.
Referenced by mmm2d_coulomb_pair_energy(), and MMM2D_self_energy().
| void clear_image_contributions | ( | int | size | ) | [static] |
clear the image contributions if there is no dielectric contrast and no image charges
Definition at line 404 of file mmm2d.c.
References abventry(), blwentry(), clear_vec(), gblcblk, n_layers, n_nodes, and this_node.
Referenced by add_force_contribution(), and energy_contribution().
| MDINLINE void clear_vec | ( | double * | pdc, |
| int | size | ||
| ) |
| MDINLINE void copy_vec | ( | double * | pdc_d, |
| double * | pdc_s, | ||
| int | size | ||
| ) |
| void distribute | ( | int | size, |
| double | fac | ||
| ) | [static] |
spread the top/bottom sums
Definition at line 434 of file mmm2d.c.
References abventry(), addscale_vec(), blwentry(), comm_cart, copy_vec(), gblcblk, lclcblk, MPI_DOUBLE, MPI_Recv(), MPI_Send(), n_layers, n_nodes, and this_node.
Referenced by add_force_contribution(), and energy_contribution().
| static double energy_contribution | ( | int | p, |
| int | q | ||
| ) | [static] |
Definition at line 1249 of file mmm2d.c.
References C_2PI, checkpoint, clear_image_contributions(), MMM2D_struct::dielectric_contrast_on, distribute(), gather_image_contributions(), layer_h, P_energy(), PQ_energy(), Q_energy(), setup_P(), setup_PQ(), setup_Q(), setup_z_energy(), SQR(), ux, uy, and z_energy().
Referenced by MMM2D_add_far().
| void gather_image_contributions | ( | int | size | ) | [static] |
gather the informations for the far away image charges
Definition at line 416 of file mmm2d.c.
References abventry(), blwentry(), comm_cart, copy_vec(), gblcblk, lclimge, MPI_Allreduce(), MPI_DOUBLE, MPI_SUM, n_layers, n_nodes, and this_node.
Referenced by add_force_contribution(), and energy_contribution().
| double MMM2D_add_far | ( | int | f, |
| int | e | ||
| ) |
the general long range force/energy calculation
Definition at line 1302 of file mmm2d.c.
References add_force_contribution(), box_l, C_2PI, energy_contribution(), MMM2D_struct::far_cut, MMM2D_struct::far_cut2, FARRELPREC, free, malloc, n_scxcache, n_scycache, prepare_scx_cache(), prepare_scy_cache(), self_energy, SQR(), ux, ux2, uy2, and uz.
Referenced by MMM2D_add_far_force(), and MMM2D_far_energy().
| double mmm2d_coulomb_pair_energy | ( | double | charge_factor, |
| double | dv[3], | ||
| double | d2, | ||
| double | d | ||
| ) |
pairwise calculated parts of MMM2D force (near neighbors)
Definition at line 1796 of file mmm2d.c.
References calc_mmm2d_copy_pair_energy(), coulomb, and Coulomb_parameters::prefactor.
Referenced by add_non_bonded_pair_energy(), and MMM2D_dielectric_layers_energy_contribution().
| double MMM2D_dielectric_layers_energy_contribution | ( | ) |
energy contribution from dielectric layers
Definition at line 2022 of file mmm2d.c.
References box_l, C_2PI, cells, coulomb, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::dielectric_contrast_on, i, layered_get_mi_vector(), mmm2d_coulomb_pair_energy(), ParticleList::n, n_layers, n_nodes, ParticlePosition::p, Particle::p, ParticleList::part, Coulomb_parameters::prefactor, ParticleProperties::q, Particle::r, sqrlen(), this_node, ux, and uy.
Referenced by calc_long_range_energies().
| void MMM2D_dielectric_layers_force_contribution | ( | ) |
force contribution from dielectric layers
Definition at line 1962 of file mmm2d.c.
References add_mmm2d_coulomb_pair_force(), box_l, cells, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::dielectric_contrast_on, ParticleForce::f, Particle::f, i, layered_get_mi_vector(), ParticleList::n, n_layers, n_nodes, ParticlePosition::p, Particle::p, ParticleList::part, ParticleProperties::q, Particle::r, sqrlen(), and this_node.
Referenced by calc_long_range_forces(), and calc_long_range_forces_iccp3m().
| void MMM2D_init | ( | ) |
initialize the MMM2D constants
Definition at line 1910 of file mmm2d.c.
References cell_structure, CELL_STRUCTURE_LAYERED, CELL_STRUCTURE_NSQUARE, coulomb, COULOMB_NONE, MMM2D_struct::dielectric_contrast_on, err, ERROR_SPRINTF, MMM2D_struct::far_calculated, MMM2D_struct::far_cut, MMM2D_struct::maxPWerror, Coulomb_parameters::method, mmm2d_errors, MMM2D_sanity_checks(), MMM2D_setup_constants(), MMM2D_tune_far(), MMM2D_tune_near(), n_nodes, runtime_error(), and CellStructure::type.
Referenced by on_boxl_change(), on_cell_structure_change(), and on_coulomb_change().
| void MMM2D_on_resort_particles | ( | ) |
if the number of particles has changed (even per node), the particle buffers for the coefficients have to be resized.
Definition at line 1944 of file mmm2d.c.
References cell_structure, CELL_STRUCTURE_LAYERED, cells_get_n_particles(), MMM2D_struct::far_cut, gblcblk, lclcblk, MMM2D_self_energy(), n_cells, n_scxcache, n_scycache, partblk, realloc, scxcache, scycache, CellStructure::type, ux, and uy.
Referenced by on_resort_particles().
| int MMM2D_sanity_checks | ( | ) |
check that MMM2D can run with the current parameters
Definition at line 1891 of file mmm2d.c.
References cell_structure, CELL_STRUCTURE_LAYERED, CELL_STRUCTURE_NSQUARE, ERROR_SPRINTF, PERIODIC, runtime_error(), and CellStructure::type.
Referenced by check_obs_calc_initialized(), and MMM2D_init().
| void MMM2D_self_energy | ( | ) |
energy of all local particles with their copies
Definition at line 1807 of file mmm2d.c.
References calc_mmm2d_copy_pair_energy(), CellPList::cell, coulomb, i, local_cells, CellPList::n, ParticleList::n, part, ParticleList::part, Coulomb_parameters::prefactor, self_energy, and SQR().
Referenced by MMM2D_on_resort_particles().
| int MMM2D_set_params | ( | double | maxPWerror, |
| double | far_cut, | ||
| double | delta_top, | ||
| double | delta_mid | ||
| ) |
set parameters for MMM2D.
This assumes that the particles do NOT leave the box. For the near formula (nsquared cell structure), precision might be lost, while the far formula might have problems with overflows.
| maxPWerror | the maximal error for the pairwise interactions. Both for potential and force components. The potential is therefore always slightly more precise |
| far_cut | sets the cutoff for the far formula in inverse lengths. If -1, the far cutoff is determined by maxPWerror. Manual setting is probably only good for testing |
| delta_top | dielectric contrast at top of the simulation box |
| delta_mid | dielectric contrast in the middle of the simulation box |
Definition at line 1835 of file mmm2d.c.
References cell_structure, CELL_STRUCTURE_LAYERED, CELL_STRUCTURE_NSQUARE, coulomb, COULOMB_MMM2D, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::delta_mult, MMM2D_struct::dielectric_contrast_on, err, ERROR_ICL, ES_ERROR, ES_OK, MMM2D_struct::far_calculated, MMM2D_struct::far_cut, MMM2D_struct::far_cut2, MMM2D_struct::maxPWerror, Coulomb_parameters::method, MMM2D_setup_constants(), MMM2D_tune_far(), MMM2D_tune_near(), mpi_bcast_coulomb_params(), n_nodes, SQR(), and CellStructure::type.
Referenced by tclcommand_inter_coulomb_parse_mmm2d().
| void MMM2D_setup_constants | ( | ) |
Definition at line 262 of file mmm2d.c.
References box_l, cell_structure, CELL_STRUCTURE_LAYERED, CELL_STRUCTURE_NSQUARE, errexit(), layer_h, max_near, min_far, skin, this_node, CellStructure::type, ux, ux2, uy, uy2, and uz.
Referenced by MMM2D_init(), and MMM2D_set_params().
| static int MMM2D_tune_far | ( | double | error | ) | [static] |
cutoff error setup.
Returns error code
Definition at line 1373 of file mmm2d.c.
References C_2PI, dmin(), err, ERROR_FARC, MMM2D_struct::far_cut, MMM2D_struct::far_cut2, layer_h, M_PI, MAXIMAL_FAR_CUT, min_far, SQR(), ux, and uy.
Referenced by MMM2D_init(), and MMM2D_set_params().
| static int MMM2D_tune_near | ( | double | error | ) | [static] |
cutoff error setup.
Returns error code
Definition at line 1397 of file mmm2d.c.
References box_l, C_2PI, COMPLEX_FAC, COMPLEX_STEP, complexCutoff, create_mod_psi_up_to(), dmax(), IntList::e, err, ERROR_BESSEL, ERROR_BOXL, ERROR_LARGE, ERROR_POLY, ERROR_SMALL, i, K1, M_PI, M_SQRT2, max_near, MAXIMAL_B_CUT, MAXIMAL_POLYGAMMA, min_far, mod_psi_even(), IntList::n, part_error, prepareBernoulliNumbers(), realloc_intlist(), SQR(), ux, and uy.
Referenced by MMM2D_init(), and MMM2D_set_params().
| static double P_energy | ( | double | omega | ) | [static] |
| static double PQ_energy | ( | double | omega | ) | [static] |
| static void prepare_scx_cache | ( | ) | [static] |
sin/cos storage
Definition at line 290 of file mmm2d.c.
References C_2PI, cells, i, ParticleList::n, n_layers, n_localpart, n_scxcache, ParticlePosition::p, part, ParticleList::part, Particle::r, scxcache, and ux.
Referenced by MMM2D_add_far().
| static void prepare_scy_cache | ( | ) | [static] |
Definition at line 313 of file mmm2d.c.
References C_2PI, cells, i, ParticleList::n, n_layers, n_localpart, n_scycache, ParticlePosition::p, part, ParticleList::part, Particle::r, scycache, and uy.
Referenced by MMM2D_add_far().
| static void prepareBernoulliNumbers | ( | int | nmax | ) | [static] |
complex evaluation
Definition at line 1469 of file mmm2d.c.
References DoubleList::e, DoubleList::n, realloc_doublelist(), and uy.
Referenced by MMM2D_tune_near().
| static double Q_energy | ( | double | omega | ) | [static] |
| MDINLINE void scale_vec | ( | double | scale, |
| double * | pdc, | ||
| int | size | ||
| ) |
| static void setup_P | ( | int | p, |
| double | omega, | ||
| double | fac | ||
| ) | [static] |
p=0 per frequency code
Definition at line 703 of file mmm2d.c.
References abventry(), add_vec(), block(), blwentry(), box_l, cells, clear_vec(), coulomb, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::delta_mult, MMM2D_struct::dielectric_contrast_on, i, layer_h, lclcblk, lclimge, M_PI, my_left, ParticleList::n, n_layers, n_nodes, Particle::p, part, ParticleList::part, partblk, POQECM, POQECP, POQESM, POQESP, Coulomb_parameters::prefactor, ParticleProperties::q, scale_vec(), scxcache, this_node, ux, and uy.
Referenced by add_force_contribution(), and energy_contribution().
| static void setup_PQ | ( | int | p, |
| int | q, | ||
| double | omega, | ||
| double | fac | ||
| ) | [static] |
p,q <> 0 per frequency code
Definition at line 1015 of file mmm2d.c.
References abventry(), add_vec(), block(), blwentry(), box_l, cells, clear_vec(), coulomb, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::delta_mult, MMM2D_struct::dielectric_contrast_on, i, layer_h, lclcblk, lclimge, M_PI, my_left, ParticleList::n, n_layers, n_localpart, n_nodes, Particle::p, part, ParticleList::part, partblk, PQECCM, PQECCP, PQECSM, PQECSP, PQESCM, PQESCP, PQESSM, PQESSP, Coulomb_parameters::prefactor, ParticleProperties::q, scale_vec(), scxcache, scycache, this_node, ux, and uy.
Referenced by add_force_contribution(), and energy_contribution().
| static void setup_Q | ( | int | q, |
| double | omega, | ||
| double | fac | ||
| ) | [static] |
q=0 per frequency code
Definition at line 812 of file mmm2d.c.
References abventry(), add_vec(), block(), blwentry(), box_l, cells, clear_vec(), coulomb, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::delta_mult, MMM2D_struct::dielectric_contrast_on, i, layer_h, lclcblk, lclimge, M_PI, my_left, ParticleList::n, n_layers, n_nodes, Particle::p, part, ParticleList::part, partblk, POQECM, POQECP, POQESM, POQESP, Coulomb_parameters::prefactor, ParticleProperties::q, scale_vec(), scycache, this_node, ux, and uy.
Referenced by add_force_contribution(), and energy_contribution().
| static void setup_z_energy | ( | ) | [static] |
Definition at line 648 of file mmm2d.c.
References ABEQQP, ABEQZP, abventry(), blwentry(), C_2PI, cells, clear_vec(), copy_vec(), coulomb, i, lclcblk, ParticleList::n, n_layers, n_nodes, ParticlePosition::p, Particle::p, part, ParticleList::part, Coulomb_parameters::prefactor, ParticleProperties::q, Particle::r, scale_vec(), this_node, ux, and uy.
Referenced by energy_contribution().
| static void setup_z_force | ( | ) | [static] |
2 pi |z| code
Definition at line 545 of file mmm2d.c.
References abventry(), blwentry(), C_2PI, cells, clear_vec(), coulomb, MMM2D_struct::delta_mid_bot, MMM2D_struct::delta_mid_top, MMM2D_struct::delta_mult, MMM2D_struct::dielectric_contrast_on, i, lclcblk, lclimge, ParticleList::n, n_layers, n_nodes, Particle::p, part, ParticleList::part, Coulomb_parameters::prefactor, ParticleProperties::q, QQEQQM, QQEQQP, scale_vec(), this_node, ux, and uy.
Referenced by add_force_contribution().
| static double z_energy | ( | ) | [static] |
Definition at line 680 of file mmm2d.c.
References ABEQQM, ABEQQP, ABEQZM, ABEQZP, block(), cells, gblcblk, i, ParticleList::n, n_layers, ParticlePosition::p, Particle::p, part, ParticleList::part, ParticleProperties::q, and Particle::r.
Referenced by energy_contribution().
IntList besselCutoff = {NULL, 0, 0} [static] |
DoubleList bon = {NULL, 0, 0} [static] |
int complexCutoff[COMPLEX_STEP+1] [static] |
cutoffs for the complex sum
Definition at line 110 of file mmm2d.c.
Referenced by add_mmm2d_coulomb_pair_force(), calc_mmm2d_copy_pair_energy(), and MMM2D_tune_near().
double* gblcblk = NULL [static] |
collected data from the cells above the top neighbor of a cell rsp.
below the bottom neighbor (P=below, M=above, as the signs in the exp).
Definition at line 193 of file mmm2d.c.
Referenced by add_P_force(), add_PQ_force(), add_Q_force(), add_z_force(), clear_image_contributions(), distribute(), gather_image_contributions(), MMM2D_on_resort_particles(), P_energy(), PQ_energy(), Q_energy(), and z_energy().
double* lclcblk = NULL [static] |
for all local cells including ghosts
Definition at line 189 of file mmm2d.c.
Referenced by distribute(), MMM2D_on_resort_particles(), setup_P(), setup_PQ(), setup_Q(), setup_z_energy(), and setup_z_force().
double lclimge[8] [static] |
contribution from the image charges
Definition at line 196 of file mmm2d.c.
Referenced by gather_image_contributions(), setup_P(), setup_PQ(), setup_Q(), and setup_z_force().
double max_near [static] |
maximal z for near formula, minimal z for far formula.
Is identical in the theory, but with the verlet tricks this is no longer true, the skin has to be added/subtracted
Definition at line 123 of file mmm2d.c.
Referenced by MMM2D_setup_constants(), and MMM2D_tune_near().
| double min_far |
Definition at line 123 of file mmm2d.c.
Referenced by MMM2D_setup_constants(), MMM2D_tune_far(), and MMM2D_tune_near().
| char const* mmm2d_errors[] |
{
"ok",
"Layer height too large for MMM2D near formula, increase n_layers",
"box_l[1]/box_l[0] too large for MMM2D near formula, please exchange x and y",
"Could find not reasonable Bessel cutoff. Please decrease n_layers or the error bound",
"Could find not reasonable Polygamma cutoff. Consider exchanging x and y",
"Far cutoff too large, decrease the error bound",
"Layer height too small for MMM2D far formula, decrease n_layers or skin",
"IC requires layered cellsystem with more than 3 layers",
}
error messages, see above
Definition at line 41 of file mmm2d.c.
Referenced by MMM2D_init(), and tclcommand_inter_coulomb_parse_mmm2d().
| MMM2D_struct mmm2d_params = { 1e100, 10, 1, 0, 0, 1, 1, 1 } |
Definition at line 129 of file mmm2d.c.
Referenced by mpi_bcast_coulomb_params_slave(), and tclprint_to_result_MMM2D().
int n_localpart = 0 [static] |
number of local particles
Definition at line 184 of file mmm2d.c.
Referenced by prepare_scx_cache(), prepare_scy_cache(), and setup_PQ().
int n_scxcache [static] |
Definition at line 204 of file mmm2d.c.
Referenced by MMM2D_add_far(), MMM2D_on_resort_particles(), and prepare_scx_cache().
int n_scycache [static] |
Definition at line 207 of file mmm2d.c.
Referenced by MMM2D_add_far(), MMM2D_on_resort_particles(), and prepare_scy_cache().
double part_error [static] |
up to that error the sums in the NF are evaluated
Definition at line 104 of file mmm2d.c.
Referenced by add_mmm2d_coulomb_pair_force(), calc_mmm2d_copy_pair_energy(), and MMM2D_tune_near().
double* partblk = NULL [static] |
temporary buffers for product decomposition
Definition at line 187 of file mmm2d.c.
Referenced by add_P_force(), add_PQ_force(), add_Q_force(), MMM2D_on_resort_particles(), P_energy(), PQ_energy(), Q_energy(), setup_P(), setup_PQ(), and setup_Q().
SCCache* scxcache = NULL [static] |
sin/cos caching
Definition at line 203 of file mmm2d.c.
Referenced by MMM2D_on_resort_particles(), prepare_scx_cache(), setup_P(), and setup_PQ().
SCCache* scycache = NULL [static] |
sin/cos caching
Definition at line 206 of file mmm2d.c.
Referenced by MMM2D_on_resort_particles(), prepare_scy_cache(), setup_PQ(), and setup_Q().
double self_energy [static] |
Definition at line 127 of file mmm2d.c.
Referenced by MMM2D_add_far(), and MMM2D_self_energy().
double ux [static] |
inverse box dimensions
Definition at line 116 of file mmm2d.c.
Referenced by add_force_contribution(), add_mmm2d_coulomb_pair_force(), add_PQ_force(), calc_mmm2d_copy_pair_energy(), energy_contribution(), MMM2D_add_far(), MMM2D_dielectric_layers_energy_contribution(), MMM2D_on_resort_particles(), MMM2D_setup_constants(), MMM2D_tune_far(), MMM2D_tune_near(), prepare_scx_cache(), setup_P(), setup_PQ(), setup_Q(), setup_z_energy(), and setup_z_force().
1.7.5.1