MarvinSketch: parameters and events


  1. Parameters
    1. Applet only parameters
  2. Events fired by the JavaBean
    1. Action events
    2. Property change events

1   Parameters

Parameters of the MSketch and JMSketch applets can be set using the <param> HTML tag. Parameters of the MSketchPane JavaBean can be set using the setParams method.

autoscale How to display a loaded molecule:
  • "true" - fit to the applet's window
  • "false" - use default scaling
viewonly Visualization mode: hide editing buttons; "true" or "false". false
verticalbar Enable vertical button bar and move atom, bond and edit buttons from the horizontal bar to the vertical; "true" or "false". false
dispQuality Display quality.
  • 0 - low quality, faster rendering
  • 1 - high quality (antialiasing), slower rendering
implicitH How to display H labels.
  • off
  • hetero - on heteroatoms
  • heteroterm - on hetero or terminal atoms
  • all - all atoms
explicitH Show explicit hydrogens. true
chiralitySupport When to show atom chirality (R/S).
  • off - never
  • selected - if chiral flag is set for the molecule or the atom's enhanced stereo type is absolute
  • all - always
ezVisible Show (true) or hide (false) E/Z labels. false
background Background color in hexa.  
molbg Molecule background color in hexa.  
colorScheme Color scheme.
  • mono - monochrome
  • cpk - Corey-Pauling-Kultun
  • shapely - shapely (residue types)
  • group - residue sequence numbers
rendering Rendering style.
  • wireframe - wireframe
  • wireknobs - wireframe with knobs
  • sticks - 3D sticks
  • ballstick - ball & stick
  • spacefill - balls
stickThickness 3D stick diameter for "sticks" and "ballstick" rendering modes, in Angstroms. 0.1
ballRadius Ball radius for "ballstick" rendering mode, in units of covalent radius. 0.5
scale Magnification. A 1.54 Å long C-C bond is magnified to scale pixels. 26.4
atomsize Atom label font size in C-C bond length units:
atomsize*1.54 Å = atomsize*scale points
bondWidth Width of double bond in C-C bond length units:
width*1.54 Å = width*scale pixels
stickdst Stick distance of atoms in C-C bond length units. 0.3
mergedst Merge distance of atoms in C-C bond length units. 0.1
downWedge Wedge bond display convention. Down wedge points downward in MDL's convention (mdl), upward (at the chiral center) in Daylight's (daylight). mdl
importConv Conversion(s) after molecule loading. Currently the following options are implemented:
"a" or "+a"     aromatization
"-a" dearomatization
"H" or "+H"     add explicit H atoms
"-H" remove explicit H atoms
"c" automatic cleaning
cleanOpts Options for cleaning (2D or 3D, depending on cleanDim)
clean2dOpts Options for 2D cleaning (0D->2D)
  • O0 - no optimization
  • O1 - optimize if needed
  • O2 - optimize
clean3dOpts Options for 3D cleaning (0D->3D)
  • O0 - lightweight optimization
  • OD - Dreiding optimization
cleanDim Number of space dimensions for cleaning.
  • 2 - two-dimensional cleaning
  • 3 - three-dimensional cleaning
See also: cleanOpts, importConv.
showSets Show the specified atom sets only. Comma separated list of set sequence numbers (0, ..., 63).  
setColoringEnabled Atom/bond set coloring. true
Atom set color in hexa.  
Bond set color in hexa.  
undo Maximum number of undo operations. 50
moreEnabled Enable/disable the More button. true
elements Comma-separated list of allowed elements (H, He, Li, ...). All elements in an atomic number interval can be specified with the short X-Y notation.
Example: "B-F,P-Cl". Here B-F is equivalent to B,C,N,O,F.
queryAtoms Comma-separated list of query atoms and properties.
  • any - any atom ("A" in molfile, "*" in SMARTS),
  • arom - aliphatic and aromatic, ("a" and "A" in SMARTS),
  • conn - total number of connections, ("X" in SMARTS),
  • H - total number of hydrogens, ("H" in SMARTS),
  • hetero - heteroatom ("Q" in molfile, "[!C!H]" in SMARTS),
  • list - atom list,
  • notlist - atom 'NOT' list,
  • Rgroup - Rgroups,
  • rings - "R" in SMARTS,
  • srs - smallest ring size, "r" in SMARTS,
  • val - valence, "v" in SMARTS,
