Skip to content

Commit

Permalink
Merge pull request #42 from pthibaud/dev
Browse files Browse the repository at this point in the history
Rework for examples
  • Loading branch information
pthibaud committed Oct 9, 2023
2 parents 23c9d0b + 035ebf2 commit 32c15a6
Show file tree
Hide file tree
Showing 5,887 changed files with 7,592 additions and 1,247,880 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
104 changes: 104 additions & 0 deletions examples/NRL/collinear/example01/job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env bash
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
EXAMPLE_DIR=`pwd`

# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi

$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use TBKOSTER.x to calculate the total energy vs a of Ptfcc"

# set the needed environment variables
. ../../../environment_variables

# remove existing stuffs
rm -f *.dat *.txt *.gnuplot *.png

cat > Etot_vs_a.dat <<EOF
# a Etot
EOF

for a in 3.80 3.82 3.84 3.86 3.88 3.90 3.92 3.94 3.96 3.98 4.00; do
rm -f tempo tempo2
cat > in_master.txt<<EOF
&calculation
processing = 'scf'
/
&units
length = 'ang'
energy = 'ev'
time = 'fs'
mass = 'hau'
/
&element
ne = 1
symbol(1) = 'Pt'
u_lcn(1) = 20
/
&element_tb
filename(1) = '$TBPARAM_DIR/pt_par_fcc_bcc_sc_lda_fl'
/
&lattice
v_factor = $a
v(1,:) = 0.0 0.5 0.5
v(2,:) = 0.5 0.0 0.5
v(3,:) = 0.5 0.5 0.0
/
&atom
ns = 1
na = 1
ntag = 1
tag(1) = 'Pt'
stag(1) = 1
pbc = 5, 5, 5
r_coord = 'direct'
r(1,:) = 0.0, 0.0, 0.0
/
&mesh
type = 'mp'
gx = 10, 10, 10
dx = 0, 0, 0
/
&hamiltonian_tb
/
&energy
smearing = 'mv'
degauss = 0.05
/
&mixing
alpha = 0.1
/
&scf
delta_en = 0.0001
delta_q = 0.0001
verbose = .false.
ni_max = 200
/
EOF

# Run TBKOSTER
$BIN_DIR/TBKOSTER.x

ENERGY=$(grep "en =" out_energy.txt | cut -d "=" -f2)
echo $a $ENERGY >> Etot_vs_a.dat
done

# Display the results
if ! command -v gnuplot &> /dev/null
then
$ECHO "The gnuplot command cound not be found. Please install gnuplot."
exit 1
else
cat > Etot_vs_a.gnuplot<<EOF
set encoding utf8
set xlabel "Lattice Parameter (ang)"
set ylabel "Energy (eV)"
set terminal png
set output "Etot_vs_a.png"
plot 'Etot_vs_a.dat' w lines lw 2
EOF
gnuplot Etot_vs_a.gnuplot
fi
127 changes: 127 additions & 0 deletions examples/NRL/collinear/example02/job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/usr/bin/env bash
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
EXAMPLE_DIR=`pwd`

# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi

$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use TBKOSTER.x to calculate PDOS of a Pt(111) surface"

# set the needed environment variables
. ../../../environment_variables

a=2.77185858225127
mkdir xyz

cat > in_master.txt<<EOF
&calculation
pre_processing='txt2xyz'
pre_processing_dir='xyz'
processing = 'scf'
post_processing='dos'
/
&units
length='ang'
energy='ev'
time='fs'
mass='hau'
/
&element
ne = 1
symbol(1) = 'Pt'
q(1) = 10.0
q_d(1) = 8.8
u_lcn(1)=20
/
&element_tb
filename(1) = '$TBPARAM_DIR/pt_par_fcc_bcc_sc_lda_fl'
/
&lattice
v_factor = $a
v(1,:) = 1.0 0.0 0.0
v(2,:) =-0.5 0.866025403784438 0
v(3,:) = 0.0 0.0 10.0
/
&atom
ns = 1
na = 13
ntag = 1
tag(1) = 'Pt'
stag(1)=13
pbc = 5, 5, 0
r_coord='cartesian'
r(1,:) = 0.0000000 0.0000000 0.0000000
r(2,:) = 1.3859293 -0.8001667 -2.2632132
r(3,:) = -1.3859293 0.8001667 -4.5264263
r(4,:) = 0.0000000 0.0000000 -6.7896395
r(5,:) = 1.3859293 -0.8001667 -9.0528526
r(6,:) = -1.3859293 0.8001667 -11.3160658
r(7,:) = 0.0000000 0.0000000 -13.5792789
r(8,:) = 1.3859293 -0.8001667 -15.8424921
r(9,:) = -1.3859293 0.8001667 -18.1057053
r(10,:) = 0.0000000 0.0000000 -20.3689175
r(11,:) = 1.3859293 -0.8001667 -22.6321316
r(12,:) = -1.3859293 0.8001667 -24.8953457
r(13,:) = 0.0000000 0.0000000 -27.1585579
/
&mesh
type = 'mp'
gx = 15, 15, 1
dx = 0, 0, 0
/
&hamiltonian_tb
/
&energy
smearing = 'mv'
degauss = 0.05
/
&mixing
alpha = 0.1
/
&scf
delta_en=0.0001
delta_q=0.0001
verbose=.true.
ni_max=200
/
EOF

