Model

lib/model.js~ Model

# new Model(atoms, parameters)

An object containing an Atomic structure and taking care of its periodic nature, allowing querying and selection, and so on.

Parameters:
Name Type Description
atoms crystcif.Atoms

Atomic structure, in crystcif's Atoms format

parameters Object

Additional options:

  • supercell
  • molecularCrystal (if true, load full molecules in central unit cell)
  • useNMRActiveIsotopes (if true, all isotopes are set by default to the most common one with non-zero spin)
  • vdwScaling (scale van der Waals radii by a constant factor)
  • vdwElementScaling (table of per-element factors to scale VdW radii by)
Source:

Members

# (readonly) all :ModelView

ModelView containing all the atoms of the image

Type:
  • ModelView
Source:

# (readonly) atoms :Array.<AtomImage>

Atom images in this model

Type:
  • Array.<AtomImage>
Source:

# (readonly) axes :AxesMesh

Graphical object representing the unit cell's axes

Type:
  • AxesMesh
Source:

# (readonly) box :BoxMesh

Graphical object representing the unit cell's box

Type:
  • BoxMesh
Source:

# (readonly) cell :Array.<Array>

Unit cell of the model's original cell

Type:
  • Array.<Array>
Source:

# (readonly) crystalLabels :Array.<String>

Crystallographic labels of each atom

Type:
  • Array.<String>
Source:

# (readonly) info :Object

Additional information from the model's original cell

Type:
  • Object
Source:

# (readonly) length :int

Number of atoms in this model's original cell

Type:
  • int
Source:

# (readonly) numbers :Array.<int>

Atomic numbers in this model's original cell

Type:
  • Array.<int>
Source:

# (readonly) pbc :Array.<bool>

Periodic boundary conditions

Type:
  • Array.<bool>
Source:

# (readonly) periodic :bool

Whether this model is periodic in all three directions of space

Type:
  • bool
Source:

# (readonly) positions :Array.<Array>

Coordinates of the atoms in this model's original cell

Type:
  • Array.<Array>
Source:

# renderer :Renderer

Renderer used for this model's graphics

Type:
  • Renderer
Source:

# (readonly) scaledPositions :Array.<Array>

Fractional coordinates of the atoms in this model's original cell

Type:
  • Array.<Array>
Source:

# (readonly) speciesIndices :Array.<int>

Indices of each atom by their species (e.g. C1, C2, H1, C3, H2, etc.)

Type:
  • Array.<int>
Source:

# (readonly) supercell :Array.<int>

Shape of the supercell for this model

Type:
  • Array.<int>
Source:

# (readonly) supercellGrid :Array.<Array>

Full grid of origin coordinates of the cells making up the supercell

Type:
  • Array.<Array>
Source:

# (readonly) symbols :Array.<String>

Chemical symbols in this model's original cell

Type:
  • Array.<String>
Source:

# (readonly) vdwElementScaling :Object

Table of scaling factors by element for Van der Waals radii

Type:
  • Object
Source:

# (readonly) vdwScaling :float

Global scaling factor for Van der Waals radii

Type:
  • float
Source:

Methods

# absToFrac(x) → {Array.<float>}

Convert absolute coordinates to fractional

Parameters:
Name Type Description
x Array.<float>

Absolute coordinates

Source:
Returns:

Fractional coordinates

Type
Array.<float>

Add link drawn on model

Parameters:
Name Type Default Description
from Atom | Array

Starting point

to Atom | Array

End point

name String link

Name to use for the link object

label String null

Text label to add to the link

parameters Object

Additional parameters (see LineMesh)

Source:

# addSphere(center, radius, name, parameters)

Add a sphere drawn on model

Parameters:
Name Type Default Description
center Atom | Array

Center of the sphere

radius float

Radius of the sphere

name String sphere

Name to use for the sphere object

parameters Object

Additional parameters (see EllipsoidMesh)

Source:

# clearGraphics()

Remove all graphical objects

Source:

# deleteArray(name)

Delete an array from the underlying Atoms object

Parameters:
Name Type Description
name String

Name of the array to delete

Source:

# find(query) → {ModelView}

Find a group of atoms based on a given query and return as AtomImages

Parameters:
Name Type Description
query Array

A search query for atoms. Must use nested lists of types and arguments, and can use logic operators $and, $or and $xor.

Source:
Returns:

ModelView object for found atoms

Type
ModelView

# fracToAbs(fx) → {Array.<float>}

Convert fractional coordinates to absolute

Parameters:
Name Type Description
fx Array.<float>

Fractional coordinates

Source:
Returns:

Absolute coordinates

Type
Array.<float>

# getArray(name) → {Array}

Retrieve an array from the underlying Atoms object

Parameters:
Name Type Description
name String

Name of the array to retrieve

Source:
Returns:

Retrieved array

Type
Array

# hasArray(name) → {bool}

Check if an array exists in the underlying Atoms object

Parameters:
Name Type Description
name String

Name of the array to check

Source:
Returns:

Whether the array exists

Type
bool

# minimumSupercell(r)

Compute and return the minimum supercell that guarantees containing all atoms at a maximum distance r from those in the [0,0,0] cell.

Parameters:
Name Type Description
r float

Maximum distance that must be contained within the supercell

Source:

# removeGraphics(name)

Remove the graphical object with a given name

Parameters:
Name Type Description
name String

Name of the graphical object to remove

Source:

# setArray(name, arr)

Set an array for the underlying Atoms object

Parameters:
Name Type Description
name String

Name of the array to use

arr Array

Array to store

Source:

# view(indices) → {ModelView}

Create a new ModelView for this model, using a given list of indices

Parameters:
Name Type Description
indices Array

Indices of atoms to include in the ModelView

Source:
Returns:

ModelView object for specified indices

Type
ModelView