Search in sources :

Example 6 with Torsion

use of ffx.potential.bonded.Torsion in project ffx by mjschnie.

the class RosenbluthChiAllMove method cheapTorsionSet_indiv.

/**
 * This version of the cheap method draws each INDIVIDUAL chi from its OWN
 * Boltzmann. Each member of the test set is still a full set of chis.
 */
private TrialSet cheapTorsionSet_indiv(List<Torsion> allTors, int setSize, String snapSuffix) {
    report.append(String.format("    CheapTrialSet_Indiv (uDep  uExt  uExtBolt  running)\n"));
    TrialSet trialSet = new TrialSet(setSize);
    double[] origChi = RotamerLibrary.measureRotamer(target, false);
    double loggerW = 0.0;
    int i = 0;
    while (i < setSize) {
        double[] newChi = new double[origChi.length];
        System.arraycopy(origChi, 0, newChi, 0, origChi.length);
        Rotamer newState = null;
        for (int k = 0; k < origChi.length; k++) {
            double crit, rng, theta, uTors, offset = 0.0;
            do {
                theta = rand.nextDouble(360.0) - 180;
                newChi[k] = theta;
                newState = createRotamer(target, newChi);
                RotamerLibrary.applyRotamer(target, newState);
                uTors = allTors.get(k).energy(false);
                try {
                    offset = TORSION_OFFSET_AMPRO13.valueOf(target.getName() + k).offset;
                } catch (IllegalArgumentException ex) {
                    logger.warning(ex.getMessage());
                }
                uTors += offset;
                crit = FastMath.exp(-beta * uTors);
                rng = rand.nextDouble();
            } while (rng >= crit);
        // report.append(String.format(" Accept-reject at movenum %d pos %d chi,eng,offset,crit:   %5.2f  %5.2f  %5.2f  %5.2f  %5.2f\n",
        // moveNumber, k, theta, uTors, offset, crit, rng));
        }
        double uTorsSum = 0;
        for (Torsion tors : allTors) {
            uTorsSum += tors.energy(false);
        }
        // this cheap version does all thetas at once
        trialSet.theta[i] = 0.0;
        trialSet.rotamer[i] = newState;
        trialSet.uDep[i] = uTorsSum;
        trialSet.uExt[i] = totalEnergy() - uTorsSum;
        loggerW += FastMath.exp(-beta * trialSet.uExt[i]);
        if (i < 4 || i > setSize - 2) {
            report.append(String.format("       %3s %d:  %9.5g  %9.5g  %9.5g  %9.5g\n", snapSuffix, i + 1, trialSet.uDep[i], trialSet.uExt[i], FastMath.exp(-beta * trialSet.uExt[i]), loggerW));
        } else if (i == 4) {
            report.append(String.format("       ...\n"));
        }
        writeSnapshot(snapSuffix, true);
        i++;
    }
    target.revertState(origState);
    updateAll();
    return trialSet;
}
Also used : Rotamer(ffx.potential.bonded.Rotamer) Torsion(ffx.potential.bonded.Torsion)

Example 7 with Torsion

use of ffx.potential.bonded.Torsion in project ffx by mjschnie.

the class RosenbluthOBMC method setState.

/**
 * Calls through to residue.revertState() but also updates the Torsion
 * objects associated with that residue (so they contain appropriate chi
 * values).
 */
private void setState(Residue target, ResidueState state) {
    target.revertState(state);
    ArrayList<ROLS> torsions = target.getTorsionList();
    for (ROLS rols : torsions) {
        ((Torsion) rols).update();
    }
}
Also used : ROLS(ffx.potential.bonded.ROLS) Torsion(ffx.potential.bonded.Torsion)

Example 8 with Torsion

use of ffx.potential.bonded.Torsion in project ffx by mjschnie.

the class RosenbluthOBMC method getChiZeroTorsion.

