Rotational solutions and matrix elements

Rotational energies

The rotational energies and wave functions can be calculated for specified range of \(J\) quantum number using the function solve

[2]:
from richmol.rot import Molecule, solve, LabTensor
import numpy as np

water = Molecule()
water.B = (27.877, 14.512, 9.285) # user-defined rotational constants in units of cm^-1

sol = solve(water, Jmin=0, Jmax=10)
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)

Returned object is a dictionary sol[J][sym] containing solutions for different values of \(J\) (int) and different symetries (str). The default molecular symmetry group is \(C_1\). The rotational state energies and assignments (by \(J, k, \tau\) quantum numbers) can be printed out as following

[3]:
print("J  sym #    energy      J   k  tau  |leading coef|^2")
for J in sol.keys():
    for sym in sol[J].keys():
        for i in range(sol[J][sym].nstates):
            print(J, "%4s"%sym, i, "%12.6f"%sol[J][sym].enr[i], sol[J][sym].assign[i])
J  sym #    energy      J   k  tau  |leading coef|^2
0    A 0     0.000000 ['0' '0' '0' ' 1.000000']
1    A 0    23.797000 ['1' '1' '1' ' 1.000000']
1    A 1    37.162000 ['1' '1' '0' ' 1.000000']
1    A 2    42.389000 ['1' '0' '1' ' 1.000000']
2    A 0    70.133328 ['2' '2' '0' ' 0.858561']
2    A 1    79.529000 ['2' '2' '1' ' 1.000000']
2    A 2    95.210000 ['2' '1' '0' ' 1.000000']
2    A 3   135.305000 ['2' '1' '1' ' 1.000000']
2    A 4   136.562672 ['2' '0' '0' ' 0.858561']
3    A 0   136.909477 ['3' '3' '1' ' 0.864669']
3    A 1   142.369084 ['3' '3' '0' ' 0.967023']
3    A 2   173.535239 ['3' '2' '1' ' 0.709013']
3    A 3   206.696000 ['3' '2' '0' ' 1.000000']
3    A 4   212.568523 ['3' '1' '1' ' 0.864669']
3    A 5   287.298916 ['3' '1' '0' ' 0.967023']
3    A 6   287.494761 ['3' '0' '1' ' 0.709013']
4    A 0   222.369478 ['4' '4' '0' ' 0.896649']
4    A 1   225.067555 ['4' '4' '1' ' 0.948133']
4    A 2   276.014787 ['4' '3' '0' ' 0.629522']
4    A 3   300.891698 ['4' '3' '1' ' 0.918376']
4    A 4   316.467065 ['4' '2' '0' ' 0.532625']
4    A 5   384.522445 ['4' '2' '1' ' 0.948133']
4    A 6   385.845213 ['4' '1' '0' ' 0.629522']
4    A 7   494.618302 ['4' '1' '1' ' 0.918376']
4    A 8   494.643456 ['4' '0' '0' ' 0.611920']
5    A 0   325.904850 ['5' '5' '1' ' 0.918977']
5    A 1   327.096090 ['5' '5' '0' ' 0.940650']
5    A 2   400.581905 ['5' '4' '1' ' 0.643200']
5    A 3   417.095984 ['5' '4' '0' ' 0.858561']
5    A 4   447.924940 ['5' '1' '1' ' 0.528378']
5    A 5   506.187057 ['5' '3' '0' ' 0.813657']
5    A 6   511.103325 ['5' '0' '1' ' 0.363246']
5    A 7   616.384016 ['5' '2' '0' ' 0.858561']
5    A 8   616.605210 ['5' '3' '1' ' 0.527744']
5    A 9   757.626853 ['5' '1' '0' ' 0.868831']
5    A 10   757.629769 ['5' '0' '1' ' 0.546444']
6    A 0   447.599446 ['6' '6' '0' ' 0.930613']
6    A 1   448.088529 ['6' '6' '1' ' 0.938929']
6    A 2   544.853509 ['6' '5' '0' ' 0.694584']
6    A 3   554.434256 ['6' '5' '1' ' 0.826057']
6    A 4   605.510686 ['6' '2' '0' ' 0.398085']
6    A 5   651.859161 ['6' '4' '1' ' 0.707757']
6    A 6   664.829678 ['6' '1' '0' ' 0.555679']
6    A 7   763.189409 ['6' '3' '1' ' 0.667046']
6    A 8   764.250215 ['6' '4' '0' ' 0.533751']
6    A 9   903.627310 ['6' '2' '1' ' 0.760886']
6    A 10   903.658813 ['6' '3' '0' ' 0.601918']
6    A 11  1076.383335 ['6' '1' '1' ' 0.823528']
6    A 12  1076.383652 ['6' '0' '0' ' 0.498603']
7    A 0   587.641514 ['7' '7' '1' ' 0.936448']
7    A 1   587.832828 ['7' '7' '0' ' 0.939478']
7    A 2   707.150495 ['7' '6' '1' ' 0.745130']
7    A 3   712.071291 ['7' '6' '0' ' 0.812652']
7    A 4   787.117900 ['7' '5' '1' ' 0.378256']
7    A 5   820.814666 ['7' '5' '0' ' 0.641752']
7    A 6   847.669393 ['7' '2' '1' ' 0.418388']
7    A 7   935.093985 ['7' '4' '0' ' 0.520021']
7    A 8   938.717803 ['7' '5' '1' ' 0.475129']
7    A 9  1074.737996 ['7' '3' '0' ' 0.515449']
7    A 10  1074.921568 ['7' '4' '1' ' 0.608049']
7    A 11  1246.578723 ['7' '2' '0' ' 0.671354']
7    A 12  1246.582784 ['7' '3' '1' ' 0.626878']
7    A 13  1450.894510 ['7' '1' '0' ' 0.783322']
7    A 14  1450.894543 ['7' '2' '1' ' 0.476487']
8    A 0   746.150442 ['8' '8' '0' ' 0.939605']
8    A 1   746.222754 ['8' '8' '1' ' 0.940674']
8    A 2   887.017097 ['8' '7' '0' ' 0.779525']
8    A 3   889.320855 ['8' '7' '1' ' 0.810109']
8    A 4   990.140685 ['8' '6' '0' ' 0.423009']
8    A 5  1012.133558 ['8' '6' '1' ' 0.606478']
8    A 6  1058.750356 ['8' '1' '0' ' 0.377711']
8    A 7  1131.879066 ['8' '5' '1' ' 0.427515']
8    A 8  1141.573018 ['8' '6' '0' ' 0.389495']
8    A 9  1271.230370 ['8' '2' '1' ' 0.347811']
8    A 10  1271.990740 ['8' '5' '0' ' 0.552238']
8    A 11  1441.827472 ['8' '5' '1' ' 0.390135']
8    A 12  1441.855243 ['8' '4' '0' ' 0.602795']
8    A 13  1645.289318 ['8' '2' '1' ' 0.594197']
8    A 14  1645.289806 ['8' '3' '0' ' 0.624819']
8    A 15  1881.160608 ['8' '1' '1' ' 0.747822']
8    A 16  1881.160611 ['8' '2' '0' ' 0.484037']
9    A 0   923.184206 ['9' '9' '1' ' 0.941530']
9    A 1   923.210846 ['9' '9' '0' ' 0.941899']
9    A 2  1084.689410 ['9' '8' '1' ' 0.799868']
9    A 3  1085.699491 ['9' '8' '0' ' 0.812648']
9    A 4  1212.033720 ['9' '7' '1' ' 0.480199']
9    A 5  1224.828202 ['9' '7' '0' ' 0.591925']
9    A 6  1296.074482 ['9' '4' '1' ' 0.298864']
9    A 7  1353.002055 ['9' '6' '0' ' 0.374391']
9    A 8  1374.214294 ['9' '1' '1' ' 0.424466']
9    A 9  1493.273872 ['9' '3' '0' ' 0.392923']
9    A 10  1495.760196 ['9' '6' '1' ' 0.479054']
9    A 11  1662.416485 ['9' '6' '0' ' 0.413327']
9    A 12  1662.550755 ['9' '5' '1' ' 0.518099']
9    A 13  1864.675734 ['9' '5' '0' ' 0.454211']
9    A 14  1864.679566 ['9' '4' '1' ' 0.558578']
9    A 15  2099.761970 ['9' '2' '0' ' 0.528922']
9    A 16  2099.762025 ['9' '3' '1' ' 0.608392']
9    A 17  2367.181346 ['9' '1' '0' ' 0.716385']
9    A 18  2367.181346 ['9' '2' '1' ' 0.486567']
10    A 0  1118.768185 ['10' '10' '0' ' 0.942846']
10    A 1  1118.777805 ['10' '10' '1' ' 0.942971']
10    A 2  1300.490705 ['10' '9' '0' ' 0.811875']
10    A 3  1300.913168 ['10' '9' '1' ' 0.816944']
10    A 4  1451.264316 ['10' '8' '0' ' 0.530681']
10    A 5  1457.977536 ['10' '8' '1' ' 0.590062']
10    A 6  1556.988444 ['10' '5' '0' ' 0.287706']
10    A 7  1597.634515 ['10' '5' '1' ' 0.355618']
10    A 8  1636.837487 ['10' '2' '0' ' 0.342468']
10    A 9  1740.831055 ['10' '4' '1' ' 0.384579']
10    A 10  1747.571107 ['10' '7' '0' ' 0.402992']
10    A 11  1908.633990 ['10' '7' '1' ' 0.406274']
10    A 12  1909.146191 ['10' '6' '0' ' 0.430611']
10    A 13  2109.304208 ['10' '6' '1' ' 0.468340']
10    A 14  2109.325343 ['10' '5' '0' ' 0.435375']
10    A 15  2343.306809 ['10' '5' '1' ' 0.486181']
10    A 16  2343.307304 ['10' '4' '0' ' 0.498711']
10    A 17  2609.994395 ['10' '2' '1' ' 0.473823']
10    A 18  2609.994401 ['10' '3' '0' ' 0.584735']
10    A 19  2908.956518 ['10' '1' '1' ' 0.688389']
10    A 20  2908.956518 ['10' '2' '0' ' 0.485892']

