#PBS -N test_server
#PBS -q express
#PBS -l nodes=1:ppn=4

#-----------------------------------------------------------------------------
setenv UNRES_BIN /users2/czarek/UNRES/git3_tmp/build/bin/unresMD-mult_ifort_MPI_E0LL2Y.exe
#-----------------------------------------------------------------------------
setenv DD /users2/czarek/UNRES/git3_tmp/unres/PARAM
setenv BONDPAR $DD/bond_AM1_ext_dum.parm
setenv THETPAR $DD/theta_abinitio_old_ext.parm
setenv THETPARPDB $DD/thetaml_ext.5parm
setenv ROTPARPDB $DD/scgauss_ext.parm
setenv ROTPAR $DD/rotamers_AM1_aura_ext.10022007.parm
setenv TORPAR $DD/torsion_631Gdp_old_ext.parm
setenv TORDPAR $DD/torsion_double_631Gdp_old_ext.parm
setenv ELEPAR $DD/electr_631Gdp_ext.parm
setenv SIDEPAR $DD//scinter_GB_ext_lip.parm
setenv FOURIER $DD/fourier_opt_ext.parm.1igd_hc_iter3_3
setenv SCCORPAR $DD/sccor_am1_pawel_ext.dat
setenv SCPPAR $DD/scp_ext.parm
setenv PATTERN $DD/patterns.cart
setenv LIPTRANPAR $DD/Lip_tran_initial_ext.parm
#-----------------------------------------------------------------------------
cd $PBS_O_WORKDIR

setenv MPIRUN "/users2/local/mpich2-1.4.1p1_intel/bin/mpirun "
set NPROCS=`cat $PBS_NODEFILE | wc -l`

setenv FGPROCS 4
setenv POT GB
setenv PREFIX file
setenv OUT1FILE YES

$MPIRUN -machinefile $PBS_NODEFILE -np $NPROCS $UNRES_BIN

if ( `grep -c pdbref file.inp` ) then
 awk '{if ( NF == 14 ) print}' file_GB000.stat > md.stat
else
 awk '{if ( NF == 10 ) print}' file_GB000.stat > md.stat
endif

../../files/matplotlib_fit_hist.py $dimen3
rm md.stat

if ( -f "file_MD000.pdb" ) then
 mkdir tmp
 /users2/local/pymol_1.6/pymol -c ../files/movie.pml
 ffmpeg2theora tmp/aa%4d.png -o md.ogv
 rm -rf tmp
else
 /users2/czarek/UNRES/git3_tmp/build/bin/xdrf2pdb-mult one file.seq file_MD000.cx
 mkdir tmp
 /users2/local/pymol_1.6/pymol -c ../files/movie.pml
 ffmpeg2theora tmp/aa%4d.png -o md.ogv
 rm -rf tmp file_MD000.pdb
endif

touch finished