Example: "list,notlist".
See also: Query properties in file formats.
atomStrings Comma-separated list of string type atom properties.
  • alias - atom alias, used in molfiles
  • smarts - SMARTS query atom string
Example: "smarts".
extraBonds Comma-separated list of extra bond types.
  • arom - Aromatic bond,
  • any - Any bond,
  • 1or2 - "Single or Double" query bond,
  • aromany - "Single or Aromatic" and "Double or Aromatic" query bond types,
  • topology - "Chain" and "Ring" bonds (in molfiles),
  • wedge - Up and Down stereo wedge bonds,
  • either - "Up or Down" and "Cis or Trans",
  • ctu - "Cis or Unspecified" and "Trans or Unspecified".
Example: "arom,wedge".
See also: Query properties in file formats.
reactionSupport Enables/disables reaction arrow drawing. true
The format of this parameter is :name:file, where name is the template group name, and file is the sdf or cssdf file containing the template structures.

The file can be optionally compressed with GZIP (Java >= 1.1). A button can be rotatable if the rotation.unit fields are specified in the SDfile (the unit rotation angle in degrees). For template tables, the endrow fields must be specified for templates that are last in a row. Template tables are shown in their own window. Template buttons may have a title if the abbreviation fields are specified in the SDfile.

click here
xtmpls File containing extra templates. Extra templates are left to the normal templates (see tmpls) in the template panel.  
abbrevgroups File containing the abbreviated groups. chemaxon/marvin
molFormat Default file format: mol, csmol, smiles, cml, pdb, pov, sybyl, or xyz. mol
simpView Switches on/off "visual fragment placement".
  • 0 - show all
  • 1 - hide bonds
  • 2 - hide bonds and templates
This option can also be set from the View/Misc/Object in hand menu.
debug Debug mode. Possible values: 0, 1, 2. 0
atomSymbolsVisible Shows atom symbols
  • true - display
  • false - do not display
atomNumbersVisible Show atom numbers
  • true - display
  • false - do not display
atomMappingVisible Show atom mapping
  • true - display
  • false - do not display
valenceErrorVisible Highlight (by underlining) the labels of those atoms with valence errors. This option can also be set from the View/Misc/Valence Errors menu.
  • true - display errors
  • false - do not display errors
reactionErrorVisible Highlight invalid reactions with a red rectangle around the reaction arrow. You can also change its value from View/Misc/Reaction Errors menu.
  • true - display rectangle
  • false - do not display rectangle
grinv Set visibility of graph invariants.
  • true - show graph invariants
  • false - hide them
skin Change the component's Look & Feel (only in SWING). If you do not specify this parameter, Marvin will use the default LookAndFeel style.
This parameter value is the name of the new LookAndFeel class.
sketchHelp Sketcher help contents. chemaxon/marvin/help
sketchQuickHelp Sketcher quick help. chemaxon/marvin/help
viewHelp Viewer help contents. chemaxon/marvin/help
viewQuickHelp Viewer quick help. chemaxon/marvin/help

Applet example:

<applet CODE=MSketch WIDTH=480 HEIGHT=400>
<param NAME="background" VALUE="#cccccc>
<param NAME="molbg" VALUE="#ffffff">
<param NAME="implicitH" VALUE="hetero">
Bean example:
MSketchPane sketchPane = new MSketchPane();

1.1   Applet only parameters

The following parameters are meaningful only for the applets (MSketch, JMSketch) and not for the JavaBean (MSketchPane).

menubar Enable the embedded menubar in the Swing applet. true
detach Detachment behavior. The value consists of two optional arguments, show/hide and size . If both arguments are included, they must be separated by a comma.
To detach the sketcher from the web page and display it in a window, set "show".
To detach the sketcher but do not display the window, set "hide".
Both settings make the applet on the web page look like a molecule viewer.

