laserkelvin / PySpecTools

Routines for rotational spectroscopy analysis written in Python 3
MIT License
31 stars 5 forks source link

Treatment of axis representations in SPCAT file writing #36

Closed tjbarnum13 closed 2 years ago

tjbarnum13 commented 2 years ago

Currently, in treating asymmetric tops for SPCAT input, the reduction (A vs S) is specified by the presence of Delta_J vs D_J in the YAML containing molecular constants. However, there is no explicit designation of the axis representation (I vs II vs III, r vs l) used in the fit, and the default is to run all asymmetric tops in the IIIl representation. This is dictated by the sign of the third entry on the third line of the .var/.par file: + for Ir, - for IIIl. The ideal situation would be to explicitly designate the axis representation in the molecule YAML file and set that representation for the SPCAT calculation. There are two issues:

  1. SPCAT (to my knowledge) will only run Ir or IIIl.
  2. Some authors, especially in older papers, do not report the representation used in the fit. (not good!)

To address this issue, I suggest:

  1. Explicit inclusion of the representation in the YAML file, and use this flag to correctly choose the Ir or IIIl representation.
  2. For molecules not fit in one of these two representations, use known formulas to translate from the designated axis representation to the SPCAT allowed representations. (See 10.1515/zna-1976-0205 for quartic CD constants.) I do not believe that every transformation has been worked out beyond quartic, so some higher order terms would be neglected.
  3. For unknown axis representations, these molecules could be flagged in the log, and then a best guess made. A possible metric: molecules with Ray's asymmetry parameter >0 assigned to IIIl and <0 assigned to Ir.
laserkelvin commented 2 years ago

I'm for 1. and 3., since they're pretty easily implemented.

Do you want to try implementing it? For 3., pyspectools.units has a kappa function builtin already, which you can use to just use as a best-guess. If the user provides a specific rep. in the YAML, we can have it bypass the guessing.

Since all the simulation parameters are contained as SPCAT attributes, I reckon we can just have a rep keyword argument. The flag you would want to toggle is called quanta in the .var template contained in pyspectools.pypickett.utils.

Looking into the code a bit more, it seems that that value is determined using the __quanta_map__ dictionary class attribute:

https://github.com/laserkelvin/PySpecTools/blob/5fad919a41293c352732ad0b2941acea42a9f26f/pyspectools/pypickett/classes.py#L340

For reference, from the CRIBSHEET:

   Reduction-A, prolate (representation Ir):
  a 1  1 0   ,,,,,,,,,,,,,,,,,,
  Reduction-A, oblate (representation IIIl):
  a 1 -1 0   ,,,,,,,,,,,,,,,,,,
  Reduction-S, prolate (representation Ir):
  s 1  1 0   ,,,,,,,,,,,,,,,,,,
  Reduction-S, oblate (representation IIIl):
  s 1 -1 0   ,,,,,,,,,,,,,,,,,,

I might not have implemented those flags properly then; I'm not sure how linear/symmetric tops are treated w.r.t. the "representation" under the hood. For 3., we can modify around this line:

https://github.com/laserkelvin/PySpecTools/blob/5fad919a41293c352732ad0b2941acea42a9f26f/pyspectools/pypickett/classes.py#L614

laserkelvin commented 2 years ago

Closing this issue, since point two is not really feasible, and probably not in the scope for PySpecTools right now. If anyone else wants to work on building that we can make a new issue.