function scaledValue = scaleRho2labSchemeFun(rawValue,ATOMj,resName_j,conditions,user)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% autorelaxation are not scaled to multiplicity


if ismember(ATOMj, conditions.all.exSolAtoms)
              
	scaledValue       = (1-user.perCentD2O/100) * rawValue;        
                 
elseif ismember(ATOMj, conditions.all.HA)
                 
	scaledValue       = (1-user.deut_HA/100) * rawValue;
                 
elseif ismember(ATOMj, conditions.all.methylPseudo(1:8))                                    % methyl pseudo not labled
                 
    scaledValue       = (1-user.deut_Met/100) * rawValue;
            
elseif ismember(ATOMj, conditions.all.methylAtoms)                                          % methyl single not labled
                 
    scaledValue       = (1-user.deut_Met/100) * rawValue;
    
else
                                  
    scaledValue       = (1-user.deut_Prot/100) * rawValue;
                 
end
                


labelFlag    = 0;
               
for a = 1:size(conditions.labelingScheme,2)
                
    if labelFlag == 0 && isequal(double(resName_j),double(conditions.labelingScheme(a).resName))    % conversion of char to double    
        
        if ismember(ATOMj, conditions.labelingScheme(a).grpNum)                             % Pseudo Atom
            
         	labelFlag = 1;
                        
            scaledValue = (1 - conditions.labelingScheme(a).deutLevel/100) * rawValue;
            
     	elseif ismember(ATOMj, conditions.labelingScheme(a).atoms)
                        
         	labelFlag = 1;
            
           	scaledValue = (1 - conditions.labelingScheme(a).deutLevel/100) * rawValue;      % Single Atom
                        
        end
                    
    end
                
end


