Skip to content
프로젝트

소개

WebGL로 가속되는 JavaScript 분자 그래픽 라이브러리

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+2
in 1 month
+4

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

3Dmol.js

CDNJS codecov Github CI

3Dmol.js is an object-oriented, WebGL accelerated JavaScript library for online molecular visualization.

Since 3Dmol.js is licensed under the permissive BSD open-source license, you are free to use it in any project, as long the code is properly acknowledged and cited.

With 3Dmol.js, you can add beautifully rendered molecular visualizations to your web applications. Features include:

  • support for pdb, sdf, mol2, xyz, cif, cdjson, mmtf, prmtop, gro, pqr, cube, and vasp formats
  • parallelized molecular surface computation
  • sphere, stick, line, cross, cartoon, and surface styles
  • atom property based selection and styling
  • labels
  • clickable interactivity with molecular data
  • geometric shapes including spheres and arrows

See the documentation to learn how to use 3Dmol.js as a hosted viewer, embeddable viewer, or as a component of a larger application.

Examples

HTML

<script src="https://3Dmol.org/build/3Dmol-min.js"></script>     
 
 <div style="width: 400px; height: 400px;" 
        class='viewer_3Dmoljs' data-pdb='4N8T' data-style='cartoon:color=spectrum'
        data-surface='opacity:.7;color:white'></div>

JavaScript

We support the use of both PDB queries as well as PDB files.

Alt Text

Create the viewer inside an existing element with a nonzero width and height. The following example uses jQuery to find the element; createViewer also accepts the element itself or its ID string, so jQuery is not required by your application.

var viewer = $3Dmol.createViewer($("#div"));

Then download a Protein Data Bank structure (here pdb:1MO8) and style it in the completion callback after a successful load. Loading, styling, fitting the camera with zoomTo, and drawing with render are separate operations; download performs an initial camera fit on success. Its callback also runs after a load failure; use the Promise form when you need to handle errors explicitly.

$3Dmol.download("pdb:1MO8",viewer,{multimodel:true, frames:true},function(){
	viewer.setStyle({}, {cartoon:{color:"spectrum"}});
	viewer.render();
});

Surfaces

Molecular surfaces are computed asynchronously by default and support different color schemes. The example below assumes viewer already contains a model, volumedata contains Cube-format text, and range contains its scalar color limits. See addSurface for completion and surface-removal semantics.

Alt Text

viewer.addSurface($3Dmol.SurfaceType.VDW, {
    opacity:0.85,
    voldata: new $3Dmol.VolumeData(volumedata, "cube"),
    volscheme: new $3Dmol.Gradient.ROYGB(range[1],range[0])
},{});

Shapes

The use of different shapes and styles is supported.

Alt Text

viewer.addCylinder({start:{x:0.0,y:2.0,z:0.0},
    end:{x:0.0,y:10.0,z:0.0},
    radius:0.5,
    fromCap:false,
    toCap:true,
    color:'teal'});
viewer.addCylinder({start:{x:15.0,y:0.0,z:0.0},
    end:{x:20.0,y:0.0,z:0.0},
    radius:1.0,
    color:'black',
    fromCap:false,
    toCap:false});

Documentation

Start with the JavaScript tutorial, then use the GLViewer reference and its linked selection, style, and parser specifications. For notebooks, see py3Dmol. The optional controls are documented in the embedding tutorial.

For agents and text-based tools, llms.txt points to the generated API index and per-page Markdown. These are generated from the same TypeScript comments and tutorials as the HTML reference; there is no separately maintained API manual. The npm package also includes TypeScript declarations under build/types.

The hosted documentation and 3Dmol.org/build bundles follow development. For a reproducible application, pin a package or CDN release and consult matching source comments and declarations. See the installation guide for the available bundles.

Development

Use Node.js 24 and npm 10 or newer to build and test the project. If you use nvm, run nvm install and nvm use from the repository root to select the version in .nvmrc. See CONTRIBUTING.md for contribution, documentation, and testing instructions.

Builds include the package version and Git revision in each bundle's header and in $3Dmol.buildInfo (also available as the buildInfo ES module export):

console.log($3Dmol.buildInfo);
// { version: "2.5.5", gitDescribe: "2.5.5-25-g07ff4af4-dirty",
//   commit: "<full commit hash>", dirty: true }

The Git description uses the nearest reachable tag, commit count, and abbreviated hash; an exact tag is shown by itself. Without tags it uses the abbreviated hash. -dirty indicates changes to tracked files; untracked files are not included. Builds without Git or checkout metadata still include the package version, with gitDescribe, commit, and dirty set to null. No build timestamp is included.

Contact

Please address any questions or concerns to [email protected]. You may also submit an issue on github.

Citing

If you use 3Dmol.js, please cite our Bioinformatics paper.

Funding

3DMol.js is funded through R35GM140753 (and previously R01GM108340) from the National Institute of General Medical Sciences. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institute of General Medical Sciences or the National Institutes of Health.

관련 프로젝트 살펴보기

불러오는 중…