def retr_lattice_type(xtalstr,ini0):
    """
    Retrieve lattice type.

    Lookup the crystal_system, find out whether the structure is
    Bcc, Fcc or something else and lookup the corresponding lattice
    type. Add the lattice type to the dictionary and return the
    updated dictionary.

    The logic is copied from pymatgen.symmetry.bandstructure
    HighSymmKpath. That routine acknowledges:

    W. Setyawan, S. Curtarolo (2010), "High-throughput electronic
    band structure calculations: Challenges and tools".
    Computational Materials Science, 49(2), 299-312. 
    DOI: 10.1016/j.commatsci.2010.05.010
    """
    lattice    = xtalstr.crystal_system
    hall       = xtalstr.spacegroup_hall
    lattice_tp = None
    if   lattice == "cubic":
        if   "P" in hall:
            lattice_tp = "cubic"
        elif "F" in hall:
            lattice_tp = "cubic_fcc"
        elif "I" in hall:
            lattice_tp = "cubic_bcc"
        else:
            print("Unexpected lattice and Hall symbol combination: %s, %s" % (lattice,hall))
            exit(1)
    elif lattice == "tetragonal":
        if   "P" in hall:
            lattice_tp = "tetragonal"
        elif "I" in hall:
            lattice_tp = "tetragonal_bcc"
        else:
            print("Unexpected lattice and Hall symbol combination: %s, %s" % (lattice,hall))
            exit(1)
    elif lattice == "orthorhombic":
        if   "P" in hall:
            lattice_tp = "orthorhombic"
        elif "A" in hall:  # Base centered, no separately recognized
            lattice_tp = "orthorhombic"
        elif "B" in hall:  # Base centered, no separately recognized
            lattice_tp = "orthorhombic"
        elif "C" in hall:  # Base centered, no separately recognized
            lattice_tp = "orthorhombic"
        elif "F" in hall:
            lattice_tp = "orthorhombic_fcc"
        elif "I" in hall:
            lattice_tp = "orthorhombic_bcc"
        else:
            print("Unexpected lattice and Hall symbol combination: %s, %s" % (lattice,hall))
            exit(1)
    elif lattice == "hexagonal":
        lattice_tp = "hexagonal"
    elif lattice == "monoclinic":
        lattice_tp = "monoclinic"
    elif lattice == "trigonal" or lattice == "rhombohedral":
        lattice_tp = "rhombohedral"
    elif lattice == "triclinic":
        lattice_tp = "triclinic"
    else:
        print("Unexpected lattice: %s" % lattice)
        exit(1)
    ini0["hall"]         = hall
    if lattice_tp:
        if (lattice_tp == 'cubic'):
            ini0["istruc"]     = -1
        elif (lattice_tp == 'cubic_bcc'):
            ini0["istruc"]     = -2
        elif (lattice_tp == 'cubic_fcc'):
            ini0["istruc"]     = -3
        elif (lattice_tp == 'hexagonal'):
            ini0["istruc"]     = -4
        elif (lattice_tp == 'tetragonal'):
            ini0["istruc"]     = -5
        elif (lattice_tp == 'tetragonal_bcc'):
            ini0["istruc"]     = -6
        elif (lattice_tp == 'orthorhombic'):
            ini0["istruc"]     = -7
        elif (lattice_tp == 'orthorhombic_bcc'):
            ini0["istruc"]     = -8
        elif (lattice_tp == 'orthorhombic_fcc'):
            ini0["istruc"]     = -9
        elif (lattice_tp == 'monoclinic'):
            ini0["istruc"]     = -10
        elif (lattice_tp == 'rhombohedral'):
            ini0["istruc"]     = -11
        elif (lattice_tp == 'triclinic'):
            ini0["istruc"]     = -13
    else:
      ini0["istruc"]     = 0
    ini0["lattice_type"] = lattice_tp
    return ini0