Search in sources :

Example 1 with MomentsOfInertia

use of org.biojava.nbio.structure.geometry.MomentsOfInertia in project mm-dev by sbl-sdsc.

the class ShapeTypeDemo method calcShape.

private static String calcShape(Structure structure) {
    // calculate moments of inertia for C-alpha atoms
    MomentsOfInertia moi = new MomentsOfInertia();
    for (Atom a : StructureTools.getAtomCAArray(structure)) {
        moi.addPoint(a.getCoordsAsPoint3d(), 1.0);
    }
    // calculate symmetry based on the moments of inertia
    String s1 = moi.getSymmetryClass(0.05).toString();
    if (s1.equals("SYMMETRIC")) {
        return s1;
    } else {
        String s2 = moi.getSymmetryClass(0.2).toString();
        if (s2.equals("SYMMETRIC")) {
            return "EXCLUDE";
        } else {
            return s2;
        }
    }
}
Also used : MomentsOfInertia(org.biojava.nbio.structure.geometry.MomentsOfInertia) Atom(org.biojava.nbio.structure.Atom)

Aggregations

Atom (org.biojava.nbio.structure.Atom)1 MomentsOfInertia (org.biojava.nbio.structure.geometry.MomentsOfInertia)1