# needs description
# DESCRIPTION: haynes-schockley
# poisson eqn for E-field: epsilon phi,xx = -e (n - p + N_D - N_A)
# w/ E = phi,x

echo both
units    metal

variable dt equal 0.0000001
variable s equal 1
variable L equal 10.0
variable N equal 40
variable T equal 30000.0
variable E equal 0.5

timestep  ${dt}

atom_style  atomic
lattice         fcc 1.0 
region    simRegion block 0 $L  0 1 0 1
boundary  f p p
create_box  1 simRegion
mass    1 1.0 # need to keep this
atom_modify     sort 0 1

#          ID  group atc PhysicsType ParameterFile
fix        AtC all   atc drift_diffusion-schrodinger  Si_ddm_schrodinger.mat

#          ID  part keywords    nx ny nz region
fix_modify AtC mesh  create $N 1  1  simRegion f p p

variable a equal $L-0.1
variable b equal $L+0.1
fix_modify AtC mesh create_nodeset lbc -0.1 0.1 -INF  INF -INF  INF
fix_modify AtC mesh create_nodeset rbc  $a  $b  -INF  INF -INF  INF

# ics/bcs : density consistent with wave function
fix_modify AtC  initial temperature          all 300.0
fix_modify AtC  fix     temperature          all 300.0
fix_modify AtC  initial electron_temperature all $T
fix_modify AtC  fix     electron_temperature all $T
fix_modify AtC  initial electron_density     all 0.0
#fix_modify AtC  fix     electron_density     lbc 0 
#fix_modify AtC  fix     electron_density     rbc 0 
fix_modify AtC  initial electric_potential   all 0.0
fix_modify AtC  initial electron_wavefunction all 0.0
fix_modify AtC  fix     electron_wavefunction lbc 0 
fix_modify AtC  fix     electron_wavefunction rbc 0 

thermo  $s
# f_AtC:1 thermal energy, 2 avg T, 3 electron energy, 4 avg Te, 5 total n
thermo_style custom step cpu f_AtC[1] f_AtC[2] f_AtC[3] f_AtC[4] f_AtC[5]
thermo_modify  format 1 %5i format 2 %7.2g
fix_modify AtC  output   ddm_schrodingerFE $s text
fix_modify AtC extrinsic electron_integration implicit 1
fix_modify AtC extrinsic schrodinger_poisson_solver self_consistency 1 # 100
fix_modify AtC  unfix   electric_potential all
# ends zero
fix_modify AtC  fix     electric_potential lbc  0 
fix_modify AtC  fix     electric_potential rbc  0 
run 1
# ends from gradient
fix_modify AtC  fix     electric_potential lbc linear 0 0 0 $E 0 0 0
fix_modify AtC  fix     electric_potential rbc linear 0 0 0 $E 0 0 0
run 1

