def reduce_output_path(path=None, pdb_name=None):
    """Defines location of Reduce output files relative to input files."""
    if not path:
        if not pdb_name:
            raise NameError(
                "Cannot save an output for a temporary file without a PDB"
                "code specified")
        pdb_name = pdb_name.lower()
        output_path = Path(global_settings['structural_database']['path'],
                           pdb_name[1:3].lower(), pdb_name[:4].lower(),
                           'reduce', pdb_name + '_reduced.mmol')
    else:
        input_path = Path(path)
        if len(input_path.parents) > 1:
            output_path = input_path.parents[1] / 'reduce' / \
                (input_path.stem + '_reduced' + input_path.suffix)
        else:
            output_path = input_path.parent / \
                (input_path.stem + '_reduced' + input_path.suffix)
    return output_path
Defines location of Reduce output files relative to input files.