The energies here are in units of cm\(^{-1}\) (same units as input rotational constants) and the assignment is a list of quantum numbers \(J\), \(k\), \(\tau\) of the leading symmetric-top function in the expansion of state wave function. \(\tau\) is the parity of rotational state, defined as \((-1)^\tau\). The last element of the assignment list is the squared absolute value of the leading symmetric-top function coefficient. It is easy to print more than one leading contribution in the assignment, as shown in the following

[4]:
print("J  sym #    energy      J   k  tau  |leading coef|^2")
for J in sol.keys():
    for sym in sol[J].keys():
        sol[J][sym].assign_nprim = 3 # print up to three leading contributions
        for i in range(sol[J][sym].nstates):
            print(J, "%4s"%sym, i, "%12.6f"%sol[J][sym].enr[i], sol[J][sym].assign[i])
J  sym #    energy      J   k  tau  |leading coef|^2
0    A 0     0.000000 ['0' '0' '0' ' 1.000000']
1    A 0    23.797000 ['1' '1' '1' ' 1.000000' '1' '0' '1' ' 0.000000' '1' '1' '0' ' 0.000000']
1    A 1    37.162000 ['1' '1' '0' ' 1.000000' '1' '0' '1' ' 0.000000' '1' '1' '1' ' 0.000000']
1    A 2    42.389000 ['1' '0' '1' ' 1.000000' '1' '1' '0' ' 0.000000' '1' '1' '1' ' 0.000000']
2    A 0    70.133328 ['2' '2' '0' ' 0.858561' '2' '0' '0' ' 0.141439' '2' '1' '0' ' 0.000000']
2    A 1    79.529000 ['2' '2' '1' ' 1.000000' '2' '0' '0' ' 0.000000' '2' '1' '0' ' 0.000000']
2    A 2    95.210000 ['2' '1' '0' ' 1.000000' '2' '0' '0' ' 0.000000' '2' '1' '1' ' 0.000000']
2    A 3   135.305000 ['2' '1' '1' ' 1.000000' '2' '0' '0' ' 0.000000' '2' '1' '0' ' 0.000000']
2    A 4   136.562672 ['2' '0' '0' ' 0.858561' '2' '2' '0' ' 0.141439' '2' '1' '0' ' 0.000000']
3    A 0   136.909477 ['3' '3' '1' ' 0.864669' '3' '1' '1' ' 0.135331' '3' '2' '0' ' 0.000000']
3    A 1   142.369084 ['3' '3' '0' ' 0.967023' '3' '1' '0' ' 0.032977' '3' '2' '1' ' 0.000000']
3    A 2   173.535239 ['3' '2' '1' ' 0.709013' '3' '0' '1' ' 0.290987' '3' '1' '0' ' 0.000000']
3    A 3   206.696000 ['3' '2' '0' ' 1.000000' '3' '1' '1' ' 0.000000' '3' '3' '1' ' 0.000000']
3    A 4   212.568523 ['3' '1' '1' ' 0.864669' '3' '3' '1' ' 0.135331' '3' '2' '0' ' 0.000000']
3    A 5   287.298916 ['3' '1' '0' ' 0.967023' '3' '3' '0' ' 0.032977' '3' '0' '1' ' 0.000000']
3    A 6   287.494761 ['3' '0' '1' ' 0.709013' '3' '2' '1' ' 0.290987' '3' '1' '0' ' 0.000000']
4    A 0   222.369478 ['4' '4' '0' ' 0.896649' '4' '2' '0' ' 0.086275' '4' '0' '0' ' 0.017076']
4    A 1   225.067555 ['4' '4' '1' ' 0.948133' '4' '2' '1' ' 0.051867' '4' '3' '0' ' 0.000000']
4    A 2   276.014787 ['4' '3' '0' ' 0.629522' '4' '1' '0' ' 0.370478' '4' '4' '1' ' 0.000000']
4    A 3   300.891698 ['4' '3' '1' ' 0.918376' '4' '1' '1' ' 0.081624' '4' '2' '1' ' 0.000000']
4    A 4   316.467065 ['4' '2' '0' ' 0.532625' '4' '0' '0' ' 0.371003' '4' '4' '0' ' 0.096372']
4    A 5   384.522445 ['4' '2' '1' ' 0.948133' '4' '4' '1' ' 0.051867' '4' '1' '0' ' 0.000000']
4    A 6   385.845213 ['4' '1' '0' ' 0.629522' '4' '3' '0' ' 0.370478' '4' '2' '1' ' 0.000000']
4    A 7   494.618302 ['4' '1' '1' ' 0.918376' '4' '3' '1' ' 0.081624' '4' '1' '0' ' 0.000000']
4    A 8   494.643456 ['4' '0' '0' ' 0.611920' '4' '2' '0' ' 0.381101' '4' '4' '0' ' 0.006979']
5    A 0   325.904850 ['5' '5' '1' ' 0.918977' '5' '3' '1' ' 0.067985' '5' '1' '1' ' 0.013038']
5    A 1   327.096090 ['5' '5' '0' ' 0.940650' '5' '3' '0' ' 0.056654' '5' '1' '0' ' 0.002696']
5    A 2   400.581905 ['5' '4' '1' ' 0.643200' '5' '2' '1' ' 0.266490' '5' '0' '1' ' 0.090310']
5    A 3   417.095984 ['5' '4' '0' ' 0.858561' '5' '2' '0' ' 0.141439' '5' '5' '0' ' 0.000000']
5    A 4   447.924940 ['5' '1' '1' ' 0.528378' '5' '3' '1' ' 0.404271' '5' '5' '1' ' 0.067351']
5    A 5   506.187057 ['5' '3' '0' ' 0.813657' '5' '1' '0' ' 0.128473' '5' '5' '0' ' 0.057870']
5    A 6   511.103325 ['5' '0' '1' ' 0.363246' '5' '4' '1' ' 0.335435' '5' '2' '1' ' 0.301319']
5    A 7   616.384016 ['5' '2' '0' ' 0.858561' '5' '4' '0' ' 0.141439' '5' '3' '1' ' 0.000000']
5    A 8   616.605210 ['5' '3' '1' ' 0.527744' '5' '1' '1' ' 0.458583' '5' '5' '1' ' 0.013672']
5    A 9   757.626853 ['5' '1' '0' ' 0.868831' '5' '3' '0' ' 0.129688' '5' '5' '0' ' 0.001481']
5    A 10   757.629769 ['5' '0' '1' ' 0.546444' '5' '2' '1' ' 0.432191' '5' '4' '1' ' 0.021365']
6    A 0   447.599446 ['6' '6' '0' ' 0.930613' '6' '4' '0' ' 0.060372' '6' '2' '0' ' 0.007566']
6    A 1   448.088529 ['6' '6' '1' ' 0.938929' '6' '4' '1' ' 0.056679' '6' '2' '1' ' 0.004392']
6    A 2   544.853509 ['6' '5' '0' ' 0.694584' '6' '3' '0' ' 0.213390' '6' '1' '0' ' 0.092026']
6    A 3   554.434256 ['6' '5' '1' ' 0.826057' '6' '3' '1' ' 0.161865' '6' '1' '1' ' 0.012078']
6    A 4   605.510686 ['6' '2' '0' ' 0.398085' '6' '4' '0' ' 0.365712' '6' '0' '0' ' 0.184283']
6    A 5   651.859161 ['6' '4' '1' ' 0.707757' '6' '2' '1' ' 0.234722' '6' '6' '1' ' 0.057521']
6    A 6   664.829678 ['6' '1' '0' ' 0.555679' '6' '5' '0' ' 0.259629' '6' '3' '0' ' 0.184691']
6    A 7   763.189409 ['6' '3' '1' ' 0.667046' '6' '5' '1' ' 0.168561' '6' '1' '1' ' 0.164394']
6    A 8   764.250215 ['6' '4' '0' ' 0.533751' '6' '0' '0' ' 0.315665' '6' '2' '0' ' 0.133429']
6    A 9   903.627310 ['6' '2' '1' ' 0.760886' '6' '4' '1' ' 0.235563' '6' '6' '1' ' 0.003551']
6    A 10   903.658813 ['6' '3' '0' ' 0.601918' '6' '1' '0' ' 0.352295' '6' '5' '0' ' 0.045787']
6    A 11  1076.383335 ['6' '1' '1' ' 0.823528' '6' '3' '1' ' 0.171090' '6' '5' '1' ' 0.005382']
6    A 12  1076.383652 ['6' '0' '0' ' 0.498603' '6' '2' '0' ' 0.460920' '6' '4' '0' ' 0.040164']
7    A 0   587.641514 ['7' '7' '1' ' 0.936448' '7' '5' '1' ' 0.056693' '7' '3' '1' ' 0.005772']
7    A 1   587.832828 ['7' '7' '0' ' 0.939478' '7' '5' '0' ' 0.055498' '7' '3' '0' ' 0.004784']
7    A 2   707.150495 ['7' '6' '1' ' 0.745130' '7' '4' '1' ' 0.185469' '7' '2' '1' ' 0.053659']
7    A 3   712.071291 ['7' '6' '0' ' 0.812652' '7' '4' '0' ' 0.165124' '7' '2' '0' ' 0.022224']
7    A 4   787.117900 ['7' '5' '1' ' 0.378256' '7' '3' '1' ' 0.329673' '7' '1' '1' ' 0.246567']
7    A 5   820.814666 ['7' '5' '0' ' 0.641752' '7' '3' '0' ' 0.274838' '7' '7' '0' ' 0.055134']
7    A 6   847.669393 ['7' '2' '1' ' 0.418388' '7' '0' '1' ' 0.245493' '7' '6' '1' ' 0.190231']
7    A 7   935.093985 ['7' '4' '0' ' 0.520021' '7' '2' '0' ' 0.306422' '7' '6' '0' ' 0.173557']
7    A 8   938.717803 ['7' '5' '1' ' 0.475129' '7' '1' '1' ' 0.470030' '7' '3' '1' ' 0.037677']
7    A 9  1074.737996 ['7' '3' '0' ' 0.515449' '7' '5' '0' ' 0.291067' '7' '1' '0' ' 0.188162']
7    A 10  1074.921568 ['7' '4' '1' ' 0.608049' '7' '0' '1' ' 0.277166' '7' '6' '1' ' 0.063320']
7    A 11  1246.578723 ['7' '2' '0' ' 0.671354' '7' '4' '0' ' 0.314855' '7' '6' '0' ' 0.013791']
7    A 12  1246.582784 ['7' '3' '1' ' 0.626878' '7' '1' '1' ' 0.282317' '7' '5' '1' ' 0.089922']
7    A 13  1450.894510 ['7' '1' '0' ' 0.783322' '7' '3' '0' ' 0.204929' '7' '5' '0' ' 0.011683']
7    A 14  1450.894543 ['7' '2' '1' ' 0.476487' '7' '0' '1' ' 0.461599' '7' '4' '1' ' 0.060594']
8    A 0   746.150442 ['8' '8' '0' ' 0.939605' '8' '6' '0' ' 0.054595' '8' '4' '0' ' 0.005036']
8    A 1   746.222754 ['8' '8' '1' ' 0.940674' '8' '6' '1' ' 0.054211' '8' '4' '1' ' 0.004726']
8    A 2   887.017097 ['8' '7' '0' ' 0.779525' '8' '5' '0' ' 0.170214' '8' '3' '0' ' 0.037362']
8    A 3   889.320855 ['8' '7' '1' ' 0.810109' '8' '5' '1' ' 0.162492' '8' '3' '1' ' 0.025633']
8    A 4   990.140685 ['8' '6' '0' ' 0.423009' '8' '4' '0' ' 0.296804' '8' '2' '0' ' 0.169511']
8    A 5  1012.133558 ['8' '6' '1' ' 0.606478' '8' '4' '1' ' 0.283223' '8' '2' '1' ' 0.057602']
8    A 6  1058.750356 ['8' '1' '0' ' 0.377711' '8' '3' '0' ' 0.337803' '8' '7' '0' ' 0.145017']
8    A 7  1131.879066 ['8' '5' '1' ' 0.427515' '8' '3' '1' ' 0.357391' '8' '7' '1' ' 0.167569']
8    A 8  1141.573018 ['8' '6' '0' ' 0.389495' '8' '2' '0' ' 0.330058' '8' '0' '0' ' 0.251323']
8    A 9  1271.230370 ['8' '2' '1' ' 0.347811' '8' '4' '1' ' 0.337552' '8' '6' '1' ' 0.308222']
8    A 10  1271.990740 ['8' '5' '0' ' 0.552238' '8' '1' '0' ' 0.376218' '8' '7' '0' ' 0.071526']
8    A 11  1441.827472 ['8' '5' '1' ' 0.390135' '8' '3' '1' ' 0.384973' '8' '1' '1' ' 0.202887']
8    A 12  1441.855243 ['8' '4' '0' ' 0.602795' '8' '0' '0' ' 0.250293' '8' '6' '0' ' 0.129652']
8    A 13  1645.289318 ['8' '2' '1' ' 0.594197' '8' '4' '1' ' 0.374500' '8' '6' '1' ' 0.031089']
8    A 14  1645.289806 ['8' '3' '0' ' 0.624819' '8' '1' '0' ' 0.233172' '8' '5' '0' ' 0.138078']
8    A 15  1881.160608 ['8' '1' '1' ' 0.747822' '8' '3' '1' ' 0.232002' '8' '5' '1' ' 0.019859']
8    A 16  1881.160611 ['8' '2' '0' ' 0.484037' '8' '0' '0' ' 0.431835' '8' '4' '0' ' 0.080866']
9    A 0   923.184206 ['9' '9' '1' ' 0.941530' '9' '7' '1' ' 0.053217' '9' '5' '1' ' 0.004663']
9    A 1   923.210846 ['9' '9' '0' ' 0.941899' '9' '7' '0' ' 0.053093' '9' '5' '0' ' 0.004565']
9    A 2  1084.689410 ['9' '8' '1' ' 0.799868' '9' '6' '1' ' 0.161263' '9' '4' '1' ' 0.030040']
9    A 3  1085.699491 ['9' '8' '0' ' 0.812648' '9' '6' '0' ' 0.158424' '9' '4' '0' ' 0.025782']
9    A 4  1212.033720 ['9' '7' '1' ' 0.480199' '9' '5' '1' ' 0.281490' '9' '3' '1' ' 0.123503']
9    A 5  1224.828202 ['9' '7' '0' ' 0.591925' '9' '5' '0' ' 0.280069' '9' '3' '0' ' 0.070944']
9    A 6  1296.074482 ['9' '4' '1' ' 0.298864' '9' '2' '1' ' 0.289966' '9' '6' '1' ' 0.152107']
9    A 7  1353.002055 ['9' '6' '0' ' 0.374391' '9' '4' '0' ' 0.363890' '9' '8' '0' ' 0.158114']
9    A 8  1374.214294 ['9' '1' '1' ' 0.424466' '9' '7' '1' ' 0.302786' '9' '3' '1' ' 0.250463']
9    A 9  1493.273872 ['9' '3' '0' ' 0.392923' '9' '7' '0' ' 0.302765' '9' '5' '0' ' 0.231880']
9    A 10  1495.760196 ['9' '6' '1' ' 0.479054' '9' '0' '1' ' 0.223298' '9' '2' '1' ' 0.214076']
9    A 11  1662.416485 ['9' '6' '0' ' 0.413327' '9' '2' '0' ' 0.364327' '9' '4' '0' ' 0.194185']
9    A 12  1662.550755 ['9' '5' '1' ' 0.518099' '9' '1' '1' ' 0.308943' '9' '7' '1' ' 0.153787']
9    A 13  1864.675734 ['9' '5' '0' ' 0.454211' '9' '3' '0' ' 0.282248' '9' '1' '0' ' 0.211786']
9    A 14  1864.679566 ['9' '4' '1' ' 0.558578' '9' '0' '1' ' 0.230510' '9' '6' '1' ' 0.201430']
9    A 15  2099.761970 ['9' '2' '0' ' 0.528922' '9' '4' '0' ' 0.416143' '9' '6' '0' ' 0.053858']
9    A 16  2099.762025 ['9' '3' '1' ' 0.608392' '9' '1' '1' ' 0.196965' '9' '5' '1' ' 0.184580']
9    A 17  2367.181346 ['9' '1' '0' ' 0.716385' '9' '3' '0' ' 0.253463' '9' '5' '0' ' 0.029276']
9    A 18  2367.181346 ['9' '2' '1' ' 0.486567' '9' '0' '1' ' 0.407203' '9' '4' '1' ' 0.100009']
10    A 0  1118.768185 ['10' '10' '0' ' 0.942846' '10' '8' '0' ' 0.052216' '10' '6' '0'
 ' 0.004435']
