diff --git a/docs/source/usage/parameters.rst b/docs/source/usage/parameters.rst index 70d7437de..ec87c7a29 100644 --- a/docs/source/usage/parameters.rst +++ b/docs/source/usage/parameters.rst @@ -5,6 +5,11 @@ Parameters: Inputs File This documents how to use ImpactX with an input file (``impactx input_file.in``). +.. note:: + + Input files use the AMReX `ParmParse `__ syntax. + A `parser `__) is used for the right-hand-side of all input parameters that consist of one or more integers or floats, so expressions like ``beam.kin_energy = "2.+1."``, ``beam.lambdaY = beam.lambdaX`` and/or using user-defined constants are accepted. + .. _running-cpp-parameters-particle: diff --git a/examples/achromatic_spectrometer/input_spectrometer.in b/examples/achromatic_spectrometer/input_spectrometer.in index 90a032c75..3acb4113e 100644 --- a/examples/achromatic_spectrometer/input_spectrometer.in +++ b/examples/achromatic_spectrometer/input_spectrometer.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 3.162277660e-6 -beam.lambdaY = 3.162277660e-6 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 3.16227766017e-4 -beam.lambdaPy = 3.16227766017e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-2 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/alignment/input_alignment.in b/examples/alignment/input_alignment.in index 19a5339b5..1ef1cfe05 100644 --- a/examples/alignment/input_alignment.in +++ b/examples/alignment/input_alignment.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 1.16098260008648811e-3 -beam.lambdaY = 1.16098260008648811e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 0.580491300043e-3 -beam.lambdaPy = 0.580491300043e-3 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/apochromatic/input_apochromatic.in b/examples/apochromatic/input_apochromatic.in index dad950167..7a396cbde 100644 --- a/examples/apochromatic/input_apochromatic.in +++ b/examples/apochromatic/input_apochromatic.in @@ -8,11 +8,11 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = gaussian beam.lambdaX = 1.288697604e-6 -beam.lambdaY = 1.288697604e-6 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-6 beam.lambdaPx = 3.965223396e-6 -beam.lambdaPy = 3.965223396e-6 -beam.lambdaPt = 0.01 #1% energy spread +beam.lambdaPy = beam.lambdaPx +beam.lambdaPt = 0.01 # 1% energy spread beam.muxpx = 0.0 beam.muypy = 0.0 beam.mutpt = 0.0 diff --git a/examples/apochromatic/input_apochromatic_pl.in b/examples/apochromatic/input_apochromatic_pl.in index 750166ab2..ef6b3a2a9 100644 --- a/examples/apochromatic/input_apochromatic_pl.in +++ b/examples/apochromatic/input_apochromatic_pl.in @@ -8,11 +8,11 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = gaussian beam.lambdaX = 1.288697604e-6 -beam.lambdaY = 1.288697604e-6 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-6 beam.lambdaPx = 3.965223396e-6 -beam.lambdaPy = 3.965223396e-6 -beam.lambdaPt = 0.01 #1% energy spread +beam.lambdaPy = beam.lambdaPx +beam.lambdaPt = 0.01 # 1% energy spread beam.muxpx = 0.0 beam.muypy = 0.0 beam.mutpt = 0.0 diff --git a/examples/cfbend/input_cfbend.in b/examples/cfbend/input_cfbend.in index b809b89d7..325a557a8 100644 --- a/examples/cfbend/input_cfbend.in +++ b/examples/cfbend/input_cfbend.in @@ -7,12 +7,12 @@ beam.kin_energy = 2.0e3 #2 GeV beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag -beam.lambdaX = 5.0e-6 #5 um -beam.lambdaY = 8.0e-6 #8 um -beam.lambdaT = 0.0599584916 #200 ps -beam.lambdaPx = 2.5543422003e-9 #exn = 50 pm-rad -beam.lambdaPy = 1.5964638752e-9 #eyn = 50 pm-rad -beam.lambdaPt = 9.0e-4 #approximately dE/E +beam.lambdaX = 5.0e-6 # 5 um +beam.lambdaY = 8.0e-6 # 8 um +beam.lambdaT = 0.0599584916 # 200 ps +beam.lambdaPx = 2.5543422003e-9 # exn = 50 pm-rad +beam.lambdaPy = 1.5964638752e-9 # eyn = 50 pm-rad +beam.lambdaPt = 9.0e-4 # approximately dE/E beam.muxpx = 0.0 beam.muypy = 0.0 beam.mutpt = 0.0 diff --git a/examples/cfchannel/input_cfchannel.in b/examples/cfchannel/input_cfchannel.in index c9fcef412..6c6d06705 100644 --- a/examples/cfchannel/input_cfchannel.in +++ b/examples/cfchannel/input_cfchannel.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 1.0e-3 -beam.lambdaY = 1.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 3.369701494258956e-4 beam.lambdaPx = 1.0e-3 -beam.lambdaPy = 1.0e-3 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.9676219145931020e-3 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/cfchannel/input_cfchannel_10nC_fft.in b/examples/cfchannel/input_cfchannel_10nC_fft.in index fea309698..5b93893b9 100644 --- a/examples/cfchannel/input_cfchannel_10nC_fft.in +++ b/examples/cfchannel/input_cfchannel_10nC_fft.in @@ -9,10 +9,10 @@ beam.charge = 1.0e-8 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 1.2154443728379865788e-3 -beam.lambdaY = 1.2154443728379865788e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 4.0956844276541331005e-4 beam.lambdaPx = 8.2274435782286157175e-4 -beam.lambdaPy = 8.2274435782286157175e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.4415943602685364584e-3 diff --git a/examples/cfchannel/input_cfchannel_10nC_mlmg.in b/examples/cfchannel/input_cfchannel_10nC_mlmg.in index ad4ef7400..36d39811c 100644 --- a/examples/cfchannel/input_cfchannel_10nC_mlmg.in +++ b/examples/cfchannel/input_cfchannel_10nC_mlmg.in @@ -9,10 +9,10 @@ beam.charge = 1.0e-8 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 1.2154443728379865788e-3 -beam.lambdaY = 1.2154443728379865788e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 4.0956844276541331005e-4 beam.lambdaPx = 8.2274435782286157175e-4 -beam.lambdaPy = 8.2274435782286157175e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.4415943602685364584e-3 diff --git a/examples/chicane/input_chicane.in b/examples/chicane/input_chicane.in index 430a1e944..c29b0ee33 100644 --- a/examples/chicane/input_chicane.in +++ b/examples/chicane/input_chicane.in @@ -14,7 +14,7 @@ beam.lambdaPx = 1.598353425e-6 beam.lambdaPy = 2.803697378e-6 beam.lambdaPt = 2.000000000e-6 beam.muxpx = 0.933345606203060 -beam.muypy = 0.933345606203060 +beam.muypy = beam.muxpx beam.mutpt = 0.999999961419755 diff --git a/examples/chicane/input_chicane_csr.in b/examples/chicane/input_chicane_csr.in index 43e823d94..103373909 100644 --- a/examples/chicane/input_chicane_csr.in +++ b/examples/chicane/input_chicane_csr.in @@ -14,7 +14,7 @@ beam.lambdaPx = 1.598353425e-6 beam.lambdaPy = 2.803697378e-6 beam.lambdaPt = 2.000000000e-6 beam.muxpx = 0.933345606203060 -beam.muypy = 0.933345606203060 +beam.muypy = beam.muxpx beam.mutpt = 0.999999961419755 diff --git a/examples/compression/input_compression.in b/examples/compression/input_compression.in index d83ff12df..fc52eca68 100644 --- a/examples/compression/input_compression.in +++ b/examples/compression/input_compression.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 0.5e-3 -beam.lambdaY = 0.5e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 5.0e-3 beam.lambdaPx = 1.0e-5 -beam.lambdaPy = 1.0e-5 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 4.0e-6 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/coupled_optics/input_coupled_optics.in b/examples/coupled_optics/input_coupled_optics.in index f0ee840c4..dbe2cd328 100644 --- a/examples/coupled_optics/input_coupled_optics.in +++ b/examples/coupled_optics/input_coupled_optics.in @@ -14,7 +14,7 @@ beam.lambdaPx = 1.598353425e-6 beam.lambdaPy = 2.803697378e-6 beam.lambdaPt = 2.000000000e-6 beam.muxpx = 0.933345606203060 -beam.muypy = 0.933345606203060 +beam.muypy = beam.muxpx beam.mutpt = 0.999999961419755 diff --git a/examples/cyclotron/input_cyclotron.in b/examples/cyclotron/input_cyclotron.in index db5490b21..8ca40b66e 100644 --- a/examples/cyclotron/input_cyclotron.in +++ b/examples/cyclotron/input_cyclotron.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 1.0e-3 -beam.lambdaY = 1.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 0.3 beam.lambdaPx = 2.0e-4 -beam.lambdaPy = 2.0e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-5 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/distgen/input_gaussian_twiss.in b/examples/distgen/input_gaussian_twiss.in index 71884d95d..b0f68d3d3 100644 --- a/examples/distgen/input_gaussian_twiss.in +++ b/examples/distgen/input_gaussian_twiss.in @@ -11,10 +11,10 @@ beam.alphaX = -1.5905003499999992 beam.alphaY = 1.5905003499999992 beam.alphaT = 0.0 beam.betaX = 2.8216194100262637 -beam.betaY = 2.8216194100262637 +beam.betaY = beam.betaX beam.betaT = 0.5 beam.emittX = 2e-09 -beam.emittY = 2e-09 +beam.emittY = beam.emittX beam.emittT = 2e-06 diff --git a/examples/distgen/input_kurth4d.in b/examples/distgen/input_kurth4d.in index e82bbd1f4..e53a4a65e 100644 --- a/examples/distgen/input_kurth4d.in +++ b/examples/distgen/input_kurth4d.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = kurth4d beam.lambdaX = 1.0e-3 -beam.lambdaY = 1.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 1.0e-3 -beam.lambdaPy = 1.0e-3 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/distgen/input_kvdist_twiss.in b/examples/distgen/input_kvdist_twiss.in index aedf9f9a6..8dbce72f7 100644 --- a/examples/distgen/input_kvdist_twiss.in +++ b/examples/distgen/input_kvdist_twiss.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = kvdist_from_twiss beam.alphaX = -1.5905003499999992 -beam.alphaY = 1.5905003499999992 +beam.alphaY = -beam.alphaX beam.alphaT = 0.0 beam.betaX = 2.8216194100262637 -beam.betaY = 2.8216194100262637 +beam.betaY = beam.betaX beam.betaT = 0.5 beam.emittX = 2e-09 -beam.emittY = 2e-09 +beam.emittY = beam.emittX beam.emittT = 2e-06 diff --git a/examples/distgen/input_semigaussian.in b/examples/distgen/input_semigaussian.in index 99ccac82d..734458c6b 100644 --- a/examples/distgen/input_semigaussian.in +++ b/examples/distgen/input_semigaussian.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = gaussian beam.lambdaX = 3.9984884770e-5 -beam.lambdaY = 3.9984884770e-5 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 2.6623538760e-5 -beam.lambdaPy = 2.6623538760e-5 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = -0.846574929020762 -beam.muypy = 0.846574929020762 +beam.muypy = -beam.muxpx beam.mutpt = 0.0 diff --git a/examples/dogleg/input_dogleg.in b/examples/dogleg/input_dogleg.in index 93d80e198..347b7f59b 100644 --- a/examples/dogleg/input_dogleg.in +++ b/examples/dogleg/input_dogleg.in @@ -14,7 +14,7 @@ beam.lambdaPx = 1.598353425e-6 beam.lambdaPy = 2.803697378e-6 beam.lambdaPt = 2.000000000e-6 beam.muxpx = 0.933345606203060 -beam.muypy = 0.933345606203060 +beam.muypy = beam.muxpx beam.mutpt = 0.999999961419755 @@ -29,11 +29,11 @@ sbend1.ds = 0.500194828041958 # projected length 0.5 m, angle 2.77 deg sbend1.rc = -10.3462283686195526 drift1.type = drift -drift1.ds = 5.0058489435 # projected length 5 m +drift1.ds = 5.0058489435 # projected length 5 m sbend2.type = sbend -sbend2.ds = 0.500194828041958 # projected length 0.5 m, angle 2.77 deg -sbend2.rc = 10.3462283686195526 +sbend2.ds = sbend1.ds # projected length 0.5 m, angle 2.77 deg +sbend2.rc = -sbend1.rc drift2.type = drift drift2.ds = 0.5 @@ -45,8 +45,8 @@ dipedge1.g = 0.0 dipedge1.K2 = 0.0 dipedge2.type = dipedge -dipedge2.psi = 0.048345620280243 -dipedge2.rc = 10.3462283686195526 +dipedge2.psi = -dipedge1.psi +dipedge2.rc = -dipedge1.rc dipedge2.g = 0.0 dipedge2.K2 = 0.0 diff --git a/examples/epac2004_benchmarks/input_bithermal.in b/examples/epac2004_benchmarks/input_bithermal.in index 2f540ea88..928b80467 100644 --- a/examples/epac2004_benchmarks/input_bithermal.in +++ b/examples/epac2004_benchmarks/input_bithermal.in @@ -27,8 +27,8 @@ monitor.backend = h5 constf1.type = constf constf1.ds = 10.0 constf1.kx = 6.283185307179586 -constf1.ky = 6.283185307179586 -constf1.kt = 6.283185307179586 +constf1.ky = constf1.kx +constf1.kt = constf1.kx #constf1.nslice = 400 #full resolution constf1.nslice = 50 diff --git a/examples/epac2004_benchmarks/input_fodo_rf_SC.in b/examples/epac2004_benchmarks/input_fodo_rf_SC.in index c6efdb395..6e6cf533f 100644 --- a/examples/epac2004_benchmarks/input_fodo_rf_SC.in +++ b/examples/epac2004_benchmarks/input_fodo_rf_SC.in @@ -37,7 +37,7 @@ fquad.nslice = 6 dquad.type = quad dquad.ds = 0.3 -dquad.k = -2.4669749766168163 +dquad.k = -fquad.k dquad.nslice = 12 gapa1.type = rfcavity diff --git a/examples/epac2004_benchmarks/input_thermal.in b/examples/epac2004_benchmarks/input_thermal.in index 75f158951..d6ba68b6d 100644 --- a/examples/epac2004_benchmarks/input_thermal.in +++ b/examples/epac2004_benchmarks/input_thermal.in @@ -23,8 +23,8 @@ monitor.backend = h5 constf1.type = constf constf1.ds = 10.0 constf1.kx = 6.283185307179586 -constf1.ky = 6.283185307179586 -constf1.kt = 6.283185307179586 +constf1.ky = constf1.kx +constf1.kt = constf1.kx constf1.nslice = 400 #full resolution #constf1.nslice = 50 diff --git a/examples/expanding_beam/input_expanding_fft.in b/examples/expanding_beam/input_expanding_fft.in index 92c6a1df0..9ba39c481 100644 --- a/examples/expanding_beam/input_expanding_fft.in +++ b/examples/expanding_beam/input_expanding_fft.in @@ -8,7 +8,7 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = kurth6d beam.lambdaX = 4.472135955e-4 -beam.lambdaY = 4.472135955e-4 +beam.lambdaY = beam.lambdaX beam.lambdaT = 9.12241869e-7 beam.lambdaPx = 0.0 beam.lambdaPy = 0.0 diff --git a/examples/expanding_beam/input_expanding_mlmg.in b/examples/expanding_beam/input_expanding_mlmg.in index c8ec50a44..a31c6ed97 100644 --- a/examples/expanding_beam/input_expanding_mlmg.in +++ b/examples/expanding_beam/input_expanding_mlmg.in @@ -8,7 +8,7 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = kurth6d beam.lambdaX = 4.472135955e-4 -beam.lambdaY = 4.472135955e-4 +beam.lambdaY = beam.lambdaX beam.lambdaT = 9.12241869e-7 beam.lambdaPx = 0.0 beam.lambdaPy = 0.0 diff --git a/examples/fodo/input_fodo.in b/examples/fodo/input_fodo.in index ab3db1124..bb9076374 100644 --- a/examples/fodo/input_fodo.in +++ b/examples/fodo/input_fodo.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 3.9984884770e-5 -beam.lambdaY = 3.9984884770e-5 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 2.6623538760e-5 -beam.lambdaPy = 2.6623538760e-5 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = -0.846574929020762 -beam.muypy = 0.846574929020762 +beam.muypy = -beam.muxpx beam.mutpt = 0.0 diff --git a/examples/fodo/input_fodo_twiss.in b/examples/fodo/input_fodo_twiss.in index 5e8fcd670..954dc6a5e 100644 --- a/examples/fodo/input_fodo_twiss.in +++ b/examples/fodo/input_fodo_twiss.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag_from_twiss beam.alphaX = -1.5905003499999992 -beam.alphaY = 1.5905003499999992 +beam.alphaY = -beam.alphaX beam.alphaT = 0.0 beam.betaX = 2.8216194100262637 -beam.betaY = 2.8216194100262637 +beam.betaY = beam.betaX beam.betaT = 0.5 beam.emittX = 2e-09 -beam.emittY = 2e-09 +beam.emittY = beam.emittX beam.emittT = 2e-06 diff --git a/examples/fodo_channel/input_fodo.in b/examples/fodo_channel/input_fodo.in index e782be7f8..51f06a275 100644 --- a/examples/fodo_channel/input_fodo.in +++ b/examples/fodo_channel/input_fodo.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag_from_twiss beam.alphaX = -1.5905003499999992 -beam.alphaY = 1.5905003499999992 +beam.alphaY = -beam.alphaX beam.alphaT = 0.0 beam.betaX = 2.8216194100262637 -beam.betaY = 2.8216194100262637 +beam.betaY = beam.betaX beam.betaT = 0.5 beam.emittX = 2e-09 -beam.emittY = 2e-09 +beam.emittY = beam.emittX beam.emittT = 2e-06 diff --git a/examples/fodo_chromatic/input_fodo_chr.in b/examples/fodo_chromatic/input_fodo_chr.in index 06fdda774..373a08e07 100644 --- a/examples/fodo_chromatic/input_fodo_chr.in +++ b/examples/fodo_chromatic/input_fodo_chr.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 3.9984884770e-5 -beam.lambdaY = 3.9984884770e-5 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 2.6623538760e-5 -beam.lambdaPy = 2.6623538760e-5 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = -0.846574929020762 -beam.muypy = 0.846574929020762 +beam.muypy = -beam.muxpx beam.mutpt = 0.0 diff --git a/examples/fodo_tune/input_fodo_tune.in b/examples/fodo_tune/input_fodo_tune.in index 2e17003ea..c35ce3c30 100644 --- a/examples/fodo_tune/input_fodo_tune.in +++ b/examples/fodo_tune/input_fodo_tune.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 3.9984884770e-5 -beam.lambdaY = 3.9984884770e-5 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 2.6623538760e-5 -beam.lambdaPy = 2.6623538760e-5 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = -0.846574929020762 -beam.muypy = 0.846574929020762 +beam.muypy = -beam.muxpx beam.mutpt = 0.0 diff --git a/examples/iota_lens/input_iotalens.in b/examples/iota_lens/input_iotalens.in index f4f5ea2b4..74a4304c6 100644 --- a/examples/iota_lens/input_iotalens.in +++ b/examples/iota_lens/input_iotalens.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 2.0e-3 -beam.lambdaY = 2.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 3.0e-4 -beam.lambdaPy = 3.0e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 0.0 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/iota_lens/input_iotalens_sdep.in b/examples/iota_lens/input_iotalens_sdep.in index 1c9e214e5..7b160dbcb 100644 --- a/examples/iota_lens/input_iotalens_sdep.in +++ b/examples/iota_lens/input_iotalens_sdep.in @@ -8,7 +8,7 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = waterbag #beam.lambdaX = 2.0e-3 -#beam.lambdaY = 2.0e-3 +#beam.lambdaY = beam.lambdaX #beam.lambdaT = 1.0e-3 #beam.lambdaPx = 3.0e-4 #beam.lambdaPy = 3.0e-4 @@ -17,13 +17,13 @@ beam.distribution = waterbag #beam.muypy = 0.0 #beam.mutpt = 0.0 beam.lambdaX = 1.397456296195e-003 -beam.lambdaY = 1.397456296195e-003 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-4 beam.lambdaPx = 1.256184325020e-003 -beam.lambdaPy = 1.256184325020e-003 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 0.0 beam.muxpx = 0.8090169943749474 -beam.muypy = 0.8090169943749474 +beam.muypy = beam.muxpx beam.mutpt = 0.0 diff --git a/examples/kicker/input_kicker.in b/examples/kicker/input_kicker.in index dddf3787d..db2140ae8 100644 --- a/examples/kicker/input_kicker.in +++ b/examples/kicker/input_kicker.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 4.0e-3 -beam.lambdaY = 4.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 3.0e-4 -beam.lambdaPy = 3.0e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/kurth/input_kurth_10nC_periodic.in b/examples/kurth/input_kurth_10nC_periodic.in index 8e3f15bac..20360cea6 100644 --- a/examples/kurth/input_kurth_10nC_periodic.in +++ b/examples/kurth/input_kurth_10nC_periodic.in @@ -2,17 +2,17 @@ # Particle Beam(s) ############################################################################### beam.npart = 10000 -#beam.npart = 100000 #optional for increased precision +#beam.npart = 100000 # optional for increased precision beam.units = static beam.kin_energy = 2.0e3 beam.charge = 1.0e-8 beam.particle = proton beam.distribution = kurth6d beam.lambdaX = 1.46e-3 -beam.lambdaY = 1.46e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 4.9197638312420749e-4 beam.lambdaPx = 6.84931506849e-4 -beam.lambdaPy = 6.84931506849e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0326178944803812e-3 @@ -21,7 +21,7 @@ beam.lambdaPt = 2.0326178944803812e-3 ############################################################################### lattice.elements = monitor drift1 constf1 drift1 monitor lattice.nslice = 20 -#lattice.nslice = 30 #optional for increased precision +#lattice.nslice = 30 # optional for increased precision monitor.type = beam_monitor monitor.backend = h5 diff --git a/examples/kurth/input_kurth_periodic.in b/examples/kurth/input_kurth_periodic.in index 2af0f6a4f..e1f073eee 100644 --- a/examples/kurth/input_kurth_periodic.in +++ b/examples/kurth/input_kurth_periodic.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-8 beam.particle = proton beam.distribution = kurth6d beam.lambdaX = 1.11e-3 -beam.lambdaY = 1.11e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 3.74036839224568e-4 beam.lambdaPx = 9.00900900901e-4 -beam.lambdaPy = 9.00900900901e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.6735334467940146e-3 @@ -29,8 +29,8 @@ drift1.ds = 1.0 constf1.type = constf constf1.ds = 2.0 constf1.kx = 0.7 -constf1.ky = 0.7 -constf1.kt = 0.7 +constf1.ky = constf1.kx +constf1.kt = constf1.kx ############################################################################### diff --git a/examples/linac_segment/input_linac_segment.in b/examples/linac_segment/input_linac_segment.in index 920262c55..3a858ce53 100644 --- a/examples/linac_segment/input_linac_segment.in +++ b/examples/linac_segment/input_linac_segment.in @@ -6,7 +6,7 @@ beam.npart = 10000 beam.units = static beam.kin_energy = 2.1226695 -beam.charge = 2.9824923076852509e-11 #based on I/f +beam.charge = 2.9824923076852509e-11 # based on I/f beam.particle = Hminus beam.distribution = gaussian_from_twiss beam.alphaX = 0.13233244124654187 diff --git a/examples/multipole/input_multipole.in b/examples/multipole/input_multipole.in index 93e452d4e..63eb5641d 100644 --- a/examples/multipole/input_multipole.in +++ b/examples/multipole/input_multipole.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 4.0e-3 -beam.lambdaY = 4.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 3.0e-4 -beam.lambdaPy = 3.0e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = 0.0 beam.muypy = 0.0 @@ -27,17 +27,17 @@ monitor.type = beam_monitor monitor.backend = h5 thin_quadrupole.type = multipole -thin_quadrupole.multipole = 2 //Thin quadrupole +thin_quadrupole.multipole = 2 # Thin quadrupole thin_quadrupole.k_normal = 3.0 thin_quadrupole.k_skew = 0.0 thin_sextupole.type = multipole -thin_sextupole.multipole = 3 //Thin sextupole +thin_sextupole.multipole = 3 # Thin sextupole thin_sextupole.k_normal = 100.0 thin_sextupole.k_skew = -50.0 thin_octupole.type = multipole -thin_octupole.multipole = 4 //Thin octupole +thin_octupole.multipole = 4 # Thin octupole thin_octupole.k_normal = 65.0 thin_octupole.k_skew = 6.0 diff --git a/examples/positron_channel/input_positron.in b/examples/positron_channel/input_positron.in index c552ca0c7..ba7b52703 100644 --- a/examples/positron_channel/input_positron.in +++ b/examples/positron_channel/input_positron.in @@ -8,10 +8,10 @@ beam.charge = 190.0e-12 beam.particle = positron beam.distribution = triangle beam.lambdaX = 5.054566450e-6 -beam.lambdaY = 5.054566450e-6 +beam.lambdaY = beam.lambdaX beam.lambdaT = 8.43732950e-7 beam.lambdaPx = 1.01091329e-7 -beam.lambdaPy = 1.01091329e-7 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 1.0e-2 beam.muxpx = 0.0 beam.muypy = 0.0 diff --git a/examples/quadrupole_softedge/input_quadrupole_softedge.in b/examples/quadrupole_softedge/input_quadrupole_softedge.in index b3fc60891..017857aa6 100644 --- a/examples/quadrupole_softedge/input_quadrupole_softedge.in +++ b/examples/quadrupole_softedge/input_quadrupole_softedge.in @@ -8,13 +8,13 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 3.9984884770e-5 -beam.lambdaY = 3.9984884770e-5 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 2.6623538760e-5 -beam.lambdaPy = 2.6623538760e-5 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 beam.muxpx = -0.846574929020762 -beam.muypy = 0.846574929020762 +beam.muypy = -beam.muxpx beam.mutpt = 0.0 diff --git a/examples/rotation/input_rotation.in b/examples/rotation/input_rotation.in index b8a786b2f..ec5e01cc1 100644 --- a/examples/rotation/input_rotation.in +++ b/examples/rotation/input_rotation.in @@ -8,10 +8,10 @@ beam.charge = 1.0e-9 beam.particle = electron beam.distribution = waterbag beam.lambdaX = 4.0e-3 -beam.lambdaY = 4.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 1.0e-3 beam.lambdaPx = 3.0e-4 -beam.lambdaPy = 3.0e-4 +beam.lambdaPy = beam.lambdaPx beam.lambdaPt = 2.0e-3 diff --git a/examples/thin_dipole/input_thin_dipole.in b/examples/thin_dipole/input_thin_dipole.in index e78934484..7d393085e 100644 --- a/examples/thin_dipole/input_thin_dipole.in +++ b/examples/thin_dipole/input_thin_dipole.in @@ -8,11 +8,11 @@ beam.charge = 1.0e-9 beam.particle = proton beam.distribution = waterbag beam.lambdaX = 1.0e-3 -beam.lambdaY = 1.0e-3 +beam.lambdaY = beam.lambdaX beam.lambdaT = 0.3 beam.lambdaPx = 2.0e-4 -beam.lambdaPy = 2.0e-4 -beam.lambdaPt = 2.0e-4 +beam.lambdaPy = beam.lambdaPx +beam.lambdaPt = beam.lambdaPx beam.muxpx = 0.0 beam.muypy = 0.0 beam.mutpt = 0.0 diff --git a/src/ImpactX.cpp b/src/ImpactX.cpp index bc71e0de1..fdb56123c 100644 --- a/src/ImpactX.cpp +++ b/src/ImpactX.cpp @@ -105,7 +105,7 @@ namespace impactx { // verbosity amrex::ParmParse pp_impactx("impactx"); int verbose = 1; - pp_impactx.queryAdd("verbose", verbose); + pp_impactx.queryAddWithParser("verbose", verbose); if (verbose > 0) { std::cout << "\nGrids Summary:\n"; @@ -133,7 +133,7 @@ namespace impactx { // verbosity amrex::ParmParse pp_impactx("impactx"); int verbose = 1; - pp_impactx.queryAdd("verbose", verbose); + pp_impactx.queryAddWithParser("verbose", verbose); // a global step for diagnostics including space charge slice steps in elements // before we start the evolve loop, we are in "step 0" (initial state) @@ -152,7 +152,7 @@ namespace impactx { int file_min_digits = 6; if (diag_enable) { - pp_diag.queryAdd("file_min_digits", file_min_digits); + pp_diag.queryAddWithParser("file_min_digits", file_min_digits); // print initial reference particle to file diagnostics::DiagnosticOutput(*amr_data->m_particle_container, @@ -182,7 +182,7 @@ namespace impactx { // periods through the lattice int num_periods = 1; - amrex::ParmParse("lattice").queryAdd("periods", num_periods); + amrex::ParmParse("lattice").queryAddWithParser("periods", num_periods); for (int period=0; period < num_periods; ++period) { // loop over all beamline elements diff --git a/src/initialization/InitAmrCore.cpp b/src/initialization/InitAmrCore.cpp index 9e992b859..50d2c88bf 100644 --- a/src/initialization/InitAmrCore.cpp +++ b/src/initialization/InitAmrCore.cpp @@ -99,7 +99,7 @@ namespace details // Mesh-refinement int max_level = 0; - pp_amr.query("max_level", max_level); + pp_amr.queryWithParser("max_level", max_level); // amrex::AmrMesh::InitAmrMesh will query amr.ref_ratio or amr.ref_ratio_vect on its own amrex::Vector const & ref_ratios = amrex::Vector(); @@ -144,7 +144,7 @@ namespace details // Mesh-refinement int max_level = 0; - pp_amr.query("max_level", max_level); + pp_amr.queryWithParser("max_level", max_level); // amrex::AmrMesh::InitAmrMesh will query amr.ref_ratio or amr.ref_ratio_vect on its own amrex::Vector const & ref_ratios = amrex::Vector(); diff --git a/src/initialization/InitDistribution.cpp b/src/initialization/InitDistribution.cpp index 97806f752..18f50acad 100644 --- a/src/initialization/InitDistribution.cpp +++ b/src/initialization/InitDistribution.cpp @@ -194,15 +194,15 @@ namespace impactx amrex::ParticleReal alphax = 0.0, alphay = 0.0, alphat = 0.0; // Reading the input Twiss parameters - pp_dist.query("alphaX", alphax); - pp_dist.query("alphaY", alphay); - pp_dist.query("alphaT", alphat); - pp_dist.get("betaX", betax); - pp_dist.get("betaY", betay); - pp_dist.get("betaT", betat); - pp_dist.get("emittX", emittx); - pp_dist.get("emittY", emitty); - pp_dist.get("emittT", emittt); + pp_dist.queryWithParser("alphaX", alphax); + pp_dist.queryWithParser("alphaY", alphay); + pp_dist.queryWithParser("alphaT", alphat); + pp_dist.getWithParser("betaX", betax); + pp_dist.getWithParser("betaY", betay); + pp_dist.getWithParser("betaT", betat); + pp_dist.getWithParser("emittX", emittx); + pp_dist.getWithParser("emittY", emitty); + pp_dist.getWithParser("emittT", emittt); if (betax <= 0.0_prt || betay <= 0.0_prt || betat <= 0.0_prt) { throw std::runtime_error("Input Error: The beta function values need to be non-zero positive values in all dimensions."); @@ -251,15 +251,15 @@ namespace impactx amrex::ParticleReal& muxpx, amrex::ParticleReal& muypy, amrex::ParticleReal& mutpt ) { - pp_dist.get("lambdaX", sigx); - pp_dist.get("lambdaY", sigy); - pp_dist.get("lambdaT", sigt); - pp_dist.get("lambdaPx", sigpx); - pp_dist.get("lambdaPy", sigpy); - pp_dist.get("lambdaPt", sigpt); - pp_dist.query("muxpx", muxpx); - pp_dist.query("muypy", muypy); - pp_dist.query("mutpt", mutpt); + pp_dist.getWithParser("lambdaX", sigx); + pp_dist.getWithParser("lambdaY", sigy); + pp_dist.getWithParser("lambdaT", sigt); + pp_dist.getWithParser("lambdaPx", sigpx); + pp_dist.getWithParser("lambdaPy", sigpy); + pp_dist.getWithParser("lambdaPt", sigpt); + pp_dist.queryWithParser("muxpx", muxpx); + pp_dist.queryWithParser("muypy", muypy); + pp_dist.queryWithParser("mutpt", mutpt); } void ImpactX::initBeamDistributionFromInputs () @@ -272,10 +272,10 @@ namespace impactx amrex::ParmParse const pp_dist("beam"); amrex::ParticleReal kin_energy = 0.0; // Beam kinetic energy (MeV) - pp_dist.get("kin_energy", kin_energy); + pp_dist.getWithParser("kin_energy", kin_energy); amrex::ParticleReal bunch_charge = 0.0; // Bunch charge (C) - pp_dist.get("charge", bunch_charge); + pp_dist.getWithParser("charge", bunch_charge); std::string particle_type; // Particle type pp_dist.get("particle", particle_type); @@ -310,7 +310,7 @@ namespace impactx .set_charge_qe(qe).set_mass_MeV(massE).set_kin_energy_MeV(kin_energy); int npart = 1; // Number of simulation particles - pp_dist.get("npart", npart); + pp_dist.getWithParser("npart", npart); std::string unit_type; // System of units pp_dist.get("units", unit_type); @@ -415,14 +415,14 @@ namespace impactx } else if (distribution_type == "thermal") { amrex::ParticleReal k, kT, kT_halo, normalize, normalize_halo; amrex::ParticleReal halo = 0.0; - pp_dist.get("k", k); - pp_dist.get("kT", kT); + pp_dist.getWithParser("k", k); + pp_dist.getWithParser("kT", kT); kT_halo = kT; - pp_dist.get("normalize", normalize); + pp_dist.getWithParser("normalize", normalize); normalize_halo = normalize; - pp_dist.query("kT_halo", kT_halo); - pp_dist.query("normalize_halo", normalize_halo); - pp_dist.query("halo", halo); + pp_dist.queryWithParser("kT_halo", kT_halo); + pp_dist.queryWithParser("normalize_halo", normalize_halo); + pp_dist.queryWithParser("halo", halo); distribution::KnownDistributions thermal(distribution::Thermal(k, kT, kT_halo, normalize, normalize_halo, halo)); diff --git a/src/initialization/InitElement.cpp b/src/initialization/InitElement.cpp index 932ecdc3d..da4c24c35 100644 --- a/src/initialization/InitElement.cpp +++ b/src/initialization/InitElement.cpp @@ -64,8 +64,8 @@ namespace detail { amrex::ParticleReal ds; int nslice = nslice_default; - pp_element.get("ds", ds); - pp_element.queryAdd("nslice", nslice); + pp_element.getWithParser("ds", ds); + pp_element.queryAddWithParser("nslice", nslice); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(nslice > 0, pp_element.getPrefix() + ".nslice must be > 0."); @@ -84,9 +84,9 @@ namespace detail amrex::ParticleReal dx = 0; amrex::ParticleReal dy = 0; amrex::ParticleReal rotation_degree = 0; - pp_element.query("dx", dx); - pp_element.query("dy", dy); - pp_element.query("rotation", rotation_degree); + pp_element.queryWithParser("dx", dx); + pp_element.queryWithParser("dy", dy); + pp_element.queryWithParser("rotation", rotation_degree); std::map values = { {"dx", dx}, @@ -124,7 +124,7 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal k; - pp_element.get("k", k); + pp_element.getWithParser("k", k); m_lattice.emplace_back( Quad(ds, k, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "drift") @@ -139,7 +139,7 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal rc; - pp_element.get("rc", rc); + pp_element.getWithParser("rc", rc); m_lattice.emplace_back( Sbend(ds, rc, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "cfbend") @@ -148,8 +148,8 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal rc, k; - pp_element.get("rc", rc); - pp_element.get("k", k); + pp_element.getWithParser("rc", rc); + pp_element.getWithParser("k", k); m_lattice.emplace_back( CFbend(ds, rc, k, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "dipedge") @@ -157,10 +157,10 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal psi, rc, g, K2; - pp_element.get("psi", psi); - pp_element.get("rc", rc); - pp_element.get("g", g); - pp_element.get("K2", K2); + pp_element.getWithParser("psi", psi); + pp_element.getWithParser("rc", rc); + pp_element.getWithParser("g", g); + pp_element.getWithParser("K2", K2); m_lattice.emplace_back( DipEdge(psi, rc, g, K2, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "constf") @@ -169,9 +169,9 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::Real kx, ky, kt; - pp_element.get("kx", kx); - pp_element.get("ky", ky); - pp_element.get("kt", kt); + pp_element.getWithParser("kx", kx); + pp_element.getWithParser("ky", ky); + pp_element.getWithParser("kt", kt); m_lattice.emplace_back( ConstF(ds, kx, ky, kt, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "buncher") @@ -179,8 +179,8 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal V, k; - pp_element.get("V", V); - pp_element.get("k", k); + pp_element.getWithParser("V", V); + pp_element.getWithParser("k", k); m_lattice.emplace_back( Buncher(V, k, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "shortrf") @@ -189,9 +189,9 @@ namespace detail amrex::ParticleReal V, freq; amrex::ParticleReal phase = -90.0; - pp_element.get("V", V); - pp_element.get("freq", freq); - pp_element.queryAdd("phase", phase); + pp_element.getWithParser("V", V); + pp_element.getWithParser("freq", freq); + pp_element.queryAddWithParser("phase", phase); m_lattice.emplace_back( ShortRF(V, freq, phase, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "multipole") @@ -200,9 +200,9 @@ namespace detail int m; amrex::ParticleReal k_normal, k_skew; - pp_element.get("multipole", m); - pp_element.get("k_normal", k_normal); - pp_element.get("k_skew", k_skew); + pp_element.getWithParser("multipole", m); + pp_element.getWithParser("k_normal", k_normal); + pp_element.getWithParser("k_skew", k_skew); m_lattice.emplace_back( Multipole(m, k_normal, k_skew, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "nonlinear_lens") @@ -210,8 +210,8 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal knll, cnll; - pp_element.get("knll", knll); - pp_element.get("cnll", cnll); + pp_element.getWithParser("knll", knll); + pp_element.getWithParser("cnll", cnll); m_lattice.emplace_back( NonlinearLens(knll, cnll, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "rfcavity") @@ -224,10 +224,10 @@ namespace detail RF_field_data const ez; std::vector cos_coef = ez.default_cos_coef; std::vector sin_coef = ez.default_sin_coef; - pp_element.get("escale", escale); - pp_element.get("freq", freq); - pp_element.get("phase", phase); - pp_element.queryAdd("mapsteps", mapsteps); + pp_element.getWithParser("escale", escale); + pp_element.getWithParser("freq", freq); + pp_element.getWithParser("phase", phase); + pp_element.queryAddWithParser("mapsteps", mapsteps); detail::queryAddResize(pp_element, "cos_coefficients", cos_coef); detail::queryAddResize(pp_element, "sin_coefficients", sin_coef); @@ -238,14 +238,14 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal ks; - pp_element.get("ks", ks); + pp_element.getWithParser("ks", ks); m_lattice.emplace_back( Sol(ds, ks, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "prot") { amrex::ParticleReal phi_in, phi_out; - pp_element.get("phi_in", phi_in); - pp_element.get("phi_out", phi_out); + pp_element.getWithParser("phi_in", phi_in); + pp_element.getWithParser("phi_out", phi_out); m_lattice.emplace_back( PRot(phi_in, phi_out, element_name) ); } else if (element_type == "plane_xyrotation") @@ -253,7 +253,7 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal phi; - pp_element.get("angle", phi); + pp_element.getWithParser("angle", phi); m_lattice.emplace_back( PlaneXYRot(phi, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "solenoid_softedge") @@ -267,9 +267,9 @@ namespace detail Sol_field_data const bz; std::vector cos_coef = bz.default_cos_coef; std::vector sin_coef = bz.default_sin_coef; - pp_element.get("bscale", bscale); - pp_element.queryAdd("units", units); - pp_element.queryAdd("mapsteps", mapsteps); + pp_element.getWithParser("bscale", bscale); + pp_element.queryAddWithParser("units", units); + pp_element.queryAddWithParser("mapsteps", mapsteps); detail::queryAddResize(pp_element, "cos_coefficients", cos_coef); detail::queryAddResize(pp_element, "sin_coefficients", sin_coef); @@ -284,8 +284,8 @@ namespace detail Quad_field_data const gz; std::vector cos_coef = gz.default_cos_coef; std::vector sin_coef = gz.default_sin_coef; - pp_element.get("gscale", gscale); - pp_element.queryAdd("mapsteps", mapsteps); + pp_element.getWithParser("gscale", gscale); + pp_element.queryAddWithParser("mapsteps", mapsteps); detail::queryAddResize(pp_element, "cos_coefficients", cos_coef); detail::queryAddResize(pp_element, "sin_coefficients", sin_coef); @@ -303,8 +303,8 @@ namespace detail amrex::ParticleReal k; int units = 0; - pp_element.get("k", k); - pp_element.queryAdd("units", units); + pp_element.getWithParser("k", k); + pp_element.queryAddWithParser("units", units); m_lattice.emplace_back( ChrQuad(ds, k, units, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "plasma_lens_chromatic") @@ -314,8 +314,8 @@ namespace detail amrex::ParticleReal k; int units = 0; - pp_element.get("k", k); - pp_element.queryAdd("units", units); + pp_element.getWithParser("k", k); + pp_element.queryAddWithParser("units", units); m_lattice.emplace_back( ChrPlasmaLens(ds, k, units, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "tapered_plasma_lens") @@ -325,9 +325,9 @@ namespace detail amrex::ParticleReal k; amrex::ParticleReal taper; int units = 0; - pp_element.get("k", k); - pp_element.get("taper", taper); - pp_element.queryAdd("units", units); + pp_element.getWithParser("k", k); + pp_element.getWithParser("taper", taper); + pp_element.queryAddWithParser("units", units); m_lattice.emplace_back( TaperedPL(k, taper, units, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "drift_exact") @@ -343,8 +343,8 @@ namespace detail amrex::ParticleReal phi; amrex::ParticleReal B = 0.0; - pp_element.get("phi", phi); - pp_element.queryAdd("B", B); + pp_element.getWithParser("phi", phi); + pp_element.queryAddWithParser("B", B); m_lattice.emplace_back( ExactSbend(ds, phi, B, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "uniform_acc_chromatic") @@ -353,8 +353,8 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal ez, bz; - pp_element.get("ez", ez); - pp_element.get("bz", bz); + pp_element.getWithParser("ez", ez); + pp_element.getWithParser("bz", bz); m_lattice.emplace_back( ChrAcc(ds, ez, bz, a["dx"], a["dy"], a["rotation_degree"], nslice, element_name) ); } else if (element_type == "thin_dipole") @@ -362,8 +362,8 @@ namespace detail auto a = detail::query_alignment(pp_element); amrex::ParticleReal theta, rc; - pp_element.get("theta", theta); - pp_element.get("rc", rc); + pp_element.getWithParser("theta", theta); + pp_element.getWithParser("rc", rc); m_lattice.emplace_back( ThinDipole(theta, rc, a["dx"], a["dy"], a["rotation_degree"], element_name) ); } else if (element_type == "kicker") @@ -372,8 +372,8 @@ namespace detail amrex::ParticleReal xkick, ykick; std::string units_str = "dimensionless"; - pp_element.get("xkick", xkick); - pp_element.get("ykick", ykick); + pp_element.getWithParser("xkick", xkick); + pp_element.getWithParser("ykick", ykick); pp_element.queryAdd("units", units_str); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(units_str == "dimensionless" || units_str == "T-m", element_name + ".units must be \"dimensionless\" or \"T-m\""); @@ -391,10 +391,10 @@ namespace detail amrex::ParticleReal repeat_y = 0.0; std::string shape_str = "rectangular"; std::string action_str = "transmit"; - pp_element.get("xmax", xmax); - pp_element.get("ymax", ymax); - pp_element.queryAdd("repeat_x", repeat_x); - pp_element.queryAdd("repeat_y", repeat_y); + pp_element.getWithParser("xmax", xmax); + pp_element.getWithParser("ymax", ymax); + pp_element.queryAddWithParser("repeat_x", repeat_x); + pp_element.queryAddWithParser("repeat_y", repeat_y); pp_element.queryAdd("shape", shape_str); pp_element.queryAdd("action", action_str); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(shape_str == "rectangular" || shape_str == "elliptical", @@ -418,7 +418,7 @@ namespace detail std::string openpmd_encoding{"g"}; pp_element.queryAdd("encoding", openpmd_encoding); int period_sample_intervals = 1; - pp_element.queryAdd("period_sample_intervals", period_sample_intervals); + pp_element.queryAddWithParser("period_sample_intervals", period_sample_intervals); // optional: add and calculate additional particle properties // property: nonlinear lens invariants @@ -427,13 +427,13 @@ namespace detail if (add_nll_invariants) { amrex::ParticleReal alpha = 0.0; - pp_element.queryAdd("alpha", alpha); + pp_element.queryAddWithParser("alpha", alpha); amrex::ParticleReal beta = 1.0; - pp_element.queryAdd("beta", beta); + pp_element.queryAddWithParser("beta", beta); amrex::ParticleReal tn = 0.4; - pp_element.queryAdd("tn", tn); + pp_element.queryAddWithParser("tn", tn); amrex::ParticleReal cn = 0.01; - pp_element.queryAdd("cn", cn); + pp_element.queryAddWithParser("cn", cn); } m_lattice.emplace_back(diagnostics::BeamMonitor(openpmd_name, openpmd_backend, openpmd_encoding, period_sample_intervals)); @@ -446,7 +446,7 @@ namespace detail bool reverse = false; pp_sub_lattice.queryAdd("reverse", reverse); int repeat = 1; - pp_sub_lattice.queryAdd("repeat", repeat); + pp_sub_lattice.queryAddWithParser("repeat", repeat); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(repeat >= 1, element_name + ".repeat must be >= 1"); @@ -492,7 +492,7 @@ namespace detail // periods through the lattice int periods = 1; - pp_lattice.queryAdd("periods", periods); + pp_lattice.queryAddWithParser("periods", periods); AMREX_ALWAYS_ASSERT_WITH_MESSAGE(periods >= 1, "lattice.periods must be >= 1"); @@ -508,7 +508,7 @@ namespace detail // Default number of slices per element int nslice_default = 1; - pp_lattice.query("nslice", nslice_default); + pp_lattice.queryWithParser("nslice", nslice_default); // Default number of map integration steps per slice int const mapsteps_default = 10; // used only in RF cavity diff --git a/src/initialization/InitMeshRefinement.H b/src/initialization/InitMeshRefinement.H index 72065d74f..a8b1be634 100644 --- a/src/initialization/InitMeshRefinement.H +++ b/src/initialization/InitMeshRefinement.H @@ -39,7 +39,7 @@ namespace impactx::initialization pp_algo.queryAdd("poisson_solver", poisson_solver); int max_level = 0; - pp_amr.query("max_level", max_level); + pp_amr.queryWithParser("max_level", max_level); if (max_level > 1 && !space_charge) throw std::runtime_error( diff --git a/src/initialization/InitMeshRefinement.cpp b/src/initialization/InitMeshRefinement.cpp index 0c0047218..fe4589332 100644 --- a/src/initialization/InitMeshRefinement.cpp +++ b/src/initialization/InitMeshRefinement.cpp @@ -37,7 +37,7 @@ namespace detail amrex::ParmParse pp_geometry("geometry"); int max_level = 0; - pp_amr.query("max_level", max_level); + pp_amr.queryWithParser("max_level", max_level); std::string poisson_solver = "multigrid"; pp_algo.queryAdd("poisson_solver", poisson_solver); diff --git a/src/initialization/Warnings.cpp b/src/initialization/Warnings.cpp index 8638fcf1d..7721e6d1a 100644 --- a/src/initialization/Warnings.cpp +++ b/src/initialization/Warnings.cpp @@ -27,7 +27,7 @@ void ImpactX::init_warning_logger () // verbosity int verbose = 1; - pp_impactx.queryAdd("verbose", verbose); + pp_impactx.queryAddWithParser("verbose", verbose); // Set the flag to control if ImpactX has to emit a warning message // as soon as a warning is recorded @@ -64,7 +64,7 @@ bool ImpactX::early_param_check () // verbosity amrex::ParmParse pp_impactx("impactx"); int verbose = 1; - pp_impactx.queryAdd("verbose", verbose); + pp_impactx.queryAddWithParser("verbose", verbose); if (verbose > 0) { amrex::Print() << "\n"; diff --git a/src/particles/ImpactXParticleContainer.cpp b/src/particles/ImpactXParticleContainer.cpp index 996707f08..4be795c81 100644 --- a/src/particles/ImpactXParticleContainer.cpp +++ b/src/particles/ImpactXParticleContainer.cpp @@ -153,7 +153,7 @@ namespace impactx { amrex::ParmParse const pp_algo("algo"); int v = 0; - bool const has_shape = pp_algo.query("particle_shape", v); + bool const has_shape = pp_algo.queryWithParser("particle_shape", v); if (!has_shape) throw std::runtime_error("particle_shape is not set, cannot initialize grids with guard cells."); SetParticleShape(v); diff --git a/src/particles/diagnostics/DiagnosticOutput.cpp b/src/particles/diagnostics/DiagnosticOutput.cpp index 1ec35610f..a28758d6a 100644 --- a/src/particles/diagnostics/DiagnosticOutput.cpp +++ b/src/particles/diagnostics/DiagnosticOutput.cpp @@ -193,16 +193,16 @@ namespace impactx::diagnostics amrex::ParmParse pp_diag("diag"); amrex::ParticleReal alpha = 0.0; - pp_diag.queryAdd("alpha", alpha); + pp_diag.queryAddWithParser("alpha", alpha); amrex::ParticleReal beta = 1.0; - pp_diag.queryAdd("beta", beta); + pp_diag.queryAddWithParser("beta", beta); amrex::ParticleReal tn = 0.4; - pp_diag.queryAdd("tn", tn); + pp_diag.queryAddWithParser("tn", tn); amrex::ParticleReal cn = 0.01; - pp_diag.queryAdd("cn", cn); + pp_diag.queryAddWithParser("cn", cn); NonlinearLensInvariants const nonlinear_lens_invariants(alpha, beta, tn, cn); diff --git a/src/particles/elements/diagnostics/AdditionalProperties.cpp b/src/particles/elements/diagnostics/AdditionalProperties.cpp index a6c9ca29b..de19903e3 100644 --- a/src/particles/elements/diagnostics/AdditionalProperties.cpp +++ b/src/particles/elements/diagnostics/AdditionalProperties.cpp @@ -39,16 +39,16 @@ namespace impactx::diagnostics return; amrex::ParticleReal alpha = 0.0; - pp_element.queryAdd("alpha", alpha); + pp_element.queryAddWithParser("alpha", alpha); amrex::ParticleReal beta = 1.0; - pp_element.queryAdd("beta", beta); + pp_element.queryAddWithParser("beta", beta); amrex::ParticleReal tn = 0.4; - pp_element.queryAdd("tn", tn); + pp_element.queryAddWithParser("tn", tn); amrex::ParticleReal cn = 0.01; - pp_element.queryAdd("cn", cn); + pp_element.queryAddWithParser("cn", cn); NonlinearLensInvariants const nonlinear_lens_invariants(alpha, beta, tn, cn); diff --git a/src/particles/elements/diagnostics/openPMD.cpp b/src/particles/elements/diagnostics/openPMD.cpp index 8b215d3e2..16ff6c81c 100644 --- a/src/particles/elements/diagnostics/openPMD.cpp +++ b/src/particles/elements/diagnostics/openPMD.cpp @@ -181,9 +181,9 @@ namespace detail amrex::ParmParse pp_diag("diag"); // turn filter - pp_diag.queryAdd("period_sample_intervals", m_period_sample_intervals); + pp_diag.queryAddWithParser("period_sample_intervals", m_period_sample_intervals); // legacy options from other diagnostics - pp_diag.queryAdd("file_min_digits", m_file_min_digits); + pp_diag.queryAddWithParser("file_min_digits", m_file_min_digits); // Ensure m_series is the same for the same names. if (m_unique_series.count(m_series_name) == 0u) { diff --git a/src/particles/spacecharge/PoissonSolve.cpp b/src/particles/spacecharge/PoissonSolve.cpp index a414604b9..82db71b90 100644 --- a/src/particles/spacecharge/PoissonSolve.cpp +++ b/src/particles/spacecharge/PoissonSolve.cpp @@ -63,13 +63,13 @@ namespace impactx::spacecharge // MLMG options amrex::Real mlmg_relative_tolerance = 1.e-7; // relative TODO: make smaller for SP amrex::Real mlmg_absolute_tolerance = 0.0; // ignored - pp_algo.queryAdd("mlmg_relative_tolerance", mlmg_relative_tolerance); - pp_algo.queryAdd("mlmg_absolute_tolerance", mlmg_absolute_tolerance); + pp_algo.queryAddWithParser("mlmg_relative_tolerance", mlmg_relative_tolerance); + pp_algo.queryAddWithParser("mlmg_absolute_tolerance", mlmg_absolute_tolerance); int mlmg_max_iters = 100; int mlmg_verbosity = 1; - pp_algo.queryAdd("mlmg_max_iters", mlmg_max_iters); - pp_algo.queryAdd("mlmg_verbosity", mlmg_verbosity); + pp_algo.queryAddWithParser("mlmg_max_iters", mlmg_max_iters); + pp_algo.queryAddWithParser("mlmg_verbosity", mlmg_verbosity); // create a vector to our fields, sorted by level amrex::Vector sorted_rho; diff --git a/src/particles/wakefields/HandleWakefield.H b/src/particles/wakefields/HandleWakefield.H index 6bd65de9f..331c4fe5e 100644 --- a/src/particles/wakefields/HandleWakefield.H +++ b/src/particles/wakefields/HandleWakefield.H @@ -58,7 +58,7 @@ namespace impactx::particles::wakefields #endif int csr_bins = 150; - pp_algo.queryAdd("csr_bins", csr_bins); + pp_algo.queryAddWithParser("csr_bins", csr_bins); // Measure beam size, extract the min, max of particle positions [[maybe_unused]] auto const [x_min, y_min, t_min, x_max, y_max, t_max] = diff --git a/src/python/ImpactX.cpp b/src/python/ImpactX.cpp index d1c99f99e..3fe6fd3fd 100644 --- a/src/python/ImpactX.cpp +++ b/src/python/ImpactX.cpp @@ -43,10 +43,16 @@ namespace detail template< typename T> auto get_or_throw (std::string const & prefix, std::string const & name) { - T value; + using V = std::decay_t; + V value; + + bool has_name = false; // TODO: if array do queryarr - // bool const has_name = amrex::ParmParse(prefix).queryarr(name.c_str(), value); - bool const has_name = amrex::ParmParse(prefix).query(name.c_str(), value); + // has_name = amrex::ParmParse(prefix).queryarr(name.c_str(), value); + if constexpr (std::is_same_v || std::is_same_v) + has_name = amrex::ParmParse(prefix).query(name.c_str(), value); + else + has_name = amrex::ParmParse(prefix).queryWithParser(name.c_str(), value); if (!has_name) throw std::runtime_error(prefix + "." + name + " is not set yet"); @@ -112,7 +118,7 @@ void init_ImpactX (py::module& m) [](ImpactX & /* ix */){ int max_level = 0; amrex::ParmParse pp_amr("amr"); - pp_amr.query("max_level", max_level); + pp_amr.queryWithParser("max_level", max_level); return max_level; }, [](ImpactX & ix, int max_level) { diff --git a/src/python/elements.cpp b/src/python/elements.cpp index ce712c370..aeb0e06d9 100644 --- a/src/python/elements.cpp +++ b/src/python/elements.cpp @@ -37,10 +37,16 @@ namespace detail template< typename T> auto get_or_throw (std::string const & prefix, std::string const & name) { - T value; + using V = std::decay_t; + V value; + + bool has_name = false; // TODO: if array do queryarr - // bool const has_name = amrex::ParmParse(prefix).queryarr(name.c_str(), value); - bool const has_name = amrex::ParmParse(prefix).query(name.c_str(), value); + // has_name = amrex::ParmParse(prefix).queryarr(name.c_str(), value); + if constexpr (std::is_same_v || std::is_same_v) + has_name = amrex::ParmParse(prefix).query(name.c_str(), value); + else + has_name = amrex::ParmParse(prefix).queryWithParser(name.c_str(), value); if (!has_name) throw std::runtime_error(prefix + "." + name + " is not set yet");