# -*-shell-script-*-
# Parallel MD code of BCC Mo. screw split polarity
#------------------------------------------------------------
#
#Batch job submission command example
#  bsub -q o2k-mp4 moscrew moscrew.script
#  bqueues, bjobs, bstop, bkill, bresume
#
#------------------------------------------------------------
setnolog
setoverwrite
dirname = runs/tmp
#dirname = runs/screw-polarity/tmp
#shmsize = 10485760 shmallocate #10MB
#shmsize = 20971520 shmallocate #10MB
shmsize = 31457280 shmallocate #10MB
#shmsize = 41943040  shmallocate #40MB
#shmsize = 83886080  shmallocate #80MB
#--------------------------------------------
#Run command
#command = ls runcommand 
#command = "echo x y z" runcommand quit
#--------------------------------------------
#Read in potential file
#
potfile = ~/Codes/MOLLY3/mo_pot readpot
#------------------------------------------------------------
#Read in structure
#
#incnfile = ~/Codes/MOLLY3/runs/mochar/relax-vic-20x48x2-n10/frelaxed.cn readcn
#incnfile = ~/Codes/MOLLY2/runs/mochar/relax-vic-20x48x10-n-10/relaxed.cn readcn
#incnfile = ~/Codes/MOLLY3/structures/screw-polarity/s1b.cn readcn
incnfile = ~/Codes/MOLLY3/structures/junction/jnt8x19x8.cn readcn
#incnfile = ~/Codes/MOLLY3/structures/twistbnd/twist18x7x36.cn readcn
#incnfile = ~/Codes/MOLLY3/F90/runs/relax/relaxed.cn readcn
#incnfile = frelaxed.cn readcn
#
#eval quit
#incnfile = final.cn readcn allocmultiple = 4 readcn
#incnfile = s2b-x20.cn readcn #relaxed.cn readcn
#shiftspec = [ 0 0 0 ] shiftpbc
#extendboxspec = [ 3 8 ] extendbox finalcnfile = extended.cn writecn quit
#extendboxspec = [ 3 4 ] extendbox finalcnfile = extended.cn writecn quit
#incnfile = splice.cn readcn
#incnfile = ~/Codes/MOLLY3/structures/screw-polarity/r1b-sh0.5-20b.cn
#splicecnspec = [ 3 0 ] splicecn finalcnfile = splice.cn writecn quit
#
#------------------------------------------------------------
#Create Perfect Lattice Configuration
#
latticestructure = body-centered-cubic latticeconst = 3.1472 #(A) for Mo
#makecnspec = [  1   1  -2   8    #for screw [111]
#                1  -1   0   19
#                0.5   0.5   0.5   5 ]
#makecnspec = [  1   1   0   8    #for screw [001]
#                1  -1   0   16
#                0   0   1   5 ]
#makecnspec = [  1   1   1   10   #for edge [111]
#                1  -1   0   20
#                1   1  -2   5 ]
#makecn finalcnfile = final.cn writecn                
#
#------------------------------------------------------------
#Create Bicrystal (make twist boundary N=12)
#allocmultiple = 2
#makecnspec = [ 1  1  -1   12 #for screw cross network
#               -1 1  0   19
#               1  1  1   12 ]
#makecn finalcnfile = final.cn writecn
#makecnspec = [ 1  1  -2  8 #for screw-screw junction
#               -1 1  0   19
#               1  1  2   8 ]
#makecn finalcnfile = final.cn writecn
#makecnspec = [ 2  2  -1  6  #for screw-edge junction
#               -1 1  0   19
#               2  2  1   6 ]
#makecn finalcnfile = final.cn writecn
#makecnspec = [  12  12  -1   1
#                1  -1   0   7
#                1   1   24   1 ]
#makecn   finalcnfile = crystal1.cn writecn
#makecnspec = [  12  12  1   1
#                1  -1   0   7
#                -1   -1   24   1 ]
#
#makecnspec = [  18  18  -1   1
#                1  -1   0   7
#                1   1   36   1 ]
#makecn   finalcnfile = crystal1.cn writecn
#makecnspec = [  18  18  1   1
#                1  -1   0   7
#                -1   -1   36   1 ]
#makecn   finalcnfile = crystal2.cn writecn
#
#makecnspec = [  24  24  -1   1
#                1  -1   0   7
#                1   1   48   1 ]
#makecn   finalcnfile = crystal1.cn writecn
#makecnspec = [  24  24  1   1
#                1  -1   0   7
#                -1   -1   48   1 ]
#makecn   finalcnfile = crystal2.cn writecn
#
#makecnspec = [  6.5  6.5  11.5   1
#                -1  1   0   7
#                -5.5   -5.5   12.5   1 ]
#makecn   finalcnfile = crystal1.cn writecn 
#makecnspec = [  5.5  5.5  12.5   1
#                1  -1   0   7
#                -6.5   -6.5   11.5   1 ]
#
#makecnspec = [  12.5  12.5  23.5   1
#                -1  1   0   7
#                -11.5   -11.5   24.5   1 ]
#makecn   finalcnfile = crystal1.cn writecn 
#makecnspec = [  11.5  11.5  24.5   1
#                1  -1   0   7
#                -12.5   -12.5   23.5   1 ]
#makecn   finalcnfile = crystal2.cn writecn
#
#makecnspec = [  11.5  11.5  21.5   1
#                -1  1   0   7
#                -10.5   -10.5   22.5   1 ]
#makecn   finalcnfile = crystal1.cn writecn 
#makecnspec = [  10.5  10.5  22.5   1
#                1  -1   0   7
#                -11.5   -11.5   21.5   1 ]
#makecn   finalcnfile = crystal2.cn writecn
#incnfile = crystal1.cn 
#splicecnspec = [ 2 0 ] splicecn finalcnfile = splice.cn writecn #quit
#-------------------------------------------------------------
#
#shiftspec = [ 1 3 0.3333333333333 ] redefinepbc finalcnfile = redefine.cn writecn #quit
#-------------------------------------------------------------
#Create Dislocation Dipole
#(screw) [111]
#mkdipole = [ 3 2 #z(dislocation line), y(dipole direction)
#             0 0 0.2 #(burgers vector relative to box)
#             0 -0.2632  0.2368 #Y=18 d=0.5  (b)
#             0.305 #\nu
#             -10 10 -10 10 1  #number of images
#             0 0 0 0 ]
#makedipole finalcnfile = makedp.cn writecn
#(screw) [001]
#mkdipole = [ 3 2 #z(dislocation line), y(dipole direction)
#             0 0 0.2 #(burgers vector relative to box)
#             -0.03125 -0.2344 0.2656 #Y=18 d=0.5  (b)
#             0.305 #\nu
#             -10 10 -10 10 1 ] #number of images
#makedipole finalcnfile = makedp.cn writecn
#(edge)
#mkdipole = [ 3 2 #z(dislocation line), y(dipole direction)
#             0.05 0 0 #(burgers vector relative to box)
#             -0.0166 -0.2625 0.2375 #Y=18 d=0.5  (b)
#             0.305 #\nu
#             -3 3 -3 3 1 ] #number of images
#makedipole finalcnfile = makedp.cn writecn #quit
#
#
#cross screw on [111]x[111] lattice
#mkdipole = [ 3 2
#             0 0 -0.0416666667
#             0.0208 -0.1711 0.3289
#             0.305 #\nu
#             -10 10 -10 10 1 #number of images
#             0 0 0 1  ] 
#makedipole finalcnfile = makedp.cn writecn
#mkdipole = [ 1 2
#             -0.0416666667 0 0  #0.0416666667 0 0
#             0 0.3289 0.8289
#             0.305 #\nu
#             -10 10  -10 10 1 #number of images
#             0 0 0 0 ] 
#makedipole finalcnfile = makedp.cn writecn
#
#
#cross screw and screw junction on [112]x[112] lattice
#mkdipole = [ 3 2  #71 degree
#             0.015625 0 0.046875 #[11-2]*1/8+[112]*3/8=[111]/2
#             0.0001 -0.25 0.25
#             0.305 #\nu
#             -10 10 -10 10 1 #number of images
#             0 0 0 1  ] 
#makedipole finalcnfile = makedp.cn writecn
#mkdipole = [ 1 2
#             0.046875 0 0.015625 #[11-2]*3/8+[112]*1/8=[11-1]/2
#             0.0001 0.25 0.75
#             0.305 #\nu
#             -10 10  -10 10 1 #number of images
#             0 0 0 0 ] 
#makedipole finalcnfile = makedp.cn writecn
#
#
#cross screw and edge junction on [221]x[221] lattice
#mkdipole = [ 3 2  #71 degree
#             0.0208333 0 -0.0625 #[22-1]*-1/8+[221]*3/8=[111]/2
#             0.0001 -0.25 0.25
#             0.305 #\nu
#             -10 10 -10 10 1 #number of images
#             0 0 0 1  ] 
#makedipole finalcnfile = makedp.cn writecn 
#mkdipole = [ 1 2
#             0.0625 0 -0.0208333 #[22-1]*3/8+[221]*-1/8=[11-1]/2
#             0.0001 0.25 0.75
#             0.305 #\nu
#             -10 10  -10 10 1 #number of images
#             0 0 0 0 ] 
#makedipole finalcnfile = makedp.cn writecn
#-------------------------------------------------------------
#
#Plot Configuration
#
atomradius = 1.0 bondradius = 0.3 bondlength = 0
atomcolor = cyan highlightcolor = purple backgroundcolor = gray
bondcolor = red fixatomcolor = yellow
#highlightenergy = [ 1 -6.725 ]
#highlightenergy = [ 1 -6.6 ]
#highlightenergy = [ 1 -6.58 ]
hideatomenergy = [ 1 -6.725 -6 ]
#energycolorbar = [ 2 -6.8 -6.55 ]  highlightcolor = red
#energycolorbar = [ 1 -6.9 -6.5 ]  highlightcolor = red
#plot_restrict = 1 plot_ymin = 0.235 plot_ymax = 0.25 highlightcolor = red
#plot_restrict = 1 plot_ymin = 0.245 plot_ymax = 0.26 highlightcolor = red
plot_select = 5 plot_highlight = [ 0 0 1 2 3 4 5 6 7 8 9 ]
plotfreq = 10 
rotateangles = [ 0 0 0 1.5 ]
#rotateangles = [ 0 -90 0 4.5 ]
#rotateangles = [ 0 90 0 4.5 ]
#rotateangles = [ 0 -90 0 1.5 ]
#
win_width = 600 win_height = 600
#ncpu = 2 spawn (parallel potential not complete)
#openwin reversergb alloccolors rotate saverot refreshnnlist eval plot
openwin alloccolors rotate saverot refreshnnlist eval plot
sleep quit
#------------------------------------------------------------
#Making Single Screw Dislocation under Fixed Boundary Condition
#
#mksgscrewspec = [ 0 -0.501 -0.4028 0.3888 0.5 -0.17 0.3 0 0.2 ]#+b
#mksgscrewspec = [ 0 -0.501 -0.4028 0.3888 0.5 -0.17 0.3 0 -0.2 ]#-b
mksgscrewspec = [ 0 -0.501 -0.4028 0.3710 0.5 -0.17 0.3 0 0.2 ]#+b
#mksgscrewspec = [ 0 -0.501 -0.4028 0.3710 0.5 -0.17 0.3 0 -0.2 ]#-b
#makesinglescrew  plot
#eval plot
#sleep quit
#-------------------------------------------------------------
#Conjugate-Gradient relaxation
#
conj_ftol = 1e-7 conj_itmax = 1000 conj_fevalmax = 1000
conj_fixbox = 1 #conj_monitor = 1 conj_summary = 1
#relax finalcnfile = relaxed.cn writecn
#-------------------------------------------------------------
#Fortran Conjugate-Gradient relaxation
#
fortranpath = ~/Codes/MOLLY3/F90FS potfile = Mo.pot fortranexe = Relax
#
conj_fixbox = 1  #stress is meaningful only if allow box to relax
#stress = [ 0 100 0
#           100 0 0
#           0 0 0 ] #(stress in MPa)
#fortranrelax eval plot sleep quit
#( comment out the above line and                             )
#( uncomment the following line for more frequent Plot update )
conj_fevalmax = 1000  fortranrelax #eval plot writeintercn
incnfile = frelaxed.cn readcn finalcnfile = relaxed.cn writecn
incnfile = relaxed.cn readcn eval plot sleep quit
#quit
#-------------------------------------------------------------
#MD setting
T_OBJ = 300 #(in K)
equilsteps = 0  totalsteps = 100 timestep = 0.0005 # (ps)
atommass = 95.94  #Atomic Mass  (g/mol) (Ta: 180.9479,  Mo: 95.94) 
#wmasscoeff = 2.0
atomTcpl = 200.0 #Atomic T-coupling constant
boxTcpl = 20.0 #Wall T-coupling constant

#for equilibration
potavgfreq = 100  showavgpot = 1
DOUBLE_T = 1 initvelocity totalsteps = 1000 saveprop = 0 run
usenosehoover = 1   vt2 = 1e28  
#------------------------------------------------------------
#Typical MD Simulation
#
totalsteps = 2000000 equilsteps = 0
saveprop = 1 savepropfreq = 100 openpropfile findcorefreq = 100
savecn = 1 savecnfreq = 5000 openintercnfile
#savecn = 0 savecnfreq = 2000 openintercnfile

#initvelocity 

boundaryspeed = [ 0 0 -2e-3 ] #-5e-3
#autowritegiffreq = 40  wintogglepause
run  finalcnfile = run.cn writecn
#boundaryspeed = 0  totalsteps = 2000 run finalcnfile = stop.cn writecn
#relax finalcnfile = relaxed.cn writecn
