Ewald

class Ewald : public feasst::VisitModel

The Ewald summation accounts for the long-range nature of the electrostatic interaction by applying a Gaussian screening charge, computing a Fourier-space long-range component, and then correcting for the various spurious terms that are included in the Fourier summation, such as self and intra-particle.

See “Computer simulation of liquids” by M. P. Allen and D. J. Tildesley. The LAMMPS and DL_POLY manuals also include thorough descriptions of the Ewald summation.

Public Functions

Ewald(const argtype &args = argtype())

args:

  • tolerance: determine the alpha parameter and number of wave vectors by specifying the accuracy relative to the energy of two unit charges separated by a distance of one unit.

  • tolerance_num_sites: for setting parameters with the tolerance, optionally set the number of sites to be used for the parameter calculation rather than the currently existing number of sites (default).

  • alpha: optionally specify the alpha parameter in units of inverse length.

  • kxmax: optionally specify the maximum wave vectors in the first dimension.

  • kymax: same as above, but in the second dimension.

  • kzmax: same as above, but in the third dimension.

  • kmax_squared: optionally set the squared maximum integer wave vector for cubic domains only, which also sets kxmax, etc.

void tolerance_to_alpha_ks(const double tolerance, const Configuration &config, double *alpha, int *kxmax, int *kymax, int *kzmax)

Parameters
  • tolerance: Estimated tolerance for the energy. This is relative to the energy exerted by two unit charges separated by a distance of one unit.

  • alpha: Return the alpha

  • kxmax: Return the maximum number of Fourier vectors in the x dimension.

  • kymax: as above but in y

  • kzmax: as above but in z

Recommend an alpha parameter for Ewald as described and implemented in LAMMPS https://lammps.sandia.gov/doc/kspace_style.html https://doi.org/10.1080/08927029208049126 https://doi.org/10.1063/1.470043

void update_wave_vectors(const Configuration &config)

Precompute the wave vectors within cutoff, coefficients, and also resize the structure factors.

void init_wave_vector_storage(Configuration *config, const int group_index = 0)

Initialize custom site properties to store wave vector components.

void update_struct_fact_eik(const Select &selection, Configuration *config, std::vector<double> *struct_fact_real, std::vector<double> *struct_fact_imag)

Update the site-stored eik properties of the selection, and also the structure factor.

void precompute(Configuration *config)

Add “eik” to list of config’s excluded properties during selection updates.

void compute(ModelOneBody *model, const ModelParams &model_params, Configuration *config, const int group_index = 0)

Compute interactions of entire group in configuration from scratch. This is not optimized for smaller perturbations to the configuration.

void compute(ModelOneBody *model, const ModelParams &model_params, const Select &selection, Configuration *config, const int group_index)

Compute by selection is optimized for perturbations to the system. Contrary to short range interactions, in this case the energy of the entire system is computed from the structure factor. Thus, to get an energy contribution of a selection, one must take a difference between the configuration with and without the selection’s contributions to the structure factor.

For MonteCarlo trials, this means that the type of trial must be taken into consideration, which is provided via Select::trial_state().

For 0, “old”, first prepare to return the (previously computed) energy of the entire system, and then remove the structure factor contributions of the selection, without updating the selection’s eik. This assumes that there will be a follow up of exactly one 1, “move” state which will update the eik. Ewald is not currently supported with more than one step in TrialStage.

For 1, “move”, eik are updated and their contributions are added to the structure factor. Return the new system energy.

For 2, “remove”, remove the eik contributions to the structure factor without updating the eik. Return the old minus new energy.

For 3, “add”, eik are updated and their contributions are added to the structure factor. Return the new minus old energy.

void change_volume(const double delta_volume, const int dimension)

Change the volume.

double net_charge(const Configuration &config) const

Return the net charge of the configuration.