Class UnitCell

  • All Implemented Interfaces:
    java.lang.Cloneable

    class UnitCell
    extends SimpleUnitCell
    implements java.lang.Cloneable
    a class private to the org.jmol.symmetry package to be accessed only through the SymmetryInterface API adds vertices and offsets orientation, and a variety of additional calculations that in principle could be put in SimpleUnitCell if desired, but for now are in this optional package.
    • Field Detail

      • vertices

        private javajs.util.P3[] vertices
      • fractionalOffset

        private javajs.util.P3 fractionalOffset
      • allFractionalRelative

        private boolean allFractionalRelative
        this flag TRUE causes an update of matrixCtoFNoOffset each time an offset is changed so that it is updated and the two stay the same; set true only for isosurfaceMesh
      • cartesianOffset

        protected final javajs.util.P3 cartesianOffset
      • unitCellMultiplier

        protected javajs.util.T3 unitCellMultiplier
        a P3 or P4; the raw multiplier for the cell from UNITCELL {ijk ijk scale} UNITCELL {1iiijjjkkk 1iiijjjkkk scale} (encoded as a P4: {1iiijjjkkk 1iiijjjkkk scale 1kkkkkk} )
      • unitCellMultiplied

        private UnitCell unitCellMultiplied
        the multiplied, offset UnitCell derived from this UnitCell
      • moreInfo

        public javajs.util.Lst<java.lang.String> moreInfo
      • name

        public java.lang.String name
      • unitVectors

        private static final javajs.util.V3[] unitVectors
    • Constructor Detail

      • UnitCell

        private UnitCell()
        Indicate that this is a new unit cell, not one from a file.
    • Method Detail

      • fromOABC

        static UnitCell fromOABC​(javajs.util.T3[] oabc,
                                 boolean setRelative)
        A special constructor for spacially defined unit cells. Not used by readers.
        Parameters:
        oabc - [origin, Va, Vb, Vc]
        setRelative - a flag only set true for IsosurfaceMesh
        Returns:
        new unit cell
      • fromParams

        public static UnitCell fromParams​(float[] params,
                                          boolean setRelative)
        Parameters:
        params -
        setRelative - only set true for JmolData and tensors
        Returns:
        a new unit cell
      • initOrientation

        void initOrientation​(javajs.util.M3 mat)
      • toUnitCell

        final void toUnitCell​(javajs.util.T3 pt,
                              javajs.util.T3 offset)
        when offset is null, use the current cell, otherwise use the original unit cell
        Parameters:
        pt -
        offset -
      • toUnitCellRnd

        final void toUnitCellRnd​(javajs.util.T3 pt,
                                 javajs.util.T3 offset)
        when offset is null, use the current cell, otherwise use the original unit cell
        Parameters:
        pt -
        offset -
      • unitize

        public void unitize​(javajs.util.T3 pt)
        returns [0,1)
        Parameters:
        pt -
      • unitizeRnd

        public void unitizeRnd​(javajs.util.T3 pt)
        returns [0,1) with rounding to 0.0001
        Parameters:
        pt -
      • reset

        public void reset()
      • setOffset

        void setOffset​(javajs.util.T3 pt)
      • setCartesianOffset

        private void setCartesianOffset​(javajs.util.T3 origin)
      • getInfo

        java.util.Map<java.lang.String,​java.lang.Object> getInfo()
      • dumpInfo

        java.lang.String dumpInfo​(boolean isDebug,
                                  boolean multiplied)
      • getUnitCellMultiplied

        UnitCell getUnitCellMultiplied()
      • getVertices

        javajs.util.P3[] getVertices()
      • getCartesianOffset

        javajs.util.P3 getCartesianOffset()
      • getFractionalOffset

        javajs.util.P3 getFractionalOffset()
      • getTensor

        Tensor getTensor​(Viewer vwr,
                         float[] parBorU)
      • getCanonicalCopy

        javajs.util.P3[] getCanonicalCopy​(float scale,
                                          boolean withOffset)
        Parameters:
        scale -
        withOffset -
        Returns:
        points in Triangulator order
      • getScaledCell

        public javajs.util.P3[] getScaledCell​(boolean withOffset)
      • initUnitcellVertices

        private void initUnitcellVertices()
      • checkDistance

        public boolean checkDistance​(javajs.util.P3 f1,
                                     javajs.util.P3 f2,
                                     float distance,
                                     float dx,
                                     int iRange,
                                     int jRange,
                                     int kRange,
                                     javajs.util.P3 ptOffset)
        Parameters:
        f1 -
        f2 -
        distance -
        dx -
        iRange -
        jRange -
        kRange -
        ptOffset - TODO
        Returns:
        TRUE if pt has been set.
      • getUnitCellMultiplier

        public javajs.util.T3 getUnitCellMultiplier()
      • getUnitCellVectors

        public javajs.util.P3[] getUnitCellVectors()
      • fix

        private float fix​(float x)
      • isSameAs

        public boolean isSameAs​(UnitCell uc)
      • hasOffset

        public boolean hasOffset()
      • getQuaternionRotation

        public javajs.util.Quat getQuaternionRotation​(java.lang.String abc)
        Returns a quaternion that will take the standard frame to a view down a particular axis, expressed as its counterparts.
        Parameters:
        abc - ab bc ca
        Returns:
        quaternion
      • getV0abc

        public javajs.util.T3[] getV0abc​(java.lang.Object def,
                                         javajs.util.M4 retMatrix)
        Parameters:
        def - String "abc;offset" or M3 or M4 to origin; if String, can be preceded by ! for "reverse of". For example, "!a-b,-5a-5b,-c;7/8,0,1/8" offset is optional, and can be a definition such as "a=3.40,b=4.30,c=5.02,alpha=90,beta=90,gamma=129"
        retMatrix - if a string, return the M4 matrix corresponding to this definition
        Returns:
        [origin va vb vc] or null if invalid syntax, or null for allowNull and is identity
      • toFromPrimitive

        public boolean toFromPrimitive​(boolean toPrimitive,
                                       char type,
                                       javajs.util.T3[] uc,
                                       javajs.util.M3 primitiveToCrystal)
        Parameters:
        toPrimitive - or assumed conventional
        type - P, R, A, B, C, I(BCC), or F(FCC)
        uc - either [origin, va, vb, vc] or just [va, vb, vc]
        primitiveToCrystal -
        Returns:
        true if successful
      • getConventionalUnitCell

        public javajs.util.T3[] getConventionalUnitCell​(java.lang.String latticeType,
                                                        javajs.util.M3 primitiveToCrystal)
        return a conventional lattice from a primitive
        Parameters:
        latticeType - "A" "B" "C" "R" etc.
        primitiveToCrystal -
        Returns:
        [origin va vb vc]
      • getEquivPoints

        javajs.util.Lst<javajs.util.P3> getEquivPoints​(javajs.util.P3 pt,
                                                       java.lang.String flags,
                                                       javajs.util.M4[] ops,
                                                       javajs.util.Lst<javajs.util.P3> list,
                                                       int i0,
                                                       int n0)
        Parameters:
        pt - the point to transform
        flags - "tofractional,fromfractional,packed"
        ops - space group operations
        list - the list to append to
        i0 - the starting index of the list
        n0 - the first point that is to be duplicated; prior points are just references for removing duplicates
        Returns:
        augmented list
      • checkDuplicate

        private static void checkDuplicate​(javajs.util.Lst<javajs.util.P3> list,
                                           int i0,
                                           int n0,
                                           int n)
      • normalize

        public void normalize​(javajs.util.V3 vtrans)
      • getState

        public java.lang.String getState()