# Preperation

In order to run MDET simulations one has to provide a “.bas” file which contains the positions of different atoms. Inorder to get accurate results, One has to optimize the structure. Since MDET is a quantum simulation, It is better to have an ensemble of different initial points. Inorder to assemble an ensemble one can run a ground state Molecular Dynamics on the optimized structure for some amount of step. Now each of the MD steps can be used as an initial point in MDET simulation, which one can choose from these MD steps using a random python script. Since the MDET is been written for McWeda the MD part should be ran as McWeda, or itheory_xc=2.

# Single Run

Inorder to make FIREBALL to run a MDET simulation, one has to have a fireball.in, mdet.input, gamma.kpts, input.bas, VELOCITES. The input.bas and VELOCITES will be gathered from MD run.

## fireball.in

&option
basisfile=input.bas
iensemble = 3
iquench = 0
nstepi = 1
nstepf = 4000
iqout = 1
icluster = 1
dt = 0.25
T_initial = 300.0
rescal = 1.00
tempfe = 300
sigmatol = 1.00E-05
imdet = 1
nddt = 100
&end
&output
iwrtxyz = 1
iwrtpop = 1
iwrtvel = 0
iwrteigen = 0
iwrtefermi = 1
iwrtfpieces = 0
&end


The important parts here are to set imdet = 1, set initial and final steps in nstepi and nstepf, set dt, and the Temprature.

## mdet.input

If we set imdet = 1 we need a “mdet.input” file. This file will contain the state and the occupations of them. So first we have to find the number of the last state ocuupied (HOMO). Inorder to do that one can check number of electrons in our system from log file of MD, this value will be denoted as ztot, so one can either open the log file and look for ztot or use the grep command (grep <text> <filename>)
example :

  $grep ztot log$  (What it must be)           ztot =    68.0000000000000

Now since each state can be occupied by two electrons, we can divide the number of electrons by 2, if the remainder of this division is equal two zero that means that HOMO is fully occupied, meaning $$HOMO = (ztot)/2$$, If the remainder is equal to one it means that the HOMO is half occupied, so we take the quotient of $$(ztot)/2$$ and add 1 to it. for example if ztot is 10 $$HOMO = 5$$, but if it is 11, the quotient(11/2)=5 so $$HOMO = 6$$. Or in azobenzene if ztot is 68, that means HOMO is equal to 34 and it’s fully occupied, If we one to excite one electron in LUMO the mdet will have 34 having 1 electron in it and 35 another one.

The mdet.input file starts with number of states, next the states with their occupation, for example for azobenzene with one electron excited in LUMO we have :

2                                 ! nele (number of states where switches are possible)
34  1
35  1

## gamma.kpts

1
0 0 0 1.0

The next step will be to copy the fireball.x and Fdata or make a soft link to the Fdata and run ./fireball.x

# Ensemble

Inorder to make an 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. The following is the a description one how new_random_Structure works. To make an ensemble we only need to use the final bash script.

## new_randomStructure.py

For new_random_Structure.py to operate, one has to have the following files at the same directory

VELOCITY.dat

Both of these files are generated in the MD part. To use this script one has to type in the command line :
python new_random_Structure.py <Number of MD steps> <number of atoms> <job number>
For example for azobenzene 24 atoms and 60000 MD step we can use :

 $python new_randomStructure.py 60000 24 6 ## 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 ### 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”, mkdir MDET Let us make a directory that contains “answer.xyz” and “VELOCITY.dat”, we can call it “init”. Assuming these to files are in a directory called MD we will move them to MDET/init cd MDET mkdir init cp ../MD/answer.xyz init/ cp ../MD/answer.xyz init/ 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. So far we have created three directories “util”, “input”, and “init”, a tree structure for the directories will look like: --MD --MDET----util----new_randomStructure.py ----input---fireball.in ---mdet.input ---gamma.kpts ----init----answer.xyz ----VELOCITY.dat Now We will create a file with name setup.h in MDET directory using vi or any text editor $ vi setup.h

Then we have to copy the following in the steup.h.

REMEMBER YOU HAVE TO CHANGE ANY VALUE THAT IS INSIDE < >, TO SOMETHING SUITABLE TO YOUR CALCULATIONS

#!/bin/bash
for i in seq 1 <number of ensemble>;
do
mkdir ens.$i cd ens.$i
cp ../init/VELOCITY.dat .
cp ../util/new_randomStructure.py .
python new_randomStructure.py 60000 24 \$i
done