Skip to content

Commit

Permalink
Merge branch 'main' into pytorch
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaisa authored Jul 25, 2024
2 parents 75847cf + 070e62c commit 118bd30
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/software_repo_native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- TensorFlow
- ESPResSo
- PyTorch
- QuantumESPRESSO
EESSI_VERSION:
- "2023.06"
steps:
Expand Down
8 changes: 8 additions & 0 deletions QuantumESPRESSO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# QuantumESPRESSO example

This is an exemplified calculation of the band structure of silicon using QuantumESPRESSO.
The calculation is performed in two steps: first, a self-consistent field calculation is performed to obtain the charge density, and then a non-self-consistent calculation is performed to obtain the band structure. The assumption is made that the proper convergence tests have already been performed and the lattice parameter has been optimized.

Example re-adapted from https://github.com/Crivella/DFT_QE_beginner_tutorial/tree/master/0_Si_bulk/4_bandstructure

Runtime: ~5 seconds on a single core
204 changes: 204 additions & 0 deletions QuantumESPRESSO/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
if [[ $EESSI_CVMFS_REPO == "/cvmfs/software.eessi.io" ]] && [[ $EESSI_VERSION == "2023.06" ]]; then
echo "Running demo for QuantumESPRESSO 7.3.1 ..."
module load QuantumESPRESSO/7.3.1-foss-2023a
module load gnuplot/5.4.8-GCCcore-12.3.0
else
echo "Don't know which QuantumESPRESSO module to load for ${EESSI_CVMFS_REPO}/versions/${EESSI_VERSION}" >&2
exit 1
fi

export OMP_NUM_THREADS=1
export OMPI_MCA_osc=^ucx
export OMPI_MCA_btl=^openib,ofi
export OMPI_MCA_pml=^ucx
export OMPI_MCA_mtl=^ofi

if [ ! -f Si.pz-vbc.UPF ]; then
curl -OL http://pseudopotentials.quantum-espresso.org/upf_files/Si.pz-vbc.UPF
fi

PSEUDO_DIR=$(pwd)
TMP_DIR=$(pwd)/tmp
RUN_COMMAND=""

echo "Parallel command:" $RUN_COMMAND
echo "Started at: " `date`

############################################################3
# Calculate the SCF charge density

IN=si_script.scf.in
OUT=si.scf.out
cat > $IN << EOF
&CONTROL
calculation = "scf",
prefix = "Si",
pseudo_dir = "$PSEUDO_DIR",
outdir = "$TMP_DIR",
restart_mode = "from_scratch"
tprnfor = .true.
wf_collect=.true.
/
&SYSTEM
ibrav = 2,
celldm(1) = 10.21,
nat = 2,
ntyp = 1,
ecutwfc = 20
nbnd = 5
/
&ELECTRONS
conv_thr = 1.D-8,
mixing_beta = 0.7D0 ,
/
ATOMIC_SPECIES
Si 28.086 Si.pz-vbc.UPF
ATOMIC_POSITIONS
Si 0.00 0.00 0.00
Si 0.25 0.25 0.25
K_POINTS
10
0.1250000 0.1250000 0.1250000 1.00
0.1250000 0.1250000 0.3750000 3.00
0.1250000 0.1250000 0.6250000 3.00
0.1250000 0.1250000 0.8750000 3.00
0.1250000 0.3750000 0.3750000 3.00
0.1250000 0.3750000 0.6250000 6.00
0.1250000 0.3750000 0.8750000 6.00
0.1250000 0.6250000 0.6250000 3.00
0.3750000 0.3750000 0.3750000 1.00
0.3750000 0.3750000 0.6250000 3.00
EOF

echo -e "\tStart: " `date`
COMMAND=" $RUN_COMMAND pw.x"
echo -e "\t\t$COMMAND < $IN > $OUT"
$COMMAND < $IN > $OUT
echo -e "\tEnd: " `date`

