meshi.energy.simpleEnergyTerms.compositeTorsions
Class SplinedPolynomial

java.lang.Object
  extended by meshi.energy.simpleEnergyTerms.compositeTorsions.SplinedPolynomial
All Implemented Interfaces:
CompositeTorsionsDefinitions

public class SplinedPolynomial
extends java.lang.Object
implements CompositeTorsionsDefinitions

Polynomial for calculating energy values for a given amino acid, and given torsion angles.


Field Summary
private  int aac
           
private  double[][] breaks
           
private  double[] coefs
           
private  int numVariables
           
private  int[] order
           
private  double[][] quickPowerMatrix
           
private  int ssType
           
private  int[] torsionAngles
           
 
Fields inherited from interface meshi.energy.simpleEnergyTerms.compositeTorsions.CompositeTorsionsDefinitions
ALL, CHI_1, CHI_2, CHI_3, CHI_4, COIL, HELIX, NUM_SIDECHAIN_TORSIONS, OMG, OMNI, PHI, POLYNOMIAL_CHI_1, POLYNOMIAL_CHI_1_CHI_2, POLYNOMIAL_CHI_1_CHI_2_TORSIONS, POLYNOMIAL_CHI_1_CHI_3, POLYNOMIAL_CHI_1_CHI_3_TORSIONS, POLYNOMIAL_CHI_1_CHI_4, POLYNOMIAL_CHI_1_CHI_4_TORSIONS, POLYNOMIAL_CHI_1_TORSIONS, POLYNOMIAL_PHI_PSI, POLYNOMIAL_PHI_PSI_CHI_1, POLYNOMIAL_PHI_PSI_CHI_1_TORSIONS, POLYNOMIAL_PHI_PSI_TORSIONS, PREPRO, PSI, SHEET, TOTAL_TORSION_ANGLES, UNIDENTIFIED_TORSION_TYPE
 
Constructor Summary
SplinedPolynomial(int numVariables, int aac, int[] torsionAngles, int ssType, double[][] breaks, double[] coefs)
          Creates a new splined polynomial.
 
Method Summary
 int findBin(double[] breaks, double torsion)
          Find break index (bin) for torsion angle.
 double fixTorsionToBin(double[] breaks, double torsion, int bin)
          Fixes a torsion to be inside its bin.
 boolean isPolynomialNeeded(int aac, int[] torsionAngles, int ssType)
          checks whether this polynomial is of the parameters needed.
private static double quickPower(double torsion, int power)
          Raises a double by the power, with 0 <= power <= 3.
 java.lang.String toString()
          Converts attributes of polynomial to string.
 double value(int derivVar, double... args)
          Calculates polynomial's derivation for given variable with value for list of arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numVariables

private int numVariables

aac

private int aac

torsionAngles

private int[] torsionAngles

ssType

private int ssType

breaks

private double[][] breaks

coefs

private double[] coefs

quickPowerMatrix

private double[][] quickPowerMatrix

order

private int[] order
Constructor Detail

SplinedPolynomial

public SplinedPolynomial(int numVariables,
                         int aac,
                         int[] torsionAngles,
                         int ssType,
                         double[][] breaks,
                         double[] coefs)
Creates a new splined polynomial.

Method Detail

isPolynomialNeeded

public boolean isPolynomialNeeded(int aac,
                                  int[] torsionAngles,
                                  int ssType)
checks whether this polynomial is of the parameters needed.


value

public double value(int derivVar,
                    double... args)
Calculates polynomial's derivation for given variable with value for list of arguments.

Parameters:
derivVar - variable to be derived (zero for calculation of polynomial).

findBin

public int findBin(double[] breaks,
                   double torsion)
Find break index (bin) for torsion angle.

Returns:
left bound of break, -1 if no break found.

fixTorsionToBin

public double fixTorsionToBin(double[] breaks,
                              double torsion,
                              int bin)
Fixes a torsion to be inside its bin. Since some of the breaks are not from -pi to pi (due to the varied grid construction method) we need this addition to verify the polynomial is calculated correctly.


toString

public java.lang.String toString()
Converts attributes of polynomial to string.

Overrides:
toString in class java.lang.Object

quickPower

private static double quickPower(double torsion,
                                 int power)
Raises a double by the power, with 0 <= power <= 3. For the special exception of power=-1, returns 0 (as it eases polynomial derivation calculations).