%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%      corrSigAndDistCalcSelectStereo     %%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if ~isfield(user, 'corrSigStereo')
    fprintf('\nYou did not provide any stereo specificity, all values will be averaged!\n')
    for j = 1:length(sigmaData)
        sigmaData(j).numcode.stAssi = 0;
        sigmaData(j).numcode.stAssj = 0;
    end
elseif user.corrSigStereo == 'n'
    fprintf('\nYou did not provide any stereo specificity, all values will be averaged!\n')
    for j = 1:length(sigmaData)
        sigmaData(j).numcode.stAssi = 0;
        sigmaData(j).numcode.stAssj = 0;
    end
else

for j = 1:length(sigmaData)
    sigmaData(j).numcode.stAssi = 0;
    sigmaData(j).numcode.stAssj = 0;
end

file                                                = fopen (user.corrSigStereo, 'r');
stereoSpecAssRaw                                    = fscanf (file, '%d  %d  %d',[3 inf])';
fclose (file);

c = 1;
for i = 1:length(stereoSpecAssRaw)
        
        stereoSpecAss(c).ASS                        = stereoSpecAssRaw(i,1);
        stereoSpecAss(c).ATOM                       = stereoSpecAssRaw(i,2);
        
        c = c + 1;
        
        stereoSpecAss(c).ASS                        = stereoSpecAssRaw(i,1);
        stereoSpecAss(c).ATOM                       = stereoSpecAssRaw(i,3);
        
        c = c + 1;
        
end

for j = 1:length(sigmaData)
    for c = 1:length(stereoSpecAss)
        if (sigmaData(j).numcode.ASSi == stereoSpecAss(c).ASS && ...
            sigmaData(j).numcode.ATOMi == stereoSpecAss(c).ATOM)
            sigmaData(j).numcode.stAssi = 1;
        elseif (sigmaData(j).numcode.ASSj == stereoSpecAss(c).ASS && ...
            sigmaData(j).numcode.ATOMj == stereoSpecAss(c).ATOM)
            sigmaData(j).numcode.stAssj = 1;
        end
    end
end

end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%