private Torsion getChiZeroTorsion(Residue residue) {
    AminoAcid3 name = AminoAcid3.valueOf(residue.getName());
    ArrayList<ROLS> torsions = residue.getTorsionList();
    switch(name) {
        case VAL:
            {
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom CG1 = (Atom) residue.getAtomNode("CG1");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, CG1)) {
                        return torsion;
                    }
                }
                break;
            }
        case ILE:
            {
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom CD1 = (Atom) residue.getAtomNode("CD1");
                Atom CG1 = (Atom) residue.getAtomNode("CG1");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, CG1)) {
                        return torsion;
                    }
                }
                break;
            }
        case SER:
            {
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom OG = (Atom) residue.getAtomNode("OG");
                Atom HG = (Atom) residue.getAtomNode("HG");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, OG)) {
                        return torsion;
                    }
                }
                break;
            }
        case THR:
            {
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom OG1 = (Atom) residue.getAtomNode("OG1");
                Atom HG1 = (Atom) residue.getAtomNode("HG1");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, OG1)) {
                        return torsion;
                    }
                }
                break;
            }
        case CYX:
            {
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom SG = (Atom) residue.getAtomNode("SG");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, SG)) {
                        return torsion;
                    }
                }
                break;
            }
        case CYD:
            {
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom SG = (Atom) residue.getAtomNode("SG");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, SG)) {
                        return torsion;
                    }
                }
                break;
            }
        default:
            {
                // All other residues' chi[0] are defined by N,CA,CB,CG.
                Atom N = (Atom) residue.getAtomNode("N");
                Atom CA = (Atom) residue.getAtomNode("CA");
                Atom CB = (Atom) residue.getAtomNode("CB");
                Atom CG = (Atom) residue.getAtomNode("CG");
                for (ROLS rols : torsions) {
                    Torsion torsion = (Torsion) rols;
                    if (torsion.compare(N, CA, CB, CG)) {
                        return torsion;
                    }
                }
                logger.info("Couldn't find chi[0] for residue " + residue.toString());
                return null;
            }
    }
    logger.info("Couldn't find chi[0] for residue " + residue.toString());
    return null;
}
Also used : ROLS(ffx.potential.bonded.ROLS) AminoAcid3(ffx.potential.bonded.ResidueEnumerations.AminoAcid3) Torsion(ffx.potential.bonded.Torsion) Atom(ffx.potential.bonded.Atom)

Example 9 with Torsion

use of ffx.potential.bonded.Torsion in project ffx by mjschnie.

the class ForceFieldEnergyOpenMM method addAmoebaMultipoleForce.

