QMol_SE_wfcn_basis - fmauger1/QMol-grid GitHub Wiki
QMol_SE_wfcn_basis
Wave function object
Description
Use QMol_SE_wfcn_basis
to store wave functions for (TD)SE simulations with basis-set discretization. QMol_SE_wfcn_basis
is a handle class.
Class properties
Wave functions
The QMol_SE_wfcn_basis
class defines the following public get-access properties; each can be changed using the set
method:
waveFunction (wfcn)
Discretization of the wave functions [ matrix (default []) ]
- Properly allocated
waveFunction
is asize(
disc
.basis,2)-by-N
matrix, whereN
is the number of wave functions and matching the domain discretization of the associated (TD)SE model
Other properties
These properties cannot be edited with the set
method.
isInitialized (isInit)
Whether the wave function object is properly initialized. This is used throughout the QMol-grid package to check that the wave function object holds meaningful information and is ready for use.
isBasis
Flag indicating that QMol_SE_wfcn_basis
objects are discretization over a basis set [ true ]
- At run time,
isBasis
can be used to discriminateQMol_SE_wfcn
objects fromQMol_SE_wfcn_basis
(which overloads the class) - For class development purposes,
isBasis
is technically a static method. Practically, though, it can virtually almost always be treated as a constant property.
Class methods
Creation
constructor
Create a wave functions object with empty class properties.
obj = QMol_SE_wfcn_basis;
Create a wave functions object with the name
properties set to the specified value
. Several name-value
pairs can be specified consecutively. Suitable name
is any of the wave functions properties and is case insensitive.
obj = QMol_SE_wfcn_basis(name1,value1);
obj = QMol_SE_wfcn_basis(name1,value1,name2,value2,___);
Changing class properties
set
Update the name
properties of a wave functions object to the specified value
. Several name-value
pairs can be specified consecutively. Suitable name
is any of the wave functions properties and is case insensitive.
obj.set(name1,value1);
obj.set(name1,value1,name2,value2,___);
This is the common name-value pair assignment method used throughout the QMol-grid package. The set
method also reset
the class. After running, the set
property updates the isInitialized
flag to a false
value.
reset
Reset the object by deleting/re-initializing all run-time properties of the class and updating the isInitialized
flag to false
.
obj.reset;
This is the common reset
method available to all classes throughout the QMol-grid package.
clear
Clear all class properties
obj.clear;
Clear a specific set of the class properties. Suitable name
is any of the wave functions properties and is case insensitive.
obj.clear(name1,name2,___);
This is the common clear
method available to all classes throughout the QMol-grid package. The clear
method also reset
the class. The clear
method can be used to delete specific properties before saving an instance of the QMol_SE_wfcn
class.
Initializing the object
initialize
Minimally initialize a wave functions objects and set the isInitialized
flag to true
obj.initialize;
- To avoid any mismatch in internal properties,
initialize
firstreset
the object before performing the initialization
Future development my require access to the associated domain-discretization object, which can be provided at initialization
obj.initialize(disc);
Run-time documentation
getMemoryProfile
Get an estimate of the memory held by a QMol_SE_wfcn_basis
object with either
mem = obj.getMemoryProfile;
mem = obj.getMemoryProfile(false);
- The object must be properly
initialize
d with a domain discretization. - The estimate only includes the discretization of the wave functions on the domain grid and ignores other (small) properties.
- The output
mem
is the estimated size in bytes.
Additionally display the detail of the memory footprint with
mem = obj.getMemoryProfile(true);
Comparing orbitals
The class overloads the ==
and ~=
operators to facilitate the comparison between wave functions objects
eq (==)
Test if two wave functions objects describe the same density
obj1 == obj2
- It is defined as both objects holding the same number of wave functions and
all(abs(data1.waveFunction-data2.waveFunction) <= eqTol,'all')
eqTol = 1e-10
is a tolerance parameter to account for possible roundoff mismatch between two wave functions objects.- Any mismatch in the size of the two wave functions components returns a
false
result. - If both wave functions objects have been initialized with a domain-discretization object. The equality operator also checks that the to wave functions objects have the same domain discretization
obj1.disc == obj2.disc
.
ne (~=)
Test if two wave functions objects describe different densities
obj1 ~= obj2
It is equivalent to ~(obj1 == obj2)
.
Examples
Most end users will get wave functions objects indirectly, through Schrödinger-equation and TDSE simulations -- see their respective documentations for examples.
Test suite
Run the test suite for the class in normal or summary mode respectively with
QMol_test.test('SE_wfcn_basis');
QMol_test.test('-summary','SE_wfcn_basis');
For developers
QMol_SE_wfcn_basis
implements a streamlined version of the clear
all method, since it might be called frequently in Schrödinger-equation and TDSE computations. If adding properties to the class, the streamlined clear
all must be updated accordingly.
After initialization, the domain discretization is stored in the transient property disc
. The current version of QMol_SE_wfcn_basis
does not use this property; it is implemented for support in future development of the QMol-grid package. Future versions might remove the transient nature of disc
.
QMol_SE_wfcn_basis
overloads QMol_suite
.
Notes
QMol_SE_wfcn_basis
was introduced in version 01.20