public AngleDR Ampqk(AngleDR ap, AMParams amprms) {
        double gr2e; /* (grav rad Sun)*2/(Sun-Earth distance) */
        double ab1; /* sqrt(1-v*v) where v=modulus of Earth vel */
        double ehn[] = new double[3]; /* Earth position wrt Sun (unit vector, FK5) */
        double abv[] = new double[3]; /* Earth velocity wrt SSB (c, FK5) */
        double p[] = new double[3], p1[] = new double[3];
        double p2[] = new double[3], p3[] = new double[3]; /* work vectors */
        double ab1p1, p1dv = 0.0, p1dvp1, w, pde = 0.0, pdep1;
        int i, j;

        TRACE("Ampqk");
        /* Unpack some of the parameters */
        gr2e = amprms.getGrad();
        ab1 = amprms.getRoot();
        ehn = amprms.getHelio();
        abv = amprms.getEarthv();

        /* Apparent RA,Dec to Cartesian */
        p3 = Dcs2c(ap);

        /* Precession and nutation */
        p2 = Dimxv(amprms.getPrecess(), p3);

        /* Aberration */
        ab1p1 = ab1 + 1.0;
        for (i = 0; i < 3; i++) {
            p1[i] = p2[i];
        }
        for (j = 0; j < 2; j++) {
            p1dv = Dvdv(p1, abv);
            p1dvp1 = 1.0 + p1dv;
            w = 1.0 + p1dv / ab1p1;
            for (i = 0; i < 3; i++) {
                p1[i] = (p1dvp1 * p2[i] - w * abv[i]) / ab1;
            }
            w = Dvn(p1, p3);
            for (i = 0; i < 3; i++) {
                p1[i] = p3[i];
            }
        }

        /* Light deflection */
        for (i = 0; i < 3; i++) {
            p[i] = p1[i];
        }
        for (j = 0; j < 5; j++) {
            pde = Dvdv(p, ehn);
            pdep1 = 1.0 + pde;
            w = pdep1 - gr2e * pde;
            for (i = 0; i < 3; i++) {
                p[i] = (pdep1 * p1[i] - gr2e * ehn[i]) / w;
            }
            w = Dvn(p, p2);
            for (i = 0; i < 3; i++) {
                p[i] = p2[i];
            }
        }

        /* Mean RA,Dec */
        ap = Dcc2s(p);
        ap.setAlpha(Dranrm(ap.getAlpha()));
        ENDTRACE("Ampqk");
        return ap;
    }