function [struct, indices, out] = HpdbSerNoFun(struct, pdbHnumCode, indices, out)

out.noHpdbSerNo         = 0;
count.noHpdbSerNoATOMi  = 1;
count.noHpdbSerNoATOMj  = 1;

for j = 1:length(struct)
    
    for s = 1:length(pdbHnumCode.Model.Atom)
        
        if ~isempty(struct(j).numcode.ATOMi_H)
            for b = 1:length(struct(j).numcode.ATOMi_H)
                if struct(j).numcode.ASSi == pdbHnumCode.Model.Atom(s).resSeq && struct(j).numcode.ATOMi_H(b) == pdbHnumCode.Model.Atom(s).NumCode
                   struct(j).numcode.ATOMi_HpdbSerNo(b)    = pdbHnumCode.Model.Atom(s).AtomSerNo;
                end
            end
        end
        
        if ~isempty(struct(j).numcode.ATOMj_H)
            for b = 1:length(struct(j).numcode.ATOMj_H)
                if struct(j).numcode.ASSj == pdbHnumCode.Model.Atom(s).resSeq && struct(j).numcode.ATOMj_H(b) == pdbHnumCode.Model.Atom(s).NumCode
                   struct(j).numcode.ATOMj_HpdbSerNo(b)    = pdbHnumCode.Model.Atom(s).AtomSerNo;
                end
            end
        end
        
    end
end


for j = 1:length(struct)
        
        if ~isempty(struct(j).numcode.ATOMi_H)
            
            b = length(struct(j).numcode.ATOMi_H);
            c = length(struct(j).numcode.ATOMi_HpdbSerNo);
                
            if b ~= c
                indices.sigmaData.ATOMi.noHpdbSerNo(count.noHpdbSerNoATOMi)   = j;
                count.noHpdbSerNoATOMi  = count.noHpdbSerNoATOMi + 1;
            end
        end
        
        if ~isempty(struct(j).numcode.ATOMj_H)
            
            b = length(struct(j).numcode.ATOMj_H);
            c = length(struct(j).numcode.ATOMj_HpdbSerNo);
                
            if b ~= c
                indices.sigmaData.ATOMj.noHpdbSerNo(count.noHpdbSerNoATOMj)   = j;
                count.noHpdbSerNoATOMj 	= count.noHpdbSerNoATOMj + 1;
            end
        end
end

count.noHpdbSerNoATOMi  = count.noHpdbSerNoATOMi  - 1;
count.noHpdbSerNoATOMj  = count.noHpdbSerNoATOMj  - 1;

if count.noHpdbSerNoATOMi + count.noHpdbSerNoATOMj ~= 0
    
    indices.sigmaData.ATOMi.noHpdbSerNo         = unique(indices.sigmaData.ATOMi.noHpdbSerNo);
    indices.sigmaData.ATOMj.noHpdbSerNo         = unique(indices.sigmaData.ATOMj.noHpdbSerNo);
    indices.sigmaData.union.noHpdbSerNo         = union(    [indices.sigmaData.ATOMi.noHpdbSerNo], [indices.sigmaData.ATOMj.noHpdbSerNo]);
    indices.sigmaData.intersect.noHpdbSerNo     = intersect([indices.sigmaData.ATOMi.noHpdbSerNo], [indices.sigmaData.ATOMj.noHpdbSerNo]);
    
    out.noHpdbSerNo = length(indices.sigmaData.union.noHpdbSerNo);
    
end
