# -*-shell-script-*-
# Free energy of Silicon Core Vacancy by Adiabatic Switching
#setnolog
setoverwrite
dirname = runs/si-core-vac-sw2ha
#------------------------------------------------------------
#Read in structure
#
# atom 66 is marked with fixed=-1 (removed)
incnfile = ../../structures/CSD-book/chap6/si192-p30rec-vac66-600K-rlx.cn readcn
#-------------------------------------------------------------
#
#Plot Configuration
#
atomradius = 0.9 bondradius = 0.3 bondlength = 2.8285 #for Si
atomcolor = orange highlightcolor = purple  bondcolor = red
backgroundcolor = gray fixatomcolor = yellow
color00 = "orange"  color01 = "purple" color02 = "green"
color03 = "magenta" color04 = "cyan"   color05 = "purple"
color06 = "gray80"  color07 = "white"
plot_color_windows = [ 2
                          -10 -4.44 0  #color00 = orange
                          -4.44 -3  1  #color01 = purple
                     ]
plot_atom_info = 3
plotfreq = 10
plot_limits = [ 1 -10 10 -0.4 0.0 -10 10 ]
rotateangles = [ 0 -90 -90 1.5 ]
win_width = 600 win_height = 600
#openwin alloccolors rotate saverot refreshnnlist eval plot
#sleep quit
#------------------------------------------------------------
#Monte Carlo Simulation
#
totalsteps = 500000 saveprop = 1 openpropfile savepropfreq = 100
printfreq  = 5000
mcatom = -1 #-1: move all atoms, 0: move a random atom at each step
T_OBJ = 600  timestep = 0.02 #Angstrom
#randseed = 10129 srand48
srand48bytime                #randomize random number generator
#
#runMC #(standard MC simulation)
#finalcnfile = final.cn writecn quit
#
#------------------------------------------------------------
#MC Adiabatic Switching Simulations
#RLIST = 5.6 #enlarge neighborlist radius for switching simulations

incnfile = ../../structures/CSD-book/chap6/si192-p30rec-vac66-600K-rlx.cn
  readcn setconfig1

Ecoh = -4.536103878024589 # energy per atom (base energy for HA potential)
switchfreq = 10           # change lambda every 10 MC steps
#------------------------------------------------------------
# Switching to Harmonic Approximation of the same potential

switchfunc = 0 #curved switching function (default)
#switchfunc = 1 #linear switching function

#refpotential = 0 #Einstein crystal as reference potential (default)
refpotential = 1 #Harmonic approximation of the original potential as reference

# load previously computed Hessian matrix
incnfile = ../si-core-vac-ha/hessian.out readHessian

#----------------------------
# an equilibrated structure, starting point of switching simulation
incnfile = ../../structures/CSD-book/chap6/si192-p30rec-vac66-600K.cn readcn
#  unfortunately, this file does not know that fixed[66]=-1
input = [ 1 66 ] fixatoms_by_ID markremovefixedatoms # set fixed[66]=-1
#  create a new local file, relaxed.cn, as the starting point of switching
writeall = 1 finalcnfile = relaxed.cn writecn
#----------------------------

incnfile = relaxed.cn

readcn lambda0 = 0 lambda1 = 1 runMCSWITCH finalcnfile = f01a.cn writecn
readcn lambda0 = 0 lambda1 = 1 runMCSWITCH finalcnfile = f01b.cn writecn
readcn lambda0 = 0 lambda1 = 1 runMCSWITCH finalcnfile = f01c.cn writecn
readcn lambda0 = 0 lambda1 = 1 runMCSWITCH finalcnfile = f01d.cn writecn
readcn lambda0 = 0 lambda1 = 1 runMCSWITCH finalcnfile = f01e.cn writecn

quit
#------------------------------------------------------------
# Reverse Switching requires an equilibrated configuration with HA potential
#  as the initial configuration
#  This can be done by running a switching simulation with lambda0=lambda1=1
#
#incnfile = ...
#
#readcn lambda0 = 1 lambda1 = 0 runMCSWITCH finalcnfile = f10a.cn writecn
#readcn lambda0 = 1 lambda1 = 0 runMCSWITCH finalcnfile = f10b.cn writecn
#readcn lambda0 = 1 lambda1 = 0 runMCSWITCH finalcnfile = f10c.cn writecn
#readcn lambda0 = 1 lambda1 = 0 runMCSWITCH finalcnfile = f10d.cn writecn
#readcn lambda0 = 1 lambda1 = 0 runMCSWITCH finalcnfile = f10e.cn writecn
#
#quit
#------------------------------------------------------------
