private int gradient_optimize_with_step(double step) throws Exception {
		double grad[][] = { { 0D, 0D, 0D, 0D, 0D, 0D },
				{ 0D, 0D, 0D, 0D, 0D, 0D }, { 0D, 0D, 0D, 0D, 0D, 0D },
				{ 0D, 0D, 0D, 0D, 0D, 0D }, { 0D, 0D, 0D, 0D, 0D, 0D } };
		int i, j, l;
		int result = 0;
		double minDist = Double.MAX_VALUE;
		double copiaStartVec[] = this.section.poincareStartVector.clone();
		double copiaEndVec[] = this.section.poincareEndVector.clone();
		double copiaDifMap[] = this.section.poincareDifMap.clone();

		i = 0;
		l = 0;
		while (result == 0
				&& this.totalPendingIter > 0
				&& this.section.poincareEndVector[1] < minDist
				&& this.section.poincareEndVector[1] > this.aproxEndBodyDistance) {

			// Copia vector inicial i diferencial
			copyVector(this.section.poincareStartVector, copiaStartVec);
			copyVector(this.section.poincareEndVector, copiaEndVec);
			copyVector(this.section.poincareDifMap, copiaDifMap);
			minDist = this.section.poincareEndVector[1];
			l++;

			for (j = 0; j < 6; j++) {
				grad[i][j] = -this.aproxMetricPar[j]
						* this.section.poincareDifMap[1 + 6 * j];
			}

			if (Funcions.normaliserd(grad[i], 6) == 0D) {
				result = ErrorCode.GradientUnderFlow.getErrorNumber();
				break;
			}

			Funcions.adamsBashforth(this.section.poincareStartVector, 6,
					grad[i], grad[(i + 4) % 5], grad[(i + 3) % 5],
					grad[(i + 2) % 5], l >= AB_POINTS ? AB_POINTS : 1, step);

			result = this.section.poincareMap();

			if (result != 0 || minDist < this.section.poincareEndVector[1]) {
				// Restaura vector inicial i diferencial
				copyVector(copiaStartVec, this.section.poincareStartVector);
				this.section.poincareEndVector = copiaEndVec.clone();
				this.section.poincareDifMap = copiaDifMap.clone();
			} else {
				i = (i + 1) % 5;
				this.totalPendingIter--;
			}
		}
		return result;
	}