cat > dos/in_energy.txt<<EOF
&energy
smearing = 'g'
degauss = 0.1
en_min = -10.0
en_max = 10.0
/
EOF

cat > dos/in_dos.txt<<EOF
&dos
nen=500
na_dos=2
ia(1)= 1
ia(2)=7
en_min=-10
en_max=10
/
EOF

cat > dos/in_mesh.txt<<EOF
&mesh
type = 'mp'
gx = 15, 15, 1
dx = 0, 0, 0
/
EOF

# Set TBKOSTER root directory in in_master.txt
sed "s|TBKOSTER_ROOT_DIR|$TBKOSTER_ROOT_DIR|g" in_master.txt >in_master2.txt
mv -f in_master2.txt in_master.txt


# Run TBKOSTER
$BIN_DIR/TBKOSTER.x
132 changes: 132 additions & 0 deletions examples/NRL/collinear/example03/job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#!/usr/bin/env bash
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
EXAMPLE_DIR=`pwd`

# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi

$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use TBKOSTER.x to calculate the band structure of Pt(111)"

# set the needed environment variables
. ../../../environment_variables

# remove the previous content if existing
rm -fr band scf *.txt

# create the appropriate folders if not existing
mkdir band scf

# set the lattice parameter
a=2.77185858225127

cat > in_master.txt<<EOF
&calculation
processing='scf'
post_processing='band'
/
&units
length='ang'
energy='ev'
time='fs'
mass='hau'
/
&element
ne = 1
symbol(1) = 'Pt'
q(1) = 10.0
u_lcn(1)=20
/
&element_tb
filename(1) = '$TBPARAM_DIR/pt_par_fcc_bcc_sc_lda_fl'
/
&lattice
v_factor = $a
v(1,:) = 1.0 0.0 0.0
v(2,:) =-0.5 0.866025403784438 0
v(3,:) = 0.0 0.0 10.0
/
&atom
ns = 1
na = 13
ntag = 1
tag(1) = 'Pt'
stag(1)=13
pbc = 5, 5, 0
r_coord='cartesian'
r(1,:) = 0.0000000 0.0000000 0.0000000
r(2,:) = 1.3859293 -0.8001667 -2.2632132
r(3,:) = -1.3859293 0.8001667 -4.5264263
r(4,:) = 0.0000000 0.0000000 -6.7896395
r(5,:) = 1.3859293 -0.8001667 -9.0528526
r(6,:) = -1.3859293 0.8001667 -11.3160658
r(7,:) = 0.0000000 0.0000000 -13.5792789
r(8,:) = 1.3859293 -0.8001667 -15.8424921
r(9,:) = -1.3859293 0.8001667 -18.1057053
r(10,:) = 0.0000000 0.0000000 -20.3689175
r(11,:) = 1.3859293 -0.8001667 -22.6321316
r(12,:) = -1.3859293 0.8001667 -24.8953457
r(13,:) = 0.0000000 0.0000000 -27.1585579
/
&mesh
type = 'mp'
gx = 10, 10, 1
dx = 0, 0, 0
/
&hamiltonian_tb
/
&energy
smearing = 'mv'
degauss = 0.05
/
&mixing
alpha = 0.1
/
&scf
delta_en=0.0001
delta_q=0.0001
verbose=.false.
ni_max=200
/
EOF

cat > band/in_mesh.txt<<EOF
&mesh
type = 'path'
nxs = 4
gxs = 100
xs_label(1) = 'G'
xs_label(2) = 'X'
xs_label(3) = 'M'
xs_label(4) = 'G'
xs(1,:) = 0 , 0 , 0
xs(2,:) = 0.5 , 0 , 0
xs(3,:) = 0.666666666 , 0.33333333 , 0
xs(4,:) = 0 , 0 , 0
/
EOF

cat > band/in_band.txt<<EOF
&band
na_band=1
ia_band=1
/
EOF

# Run TBKOSTER
$BIN_DIR/TBKOSTER.x

# Run bands.x
$BIN_DIR/bands.x

# Display the results
if ! command -v gnuplot &> /dev/null
then
$ECHO "The gnuplot command cound not be found. Please install gnuplot."
exit 1
else
gnuplot $PREFIX/tools/band_weight.gnuplot
fi
Loading

0 comments on commit 32c15a6

Please sign in to comment.