#!/bin/tcsh
## TK 14.9.2007
#BSUB -o jobfile.out
#BSUB -e jobfile.err
#BSUB -J GOLD40_RUN

#BSUB -L /bin/tcsh
#BSUB -N
#BSUB -u email@address
#BSUB -W 02:30
# assure that only one node is assigned
#BSUB -ext "SLURM[nodes=1]"
#BSUB -n 4
## NOTE! run only 4 instances of Gold simultaneously!
## NOTE! do not use #BSUB -ext "SLURM[nodes=1]" in serial jobs!

echo "Date is `date`"
echo "Submission directory is `pwd`"
echo "Running host is $HOSTNAME"
echo "JOB_ID is $LSB_JOBID"
echo "Machines are:"
echo $LSB_MCPU_HOSTS

# Need to parse gold.hosts
echo $LSB_MCPU_HOSTS > gold.hosts

# setup for GOLD
module load gold/4.0

# setup for PVM
setenv PVM_ROOT /v/linux26_x86_64/appl/chem/gold/gold_v4.0/GOLD_Suite/GOLD/pvm3
setenv PVM_ARCH LINUX64
setenv PVM_TMP $TMPDIR

# start PVMD
$PVM_ROOT/lib/LINUX64/pvmd3 & 

# INSERT GOLD RUN COMMANDS HERE

parallel_gold_auto $SLURM_NPROCS gold.conf gold.hosts

# GOLD RUN ENDED

# stop PVMD
echo halt | $PVM_ROOT/lib/LINUX64/pvm

