Package org.jmol.modelkit
Class ModelKit
java.lang.Object
org.jmol.modelkit.ModelKit
An abstract popup class that is instantiated for a given platform and context
as one of:
-- abstract ModelKitPopup -- AwtModelKitPopup -- JSModelKitPopup
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
actionRotateBond
(int deltaX, int deltaY, int x, int y, boolean forceFull) Actually rotate the bond.void
addAtomSet
(String data) void
addLockedAtoms
(SymmetryInterface sg, BS bsLocked) Only for the current modelprotected static M4
addSGTransform
(SymmetryInterface sym, String tr, M4 trm0, M4 temp) int
checkMovedAtoms
(BS bsFixed, BS bsAtoms, P3[] apos0) Something has changed atom positions.protected boolean
boolean
checkOption
(char type, String key) MODELKIT SET options for syntax checking.void
void
clickAssignAtom
(int atomIndex, String element, P3 ptNew) From Mouse or handleAtomOrBondBickedprotected void
clickProcessXtal
(String id, String action) int
MODELKIT ADD @3 ...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 ATOMvoid
cmdAssignBond
(int bondIndex, char type, String cmd) void
cmdAssignConnect
(int index, int index2, char type, String cmd) int
Delete all atoms that are equivalent to this atom.int
cmdAssignMoveAtoms
(BS bsSelected, int iatom, P3 p, P3[] pts, boolean allowProjection, boolean isMolecule) cmdAssignSpaceGroup
(BS bs, String name, Object paramsOrUC, boolean isPacked, String cmd) MODELKIT SPACEGROUP Assign a given space group, currently only "P1" Do all the necessary changes in unit cells and atom site assignments.int
cmdAssignSpaceGroupPacked
(BS bsAtoms, String transform, String cmd) MODELKIT SPACEGROUP ....void
cmdMinimize
(JmolScriptEvaluator eval, BS bsBasis, int steps, float crit, float rangeFixed, int flags) Minimize a unit cell with full symmetry constraints.int
cmdRotateAtoms
(BS bsAtoms, P3[] points, float endDegrees) void
dispose()
void
void
drawSymop
(int a1, int a2) from set picking symopvoid
drawUnitCell
(String id, T3 ucLattice, String swidth) protected void
exitBondRotation
(String text) for the thin box on the top left of the windowprotected String[]
protected Atom
getBasisAtom
(int iatom) protected String
protected String
protected static String
getElementKey
(int modelIndex) protected int
getProperty
(String name) Get a property of the modelkit.int
getSym
(int iatom) protected int
protected String
protected int
protected int
boolean
handleAssignNew
(MouseState pressed, MouseState dragged, MeasurementPending mp, int dragAtomIndex, int key) handle a mouse-generated assignNew eventboolean
hasConstraint
(int iatom, boolean ignoreGeneral, boolean addNew) void
Not clear this is a good idea.boolean
isHidden()
boolean
protected boolean
void
minimizeEnd
(BS bsBasis2, boolean isEnd) int
moveMinConstrained
(int iatom, P3 p, BS bsAtoms) protected void
processMKPropertyItem
(String name, boolean TF) protected boolean
processSymop
(String id, boolean isFocus) protected void
setBondMeasure
(int bi, MeasurementPending mp) protected org.jmol.modelkit.ModelKit.Constraint
setConstraint
(SymmetryInterface sym, int ia, int mode) This constraint will be set for the site only.protected boolean
protected void
setHoverLabel
(String mode, String text) void
setMenu
(ModelKitPopup menu) protected void
setMKState
(int bits) setProperty
(String key, Object value) Modify the state by setting a property.void
showMenu
(int x, int y) 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.void
updateDrawAtomSets
(String mode, BS atoms) void
boolean
-
Field Details
-
vwr
-
lastModelSet
-
-
Constructor Details
-
ModelKit
public ModelKit()
-
-
Method Details
-
getElementKey
-
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
Only for the current model- Parameters:
sg
-bsLocked
-
-
checkMovedAtoms
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
MODELKIT SET options for syntax checking.- Parameters:
type
- 'M' menu, 'S' symmetry 'U' unit cell, 'B' booleankey
-- Returns:
- true if the type exists
-
clearAtomConstraints
public void clearAtomConstraints() -
clickAssignAtom
From Mouse or handleAtomOrBondBicked- Parameters:
atomIndex
- initiating atom clicked or dragged fromelement
- chemical symbol or "X" for delete, or one of the pickAssignTypes, such as increase/decrease chargeptNew
- if dragged to a new location to create a bond
-
cmdAssignAddAtoms
MODELKIT ADD @3 ... MODELKIT ADD _C wyckoff <[a-zAG] MODELKIT ADD C| this model only - Parameters:
type
-| "_" | ":"<Wyckoff letter [a-zAG] pts
- one or more new points, may be nullbsAtoms
- the atoms to process, presumably from different sitespacking
- "packed" or ""cmd
- the command generating this call- Returns:
- the number of atoms added
-
cmdAssignAtom
A versatile method that allows changing element, setting charge, setting position, adding or deleting an atom via MODELKIT ASSIGN ATOM- Parameters:
bs
- may be -1pt
- a Cartesian position for a new atom or when moving an atom to a new positiontype
- 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
-
cmdAssignConnect
- Parameters:
index
-index2
-type
-cmd
-
-
cmdAssignDeleteAtoms
Delete all atoms that are equivalent to this atom.- Parameters:
bs
-- Returns:
- number of deleted atoms
-
cmdAssignMoveAtoms
-
cmdAssignSpaceGroup
public String cmdAssignSpaceGroup(BS bs, String name, Object paramsOrUC, boolean isPacked, 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 groupname
- "P1" or "1" or ignoredparamsOrUC
-isPacked
-cmd
-- Returns:
- new name or "" or error message
-
cmdAssignSpaceGroupPacked
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
-
dispose
public void dispose() -
getActiveMenu
for the thin box on the top left of the window- Returns:
- [ "atomMenu" | "bondMenu" | "xtalMenu" | null ]
-
getDefaultModel
-
getProperty
Get a property of the modelkit.- Parameters:
name
-- Returns:
- value
-
getRotateBondIndex
public int getRotateBondIndex() -
getSym
-
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) -
initializeForModel
public void initializeForModel()Not clear this is a good idea. It's possible for this to be set only once, when the file is loaded -
isHidden
public boolean isHidden() -
isPickAtomAssignCharge
public boolean isPickAtomAssignCharge() -
minimizeEnd
-
moveMinConstrained
-
setBondMeasure
-
setMenu
-
setProperty
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
-
exitBondRotation
-
getAllOperators
-
getBasisAtom
-
getCenterText
-
getElementFromUser
-
getMKState
protected int getMKState() -
getSymEditState
protected int getSymEditState() -
getSymopText
-
getSymViewState
protected int getSymViewState() -
getUnitCellState
protected int getUnitCellState() -
isXtalState
protected boolean isXtalState() -
processMKPropertyItem
-
processSymop
-
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
-
setMKState
protected void setMKState(int bits) -
addSGTransform
-
transformAtomsToUnitCell
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
-
updateDrawAtomSets
-
drawSymop
public void drawSymop(int a1, int a2) from set picking symop- Parameters:
a1
-a2
-
-
addAtomSet
-
drawUnitCell
- Parameters:
id
-ucLattice
-swidth
-
-
drawAxes
-