#!/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 # function to test the exit status of a job . ../check_failure.sh $ECHO $ECHO "$EXAMPLE_DIR : starting" $ECHO $ECHO "This example shows how to use cp.x to compute the equilibrium geometry" $ECHO "of a simple molecule, CO" # set the needed environment variables . ../environment_variables # required executables and pseudopotentials BIN_LIST="cp.x" PSEUDO_LIST=" O.pz-rrkjus.UPF C.pz-rrkjus.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 CP_COMMAND="$PARA_PREFIX $BIN_DIR/cp.x $PARA_POSTFIX" $ECHO $ECHO " running cp.x as: $CP_COMMAND" $ECHO # clean TMP_DIR $ECHO " cleaning $TMP_DIR...\c" rm -rf $TMP_DIR/* $ECHO " done" # molecular dynamics calculation cat > co.cp.start.in << EOF &control calculation='cp', restart_mode='from_scratch', nstep=20, iprint=20, isave=20, dt=5.0, ndr=90, ndw=91, pseudo_dir='$PSEUDO_DIR/', outdir='$TMP_DIR/', / &SYSTEM ibrav = 0, nat = 28, nelec = 140, ntyp = 2, ecutwfc = 24.D0, ecutrho = 144.D0, nr1b=16, nr2b=16, nr3b=16, qcutz=150., q2sigma=2.0, ecfixed=16.0, / &electrons electron_dynamics='damp', electron_damping=0.2, startingwfc='random', ampre=0.01, emass=700., emass_cutoff=3., / #&IONS # ion_dynamics='none', # ion_radius(1) = 1.0, ion_radius(2) =1.0, #/ ATOMIC_SPECIES O 16.00 O.pz-rrkjus.UPF C 12.00 C.pz-rrkjus.UPF ATOMIC_POSITIONS {angstrom} ! #1 C 0.33780000 0.33780000 0.33780000 ! (0) C 3.15280000 2.47720000 -0.33780000 ! (1) C -0.33780000 3.15280000 2.47720000 C 2.47720000 -0.33780000 3.15280000 ! (3) C 0.33780000 0.33780000 5.96780000 ! (4) C 3.15380000 2.47720000 5.29220000 ! (5) C 0.33780000 5.96780000 0.33780000 ! (6) C 2.47720000 5.29220000 3.15280000 ! (7) C 0.33780000 5.96780000 5.96780000 ! (8) C 5.96780000 0.33780000 0.33780000 ! (9) C 5.29220000 3.15280000 2.47720000 ! (10) C 5.96780000 0.33780000 5.96780000 ! (11) C 5.96780000 5.96780000 0.33780000 ! (12) C 5.96780000 5.96780000 5.96780000 ! (13) O -0.22520000 -0.22520000 -0.22520000 ! (0) O 2.58980000 3.04020000 0.22520000 ! (1) O 0.22520000 2.58980000 3.04020000 O 3.04020000 0.22520000 2.58980000 ! (3) O -0.22520000 -0.22520000 5.40480000 ! (4) O 2.58980000 3.04020000 5.85520000 ! (5) O -0.22520000 5.40480000 -0.22520000 ! (6) O 3.04020000 5.85520000 2.58980000 ! (7) O -0.22520000 5.40480000 5.40480000 ! (8) O 5.40480000 -0.22520000 -0.22520000 ! (9) O 5.85520000 2.58980000 3.04020000 ! (10) O 5.40480000 -0.22520000 5.40480000 ! (11) O 5.40480000 5.40480000 -0.2252000 ! (12) O 5.40480000 5.40480000 5.40480000 ! (13) CELL_PARAMETERS cubic 16.0000 0.000 0.000 0.000 16.0000 0.000 0.000 0.000 16.0000 $ECHO " running the calculation with fixed ions...\c" $CP_COMMAND < co.cp.start.in > co.cp.start.out check_failure $? $ECHO " done" EOF $ECHO $ECHO "$EXAMPLE_DIR: done"