10    A 1  1118.777805 ['10' '10' '1' ' 0.942971' '10' '8' '1' ' 0.052176' '10' '6' '1'
 ' 0.004404']
10    A 2  1300.490705 ['10' '9' '0' ' 0.811875' '10' '7' '0' ' 0.155477' '10' '5' '0'
 ' 0.026360']
10    A 3  1300.913168 ['10' '9' '1' ' 0.816944' '10' '7' '1' ' 0.154458' '10' '5' '1'
 ' 0.024841']
10    A 4  1451.264316 ['10' '8' '0' ' 0.530681' '10' '6' '0' ' 0.273003' '10' '4' '0'
 ' 0.097119']
10    A 5  1457.977536 ['10' '8' '1' ' 0.590062' '10' '6' '1' ' 0.273838' '10' '4' '1'
 ' 0.074085']
10    A 6  1556.988444 ['10' '5' '0' ' 0.287706' '10' '3' '0' ' 0.231608' '10' '1' '0'
 ' 0.186176']
10    A 7  1597.634515 ['10' '5' '1' ' 0.355618' '10' '7' '1' ' 0.347209' '10' '9' '1'
 ' 0.149178']
10    A 8  1636.837487 ['10' '2' '0' ' 0.342468' '10' '8' '0' ' 0.235084' '10' '4' '0'
 ' 0.211387']
