56 auto &lineshape = lines[k].lineshape;
59 return Output{lineshape.
G0(T, T0, P, vmrs), lineshape.D0(T, T0, P, vmrs),
60 lineshape.G2(T, T0, P, vmrs), lineshape.D2(T, T0, P, vmrs),
61 lineshape.FVC(T, T0, P, vmrs), lineshape.ETA(T, T0, P, vmrs),
62 lineshape.Y(T, T0, P, vmrs), lineshape.G(T, T0, P, vmrs),
63 lineshape.DV(T, T0, P, vmrs)}
64 .no_linemixing(not DoLineMixing(P));
71 auto &lineshape = lines[k].lineshape[pos];
73 return lineshape.at(T, T0, P).no_linemixing(not DoLineMixing(P));
78 auto &lineshape = lines[k].lineshape;
81 return Output{lineshape.dG0dT(T, T0, P, vmrs), lineshape.dD0dT(T, T0, P, vmrs),
82 lineshape.dG2dT(T, T0, P, vmrs), lineshape.dD2dT(T, T0, P, vmrs),
83 lineshape.dFVCdT(T, T0, P, vmrs), lineshape.dETAdT(T, T0, P, vmrs),
84 lineshape.dYdT(T, T0, P, vmrs), lineshape.dGdT(T, T0, P, vmrs),
85 lineshape.dDVdT(T, T0, P, vmrs)}
91 auto &lineshape = lines[k].lineshape[pos];
93 return lineshape.dT(T, T0, P).no_linemixing(not DoLineMixing(P));
99 if (selfbroadening and spec == quantumidentity.Species()) {
104 const Index s = selfbroadening;
105 const Index e = broadeningspecies.nelem() - bathbroadening;
106 for (
Index i = s; i < e; i++) {
107 if (spec == broadeningspecies[i]) {
113 if (bathbroadening)
return broadeningspecies.nelem() - 1;
122 auto &lineshape = lines[k].lineshape;
124 const Index pos = LineShapePos(vmr_qid.Species());
128 out = lineshape[pos].at(T, T0, P);
129 const Index bath = lineshape.nelem() - 1;
130 if (bathbroadening and pos not_eq bath) {
131 out -= lineshape[bath].at(T, T0, P);
155 if (is.eof())
return data;
167 if (line.
nelem() == 0 && is.eof())
return data;
180 istringstream icecream(line);
185 if (artsid.length() != 0) {
189 isotopologue.is_joker() or
190 isotopologue.type not_eq Species::TagType::Plain,
191 "A line catalog species can only be of the form \"Plain\", meaning it\nhas the form SPECIES-ISONUM.\n"
192 "Your input contains: ",
194 ". which we cannot interpret as a plain species")
236 for (
Index j = 0; j < naux; j++) {
251 }
catch (
const std::runtime_error&) {
255 if (tgam != data.
T0) {
256 agam = agam *
pow(tgam / data.
T0, nair);
257 sgam = sgam *
pow(tgam / data.
T0, nself);
287 if (is.eof())
return data;
299 if (line.
nelem() == 0 && is.eof())
return data;
312 istringstream icecream(line);
317 if (artsid.length() != 0) {
321 isotopologue.is_joker() or
322 isotopologue.type not_eq Species::TagType::Plain,
323 "A line catalog species can only be of the form \"Plain\", meaning it\nhas the form SPECIES-ISONUM.\n"
324 "Your input contains: ",
326 ". which we cannot interpret as a plain species")
370 bool lmd_found =
false;
382 if (is.eof())
return data;
394 if (line.
nelem() == 0 && is.eof())
return data;
407 istringstream icecream(line);
413 if (artsid.length() != 0) {
417 isotopologue.is_joker() or
418 isotopologue.type not_eq Species::TagType::Plain,
419 "A line catalog species can only be of the form \"Plain\", meaning it\nhas the form SPECIES-ISONUM.\n"
420 "Your input contains: ",
422 ". which we cannot interpret as a plain species")
462 }
else if (token ==
"QN") {
467 token !=
"UP",
"Unknown quantum number tag: ", token)
471 while (icecream and token not_eq
"LO") {
472 auto qn = Quantum::Number::toType(token);
488 !is || token !=
"LO",
489 "Error in catalog. Lower quantum number tag 'LO' not found.")
492 auto qn = Quantum::Number::toType(token);
494 not(token ==
"LM" or token ==
"LF" or token ==
"ZM" or
495 token ==
"LSM" or token ==
"PB")) {
509 qn = Quantum::Number::toType(token);
511 }
else if (token ==
"LM") {
515 }
else if (token ==
"LF") {
524 }
else if (token ==
"ZM") {
528 }
else if (token ==
"LSM") {
537 if (token ==
"CUT") {
539 data.
cutoff = CutoffType::ByLine;
543 if (token ==
"LML") {
548 else if (token ==
"MTM") {
553 else if (token ==
"LNT") {
568 }
catch (
const std::runtime_error& e) {
569 ARTS_USER_ERROR(
"Parse error in catalog line: \n", line,
'\n', e.what())
588 data.
species[1] = Species::Species::Bath;
603 if (is.eof())
return data;
615 if (line.
nelem() == 0 && is.eof())
return data;
619 if (line[line.
nelem() - 1] == 13) {
620 line.erase(line.
nelem() - 1, 1);
673 data.
line.
I0 = s * hi2arts;
697 agam = gam * hi2arts;
703 sgam = gam * hi2arts;
706 if (0 == sgam) sgam = agam;
852 data.
species[1] = Species::Species::Bath;
867 if (is.eof())
return data;
879 if (line.
nelem() == 0 && is.eof())
return data;
883 if (line[line.
nelem() - 1] == 13) {
884 line.erase(line.
nelem() - 1, 1);
937 data.
line.
I0 = s * hi2arts;
961 agam = gam * hi2arts;
967 sgam = gam * hi2arts;
970 if (0 == sgam) sgam = agam;
1105 std::stringstream ss;
1107 ss >> upper >> lower;
1123 data.
species[1] = Species::Species::Bath;
1134 bool comment =
true;
1138 if (is.eof())
return data;
1150 if (line.
nelem() == 0 && is.eof())
return data;
1154 if (line[line.
nelem() - 1] == 13) {
1155 line.erase(line.
nelem() - 1, 1);
1209 data.
line.
I0 = s * hi2arts;
1236 agam = gam * hi2arts;
1242 sgam = gam * hi2arts;
1245 if (0 == sgam) sgam = agam;
1371 bool comment =
true;
1375 if (is.eof())
return data;
1382 if (line[0] ==
'>' or line[0] ==
'%')
continue;
1388 if (line.
nelem() == 0 && is.eof())
return data;
1392 if (line[line.
nelem() - 1] == 13) {
1393 line.erase(line.
nelem() - 1, 1);
1442 if (line[6] ==
'D') line[6] =
'E';
1448 data.
line.
I0 = s * hi2arts;
1475 agam = gam * hi2arts;
1481 sgam = gam * hi2arts;
1484 if (0 == sgam) sgam = agam;
1602 if (test == -1 || test == -3)
1735 std::vector<SingleLineExternal>& external_lines,
1736 const std::vector<QuantumNumberType>& localquantas,
1737 const std::vector<QuantumNumberType>& globalquantas) {
1738 std::vector<Lines> lines(0);
1741 while (external_lines.size()) {
1742 auto& sle = external_lines.back();
1745 if (sle.selfbroadening) sle.species.front() = sle.quantumidentity.Species();
1746 if (sle.bathbroadening) sle.species.back() = Species::Species::Bath;
1750 for (
auto qn : globalquantas)
1751 if (sle.quantumidentity.val.has(qn))
1752 global_id.val.set(sle.quantumidentity.val[qn]);
1755 for (
auto qn : localquantas)
1756 if (sle.quantumidentity.val.has(qn))
1757 local_id.
val.
set(sle.quantumidentity.val[qn]);
1760 auto line = sle.line;
1761 line.localquanta = local_id;
1764 auto band = std::find_if(lines.begin(), lines.end(), [&](
const Lines& li) {
1765 return li.MatchWithExternal(sle, global_id);
1767 if (band not_eq lines.end()) {
1768 band->AppendSingleLine(line);
1770 lines.push_back(
Lines(sle.selfbroadening,
1779 sle.linemixinglimit,
1784 external_lines.pop_back();
1792 for (
auto& line : lines.
lines) os << line <<
'\n';
1797 for (
auto& line : lines.
lines) is >> line;
1802 os << line.
F0 <<
' ' << line.
I0 <<
' ' << line.
E0 <<
' ' << line.
glow <<
' '
1803 << line.
gupp <<
' ' << line.
A <<
' ' << line.
zeeman <<
' '
1811 line.
gupp >> line.
A;
1821 std::ostringstream os;
1823 os <<
"\nLines meta-data:\n";
1824 os <<
'\t' <<
"Species identity:\n";
1825 os <<
"\t\tSpecies: " << SpeciesName() <<
'\n';
1826 os <<
"\t\tIdentity: " << quantumidentity <<
'\n';
1828 os <<
'\t' << populationtype2metadatastring(population);
1829 os <<
'\t' << normalizationtype2metadatastring(normalization);
1830 os <<
'\t' << LineShape::shapetype2metadatastring(lineshapetype);
1831 os <<
'\t' << mirroringtype2metadatastring(mirroring);
1832 os <<
'\t' <<
"The reference temperature for all line parameters is " << T0
1834 if (linemixinglimit < 0)
1835 os <<
'\t' <<
"If applicable, there is no line mixing limit.\n";
1837 os <<
'\t' <<
"If applicable, there is a line mixing limit at "
1838 << linemixinglimit <<
" Pa.\n";
1840 if (not NumLines()) {
1841 os <<
"\tNo line data is available.\n";
1843 os <<
"\tThere are " << NumLines() <<
" lines available.\n";
1845 auto& line = lines.front();
1846 os <<
"\tThe front line has:\n";
1848 <<
"f0: " << line.F0 <<
" Hz\n";
1850 <<
"i0: " << line.I0 <<
" m^2/Hz\n";
1852 <<
"e0: " << line.E0 <<
" J\n";
1854 <<
"Lower stat. weight: " << line.glow <<
" [-]\n";
1856 <<
"Upper stat. weight: " << line.gupp <<
" [-]\n";
1858 <<
"A: " << line.A <<
" 1/s\n";
1860 <<
"Zeeman splitting of lower state: " << line.zeeman.gl() <<
" [-]\n";
1862 <<
"Zeeman splitting of upper state: " << line.zeeman.gu() <<
" [-]\n";
1864 <<
"Local quantum numbers: " << line.localquanta.val <<
"\n";
1867 line.lineshape, selfbroadening, broadeningspecies, T0);
1869 <<
"Line shape parameters (are normalized by sum(VMR)):\n";
1870 for (
auto& ls_form : ls_meta) os <<
"\t\t\t" << ls_form <<
"\n";
1877 lines.erase(lines.begin() + i);
1881 auto line = lines[i];
1887 std::reverse(lines.begin(), lines.end());
1891 return quantumidentity.Isotopologue().mass;
1904 const Numeric& bath_mass)
const {
1906 if (bathbroadening and bath_mass > 0) mass[mass.
nelem() - 1] = bath_mass;
1914 "Bad species and vmr lists");
1924 if (not
iseven(Jf + lf + 1))
1925 return -
sqrt(2 * Jf + 1) *
wigner3j(Jf, k, Ji, li, lf - li, -lf);
1926 return +
sqrt(2 * Jf + 1) *
wigner3j(Jf, k, Ji, li, lf - li, -lf);
1933 return -
sqrt(6 * (2 * Jf + 1) * (2 * Ji + 1)) *
1935 return +
sqrt(6 * (2 * Jf + 1) * (2 * Ji + 1)) *
wigner6j(1, 1, 1, Ji, Jf,
N);
1952 bool comment =
true;
1956 if (is.eof())
return data;
1968 if (line.
nelem() == 0 && is.eof())
return data;
2054 tag = tag > 0 ? tag : -tag;
2113 const Index nb = broadeningspecies.nelem();
2116 if (not Isotopologue().OK())
return false;
2119 if (nb < (
Index(selfbroadening) +
Index(bathbroadening)))
return false;
2122 if (T0 <= 0)
return false;
2125 if (std::any_of(lines.cbegin(), lines.cend(), [nb](
auto& line) {
2126 return line.LineShapeElems() != nb;
2131 if (std::any_of(lines.cbegin(), lines.cend(), [&](
auto& line) {
2132 return line.LocalQuantumElems() != lines.front().LocalQuantumElems();
2147 std::ostringstream os;
2149 case CutoffType::None:
2150 os <<
"No cut-off will be applied.\n";
2152 case CutoffType::ByLine:
2153 os <<
"The lines will be cut-off " <<
cutoff
2154 <<
" Hz from the line center + D0.\n";
2156 case CutoffType::FINAL:
2177 LineShape::TemperatureModel::LM_AER,
d[4],
d[5],
d[6],
d[7]};
2179 LineShape::TemperatureModel::LM_AER,
d[8],
d[9],
d[10],
d[11]};
2215 "Error calling appending function, bad size of quantum numbers\n"
2216 "Type of quantum numbers in band: ",
2217 lines.front().localquanta.val,
2218 "\nType of quantum numbers in new line:",
2219 sl.localquanta.val);
2223 sl.LineShapeElems() not_eq
lines[0].LineShapeElems(),
2224 "Error calling appending function, bad size of broadening species");
2226 lines.push_back(std::move(sl));
2236 if (sle.bad)
return false;
2237 if (sle.selfbroadening not_eq selfbroadening)
return false;
2238 if (sle.bathbroadening not_eq bathbroadening)
return false;
2239 if (sle.cutoff not_eq
cutoff)
return false;
2240 if (sle.mirroring not_eq mirroring)
return false;
2241 if (sle.population not_eq population)
return false;
2242 if (sle.normalization not_eq normalization)
return false;
2243 if (sle.lineshapetype not_eq lineshapetype)
return false;
2244 if (sle.T0 not_eq T0)
return false;
2245 if (sle.cutofffreq not_eq cutofffreq)
return false;
2246 if (sle.linemixinglimit not_eq linemixinglimit)
return false;
2247 if (quantumidentity not_eq qid)
return false;
2248 if (not std::equal(sle.species.cbegin(),
2250 broadeningspecies.cbegin(),
2251 broadeningspecies.cend()))
2253 if (NumLines() not_eq 0 and
2254 not lines.front().localquanta.same_types_as(sle.line.localquanta))
2256 if (NumLines() not_eq 0 and
2257 not sle.line.lineshape.Match(lines.front().lineshape).first)
2264 if (l.selfbroadening not_eq selfbroadening)
return {
false,
false};
2265 if (l.bathbroadening not_eq bathbroadening)
return {
false,
false};
2266 if (l.cutoff not_eq
cutoff)
return {
false,
false};
2267 if (l.mirroring not_eq mirroring)
return {
false,
false};
2268 if (l.population not_eq population)
return {
false,
false};
2269 if (l.normalization not_eq normalization)
return {
false,
false};
2270 if (l.lineshapetype not_eq lineshapetype)
return {
false,
false};
2271 if (l.T0 not_eq T0)
return {
false,
false};
2272 if (l.cutofffreq not_eq cutofffreq)
return {
false,
false};
2273 if (l.linemixinglimit not_eq linemixinglimit)
return {
false,
false};
2274 if (l.quantumidentity not_eq quantumidentity)
return {
false,
false};
2275 if (not std::equal(l.broadeningspecies.cbegin(),
2276 l.broadeningspecies.cend(),
2277 broadeningspecies.cbegin(),
2278 broadeningspecies.cend()))
2279 return {
false,
false};
2280 if (NumLines() not_eq 0 and l.NumLines() not_eq 0 and
2281 not lines.front().localquanta.same_types_as(l.lines.front().localquanta))
2282 return {
false,
false};
2283 if (NumLines() not_eq 0 and l.NumLines() not_eq 0) {
2284 if (
auto matchpair =
2285 l.lines.front().lineshape.Match(lines.front().lineshape);
2286 not matchpair.first)
2290 return {
true,
true};
2301 std::sort(
lines.begin(),
2319 return lines.size() ?
lines.front().localquanta.val.nelem() : 0;
2323 return population == PopulationType::ByMakarovFullRelmat or
2324 population == PopulationType::ByRovibLinearDipoleLineMixing;
2328 return linemixinglimit < 0 ? true : linemixinglimit > P;
2332 return qid.Isotopologue() == quantumidentity.Isotopologue() or
2333 (qid.Isotopologue().joker() and
2334 qid.Species() == quantumidentity.Species()) or
2335 std::any_of(broadeningspecies.begin(), broadeningspecies.end(),
2336 [s = qid.Species()](
auto &
a) { return a == s; });
2340 for (
auto &line :
lines) {
2341 for (
auto &shape : line.lineshape.Data()) {
2342 if (shape.Y().type not_eq LineShape::TemperatureModel::None or
2343 shape.G().type not_eq LineShape::TemperatureModel::None or
2344 shape.DV().type not_eq LineShape::TemperatureModel::None) {
2354 std::find(broadeningspecies.cbegin(), broadeningspecies.cend(), spec);
2355 ptr not_eq broadeningspecies.cend())
2356 return std::distance(broadeningspecies.cbegin(), ptr);
2363 qns.val.has(QuantumNumberType::J))
2364 return qns.val.has(QuantumNumberType::F) ? qns.val[QuantumNumberType::F]
2365 : qns.val[QuantumNumberType::J];
2372 auto& val =
get(lines[k].localquanta);
2382 auto& val =
get(lines[k].localquanta);
2383 return lines[k].zeeman.Strength(val.upp(), val.low(), type, i);
2392 auto& val =
get(lines[k].localquanta);
2393 return lines[k].zeeman.Splitting(val.upp(), val.low(), type, i);
2402 std::inner_product(lines.cbegin(),
2407 [](
const auto&
a,
const auto&
b) { return a.F0 * b; });
2408 const Numeric div = wgts.sum();
2415 const Index n = NumLines();
2418 const Numeric ratiopart = QT0 / QT;
2421 for (
Index i = 0; i < n; i++) {
2427 (pop0 * lines[i].F0 *
2429 wgts[i] = pop * dip_squared;
2432 return F_mean(wgts);
2437 case CutoffType::ByLine:
2438 return lines[k].F0 + cutofffreq +
2439 (mirroring == MirroringType::Manual ? -shift : shift);
2440 case CutoffType::None:
2441 return std::numeric_limits<Numeric>::max();
2442 case CutoffType::FINAL:
2445 return std::numeric_limits<Numeric>::max();
2450 case CutoffType::ByLine:
2451 return lines[k].F0 - cutofffreq +
2452 (mirroring == MirroringType::Manual ? -shift : shift);
2453 case CutoffType::None:
2454 return std::numeric_limits<Numeric>::lowest();
2455 case CutoffType::FINAL:
2459 return std::numeric_limits<Numeric>::lowest();
2463 for (
auto& line :
lines) line.read(is);
2468 for (
auto& line :
lines) line.write(os);
2474 for (
auto&
a : lines[k].localquanta.val) qid.
val.
set(
a);
2483 for (
Index j = 0; j < m; j++) {
2486 LineShape::TemperatureModel t = LineShape::TemperatureModel::None;
2487 for (
auto& line :
lines) {
2488 if (
auto& data = line.lineshape[j].Data()[i];
2490 if (t == LineShape::TemperatureModel::None) t = data.type;
2493 "Cannot make a common line shape model for the band as there are multiple non-empty types: ",
2501 for (
auto& line :
lines) {
2502 if (
auto& data = line.lineshape[j].Data()[i]; data.type not_eq t) {
2513 for (
auto& abs_lines : abs_lines_per_species) {
2514 for (
auto& band : abs_lines) {
2515 switch (band.population) {
2516 case Absorption::PopulationType::LTE:
2519 case Absorption::PopulationType::NLTE:
2522 case Absorption::PopulationType::VibTemps:
2525 case Absorption::PopulationType::ByHITRANFullRelmat:
2528 case Absorption::PopulationType::ByHITRANRosenkranzRelmat:
2531 case Absorption::PopulationType::ByMakarovFullRelmat:
2534 case Absorption::PopulationType::ByRovibLinearDipoleLineMixing:
2537 case Absorption::PopulationType::FINAL: {
2546 for (
auto& abs_lines : abs_lines_per_species) {
2547 for (
auto& band : abs_lines) {
2548 switch (band.cutoff) {
2549 case Absorption::CutoffType::None:
2552 case Absorption::CutoffType::ByLine:
2555 case Absorption::CutoffType::FINAL: {
2564 for (
auto& abs_lines : abs_lines_per_species) {
2565 for (
auto& band : abs_lines) {
2566 switch (band.lineshapetype) {
2567 case LineShape::Type::DP:
2570 case LineShape::Type::LP:
2573 case LineShape::Type::VP:
2576 case LineShape::Type::SDVP:
2579 case LineShape::Type::HTP:
2582 case LineShape::Type::SplitLP:
2585 case LineShape::Type::SplitVP:
2588 case LineShape::Type::SplitSDVP:
2591 case LineShape::Type::SplitHTP:
2594 case LineShape::Type::FINAL: {
2603 for (
auto& abs_lines : abs_lines_per_species) {
2604 for (
auto& band : abs_lines) {
2605 switch (band.mirroring) {
2606 case Absorption::MirroringType::None:
2609 case Absorption::MirroringType::Lorentz:
2612 case Absorption::MirroringType::SameAsLineShape:
2615 case Absorption::MirroringType::Manual:
2618 case Absorption::MirroringType::FINAL: {
2627 for (
auto& abs_lines : abs_lines_per_species) {
2628 for (
auto& band : abs_lines) {
2629 switch (band.normalization) {
2630 case Absorption::NormalizationType::None:
2633 case Absorption::NormalizationType::VVH:
2636 case Absorption::NormalizationType::VVW:
2639 case Absorption::NormalizationType::RQ:
2642 case Absorption::NormalizationType::SFS:
2645 case Absorption::NormalizationType::FINAL: {
2653template <
typename T>
2654constexpr std::size_t req_spaces(T my_enum) {
2655 constexpr std::size_t n = []() {
2656 std::size_t longest = 0;
2657 for (
auto& x : Absorption::enumstrs::CutoffTypeNames) {
2658 longest = std::max(x.length(), longest);
2660 for (
auto& x : Absorption::enumstrs::MirroringTypeNames) {
2661 longest = std::max(x.length(), longest);
2663 for (
auto& x : Absorption::enumstrs::NormalizationTypeNames) {
2664 longest = std::max(x.length(), longest);
2666 for (
auto& x : Absorption::enumstrs::PopulationTypeNames) {
2667 longest = std::max(x.length(), longest);
2669 for (
auto& x : LineShape::enumstrs::TypeNames) {
2670 longest = std::max(x.length(), longest);
2674 return n -
toString(my_enum).length();
2677auto spaces(std::size_t n) {
return std::basic_string(n,
' '); }
2682 Absorption::CutoffType x{Absorption::CutoffType::FINAL};
2684 case Absorption::CutoffType::FINAL:
2685 os <<
"Cutoff tag types:\n";
2687 case AbsorptionCutoffType::ByLine:
2688 os <<
" ByLine:" << spaces(req_spaces(AbsorptionCutoffType::ByLine))
2691 case AbsorptionCutoffType::None:
2692 os <<
" None:" << spaces(req_spaces(AbsorptionCutoffType::None))
2701 Absorption::MirroringType x{Absorption::MirroringType::FINAL};
2703 case Absorption::MirroringType::FINAL:
2704 os <<
"Mirroring tag types:\n";
2706 case Absorption::MirroringType::None:
2707 os <<
" None:" << spaces(req_spaces(Absorption::MirroringType::None))
2708 << val.
None <<
'\n';
2710 case Absorption::MirroringType::Lorentz:
2712 << spaces(req_spaces(Absorption::MirroringType::Lorentz))
2715 case Absorption::MirroringType::SameAsLineShape:
2716 os <<
" SameAsLineShape:"
2717 << spaces(req_spaces(Absorption::MirroringType::SameAsLineShape))
2720 case Absorption::MirroringType::Manual:
2722 << spaces(req_spaces(Absorption::MirroringType::Manual)) << val.
Manual;
2730 Absorption::NormalizationType x{Absorption::NormalizationType::FINAL};
2732 case Absorption::NormalizationType::FINAL:
2733 os <<
"Normalization tag types:\n";
2735 case Absorption::NormalizationType::None:
2737 << spaces(req_spaces(Absorption::NormalizationType::None)) << val.
None
2740 case Absorption::NormalizationType::VVH:
2741 os <<
" VVH:" << spaces(req_spaces(Absorption::NormalizationType::VVH))
2744 case Absorption::NormalizationType::VVW:
2745 os <<
" VVW:" << spaces(req_spaces(Absorption::NormalizationType::VVW))
2748 case Absorption::NormalizationType::RQ:
2749 os <<
" RQ:" << spaces(req_spaces(Absorption::NormalizationType::RQ))
2752 case Absorption::NormalizationType::SFS:
2753 os <<
" SFS:" << spaces(req_spaces(Absorption::NormalizationType::SFS))
2762 Absorption::PopulationType x{Absorption::PopulationType::FINAL};
2764 case Absorption::PopulationType::FINAL:
2765 os <<
"Population tag type:\n";
2767 case Absorption::PopulationType::LTE:
2768 os <<
" LTE:" << spaces(req_spaces(Absorption::PopulationType::LTE))
2771 case Absorption::PopulationType::NLTE:
2772 os <<
" NLTE:" << spaces(req_spaces(Absorption::PopulationType::NLTE))
2773 << val.
NLTE <<
'\n';
2775 case Absorption::PopulationType::VibTemps:
2777 << spaces(req_spaces(Absorption::PopulationType::VibTemps))
2780 case Absorption::PopulationType::ByHITRANRosenkranzRelmat:
2781 os <<
" ByHITRANRosenkranzRelmat:"
2782 << spaces(req_spaces(
2783 Absorption::PopulationType::ByHITRANRosenkranzRelmat))
2786 case Absorption::PopulationType::ByHITRANFullRelmat:
2787 os <<
" ByHITRANFullRelmat:"
2788 << spaces(req_spaces(Absorption::PopulationType::ByHITRANFullRelmat))
2791 case Absorption::PopulationType::ByMakarovFullRelmat:
2792 os <<
" ByMakarovFullRelmat:"
2793 << spaces(req_spaces(Absorption::PopulationType::ByMakarovFullRelmat))
2796 case Absorption::PopulationType::ByRovibLinearDipoleLineMixing:
2797 os <<
" ByRovibLinearDipoleLineMixing:"
2798 << spaces(req_spaces(
2799 Absorption::PopulationType::ByRovibLinearDipoleLineMixing))
2810 case LineShapeType::FINAL:
2811 os <<
"Line shape tag type:\n";
2813 case LineShapeType::DP:
2814 os <<
" DP:" << spaces(req_spaces(LineShapeType::DP)) << val.
DP
2817 case LineShapeType::LP:
2818 os <<
" LP:" << spaces(req_spaces(LineShapeType::LP)) << val.
LP
2821 case LineShapeType::VP:
2822 os <<
" VP:" << spaces(req_spaces(LineShapeType::VP)) << val.
VP
2825 case LineShapeType::SDVP:
2826 os <<
" SDVP:" << spaces(req_spaces(LineShapeType::SDVP)) << val.
SDVP
2829 case LineShapeType::HTP:
2830 os <<
" HTP:" << spaces(req_spaces(LineShapeType::HTP)) << val.
HTP
2833 case LineShapeType::SplitLP:
2834 os <<
" SplitLP:" << spaces(req_spaces(LineShapeType::SplitLP)) << val.
SplitLP
2837 case LineShapeType::SplitVP:
2838 os <<
" SplitVP:" << spaces(req_spaces(LineShapeType::SplitVP)) << val.
SplitVP
2841 case LineShapeType::SplitSDVP:
2842 os <<
" SplitSDVP:" << spaces(req_spaces(LineShapeType::SplitSDVP)) << val.
SplitSDVP
2845 case LineShapeType::SplitHTP:
2846 os <<
" SplitHTP:" << spaces(req_spaces(LineShapeType::SplitHTP)) << val.
SplitHTP;
2852 return os <<
"Catalog tag summary:\n " << val.
cutoff <<
"\n "
2864 while (ispec < n and i >= abs_lines_per_species[ispec].nelem()) {
2865 i -= abs_lines_per_species[ispec].
nelem();
2875 abs_lines_per_species.cbegin(),
2876 abs_lines_per_species.cend(),
2877 [](
auto& abs_lines) {
2879 abs_lines.cbegin(), abs_lines.cend(), [](auto& band) {
2880 return band.cutoff not_eq CutoffType::None;
2887 if (quantumidentity.val.has(x)) {
2888 auto& val = quantumidentity.val[x];
2889 return std::max(val.low(), val.upp());
2892 Rational out{std::numeric_limits<Index>::lowest()};
2893 for (
auto& line : lines) {
2895 auto& val = line.localquanta.val[x];
2896 out = std::max(std::max(val.low(), val.upp()), out);
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J).
Declarations required for the calculation of absorption coefficients.
std::ostream & operator<<(std::ostream &os, AbsorptionCutoffTagTypeStatus val)
AbsorptionSpeciesBandIndex flat_index(Index i, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species)
Get a flat index pair for species and band.
Contains the absorption namespace.
Index nelem() const ARTS_NOEXCEPT
A constant view of a Vector.
Index nelem() const noexcept
Returns the number of elements.
Main line shape model class.
void SetLineMixingModel(SingleSpeciesModel x)
Sets the same line mixing model to all species.
bifstream & read(bifstream &bif)
Binary read for Model.
bofstream & write(bofstream &bof) const
Binary write for Model.
const std::vector< SingleSpeciesModel > & Data() const noexcept
The line shape model data.
void set(Value v)
Sets the value if it exists or adds it otherwise.
bool has(Types... ts) const ARTS_NOEXCEPT
Returns whether all the Types are part of the list, the types must be sorted.
Value & add(Type t)
Add for manipulation.
Index nelem() const ARTS_NOEXCEPT
Return number of quantum numbers.
Binary output file stream class.
Binary output file stream class.
Input manipulator class for doubles to enable nan and inf parsing.
Helper macros for debugging.
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
constexpr std::string_view toString(EnergyLevelMapType x) noexcept
constexpr bool good_enum(EnumType x) noexcept
Checks if the enum number is good.
This file contains basic functions to handle ASCII files.
Numeric boltzman_factor(Numeric T, Numeric E0)
Computes exp(- E0/kT)
Numeric boltzman_ratio(const Numeric &T, const Numeric &T0, const Numeric &E0)
Computes exp(E0/c (T - T0) / (T * T0))
Numeric single_partition_function(const Numeric &T, const Species::IsotopeRecord &ir)
Computes the partition function at one temperature.
Constains various line scaling functions.
Contains the line shape namespace.
LineShape::Type LineShapeType
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
void extract(T &x, String &line, std::size_t n)
Extract something from the beginning of a string.
Namespace to contain things required for absorption calculations.
SingleLineExternal ReadFromHitranOnlineStream(istream &is)
Read from HITRAN online.
String cutofftype2metadatastring(CutoffType in, Numeric cutoff)
SingleLineExternal ReadFromJplStream(istream &is)
Read from JPL.
const Quantum::Number::Value & get(const Quantum::Number::LocalState &qns) ARTS_NOEXCEPT
Numeric reduced_rovibrational_dipole(Rational Jf, Rational Ji, Rational lf, Rational li, Rational k=Rational(1))
Compute the reduced rovibrational dipole moment.
SingleLineExternal ReadFromArtscat3Stream(istream &is)
Read from ARTSCAT-3.
Index nelem(const Lines &l)
Number of lines.
SingleLineExternal ReadFromLBLRTMStream(istream &is)
Read from LBLRTM.
std::ostream & operator<<(std::ostream &os, const Absorption::Lines &lines)
std::istream & operator>>(std::istream &is, Lines &lines)
SingleLineExternal ReadFromArtscat5Stream(istream &is)
Read from ARTSCAT-5.
bool any_cutoff(const ArrayOfArrayOfAbsorptionLines &abs_lines_per_species)
Numeric reduced_magnetic_quadrapole(Rational Jf, Rational Ji, Rational N)
Compute the reduced magnetic quadrapole moment.
SingleLineExternal ReadFromHitran2004Stream(istream &is)
Read from newer HITRAN.
SingleLineExternal ReadFromHitran2001Stream(istream &is)
Read from HITRAN before 2004.
SingleLineExternal ReadFromArtscat4Stream(istream &is)
Read from ARTSCAT-4.
std::vector< Lines > split_list_of_external_lines(std::vector< SingleLineExternal > &external_lines, const std::vector< QuantumNumberType > &localquantas={}, const std::vector< QuantumNumberType > &globalquantas={})
Splits a list of lines into proper Lines.
constexpr Numeric doppler_broadening_const_squared
Doppler broadening constant squared [kg/T]^2.
constexpr Numeric k
Boltzmann constant convenience name [J/K].
constexpr Numeric c
Speed of light convenience name [m/s].
constexpr Numeric h
Planck constant convenience name [J s].
constexpr auto atm2pa(auto x) noexcept
Conversion from Atm to Pa.
QuantumIdentifier id_from_lookup(Index mol, char isochar)
Finds the ID of the ARTS species from HITRAN.
Numeric ratio_from_lookup(Index mol, char isochar)
Finds the isotopologue ratio of the species from HITRAN.
QuantumIdentifier id_from_lookup(Index tag)
Finds the ID of the ARTS species from JPL.
Model vector2modellm(Vector x, LegacyLineMixingData::TypeLM type)
LineShape::Model from legacy input vector.
Computations of line shape derived parameters.
Model lblrtm_model(Numeric sgam, Numeric nself, Numeric agam, Numeric nair, Numeric psf, std::array< Numeric, 12 > aer_interp)
constexpr ModelParameters modelparameterGetEmpty(const TemperatureModel t) noexcept
std::istream & from_linefunctiondata(std::istream &data, Type &type, bool &self, bool &bath, Model &m, ArrayOfSpecies &species)
constexpr bool modelparameterEmpty(const ModelParameters mp) noexcept
Model hitran_model(Numeric sgam, Numeric nself, Numeric agam, Numeric nair, Numeric psf)
Vector mass(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const ArrayOfSpecies &lineshape_species, const SpeciesIsotopologueRatios &ir) ARTS_NOEXCEPT
Returns a mass vector for this model's main calculations.
std::istream & from_pressurebroadeningdata(std::istream &data, LineShape::Type &type, bool &self, bool &bath, Model &m, ArrayOfSpecies &species, const QuantumIdentifier &qid)
Legacy reading of old deprecated PressureBroadeningData class.
ArrayOfString ModelMetaDataArray(const LineShape::Model &m, const bool self, const ArrayOfSpecies &sts, const Numeric T0)
String ModelShape2MetaData(const Model &m)
std::istream & from_artscat4(std::istream &is, Type &type, bool &self, bool &bath, Model &m, ArrayOfSpecies &species, const QuantumIdentifier &qid)
std::istream & from_linemixingdata(std::istream &data, Model &lsc)
Legacy reading of old deprecated LineMixingData class.
constexpr Index nVars
Current max number of line shape variables.
Vector vmrs(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const ArrayOfSpecies &lineshape_species) ARTS_NOEXCEPT
Returns a VMR vector for this model's main calculations.
constexpr auto pow2(auto x) noexcept
power of two
constexpr ValueType common_value_type(ValueType a, ValueType b) noexcept
Return a common type between a and b.
ValueList from_hitran(std::string_view upp, std::string_view low)
String update_isot_name(const String &old_name)
Updates the name of the isotopologue based on updates of the isotopologues.
constexpr Index find_species_index(const Species spec, const std::string_view isot) noexcept
constexpr Index nelem(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the number of elements of the polarization type of this transition.
Polarization
Zeeman polarization selection.
Quantum::Number::Type QuantumNumberType
Contains the rational class definition.
Numeric pow(const Rational base, Numeric exp)
Power of.
Numeric sqrt(const Rational r)
Square root.
constexpr bool iseven(const Rational r) noexcept
Returns true if even integer.
AbsorptionCutoffTagTypeStatus(const ArrayOfArrayOfAbsorptionLines &)
AbsorptionLineShapeTagTypeStatus(const ArrayOfArrayOfAbsorptionLines &)
AbsorptionMirroringTagTypeStatus(const ArrayOfArrayOfAbsorptionLines &)
AbsorptionNormalizationTagTypeStatus(const ArrayOfArrayOfAbsorptionLines &)
bool ByHITRANRosenkranzRelmat
bool ByRovibLinearDipoleLineMixing
AbsorptionPopulationTagTypeStatus(const ArrayOfArrayOfAbsorptionLines &)
Helper struct for flat_index.
AbsorptionNormalizationTagTypeStatus normalization
AbsorptionPopulationTagTypeStatus population
AbsorptionLineShapeTagTypeStatus lineshapetype
AbsorptionCutoffTagTypeStatus cutoff
AbsorptionMirroringTagTypeStatus mirroring
void sort_by_einstein()
Sort inner line list by Einstein coefficient.
void sort_by_frequency()
Sort inner line list by frequency.
Index NumBroadeners() const ARTS_NOEXCEPT
Number of broadening species.
SingleLine PopLine(Index) noexcept
Pops a single line.
Index BroadeningSpeciesPosition(Species::Species spec) const noexcept
Position of species if available or -1 else.
PopulationType population
Line population distribution.
Index NumLocalQuanta() const noexcept
Number of broadening species.
void RemoveLine(Index) noexcept
Removes a single line.
Numeric F_mean(Numeric T=0) const noexcept
Mean frequency by weight of line strength.
void SetAutomaticZeeman() noexcept
Set Zeeman effect for all lines that have the correct quantum numbers.
Vector BroadeningSpeciesVMR(const ConstVectorView &, const ArrayOfArrayOfSpeciesTag &) const
Returns the VMRs of the broadening species.
Numeric ZeemanSplitting(size_t k, Zeeman::Polarization type, Index i) const ARTS_NOEXCEPT
Returns the splitting of a Zeeman split line.
Array< SingleLine > lines
A list of individual lines.
Index NumLines() const noexcept
Number of lines.
bofstream & write(bofstream &os) const
Binary write for Lines.
Species::Species Species() const noexcept
Species Enum.
Numeric DopplerConstant(Numeric T) const noexcept
bool OnTheFlyLineMixing() const noexcept
On-the-fly line mixing.
Numeric ZeemanStrength(size_t k, Zeeman::Polarization type, Index i) const ARTS_NOEXCEPT
Returns the strength of a Zeeman split line.
QuantumIdentifier QuantumIdentityOfLine(Index k) const noexcept
bool OK() const ARTS_NOEXCEPT
bifstream & read(bifstream &is)
Binary read for Lines.
bool MatchWithExternal(const SingleLineExternal &sle, const QuantumIdentifier &quantumidentity) const ARTS_NOEXCEPT
Checks if an external line matches this structure.
Species::IsotopeRecord Isotopologue() const noexcept
Isotopologue Index.
String LineShapeMetaData() const noexcept
Meta data for the line shape if it exists.
void MakeLineShapeModelCommon()
Make a common line shape if possible.
String SpeciesName() const noexcept
Species Name.
Index LineShapePos(const Species::Species spec) const ARTS_NOEXCEPT
Position among broadening species or -1.
LineShape::Output ShapeParameters(size_t k, Numeric T, Numeric P, const Vector &vmrs) const ARTS_NOEXCEPT
Line shape parameters.
Index ZeemanCount(size_t k, Zeeman::Polarization type) const ARTS_NOEXCEPT
Returns the number of Zeeman split lines.
Numeric CutoffFreq(size_t k, Numeric shift=0) const noexcept
Returns cutoff frequency or maximum value.
void ReverseLines() noexcept
Reverses the order of the internal lines.
std::pair< bool, bool > Match(const Lines &l) const noexcept
Checks if another line list matches this structure.
void AppendSingleLine(SingleLine &&sl)
Appends a single line to the absorption lines.
ArrayOfSpecies broadeningspecies
A list of broadening species.
Numeric SelfVMR(const ConstVectorView &, const ArrayOfArrayOfSpeciesTag &) const
Returns the VMR of the species.
Numeric CutoffFreqMinus(size_t k, Numeric shift=0) const noexcept
Returns negative cutoff frequency or lowest value.
bool AnyLinemixing() const noexcept
String MetaData() const
Returns a printable statement about the lines.
bool DoLineMixing(Numeric P) const noexcept
Returns if the pressure should do line mixing.
Numeric SpeciesMass() const noexcept
Mass of the molecule.
QuantumIdentifier quantumidentity
Catalog ID.
bool DoVmrDerivative(const QuantumIdentifier &qid) const noexcept
LineShape::Output ShapeParameters_dVMR(size_t k, Numeric T, Numeric P, const QuantumIdentifier &vmr_qid) const ARTS_NOEXCEPT
Line shape parameters vmr derivative.
LineShape::Output ShapeParameters_dT(size_t k, Numeric T, Numeric P, const Vector &vmrs) const ARTS_NOEXCEPT
Line shape parameters temperature derivatives.
Vector BroadeningSpeciesMass(const ConstVectorView &, const ArrayOfArrayOfSpeciesTag &, const SpeciesIsotopologueRatios &, const Numeric &bath_mass=0) const
Returns the mass of the broadening species.
Single line reading output.
QuantumIdentifier quantumidentity
NormalizationType normalization
LineShape::Type lineshapetype
Computations and data for a single absorption line.
Numeric E0
Lower state energy level.
bofstream & write(bofstream &bof) const
Binary write for AbsorptionLines.
bifstream & read(bifstream &bif)
Binary read for AbsorptionLines.
Numeric F0
Central frequency.
Quantum::Number::LocalState localquanta
Local quantum numbers.
LineShape::Model lineshape
Line shape model.
void SetAutomaticZeeman(QuantumIdentifier qid)
Set Zeeman effect by automatic detection.
Zeeman::Model zeeman
Zeeman model.
Numeric A
Einstein spontaneous emission coefficient.
Numeric glow
Lower level statistical weight.
void SetLineMixing2AER(const Vector &d)
Set the line mixing model to AER kind.
Numeric gupp
Upper level statistical weight.
void SetLineMixing2SecondOrderData(const Vector &d)
Set the line mixing model to 2nd order.
Numeric I0
Reference intensity.
Coefficients and temperature model for SingleSpeciesModel.
constexpr Output & no_linemixing(bool do_no_linemixing)
Turns of line mixing if true. Return *this.
A logical struct for global quantum numbers with species identifiers.
Species::Species Species() const noexcept
Species::IsotopeRecord Isotopologue() const noexcept
A logical struct for local quantum numbers.
A complete quantum number value with type information.
constexpr void set(std::string_view s, bool upp)
Set level value.
Implements rational numbers to work with other ARTS types.
Struct containing all information needed about one isotope.
String FullName() const noexcept
Numeric wigner6j(const Rational j1, const Rational j2, const Rational j3, const Rational l1, const Rational l2, const Rational l3)
Wigner 6J symbol.
Numeric wigner3j(const Rational j1, const Rational j2, const Rational j3, const Rational m1, const Rational m2, const Rational m3)
Wigner 3J symbol.
Wigner symbol interactions.