private void addAmoebaMultipoleForce() {
    ParticleMeshEwald pme = super.getPmeNode();
    if (pme == null) {
        return;
    }
    int[][] axisAtom = pme.getAxisAtoms();
    double dipoleConversion = OpenMM_NmPerAngstrom;
    double quadrupoleConversion = OpenMM_NmPerAngstrom * OpenMM_NmPerAngstrom;
    double polarityConversion = OpenMM_NmPerAngstrom * OpenMM_NmPerAngstrom * OpenMM_NmPerAngstrom;
    double dampingFactorConversion = sqrt(OpenMM_NmPerAngstrom);
    amoebaMultipoleForce = OpenMM_AmoebaMultipoleForce_create();
    double polarScale = 1.0;
    if (pme.getPolarizationType() != Polarization.MUTUAL) {
        OpenMM_AmoebaMultipoleForce_setPolarizationType(amoebaMultipoleForce, OpenMM_AmoebaMultipoleForce_Direct);
        if (pme.getPolarizationType() == Polarization.NONE) {
            polarScale = 0.0;
        }
    } else {
        ForceField forceField = molecularAssembly.getForceField();
        String algorithm = forceField.getString(ForceField.ForceFieldString.SCF_ALGORITHM, "CG");
        ParticleMeshEwald.SCFAlgorithm scfAlgorithm;
        try {
            algorithm = algorithm.replaceAll("-", "_").toUpperCase();
            scfAlgorithm = ParticleMeshEwald.SCFAlgorithm.valueOf(algorithm);
        } catch (Exception e) {
            scfAlgorithm = ParticleMeshEwald.SCFAlgorithm.CG;
        }
        switch(scfAlgorithm) {
            case EPT:
                logger.info(" Using extrapolated perturbation theory approximation instead of full SCF calculations. Not supported in FFX reference implementation.");
                OpenMM_AmoebaMultipoleForce_setPolarizationType(amoebaMultipoleForce, OpenMM_AmoebaMultipoleForce_Extrapolated);
                PointerByReference exptCoefficients = OpenMM_DoubleArray_create(4);
                OpenMM_DoubleArray_set(exptCoefficients, 0, -0.154);
                OpenMM_DoubleArray_set(exptCoefficients, 1, 0.017);
                OpenMM_DoubleArray_set(exptCoefficients, 2, 0.657);
                OpenMM_DoubleArray_set(exptCoefficients, 3, 0.475);
                OpenMM_AmoebaMultipoleForce_setExtrapolationCoefficients(amoebaMultipoleForce, exptCoefficients);
                OpenMM_DoubleArray_destroy(exptCoefficients);
                break;
            case CG:
            case SOR:
            default:
                OpenMM_AmoebaMultipoleForce_setPolarizationType(amoebaMultipoleForce, OpenMM_AmoebaMultipoleForce_Mutual);
                break;
        }
    }
    PointerByReference dipoles = OpenMM_DoubleArray_create(3);
    PointerByReference quadrupoles = OpenMM_DoubleArray_create(9);
    Atom[] atoms = molecularAssembly.getAtomArray();
    int nAtoms = atoms.length;
    for (int i = 0; i < nAtoms; i++) {
        Atom atom = atoms[i];
        MultipoleType multipoleType = atom.getMultipoleType();
        PolarizeType polarType = atom.getPolarizeType();
        /**
         * Define the frame definition.
         */
        int axisType = OpenMM_AmoebaMultipoleForce_NoAxisType;
        switch(multipoleType.frameDefinition) {
            case ZONLY:
                axisType = OpenMM_AmoebaMultipoleForce_ZOnly;
                break;
            case ZTHENX:
                axisType = OpenMM_AmoebaMultipoleForce_ZThenX;
                break;
            case BISECTOR:
                axisType = OpenMM_AmoebaMultipoleForce_Bisector;
                break;
            case ZTHENBISECTOR:
                axisType = OpenMM_AmoebaMultipoleForce_ZBisect;
                break;
            case TRISECTOR:
                axisType = OpenMM_AmoebaMultipoleForce_ThreeFold;
                break;
            default:
                break;
        }
        double useFactor = 1.0;
        if (!atoms[i].getUse() || !atoms[i].getElectrostatics()) {
            // if (!atoms[i].getUse()) {
            useFactor = 0.0;
        }
        // Should be 1.0 at this point.
        double lambdaScale = lambda;
        if (!atom.applyLambda()) {
            lambdaScale = 1.0;
        }
        useFactor *= lambdaScale;
        /**
         * Load local multipole coefficients.
         */
        for (int j = 0; j < 3; j++) {
            OpenMM_DoubleArray_set(dipoles, j, multipoleType.dipole[j] * dipoleConversion * useFactor);
        }
        int l = 0;
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                OpenMM_DoubleArray_set(quadrupoles, l++, multipoleType.quadrupole[j][k] * quadrupoleConversion * useFactor / 3.0);
            }
        }
        // int zaxis = 0;
        int zaxis = 1;
        // int xaxis = 0;
        int xaxis = 1;
        // int yaxis = 0;
        int yaxis = 1;
        int[] refAtoms = axisAtom[i];
        if (refAtoms != null) {
            zaxis = refAtoms[0];
            if (refAtoms.length > 1) {
                xaxis = refAtoms[1];
                if (refAtoms.length > 2) {
                    yaxis = refAtoms[2];
                }
            }
        } else {
            axisType = OpenMM_AmoebaMultipoleForce_NoAxisType;
            logger.info(String.format(" Atom type %s", atom.getAtomType().toString()));
        }
        double charge = multipoleType.charge * useFactor;
        /**
         * Add the multipole.
         */
        OpenMM_AmoebaMultipoleForce_addMultipole(amoebaMultipoleForce, charge, dipoles, quadrupoles, axisType, zaxis, xaxis, yaxis, polarType.thole, polarType.pdamp * dampingFactorConversion, polarType.polarizability * polarityConversion * polarScale);
    }
    OpenMM_DoubleArray_destroy(dipoles);
    OpenMM_DoubleArray_destroy(quadrupoles);
    Crystal crystal = super.getCrystal();
    if (!crystal.aperiodic()) {
        OpenMM_AmoebaMultipoleForce_setNonbondedMethod(amoebaMultipoleForce, OpenMM_AmoebaMultipoleForce_PME);
        OpenMM_AmoebaMultipoleForce_setCutoffDistance(amoebaMultipoleForce, pme.getEwaldCutoff() * OpenMM_NmPerAngstrom);
        OpenMM_AmoebaMultipoleForce_setAEwald(amoebaMultipoleForce, pme.getEwaldCoefficient() / OpenMM_NmPerAngstrom);
        double ewaldTolerance = 1.0e-04;
        OpenMM_AmoebaMultipoleForce_setEwaldErrorTolerance(amoebaMultipoleForce, ewaldTolerance);
        PointerByReference gridDimensions = OpenMM_IntArray_create(3);
        ReciprocalSpace recip = pme.getReciprocalSpace();
        OpenMM_IntArray_set(gridDimensions, 0, recip.getXDim());
        OpenMM_IntArray_set(gridDimensions, 1, recip.getYDim());
        OpenMM_IntArray_set(gridDimensions, 2, recip.getZDim());
        OpenMM_AmoebaMultipoleForce_setPmeGridDimensions(amoebaMultipoleForce, gridDimensions);
        OpenMM_IntArray_destroy(gridDimensions);
    } else {
        OpenMM_AmoebaMultipoleForce_setNonbondedMethod(amoebaMultipoleForce, OpenMM_AmoebaMultipoleForce_NoCutoff);
    }
    OpenMM_AmoebaMultipoleForce_setMutualInducedMaxIterations(amoebaMultipoleForce, 500);
    OpenMM_AmoebaMultipoleForce_setMutualInducedTargetEpsilon(amoebaMultipoleForce, pme.getPolarEps());
    int[][] ip11 = pme.getPolarization11();
    int[][] ip12 = pme.getPolarization12();
    int[][] ip13 = pme.getPolarization13();
    ArrayList<Integer> list12 = new ArrayList<>();
    ArrayList<Integer> list13 = new ArrayList<>();
    ArrayList<Integer> list14 = new ArrayList<>();
    PointerByReference covalentMap = OpenMM_IntArray_create(0);
    for (int i = 0; i < nAtoms; i++) {
        Atom ai = atoms[i];
        list12.clear();
        list13.clear();
        list14.clear();
        for (Bond bond : ai.getBonds()) {
            int index = bond.get1_2(ai).getIndex() - 1;
            OpenMM_IntArray_append(covalentMap, index);
            list12.add(index);
        }
        OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i, OpenMM_AmoebaMultipoleForce_Covalent12, covalentMap);
        OpenMM_IntArray_resize(covalentMap, 0);
        for (Angle angle : ai.getAngles()) {
            Atom ak = angle.get1_3(ai);
            if (ak != null) {
                int index = ak.getIndex() - 1;
                if (!list12.contains(index)) {
                    list13.add(index);
                    OpenMM_IntArray_append(covalentMap, index);
                }
            }
        }
        OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i, OpenMM_AmoebaMultipoleForce_Covalent13, covalentMap);
        OpenMM_IntArray_resize(covalentMap, 0);
        for (Torsion torsion : ai.getTorsions()) {
            Atom ak = torsion.get1_4(ai);
            if (ak != null) {
                int index = ak.getIndex() - 1;
                if (!list12.contains(index) && !list13.contains(index)) {
                    list14.add(index);
                    OpenMM_IntArray_append(covalentMap, index);
                }
            }
        }
        OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i, OpenMM_AmoebaMultipoleForce_Covalent14, covalentMap);
        OpenMM_IntArray_resize(covalentMap, 0);
        for (Atom ak : ai.get1_5s()) {
            int index = ak.getIndex() - 1;
            if (!list12.contains(index) && !list13.contains(index) && !list14.contains(index)) {
                OpenMM_IntArray_append(covalentMap, index);
            }
        }
        OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i, OpenMM_AmoebaMultipoleForce_Covalent15, covalentMap);
        OpenMM_IntArray_resize(covalentMap, 0);
        for (int j = 0; j < ip11[i].length; j++) {
            OpenMM_IntArray_append(covalentMap, ip11[i][j]);
        }
        OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i, OpenMM_AmoebaMultipoleForce_PolarizationCovalent11, covalentMap);
        OpenMM_IntArray_resize(covalentMap, 0);
    // for (int j = 0; j < ip12[i].length; j++) {
    // OpenMM_IntArray_append(covalentMap, ip12[i][j]);
    // }
    // OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i,
    // OpenMM_AmoebaMultipoleForce_PolarizationCovalent12, covalentMap);
    // OpenMM_IntArray_resize(covalentMap, 0);
    // 
    // for (int j = 0; j < ip13[i].length; j++) {
    // OpenMM_IntArray_append(covalentMap, ip13[i][j]);
    // }
    // OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i,
    // OpenMM_AmoebaMultipoleForce_PolarizationCovalent13, covalentMap);
    // OpenMM_IntArray_resize(covalentMap, 0);
    // 
    // OpenMM_AmoebaMultipoleForce_setCovalentMap(amoebaMultipoleForce, i,
    // OpenMM_AmoebaMultipoleForce_PolarizationCovalent14, covalentMap);
    }
    OpenMM_IntArray_destroy(covalentMap);
    OpenMM_System_addForce(system, amoebaMultipoleForce);
    OpenMM_Force_setForceGroup(amoebaMultipoleForce, 1);
    logger.log(Level.INFO, " Added polarizable multipole force.");
    GeneralizedKirkwood gk = super.getGK();
    if (gk != null) {
        addGKForce();
    }
}
Also used : PolarizeType(ffx.potential.parameters.PolarizeType) GeneralizedKirkwood(ffx.potential.nonbonded.GeneralizedKirkwood) ArrayList(java.util.ArrayList) MultipoleType(ffx.potential.parameters.MultipoleType) ReciprocalSpace(ffx.potential.nonbonded.ReciprocalSpace) EnergyException(ffx.potential.utils.EnergyException) Atom(ffx.potential.bonded.Atom) OpenMM_System_addConstraint(simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint) CoordRestraint(ffx.potential.nonbonded.CoordRestraint) Angle(ffx.potential.bonded.Angle) OpenMM_AmoebaAngleForce_addAngle(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaAngleForce_addAngle) OpenMM_AmoebaInPlaneAngleForce_addAngle(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaInPlaneAngleForce_addAngle) PointerByReference(com.sun.jna.ptr.PointerByReference) ForceField(ffx.potential.parameters.ForceField) Bond(ffx.potential.bonded.Bond) OpenMM_AmoebaBondForce_addBond(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaBondForce_addBond) RestraintBond(ffx.potential.bonded.RestraintBond) OpenMM_CustomBondForce_addBond(simtk.openmm.OpenMMLibrary.OpenMM_CustomBondForce_addBond) OpenMM_HarmonicBondForce_addBond(simtk.openmm.OpenMMLibrary.OpenMM_HarmonicBondForce_addBond) ParticleMeshEwald(ffx.potential.nonbonded.ParticleMeshEwald) Torsion(ffx.potential.bonded.Torsion) OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion) TorsionTorsion(ffx.potential.bonded.TorsionTorsion) OpenMM_PeriodicTorsionForce_addTorsion(simtk.openmm.OpenMMLibrary.OpenMM_PeriodicTorsionForce_addTorsion) PiOrbitalTorsion(ffx.potential.bonded.PiOrbitalTorsion) OpenMM_AmoebaPiTorsionForce_addPiTorsion(simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaPiTorsionForce_addPiTorsion) ImproperTorsion(ffx.potential.bonded.ImproperTorsion) Crystal(ffx.crystal.Crystal)

