clearvars plotVars

if ~isfield(out,'noPdbDistValue')
    out.noPdbDistValue      = 0;
elseif ~isfield(out,'plottedPoints')
    out.plottedPoints       = 0;
elseif ~isfield(out,'noSpinDiffValue')
    out.noSpinDiffValue     = 0;
end

plotVars.molviewON = 0;
plotVars.previousIndx = [1];
plotVars.count = 1;
plotVars.currenPlotFun = @plotRexpRpdbAllFun;

if exist('FH')
    
    if ishandle(FH)
    
        plotVars.molviewON = 0;
        [out work] = plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);
        
    elseif ~ishandle(FH)
        
        user.openMolViewer  = input('Open the molecular viewer as well (y/n) ? ','s');
    
        if user.openMolViewer == 'y'
        
            molView
        
            plotVars.molviewON = 0;
            [out work]= plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);
        
        elseif user.openMolViewer == 'n'
    
        FH = [];
        [out work]= plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);

        end
    
    elseif isempty(FH)
    
        user.openMolViewer  = input('Open the molecular viewer as well (y/n) ? ','s');
    
        if user.openMolViewer == 'y'
        
            molView
        
            plotVars.molviewON = 0;
            [out work]= plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);
        
        elseif user.openMolViewer == 'n'
    
            FH = [];
            [out work]= plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);

        end       
    end

end

if ~exist('FH')

    user.openMolViewer  = input('Open the molecular viewer as well (y/n) ? ','s');
    
    if user.openMolViewer == 'y'
        
        molView
        
        plotVars.molviewON = 0;
        
        [out work]= plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);
        
    elseif user.openMolViewer == 'n'
    
        FH = [];
        [out work]= plotSelectGui(sigmaData, out, work ,user, conditions, FH, plotVars);

    end
end