mirror of https://gitlab.com/QEF/q-e.git
152 lines
3.5 KiB
Bash
Executable File
152 lines
3.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# 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 cpvib.x to calculate the normal modes,"
|
|
$ECHO "Born charge tensors and infrared cross-section of a single water "
|
|
$ECHO "molecule in vacuum. The coordinates of the atoms in the molecule are"
|
|
$ECHO "already in a good ground state configuration, no geometry optimization"
|
|
$ECHO "is required."
|
|
|
|
# set the needed environment variables
|
|
. ../environment_variables
|
|
|
|
# required executables and pseudopotentials
|
|
BIN_LIST="cpvib.x"
|
|
PSEUDO_LIST="H.fpmd.UPF O.BLYP.UPF"
|
|
|
|
$ECHO
|
|
$ECHO " executables directory: $BIN_DIR"
|
|
$ECHO " pseudo directory: $PSEUDO_DIR"
|
|
$ECHO " temporary directory: $TMP_DIR"
|
|
$ECHO " checking that needed directories and files exist...\c"
|
|
|
|
# check for directories
|
|
for DIR in "$BIN_DIR" "$PSEUDO_DIR" ; do
|
|
if test ! -d $DIR ; then
|
|
$ECHO
|
|
$ECHO "ERROR: $DIR not existent or not a directory"
|
|
$ECHO "Aborting"
|
|
exit 1
|
|
fi
|
|
done
|
|
for DIR in "$TMP_DIR" "$EXAMPLE_DIR/results" ; do
|
|
if test ! -d $DIR ; then
|
|
mkdir $DIR
|
|
fi
|
|
done
|
|
cd $EXAMPLE_DIR/results
|
|
|
|
# check for executables
|
|
for FILE in $BIN_LIST ; do
|
|
if test ! -x $BIN_DIR/$FILE ; then
|
|
$ECHO
|
|
$ECHO "ERROR: $BIN_DIR/$FILE not existent or not executable"
|
|
$ECHO "Aborting"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# check for pseudopotentials
|
|
for FILE in $PSEUDO_LIST ; do
|
|
if test ! -r $PSEUDO_DIR/$FILE ; then
|
|
$ECHO
|
|
$ECHO "ERROR: $PSEUDO_DIR/$FILE not existent or not readable"
|
|
$ECHO "Aborting"
|
|
exit 1
|
|
fi
|
|
done
|
|
$ECHO " done"
|
|
|
|
|
|
# how to run executables
|
|
PW_COMMAND="$PARA_PREFIX $BIN_DIR/cpvib.x $PARA_POSTFIX"
|
|
$ECHO
|
|
$ECHO " running cpvib.x as: $PW_COMMAND"
|
|
$ECHO
|
|
|
|
|
|
# clean TMP_DIR
|
|
$ECHO " cleaning $TMP_DIR...\c"
|
|
rm -rf $TMP_DIR/*
|
|
$ECHO " done"
|
|
|
|
# molecular dynamics calculation
|
|
cat > h2o.cp.in << EOF
|
|
&control
|
|
title = ' Water Molecule ',
|
|
calculation = 'scf',
|
|
restart_mode = 'from_scratch',
|
|
ndr = 51,
|
|
ndw = 51,
|
|
nstep = 100,
|
|
etot_conv_thr = 1.d-9,
|
|
ekin_conv_thr = 1.d-6,
|
|
prefix = 'h2o'
|
|
pseudo_dir='$PSEUDO_DIR/',
|
|
outdir='$TMP_DIR/',
|
|
/
|
|
&system
|
|
ibrav = 1,
|
|
celldm(1) = 12.0,
|
|
nat = 3,
|
|
ntyp = 2,
|
|
nbnd = 4,
|
|
nelec = 8,
|
|
ecutwfc = 80.0,
|
|
nr1b= 10, nr2b = 10, nr3b = 10,
|
|
/
|
|
&electrons
|
|
electron_dynamics = 'cg',
|
|
electron_velocities = 'zero',
|
|
/
|
|
&ions
|
|
ion_dynamics = 'none',
|
|
ion_radius(1) = 0.8d0,
|
|
ion_radius(2) = 0.8d0,
|
|
/
|
|
ATOMIC_SPECIES
|
|
O 16.0d0 O.BLYP.UPF 4
|
|
H 1.00d0 H.fpmd.UPF 4
|
|
ATOMIC_POSITIONS (bohr)
|
|
O 0.00957000000000 0.00957000000000 0.00000000000000 1 1 1
|
|
H 1.83318000000000 -0.21765000000000 -0.00015000000000 1 1 1
|
|
H -0.21765000000000 1.83318000000000 0.00028000000000 1 1 1
|
|
EOF
|
|
|
|
cat > $TMP_DIR/h2o.vib.inp << EOF
|
|
&INPUT_VIB
|
|
displacement = 0.02
|
|
save_freq = 1
|
|
trans_inv_flag = .TRUE.
|
|
trans_rot_inv_flag = .TRUE.
|
|
trans_inv_max_iter = 50
|
|
trans_inv_conv_thr = 1e-15
|
|
restart_label = 'auto'
|
|
animate = .TRUE.
|
|
/
|
|
&ISOTOPES
|
|
isotope(1) = 16.0,
|
|
/
|
|
EOF
|
|
|
|
$ECHO " running the CPVIB calculation for water molecule in vacuum ...\c"
|
|
$PW_COMMAND < h2o.cp.in > h2o.cp.out
|
|
$ECHO " done"
|
|
|
|
$ECHO " copying to local directory: h2o.vib.inp h2o.vib.analysis"
|
|
cp $TMP_DIR/h2o.vib.inp .
|
|
cp $TMP_DIR/h2o.vib.analysis .
|
|
|
|
|
|
$ECHO
|
|
$ECHO "$EXAMPLE_DIR : done"
|