A new program for the simulating and fitting of molecular rotational spectra for
The paper is available here and the pre-print is available here.
Please feel free to direct any questions about the program to westerfit@proton.me
The following is intended to be a quick reference on the input file structure & program usage. A more complete manual will be constructed once the paper is published. The westerfit input file is divided into three sections each with a designated header. The very first line is a title card and the sections are the Control Settings (%CNTRLS), Second Order Parameters (%2NDORDER), and the additional Operators & Parameters (%PARAMS).
Below are control settings, their meanings, and default values::Type
apology (true::Bool): Prints a sincere if awkward apology for the name of the program
RUNmode (ESF::String): Dictates how the program is run by finding characters in string. E calculates & prints energy levels, S calculates & prints transitions, and F performs the optimization. ES will run through the same calculations as S but without printing energy levels. The Fit will run first and then put the new parameters into the ES calculation.
overwrite (true::Bool): Whether or not to overwrite the input file with the new values from the fit. Regardless, the input file will be copied to a back up.
S (0::Float64): Spin value of the internal spin source. This can be either electron or nuclear spin
NFOLD (0::Int): Symmetry-fold of the internal rotor. 0 disables most of the torsional code (I think)
mcalc (8::Int): Determines the size of the torsional basis as 2mcalc+1 for A & E symmetry states and 2mcalc+2 for B symmetry. BELGI uses 10 for the first stage and the equivalent of 4 for the second stage. I've found 5 to work reasonably well without being repulsively slow.
vtmax (0::Int): Largest torsional state output by the code. I think this also impacts what torsional states are used in the fitter. Best to keep with just ground state for now.
Jmax (0.0::Float64): Largest J value in the simulation. The code will automatically adjust if S is a half integer and print a warning.
νmin (0.0::Float64): Lowest frequency in the simulation in GHz. The first character is a nu not a v so be careful
νmax (40.::Float64): Highest frequency in the simulation in GHz. Make sure this is larger than νmin or the code will crash
INTthres (0.0::Float64): Minimum intensity value included in the file
TK (8.0::Float64): Temperature of the simulation in Kelvin
λlm0 (0.0001::Float64): Scale-factor used to determine the inital Levenberg-Marquardt Parameter. This gets multiplied by a function of the rms to determine the LBMQ Parameter used in a given step.
turducken (1::Int): Number of Levenberg-Marquardt steps calculated on single step before recalculated the Jacobian. Doesn't seem worth it given the current performance of the Jacobian but can give an occasional performance boost
goal (1.0::Float64): The value of the weighted RMS that terminates the fit. Intended to prevent fitting past the experimental resolution.
assign (expect::String): Determines how the quantum numbers are assigned after diagonalization. The default, expect, uses the expectation values of
The second order Hamiltonian of westerfit is hardcoded. You can comment out any lines with # but the number of lines must remain fixed in this section. All the parameters default to zero and there are some internal transformations that occur upon initializing the code.
The
The
Lastly are the spin-torsion coupling terms
Caution. The user facing second order terms are not directly used nor fit by the program. The table below shows how the scale values in the 2nd order section are actually treated.
User Facing | Internal | User Facing | Internal |
---|---|---|---|
A | BK |
ϵzz | T⁰₀(ϵ) |
B | BN |
ϵxx | T²₀(ϵ) |
C | B⨦ |
ϵyy | T²₂(ϵ) |
ρz | rz |
ϵzx | T²₁(ϵ) |
ρx | rx |
ϵxz | T¹₁(ϵ) |
These are manual coded in operators that are implemented as the anti-commutator of what the user codes in. These lines can also be commented out but do not remove the lines opening with %. The first column is a name string for the operators. Here are some unicode characters for easier name: Δ, δ, Φ, ϕ, ϵ, χ, ρ, η, μ. The second & third columns are Float64 and are the parameter value and step scale factor, respectively. A scale factor of zero will keep that operator fixed during the optimization. The next 8 columns are Int referring to the powers of the various operators as described in the line beginign that block of the input file. There are no checks of symmetry like in RAM36 so go wild. One could also code in inverse powers but I'm not sure why one would. Let me know if you do and how it helped! The last column is a stage. It is either 0 for intensites of 1 for Hamiltonian operators. Might expand that if I come up with better code structures.
The experimental transitions should be included in the molnam.lne file. This uses a comma delimited format in the following structure:
Ju, Nu, Kau, Kcu, mu, Jl, Nl, Kal, Kcl, ml, freq, unc
These installation instructions are to the best of our knowledge, but both developers run the same Linux distribution. Please send us an email if it's not working! We need to know if we want to fix it.
There are two possible ways to install westerfit on Windows. The first one is running it natively in Windows, and the second is using the Windows Subsystem for Linux. The latter version is more robust, but the first one is likely easier.
- Install Julia.
- Open Julia. Enter
]
to enter package mode. Enteradd Westerfit
. - To use Westerfit, open your Command Line. Navigate to the directory your input "molnam.inp" is in. Enter
julia
. You should see the Julia startup.
using Westerfit
westerfit("molnam")
That should run westerfit!
- Set up Windows Subsystem for Linux with the Ubuntu App.
- Open up Ubuntu and do the set-up process, including setting a username and password (you won't be able to see the password when you type it).
- From here, move to the LINUX instructions.
Useful Windows Notes:
- You can make a folder with the command
mkdir
followed by the name of the folder:mkdir molecule
. Enter the folder with cd and see what's inside it with ls. You can view text files with vim, and exit vim with Esc+:q
. - You can access your normal File Explorer by going to your home directory (
cd ~
) and typingexplorer.exe
. - You may run into issues where your files have the wrong type of linebreaks. To fix this, install dos2unix by typing
sudo apt install dos2unix
and typing in your password. Then, typedos2unix FILENAME
, with your file name inserted. This should fix the problem.
- Install Julia. It is recommended that you do so through juliaup.
- Run the command
julia
to enter a REPL session. Enter]
to enter package mode. Enteradd Westerfit
. - Unfortunately, WIGXJPFjl, a dependency, is often the source of failure. You can try to remedy this by typing
add WIGXJPFjl
in package mode. If that doesn't work, feel free to shoot me an email. I can help you manually set up WIGXJPF as well as an alternative version of the WIGXJPFjl wrapper that should work. - Navigate to a directory in your PATH and create a file named
westerfit
containing the 3 lines below with X replaced by the number of threads you want to run on (more is better, you can also just remove the -tX altogether). You can usewhich julia
to determine your exact path to Julia.
#!/PATH/TO/julia -tX
using Westerfit
westerfit(ARGS[1])
- Run
chmod +x westerfit
to turnwesterfit
into an executeable. - Try running westerfit! Enter
westerfit molnam
and it will run on molnam.inp. Make sure you're in the directory that molnam.inp is in. "molnam" can be replaced with any molecule name.
Enjoy! And feel free to reach out if anything goes wrong or you have any questions!
I don't have any idea whether we will ever need spectroscopy again in 40 years. As for spectroscopy, people who want to do spectroscopy seem to be born that way.... As I describe it, it's just one step in the compulsive/obsessive spectrum before the stage where you're put in an institution for your entire life. And they have that, and they just love this stuff, and you can't get them to stop talking. They're only 25 years old, I mean, they should be drinking beer and doing whatever, they want to talk about this and they love it. So, those people are going to continue to do this, in the backwater universities, not heavily funded, but they are going to preserve the skills, because they can't help themselves. They're born that way.
And they simply don't want to sell cars. They don't want to broad-brush the future of American science. They want to do something that has eight digit numbers and a theory and obs minus calcs, and you're born that way. You can see it in them.
-Jon T. Hougen