Pedram Tavazohi edited section_Ensemble_Inorder_to_make__.tex  almost 8 years ago

Commit id: 14a9f137f54c87721ec16e7918864a0aa1672f9e

deletions | additions      

       

\section{Ensemble}  Inorder to make an ensemble, ensemble one has to use two scripts, the "new_randomStructure.py" and a bash script.The new_randomStructure.py creates random initial .bas files and VELOCITIES from the Md runs. while the bash script moves the input files for fireball and the initial files to each directory.  \textbf{The following is the a description one how new_random_Structure works. To make an ensemble  we will only need to  use the final bash script.}  \subsection{new_randomStructure.py}  For new_random_Structure.py to operate, one has to have the  following python script  \begin{minted}{python}  #!/usr/bin/python  import random  import sys  import time  # MODULE DIRECTIONS  # files at the same directory   \begin{itemsize}  \item answer.xyz  \item VELOCITY.dat  \end{itemsize}  Both of these files are generated in the MD part.  To use this module, script one has to  typepython randomStructure.py [numTimeSteps  in answer.xyz] [numAtoms in system] [ job number ]  def pull(numAtoms, numTimeSteps, seed,fname,gname):  elements = {'N':'7', 'O':'8', 'H':'1', 'C':'6', 'Au':'79', 'Ag':'47'}  f = open(fname)  b = open('input.bas', 'w')  foo = f.readlines()  for the command  line in foo:  line.rstrip('/n')  same = ranNum(seed,numTimeSteps)   pos = (int(numAtoms)+2) * same + 2  b.write(" "+ str(numAtoms) + '\n') :\\  python new_random_Structure.py \\  For example  for i azobenzene 24 atoms and 60000 MD step we can use :  \begin{minted}{bash}  $ python new_randomStructure.py 60000 24 6  \end{minted}  \subsection{bash script(for bash shell)}  At this point we have to write a bash script which makes directories and copies every file that is needed into the directories and makes soft links to "Fdata" and "fireball.x". Depending one whether we are running on a PC or super computer and the ability of the super computer to do an array job we will use these two methods   \subsubsection{regular bash}  This bash script can be used to run a single job which creates the neccecary directories. \\  First make a directory and call it "MDET",   \begin{minted}{bash}  mkdir MDET  \end{minted}  Let us make a directory that contains "answer.xyz" and "VELOCITY.dat", we can call it "init". Assuming these to files are  in range(0,int(numAtoms)):  temp = foo[pos+i] a directory called MD we will move them to MDET/init  \begin{minted}{bash}  cd MDET  mkdir init  cp ../MD/answer.xyz init/  cp ../MD/answer.xyz init/  \end{minted}  Let us make another directory that contains our input files, we can call it "input". This directory will contain "fireball.in","mdet.input" and "gamma.kpts".\\  We move the new_randomStructure.py to a directory names util.\\  for key tree={  font=\ttfamily,  grow'=0,  child anchor=west,  parent anchor=south,  anchor=west,  calign=first,  edge path={  \noexpand\path [draw, \forestoption{edge}]  (!u.south west) +(7.5pt,0) |- node[fill,inner sep=1.25pt] {} (.child anchor)\forestoption{edge label};  },  before typesetting nodes={  if n=1  {insert before={[,phantom]}}  {}  },  fit=band,  before computing xy={l=15pt},  }  [text1  [text1.1  [text1.1.1]  [text1.1.2]  [text1.1.3]  ]  [text1.2  [text1.2.1]  [text1.2.2]  ]  ]  \end{forest}  \end{document}  Now We will create a file with name setup.h  in elements:  print elements[key]  temp2=temp.replace(key, elements[key])  temp = temp2  b.write(temp)  g = open(gname)  c = open('VELOCITIES', 'w')  goo = g.readlines()  for line MDET directory using vi or any text editor  \begin{minted}{bash}  $ vi setup.h  \end{minted}  Then we have to copy the following  in goo:  line.rstrip('/n')  pos = (int(numAtoms)+1) * same + 2  c.write(" "+ str(numAtoms) + '\n') the steup.h.  \begin{minted}{bash}  #!/bin/bash  for i in range(0,int(numAtoms)):  tem = goo[pos+i]   temp3 = tem.split( )  c.write(temp3[4] + " " + temp3[5] + " " + temp3[6] + '\n')  def convert(str):  pass  def ranNum(seed,numTimes):  A = random.randint(1,seed+23)  B = random.randint(1,seed+A)    return (A * int(seed) + B)% numTimes  def main():  print sys.argv  args = sys.argv  numTimeSteps= int(args[1])  numAtoms= args[2]  try:  numJob= args[3]  except:  numJob = random.randint(0,5000)   seed = int(numJob)+ random.randint(0,numTimeSteps)    pull(numAtoms, numTimeSteps, seed, 'answer.xyz','VELOCITY.dat')  main() `seq 1 10`;  do  mkdir ens.$i  cd ens.$i   cp ../init/asnwer.  done  \end{minted}