Displays the MoleculeSim simulation.

Hierarchy (view full)

Implements

Constructors

  • Parameters

    • elem_ids: ElementIDs

      specifies the names of the HTML elementId's to look for in the HTML document; these elements are where the user interface of the simulation is created.

    • numAtoms: number

      number of atoms to make, from 2 to 6

    Returns Molecule3App

Properties

attract: number = 30

strength of attraction force in NonLinearSpring2

msm_: number[][] = []

Mass-Spring-Mass matrix says how springs & masses are connected each row corresponds to a spring, with indices of masses connected to that spring.

nsg_: number[] = []

Non-Special Group of springs. These are indices in sim.getSprings() array.

sg_: number[] = []

Special Group of springs. These are indices in sim.getSprings() array.

springType_: SpringType = SpringType.LINEAR

What type of spring to create: linear, non-linear, or pseudo-gravity

Methods

  • Adds the given Observer to this Subject's list of Observers, so that the Observer will be notified of changes in this Subject. An Observer may call Subject.addObserver during its observe method.

    Parameters

    Returns void

  • Define short-cut name replacement rules. For example sim is replaced by app.sim when myName is app.

    Parameters

    • myName: string

      the name of this object, valid in global Javascript context.

    Returns void

  • Parameters

    • script: string
    • output: boolean = true

      whether to print the result to the output text area and add the script to session history; default is true

    Returns any

    the result of evaluating the string

  • Returns strength of attraction force in NonLinearSpring2.

    Returns number

    strength of attraction force in NonLinearSpring2

  • What type of springs to create

    Returns SpringType

    type of spring to create: 1=linear, 2=non-linear, or 3=pseudo-gravity

  • Returns spring stiffness of special group of springs

    Returns number

    spring stiffness of special group of springs

  • Notifies this Observer that a change has occurred in the Subject.

    Parameters

    • event: SubjectEvent

      contains information about what has changed in the Subject: typically either a one-time GenericEvent, or a change to the value of a Parameter

    Returns void

  • Sets strength of attraction force in NonLinearSpring2

    Parameters

    • value: number

      strength of attraction force in NonLinearSpring2

    Returns void

  • Sets whether this Subject will broadcast events, typically used to temporarily disable broadcasting. Intended to be used in situations where a subclass overrides a method that broadcasts an event. This allows the subclass to prevent the superclass broadcasting that event, so that the subclass can broadcast the event when the method is completed.

    Parameters

    • value: boolean

      whether this Subject should broadcast events

    Returns boolean

    the previous value

  • Sets type of springs to create

    Parameters

    • value: SpringType

      type of springs to create: 1=linear, 2=non-linear, or 3=pseudo-gravity

    Returns void

  • Sets spring stiffness of special group of springs

    Parameters

    • value: number

      spring stiffness of special group of springs

    Returns void

  • Set width and height of walls.

    Parameters

    • value: number

      width (and height) of walls

    Returns void

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:

    DisplayShape{polygon:Polygon{'chain3'}}
    

    Returns string

    a minimal string representation of this object.

  • Returns Mass-Spring-Mass matrix which says how springs & masses are connected. Each row corresponds to a spring; with indices of masses connected to that spring.

    Parameters

    • numAtoms: number

      number of atoms in molecule

    Returns number[][]

  • Returns Non-Special Groups of springs, these are indices into msm[].

    Parameters

    • num_springs: number

      number of springs in molecule

    • sg: number[]

      the special group

    Returns number[]

  • Returns Special Groups of springs, these are indices into msm[].

    Parameters

    • numAtoms: number

      number of atoms in molecule

    Returns number[]

Generated using TypeDoc