# DESCRIPTION: haynes-schockley
echo both
units    metal

variable V equal  5000.0
variable n0 equal 0.085
variable dn equal 2.0*${n0}
variable dt equal 0.0005
variable s equal 10

timestep  ${dt}

atom_style  atomic
lattice         fcc 1.0 
region    simRegion block -50 50  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 convective_drift_diffusion  Cu_cddm.mat

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

fix_modify AtC material all Cu

fix_modify AtC mesh create_nodeset lbc -50.0 -50.0 -INF  INF -INF  INF
fix_modify AtC mesh create_nodeset rbc  50.0  50.0 -INF  INF -INF  INF

# fix a temperature
fix_modify AtC  initial temperature          all 300.0
#fix_modify AtC  initial electron_temperature all 300.0
fix_modify AtC  fix electron_temperature all 300.
#fix_modify AtC  initial electron_temperature all gaussian 0 0 0 1 0 0 5.0 300. 300.
fix_modify AtC  initial electron_density all gaussian 0 0 0 1 0 0 5.0 ${dn} ${n0}
#fix_modify AtC fix electron_density all ${n0}
# isolate system: 
# diffusion: dn/dx = 0
# drift    : n = 0
fix_modify AtC  fix electron_density lbc ${n0}
fix_modify AtC  fix electron_density rbc ${n0}
fix_modify AtC  fix temperature lbc 300.0
fix_modify AtC  fix temperature rbc 300.0
fix_modify AtC  fix electron_temperature lbc 300.0
fix_modify AtC  fix electron_temperature rbc 300.0
fix_modify AtC  fix electric_potential all 0.
fix_modify AtC extrinsic electron_integration implicit

# electron velocity
fix_modify AtC initial electron_velocity x all 0.
#fix_modify AtC fix electron_velocity x all 0.
fix_modify AtC initial electron_velocity y all 0.
fix_modify AtC fix electron_velocity y all 0
fix_modify AtC initial electron_velocity z all 0.
fix_modify AtC fix electron_velocity z all 0.

# 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   convective_pulseFE $s text binary
thermo  $s
#run     100

# free electric field and allow shielding
fix_modify AtC  unfix electric_potential all
fix_modify AtC  fix electric_potential  lbc -$V
fix_modify AtC  fix electric_potential  rbc 0
fix_modify AtC  source electric_potential all ${n0}
fix_modify AtC extrinsic electron_integration implicit 10
run     100
