# Python script

import mdpp

#*******************************************
# Definition of procedures
#******************************************* 
def initmd(n) :
     mdpp.cmd('setnolog')
     mdpp.cmd('setoverwrite')
     mdpp.cmd('dirname = runs/si-example-{0}'.format(n))
     mdpp.cmd('zipfiles = 1')       # zip output files
     mdpp.cmd('NIC = 200 NNM = 200')
     #------------------------------------------------------------
     # Create Perfect Lattice Configuration
     #
     mdpp.cmd('element0 = Si')
     mdpp.cmd('crystalstructure = diamond-cubic')
     mdpp.cmd('latticeconst = 5.4309529817532409') # (A) for Si 
     mdpp.cmd('element0 = Silicon')
     mdpp.cmd('''
          latticesize = [ 1 0 0 2
                          0 1 0 2
                          0 0 1 3 ]
                          ''')
                          
#------------------------------------------------------------
def openwindow() :
     # Plot Configuration
     # 
     mdpp.cmd('''
     atomradius = 0.67 bondradius = 0.3 bondlength = 2.8285  # for Si
     atomcolor = orange highlightcolor = purple
     bondcolor = red backgroundcolor = grey70
     plotfreq = 10 rotateangles = [ 0 0 0 1.25 ]
     openwin alloccolors rotate saverot eval plot
     ''')
     
#*******************************************
# Main program starts here
#*******************************************
initmd(1)
mdpp.cmd('makecrystal writecn')
openwindow()
mdpp.cmd('sleep quit')
