Members
(readonly) CAP
Enum for cylinder cap styles.
Name | Type | Description |
---|---|---|
NONE | ||
FLAT | ||
ROUND |
- Source
(constant) OFFSETS
(readonly) SurfaceType :number
Surface types
- number
Name | Type | Description |
---|---|---|
VDW | van der Waals surface | |
MS | Molecular surface | |
SAS | Solvent accessible surface | |
SES | Solvent exposed surface |
- Source
(constant) builtinColorSchemes
built in color schemes
The user can pass these strings directly as the colorscheme
Name | Type | Description |
---|---|---|
ssPyMol | pymol secondary structure | |
ssJmol | jmol secondary structure | |
Jmol | jmol element defaults | |
amino | amino acid coloring | |
shapely | amino acid coloring | |
nucleic | nucleic acid coloring | |
chain | color by chain | |
rasmol | rasmol default element coloring | |
default | default element coloring | |
greenCarbon | default element coloring with green carbon | |
cyanCarbon | default element coloring with cyan carbon | |
magentaCarbon | default element coloring with magenta carbon | |
purpleCarbon | default element coloring with purple carbon | |
whiteCarbon | default element coloring with white carbon | |
orangeCarbon | default element coloring with orange carbon | |
yellowCarbon | default element coloring with yellow carbon | |
blueCarbon | default element coloring with blue carbon | |
chainHetatm | color chains |
- Source
window.$3Dmol.download("pdb:4UAA",viewer,{},function(){
viewer.setBackgroundColor(0xffffffff);
var colorAsSnake = function(atom) {
return atom.resi % 2 ? 'white': 'green'
};
viewer.setStyle( {chain:'A'}, { cartoon: {colorfunc: colorAsSnake }});
viewer.setStyle( {chain:'B'}, { stick: {colorscheme: 'yellowCarbon'}});
viewer.render();
});
(constant) builtinGradients
built in gradient schemes
The user can pass these strings directly as the gradient
Name | Type | Description |
---|---|---|
rwb | red/white/blue, supports setting a mid point for white | |
roygb | rainbow | |
sinebow | rainbow with better saturation properties | |
linear | linearly maps between provided colors |
- Source
(constant) dic
Parse a lammps trajectory file from str and create atoms
- Source
(constant) elementColors
Preset element coloring - from individual element colors to entire mappings (e.g. 'elementColors.Jmol' colors atoms with Jmol stylings)
- Source
(constant) ssColors
Preset secondary structure color scheme
- Source
syncSurface :boolean
Render surface synchronously if true
- boolean
- Source
viewers
Contains a dictionary of embedded viewers created from HTML elements
with a the viewer_3Dmoljs css class indexed by their id (or numerically
if they do not have an id).
- Source
Methods
BCIF(bindata, ParserOptionsSpec)
Name | Type | Description |
---|---|---|
bindata | binary UInt8Array buffer or a base64 encoded string | |
ParserOptionsSpec |
- Source
CDJSON(str, options)
This parses the ChemDoodle json file format. Although this is registered
for the json file extension, other chemical json file formats exist that
this can not parse. Check which one you have and do not assume that
.json can be parsed
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
CUBE(str, options)
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
GRO(str, options) → {Array.<Array.<AtomSpec>>}
Parse a gro file from str and create atoms
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
- Returns a 2D array of type AtomSpec
- Type:
- Array.<Array.<AtomSpec>>
MMTFparser(bindata, ParserOptionsSpec)
Name | Type | Description |
---|---|---|
bindata | binary UInt8Array buffer or a base64 encoded string | |
ParserOptionsSpec |
- Source
MOL2(str, options)
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
PDB(str, options)
Parse pdb file from str and create atoms if computeStruct is true will always perform secondary structure analysis,
otherwise only do analysis of SHEET/HELIX comments are missing
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec | keepH (do not strip hydrogens), noSecondaryStructure, |
- Source
PQR(str, options)
Parse a pqr file from str and create atoms. A pqr file is assumed to be a whitespace delimited PDB with charge and radius fields.
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec | noSecondaryStructure (do not compute ss) |
- Source
PRMTOP(str, options)
Parse a prmtop file from str and create atoms
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec | noSecondaryStructure (do not compute ss) |
- Source
SDF(str, options)
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
VASP(str, options)
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
XYZ(str, options)
Read an XYZ file from str and return result
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
assignPDBBonds(atomsarray)
Name | Type | Description |
---|---|---|
atomsarray | Array.<AtomSpec> |
conversionMatrix3(a, b, c, alpha, beta, gamma) → {Matrix3}
Name | Type | Description |
---|---|---|
a | number | |
b | number | |
c | number | |
alpha | number | |
beta | number | |
gamma | number |
- Type:
- Matrix3
createViewer(element, configopt) → {GLViewer}
Create and initialize an appropriate viewer at supplied HTML element using specification in config
Name | Type | Attributes | Description |
---|---|---|---|
element | Object | | Either HTML element or string identifier | |
config | ViewerSpec | <optional> | Viewer configuration |
- Source
GLViewer, null if unable to instantiate WebGL
- Type:
- GLViewer
var viewer = $3Dmol.createViewer(
'gldiv', //id of div to create canvas in
{
defaultcolors: $3Dmol.elementColors.rasmol,
backgroundColor: 'black'
}
);
createViewerGrid(element, configopt, viewer_configopt)
Create and initialize an appropriate a grid of viewers that share a WebGL canvas
Name | Type | Attributes | Description |
---|---|---|---|
element | Object | | Either HTML element or string identifier | |
config | GridSpec | <optional> | grid configuration |
viewer_config | ViewerGridSpec | <optional> | Viewer specification to apply to all subviewers |
- Source
[[GLViewer]] 2D array of GLViewers
var viewers = $3Dmol.createViewerGrid(
'gldiv', //id of div to create canvas in
{
rows: 2,
cols: 2,
control_all: true //mouse controls all viewers
},
{ backgroundColor: 'lightgrey' }
);
$3Dmol.get('data/1jpy.cif', function(data) {
var viewer = viewers[0][0];
viewer.addModel(data,'cif');
viewer.setStyle({sphere:{}});
viewer.zoomTo();
viewer.render( );
viewer = viewers[0][1];
viewer.addModel(data,'cif');
viewer.setStyle({stick:{}});
viewer.zoomTo();
viewer.render( );
viewer = viewers[1][0];
viewer.addModel(data,'cif');
viewer.setStyle({cartoon:{color:'spectrum'}});
viewer.zoomTo();
viewer.render( );
viewer = viewers[1][1];
viewer.addModel(data,'cif');
viewer.setStyle({cartoon:{colorscheme:'chain'}});
viewer.zoomTo();
viewer.render();
});
decode()
Fixed point, delta, RLE, integer packing adopted from https://github.com/rcsb/mmtf-javascript/
by Alexander Rose alexander.rose@weirdbyte.de, MIT License, Copyright (c) 2016
download(query, viewer, options, callbackopt) → {GLModel}
Load a PDB/PubChem structure into existing viewer. Automatically calls 'zoomTo' and 'render' on viewer after loading model
Name | Type | Attributes | Description |
---|---|---|---|
query | string | String specifying pdb or pubchem id; must be prefaced with "pdb: " or "cid: ", respectively | |
viewer | GLViewer | Add new model to existing viewer | |
options | Object | Specify additional options | |
callback | function | <optional> | Function to call with model as argument after data is loaded. |
- Source
GLModel, Promise if callback is not provided
- Type:
- GLModel
viewer.setBackgroundColor(0xffffffff);
$3Dmol.download('pdb:2nbd',viewer,{onemol: true,multimodel: true},function(m) {
m.setStyle({'cartoon':{colorscheme:{prop:'ss',map:$3Dmol.ssColors.Jmol}}});
viewer.zoomTo();
viewer.render(callback);
});
fractionalToCartesian(str, options)
Puts atoms specified in mmCIF fromat in str into atoms
Name | Type | Description |
---|---|---|
str | string | |
options | ParserOptionsSpec |
- Source
get(uri, callback)
Fetch data from URL
Name | Type | Description |
---|---|---|
uri | URL | |
callback | Function to call with data |
- Source
getColorFromStyle(atom, style) → {Color}
Return proper color for atom given style
Name | Type | Description |
---|---|---|
atom | AtomSpec | |
style | AtomStyle |
- Source
- Type:
- Color
getbin(uri, callbackopt, requestopt, postdataopt) → {Promise}
Download binary data (e.g. a gzipped file) into an array buffer and provide
arraybuffer to callback.
Name | Type | Attributes | Description |
---|---|---|---|
uri | string | location of data | |
callback | function | <optional> | Function to call with arraybuffer as argument. |
request | string | <optional> | type of request |
postdata | string | <optional> | data for POST request |
- Source
- Type:
- Promise
parseV3000(linesnon-null, options) → (non-null) {Array.<!Array.<!Object>>}
Name | Type | Description |
---|---|---|
lines | Array.<string> | |
options | ParserOptionsSpec |
- Source
- Type:
- Array.<!Array.<!Object>>
setSyncSurface(val)
Name | Type | Description |
---|---|---|
val | boolean | Whether surfaces should be rendered synchronously or in parallel. |
- Source
Type Definitions
ColorSpec
Color representation. A hex number, html color name, or object with r/g/b properties
- number |
string | Colored
- Source
ColorschemeSpec
Colorscheme specification.
- string |
object
Name | Type | Attributes | Description |
---|---|---|---|
gradient | GradientType | | <optional> | |
min | number | <optional> | |
max | number | <optional> | |
prop | string | <optional> | {AtomSpec} property to use for gradient calculation. E.g., 'b' for temperature factors of a PDB. |
mid | number | <optional> | mid point value for gradient (for rwb) |
colors | Array.<ColorSpec> | <optional> | Custom colors for gradient (for |
map | Record.<string, unknown> | <optional> | map of a certain |
- Source
GradientSpec
Gradient specification.
- object
Name | Type | Attributes | Description |
---|---|---|---|
gradient | string | <optional> | Kind of gradient. E.g. RWB, ROYGB, sinebow. Can also specify linear[_color]* as a, |
min | number | <optional> | Lower range of gradient |
max | number | <optional> | Upper range of gradient |
prop | string | <optional> | {AtomSpec} property to use for gradient calculation. E.g., 'b' for temperature factors of a PDB. |
mid | number | <optional> | mid point value for gradient (for rwb) |
colors | Array.<ColorSpec> | <optional> | Custom colors for gradient (for |
map | Record.<string, unknown> | <optional> | map of a certain |
- Source