Example 10 with Torsion

use of ffx.potential.bonded.Torsion in project ffx by mjschnie.

the class RosenbluthChiAllMove method createBackBondedMap.

/**
 * Maps the back-bonded terms affected by key atoms in an amino acid. Here,
 * 'key atom' refers to each new rotamer-torsion-completing atom. e.g. VAL
 * has 1 key atom (CG1), ARG has 4 key atoms (CG,CD,NE,CZ). 'Back-bonded'
 * means we only map terms that lead toward the backbone.
 */
private HashMap<Integer, BackBondedList> createBackBondedMap(AminoAcid3 name) {
    HashMap<Integer, BackBondedList> map = new HashMap<>();
    List<Atom> chain = new ArrayList<>();
    Atom N = (Atom) target.getAtomNode("N");
    Atom CA = (Atom) target.getAtomNode("CA");
    Atom CB = (Atom) target.getAtomNode("CB");
    List<Atom> keyAtoms = new ArrayList<>();
    switch(name) {
        case VAL:
            {
                Atom CG1 = (Atom) target.getAtomNode("CG1");
                keyAtoms.add(CG1);
                keyAtoms.add(CB);
                break;
            }
        case LEU:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom CD1 = (Atom) target.getAtomNode("CD1");
                keyAtoms.add(CG);
                keyAtoms.add(CD1);
                break;
            }
        case ILE:
            {
                Atom CD1 = (Atom) target.getAtomNode("CD1");
                Atom CG1 = (Atom) target.getAtomNode("CG1");
                keyAtoms.add(CD1);
                keyAtoms.add(CG1);
                break;
            }
        case SER:
            {
                Atom OG = (Atom) target.getAtomNode("OG");
                Atom HG = (Atom) target.getAtomNode("HG");
                keyAtoms.add(OG);
                keyAtoms.add(HG);
                break;
            }
        case THR:
            {
                Atom OG1 = (Atom) target.getAtomNode("OG1");
                Atom HG1 = (Atom) target.getAtomNode("HG1");
                keyAtoms.add(OG1);
                keyAtoms.add(HG1);
                break;
            }
        case CYX:
        case CYD:
            {
                Atom SG = (Atom) target.getAtomNode("SG");
                keyAtoms.add(SG);
                break;
            }
        case PHE:
            {
                Atom CD1 = (Atom) target.getAtomNode("CD1");
                Atom CG = (Atom) target.getAtomNode("CG");
                keyAtoms.add(CG);
                break;
            }
        case PRO:
            {
                // Not allowed yet.
                Atom CD = (Atom) target.getAtomNode("CD");
                Atom CG = (Atom) target.getAtomNode("CG");
                keyAtoms.add(CG);
                keyAtoms.add(CD);
                break;
            }
        case TYR:
            {
                Atom CD1 = (Atom) target.getAtomNode("CD1");
                Atom CE2 = (Atom) target.getAtomNode("CE2");
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom CZ = (Atom) target.getAtomNode("CZ");
                Atom OH = (Atom) target.getAtomNode("OH");
                Atom HH = (Atom) target.getAtomNode("HH");
                // SPECIAL CASE: have to create map manualy.
                Bond b1 = CG.getBond(CB);
                Angle a1 = CG.getAngle(CB, CA);
                Torsion t1 = CG.getTorsion(CB, CA, N);
                Bond b2 = CD1.getBond(CG);
                Angle a2 = CD1.getAngle(CG, CB);
                Torsion t2 = CD1.getTorsion(CG, CB, CA);
                Bond b3 = HH.getBond(OH);
                Angle a3 = HH.getAngle(OH, CZ);
                Torsion t3 = HH.getTorsion(OH, CZ, CE2);
                BackBondedList bbl1 = new BackBondedList(b1, a1, t1);
                BackBondedList bbl2 = new BackBondedList(b2, a2, t2);
                BackBondedList bbl3 = new BackBondedList(b3, a3, t3);
                map.put(0, bbl1);
                map.put(1, bbl2);
                map.put(2, bbl3);
                // Note the return here.
                return map;
            }
        case TYD:
            {
                Atom CD1 = (Atom) target.getAtomNode("CD1");
                Atom CG = (Atom) target.getAtomNode("CG");
                keyAtoms.add(CG);
                keyAtoms.add(CD1);
                break;
            }
        case TRP:
            {
                Atom CD1 = (Atom) target.getAtomNode("CD1");
                Atom CG = (Atom) target.getAtomNode("CG");
                keyAtoms.add(CG);
                keyAtoms.add(CD1);
                break;
            }
        case HIS:
        case HID:
        case HIE:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom ND1 = (Atom) target.getAtomNode("ND1");
                keyAtoms.add(CG);
                keyAtoms.add(ND1);
                break;
            }
        case ASP:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                keyAtoms.add(CG);
                break;
            }
        case ASH:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom OD1 = (Atom) target.getAtomNode("OD1");
                keyAtoms.add(CG);
                keyAtoms.add(OD1);
                break;
            }
        case ASN:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom OD1 = (Atom) target.getAtomNode("OD1");
                keyAtoms.add(CG);
                keyAtoms.add(OD1);
                break;
            }
        case GLU:
        case GLH:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom CD = (Atom) target.getAtomNode("CD");
                Atom OE1 = (Atom) target.getAtomNode("OE1");
                keyAtoms.add(CG);
                keyAtoms.add(CD);
                keyAtoms.add(OE1);
                break;
            }
        case GLN:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom CD = (Atom) target.getAtomNode("CD");
                Atom OE1 = (Atom) target.getAtomNode("OE1");
                keyAtoms.add(CG);
                keyAtoms.add(CD);
                keyAtoms.add(OE1);
                break;
            }
        case MET:
            {
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom CE = (Atom) target.getAtomNode("CE");
                Atom SD = (Atom) target.getAtomNode("SD");
                keyAtoms.add(CG);
                keyAtoms.add(SD);
                keyAtoms.add(CE);
                break;
            }
        case LYS:
        case LYD:
            {
                Atom CD = (Atom) target.getAtomNode("CD");
                Atom CE = (Atom) target.getAtomNode("CE");
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom NZ = (Atom) target.getAtomNode("NZ");
                keyAtoms.add(CG);
                keyAtoms.add(CD);
                keyAtoms.add(CE);
                keyAtoms.add(NZ);
                break;
            }
        case ARG:
            {
                Atom CD = (Atom) target.getAtomNode("CD");
                Atom CG = (Atom) target.getAtomNode("CG");
                Atom CZ = (Atom) target.getAtomNode("CZ");
                Atom NE = (Atom) target.getAtomNode("NE");
                keyAtoms.add(CG);
                keyAtoms.add(CD);
                keyAtoms.add(NE);
                keyAtoms.add(CZ);
                break;
            }
        default:
            logger.severe(String.format("CBMC called on unsupported residue: %s", name.toString()));
    }
    // Build the chain and assign back-bonded terms.
    chain.add(N);
    chain.add(CA);
    chain.add(CB);
    chain.addAll(keyAtoms);
    for (int i = 3; i < chain.size(); i++) {
        Atom key = chain.get(i);
        Bond bond = key.getBond(chain.get(i - 1));
        Angle angle = key.getAngle(chain.get(i - 1), chain.get(i - 2));
        Torsion torsion = key.getTorsion(chain.get(i - 1), chain.get(i - 2), chain.get(i - 3));
        BackBondedList bbl = new BackBondedList(bond, angle, torsion);
        map.put(i - 3, bbl);
    // report.append(String.format("    BackBondedMap: %s\t\t%s\n", key, torsion));
    }
    return map;
}
Also used : Angle(ffx.potential.bonded.Angle) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Bond(ffx.potential.bonded.Bond) Torsion(ffx.potential.bonded.Torsion) Atom(ffx.potential.bonded.Atom)

