public static void writeHaploStructFiles(String fName, PopulationData popdata)
            throws IOException {
        PrintWriter hsa = new PrintWriter(
                new BufferedWriter(new FileWriter(fName+".hsa")));
        PrintWriter hsb = new PrintWriter(
                new BufferedWriter(new FileWriter(fName+".hsb")));
        int segcount = 0;
        for (Chromosome chrom: popdata.getChromosome()) {
            int n = chrom.maxSegCount();
            if (n>segcount) segcount = n;
        }

        for (Individual ind: popdata.getIndividual()) {
            for (Chromosome chrom: popdata.getChromosome()) {
                int chrNum = chrom.getChromNumber();
                for (int p=0; p<popdata.ploidy; p++) {
                    hsa.print(ind.getIndivName()+"\t"+chrom.getChromName()+"\t"+(p+1));
                    HaploStruct hs = ind.getHaploStruct(chrNum,p);
                    int hslen = hs.segmentCount();
                    for (int s=0; s<hslen; s++) {
                        hsa.print("\t"+hs.getFounder().get(s));
                        if (s>0) {
                            hsb.print("\t" + hs.getRecombPos().get(s)*100.0); //Morgan to cM
                        }
                    }
                    for (int s=hslen; s<segcount; s++) {
                        hsa.print("\t"+popdata.missing);
                        hsb.print("\t"+popdata.missing);
                    }
                    hsa.println();
                    hsb.println();
                }
            }
        }
        hsa.flush();
        hsb.flush();
    } //writeHaploStructFiles