10    A 9  1740.831055 ['10' '4' '1' ' 0.384579' '10' '8' '1' ' 0.286705' '10' '6' '1'
 ' 0.173517']
10    A 10  1747.571107 ['10' '7' '0' ' 0.402992' '10' '1' '0' ' 0.381921' '10' '3' '0'
 ' 0.127222']
10    A 11  1908.633990 ['10' '7' '1' ' 0.406274' '10' '3' '1' ' 0.387790' '10' '5' '1'
 ' 0.093986']
10    A 12  1909.146191 ['10' '6' '0' ' 0.430611' '10' '0' '0' ' 0.196820' '10' '8' '0'
 ' 0.163163']
10    A 13  2109.304208 ['10' '6' '1' ' 0.468340' '10' '2' '1' ' 0.365330' '10' '4' '1'
 ' 0.097716']
10    A 14  2109.325343 ['10' '5' '0' ' 0.435375' '10' '1' '0' ' 0.261144' '10' '7' '0'
 ' 0.241853']
10    A 15  2343.306809 ['10' '5' '1' ' 0.486181' '10' '1' '1' ' 0.216981' '10' '3' '1'
 ' 0.204431']
10    A 16  2343.307304 ['10' '4' '0' ' 0.498711' '10' '6' '0' ' 0.267364' '10' '0' '0'
 ' 0.215074']
10    A 17  2609.994395 ['10' '2' '1' ' 0.473823' '10' '4' '1' ' 0.443207' '10' '6' '1'
 ' 0.079900']
10    A 18  2609.994401 ['10' '3' '0' ' 0.584735' '10' '5' '0' ' 0.226344' '10' '1' '0'
 ' 0.169325']
10    A 19  2908.956518 ['10' '1' '1' ' 0.688389' '10' '3' '1' ' 0.270399' '10' '5' '1'
 ' 0.039374']
10    A 20  2908.956518 ['10' '2' '0' ' 0.485892' '10' '0' '0' ' 0.386373' '10' '4' '0'
 ' 0.117576']

Molecular symmetry

The molecular symmetry group can be specified using the Molecule property sym. For example, the above calculation can be done using the \(D_2\) or \(C_{2v}\) symmetry groups

[5]:
water.sym = 'D2'
sol_d2 = solve(water, Jmin=0, Jmax=3)

water.sym = 'C2v'
sol_c2v = solve(water, Jmin=0, Jmax=3)

print("D2 solutions")
print("J  sym #    energy      J   k  tau  |leading coef|^2")
for J in sol_d2.keys():
    for sym in sol_d2[J].keys():
        for i in range(sol_d2[J][sym].nstates):
            print(J, "%4s"%sym, i, "%12.6f"%sol_d2[J][sym].enr[i], sol_d2[J][sym].assign[i])

print("C2v solutions")
print("J  sym #    energy      J   k  tau  |leading coef|^2")
for J in sol_c2v.keys():
    for sym in sol_c2v[J].keys():
        for i in range(sol_c2v[J][sym].nstates):
            print(J, "%4s"%sym, i, "%12.6f"%sol_c2v[J][sym].enr[i], sol_c2v[J][sym].assign[i])
D2 solutions
J  sym #    energy      J   k  tau  |leading coef|^2
0    A 0     0.000000 ['0' '0' '0' ' 1.000000']
1   B1 0    42.389000 ['1' '0' '1' ' 1.000000']
1   B2 0    37.162000 ['1' '1' '0' ' 1.000000']
1   B3 0    23.797000 ['1' '1' '1' ' 1.000000']
2    A 0    70.133328 ['2' '2' '0' ' 0.858561']
2    A 1   136.562672 ['2' '0' '0' ' 0.858561']
2   B1 0    79.529000 ['2' '2' '1' ' 1.000000']
2   B2 0    95.210000 ['2' '1' '0' ' 1.000000']
2   B3 0   135.305000 ['2' '1' '1' ' 1.000000']
3    A 0   206.696000 ['3' '2' '0' ' 1.000000']
3   B1 0   173.535239 ['3' '2' '1' ' 0.709013']
3   B1 1   287.494761 ['3' '0' '1' ' 0.709013']
3   B2 0   142.369084 ['3' '3' '0' ' 0.967023']
3   B2 1   287.298916 ['3' '1' '0' ' 0.967023']
3   B3 0   136.909477 ['3' '3' '1' ' 0.864669']
3   B3 1   212.568523 ['3' '1' '1' ' 0.864669']
C2v solutions
J  sym #    energy      J   k  tau  |leading coef|^2
0   A1 0     0.000000 ['0' '0' '0' ' 1.000000']
1   A2 0    42.389000 ['1' '0' '1' ' 1.000000']
1   B1 0    37.162000 ['1' '1' '0' ' 1.000000']
1   B2 0    23.797000 ['1' '1' '1' ' 1.000000']
2   A1 0    70.133328 ['2' '2' '0' ' 0.858561']
2   A1 1   136.562672 ['2' '0' '0' ' 0.858561']
2   A2 0    79.529000 ['2' '2' '1' ' 1.000000']
2   B1 0    95.210000 ['2' '1' '0' ' 1.000000']
2   B2 0   135.305000 ['2' '1' '1' ' 1.000000']
3   A1 0   206.696000 ['3' '2' '0' ' 1.000000']
3   A2 0   173.535239 ['3' '2' '1' ' 0.709013']
3   A2 1   287.494761 ['3' '0' '1' ' 0.709013']
3   B1 0   142.369084 ['3' '3' '0' ' 0.967023']
3   B1 1   287.298916 ['3' '1' '0' ' 0.967023']
3   B2 0   136.909477 ['3' '3' '1' ' 0.864669']
3   B2 1   212.568523 ['3' '1' '1' ' 0.864669']

