Since 18/01/2017

header ads

Plotting Bands and DOSs for Crystal Code

 

To plot electronic properties from CRYSTAL first requires the output files from a properties calculation which contain <filename>.BAND.DAT or <filename>.DOSS.DAT. If these files are returned once a properties calculation is completed, manipulating these output files will allow you to construct band and DOS plots. 
To choose the directions in k-space, you can use this summary of tables: http://www.cryst.ehu.es/cryst/get_kvec.html

Preparing Band and DOS Input Files
As opposed to running geometry optimization or SCF cycles, the input file to run any electron properties requires the wavefunction file from a prior SCF calculation.

Submission Script
The input file requires using Pproperties from the Crystal14/17 folder. Below is an example script which will submit a properties input file  to mendoza_q with 16 processors. To run it, save the script to some directory (or your working directory) and call it along with the input file name and number of processors. Your command line will look like the following:
>> <command from bash> <Input file name> <number of processors>
For example, say you have an input file called INPUT.d3 and you want to run it for 100 hours. You saved the submission script to some directory which you created a bash command called propsubmit, then your command line will be:
>> propsubmit <INPUT> 100
Once the script runs, it will produce a submission file in your working directory and automatically run it.

echo '#!/bin/bash' > $1.sh
echo '#SBATCH -J '$1 >> $1.sh
out=$1
file=-%J.o
outfile=$out$file
echo '#SBATCH -o '$outfile >> $1.sh
echo '#SBATCH -N 1' >> $1.sh
echo '#SBATCH --ntasks-per-node=16' >> $1.sh
echo '#SBATCH -p mendoza_q' >> $1.sh
time=$2
wall=:00:00
timewall=$time$wall
echo '#SBATCH -t '$timewall >> $1.sh
#echo '#SBATCH --mail-type=ALL' >> $1.sh
echo '# remove the following line if already in your .bashrc file
export PATH=/gpfs/research/mendozagroup/crystal/2017/v1_0_1b/ifort14/bin/Linux-ifort14_XE_emt64/v1.0.1:$PATH' >> $1.sh
echo 'export JOB='$1 >> $1.sh
echo 'export DIR=$SLURM_SUBMIT_DIR
export scratch=/gpfs/research/mendozagroup/scratch/crystal/${USER}/crys17

echo "submit directory: "
echo $SLURM_SUBMIT_DIR

module purge
module load intel/15
module load intel-openmpi

mkdir  -p $scratch/$JOB

# the following line need be modified according to where your input is located
cp $DIR/$JOB.d3  $scratch/$JOB/INPUT
cp $DIR/$JOB.f9  $scratch/$JOB/fort.9
cd $scratch/$JOB
touch hostfile
rm    hostfile
for i in `scontrol show hostnames $SLURM_JOB_NODELIST`
do
   echo "$i slots=16" >> hostfile
done
# in the following, -np parameters should be equal to those specified above.

mpirun -np 16 -machinefile hostfile Pproperties 2>&1 >& $DIR/${JOB}.pout    #Notice how we have changed the executable from Pcrystal to Pproperties

cp fort.9  ${DIR}/${JOB}.f9
cp fort.25  ${DIR}/${JOB}.f25
cp BAND.DAT  ${DIR}/${JOB}.BAND.dat
cp DOSS.DAT  ${DIR}/${JOB}.DOSS.dat
cp POTC.DAT  ${DIR}/${JOB}.POTC.dat


# uncomment the next 5 lines if you want to remove the scratch directory
#if [ $? -eq 0 ]
#then
#    cd ${DIR}
#    rm -rf $scratch/${JOB}
#fi' >> $1.sh

sbatch $1.sh

Creating Plots from Output Files
Once the properties run, the script will return a <filename>.BAND.DAT or <filename>.DOSS.DAT file. These files are in a good format to convert into a legible format to be plotted.
The following will outline the way to export the .DAT files into a readable format for gnuplot.

For DOS Plots
If you want to plot data, here is the recommended steps:
1. Run SCF cycle to get .f9 and .out files.
2. copy the .out and .f9 to another directory and run the script alldoss.py to create a .d3 file
3. Run the .d3 file and copy the .DOSS.dat output to another directory
4. Run the script dosplot.py(*) with the DOSS.dat output in that directory. Change the line with the definition for data_folder to your working directory or use the pwd command and parse that to the line.
5. You should now have a .eps file of your data.

(*) The alldoss.py script is not generalized to include spin up/down electrons. Instead, use the smartdoss2.py script (this script only takes a single output at a time rather than an entire directory). Also both of these scripts do not run for individual atoms. Instead, the shells are for each element in the structure.

For Band Structures
If you are interested in plotting the results, it is best to set up the following format:
1. Copy the two directories band_plot and d3_input. The d3_input directory contains files with each containing the pathway between high symmetry points for each type of crystal unit cell. The second, band_plot, contains the label for each high point of symmetry in the order the path is taken.

e.g. for the hexagonal unit cell, the following pathway connects all high points of symmetry which can be copied and saved as a file.
M G
G K
K A
A G
G L
L H
H G
END
The other file for the hexagonal unit cell will save the label names which are used for gnuplot. The info below can be copied and saved as another file.
M
{/Symbol G}
K
A
{/Symbol G}
L
H
{/Symbol G}

2. Run the script create_band_d3.py in your working directory which contains the .d12's you wish to create .d3 files for. Modify the line where data_folder is defined to be your working directory or parse the results of the pwd command to that line.
3. Run your .d3 files to get the output.
4. Copy your .dat, .out, and .d12 file to another directory and run the plotband.py script. Again, change the line where data_folder is defined to be your working directory or parse the results of the pwd command to that line.
5. Voil
à! Take your .eps image file and open it in Latex or image software.

 

https://sites.google.com/site/mendozacortesgroup/home/crystal17/plotting_bands_dos 

Post a Comment

0 Comments