Aggregations

Torsion (ffx.potential.bonded.Torsion)14 Atom (ffx.potential.bonded.Atom)7 Angle (ffx.potential.bonded.Angle)5 Bond (ffx.potential.bonded.Bond)5 ROLS (ffx.potential.bonded.ROLS)4 AminoAcid3 (ffx.potential.bonded.ResidueEnumerations.AminoAcid3)3 ArrayList (java.util.ArrayList)3 ImproperTorsion (ffx.potential.bonded.ImproperTorsion)2 PiOrbitalTorsion (ffx.potential.bonded.PiOrbitalTorsion)2 Rotamer (ffx.potential.bonded.Rotamer)2 TorsionTorsion (ffx.potential.bonded.TorsionTorsion)2 CoordRestraint (ffx.potential.nonbonded.CoordRestraint)2 AtomType (ffx.potential.parameters.AtomType)2 OpenMM_AmoebaPiTorsionForce_addPiTorsion (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaPiTorsionForce_addPiTorsion)2 OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion (simtk.openmm.AmoebaOpenMMLibrary.OpenMM_AmoebaTorsionTorsionForce_addTorsionTorsion)2 OpenMM_PeriodicTorsionForce_addTorsion (simtk.openmm.OpenMMLibrary.OpenMM_PeriodicTorsionForce_addTorsion)2 OpenMM_System_addConstraint (simtk.openmm.OpenMMLibrary.OpenMM_System_addConstraint)2 PointerByReference (com.sun.jna.ptr.PointerByReference)1 Crystal (ffx.crystal.Crystal)1 AdderDoubleArray (ffx.numerics.AdderDoubleArray)1