############################################################3
# Calculate the bands

IN=si_script.bands.in
OUT=si.bands.out
cat > $IN << EOF
&CONTROL
calculation = "bands",
prefix = "Si",
pseudo_dir = "$PSEUDO_DIR",
outdir = "$TMP_DIR",
tprnfor = .true.
wf_collect=.true.
/
&SYSTEM
ibrav = 2,
celldm(1) = 10.21,
nat = 2,
ntyp = 1,
ecutwfc = 20
nbnd = 8
/
&ELECTRONS
conv_thr = 1.D-8,
mixing_beta = 0.7D0 ,
/
ATOMIC_SPECIES
Si 28.086 Si.pz-vbc.UPF
ATOMIC_POSITIONS
Si 0.00 0.00 0.00
Si 0.25 0.25 0.25
K_POINTS {tpiba_b}
6
0.500 0.500 0.500 8 ! L
0.000 0.000 0.000 8 ! Gamma
0.000 1.000 0.000 8 ! X
0.250 1.000 0.250 1 ! U
0.750 0.750 0.000 8 ! K
0.000 0.000 0.000 1 ! Gamma
EOF

echo -e "\tStart: " `date`
COMMAND=" $RUN_COMMAND pw.x"
echo -e "\t\t$COMMAND < $IN > $OUT"
$COMMAND < $IN > $OUT
echo -e "\tEnd: " `date`

############################################################3
# Post-processing

IN=si_script.bandspp.in
OUT=si.bandspp.out
cat > $IN << EOF
&bands
prefix = "Si",
outdir='$TMP_DIR'
filband='Sibands.dat'
lsym=.true.
/
EOF

echo -e "\tStart: " `date`
COMMAND=" $RUN_COMMAND bands.x"
echo -e "\t\t$COMMAND < $IN > $OUT"
$COMMAND < $IN > $OUT
echo -e "\tEnd: " `date`


IN=si_script.plotband.in
OUT=si.plotband.out
cat > $IN << EOF
Sibands.dat
-6.0 10.0
Sibands.ps
6.377
1 6.377
EOF

echo -e "\tStart: " `date`
COMMAND="plotband.x"
echo -e "\t\t$COMMAND < $IN > $OUT"
$COMMAND < $IN > $OUT
echo -e "\tEnd: " `date`

echo "Run completed at: " `date`

rm -rf $TMP_DIR

############################################################3
# Plotting the bands

IN=Sibands.gnuplot
cat > $IN << EOF
set title "Si band structure from Sibands.dat.gnu"
#high-symmetry point: 0.5000 0.5000 0.5000 x coordinate 0.0000
#high-symmetry point: 0.0000 0.0000 0.0000 x coordinate 0.8660
#high-symmetry point: 0.0000 1.0000 0.0000 x coordinate 1.8660
#high-symmetry point: 0.2500 1.0000 0.2500 x coordinate 2.2196
#high-symmetry point: 0.7500 0.7500 0.0000 x coordinate 2.2196
#high-symmetry point: 0.0000 0.0000 0.0000 x coordinate 3.2802
L=0.0000
G1=0.8660
X=1.8660
U=2.2196
G2=3.2802
set xtics ("L" L,"{/Symbol G}" G1,"X" X,"U,K" U,"{/Symbol G}" G2) nomirror
set xrange [*:*]
set yrange [-13:4]
set grid x
set ylabel "Energy (eV)"
set nokey
EF = 6.377
set term pngcairo
set out "Sibands-nosym.png"
plot "Sibands.dat.gnu" u 1:(\$2-EF) with linespoints pointtype 7 pointsize 0.5,\
0 t "" w l lt 2
set term dumb size 120,40
set out
replot
EOF

echo -e "\tRunning gnuplot script: " `date`
gnuplot -p Sibands.gnuplot

exit

0 comments on commit 118bd30

Please sign in to comment.