boolean setupCalculations() { Vector calc; DistanceCalc distanceCalc = new DistanceCalc(); calc = calculations[CALC_DISTANCE] = new Vector(); for (int i = 0; i < bondCount; i++) { MinBond bond = bonds[i]; double bondOrder = bond.atomIndexes[2]; if (bond.isAromatic) bondOrder = 1.5; if (bond.isAmide) bondOrder = 1.41; distanceCalc.setData(calc, bond.atomIndexes[0], bond.atomIndexes[1], bondOrder); } calc = calculations[CALC_ANGLE] = new Vector(); AngleCalc angleCalc = new AngleCalc(); for (int i = angles.length; --i >= 0; ) angleCalc.setData(calc, i); calc = calculations[CALC_TORSION] = new Vector(); TorsionCalc torsionCalc = new TorsionCalc(); for (int i = torsions.length; --i >= 0; ) torsionCalc.setData(calc, i); calc = calculations[CALC_OOP] = new Vector(); // set up the special atom arrays OOPCalc oopCalc = new OOPCalc(); int elemNo; for (int i = 0; i < atomCount; i++) { MinAtom a = atoms[i]; if (a.nBonds == 3 && isInvertible(elemNo = a.atom.getElementNumber())) oopCalc.setData(calc, i, elemNo); } pairSearch(calculations[CALC_VDW] = new Vector(), new VDWCalc()); return true; }
double compute(int iType, Object[] dataIn) { switch (iType) { case CALC_DISTANCE: return bondCalc.compute(dataIn); case CALC_ANGLE: return angleCalc.compute(dataIn); case CALC_TORSION: return torsionCalc.compute(dataIn); case CALC_OOP: return oopCalc.compute(dataIn); case CALC_VDW: return vdwCalc.compute(dataIn); case CALC_ES: return esCalc.compute(dataIn); } return 0.0; }