#!/bin/bash

mv refmac.pdb refmac0.pdb
/sware64/refmac/refmac_linintel \
	XYZIN refmac0.pdb \
	XYZOUT refmac.pdb \
	HKLIN ddg_p65.mtz \
	HKLOUT refmac.mtz \
	LIBOUT refmac.cif \
	TLSIN tdg.tls     \
	TLSOUT tdg_ref.tls \
	PSRESTIN dna_restraints.dat << eof > refmac.log
make check NONE
make -
    hydrogen YES -
    hout NO -
    peptide NO -
    cispeptide YES -
    ssbridge YES -
    symmetry YES -
    sugar YES -
    connectivity NO -
    link NO
refinement exclude all from 1 E to 6 E 
refi -
    type REST -
    resi MLKF -
    meth CGMAT -
    bref ISOT
refi tlsc 10
ncyc 10
scal -
    type SIMP -
    reso 2.802 140.028 -
    LSSC -
    ANISO -
    EXPE
solvent YES -
    VDWProb 1.2 -
    IONProb 0.8 -
    RSHRink 0.8
weight -
    AUTO
NONBonding OVERall 20.0
monitor MEDIUM -
    torsion 10.0 -
    distance 10.0 -
    angle 10.0 -
    plane 10.0 -
    chiral 10.0 -
    bfactor 10.0 -
    bsphere 10.0 -
    rbond 10.0 -
    ncsr 10.0
labin  FP=F SIGFP=SIGF -
   FREE=FreeR_flag
labout  FC=FC FWT=FWT PHIC=PHIC PHWT=PHWT DELFWT=DELFWT PHDELWT=PHDELWT FOM=FOM
RSIZE 80
END
eof
ls -1 pdb/refmac*.pdb | wc -l | awk '{printf "cp refmac.pdb pdb/refmac%d.pdb\n",$1+1;}' | bash -sf
