LAMMPS (3 Nov 2022)
boundary p p p # finite field, fully periodic
kspace_style ewald/electrode 1.0e-7

include "settings.mod" # styles, computes, groups and fixes
# set boundary in main script because ffield is periodic
units real
# distribute electrode atoms among all processors:
if "$(extract_setting(world_size) % 2) == 0" then "processors * * 2"

atom_style full
pair_style lj/cut/coul/long 14
# kspace_style and _modify in main script to test different approaches

read_data "data.au-vac"
Reading data file ...
  orthogonal box = (0.285001 -0.368323 -1.043333) to (25.325067 24.671743 43.303354)
  1 by 1 by 1 MPI processor grid
  reading atoms ...
  288 atoms
  reading velocities ...
  288 velocities
Finding 1-2 1-3 1-4 neighbors ...
  special bond factors lj:    0        0        0       
  special bond factors coul:  0        0        0       
     0 = max # of 1-2 neighbors
     0 = max # of 1-3 neighbors
     0 = max # of 1-4 neighbors
     1 = max # of special neighbors
  special bonds CPU = 0.001 seconds
  read_data CPU = 0.004 seconds

group bot molecule 1
144 atoms in group bot
group top molecule 2
144 atoms in group top

# ramping potential difference
variable v equal ramp(0,2)

# get electrode charges
variable q atom q
compute qbot bot reduce sum v_q
compute qtop top reduce sum v_q

# get theoretical charges:
# calculate distance dz between electrodes
compute zbot bot reduce max z
compute ztop top reduce min z
variable dz equal c_ztop-c_zbot

# calculate theoretical capacitance as eps0 * area / dz
variable eps0 equal 55.26349406/10000 # epsilon zero
variable capac equal "v_eps0 * lx * ly / v_dz"

# calculate theoretical charges and deviation of constant potential charges from theory
variable qtheory equal "v_capac * v_v"
variable percdev equal "100 * (c_qtop - v_qtheory) / (v_qtheory + 1e-9)" # avoid divide-by-zero

# constant potential electrodes with ramping potential difference
fix conp bot electrode/conp 0 1.979 couple top v_v symm on ffield yes
288 atoms in group conp_group

thermo 1
# thermo: step, imposed potential, bottom charge, top charge, theory charge, percent deviation
thermo_style custom step v_v c_qbot c_qtop v_qtheory v_percdev

run 10

CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE

Your simulation uses code contributions which should be cited:

- fix electrode command:

@article{Ahrens2022
author = {Ahrens-Iwers, Ludwig J.V. and Janssen, Mahijs and Tee, Shern R. and Mei{\ss}ner, Robert H.},
doi = {10.1063/5.0099239},
title = {{ELECTRODE: An electrochemistry package for LAMMPS}},
journal = {The Journal of Chemical Physics},
year = {2022}
volume = {157},
pages = {084801},
}
CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE

WARNING: No fixes with time integration, atoms won't move (src/verlet.cpp:60)
Ewald/electrode initialization ...
WARNING: System is not charge neutral, net charge = 0.000219 (src/kspace.cpp:327)
  using 12-bit tables for long-range coulomb (src/kspace.cpp:342)
  G vector (1/distance) = 0.15955673
  estimated absolute RMS force accuracy = 4.0330163e-05
  estimated relative force accuracy = 1.2145309e-07
  KSpace vectors: actual max1d max3d = 95 5 665
                  kxmax kymax kzmax  = 3 3 5
Generated 1 of 1 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
  update: every = 1 steps, delay = 0 steps, check = yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 16
  ghost atom cutoff = 16
  binsize = 8, bins = 4 4 6
  2 neighbor lists, perpetual/occasional/extra = 2 0 0
  (1) pair lj/cut/coul/long, perpetual
      attributes: half, newton on
      pair build: half/bin/newton
      stencil: half/bin/3d
      bin: standard
  (2) fix electrode/conp, perpetual, copy from (1)
      attributes: half, newton on
      pair build: copy
      stencil: none
      bin: none
Per MPI rank memory allocation (min/avg/max) = 16.02 | 16.02 | 16.02 Mbytes
   Step          v_v           c_qbot         c_qtop       v_qtheory      v_percdev   
         0   0              0              0              0              0            
         1   0.2           -0.030908718    0.030908718    0.031376826   -1.491893     
         2   0.4           -0.061817435    0.061817435    0.062753652   -1.491893     
         3   0.6           -0.092726153    0.092726153    0.094130479   -1.491893     
         4   0.8           -0.12363487     0.12363487     0.1255073     -1.491893     
         5   1             -0.15454359     0.15454359     0.15688413    -1.491893     
         6   1.2           -0.18545231     0.18545231     0.18826096    -1.491893     
         7   1.4           -0.21636102     0.21636102     0.21963778    -1.491893     
         8   1.6           -0.24726974     0.24726974     0.25101461    -1.491893     
         9   1.8           -0.27817846     0.27817846     0.28239144    -1.491893     
        10   2             -0.30908718     0.30908718     0.31376826    -1.491893     
Loop time of 0.0147727 on 1 procs for 10 steps with 288 atoms

Performance: 58.486 ns/day, 0.410 hours/ns, 676.926 timesteps/s, 194.955 katom-step/s
75.1% CPU use with 1 MPI tasks x no OpenMP threads

MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 0.0035163  | 0.0035163  | 0.0035163  |   0.0 | 23.80
Bond    | 9.61e-07   | 9.61e-07   | 9.61e-07   |   0.0 |  0.01
Kspace  | 0.0018156  | 0.0018156  | 0.0018156  |   0.0 | 12.29
Neigh   | 0          | 0          | 0          |   0.0 |  0.00
Comm    | 0.00012717 | 0.00012717 | 0.00012717 |   0.0 |  0.86
Output  | 0.00083495 | 0.00083495 | 0.00083495 |   0.0 |  5.65
Modify  | 0.0083949  | 0.0083949  | 0.0083949  |   0.0 | 56.83
Other   |            | 8.273e-05  |            |       |  0.56

Nlocal:            288 ave         288 max         288 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost:           2628 ave        2628 max        2628 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs:          26496 ave       26496 max       26496 min
Histogram: 1 0 0 0 0 0 0 0 0 0

Total # of neighbors = 26496
Ave neighs/atom = 92
Ave special neighs/atom = 0
Neighbor list builds = 0
Dangerous builds = 0
Total wall time: 0:00:00
