public void doAlignment(String sq1, String sq2) {
    	
    	super.prepareAlignment(sq1, sq2);
    	
        int n = this.n, m = this.m;
        float[][] score = sub.score;
        start = new TracebackSimple[2][sq2.length() + 1];
        
        char[] s1 = sq1.toCharArray();
        char[] s2 = sq2.toCharArray();

        maxval = Float.NEGATIVE_INFINITY;
        // Initialize first column (i=0):
        for (int j=0; j<=m; j++) {
            start[1][j] = new TracebackSimple(0, j);
        }
        for (int i=1; i<=n; i++) {
            swap01(F);
            swap01(start);
            // F[1] represents (new) column i and F[0] represents (old) column i-1
            // Initialize first row (j=0):
            start[1][0] = new TracebackSimple(i, 0);
            for (int j=1; j<=m; j++) {
                float s = score[s1[i-1]][s2[j-1]];
                float val = max(0, F[0][j-1]+s, F[0][j]-d, F[1][j-1]-d);
                F[1][j] = val;
                if (val == 0) {          // Best alignment starts (and ends) here
                    start[1][j] = new TracebackSimple(i, j);
                } else if (val == F[0][j-1]+s) {
                    start[1][j] = start[0][j-1];
                } else if (val == F[0][j]-d) {
                    start[1][j] = start[0][j];
                } else if (val == F[1][j-1]-d) {
                    start[1][j] = start[1][j-1];
                } else {
                    throw new Error("SWSmart 1");
                }
                if (val > maxval) {
                    maxval = val;
                    TracebackSimple sij = start[1][j];
                    start1 = sij.i; start2 = sij.j;
                    end1 = i; end2 = j;
                }
            }
        }
    }