Class ModelKit

java.lang.Object
org.jmol.modelkit.ModelKit

public class ModelKit extends Object
An abstract popup class that is instantiated for a given platform and context as one of:
   -- abstract ModelKitPopup
      -- AwtModelKitPopup
      -- JSModelKitPopup
 
  • Field Details

    • vwr

      protected Viewer vwr
    • lastModelSet

      protected ModelSet lastModelSet
  • Constructor Details

    • ModelKit

      public ModelKit()
  • Method Details

    • getElementKey

      protected static String getElementKey(int modelIndex)
    • actionRotateBond

      public void actionRotateBond(int deltaX, int deltaY, int x, int y, boolean forceFull)
      Actually rotate the bond.
      Parameters:
      deltaX -
      deltaY -
      x -
      y -
      forceFull -
    • addLockedAtoms

      public void addLockedAtoms(SymmetryInterface sg, BS bsLocked)
      Only for the current model
      Parameters:
      sg -
      bsLocked -
    • checkMovedAtoms

      public int checkMovedAtoms(BS bsFixed, BS bsAtoms, P3[] apos0)
      Something has changed atom positions. Check to see that this is allowed and, if it is, move all equivalent atoms appropriately. If it is not, then revert.
      Parameters:
      bsFixed -
      bsAtoms -
      apos0 - original positions
      Returns:
      number of atoms moved, possibly 0
    • checkOption

      public boolean checkOption(char type, String key)
      MODELKIT SET options for syntax checking.
      Parameters:
      type - 'M' menu, 'S' symmetry 'U' unit cell, 'B' boolean
      key -
      Returns:
      true if the type exists
    • clearAtomConstraints

      public void clearAtomConstraints()
    • clickAssignAtom

      public void clickAssignAtom(int atomIndex, String element, P3 ptNew)
      From Mouse or handleAtomOrBondBicked
      Parameters:
      atomIndex - initiating atom clicked or dragged from
      element - chemical symbol or "X" for delete, or one of the pickAssignTypes, such as increase/decrease charge
      ptNew - if dragged to a new location to create a bond
    • cmdAssignAddAtoms

      public int cmdAssignAddAtoms(String type, P3[] pts, BS bsAtoms, String packing, String cmd)
      MODELKIT ADD @3 ... MODELKIT ADD _C wyckoff invalid input: '<'[a-zAG] MODELKIT ADD C | this model only
      Parameters:
      type - | "_" | ":"invalid input: '<'Wyckoff letter [a-zAG]
      pts - one or more new points, may be null
      bsAtoms - the atoms to process, presumably from different sites
      packing - "packed" or ""
      cmd - the command generating this call
      Returns:
      the number of atoms added
    • cmdAssignAtom

      public void cmdAssignAtom(BS bs, P3 pt, String type, String cmd)
      A versatile method that allows changing element, setting charge, setting position, adding or deleting an atom via MODELKIT ASSIGN ATOM
      Parameters:
      bs - may be -1
      pt - a Cartesian position for a new atom or when moving an atom to a new position
      type - one of: an element symbol, "X" (delete), "Mi" (decrement charge), "Pl" (increment charge), "." (from connect; just adding hydrogens)
      cmd - reference command given; may be null
    • cmdAssignBond

      public void cmdAssignBond(int bondIndex, char type, String cmd)
    • cmdAssignConnect

      public void cmdAssignConnect(int index, int index2, char type, String cmd)
      Parameters:
      index -
      index2 -
      type -
      cmd -
    • cmdAssignDeleteAtoms

      public int cmdAssignDeleteAtoms(BS bs)
      Delete all atoms that are equivalent to this atom.
      Parameters:
      bs -
      Returns:
      number of deleted atoms
    • cmdAssignMoveAtoms

      public int cmdAssignMoveAtoms(BS bsSelected, int iatom, P3 p, P3[] pts, boolean allowProjection, boolean isMolecule)
    • cmdAssignSpaceGroup

      public String cmdAssignSpaceGroup(BS bs, String name, Object paramsOrUC, boolean isPacked, boolean doDraw, String cmd)
      MODELKIT SPACEGROUP Assign a given space group, currently only "P1" Do all the necessary changes in unit cells and atom site assignments.
      Parameters:
      bs - atoms in the set defining the space group
      name - "P1" or "1" or ignored
      paramsOrUC -
      isPacked -
      doDraw -
      cmd -
      Returns:
      new name or "" or error message
    • cmdAssignSpaceGroupPacked

      public int cmdAssignSpaceGroupPacked(BS bsAtoms, String transform, String cmd)
      MODELKIT SPACEGROUP .... PACKED (final part, the packing) This is a rather complicated process, involving temporarily adding "centering-like" operations that propagate atoms from one former unit cell to others in a klassengleiche (crystal class-preserving) transformation in which lattice translations have been removed, leading to a sort of general position splitting. For example: MODELKIT SPACEGROUP "100 > a,b,3c > 100".
      Parameters:
      bsAtoms -
      transform -
      cmd -
      Returns:
      number of atoms added
    • cmdMinimize

      public void cmdMinimize(JmolScriptEvaluator eval, BS bsBasis, int steps, float crit, float rangeFixed, int flags) throws Exception
      Minimize a unit cell with full symmetry constraints. The model will be loaded with a 27-cell packing, but only the basis atoms themselves will be loaded.
      Parameters:
      eval -
      bsBasis -
      steps -
      crit -
      rangeFixed -
      flags -
      Throws:
      Exception
    • cmdRotateAtoms

      public int cmdRotateAtoms(BS bsAtoms, P3[] points, float endDegrees)
    • dispose

      public void dispose()
    • getActiveMenu

      public String getActiveMenu()
      for the thin box on the top left of the window
      Returns:
      [ "atomMenu" | "bondMenu" | "xtalMenu" | null ]
    • getDefaultModel

      public String getDefaultModel()
    • getProperty

      public Object getProperty(String name)
      Get a property of the modelkit.
      Parameters:
      name -
      Returns:
      value
    • getRotateBondIndex

      public int getRotateBondIndex()
    • getSym

      public SymmetryInterface getSym(int iatom)
    • handleAssignNew

      public boolean handleAssignNew(MouseState pressed, MouseState dragged, MeasurementPending mp, int dragAtomIndex, int key)
      handle a mouse-generated assignNew event
      Parameters:
      pressed -
      dragged -
      mp -
      dragAtomIndex -
      key - from a key press
      Returns:
      true if we should do a refresh now
    • hasConstraint

      public boolean hasConstraint(int iatom, boolean ignoreGeneral, boolean addNew)
    • isHidden

      public boolean isHidden()
    • isPickAtomAssignCharge

      public boolean isPickAtomAssignCharge()
    • minimizeEnd

      public void minimizeEnd(BS bsBasis2, boolean isEnd)
    • moveMinConstrained

      public int moveMinConstrained(int iatom, P3 p, BS bsAtoms)
    • setBondMeasure

      public MeasurementPending setBondMeasure(int bi, MeasurementPending mp)
    • setMenu

      public void setMenu(ModelKitPopup menu)
    • setProperty

      public Object setProperty(String key, Object value)
      Modify the state by setting a property. Also can be used for "get" purposes.
      Parameters:
      key -
      value - to set, or null to simply return the current value
      Returns:
      null or "get" value
    • showMenu

      public void showMenu(int x, int y)
    • updateMenu

      public void updateMenu()
    • wasRotating

      public boolean wasRotating()
    • checkNewModel

      protected boolean checkNewModel()
    • clickProcessXtal

      protected void clickProcessXtal(String id, String action)
    • exitBondRotation

      protected void exitBondRotation(String text)
    • getAllOperators

      protected String[] getAllOperators()
    • getBasisAtom

      protected Atom getBasisAtom(int iatom)
    • getCenterText

      protected String getCenterText()
    • getElementFromUser

      protected String getElementFromUser()
    • getMKState

      protected int getMKState()
    • getSymEditState

      protected int getSymEditState()
    • getSymopText

      protected String getSymopText()
    • getSymViewState

      protected int getSymViewState()
    • getUnitCellState

      protected int getUnitCellState()
    • isXtalState

      protected boolean isXtalState()
    • processMKPropertyItem

      protected void processMKPropertyItem(String name, boolean TF)
    • processSymop

      protected boolean processSymop(String id, boolean isFocus)
    • resetAtomPickType

      protected void resetAtomPickType()
    • setConstraint

      protected org.jmol.modelkit.ModelKit.Constraint setConstraint(SymmetryInterface sym, int ia, int mode)
      This constraint will be set for the site only.
      Parameters:
      sym -
      ia -
      mode - GET, GET_CREATE, or GET_DELETE
      Returns:
      a Constraint, or possibly null if not createNew
    • setHasUnitCell

      protected boolean setHasUnitCell()
    • setHoverLabel

      protected void setHoverLabel(String mode, String text)
    • setMKState

      protected void setMKState(int bits)
    • addSGTransform

      protected static M4 addSGTransform(SymmetryInterface sym, String tr, M4 trm0, M4 temp)
    • transformAtomsToUnitCell

      public boolean transformAtomsToUnitCell(SymmetryInterface sym, T3[] oabc, String ucname)
      Transform the atoms to fractional coordinate, set the unit cell to a new cell, and then transform them back to Cartesians.
      Parameters:
      sym -
      oabc -
      ucname -
      Returns:
      true if this is a "reset" with no atoms or sym == null
    • drawSymop

      public void drawSymop(int a1, int a2)
      from set picking symop
      Parameters:
      a1 -
      a2 -
    • addAtomSet

      public void addAtomSet(String data)
    • drawUnitCell

      public void drawUnitCell(String id, T3 ucLattice, String swidth)
      Parameters:
      id -
      ucLattice -
      swidth -
    • drawAxes

      public void drawAxes(String id, String swidth)
    • drawSymmetry

      public String drawSymmetry(String thisId, boolean isSymop, int iatom, String xyz, int iSym, P3 trans, P3 center, P3 target, int intScale, int nth, int options, int[] opList, boolean isModelkit)