To restrict solutions to have only certain symmetries, one can specify a state filter function in the filter keyword argument to solve. The filter function takes as arguments the state’s \(J\) (and \(m\)) quantum number and symmetry and returns True or False depending on if the corresponding state is included in or excluded from calculation. To demonstrate use of the filter function, let’s assume in the \(D_2\) symmetry group we want ‘A’ symmetry solutions for even \(J\) and ‘B1’ symmetry solutions for odd \(J\). This is how it can be done

[6]:
Jmin = 0
Jmax = 5

# desired D2-symmetry solutions: A for even and B1 for odd J, for max J = 5

def filter_D2(**kw):
    pass_J, pass_sym = (True, True)
    if 'J' in kw:
        J = kw['J']
        pass_J = J <= 5
    if 'sym' in kw:
        sym = kw['sym']
        pass_sym = sym in ['A'] if J % 2 == 0 else sym in ['B1']
    return pass_J * pass_sym

# obtain D2 solutions

water.sym = 'D2'
sol = solve(water, Jmin=0, Jmax=10, filter=filter_D2)


# print D2 solutions

print("J  sym #    energy      J   k  tau  |leading coef|^2")
for J in sol.keys():
    for sym in sol[J].keys():
        for i in range(sol[J][sym].nstates):
            print(J, "%4s"%sym, i, "%12.6f"%sol[J][sym].enr[i], sol[J][sym].assign[i])
J  sym #    energy      J   k  tau  |leading coef|^2
0    A 0     0.000000 ['0' '0' '0' ' 1.000000']
1   B1 0    42.389000 ['1' '0' '1' ' 1.000000']
2    A 0    70.133328 ['2' '2' '0' ' 0.858561']
2    A 1   136.562672 ['2' '0' '0' ' 0.858561']
3   B1 0   173.535239 ['3' '2' '1' ' 0.709013']
3   B1 1   287.494761 ['3' '0' '1' ' 0.709013']
4    A 0   222.369478 ['4' '4' '0' ' 0.896649']
4    A 1   316.467065 ['4' '2' '0' ' 0.532625']
4    A 2   494.643456 ['4' '0' '0' ' 0.611920']
5   B1 0   400.581905 ['5' '4' '1' ' 0.643200']
5   B1 1   511.103325 ['5' '0' '1' ' 0.363246']
5   B1 2   757.629769 ['5' '0' '1' ' 0.546444']

Rotational matrix elements

The matrix elements of laboratory-frame Cartesian tensor operators, such as, for example, dipole moment or polarizability, can be computed using LabTensor class. The rotational solutions, obtained by solve, can also be represented by LabTensor as a 0-rank tensor. Below, we compute the matrix elements of dipole moment and polarizability for water molecule

[7]:
water = Molecule()

# Cartesian coordinates of atoms
water.XYZ = ("bohr",
             "O",  0.00000000,   0.00000000,   0.12395915,
             "H",  0.00000000,  -1.43102686,  -0.98366080,
             "H",  0.00000000,   1.43102686,  -0.98366080)

# dipole moment (au)
water.dip = [0, 0, -0.7288]

# polarizability tensor (au)
water.pol = [[9.1369, 0, 0], [0, 9.8701, 0], [0, 0, 9.4486]]

Jmax = 2
water.sym = "C2v"

sol = solve(water, Jmin=0, Jmax=Jmax)

# laboratory-frame dipole moment operator
dip = LabTensor(water.dip, sol)

# laboratory-frame polarizability tensor
pol = LabTensor(water.pol, sol)

# field-free Hamiltonian
h0 = LabTensor(water, sol)

The matrix elements can be printed out in dense or sparse matrix form using tomat method. Few examples are shown below

[8]:
mu_x = dip.tomat(form='full', repres='csr_matrix', cart='x')
mu_y = dip.tomat(form='full', repres='coo_matrix', cart='y')
mu_z = dip.tomat(form='full', repres='dense', cart='z')

alpha_xx = pol.tomat(form='full', repres='csr_matrix', cart='xx')
alpha_xz = pol.tomat(form='full', cart='xz')

print(type(mu_x))
print(type(mu_y))
print(type(mu_z))
print(type(alpha_xx))
print(type(alpha_xz))

print(mu_x)
<class 'scipy.sparse.csr.csr_matrix'>
<class 'scipy.sparse.coo.coo_matrix'>
<class 'numpy.ndarray'>
<class 'scipy.sparse.csr.csr_matrix'>
<class 'scipy.sparse.csr.csr_matrix'>
  (0, 1)        (-0-0.29753135409006326j)
  (0, 3)        0.29753135409006326j
  (1, 0)        0.29753135409006326j
  (1, 10)       -0.20052055607190472j
  (1, 11)       -0.2569462873688082j
  (1, 14)       0.08186217421921829j
  (1, 15)       0.10489788255935244j
  (2, 12)       -0.1417894449657412j
  (2, 13)       -0.18168846219919169j
  (2, 16)       0.1417894449657412j
  (2, 17)       0.18168846219919169j
  (3, 0)        -0.29753135409006326j
  (3, 14)       -0.08186217421921829j
  (3, 15)       -0.10489788255935244j
  (3, 18)       0.20052055607190472j
  (3, 19)       0.2569462873688082j
  (4, 8)        (-9.258728549113566e-50+0.25766971106437786j)
  (4, 30)       (4.370915472751295e-35+0.28226302627159655j)
  (4, 32)       (-1.784418769512764e-35-0.11523339793653577j)
  (5, 7)        (-9.258728549113566e-50+0.25766971106437786j)
  (5, 9)        (-9.258728549113566e-50+0.25766971106437786j)
  (5, 31)       (3.090703970775646e-35+0.1995900999548826j)
  (5, 33)       (-3.090703970775646e-35-0.1995900999548826j)
  (6, 8)        (-9.258728549113566e-50+0.25766971106437786j)
  (6, 32)       (1.784418769512764e-35+0.11523339793653577j)
  :     :
  (26, 30)      (1.9519113634950015e-50+0.12146666666666672j)
  (26, 32)      (2.390593431851467e-50+0.14876567704503177j)
  (27, 7)       (1.784418769512764e-35-0.11523339793653573j)
  (27, 9)       (-1.784418769512764e-35+0.11523339793653573j)
  (27, 31)      (2.390593431851467e-50+0.14876567704503177j)
  (27, 33)      (2.390593431851467e-50+0.14876567704503177j)
  (28, 8)       (3.090703970775646e-35-0.19959009995488253j)
  (28, 32)      (2.390593431851467e-50+0.14876567704503177j)
  (28, 34)      (1.9519113634950015e-50+0.12146666666666672j)
  (29, 9)       (4.370915472751295e-35-0.28226302627159644j)
  (29, 33)      (1.9519113634950018e-50+0.12146666666666674j)
  (30, 4)       (4.3709154727512924e-35-0.28226302627159644j)
  (30, 26)      (-1.9519113634950018e-50-0.12146666666666674j)
  (31, 5)       (3.090703970775644e-35-0.19959009995488253j)
  (31, 25)      (-1.9519113634950015e-50-0.12146666666666672j)
  (31, 27)      (-2.390593431851467e-50-0.14876567704503177j)
  (32, 4)       (-1.784418769512763e-35+0.11523339793653573j)
  (32, 6)       (1.784418769512763e-35-0.11523339793653573j)
  (32, 26)      (-2.390593431851467e-50-0.14876567704503177j)
  (32, 28)      (-2.390593431851467e-50-0.14876567704503177j)
  (33, 5)       (-3.090703970775644e-35+0.19959009995488253j)
  (33, 27)      (-2.390593431851467e-50-0.14876567704503177j)
  (33, 29)      (-1.9519113634950015e-50-0.12146666666666672j)
  (34, 6)       (-4.3709154727512924e-35+0.28226302627159644j)
  (34, 28)      (-1.9519113634950018e-50-0.12146666666666674j)

