private void calcChromConfig(int c) {
        chrconf = new ChromConfig();
        chrconf.chromseq = new int[popdata.ploidy];
        if (popdata.ploidy == 2) {
            chrconf.chromseq = tools.shuffleArray(Tools.seq(2));
            chrconf.quad = 0;
        }
        else {
            assert (popdata.ploidy>2);
            TetraploidChromosome chr = (TetraploidChromosome)popdata.getChrom(c);
            initorder = tools.shuffleArray(Tools.seq(popdata.ploidy)); //global but only relevant during
                //this method
            for (int h=0; h<popdata.ploidy; h++) {
                    backorder[initorder[h]] = h;
            }
            hsdone = new boolean[popdata.ploidy];
            for (int side=0; side<2; side++) pairedWith[side] = getPairing(c,side); 
            primaryside = getPrimarySide(c);
            secondaryside = 1 - primaryside;
            bivalentcount = 0;
            quadrivalentcount = 0;

            if (popdata.naturalPairing) {
                //according to the prefpairing of this chromosome
                //we assign first spontaneous Bivalents (i.e. same pairing
                //at primary and secondary side),
                getSpontaneousBivalents(popdata.ploidy/2);
                //Next we search spontaneous Quadrivalents:
                getSpontaneousQuadrivalents((popdata.ploidy-2*bivalentcount)/4);

                //Now we have extracted all spontaneous Bivalents and Quadrivalents.
                //For the remaining haplostruct we ignore the previous pairings at 
                //secondaryside but make new ones ad hoc:
                calcGenohs(c,secondaryside);
                while (2*bivalentcount + 4*quadrivalentcount < popdata.ploidy) {
                    if (2*bivalentcount + 4*quadrivalentcount == popdata.ploidy - 2) {
                        //only 2 chromosomes left
                        getForcedBivalent();
                    } else {
                        //make a new Bivalent or Quadrivalent:
                        getForcedBiOrQuadri(c, true);
                    }    
                } //while (2*bivalentcount + 4*quadrivalentcount < popdata.ploidy) 
            } //if (popdata.naturalPairing)     

            else {
                //no naturalpairing but specified fraction Quadrivalents
                int numQuadrivalents = chr.ranQuadri();
                //now we know the number of quadrivalents to form 
                //with this chromosome in this meiosis
                int numBivalents = (popdata.ploidy-4*numQuadrivalents)/2;
                //we assign first the spontaneous Bivalents and Quadrivalents
                //as far as needed,
                //then add forced Bivalents: use the pairing at primaryside only
                getSpontaneousBivalents(numBivalents);
                getSpontaneousQuadrivalents(numQuadrivalents);
                while (bivalentcount < numBivalents) {
                    getForcedBivalent();
                } 
                if (quadrivalentcount < numQuadrivalents) {
                    calcGenohs(c, secondaryside);
                    while (quadrivalentcount < numQuadrivalents) {
                        getForcedBiOrQuadri(c, false);
                    }
                }
           } //no naturalpairing
            chrconf.quad = quadrivalentcount;
            chr.quadrivalentConfigCount[chrconf.quad]++;
        } //ploidy==2 else
    } //getChrConfig