QMol_extField_dipole - fmauger1/QMol-grid GitHub Wiki
QMol_extField_dipole
External driving field in the dipole approximation
Description
Use QMol_extField_dipole to store the components (electric field, derivative of the electric field, and potential vector) of an external driving field in the dipole approximation. QMol_extField_dipole is a handle class.
Note: QMol_extField_dipole is mainly a container class and it does not check the consistency between the stored electric field, derivative of the electric field, and potential vector. Supplying external-field component that do not match each other will lead to erroneous calculations, e.g., if used in TDSE or TDDFT propagation. For reminder, in the dipole approximation, the electric field and potential vector are related with $E(t)=-\partial_t A(t)$ .
Class properties
External field
The QMol_extField_dipole class defines the following public get-access properties; each can be changed using the set method:
electricField (E)
Electric-field component [ [] (default) | function handle | griddedInterpolant ]
- Function handle should have the following signature
@(t) fun(t)and return the value(s) of the electric field at the queried time(s) griddedInterpolantenables arbitrary, non-analytic, electric field definition
electricFieldDerivative (DE)
Derivative of the electric-field component [ [] (default) | function handle | griddedInterpolant ]
- Function handle should have the following signature
@(t) fun(t)and return the value(s) of the derivative of the electric field at the queried time(s) griddedInterpolantenables arbitrary, non-analytic, electric field derivative definition
potentialVector (A)
potential-vectorcomponent [ [] (default) | function handle | griddedInterpolant ]
- Function handle should have the following signature
@(t) fun(t)and return the value(s) of the potential vector at the queried time(s) griddedInterpolantenables arbitrary, non-analytic, potential vector definition
Other properties
These properties cannot be edited with the set method.
isInitialized (isInit)
Whether the external-field container object is properly initialized. This is used throughout the QMol-grid package to check that the object holds meaningful information and is ready for use. Changing its isSpinPol may cause simulations to fail or produce erroneous results.
Class methods
Creation
constructor
Create an external-field container object with empty class properties.
obj = QMol_extField_dipole;
Create an external-field container object with the name properties set to the specified value. Several name-value pairs can be specified consecutively. Suitable name is any of the external-field properties and is case insensitive.
obj = QMol_extField_dipole(name1,value1);
obj = QMol_extField_dipole(name1,value1,name2,value2,___);
Changing class properties
set
Update the name properties of an external-field container object to the specified value. Several name-value pairs can be specified consecutively. Suitable name is any of the external-field 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 false.
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 external-field 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_extField_dipole class.
Initializing the object
initialize
Initialize an external-field container object and sets the isInitialized flag to true.
obj.initialize;
- To avoid any mismatch in internal properties,
initializefirstresetthe object before performing the initialization. - For compatibility with time propagators, the object can also be initialized using the signature
obj.initialize(disc), wherediscis a domain-discretization handle
Run-time documentation
getMemoryProfile
Get an estimate of the memory held by a QMol_extField_dipole object with either
mem = obj.getMemoryProfile;
mem = obj.getMemoryProfile(false);
- The estimate only includes external-field components described with a griddedInterpolant and ignores other (small) properties.
- The output
memis the estimated size in bytes.
Additionally display the detail of the memory footprint with
mem = obj.getMemoryProfile(true);
showDocumentation
Display the run-time documentation for the specific configuration of a QMol_extField_dipole object
ref = obj.showDocumentation;
- The output
refis a cell vector containing the list of references to be included in the bibliography.
Examples
Create an external-field container with a -vector and electric-field components
% Potential vector as a function
A = @(t) cos(0.05*t).*exp(-t.^2/2/1e5);
% Interpolated electric field
t = -1500:1500;
dt = 1e-5;
E = -(A(t+.5*dt)-A(t-.5*dt))/dt;
E = griddedInterpolant(t,E,'pchip','nearest');
% Create external-field container
EF = QMol_extField_dipole('electricField',E,'potentialVector',A);
Display the run-time documentation
EF.showDocumentation;
* External driving field dipole approximation
Potential vector: function
Electric field: interpolation
Electric field derivative: N/A
V-01.21.000 (06/17/2024) F. Mauger
Display the estimated memory footprint
EF.getMemoryProfile(true);
* External driving field (dipole approx.)
> Electric field 46.9 KB
Test suite
Run the test suite for the class in normal or summary mode respectively with
QMol_test.test('extField_dipole');
QMol_test.test('-summary','extField_dipole');
For developers
Other hidden class properties
For compatibility with time propagators, QMol_extField_dipole retains a copy of the domain-discretization handle provided when the object is initialized. It cannot be edited with the set method, nor by any function outside of the object (except for QMol_TDDFT and QMol_TDSE classes). Un-initialized QMol_extField_dipole objects, i.e., isInitialized == false , have hempty disc.
Notes
The results displayed in this documentation page were generated using version 01.21 of the QMol-grid package.
QMol_extField_dipolewas introduced in version 01.10