Merge branch 'develop' into collected-small-fixes
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#!/usr/env/python3
|
||||
|
||||
import sys
|
||||
import os.path as op
|
||||
import sys
|
||||
|
||||
|
||||
def rel_error(out, ref):
|
||||
@ -49,5 +49,5 @@ for label, ref, out in out_lines:
|
||||
error = rel_error(out, ref)
|
||||
lines.append(f"{label}: {out:.5f}, {error:.5f}\n")
|
||||
|
||||
with open("madelung.txt", 'a') as f:
|
||||
with open("madelung.txt", "a") as f:
|
||||
f.writelines(lines)
|
||||
|
||||
14
examples/PACKAGES/electrode/madelung/in.eta
Normal file
14
examples/PACKAGES/electrode/madelung/in.eta
Normal file
@ -0,0 +1,14 @@
|
||||
boundary p p f
|
||||
kspace_style ewald/electrode 1.0e-8
|
||||
kspace_modify slab 8.0 # ew3dc
|
||||
|
||||
include "settings.mod" # styles, computes, groups and fixes
|
||||
|
||||
thermo_style custom step pe c_qbot c_qtop
|
||||
fix feta all property/atom d_eta ghost on
|
||||
set group bot d_eta 2.0
|
||||
set group top d_eta 2.0
|
||||
fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta write_inv inv.csv write_vec vec.csv
|
||||
|
||||
run 0
|
||||
|
||||
14
examples/PACKAGES/electrode/madelung/in.eta_cg
Normal file
14
examples/PACKAGES/electrode/madelung/in.eta_cg
Normal file
@ -0,0 +1,14 @@
|
||||
boundary p p f
|
||||
kspace_style ewald/electrode 1.0e-8
|
||||
kspace_modify slab 8.0 # ew3dc
|
||||
|
||||
include "settings.mod" # styles, computes, groups and fixes
|
||||
|
||||
thermo_style custom step pe c_qbot c_qtop
|
||||
fix feta all property/atom d_eta ghost on
|
||||
set group bot d_eta 0.5
|
||||
set group top d_eta 3.0
|
||||
fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta algo cg 1e-6
|
||||
|
||||
run 0
|
||||
|
||||
14
examples/PACKAGES/electrode/madelung/in.eta_mix
Normal file
14
examples/PACKAGES/electrode/madelung/in.eta_mix
Normal file
@ -0,0 +1,14 @@
|
||||
boundary p p f
|
||||
kspace_style ewald/electrode 1.0e-8
|
||||
kspace_modify slab 8.0 # ew3dc
|
||||
|
||||
include "settings.mod" # styles, computes, groups and fixes
|
||||
|
||||
thermo_style custom step pe c_qbot c_qtop
|
||||
fix feta all property/atom d_eta ghost on
|
||||
set group bot d_eta 0.5
|
||||
set group top d_eta 3.0
|
||||
fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta write_inv inv.csv write_vec vec.csv
|
||||
|
||||
run 0
|
||||
|
||||
138
examples/PACKAGES/electrode/madelung/log.19Feb2024.eta.g++.1
Normal file
138
examples/PACKAGES/electrode/madelung/log.19Feb2024.eta.g++.1
Normal file
@ -0,0 +1,138 @@
|
||||
LAMMPS (21 Nov 2023 - Development - patch_21Nov2023-668-g5b6c0c6b56)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
boundary p p f
|
||||
kspace_style ewald/electrode 1.0e-8
|
||||
kspace_modify slab 8.0 # ew3dc
|
||||
|
||||
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 12
|
||||
|
||||
read_data "data.au-elyt"
|
||||
Reading data file ...
|
||||
orthogonal box = (0 0 -10) to (1 1 10)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
reading atoms ...
|
||||
4 atoms
|
||||
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.000 seconds
|
||||
read_data CPU = 0.003 seconds
|
||||
|
||||
group bot type 1
|
||||
1 atoms in group bot
|
||||
group top type 2
|
||||
1 atoms in group top
|
||||
|
||||
# get electrode charges
|
||||
variable q atom q
|
||||
compute qbot bot reduce sum v_q
|
||||
compute qtop top reduce sum v_q
|
||||
|
||||
compute compute_pe all pe
|
||||
variable vpe equal c_compute_pe
|
||||
variable charge equal c_qtop
|
||||
fix fxprint all print 1 "${vpe}, ${charge}" file "out.csv"
|
||||
|
||||
thermo_style custom step pe c_qbot c_qtop
|
||||
fix feta all property/atom d_eta ghost on
|
||||
set group bot d_eta 2.0
|
||||
Setting atom values ...
|
||||
1 settings made for d_eta
|
||||
set group top d_eta 2.0
|
||||
Setting atom values ...
|
||||
1 settings made for d_eta
|
||||
fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta write_inv inv.csv write_vec vec.csv
|
||||
2 atoms in group conp_group
|
||||
|
||||
run 0
|
||||
|
||||
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 ...
|
||||
using 12-bit tables for long-range coulomb (src/kspace.cpp:342)
|
||||
WARNING: For better accuracy use 'pair_modify table 0' (src/kspace.cpp:365)
|
||||
G vector (1/distance) = 0.32261103
|
||||
estimated absolute RMS force accuracy = 3.8272011e-06
|
||||
estimated relative force accuracy = 1.1525502e-08
|
||||
KSpace vectors: actual max1d max3d = 52 50 515150
|
||||
kxmax kymax kzmax = 1 1 50
|
||||
Generated 3 of 3 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 = 14
|
||||
ghost atom cutoff = 14
|
||||
binsize = 7, bins = 1 1 3
|
||||
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
|
||||
WARNING: Proc sub-domain size < neighbor skin, could lead to lost atoms (src/domain.cpp:965)
|
||||
139.943964815502, 0.279214485147238
|
||||
Per MPI rank memory allocation (min/avg/max) = 144.2 | 144.2 | 144.2 Mbytes
|
||||
Step PotEng c_qbot c_qtop
|
||||
0 139.94396 -0.27921449 0.27921449
|
||||
Loop time of 2.191e-06 on 1 procs for 0 steps with 4 atoms
|
||||
|
||||
91.3% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Bond | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Kspace | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Output | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Modify | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Other | | 2.191e-06 | | |100.00
|
||||
|
||||
Nlocal: 4 ave 4 max 4 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 3596 ave 3596 max 3596 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 4790 ave 4790 max 4790 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 4790
|
||||
Ave neighs/atom = 1197.5
|
||||
Ave special neighs/atom = 0
|
||||
Neighbor list builds = 0
|
||||
Dangerous builds = 0
|
||||
|
||||
Total wall time: 0:00:00
|
||||
139
examples/PACKAGES/electrode/madelung/log.19Feb2024.eta_cg.g++.1
Normal file
139
examples/PACKAGES/electrode/madelung/log.19Feb2024.eta_cg.g++.1
Normal file
@ -0,0 +1,139 @@
|
||||
LAMMPS (21 Nov 2023 - Development - patch_21Nov2023-668-g5b6c0c6b56)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
boundary p p f
|
||||
kspace_style ewald/electrode 1.0e-8
|
||||
kspace_modify slab 8.0 # ew3dc
|
||||
|
||||
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 12
|
||||
|
||||
read_data "data.au-elyt"
|
||||
Reading data file ...
|
||||
orthogonal box = (0 0 -10) to (1 1 10)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
reading atoms ...
|
||||
4 atoms
|
||||
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.000 seconds
|
||||
read_data CPU = 0.003 seconds
|
||||
|
||||
group bot type 1
|
||||
1 atoms in group bot
|
||||
group top type 2
|
||||
1 atoms in group top
|
||||
|
||||
# get electrode charges
|
||||
variable q atom q
|
||||
compute qbot bot reduce sum v_q
|
||||
compute qtop top reduce sum v_q
|
||||
|
||||
compute compute_pe all pe
|
||||
variable vpe equal c_compute_pe
|
||||
variable charge equal c_qtop
|
||||
fix fxprint all print 1 "${vpe}, ${charge}" file "out.csv"
|
||||
|
||||
thermo_style custom step pe c_qbot c_qtop
|
||||
fix feta all property/atom d_eta ghost on
|
||||
set group bot d_eta 0.5
|
||||
Setting atom values ...
|
||||
1 settings made for d_eta
|
||||
set group top d_eta 3.0
|
||||
Setting atom values ...
|
||||
1 settings made for d_eta
|
||||
fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta algo cg 1e-6
|
||||
2 atoms in group conp_group
|
||||
|
||||
run 0
|
||||
|
||||
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 ...
|
||||
using 12-bit tables for long-range coulomb (src/kspace.cpp:342)
|
||||
WARNING: For better accuracy use 'pair_modify table 0' (src/kspace.cpp:365)
|
||||
G vector (1/distance) = 0.32261103
|
||||
estimated absolute RMS force accuracy = 3.8272011e-06
|
||||
estimated relative force accuracy = 1.1525502e-08
|
||||
KSpace vectors: actual max1d max3d = 52 50 515150
|
||||
kxmax kymax kzmax = 1 1 50
|
||||
Generated 3 of 3 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 = 14
|
||||
ghost atom cutoff = 14
|
||||
binsize = 7, bins = 1 1 3
|
||||
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
|
||||
WARNING: Proc sub-domain size < neighbor skin, could lead to lost atoms (src/domain.cpp:965)
|
||||
165.519373910316, 0.29521534552818
|
||||
Per MPI rank memory allocation (min/avg/max) = 144.2 | 144.2 | 144.2 Mbytes
|
||||
Step PotEng c_qbot c_qtop
|
||||
0 165.51937 -0.29521535 0.29521535
|
||||
Loop time of 2.797e-06 on 1 procs for 0 steps with 4 atoms
|
||||
|
||||
71.5% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Bond | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Kspace | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Output | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Modify | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Other | | 2.797e-06 | | |100.00
|
||||
|
||||
Nlocal: 4 ave 4 max 4 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 3596 ave 3596 max 3596 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 4790 ave 4790 max 4790 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 4790
|
||||
Ave neighs/atom = 1197.5
|
||||
Ave special neighs/atom = 0
|
||||
Neighbor list builds = 0
|
||||
Dangerous builds = 0
|
||||
|
||||
Average conjugate gradient steps: 1
|
||||
Total wall time: 0:00:00
|
||||
138
examples/PACKAGES/electrode/madelung/log.19Feb2024.eta_mix.g++.1
Normal file
138
examples/PACKAGES/electrode/madelung/log.19Feb2024.eta_mix.g++.1
Normal file
@ -0,0 +1,138 @@
|
||||
LAMMPS (21 Nov 2023 - Development - patch_21Nov2023-668-g5b6c0c6b56)
|
||||
using 1 OpenMP thread(s) per MPI task
|
||||
boundary p p f
|
||||
kspace_style ewald/electrode 1.0e-8
|
||||
kspace_modify slab 8.0 # ew3dc
|
||||
|
||||
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 12
|
||||
|
||||
read_data "data.au-elyt"
|
||||
Reading data file ...
|
||||
orthogonal box = (0 0 -10) to (1 1 10)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
reading atoms ...
|
||||
4 atoms
|
||||
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.000 seconds
|
||||
read_data CPU = 0.003 seconds
|
||||
|
||||
group bot type 1
|
||||
1 atoms in group bot
|
||||
group top type 2
|
||||
1 atoms in group top
|
||||
|
||||
# get electrode charges
|
||||
variable q atom q
|
||||
compute qbot bot reduce sum v_q
|
||||
compute qtop top reduce sum v_q
|
||||
|
||||
compute compute_pe all pe
|
||||
variable vpe equal c_compute_pe
|
||||
variable charge equal c_qtop
|
||||
fix fxprint all print 1 "${vpe}, ${charge}" file "out.csv"
|
||||
|
||||
thermo_style custom step pe c_qbot c_qtop
|
||||
fix feta all property/atom d_eta ghost on
|
||||
set group bot d_eta 0.5
|
||||
Setting atom values ...
|
||||
1 settings made for d_eta
|
||||
set group top d_eta 3.0
|
||||
Setting atom values ...
|
||||
1 settings made for d_eta
|
||||
fix conp bot electrode/conp 0 2 couple top 1 symm on eta d_eta write_inv inv.csv write_vec vec.csv
|
||||
2 atoms in group conp_group
|
||||
|
||||
run 0
|
||||
|
||||
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 ...
|
||||
using 12-bit tables for long-range coulomb (src/kspace.cpp:342)
|
||||
WARNING: For better accuracy use 'pair_modify table 0' (src/kspace.cpp:365)
|
||||
G vector (1/distance) = 0.32261103
|
||||
estimated absolute RMS force accuracy = 3.8272011e-06
|
||||
estimated relative force accuracy = 1.1525502e-08
|
||||
KSpace vectors: actual max1d max3d = 52 50 515150
|
||||
kxmax kymax kzmax = 1 1 50
|
||||
Generated 3 of 3 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 = 14
|
||||
ghost atom cutoff = 14
|
||||
binsize = 7, bins = 1 1 3
|
||||
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
|
||||
WARNING: Proc sub-domain size < neighbor skin, could lead to lost atoms (src/domain.cpp:965)
|
||||
165.519373910316, 0.295215345528172
|
||||
Per MPI rank memory allocation (min/avg/max) = 144.2 | 144.2 | 144.2 Mbytes
|
||||
Step PotEng c_qbot c_qtop
|
||||
0 165.51937 -0.29521535 0.29521535
|
||||
Loop time of 2.18e-06 on 1 procs for 0 steps with 4 atoms
|
||||
|
||||
91.7% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Bond | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Kspace | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Output | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Modify | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Other | | 2.18e-06 | | |100.00
|
||||
|
||||
Nlocal: 4 ave 4 max 4 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 3596 ave 3596 max 3596 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 4790 ave 4790 max 4790 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 4790
|
||||
Ave neighs/atom = 1197.5
|
||||
Ave special neighs/atom = 0
|
||||
Neighbor list builds = 0
|
||||
Dangerous builds = 0
|
||||
|
||||
Total wall time: 0:00:00
|
||||
@ -3,7 +3,6 @@
|
||||
import numpy as np
|
||||
from scipy.special import erf
|
||||
|
||||
ETA = 2
|
||||
SQRT2 = np.sqrt(2)
|
||||
COULOMB = 332.06371 # Coulomb constant in Lammps 'real' units
|
||||
QE2F = 23.060549
|
||||
@ -17,14 +16,14 @@ def lattice(length):
|
||||
return np.array(np.meshgrid(x, y)).T.reshape(-1, 2)
|
||||
|
||||
|
||||
def a_element(r):
|
||||
def a_element(r, eta):
|
||||
"""Coulomb contribution of two Gaussians"""
|
||||
return erf(ETA / SQRT2 * r) / r
|
||||
return erf(eta * r) / r
|
||||
|
||||
|
||||
def b_element(r, q):
|
||||
def b_element(r, q, eta):
|
||||
"""Coulomb contribution of a Gaussian with a point charge"""
|
||||
return q * erf(ETA * r) / r
|
||||
return q * erf(eta * r) / r
|
||||
|
||||
|
||||
a = 1 # nearest neighbor distance i.e. lattice constant / sqrt(2)
|
||||
@ -36,59 +35,65 @@ v = np.array([-0.5, 0.5]) * (QE2F / COULOMB)
|
||||
|
||||
# distances to images within electrode and to opposite electrode
|
||||
distances = a * np.linalg.norm(lattice(LENGTH), axis=1)
|
||||
opposite_distances = np.sqrt(np.square(distances) + distance_plates ** 2)
|
||||
opposite_distances = np.sqrt(np.square(distances) + distance_plates**2)
|
||||
|
||||
# self interaction and within original box
|
||||
A_11 = np.sqrt(2 / np.pi) * ETA
|
||||
A_12 = erf(ETA * distance_plates / SQRT2) / distance_plates
|
||||
for name, eta_elec in [("", [2.0, 2.0]), ("_eta_mix", [0.5, 3.0])]:
|
||||
eta_mix = np.prod(eta_elec) / np.sqrt(np.sum(np.square(eta_elec)))
|
||||
# self interaction and within original box
|
||||
A_11 = np.sqrt(2 / np.pi) * eta_elec[0]
|
||||
A_22 = np.sqrt(2 / np.pi) * eta_elec[1]
|
||||
A_12 = erf(eta_mix * distance_plates) / distance_plates
|
||||
|
||||
# interaction with periodic images
|
||||
A_11 += 4 * np.sum(a_element(distances))
|
||||
A_12 += 4 * np.sum(a_element(opposite_distances))
|
||||
A = np.array([[A_11, A_12], [A_12, A_11]])
|
||||
inv = np.linalg.inv(A)
|
||||
e = np.array([1, 1])
|
||||
inv -= np.matmul(inv, np.matmul(np.outer(e, e), inv)) / np.dot(e, np.dot(inv, e))
|
||||
# interaction with periodic images
|
||||
A_11 += 4 * np.sum(a_element(distances, eta_elec[0] / SQRT2))
|
||||
A_22 += 4 * np.sum(a_element(distances, eta_elec[1] / SQRT2))
|
||||
A_12 += 4 * np.sum(a_element(opposite_distances, eta_mix))
|
||||
A = np.array([[A_11, A_12], [A_12, A_22]])
|
||||
inv = np.linalg.inv(A)
|
||||
e = np.array([1, 1])
|
||||
inv -= np.matmul(inv, np.matmul(np.outer(e, e), inv)) / np.dot(e, np.dot(inv, e))
|
||||
|
||||
# electrode-electrolyte interaction
|
||||
b = []
|
||||
for x in x_elec:
|
||||
bi = 0
|
||||
for y, q in zip(x_elyt, q_elyt):
|
||||
d = abs(y - x)
|
||||
bi += b_element(d, q)
|
||||
image_distances = np.sqrt(np.square(distances) + d ** 2)
|
||||
bi += 4 * np.sum(b_element(image_distances, q))
|
||||
b.append(bi)
|
||||
b = np.array(b)
|
||||
# electrode-electrolyte interaction
|
||||
b = []
|
||||
for x, eta in zip(x_elec, eta_elec):
|
||||
bi = 0
|
||||
for y, q in zip(x_elyt, q_elyt):
|
||||
d = abs(y - x)
|
||||
bi += b_element(d, q, eta)
|
||||
image_distances = np.sqrt(np.square(distances) + d**2)
|
||||
bi += 4 * np.sum(b_element(image_distances, q, eta))
|
||||
b.append(bi)
|
||||
b = np.array(b)
|
||||
|
||||
# electrolyte-electrolyte energy
|
||||
elyt_11 = 4 * np.sum(1 / distances)
|
||||
distance_elyt = x_elyt[1] - x_elyt[0]
|
||||
elyt_12 = 1 / distance_elyt + 4 * np.sum(
|
||||
1 / np.sqrt(np.square(distances) + distance_elyt ** 2)
|
||||
)
|
||||
elyt = np.array([[elyt_11, elyt_12], [elyt_12, elyt_11]])
|
||||
energy_elyt = 0.5 * np.dot(q_elyt, np.dot(elyt, q_elyt))
|
||||
|
||||
# electrode charges and energy
|
||||
q = np.dot(inv, v - b)
|
||||
energy = COULOMB * (0.5 * np.dot(q, np.dot(A, q)) + np.dot(b, q) + energy_elyt)
|
||||
|
||||
print(
|
||||
"length, energy / kcal/mol, q1 / e, q2 / e, inv11 / A, inv12 / A, b1 / e/A, b2 / e/A"
|
||||
)
|
||||
print(
|
||||
", ".join(
|
||||
[
|
||||
str(LENGTH),
|
||||
f"{energy:.8f}",
|
||||
f"{q[0]:.10f}",
|
||||
f"{q[1]:.10f}",
|
||||
f"{inv[0, 0]:.10f}",
|
||||
f"{inv[0, 1]:.10f}",
|
||||
f"{b[0]:.8f}",
|
||||
f"{b[1]:.8f}",
|
||||
]
|
||||
# electrolyte-electrolyte energy
|
||||
elyt_11 = 4 * np.sum(1 / distances)
|
||||
distance_elyt = x_elyt[1] - x_elyt[0]
|
||||
elyt_12 = 1 / distance_elyt + 4 * np.sum(
|
||||
1 / np.sqrt(np.square(distances) + distance_elyt**2)
|
||||
)
|
||||
)
|
||||
elyt = np.array([[elyt_11, elyt_12], [elyt_12, elyt_11]])
|
||||
energy_elyt = 0.5 * np.dot(q_elyt, np.dot(elyt, q_elyt))
|
||||
|
||||
# electrode charges and energy
|
||||
q = np.dot(inv, v - b)
|
||||
energy = COULOMB * (0.5 * np.dot(q, np.dot(A, q)) + np.dot(b, q) + energy_elyt)
|
||||
|
||||
with open(f"plate_cap{name}.csv", "w") as f:
|
||||
f.write(
|
||||
"length, energy / kcal/mol, q1 / e, q2 / e, inv11 / A, inv12 / A, b1 / e/A, b2 / e/A\n"
|
||||
)
|
||||
f.write(
|
||||
", ".join(
|
||||
[
|
||||
str(LENGTH),
|
||||
f"{energy:.8f}",
|
||||
f"{q[0]:.10f}",
|
||||
f"{q[1]:.10f}",
|
||||
f"{inv[0, 0]:.10f}",
|
||||
f"{inv[0, 1]:.10f}",
|
||||
f"{b[0]:.8f}",
|
||||
f"{b[1]:.8f}",
|
||||
]
|
||||
)
|
||||
+ "\n"
|
||||
)
|
||||
|
||||
@ -7,17 +7,27 @@ if [ ! -f $lmpbin ]; then
|
||||
fi
|
||||
|
||||
ref_out="plate_cap.csv"
|
||||
if [ ! -f $ref_out ]; then
|
||||
ref_mix_out="plate_cap_eta_mix.csv"
|
||||
if [ ! -f $ref_out ] || [ ! -f $ref_mix_out ]; then
|
||||
echo "Generating reference data"
|
||||
python3 plate_cap.py > $ref_out
|
||||
python3 plate_cap.py
|
||||
fi
|
||||
|
||||
echo "Running Lammps inputs"
|
||||
# w/o eta mixing
|
||||
rm -rf madelung.txt && touch madelung.txt
|
||||
for file in in.*; do
|
||||
for file in in.eta in.ewald-ew3dc in.ewald-ew2d in.pppm-ew3dc in.cg; do
|
||||
printf "\n$file\n" >> madelung.txt
|
||||
rm -f out.csv inv.csv vec.csv
|
||||
$lmpbin -i $file &> /dev/null
|
||||
python3 eval.py $ref_out out.csv inv.csv vec.csv
|
||||
done
|
||||
|
||||
# with eta mixing
|
||||
for file in in.eta_mix in.eta_cg; do
|
||||
printf "\n$file\n" >> madelung.txt
|
||||
rm -f out.csv inv.csv vec.csv
|
||||
$lmpbin -i $file &> /dev/null
|
||||
python3 eval.py $ref_mix_out out.csv inv.csv vec.csv
|
||||
done
|
||||
cat madelung.txt
|
||||
|
||||
Reference in New Issue
Block a user