added qtotal keyword

This commit is contained in:
Shern Tee
2023-05-31 14:50:55 +00:00
parent 7d8866891a
commit 59bdb136dc
6 changed files with 168 additions and 14 deletions

View File

@ -0,0 +1,31 @@
# electrodes, overall non-neutral
# for graphene-ionic liquid supercapacitor
boundary p p f # slab calculation
include settings.mod # styles, groups, computes and fixes
kspace_modify slab 3.0
# make an extra anion
variable qmodify index 1
variable vdiff index 1
# these values can be changed, e.g. ${LAMMPS_EXECUTABLE} -i in.nonneut -var qmodify 0.9 -var vdiff -2
# fix electrode/* needs equal style variables:
variable qmodify_equal equal v_qmodify
variable vdiff_equal equal v_vdiff
create_atoms 4 single 16.1 17.2 0
set atom 3777 charge $(-v_qmodify)
fix c top electrode/conp v_vdiff_equal 1.979 couple bot 0 etypes on qtotal v_qmodify_equal
# to test electrode/thermo:
# variable vbot equal 0
# fix c top electrode/thermo v_vdiff_equal 1.979 couple bot v_vbot etypes on qtotal v_qmodify_equal temp 310 100 12309 # symm on
variable dv equal f_c[1]-f_c[2]
variable qelec equal c_qbot+c_qtop
compute qall all reduce sum v_q # total system charge
thermo 50
thermo_style custom step temp c_ctemp epair etotal c_qbot c_qtop f_c[1] f_c[2] v_dv v_qelec c_qall
run 500

View File

@ -0,0 +1,33 @@
# electrodes, overall non-neutral
# for graphene-ionic liquid supercapacitor
boundary p p f # slab calculation
include settings.mod # styles, groups, computes and fixes
kspace_modify slab 3.0
# make an extra anion
variable qmodify index 1
variable vdiff index 1
# these values can be changed, e.g. ${LAMMPS_EXECUTABLE} -i in.nonneut -var qmodify 0.9 -var vdiff -2
create_atoms 4 single 16.1 17.2 0
set atom 3777 charge $(-v_qmodify)
fix c top electrode/conp v_vtop 1.979 couple bot v_vbot etypes on # symm on
# to test electrode/thermo:
#fix c top electrode/thermo v_vtop 1.979 couple bot v_vbot etypes on temp 310 100 12309 symm off
#but it looks like update_psi() is hardwired to impose electroneutrality
variable csum equal f_c[1][2]+f_c[1][3]+f_c[2][2]+f_c[2][3]
variable cdiff equal 0.5*(f_c[1][2]-f_c[2][3])
variable qdeficit equal v_qmodify-f_c[1][1]-f_c[2][1]-v_cdiff*v_vdiff
variable vphi equal v_qdeficit/v_csum
variable vtop equal v_vphi+0.5*v_vdiff
variable vbot equal v_vphi-0.5*v_vdiff
variable dv equal v_vtop-v_vbot
variable qelec equal c_qbot+c_qtop
compute qall all reduce sum v_q # total system charge
thermo 50
thermo_style custom step temp c_ctemp epair etotal c_qbot c_qtop f_c[1] f_c[2] v_dv v_qelec c_qall
run 500