|
| input_files, every_nth_energy | input_files:every_nth_energy:Units:Input:Output:Input:final_state:initial_state:grid_vectors: (id dipole_tools,[every_nth_energy] id available,[Units] id show_states,[Input] id none,[Output] id Dyson_signs,[Input] final_state, initial_state, grid_vectors,[final_state] id state,[initial_state] id state,[grid_vectors] id grid_vectors) |
| n, 1 | IMPORTANT:n_1:n_2:Input:phi:initial_state:final_state:grid_vectors: (id point,[n_1] gamma in case of NO2 coordinate,[n_2] ra in case of NO2 momentum_space_photodipoles,[Input] theta, phi, initial_state, final_state, grid_vectors theta,[phi] id electron,[initial_state] id state,[final_state] id state,[grid_vectors] id grid_vectors) |
| grid for internal | coordinate (bending angle in degrees in case of NO2) % grid_vectors |
| grid for internal | coordinate (asymmetric stretch in Bohr in case of NO2) % If grid_vectors |
| x, y, z | n_1:n_2:Input:final_stateF:grid_vectors:Output:n_1:n_2:Input:initial_state:grid_vectors:Output:n_1:n_2:Input:final_state:grid_vectors:Output:n_1:n_2:Source_files:Molecule:Max_L:N_energies:N_final_states:N_initial_states:N_angular_points:N_atoms:Final_states: (gamma in case of NO2 coordinate,[n_2] ra in case of NO2 final_state_dipoles,[Input] final_stateI, final_stateF, grid_vectors final_stateI,[final_stateF] id required,[grid_vectors] id index,[Output] x, y, z coordinates,[n_1] gamma in case of NO2 coordinate,[n_2] ra in case of NO2 initial_state_energy,[Input] initial_state, grid_vectors,[initial_state] id state,[grid_vectors] id index,[Output] n_1, n_2 coordinates,[n_1] gamma in case of NO2 coordinate,[n_2] ra in case of NO2 final_state_energy,[Input] final_state, grid_vectors,[final_state] id state,[grid_vectors] id index,[Output] n_1, n_2 coordinates,[n_1] gamma in case of NO2 coordinate,[n_2] ra in case of NO2 structures,[Source_files] id rmatrix_data,[Molecule] id molecule,[Max_L] id momentum,[N_energies] id energies,[N_final_states] id states,[N_initial_states] id states,[N_angular_points] id signs,[N_atoms] id centre,[Final_states] 3, N_final_states Final_states) |
| | disp (msg) else error('Expecting either one or two arguments on input.') end if not(iscell(input_files)) error('The argument input_files must be a cell vector') end obj.N_geometries |
| end if | not (ischar(input_files{geom, 1})) error('Path must be character') end msg |
| elseif | not (isequal(obj.Molecule, C)) disp(obj.Molecule) disp(C) error('Flag Molecule is not the same for all geometries.') end %Read the dimensions C |
| | N_energies_geom (geom) |
| | C (4)=0 |
| if | not (isequal(ref, C)) disp(ref) disp(C) error('Dimension parameters are not the same for all geometries.') end end for i |
| | D (1:3, j) |
| if | not (is_ref_geom) if not(isequal(obj.Final_states |
| end Read the atom | coordinates (Bohr) for i |
| if is_ref_geom obj | Angular_grid_cartesian (1, i) |
| x obj | Angular_grid_cartesian (2, i) |
| y obj | Angular_grid_cartesian (3, i) |
| z obj | Angular_grid_cartesian (4, i) |
| obj | Xlm_precalculated (lm, i) |
| end end elseif | not (isequal(obj.Angular_grid_cartesian(:, i), C)) error('The angular grid is not the same for all geometries.') end end %Read the energy grid Energy_grid |
| Number and symmetry of the Dyson | orbital (only needed for book keeping so I know which Dysons were taken from the R-matrix files). flag |
| elseif | not (flag==obj.Dyson_orbitals{1, i, k}) % error('The Dyson orbital flags are not the same for all geometries.') end Dyson_signs |
| | fclose (fileID) |
| | energies (j, 1) |
| | map (geom) |
| end end | if (geom_has_energy) have_energy |
| end end | if (have_energy==true) obj.N_energies |
| | energies (obj.N_energies, 1) |
| | disp (strcat('Accepted energy:', str)) for geom |
| | disp (strcat('Dropping energy:', str)) end end obj.Electron_energies |
| obj | Electron_energies (1:obj.N_energies, 1) |
| Put the dipoles from the Dipoles_read structure to the obj Dipoles structure | disp ('Processing photodipoles arrays...') obj.Dipoles |
| obj | Dipoles (1:obj.N_lm, 1:3, e, f, in, geom) |
| end end end end | disp ('done')[obj.Internal_coordinates obj.Internal_coordinates_limits] |
| N_energies_geom(geom, 1) | zeros () |
| end end if | map (i, 1) |
| interpolate for the given internal_coordinates if | not (obj.Have_interpolant) error('Interpolation requested but not possible since the interpolant could not be const ructed.') end n_gamma = size([grid_vectors{2}],2) |
| number of gamma values else | error ('On input the size of the cell array grid_vectors must be either 1 or 3.') end if final _state > obj.N_final_states||final _state<=0error('On input final _state was out of range.') end if initial_state > obj.N_initial_states||initial_state<=0error('On input initial_state was out of range.') end if geom = [grid_vectors{1}] |
| end if nargin nargin< 2 error('Expecting either 1 or 2 parameters on input.') end if final_state > obj N_final_states final_state<=0 error('On input final_state was out of range.') end if n_coords==0 geom=1;%no interpolation;use the geometry with index 1 elseif n_coords==2 geom=0;%interpolate for the given internal_coordinates if not(obj.Have_interpolant) error('Interpolation requested but not possible since the interpolant could not be constructed.') end n_gamma=size([grid_vectors{1}], 2);%number of gamma values n_ra=size([grid_vectors{2}], 2);%number of gamma values else error('On input the size of the cell array grid_vectors must be either 1 or 3.') end %Check the range of the internal_coordinates if geom==0 if not(n_coords==size(obj.Internal_coordinates_limits, 2)) error('The number of supplied grid vectors for the nuclear coordinates does not equal the actual number of nuclear coordinates.') end for i=1:n_coords vectors=[grid_vectors{i}];n=size([grid_vectors{i}], 2);for j=1:n if vectors(j)< obj.Internal_coordinates_limits(1, i) disp(num2str(vectors(j))) disp(num2str(obj.Internal_coordinates_limits(1, i))) error('On input internal coordinate was too small.') end if vectors(j) > obj | Internal_coordinates_limits (2, i) disp(num2str(vectors(j))) disp(num2str(obj.Internal_coordinates_limits(1 |
| end if nargin nargin< 2 error( 'Expecting either 1 or 2 parameters on input.') end if final_state > obj N_final_states final_state<=0 error( 'On input final_state was out of range.') end if n_coords==0 geom=1;%no interpolation;use the geometry with index 1 elseif n_coords==2 geom=0;%interpolate for the given internal_coordinates if not(obj.Have_interpolant) error( 'Interpolation requested but not possible since the interpolant could not be constructed.') end n_gamma=size([grid_vectors{1}], 2);%number of gamma values n_ra=size([grid_vectors{2}], 2);%number of gamma values else error( 'On input the size of the cell array grid_vectors must be either 1 or 3.') end %Check the range of the internal_coordinates if geom==0 if not(n_coords==size(obj.Internal_coordinates_limits, 2)) error( 'The number of supplied grid vectors for the nuclear coordinates does not equal the actual number of nuclear coordinates.') end for i=1:n_coords vectors=[grid_vectors{i}];n=size([grid_vectors{i}], 2);for j=1:n if vectors(j)< obj.Internal_coordinates_limits(1, i) disp(num2str(vectors(j))) disp(num2str(obj.Internal_coordinates_limits(1, i))) error( 'On input internal coordinate was too small.') end if vectors(j) > obj i | error ('On input internal coordinate was too large.') end end end end if geom |
| | e (1:n_gamma, 1:n_ra) |
| if nargin< 6||nargin > | disp (nargin) error('The number of input parameters(excluding the object itself) must be either 5 or 6.') end if n_coords |
| Take the real spherical harmonic from the precalculated buffer where possible otherwise calculate it for the point given if found | Xlm (1, lm) |
| end else Include interpolation accross geometries interpolation in | energy (1D) and geometry(2D) for each of the x |
| end else Output is a | matrix (3, n_en, n_en, n_en) corresponding to the x |
| end end end end end end Auxiliary functions needed to evaluate the dipoles in the momentum basis | methods (Static, Hidden) function r |
| end if t1< t2 tmax=t1;else tmax=t2;end if abs(M) > J | abs (N) > J r=0 |
| end note that the meaning of theta and phi is swapped since xyz_to_tp uses the Mathematical convention for spherical | coordinates (theta is azimuthal angle, phi is the polar angle)! function[t |
|
| | __pad0__ |
| | n_1 |
| | __pad1__ |
| | __pad2__ |
| is given then | grid_vectors |
| is given then | initial_stateF |
| is given then cell array of size corresponding to the number of internal nuclear coordinates If the grid_vectors are not given then the dipoles are evaluated for geometry with index | Output |
| | __pad3__ |
| | symmetry |
| spin | Final_states |
| spin for each | geometry |
| spin for each the internal nuclear coordinates In case of NO2 | ninternal = 2 corresponding to the gamma |
| spin for each the internal nuclear coordinates In case of NO2 ra coordinates This array is only constructed if N_geometries | Internal_coordinates_limits |
| spin for each the internal nuclear coordinates In case of NO2 ra coordinates This array is only constructed if N_geometries | n = j |
| spin for each the internal nuclear coordinates In case of NO2 ra coordinates This array is only constructed if N_geometries where n is the number of internal nuclear coordinates At the moment n can be either or This array is only constructed if N_geometries | Angular_grid_cartesian = zeros(4,obj.N_angular_points) |
| spin for each the internal nuclear coordinates In case of NO2 ra coordinates This array is only constructed if N_geometries where n is the number of internal nuclear coordinates At the moment n can be either or This array is only constructed if N_geometries containing the grid points(x, y, z, w) defining the angular grid. %Angular_grid_spherical elseif | nargin |
| | msg = strcat('Accepting energies in steps of:',num2str(en_step)) |
| obj | Source_files = input_files |
| obj | Have_interpolant = false |
| | Dipoles_read = cell(obj.N_geometries,1) |
| | Energy_grid = cell(obj.N_geometries,1) |
| | N_energies_geom = zeros(obj.N_geometries,1) |
| angular | grid |
| angular etc All other geometries must contain the same data for the reference values if | geom |
| else | is_ref_geom = 0 |
| | C = fgetl(fileID) |
| if is_ref_geom obj | Molecule = C |
| Number of electron energies for this geometry if is_ref_geom obj | Max_L = C(1) |
| obj | N_lm = C(2) |
| obj | N_final_states = C(3) |
| obj | N_angular_points = C(5) |
| obj | N_atoms = C(6) |
| obj | N_initial_states = C(7) |
| Declarations obj | Initial_states = cell(3,obj.N_initial_states,obj.N_geometries) |
| obj | Atoms = cell(2,obj.N_atoms,obj.N_geometries) |
| | x |
| | y |
| | z |
| w obj | Angular_grid_spherical = zeros(3,obj.N_angular_points) |
| | theta = obj.Angular_grid_spherical(1,i) |
| | phi = obj.Angular_grid_spherical(2,i) |
| w obj | Xlm_precalculated = zeros(obj.N_lm,obj.N_angular_points) |
| obj | Dyson_orbitals = cell(2,obj.N_final_states,obj.N_initial_states,obj.N_geometries) |
| we omit the energy grid from the check since we determine the common set of energy points at the end | ref = [obj.Max_L |
| | D = fscanf(fileID,'%e',1) |
| | row |
| relative state number within its spin space symmetry | Ssym = strcat(' Symmetry = ',num2str(C(2))) |
| state symmetry | Sspin = strcat(' Spin = ',num2str(C(3))) |
| for | j |
| end for | i |
| quadrature weight note that theta and phi are swapped since xyz_to_tp uses the Mathematical convention for spherical | coordinates [obj.Angular_grid_spherical(2, i) obj.Angular_grid_spherical(1, i)] = obj.xyz_to_tp(obj.Angular_grid_cartesian(1,i),obj.Angular_grid_cartesian(2,i),obj.Angular_grid_cartesian(3,i)) |
| Precalculate | Xlm = zeros(1,obj.N_lm) |
| | lm = 0 |
| for | l |
| Read the Dyson orbital signs evaluated on the angular grid for | k |
| | Dnum = strcat(' Dyson orbital number = ',num2str(C(1))) |
| | Dsym = strcat(' Dyson orbital symmetry = ',num2str(C(2))) |
| end end Read the partial wave photoionization dipoles | Re = fscanf(fileID,'%e',obj.N_lm*3*N_energies_geom(geom,1)*obj.N_final_states*obj.N_initial_states) |
| | Im = fscanf(fileID,'%e',obj.N_lm*3*N_energies_geom(geom,1)*obj.N_final_states*obj.N_initial_states) |
| | all_energies = [Energy_grid{1,1}] |
| | energies = zeros(n,1) |
| if obj N_geometries Find the common set of energy | points |
| if obj N_geometries Find the common set of energy use the grid for geometry as the set of starting common points | energy_map = zeros(n,obj.N_geometries,'int32') |
| obj | N_energies = 0 |
| | test = [Energy_grid{geom,1}] |
| | geom_has_energy = false |
| | break |
| else | have_energy = false |
| | str = num2str(energies(i,1)) |
| for | in |
| Generate the griddedInterpolant for all dipole matrix | elements |
| Generate the griddedInterpolant for all dipole matrix energies and Dyson orbital | signs [obj.D_lm_xyz obj.Dipoles_initial obj.Dipoles_final obj.Energies_initial obj.Energies_final obj.Dyson_interpolant obj.Have_interpolant] = obj.construct_dipole_interpolant |
| obj | Electron_energies = energies(1:n,1) |
| obj | Dipoles = [Dipoles_read{geom,1}] |
| obj | D_lm_xyz = cell(obj.N_lm,3,obj.N_final_states,obj.N_initial_states) |
| | X = zeros(obj.N_energies,1) |
| | V = zeros(obj.N_energies,1) |
| | ref_grid = [Energy_grid{geom,1}] |
| end end end end end obj | Max_energy = max(obj.Electron_energies(:)) |
| obj | Min_energy = min(obj.Electron_energies(:)) |
| end function show_states(obj) disp(strcat( 'Molecule else | n_coords = 0 |
| no | interpolation |
| number of gamma values | n_ra = size([grid_vectors{2}],2) |
| else | s = zeros(obj.N_angular_points,n_gamma,n_ra) |
| end end end function | e |
| end end function | d |
| for | xyz |
| list of energies | n_en = size(energies,2) |
| else | dinterp = zeros(obj.N_lm,3,n_en,n_en,n_en) |
| end | found = 0 |
| end else Output is a z dipole components evaluated for the n_en *n_en *n_en points in the | energy |
| end else Output is a z dipole components evaluated for the n_en *n_en *n_en points in the | gamma |
| | t1 = J-N |
| | t2 = J+M |
| | t3 = M-N |
| if t3 | tmin = t3 |
| return end | S =sin(beta/2) |
| | tmp1 =sqrt(factorial(J+M)*factorial(J-M)*factorial(J+N)*factorial(J-N)) |
| for | t |
| end | r = tmp |
| end note that the meaning of theta and phi is swapped since xyz_to_tp uses the Mathematical convention for spherical | p |
| | fact = sqrt(x*x + y*y) |