{+ file: generate_sdb.inp +}
{+ directory: xtal_phase +}
{+ description: Generates a site database file containing entries with
                the specified derivative name and heavy atom type. +}
{+ comment: 
         - The requested number of new entries will be generated.
         - The derivative name or type can be left blank.
         - When a site database files is read by CNS entries with a
           blank derivative name are deleted and will not be written
           in any output site database files. +}
{+ authors: Axel T. Brunger, and Paul D. Adams +}
{+ copyright: Yale University +}

{- Guidelines for using this file:
   - all strings must be quoted by double-quotes
   - logical variables (true/false) are not quoted
   - do not remove any evaluate statements from the file -}

{- begin block parameter definition -} define(

{============================ space group ============================}

{* space group *}
{* use International Table conventions with subscripts substituted
   by parenthesis *}
{===>} sg="";

{============================== sites ================================}

{* number of sites to generate *}
{===>} sitedatabase_entries=10;

{* derivative name for new sites *}
{===>} derivative_name="EMC";

{* heavy atom type *}
{===>} derivative_type="HG";

{=========================== output files ============================}

{* output heavy atom database file *}
{===>} sitedatabase_outfile="generate_sdb.sdb";

{===========================================================================}
{        things below this line do not normally need to be changed          }
{===========================================================================}

 ) {- end block parameter definition -}

 checkversion 1.2

 evaluate ($log_level=quiet)

 if ( &sitedatabase_entries > 0 ) then

   topology
     mass site 10.0
     resid site
       group
         atom site type=site charge=0.0 end
     end
   end

   segment
     name=&derivative_name
     molecule
       number=&sitedatabase_entries
       name=SITE
     end
   end

   do (x=0) (all)
   do (y=0) (all)
   do (z=0) (all)
   do (b=0) (all)
   do (q=0) (all)

   do (chemical=&derivative_type) (all)

   identity (store3) (all)
   do (store4=0) (all)

 end if

 @CNS_XTALMODULE:coord_to_sdb (sitedb=$allsites;
                               use_array=store3;
                               fix_array=store4;
                               selection=(all);)

 @CNS_XTALMODULE:write_sdb (sitedb=$allsites;
                            sg=&sg;
                            output=&sitedatabase_outfile;)

 stop