Operators Class - GaryZ700/CatLab_CompChem GitHub Wiki

Operators

Overview

The Schrödinger class is implemented in the operators.py file. The operators.py files consist of the abstract Operator class, along with three concrete operator child classes that represent the three main quantum mechanical operators used in this package. This page will document the abstract class, along with the concrete implementations of the Hamiltonian, kinetic energy, and potential energy operators. Class names are as follows:

  • Abstract Classs: Operator
  • Kinetic Energy: TOperator
  • Potential Energy: VOperator
  • Hamiltonian: HOperator

Import

Importing will vary depending on your specific needs. In order to import a single class, simply import the name of the desired class as follows: from operators import HOperator.

To import multiple classes, separate each desired class by a comma. Ex: from operators import HOperator, TOperator, VOperator. To import all of the classes at once, use from operator import *.

Operator

Methods

  • Instantiation: concreteOperator = concreteOperator(integrationStart)
    • integrationStart: Value of where integration should begin. (Optional, default value is 0)
    • Although the Operator class is abstract and does not allow for instantiation, parameters and code are placed into the __init__ method to provide a template and encourage other programmers who derive from this class to also include the integrationStart parameter. It is mandatory to override this method in the child class.

  • operatesOn(other)
    • other: Specifies the other object that is to be operated on.
    • The operatesOn method must be overridden in the child class, and its parameters may be modified as necessary to meet the exact needs of the operator being implemented.

  • __getitem__(coord)
    <li>Instantiation: schrodInstance = schrod(<i>arg1</i>, <i>basis</i>, <i>pes</i>)</li>
    <ul>
        <li><i>arg1</i>: Hamiltonian Operator Object (Optional)</li>
        <li><i>basis</i>: Basis Set Object (Optional)</li>
        <li><i>PES</i>: Potential Energy Surface Object (Optional)</li>
        <li>Returns a new instance of the schrod class.</li>
        All the parameters for the constructor are optional since not including them will result in an empty schrod object being created. Then, to compute the solution, the solve method can be called with the Hamiltonian and basis set as arguments. If the Hamiltonian and basis set are passed into the constructor, then the solution is computed immediately. In case of either computation through the constructor or the solve method, the potential energy surface argument is optional, if provided the graph of the wavefunction solutions will be imposed over the potential energy surface.
    </ul><br>
    <li>schrodInstance.solve(<i>H</i>, <i>basis</i>, <i>pes</i>)</li>
    <ul>
        <li>Parameters have same meaning as in schrod instantiation, see above.</li>
        <li>Has a void return.</li>
        <li>The solve method is used to run a numerical linear algebra procedure on the Hamiltonian and basis set to produce the eigen values and vectors that then make up the wavefunctions of the system.</li>
    </ul><br>
    <li>schrodInstance.getWaveFunctions()</li>
    <ul>
        <li>Returns a list of wavefunctions that are the solution to the system passed into the schrod class. Will return an empty list if the schrod object as not solved any system.</li>
    </ul>
    

    Public Variables

    • schrodInstance.eigenValues: A list of eigen values that satisfy the solution generated by the schrod class. Will be None if a solution was not generated.
    • schrodInstance.eigenVectors: A list of eigen vectors that satisy the solution generated by the schrod classs. Will be None if a solution was not gnerated.
    • schrodInstance.basis: A basis set object. Will be none if the schrod object does not have a basis set.
    • schrodInstance.maxWaveFunctions: An integer representing the maximum number of wavefunctions that should be graphed at once. All wavefunction data still exists in the object, but only the first to the max wavefunction will be graphed for performance reasons.

    Parent Classes

    • Graphable
      • schrodInstance.graph() will generate a graph of this object.
    ⚠️ **GitHub.com Fallback** ⚠️