er317 cns_water refine on MU pike     
cp h2orefine directory to /pike/ramelota

from xplor calc.
get final .tbl files
get final xplor pdb files and put in xplorPDB dir (et24_1300c_dgsa_#.pdb)
make template_zn.pdb (any pdb file will work.  You can use one from the xplorPDB dir)
rename the xplor files to sa_#.pdb

setenv CNS_TOPPAR /usr/local/software/CNS/1.1/libraries/toppar

edit template_zn.pdb to fix zinc
also edit xplorPDB/sa_#.pdb to fix zinc.  Note that alignment is important:
ATOM   1249  OT2 ALA    83      69.296  13.232   5.744  1.00  0.00
ATOM   1250 ZN+2 ZN2   150      63.086  13.789 -10.407  1.00  0.00      zinc

run generate_h2o.inp once to create temp_h2o.pdb and er317_h2o.mtf
The file temp_h2o.pdb isn't used.
% cns < generate_h2o.inp > generate_h2o.out
This mtf has all His+ and CYS -SH, but this doesn't matter.

Edit generate_1.inp to remove the His HD1 and CYS SH:
delete select (name hg and resname cys and resid 5) end
delete select (name hg and resname cys and resid 8) end
delete select (name hg and resname cys and resid 21) end
delete select (name hg and resname cys and resid 24) end
delete select (name hg and resname cys and resid 34) end
delete select (name hg and resname cys and resid 37) end
delete select (name hg and resname cys and resid 54) end
delete select (name hd1 and resname his and resid 58) end

run generate_20.com  
after fixing generate_1.inp
This will run generate_#.inp 20 times, updating each pdb number 
this creates cnsPDB/sa_cns_#.pdb

edit and run re_h2o_zn.inp (re_h2o_tar.inp)
note:  used sum averaging and square potential
include the topology and parameters:
topology
    @@CNS_TOPPAR:ion.top
parameter
  @@CNS_TOPPAR:ion.param
fix restraints names in re_h2o.inp
This will write out refinedPDB/resa_#.pdb refinedPDB/resa_*.vio
% cns < re_h2o.inp > re_h2o.out &

xplor < ave_rota.inp > ave.out
look in ave.pdb for bb, hv ave rmsd values
grep "RMSD backbone" ave.out
grep "RMSD heavy" ave.out