For many tensor operators the selection rules are such that only certain \(J\) quanta and certain symmetries are being coupled. For example, for the dipole moment operator it holds that \(|J' - J|\leq 1\), also in the \(C_{2v}\) molecular symmetry group, \(A_1\) symmetry states are coupled only with \(A_2\) and \(B_1\) only with \(B_2\). It is therefore sometimes convenient to use a block representation of tensor matrix elements, where only non-zero blocks, corresponding to different pairs of bra and ket \(J\) quanta and symmetries, are stored. This representation can be obtained using tomat method with form="block" keyword (which is a default value)

[9]:
mu_x = dip.tomat(form="block", cart="x")
mu_y = dip.tomat(form="block", cart="y")
mu_z = dip.tomat(form="block", cart="z")

print("matrix elements of mu_x operator")
for (J1, J2) in mu_x.keys():
    for (sym1, sym2) in mu_x[(J1, J2)].keys():
        mat = mu_x[(J1, J2)][(sym1, sym2)]
        # you may notice |J1-J2|<=1 and A1<->A2, B1<->B2 selection rules
        print("(J', J) =", (J1, J2), "(sym', sym) =", (sym1, sym2), "\n", mat)
matrix elements of mu_x operator
(J', J) = (0, 1) (sym', sym) = ('A1', 'A2')
   (0, 0)       (-0-0.29753135409006326j)
  (0, 2)        0.29753135409006326j
(J', J) = (1, 2) (sym', sym) = ('A2', 'A1')
   (0, 0)       -0.20052055607190472j
  (0, 1)        -0.2569462873688082j
  (0, 4)        0.08186217421921829j
  (0, 5)        0.10489788255935244j
  (1, 2)        -0.1417894449657412j
  (1, 3)        -0.18168846219919169j
  (1, 6)        0.1417894449657412j
  (1, 7)        0.18168846219919169j
  (2, 4)        -0.08186217421921829j
  (2, 5)        -0.10489788255935244j
  (2, 8)        0.20052055607190472j
  (2, 9)        0.2569462873688082j
(J', J) = (1, 2) (sym', sym) = ('B2', 'B1')
   (0, 0)       (-4.370915472751295e-35-0.28226302627159655j)
  (0, 2)        (1.784418769512764e-35+0.11523339793653577j)
  (1, 1)        (-3.090703970775646e-35-0.1995900999548826j)
  (1, 3)        (3.090703970775646e-35+0.1995900999548826j)
  (2, 2)        (-1.784418769512764e-35-0.11523339793653577j)
  (2, 4)        (4.370915472751295e-35+0.28226302627159655j)
(J', J) = (1, 2) (sym', sym) = ('B1', 'B2')
   (0, 0)       (4.370915472751295e-35+0.28226302627159655j)
  (0, 2)        (-1.784418769512764e-35-0.11523339793653577j)
  (1, 1)        (3.090703970775646e-35+0.1995900999548826j)
  (1, 3)        (-3.090703970775646e-35-0.1995900999548826j)
  (2, 2)        (1.784418769512764e-35+0.11523339793653577j)
  (2, 4)        (-4.370915472751295e-35-0.28226302627159655j)
(J', J) = (2, 1) (sym', sym) = ('A1', 'A2')
   (0, 0)       (5.323729573622488e-66+0.20052055607190464j)
  (1, 0)        (-4.154631792546443e-66+0.25694628736880815j)
  (2, 1)        (3.7644452827118294e-66+0.14178944496574117j)
  (3, 1)        (-2.9377683138428125e-66+0.18168846219919166j)
  (4, 0)        (-2.173403497323291e-66-0.08186217421921826j)
  (4, 2)        (2.173403497323291e-66+0.08186217421921826j)
  (5, 0)        (1.6961213268139004e-66-0.10489788255935242j)
  (5, 2)        (-1.6961213268139004e-66+0.10489788255935242j)
  (6, 1)        (-3.7644452827118294e-66-0.14178944496574117j)
  (7, 1)        (2.9377683138428125e-66-0.18168846219919166j)
  (8, 2)        (-5.323729573622488e-66-0.20052055607190464j)
  (9, 2)        (4.154631792546443e-66-0.25694628736880815j)
(J', J) = (2, 1) (sym', sym) = ('B2', 'B1')
   (0, 0)       (4.3709154727512924e-35-0.28226302627159644j)
  (1, 1)        (3.090703970775644e-35-0.19959009995488253j)
  (2, 0)        (-1.784418769512763e-35+0.11523339793653573j)
  (2, 2)        (1.784418769512763e-35-0.11523339793653573j)
  (3, 1)        (-3.090703970775644e-35+0.19959009995488253j)
  (4, 2)        (-4.3709154727512924e-35+0.28226302627159644j)
(J', J) = (2, 1) (sym', sym) = ('B1', 'B2')
   (0, 0)       (-4.370915472751295e-35+0.28226302627159644j)
  (1, 1)        (-3.090703970775646e-35+0.19959009995488253j)
  (2, 0)        (1.784418769512764e-35-0.11523339793653573j)
  (2, 2)        (-1.784418769512764e-35+0.11523339793653573j)
  (3, 1)        (3.090703970775646e-35-0.19959009995488253j)
  (4, 2)        (4.370915472751295e-35-0.28226302627159644j)
(J', J) = (1, 1) (sym', sym) = ('B2', 'B1')
   (0, 1)       (9.258728549113566e-50-0.25766971106437786j)
  (1, 0)        (9.258728549113566e-50-0.25766971106437786j)
  (1, 2)        (9.258728549113566e-50-0.25766971106437786j)
  (2, 1)        (9.258728549113566e-50-0.25766971106437786j)
(J', J) = (1, 1) (sym', sym) = ('B1', 'B2')
   (0, 1)       (-9.258728549113566e-50+0.25766971106437786j)
  (1, 0)        (-9.258728549113566e-50+0.25766971106437786j)
  (1, 2)        (-9.258728549113566e-50+0.25766971106437786j)
  (2, 1)        (-9.258728549113566e-50+0.25766971106437786j)
(J', J) = (2, 2) (sym', sym) = ('A2', 'A1')
   (0, 2)       (3.97818378697277e-33-0.19151645504095033j)
  (0, 3)        (-3.97818378697277e-33+0.14945919808761246j)
  (1, 0)        (3.978183786972769e-33-0.19151645504095033j)
  (1, 1)        (-3.978183786972769e-33+0.14945919808761243j)
  (1, 4)        (4.87226019054807e-33-0.23455879609850178j)
  (1, 5)        (-4.87226019054807e-33+0.18304938634010295j)
  (2, 2)        (4.87226019054807e-33-0.23455879609850178j)
  (2, 3)        (-4.87226019054807e-33+0.18304938634010295j)
  (2, 6)        (4.87226019054807e-33-0.23455879609850178j)
  (2, 7)        (-4.87226019054807e-33+0.18304938634010295j)
  (3, 4)        (4.87226019054807e-33-0.23455879609850178j)
  (3, 5)        (-4.87226019054807e-33+0.18304938634010295j)
  (3, 8)        (3.978183786972769e-33-0.19151645504095033j)
  (3, 9)        (-3.978183786972769e-33+0.14945919808761243j)
  (4, 6)        (3.97818378697277e-33-0.19151645504095033j)
  (4, 7)        (-3.97818378697277e-33+0.14945919808761246j)
(J', J) = (2, 2) (sym', sym) = ('A1', 'A2')
   (0, 1)       (4.234699198297538e-33+0.19151645504095033j)
  (1, 1)        (-4.234699198297538e-33-0.14945919808761246j)
  (2, 0)        (4.234699198297538e-33+0.1915164550409503j)
  (2, 2)        (5.186426125000984e-33+0.23455879609850175j)
  (3, 0)        (-4.234699198297538e-33-0.14945919808761243j)
  (3, 2)        (-5.186426125000984e-33-0.18304938634010295j)
  (4, 1)        (5.186426125000984e-33+0.23455879609850175j)
  (4, 3)        (5.186426125000984e-33+0.23455879609850175j)
  (5, 1)        (-5.186426125000984e-33-0.18304938634010295j)
  (5, 3)        (-5.186426125000984e-33-0.18304938634010295j)
  (6, 2)        (5.186426125000984e-33+0.23455879609850175j)
  (6, 4)        (4.234699198297538e-33+0.1915164550409503j)
  (7, 2)        (-5.186426125000984e-33-0.18304938634010295j)
  (7, 4)        (-4.234699198297538e-33-0.14945919808761243j)
  (8, 3)        (4.234699198297538e-33+0.19151645504095033j)
  (9, 3)        (-4.234699198297538e-33-0.14945919808761246j)
(J', J) = (2, 2) (sym', sym) = ('B2', 'B1')
   (0, 1)       (-1.9519113634950018e-50-0.12146666666666674j)
  (1, 0)        (-1.9519113634950015e-50-0.12146666666666672j)
  (1, 2)        (-2.390593431851467e-50-0.14876567704503177j)
  (2, 1)        (-2.390593431851467e-50-0.14876567704503177j)
  (2, 3)        (-2.390593431851467e-50-0.14876567704503177j)
  (3, 2)        (-2.390593431851467e-50-0.14876567704503177j)
  (3, 4)        (-1.9519113634950015e-50-0.12146666666666672j)
  (4, 3)        (-1.9519113634950018e-50-0.12146666666666674j)
(J', J) = (2, 2) (sym', sym) = ('B1', 'B2')
   (0, 1)       (1.9519113634950018e-50+0.12146666666666674j)
  (1, 0)        (1.9519113634950015e-50+0.12146666666666672j)
  (1, 2)        (2.390593431851467e-50+0.14876567704503177j)
  (2, 1)        (2.390593431851467e-50+0.14876567704503177j)
  (2, 3)        (2.390593431851467e-50+0.14876567704503177j)
  (3, 2)        (2.390593431851467e-50+0.14876567704503177j)
  (3, 4)        (1.9519113634950015e-50+0.12146666666666672j)
  (4, 3)        (1.9519113634950018e-50+0.12146666666666674j)
(J', J) = (1, 0) (sym', sym) = ('A2', 'A1')
   (0, 0)       0.29753135409006326j
  (2, 0)        -0.29753135409006326j

By default, the output matrix (or matrix blocks when form="block") is a scipy.sparse.spmatrix sparse object, which you can convert to a dense array using the standard toarray() method. You can also directly get the dense matrix representation from tomat by specifying repres="dense" keyword

[10]:
# 2D matrix form
mu_x = dip.tomat(form="full", cart="x") # sparse matrix
mu_x2 = dip.tomat(form="full", repres="dense", cart="x") # dense matrix

# compare two results for 2D matrix form
print("2D, sparse == dense ?:", np.allclose(mu_x.toarray(), mu_x2))

# block form
mu_x = dip.tomat(form="block", cart="x") # blocks are sparse matrices
mu_x2 = dip.tomat(form="block", repres="dense", cart="x") # blocks are dense matrices

# compare two results for block matrix form
for (J1, J2) in mu_x.keys():
    for (sym1, sym2) in mu_x[(J1, J2)].keys():
        mat = mu_x[(J1, J2)][(sym1, sym2)].toarray()
        mat2 = mu_x2[(J1, J2)][(sym1, sym2)]
        print("block", (J1, J2, sym1, sym2), "sparse == dense ?:", np.allclose(mat, mat2))
2D, sparse == dense ?: True
block (0, 1, 'A1', 'A2') sparse == dense ?: True
block (1, 2, 'A2', 'A1') sparse == dense ?: True
block (1, 2, 'B2', 'B1') sparse == dense ?: True
block (1, 2, 'B1', 'B2') sparse == dense ?: True
block (2, 1, 'A1', 'A2') sparse == dense ?: True
block (2, 1, 'B2', 'B1') sparse == dense ?: True
block (2, 1, 'B1', 'B2') sparse == dense ?: True
block (1, 1, 'B2', 'B1') sparse == dense ?: True
block (1, 1, 'B1', 'B2') sparse == dense ?: True
block (2, 2, 'A2', 'A1') sparse == dense ?: True
block (2, 2, 'A1', 'A2') sparse == dense ?: True
block (2, 2, 'B2', 'B1') sparse == dense ?: True
block (2, 2, 'B1', 'B2') sparse == dense ?: True
block (1, 0, 'A2', 'A1') sparse == dense ?: True

You can choose any sparse representation of the tomat output matrix (or matrix blocks when form="block") that is supported by scipy.sparse module

[11]:
mu_x = dip.tomat(form="full", repres="csr_matrix", cart="x") # csr matrix
print("2D, format:", mu_x.getformat())

mu_x = dip.tomat(form="full", repres="csc_matrix", cart="x") # csc matrix
print("2D, format:", mu_x.getformat())

mu_x = dip.tomat(form="full", repres="coo_matrix", cart="x") # coo matrix
print("2D, format:", mu_x.getformat())

mu_x = dip.tomat(form="block", repres="lil_matrix", cart="x") # blocks are lil matrices
for (J1, J2) in mu_x.keys():
    for (sym1, sym2) in mu_x[(J1, J2)].keys():
        print("block", (J1, J2, sym1, sym2), "format:", mu_x[(J1, J2)][(sym1, sym2)].getformat())
2D, format: csr
2D, format: csc
2D, format: coo
block (0, 1, 'A1', 'A2') format: lil
block (1, 2, 'A2', 'A1') format: lil
block (1, 2, 'B2', 'B1') format: lil
block (1, 2, 'B1', 'B2') format: lil
block (2, 1, 'A1', 'A2') format: lil
block (2, 1, 'B2', 'B1') format: lil
block (2, 1, 'B1', 'B2') format: lil
block (1, 1, 'B2', 'B1') format: lil
block (1, 1, 'B1', 'B2') format: lil
block (2, 2, 'A2', 'A1') format: lil
block (2, 2, 'A1', 'A2') format: lil
block (2, 2, 'B2', 'B1') format: lil
block (2, 2, 'B1', 'B2') format: lil
block (1, 0, 'A2', 'A1') format: lil

You can also convert between the 2D and block matrix forms using block_form and full_form methods

[12]:
# generate 2D matrix from `dip`
mu_x_2d = dip.tomat(form="full", repres="csr_matrix", cart="x")

# convert `mu_x_2d` matrix to block form
mu_x_block1 = dip.block_form(mu_x_2d)

# generate block matrix from `dip`
mu_x_block2 = dip.tomat(form="block", repres="csr_matrix", cart="x")

# compare two block matrices
for (J1, J2) in mu_x_block1.keys():
    for (sym1, sym2) in mu_x_block1[(J1, J2)].keys():
        mat = mu_x_block1[(J1, J2)][(sym1, sym2)]
        mat2 = mu_x_block2[(J1, J2)][(sym1, sym2)]
        print("block", (J1, J2, sym1, sym2), "mu_x_block == mu_x_block2 ?:", np.allclose(mat.toarray(), mat2.toarray()))
block (0.0, 1.0, 'A1', 'A2') mu_x_block == mu_x_block2 ?: True
block (1.0, 0.0, 'A2', 'A1') mu_x_block == mu_x_block2 ?: True
block (1.0, 2.0, 'A2', 'A1') mu_x_block == mu_x_block2 ?: True
block (1.0, 2.0, 'B1', 'B2') mu_x_block == mu_x_block2 ?: True
block (1.0, 2.0, 'B2', 'B1') mu_x_block == mu_x_block2 ?: True
block (1.0, 1.0, 'B1', 'B2') mu_x_block == mu_x_block2 ?: True
block (1.0, 1.0, 'B2', 'B1') mu_x_block == mu_x_block2 ?: True
block (2.0, 1.0, 'A1', 'A2') mu_x_block == mu_x_block2 ?: True
block (2.0, 1.0, 'B1', 'B2') mu_x_block == mu_x_block2 ?: True
block (2.0, 1.0, 'B2', 'B1') mu_x_block == mu_x_block2 ?: True
block (2.0, 2.0, 'A1', 'A2') mu_x_block == mu_x_block2 ?: True
block (2.0, 2.0, 'A2', 'A1') mu_x_block == mu_x_block2 ?: True
block (2.0, 2.0, 'B1', 'B2') mu_x_block == mu_x_block2 ?: True
block (2.0, 2.0, 'B2', 'B1') mu_x_block == mu_x_block2 ?: True
[13]:
# generate block matrix from `dip`
mu_x_block = dip.tomat(form="block", repres="csr_matrix", cart="x")

# convert `mu_x_block` to 2D form
mu_x_2d = dip.full_form(mu_x_block)

# generate 2D matrix from `dip`
mu_x_2d_2 = dip.tomat(form="full", repres="csr_matrix", cart="x")

print("mu_x_2d == mu_x_2d_2 ?:", np.allclose(mu_x_2d.toarray(), mu_x_2d_2.toarray()))
mu_x_2d == mu_x_2d_2 ?: True

State assignment

By default, the basis of field-free rotational solutions is spanned by \(J\) ranging from Jmin to Jmax (defined in solve), \(m=-J..J\), \(k=0..J\), and \(\tau=0,1\). (\(\tau\) is rotational parity). The assignment of basis states by symmetric-top functions can be obtained using assign method. In the example below, we print the assignment for the first 20 basis states, the state indexes correspond to the row/column numbers of a matrix returned by tomat(form="full")

[14]:
assign_bra, assign_ket = h0.assign(form="full") # assignment of bra and ket states, i.e. `assign_bra` and `assign_ket` are equivalent in this case
assign = assign_bra

# print assignments for the first 20 states
for i in range(20):
    print(i, "J =", assign["J"][i], ", sym =", assign["sym"][i], ", m =", assign["m"][i], ", k =", assign["k"][i])
0 J = 0.0 , sym = A1 , m = 0 , k = ('0 0 0  1.000000', 0.0)
1 J = 1.0 , sym = A2 , m = -1 , k = ('1 0 1  1.000000', 36.93165361155496)
2 J = 1.0 , sym = A2 , m = 0 , k = ('1 0 1  1.000000', 36.93165361155496)
3 J = 1.0 , sym = A2 , m = 1 , k = ('1 0 1  1.000000', 36.93165361155496)
4 J = 1.0 , sym = B1 , m = -1 , k = ('1 1 0  1.000000', 24.103743154821103)
5 J = 1.0 , sym = B1 , m = 0 , k = ('1 1 0  1.000000', 24.103743154821103)
6 J = 1.0 , sym = B1 , m = 1 , k = ('1 1 0  1.000000', 24.103743154821103)
7 J = 1.0 , sym = B2 , m = -1 , k = ('1 1 1  1.000000', 41.99637168235446)
8 J = 1.0 , sym = B2 , m = 0 , k = ('1 1 1  1.000000', 41.99637168235446)
9 J = 1.0 , sym = B2 , m = 1 , k = ('1 1 1  1.000000', 41.99637168235446)
10 J = 2.0 , sym = A1 , m = -2 , k = ('2 2 0  0.621495', 71.0832845583496)
11 J = 2.0 , sym = A1 , m = -2 , k = ('2 0 0  0.621495', 134.9802523391115)
12 J = 2.0 , sym = A1 , m = -1 , k = ('2 2 0  0.621495', 71.0832845583496)
13 J = 2.0 , sym = A1 , m = -1 , k = ('2 0 0  0.621495', 134.9802523391115)
14 J = 2.0 , sym = A1 , m = 0 , k = ('2 2 0  0.621495', 71.0832845583496)
15 J = 2.0 , sym = A1 , m = 0 , k = ('2 0 0  0.621495', 134.9802523391115)
16 J = 2.0 , sym = A1 , m = 1 , k = ('2 2 0  0.621495', 71.0832845583496)
17 J = 2.0 , sym = A1 , m = 1 , k = ('2 0 0  0.621495', 134.9802523391115)
18 J = 2.0 , sym = A1 , m = 2 , k = ('2 2 0  0.621495', 71.0832845583496)
19 J = 2.0 , sym = A1 , m = 2 , k = ('2 0 0  0.621495', 134.9802523391115)

Here, assign["J"], assign["m"], assign["sym"] contain assignments by ‘good’ quantum numbers \(J\), \(m\), and symmetry, respectively. assign["k"] contains rotational state assignment by its \(J\), \(k\), and \(\tau\) quantum numbers (same as returned by sol[J][sym].assign in the example above) and energy.

The assignments can be casted into a block matrix form (to match the block form returned by tomat(form="block"))

[22]:
assign_bra, assign_ket = h0.assign(form="block") # assignment of bra and ket states, i.e. `assign_bra` and `assign_ket` are equivalent in this case
assign = assign_bra

for J in assign.keys():
    for sym in assign[J].keys():
        for m, k in zip(assign[J][sym]['m'], assign[J][sym]['k']):
            print("J =", J, ", sym =", sym, ", m =", m, ", k =", k)
J = 0.0 , sym = A1 , m = 0 , k = ('0 0 0  1.000000', 0.0)
J = 1.0 , sym = A2 , m = -1 , k = ('1 0 1  1.000000', 36.93165361155496)
J = 1.0 , sym = A2 , m = 0 , k = ('1 0 1  1.000000', 36.93165361155496)
J = 1.0 , sym = A2 , m = 1 , k = ('1 0 1  1.000000', 36.93165361155496)
J = 1.0 , sym = B1 , m = -1 , k = ('1 1 0  1.000000', 24.103743154821103)
J = 1.0 , sym = B1 , m = 0 , k = ('1 1 0  1.000000', 24.103743154821103)
J = 1.0 , sym = B1 , m = 1 , k = ('1 1 0  1.000000', 24.103743154821103)
J = 1.0 , sym = B2 , m = -1 , k = ('1 1 1  1.000000', 41.99637168235446)
J = 1.0 , sym = B2 , m = 0 , k = ('1 1 1  1.000000', 41.99637168235446)
J = 1.0 , sym = B2 , m = 1 , k = ('1 1 1  1.000000', 41.99637168235446)
J = 2.0 , sym = A1 , m = -2 , k = ('2 2 0  0.621495', 71.0832845583496)
J = 2.0 , sym = A1 , m = -2 , k = ('2 0 0  0.621495', 134.9802523391115)
J = 2.0 , sym = A1 , m = -1 , k = ('2 2 0  0.621495', 71.0832845583496)
J = 2.0 , sym = A1 , m = -1 , k = ('2 0 0  0.621495', 134.9802523391115)
J = 2.0 , sym = A1 , m = 0 , k = ('2 2 0  0.621495', 71.0832845583496)
J = 2.0 , sym = A1 , m = 0 , k = ('2 0 0  0.621495', 134.9802523391115)
J = 2.0 , sym = A1 , m = 1 , k = ('2 2 0  0.621495', 71.0832845583496)
J = 2.0 , sym = A1 , m = 1 , k = ('2 0 0  0.621495', 134.9802523391115)
J = 2.0 , sym = A1 , m = 2 , k = ('2 2 0  0.621495', 71.0832845583496)
J = 2.0 , sym = A1 , m = 2 , k = ('2 0 0  0.621495', 134.9802523391115)
J = 2.0 , sym = A2 , m = -2 , k = ('2 2 1  1.000000', 95.26857606279624)
J = 2.0 , sym = A2 , m = -1 , k = ('2 2 1  1.000000', 95.26857606279624)
J = 2.0 , sym = A2 , m = 0 , k = ('2 2 1  1.000000', 95.26857606279624)
J = 2.0 , sym = A2 , m = 1 , k = ('2 2 1  1.000000', 95.26857606279624)
J = 2.0 , sym = A2 , m = 2 , k = ('2 2 1  1.000000', 95.26857606279624)
J = 2.0 , sym = B1 , m = -2 , k = ('2 1 0  1.000000', 133.7523074329978)
J = 2.0 , sym = B1 , m = -1 , k = ('2 1 0  1.000000', 133.7523074329978)
J = 2.0 , sym = B1 , m = 0 , k = ('2 1 0  1.000000', 133.7523074329978)
J = 2.0 , sym = B1 , m = 1 , k = ('2 1 0  1.000000', 133.7523074329978)
J = 2.0 , sym = B1 , m = 2 , k = ('2 1 0  1.000000', 133.7523074329978)
J = 2.0 , sym = B2 , m = -2 , k = ('2 1 1  1.000000', 80.07442185039771)
J = 2.0 , sym = B2 , m = -1 , k = ('2 1 1  1.000000', 80.07442185039771)
J = 2.0 , sym = B2 , m = 0 , k = ('2 1 1  1.000000', 80.07442185039771)
J = 2.0 , sym = B2 , m = 1 , k = ('2 1 1  1.000000', 80.07442185039771)
J = 2.0 , sym = B2 , m = 2 , k = ('2 1 1  1.000000', 80.07442185039771)

Selecting subspaces of states

[29]:
#TODO
[ ]: