Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
faq:chimie:gaussian [2020/04/10 08:14] – [Submission script Gaussian 16] tjiangfaq:chimie:gaussian [2022/03/03 16:29] (Version actuelle) – [Submission script Gaussian 16] tjiang
Ligne 14: Ligne 14:
  
 # trace script (debug purpose, not mandatory) # trace script (debug purpose, not mandatory)
-set -x+#set -x
 # set globals # set globals
-job=structure11 +job="structure11" 
-ExtIn=com +ExtIn="com" 
-ExtOut=log+ExtOut="log"
  
 # Environment setting for gaussian # Environment setting for gaussian
Ligne 37: Ligne 37:
     exit     exit
 fi fi
-source $g16root/g16/bsd/g16.profile +source "$g16root/g16/bsd/g16.profile" 
-export Gaussian=$g16root/g16/g16+export Gaussian="$g16root/g16/g16"
  
-cd ${SGE_O_WORKDIR} +#cd "${SGE_O_WORKDIR}" || { echo "cannot cd to ${SGE_O_WORKDIR}"; exit 1; 
-echo "########## begin env##################" +#echo "########## begin env##################" 
-env +#env 
-echo "########## end env ##################"+#echo "########## end env ##################"
 echo "########## Hostname ##################" echo "########## Hostname ##################"
 hostname hostname
  
-HOMEDIR=${SGE_O_WORKDIR} +HOMEDIR="${SGE_O_WORKDIR}"
-cd ${HOMEDIR} +
 # Replace 'home' by 'scratch', from SGE_O_WORKDIR, store to SCRATCHDIR # Replace 'home' by 'scratch', from SGE_O_WORKDIR, store to SCRATCHDIR
 # check if scratch exist, create or complain # check if scratch exist, create or complain
 if [[ -d "/scratch/Chimie" ]] if [[ -d "/scratch/Chimie" ]]
 then then
-    SCRATCHDIR=/scratch/Chimie/$USER/$JOB_ID/ +    SCRATCHDIR="/scratch/Chimie/${USER}/${JOB_ID}/" 
-    mkdir -p ${SCRATCHDIR}+    mkdir -p "${SCRATCHDIR}"
 elif [[ -d "/scratch/Lake" ]] elif [[ -d "/scratch/Lake" ]]
 then then
-    SCRATCHDIR=/scratch/Lake/$USER/$JOB_ID/ +    SCRATCHDIR=/scratch/Lake/${USER}/${JOB_ID}
-    mkdir -p ${SCRATCHDIR}+    mkdir -p "${SCRATCHDIR}"
 elif [[ -d "/scratch/E5N" ]] elif [[ -d "/scratch/E5N" ]]
 then then
-    SCRATCHDIR=/scratch/E5N/$USER/$JOB_ID/ +    SCRATCHDIR=/scratch/E5N/${USER}/${JOB_ID}
-    mkdir -p ${SCRATCHDIR} +    mkdir -p "${SCRATCHDIR}"
-elif [[ -d "/scratch/E5" ]] +
-then +
-    SCRATCHDIR=/scratch/E5/$USER/$JOB_ID/ +
-    mkdir -p ${SCRATCHDIR}+
 else else
     echo "/scratch not found, cannot create ${SCRATCHDIR}"     echo "/scratch not found, cannot create ${SCRATCHDIR}"
 +    exit 1
 fi fi
  
-# check if scratchdir is OK +CalcDir="${SCRATCHDIR}" 
-echo "ok>  ${SCRATCHDIR}/toto +echo "Creating scratch for this job: ${SCRATCHDIR}" 
-Ok=$(cat  ${SCRATCHDIR}/toto) +mkdir -p "${CalcDir}" 
-if [[ "${Ok}" != "ok" ]] +
-then +
-    # if scratch is unavailable, fallback to home +
-    CalcDir="${SGE_O_WORKDIR}/scratch"_${job} +
-    mkdir -p ${CalcDir} +
-else +
-    CalcDir=${SCRATCHDIR} +
-fi+
  
 # Gaussian specific ScratchDir # Gaussian specific ScratchDir
-export GAUSS_SCRDIR=${CalcDir}+export GAUSS_SCRDIR="${CalcDir}"
  
 Machine=$(hostname) Machine=$(hostname)
Ligne 91: Ligne 79:
 # check if there is a chk or chk.gz # check if there is a chk or chk.gz
 # TODO/FIXME there's a problem here, watching the trace: if no chk, it create a .chk.chk # TODO/FIXME there's a problem here, watching the trace: if no chk, it create a .chk.chk
-NChk=grep -i "chk" ${job}.${ExtIn} | head -1 | sed 's/=/ /g' | awk '{print $2}'`+NChk=$(grep -i "chk" ${job}.${ExtIn} | head -1 | sed 's/=/ /g' | awk '{print $2}')
 if [ "$NChk" != "" ] if [ "$NChk" != "" ]
 then then
-NChk=basename $NChk .chk`.chk+NChk=$(basename "$NChk.chk).chk
 fi fi
-if [[ -s ${HOMEDIR}/${NChk} ]]+if [[ -s "${HOMEDIR}/${NChk}]]
 then then
-    cp ${HOMEDIR}/${NChk} ${CalcDir}/${NChk}+    cp "${HOMEDIR}/${NChk}" "${CalcDir}/${NChk}"
 fi fi
-if [[ -s ${HOMEDIR}/${NChk}.gz ]]+if [[ -s "${HOMEDIR}/${NChk}.gz]]
 then then
-    cp ${HOMEDIR}/${NChk}.gz ${CalcDir}/${NChk}.gz +    cp "${HOMEDIR}/${NChk}.gz" "${CalcDir}/${NChk}.gz" 
-    gunzip ${CalcDir}/${NChk}.gz+    gunzip "${CalcDir}/${NChk}.gz"
 fi fi
  
-cp ${HOMEDIR}/${job}.${ExtIn} ${CalcDir}/+cp "${HOMEDIR}/${job}.${ExtIn}" "${CalcDir}/"
  
 # logrotate old logs # logrotate old logs
-if [[ -s ${HOMEDIR}/${job}.${ExtOut} ]]+if [[ -s "${HOMEDIR}/${job}.${ExtOut}]]
 then then
     Ext=1     Ext=1
-    while [[ -s ${HOMEDIR}/${job}.${ExtOut}_${Ext} ]]+    while [[ -s "${HOMEDIR}/${job}.${ExtOut}_${Ext}]]
     do     do
-        let Ext=Ext+1+        #let Ext=Ext+1 
 +        Ext=$(( Ext+1 ))
     done     done
-    mv ${HOMEDIR}/${job}.${ExtOut} ${HOMEDIR}/${job}.${ExtOut}_${Ext}+    mv "${HOMEDIR}/${job}.${ExtOut}" "${HOMEDIR}/${job}.${ExtOut}_${Ext}"
 fi fi
  
-cd ${CalcDir} +cd "${CalcDir}" || { echo "cannot cd to ${CalcDir}"; exit 1; 
-echo ${CalcDir}+echo "${CalcDir}"
 ls -al ls -al
  
-echo "time ${Gaussian} < ${job}.${ExtIn} > ${HOMEDIR}/${job}.${ExtOut}"+#echo "time ${Gaussian} < ${job}.${ExtIn} > ${HOMEDIR}/${job}.${ExtOut}"
  
 #/usr/bin/time ${Gaussian} < ${job}.${ExtIn} > ${HOMEDIR}/${job}.${ExtOut} #/usr/bin/time ${Gaussian} < ${job}.${ExtIn} > ${HOMEDIR}/${job}.${ExtOut}
-${Gaussian} < ${job}.${ExtIn} > ${HOMEDIR}/${job}.${ExtOut}+"${Gaussian}"${job}.${ExtIn}"${HOMEDIR}/${job}.${ExtOut}"
  
-if [[ -s ${NChk} ]]+if [[ -s "${NChk}]]
 then then
-    gzip -9 ${NChk} +    gzip -9 "${NChk}" 
-    cp ${NChk}.gz ${HOMEDIR}/+    cp "${NChk}.gz" "${HOMEDIR}/"
 fi fi
  
-cp * ${HOMEDIR}/+ 
 +#copy back everything including the huge rwf files, normally we don't need it 
 +#cp -- "${HOMEDIR}/
 +cp -- outputfiles_only "${HOMEDIR}/"
  
 # final cleanup (commented during debug) # final cleanup (commented during debug)
-rm -r ${GAUSS_SCRDIR} +rm -r "${GAUSS_SCRDIR}
-rm -r ${CalcDir}+ 
  
-#Remove Gau-* files that we don't need 
-cd ${HOMEDIR} 
-rm -f Gau-* 
 </code> </code>
faq/chimie/gaussian.1586506468.txt.gz · Dernière modification : 2020/08/25 15:58 (modification externe)