#######
# MAP #
#######
save_MAP
    _category.description
;             Data items in the MAP category record
              the details of a maps. Maps record values of parameters,
              such as density, that are functions of position within
              a cell or are functions of orthogonal coordinates in
              three space.
              
              A map may is composed of one or more map segments
              specified in the MAP_SEGMENT category.
              
              Maps are optionally keyed to a particular _diffrn.id
              or to a particular _entry.id, so that multiple maps
              for different data collections or entries may be
              collected in one data block.
              
              Examples are given in the MAP_SEGMENT category.
;
    _category.id                   map
    _category.mandatory_code       no
     loop_
    _category_key.name             '_map.id'
                                   '_map.diffrn_id'
                                   '_map.entry_id'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;   Example 1 - Identifying an observed density map
                and a calculated density map
;
;
        
        loop_
        _map.id
        _map.details
        
        rho_calc
;
        density calculated from F_calc derived from the ATOM_SITE list
;
        rho_obs
;
        density combining the observed structure factors with the
        calculated phases
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    save_
save__map.details
     _item_description.description
;              The value of _map.details should give a
               description of special aspects of each map.
;
    _item.name                  '_map.details'
    _item.category_id             map
    _item.mandatory_code          no
    _item_type.code               text
     loop_
    _item_examples.case
    _item_examples.detail
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;   Example 1 - Identifying an observed density map
                and a calculated density map
;
;
        
        loop_
        _map.id
        _map.details
        
        rho_calc
;
        density calculated from F_calc derived from the ATOM_SITE list
;
        rho_obs
;
        density combining the observed structure factors with the
        calculated phases
;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      save_
      
save__map.diffrn_id
    _item_description.description
;             This item is a pointer to _diffrn.id in the
              DIFFRN category.
;
    _item.name                  '_map.diffrn_id'
    _item.category_id             map
    _item.mandatory_code          implicit
    _item_type.code               code
     save_
save__map.entry_id
    _item_description.description
;             This item is a pointer to _entry.id in the
              ENTRY category.
;
    _item.name                  '_map.entry_id'
    _item.category_id             map
    _item.mandatory_code          implicit
    _item_type.code               code
     save_
save__map.id
    _item_description.description
;             The value of _map.id must uniquely identify
              each map for the given diffrn.id or entry.id.
;
     loop_
    _item.name
    _item.category_id
    _item.mandatory_code
           '_map.id'                map          yes
           '_map_segment.id'        map_segment  yes
    _item_type.code               code
     loop_
    _item_linked.child_name
    _item_linked.parent_name
           '_map_segment.id'        '_map.id'
     save_
###########################
# MAP_SEGMENT #
###########################
save_MAP_SEGMENT
    _category.description
;             Data items in the MAP_SEGMENT category record
              the details about each segment (section or brick) of a map. 
;
    _category.id                   map_segment
    _category.mandatory_code       no
     loop_
    _category_key.name             '_map_segment.id'
                                   '_map_segment.map_id'
    loop_
    _category_group.id             'inclusive_group'
                                   'array_data_group'
    loop_
    _category_examples.detail
    _category_examples.case
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;   Example 1 - Identifying an observed density map
                and a calculated density map, each consisting of one
                segment, both using the same array structure
                and mask.
;
;
        
        loop_
        _map.id
        _map.details
        
        rho_calc
;
        density calculated from F_calc derived from the ATOM_SITE list
;
        rho_obs
;
        density combining the observed structure factors with the
        calculated phases
;
        loop_
        _map_segment.map_id
        _map_segment.id
        _map_segment.array_id
        _map_segment.binary_id
        _map_segment.mask_array_id
        _map_segment.mask_binary_id
        rho_calc rho_calc map_structure 1 mask_structure 1
        rho_obs  rho_obs  map_structure 2 mask_structure 1
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    save_
save__map_segment.array_id
    _item_description.description
;             The value of _map_segment.array_id identifies the array structure 
              into which the map is organized.
              This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
;
    _item.name                  '_map_segment.array_id'
    _item.category_id             map_segment
    _item.mandatory_code          yes
    _item_type.code               code
     save_
save__map_segment.binary_id
    _item_description.description
;             The value of _map_segment.binary_id distinguishes the particular set
              of data organized according to _map_segment.array_id in which
              the data values of the map are stored.
              This item is a pointer to _array_data.binary_id in the
              ARRAY_DATA category.
;
    _item.name                  '_map_segment.binary_id'
    _item.category_id             map_segment
    _item.mandatory_code          implicit
    _item_type.code               int
     save_
save__map_segment.mask_array_id
    _item_description.description
;             The value of _map_segment.mask_array_id, if given, the array structure
              into which the mask for the map is organized.  If no value is given,
              then all elements of the map are valid.  If a value is given, then
              only elements of the map for which the corresponding element of
              the mask is non-zero are valid.  The value of 
              _map_segment.mask_array_id differ from the value of
              _map_segment.array_id in order to permit the mask to be given
              as, say, unsigned 8-bit integers, while the map is given as
              a data type with more range.  However, the two array structures
              must be aligned, using the same axes in the same order with the
              same displacements and increments
              This item is a pointer to _array_structure.id in the
              ARRAY_STRUCTURE category.
;
    _item.name                  '_map_segment.mask_array_id'
    _item.category_id             map_segment
    _item.mandatory_code          no
    _item_type.code               code
     save_
save__map_segment.mask_binary_id
    _item_description.description
;             The value of _map_segment.mask_binary_id identifies the particular set
              of data organized according to _map_segment.mask_array_id specifying
              the mask for the map.
              This item is a pointer to _array_data.mask_binary_id in the
              ARRAY_DATA category.
;
    _item.name                  '_map_segment.mask_binary_id'
    _item.category_id             map_segment
    _item.mandatory_code          implicit
    _item_type.code               int
     save_
save__map_segment.id
    _item_description.description
;             The value of _map_segment.id must uniquely
              identify each segment of a map.
;
     loop_
    _item.name
    _item.category_id
    _item.mandatory_code
           '_map_segment.id'
           map_segment
           yes
    _item_type.code               code
     loop_
    _item_linked.child_name
    _item_linked.parent_name
           '_map_data_frame.map_segment_id'
           '_map_segment.id'
     save_
save__map_segment.map_id
    _item_description.description
;              This item is a pointer to _map.id
               in the MAP category.
;
    _item.name                  '_map_segment.map_id'
    _item.category_id             map_segment
    _item.mandatory_code          yes
    _item_type.code               code
     save_
save__map_segment.details
     _item_description.description
;              The value of _map_segment.details should give a
               description of special aspects of each segment of a map.
;
    _item.name                  '_map_segment.details'
    _item.category_id             map_segment
    _item.mandatory_code          no
    _item_type.code               text
     loop_
    _item_examples.case
    _item_examples.detail
;               Example to be provided
;
;               
;
      save_