Example #1
0
int traceV(int i, int j) {
	int a, b, c, d, Vij;
	if (j-i < TURN)  return INFINITY_;

	a = canHairpin(i,j)?eH(i, j):INFINITY_;
	b = canStack(i,j)?eS(i, j) + V(i + 1, j - 1):INFINITY_;
	c = canStack(i,j)?VBI(i,j):INFINITY_;
	d = canStack(i,j)?VM(i,j):INFINITY_;
	
	Vij = V(i,j);
	structure[i] = j;
	structure[j] = i;

	if (Vij == a ) { 
		if (print_energy_decompose == 1) fprintf(energy_decompose_outfile, "i %5d j %5d Hairpin   %12.2f\n", i, j, eH(i, j)/100.00);
		total_en += eH(i,j);
		return Vij;
	} else if (Vij == b) { 
		if (print_energy_decompose == 1) fprintf(energy_decompose_outfile, "i %5d j %5d Stack     %12.2f\n", i, j, eS(i, j)/100.00);
		total_en += eS(i,j);
		traceV(i + 1, j - 1);
		return Vij;
	} else if (Vij == c) { 
		if (print_energy_decompose == 1) fprintf(energy_decompose_outfile, "i %5d j %5d IntLoop  ", i, j);
		traceVBI(i, j);
		return Vij;
	} else if (Vij == d) { 
		int eVM = traceVM(i, j);
		if (print_energy_decompose ==1) fprintf(energy_decompose_outfile, "i %5d j %5d MultiLoop %12.2f\n", i, j, (Vij-eVM)/100.0);
		total_en += (Vij-eVM);
		return Vij;
	}

	return 0;
}
Example #2
0
int traceV(int i, int j) {
	int a, b, c, d, Vij;
	if (j-i < TURN)  return INFINITY_;

	a = eH(i, j);
	b = eS(i, j) + V(i + 1, j - 1);
	if (eS(i, j) == 0) b = INFINITY_;
	c = VBI(i,j);
	d = VM(i,j);
	
	Vij = MIN(MIN(a, b), MIN(c, d));
	
	if (Vij == a && Vij != b && Vij != c && Vij != d) { 
		if (verbose == 1) 
			printf("i %5d j %5d Hairpin   %12.2f\n", i, j, eH(i, j)/100.00);
		total_en += eH(i,j);
		return Vij;
	} else if (Vij == b) { 
		if (verbose == 1) 
			printf("i %5d j %5d Stack     %12.2f\n", i, j, eS(i, j)/100.00);
		total_en += eS(i,j);
		structure[i + 1] = j - 1;
		structure[j - 1] = i + 1;
		traceV(i + 1, j - 1);
		return Vij;
	} else if (Vij == c) { 
		if (verbose == 1) 
			printf("i %5d j %5d IntLoop  ", i, j);
		traceVBI(i, j);
		return Vij;
	} else if (Vij == d && Vij != a && Vij != b && Vij != c) { 
		int eVM = traceVM(i, j);
		if (verbose ==1) 
			printf("i %5d j %5d MultiLoop %12.2f\n", i, j, (Vij-eVM)/100.0);
		total_en += (Vij-eVM);
		return Vij;
	} 
	return 0;
}