The initial size of the sketcher window can be specified with "size=widthxheight"
Examples: "show", "size=500x500", "hide,size=500x500".
mol The molecule file to be loaded at startup, as either a URL or the molfile itself (inline) in MDL mol or compressed mol format.
If you specify the molfile inline, then you must end all the molfile lines with "\" (backslash). The file format and/or import options can be specified if one of the following forms is used:
"file(format:options)", or
If the MULTISET option is specified, then a multi-molecule file is read into one molecule object containing multiple atom sets.
Examples: "", ",f1.4C4)"
preload Comma-separated list of external modules to preload. External modules are class files in the chemaxon/marvin/modules directory.
moduleargument of getMol() call that requires it
MolExport "mol", "csmol"
SmilesExport "smiles"
CmlExport "cml"
Parity "mol", "smiles" (but not "smiles:0")
PdbExport "pdb"
PovExport "pov"
SybylExport "sybyl"
XYZExport "xyz"
Note. Preloading is required if you call getMol from JavaScript in a buggy browser/JVM combination. Without preloading, getMol might freeze Netscape 6 (Sun Java 1.3) and Netscape 3 would also fail because these browsers cannot call network functions from JavaScript.
cacheMols Store loaded molecules in an internal cache (true or false). false
loadMols Comma-separated list of molfiles to preload. Useful for caching molecules in JavaScript "slideshows".
usedJars Comma-separated list of additional jar files that can be used by the applet. The additional files have to be defined with their paths relative to the applet's base.
imageSaveURL The URL of the cgi, jsp or asp file use to save the image posted by the applet to the server.
The cgi has to read the image from the standard input into a byte array, save it to a temporary file and send back the absolute path of the file to the applet.
A jsp example: saveimage.jsp
imageShowURL The URL of the cgi, jsp or asp file that either saves the data into a file generated by the applet or shows the generated image that was saved to a temporary file by imageSaveURL.
The posted parameters:
filename If the applet generated an image, it was saved into a temporary file on the server. In this case this parameter contains the absolute path of the temporary file.
type Sets the type of the file and its extension.
It can be: "mol", "csmol", "pdb", "sybyl", "xyz", "jpeg", "png", "pov", "svg".
where Sets the location in which the image will be "shown"
Possible values: "file", "browser", null.
  • "file" - the generated data will be saved into a file.
  • "browser" - the data will be displayed in a browser window.
data If the applet generated a kind of molecule format file (see: formats), it is posted by this parameter. In this case the text file have to be saved as a file.
A jsp example: showimage.jsp

2   Events fired by the JavaBean

2.1   Action events

To handle the action events of MSketchPane, the java.awt.event.ActionListener interface must be implemented.

Source nameSource component typeMeaning
"close" javax.swing.JMenuItem File/Close has been chosen, sketcher window should be closed.



public void actionPerformed(ActionEvent ev) {
    if(ev.getSource() instanceof JComponent) {
	String name = ((JComponent)ev.getSource()).getName();
	if(name.equals("close")) {

2.2   Property change events

To handle the property change events of MSketchPane, the java.beans.PropertyChangeListener interface must be implemented.

Property nameTypeMeaning
"mol" Molecule Molecule changed.
"file" Molecule file changed from File/Open or File/Save As.
"implicitH" String Implicit Hydrogen display style changed.
"explicitH" Boolean Explicit Hydrogen display style changed.
true: show explicit H atoms
false: hide explicit H atoms
"colorScheme" String Color scheme changed.
"autoscale" Boolean Autoscale changed.
"rendering" String Rendering style changed.
"stickThickness" Double Sticks diameter changed.
"ballRadius" Double Ball radius changed.
"grinv" Boolean Graph invariants displayed/not displayed.
"downWedge" String Down wedge bond orientation changed.
"objectAtPointer" Object The MolAtom or MolBond object at the mouse pointer.
"invisibleSets" Long Visibility of atom sets changed.
"atomNumbersVisible" Boolean Visibility of atom numbers changed.
"atomMappingVisible" Boolean Visibility of atom mapping changed.
"popupMenusEnabled" Boolean Popup menus are enabled/disabled.
"valenceErrorVisible" Boolean Visibility of valence errors changed.
"reactionErrorVisible" Boolean Visibility of reaction errors changed.



public void propertyChange(PropertyChangeEvent ev) {
    String name = ev.getPropertyName();
    if(name.equals("file")) {
	File f = (File)ev.getNewValue();
	if(f != null)
	    setTitle("MarvinSketch: "+f.getName());