xcoll 0.5.12__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xcoll might be problematic. Click here for more details.

Files changed (333) hide show
  1. xcoll/__init__.py +5 -18
  2. xcoll/beam_elements/__init__.py +1 -0
  3. xcoll/beam_elements/absorber.py +12 -2
  4. xcoll/beam_elements/base.py +162 -62
  5. xcoll/beam_elements/blowup.py +1 -0
  6. xcoll/beam_elements/elements_src/black_absorber.h +57 -58
  7. xcoll/beam_elements/elements_src/black_crystal.h +49 -50
  8. xcoll/beam_elements/elements_src/everest_block.h +21 -11
  9. xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
  10. xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
  11. xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
  12. xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
  13. xcoll/beam_elements/everest.py +16 -5
  14. xcoll/beam_elements/monitor.py +1 -0
  15. xcoll/beam_elements/transparent.py +83 -0
  16. xcoll/colldb.py +15 -6
  17. xcoll/general.py +1 -1
  18. xcoll/headers/particle_states.py +51 -0
  19. xcoll/initial_distribution.py +121 -91
  20. xcoll/interaction_record/interaction_record.py +2 -1
  21. xcoll/interaction_record/interaction_types.py +2 -2
  22. xcoll/line_tools.py +163 -73
  23. xcoll/lossmap.py +519 -127
  24. xcoll/plot.py +109 -0
  25. xcoll/rf_sweep.py +6 -0
  26. xcoll/scattering_routines/engine.py +414 -217
  27. xcoll/scattering_routines/environment.py +297 -0
  28. xcoll/scattering_routines/everest/amorphous.h +95 -71
  29. xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
  30. xcoll/scattering_routines/everest/constants.h +1 -1
  31. xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
  32. xcoll/scattering_routines/everest/everest.h +8 -3
  33. xcoll/scattering_routines/everest/everest.py +2 -1
  34. xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
  35. xcoll/scattering_routines/everest/jaw.h +19 -24
  36. xcoll/scattering_routines/everest/materials.py +2 -0
  37. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  38. xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
  39. xcoll/scattering_routines/everest/properties.h +3 -72
  40. xcoll/xaux.py +65 -109
  41. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/METADATA +5 -5
  42. xcoll-0.6.0.dist-info/RECORD +135 -0
  43. xcoll/_manager.py +0 -22
  44. xcoll/headers/particle_states.h +0 -25
  45. xcoll/install.py +0 -35
  46. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  47. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  48. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  49. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  50. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  51. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  52. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  53. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  54. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  55. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  281. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  282. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  283. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  284. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  285. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  286. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  287. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  288. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  289. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  290. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  296. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  297. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  298. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
  299. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  300. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
  301. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  302. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  303. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  304. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  307. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  308. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  309. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  310. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  311. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  312. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  313. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  314. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  315. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
  316. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  317. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  318. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  319. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  320. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  321. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  322. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  323. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  324. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
  325. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
  326. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
  327. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  328. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  329. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
  330. xcoll-0.5.12.dist-info/RECORD +0 -415
  331. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/LICENSE +0 -0
  332. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/NOTICE +0 -0
  333. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/WHEEL +0 -0
@@ -3,8 +3,8 @@
3
3
  // Copyright (c) CERN, 2023. #
4
4
  // ######################################### #
5
5
 
6
- #ifndef XCOLL_EVEREST_CHANNELING_H
7
- #define XCOLL_EVEREST_CHANNELING_H
6
+ #ifndef XCOLL_EVEREST_CHANNELLING_H
7
+ #define XCOLL_EVEREST_CHANNELLING_H
8
8
  #include <math.h>
9
9
  #include <stdio.h>
10
10
  #include <stdlib.h>
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
  /*gpufun*/
21
- double channeling_average_density(EverestData restrict everest, CrystalGeometry restrict cg, LocalParticle* part, double pc) {
21
+ double channelling_average_density(EverestData restrict everest, CrystalGeometry restrict cg, LocalParticle* part, double pc) {
22
22
 
23
23
  // Material properties
24
24
  double const anuc = everest->coll->anuc;
@@ -75,12 +75,12 @@ double channeling_average_density(EverestData restrict everest, CrystalGeometry
75
75
 
76
76
  /*gpufun*/
77
77
  double* channel_transport(EverestData restrict everest, LocalParticle* part, double pc, double L_chan, double t_I, double t_P) {
78
- // Channeling: happens over an arc length L_chan (potentially less if dechanneling)
78
+ // Channelling: happens over an arc length L_chan (potentially less if dechannelling)
79
79
  // This equates to an opening angle t_P wrt. to the point P (center of miscut if at start of crystal)
80
- // The chord angle xp at the start of channeling (I) is t_P/2 + t_I
81
- // The angle xp at the end of channeling (F) is t_P + t_I
80
+ // The chord angle xp at the start of channelling (I) is t_P/2 + t_I
81
+ // The angle xp at the end of channelling (F) is t_P + t_I
82
82
  // In practice: we drift from start to end, but overwrite the angle afterwards
83
- // TODO: why does channeling only have 50% energy loss?
83
+ // TODO: why does channelling only have 50% energy loss?
84
84
 
85
85
  double* result = (double*)malloc(2 * sizeof(double));
86
86
 
@@ -88,33 +88,37 @@ double* channel_transport(EverestData restrict everest, LocalParticle* part, dou
88
88
  RecordIndex record_index = everest->coll->record_index;
89
89
  int8_t sc = everest->coll->record_scatterings;
90
90
 
91
- // First log particle at start of channeling
91
+ // First log particle at start of channelling
92
92
  int64_t i_slot = -1;
93
- if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_CHANNELING);
93
+ if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_CHANNELLING);
94
94
 
95
- // Do channeling.
95
+ // Do channelling.
96
96
  // The distance from I to F is the chord length of the angle t_P: d = 2 r sin(t_P/2)
97
97
  // Hence the longitudinal distance (the length to be drifted) is the projection of this using the
98
- // xp at the start of channeling: s = 2 r sin(t_P/2)cos(t_P/2 + t_I)
98
+ // xp at the start of channelling: s = 2 r sin(t_P/2)cos(t_P/2 + t_I)
99
99
  double t_chord= t_I + t_P/2.;
100
100
  double drift_length = 2.*L_chan/t_P * sin(t_P/2.) * cos(t_chord);
101
- LocalParticle_set_xp(part, t_chord); // Angle at start of channeling
101
+ LocalParticle_set_xp(part, t_chord); // Angle at start of channelling
102
102
  Drift_single_particle_4d(part, drift_length);
103
- // In reality,the particle oscillates horizontally between the planes while channeling.
103
+ // In reality,the particle oscillates horizontally between the planes while channelling.
104
104
  // This effect is mimicked by giving a random angle spread at the exit
105
105
  double sigma_ran = 0.5*everest->t_c;
106
- double ran_angle = RandomNormal_generate(part)*sigma_ran;
107
- LocalParticle_set_xp(part, t_I + t_P + ran_angle); // Angle at end of channeling
106
+ double ran = RandomNormal_generate(part);
107
+ while (fabs(ran) > 2.0) {
108
+ // Ensure that the kick is within [-tc, +tc]
109
+ ran = RandomNormal_generate(part);
110
+ }
111
+ double ran_angle = ran*sigma_ran;
112
+ LocalParticle_set_xp(part, t_I + t_P + ran_angle); // Angle at end of channelling
108
113
 
109
114
  // Apply energy loss along trajectory
110
- double energy_loss = 0.5*calcionloss(everest, part, L_chan);
111
- // TODO: LocalParticle_add_to_energy(part, - energy_loss*L_chan*1.e9, change_angle);
115
+ pc = calcionloss(everest, part, L_chan, pc, 0.5);
116
+ // TODO: LocalParticle_add_to_energy(part, - energy_loss*1.e9, change_angle);
112
117
  // if change_angle = 0 => LocalParticle_scale_px(part, old_rpp / new_rpp) such that xp remains the same
113
118
  // It is done in K2, so we should do it. Though, it seems that with the current implementation in xtrack
114
119
  // this is no longer correct with exact drifts...?
115
- pc = pc - energy_loss*L_chan; //energy loss to ionization [GeV]
116
120
 
117
- // Finally log particle at end of channeling
121
+ // Finally log particle at end of channelling
118
122
  if (sc) InteractionRecordData_log_child(record, i_slot, part);
119
123
 
120
124
  result[0] = drift_length;
@@ -123,118 +127,123 @@ double* channel_transport(EverestData restrict everest, LocalParticle* part, dou
123
127
  }
124
128
 
125
129
 
126
- double Channel(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length) {
127
-
128
- if (LocalParticle_get_state(part) < 1){
129
- // Do nothing if already absorbed
130
- return pc;
131
- }
132
-
133
- InteractionRecordData record = everest->coll->record;
134
- RecordIndex record_index = everest->coll->record_index;
135
- int8_t sc = everest->coll->record_scatterings;
136
-
130
+ double do_crystal(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length) {
137
131
  calculate_initial_angle(everest, part, cg);
132
+ calculate_opening_angle(everest, part, cg);
138
133
  #ifdef XCOLL_REFINE_ENERGY
139
134
  calculate_critical_angle(everest, part, cg, pc);
140
135
  #endif
141
-
142
- // Do we channel, or are we in the transition between channeling and VR?
143
- double xp = LocalParticle_get_xp(part);
144
- double alpha = fabs(xp - everest->t_I) / everest->t_c;
145
- double ratio = everest->Rc_over_R;
146
- double xi = RandomUniform_generate(part)/(1 - ratio)/sqrt(everest->coll->eta);
147
-
148
- if (xi > 1 || alpha > 2*sqrt(xi)*sqrt(1-xi)) {
149
- #ifdef XCOLL_TRANSITION
150
- // TRANSITION
151
- // We feel that this transition is not needed, as it interpolates between two regions
152
- // (adding a slant below the channeling region) which does not seem to be present in
153
- // experimental data.
136
+ #ifdef XCOLL_USE_EXACT
137
+ double const xp = LocalParticle_get_exact_xp(part);
138
+ #else
139
+ double const xp = LocalParticle_get_xp(part);
140
+ #endif
141
+ if (fabs(xp - everest->t_I) < everest->t_c) {
142
+ double alpha = fabs(xp - everest->t_I) / everest->t_c;
143
+ double ratio = everest->Rc_over_R;
144
+ double xi = RandomUniform_generate(part)/(1 - ratio)/sqrt(everest->coll->eta);
145
+ if (xi > 1 || alpha > 2*sqrt(xi)*sqrt(1-xi)) {
146
+ #ifdef XCOLL_TRANSITION_VRCH
154
147
  #ifdef XCOLL_REFINE_ENERGY
155
- calculate_VI_parameters(everest, part, pc);
148
+ calculate_VI_parameters(everest, part, pc);
156
149
  #endif
157
- volume_reflection(everest, part, XC_VOLUME_REFLECTION_TRANS_CH);
150
+ volume_reflection(everest, part, XC_VOLUME_REFLECTION_TRANS_CH);
158
151
  #endif
152
+ pc = Amorphous(everest, part, cg, pc, length, 1);
153
+ } else {
154
+ pc = Channel(everest, part, cg, pc, length);
155
+ }
156
+ } else {
159
157
  pc = Amorphous(everest, part, cg, pc, length, 1);
158
+ }
159
+ return pc;
160
+ }
161
+
162
+ double Channel(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length) {
163
+ if (LocalParticle_get_state(part) < 1){
164
+ // Do nothing if already absorbed
165
+ return pc;
166
+ }
160
167
 
168
+ // CHANNEL
169
+ double t_I = everest->t_I;
170
+ double t_P = everest->t_P;
171
+ double L_chan = everest->r*t_P;
172
+ double ratio = everest->Rc_over_R;
173
+
174
+ // ------------------------------------------------
175
+ // Calculate curved length L_dechan of dechannelling
176
+ // ------------------------------------------------
177
+ double const_dech = calculate_dechannelling_length(everest, pc);
178
+ double TLdech1 = const_dech*pc*pow(1. - ratio, 2.); //Updated calculate typical dech. length(m)
179
+ double N_atom = 1.0e-1;
180
+ if(RandomUniform_generate(part) <= N_atom) {
181
+ TLdech1 /= 200.; // Updated dechannelling length (m)
182
+ }
183
+ double L_dechan = TLdech1*RandomExponential_generate(part); // Actual dechan. length
184
+
185
+ // -----------------------------------------------------
186
+ // Calculate curved length L_nucl of nuclear interaction
187
+ // -----------------------------------------------------
188
+ // Nuclear interaction length is rescaled in this case, because channelling
189
+ double collnt = everest->coll->collnt;
190
+ double avrrho = channelling_average_density(everest, cg, part, pc);
191
+ if (avrrho == 0) {
192
+ collnt = 1.e10; // very large because essentially 1/0
161
193
  } else {
162
- // CHANNEL
163
- calculate_opening_angle(everest, part, cg);
164
- double t_I = everest->t_I;
165
- double t_P = everest->t_P;
166
- double L_chan = everest->r*t_P;
167
-
168
- // ------------------------------------------------
169
- // Calculate curved length L_dechan of dechanneling
170
- // ------------------------------------------------
171
- double const_dech = calculate_dechanneling_length(everest, pc);
172
- double TLdech1 = const_dech*pc*pow(1. - ratio, 2.); //Updated calculate typical dech. length(m)
173
- double N_atom = 1.0e-1;
174
- if(RandomUniform_generate(part) <= N_atom) {
175
- TLdech1 /= 200.; // Updated dechanneling length (m)
176
- }
177
- double L_dechan = TLdech1*RandomExponential_generate(part); // Actual dechan. length
178
-
179
- // -----------------------------------------------------
180
- // Calculate curved length L_nucl of nuclear interaction
181
- // -----------------------------------------------------
182
- // Nuclear interaction length is rescaled in this case, because channeling
183
- double collnt = everest->coll->collnt;
184
- double avrrho = channeling_average_density(everest, cg, part, pc);
185
- if (avrrho == 0) {
186
- collnt = 1.e10; // very large because essentially 1/0
187
- } else {
188
- collnt = collnt/avrrho;
194
+ collnt = collnt/avrrho;
195
+ }
196
+ double L_nucl = collnt*RandomExponential_generate(part);
197
+
198
+ // ------------------------------------------------------------------------
199
+ // Compare the 3 lengths: the first one encountered is what will be applied
200
+ // ------------------------------------------------------------------------
201
+ if (L_chan <= fmin(L_dechan, L_nucl)){
202
+ // Channel full length
203
+ double* result_chan = channel_transport(everest, part, pc, L_chan, t_I, t_P);
204
+ // double channeled_length = result_chan[0];
205
+ pc = result_chan[1];
206
+ free(result_chan);
207
+
208
+ } else if (L_dechan < L_nucl) {
209
+ // Channel up to L_dechan, then amorphous
210
+ double* result_chan = channel_transport(everest, part, pc, L_dechan, t_I, t_P*L_dechan/L_chan);
211
+ double channeled_length = result_chan[0];
212
+ pc = result_chan[1];
213
+ free(result_chan);
214
+
215
+ if (everest->coll->record_scatterings){
216
+ InteractionRecordData record = everest->coll->record;
217
+ RecordIndex record_index = everest->coll->record_index;
218
+ InteractionRecordData_log(record, record_index, part, XC_DECHANNELLING);
189
219
  }
190
- double L_nucl = collnt*RandomExponential_generate(part);
191
-
192
- // printf("Channeling (%f -> %f): L_c: %f, L_d: %f, L_n: %f\n", t_I, t_P, L_chan, L_dechan, L_nucl);
193
- // ------------------------------------------------------------------------
194
- // Compare the 3 lengths: the first one encountered is what will be applied
195
- // ------------------------------------------------------------------------
196
- if (L_chan <= fmin(L_dechan, L_nucl)){
197
- // Channel full length
198
- double* result_chan = channel_transport(everest, part, pc, L_chan, t_I, t_P);
199
- // double channeled_length = result_chan[0];
200
- pc = result_chan[1];
201
- free(result_chan);
202
-
203
- } else if (L_dechan < L_nucl) {
204
- // Channel up to L_dechan, then amorphous
205
- double* result_chan = channel_transport(everest, part, pc, L_dechan, t_I, t_P*L_dechan/L_chan);
206
- double channeled_length = result_chan[0];
207
- pc = result_chan[1];
208
- free(result_chan);
209
- if (sc) InteractionRecordData_log(record, record_index, part, XC_DECHANNELING);
210
- pc = Amorphous(everest, part, cg, pc, length - channeled_length, 1);
220
+ pc = Amorphous(everest, part, cg, pc, length - channeled_length, 1);
211
221
 
212
- } else {
213
- // Channel up to L_nucl, then scatter, then amorphous
214
- double* result_chan = channel_transport(everest, part, pc, L_nucl, t_I, t_P*L_nucl/L_chan);
215
- double channeled_length = result_chan[0];
216
- pc = result_chan[1];
217
- free(result_chan);
218
- // Rescale nuclear interaction parameters
219
- everest->rescale_scattering = avrrho;
222
+ } else {
223
+ // Channel up to L_nucl, then scatter, then amorphous
224
+ double* result_chan = channel_transport(everest, part, pc, L_nucl, t_I, t_P*L_nucl/L_chan);
225
+ double channeled_length = result_chan[0];
226
+ pc = result_chan[1];
227
+ free(result_chan);
228
+ // Rescale nuclear interaction parameters
229
+ everest->rescale_scattering = avrrho;
220
230
  #ifndef XCOLL_REFINE_ENERGY
221
- calculate_scattering(everest, pc);
231
+ calculate_scattering(everest, pc);
222
232
  #endif
223
- pc = nuclear_interaction(everest, part, pc);
224
- if (LocalParticle_get_state(part) == XC_LOST_ON_EVEREST_COLL){
225
- LocalParticle_set_state(part, XC_LOST_ON_EVEREST_CRYSTAL);
226
- } else {
227
- // We call the main Amorphous function for the leftover
228
- everest->rescale_scattering = 1;
233
+ pc = nuclear_interaction(everest, part, pc);
234
+ if (LocalParticle_get_state(part) == XC_LOST_ON_EVEREST_COLL){
235
+ LocalParticle_set_state(part, XC_LOST_ON_EVEREST_CRYSTAL);
236
+ } else {
237
+ // We call the main Amorphous function for the leftover
238
+ everest->rescale_scattering = 1;
229
239
  #ifndef XCOLL_REFINE_ENERGY
230
- calculate_scattering(everest, pc);
240
+ calculate_scattering(everest, pc);
231
241
  #endif
232
- pc = Amorphous(everest, part, cg, pc, length - channeled_length, 1);
233
- }
242
+ pc = Amorphous(everest, part, cg, pc, length - channeled_length, 1);
234
243
  }
235
244
  }
236
245
 
237
246
  return pc;
238
247
  }
239
248
 
240
- #endif /* XCOLL_EVEREST_CHANNELING_H */
249
+ #endif /* XCOLL_EVEREST_CHANNELLING_H */
@@ -50,7 +50,7 @@
50
50
  #define XC_THERMAL_VIBRATIONS ( 0.075e-10 )
51
51
  #endif
52
52
 
53
- // No idea what this represents physically...
53
+ // Classical radius of electron [m]
54
54
  #if !defined( XC_CRADE )
55
55
  #define XC_CRADE ( 2.817940285e-15 )
56
56
  #endif
@@ -19,7 +19,7 @@ void calculate_initial_angle(EverestData restrict everest, LocalParticle* part,
19
19
  double x_P = cg->x_P;
20
20
  double r = sqrt((s-s_P)*(s-s_P) + (x-x_P)*(x-x_P));
21
21
  everest->r = r;
22
- everest->t_I = R/fabs(R)*asin( (s-s_P)/r); // Tangent angle of the channeling planes (not neccecarly the same as xp)
22
+ everest->t_I = R/fabs(R)*asin( (s-s_P)/r); // Tangent angle of the channelling planes (not necessarily the same as xp)
23
23
  }
24
24
 
25
25
 
@@ -68,7 +68,7 @@ void calculate_opening_angle(EverestData restrict everest, LocalParticle* part,
68
68
  }
69
69
  }
70
70
 
71
- // Opening angle of channeling trajectory
71
+ // Opening angle of channelling trajectory
72
72
  double s = LocalParticle_get_s(part);
73
73
  double x = LocalParticle_get_x(part);
74
74
  everest->t_P = acos(1 - ( (s_F-s)*(s_F-s) - (x_F-x)*(x_F-x) ) / (2*r*r) );
@@ -78,17 +78,17 @@ void calculate_opening_angle(EverestData restrict everest, LocalParticle* part,
78
78
  /*gpufun*/
79
79
  double _critical_angle0(EverestCollData restrict coll, double pc){
80
80
  // Define typical angles/probabilities for orientation 110
81
- double eum = coll->eum;
82
- double eta = coll->eta;
81
+ double eum = coll->eum;
82
+ double eta = coll->eta;
83
83
  return sqrt(2.e-9*eta*eum/pc); // Critical angle (rad) for straight crystals // pc is actually beta pc
84
84
  }
85
85
 
86
86
  /*gpufun*/
87
87
  double _critical_radius(EverestCollData restrict coll, double pc){
88
88
  // Define typical angles/probabilities for orientation 110
89
- double eum = coll->eum;
90
- double ai = coll->ai;
91
- double eta = coll->eta;
89
+ double eum = coll->eum;
90
+ double ai = coll->ai;
91
+ double eta = coll->eta;
92
92
  return pc/(2.e-6*sqrt(eta)*eum)*ai; // Critical curvature radius [m] // pc is actually beta pc
93
93
  }
94
94
 
@@ -96,7 +96,7 @@ double _critical_radius(EverestCollData restrict coll, double pc){
96
96
  double _critical_angle(EverestCollData restrict coll, double t_c0, double Rc_over_R){
97
97
  double t_c = 0;
98
98
  if (Rc_over_R <= 1.) {
99
- // Otherwise no channeling possible
99
+ // Otherwise no channelling possible
100
100
  t_c = t_c0*(1 - Rc_over_R); // Critical angle for curved crystal
101
101
  if (coll->orient == 2) {
102
102
  t_c *= 0.98;
@@ -132,7 +132,7 @@ void calculate_VI_parameters(EverestData restrict everest, LocalParticle* part,
132
132
  double c2 = 5./3.; // Fitting coefficient
133
133
  double c3 = 1.7; // Fitting coefficient
134
134
  if (ratio > 1.) {
135
- // no channeling possibile
135
+ // no channelling possibile
136
136
  Ang_avr = c1*t_c0*5.e-2/ratio; // Average angle reflection
137
137
  Ang_rms = c3*0.42*t_c0*sin(1.4/ratio); // RMS scattering
138
138
  everest->Vcapt = 0.; // Probability of VC is zero
@@ -6,7 +6,10 @@
6
6
  #ifndef XCOLL_EVEREST_ENGINE_H
7
7
  #define XCOLL_EVEREST_ENGINE_H
8
8
 
9
- #define XCOLL_TRANSITION
9
+ #define XCOLL_TRANSITION_VRCH
10
+ #define XCOLL_TRANSITION_VRAM
11
+ // #define XCOLL_TRANSITION_VRAM_OLD
12
+
10
13
 
11
14
  typedef struct EverestCollData_ {
12
15
  // Collimator properties
@@ -47,8 +50,10 @@ typedef struct EverestData_ {
47
50
  double prob_tail_c2;
48
51
  double prob_tail_c3;
49
52
  double prob_tail_c4;
50
- double energy_loss;
51
- double energy_loss_tail;
53
+ double energy_loss_m;
54
+ double energy_loss_xi_m;
55
+ double energy_loss_most_probable_m;
56
+ double energy_loss_tail_m;
52
57
  // Crystal data
53
58
  double rescale_scattering;
54
59
  double t_c;
@@ -24,10 +24,11 @@ class EverestEngine(xt.BeamElement):
24
24
  _pkg_root.joinpath('scattering_routines','everest','constants.h'),
25
25
  _pkg_root.joinpath('scattering_routines','everest','everest.h'),
26
26
  _pkg_root.joinpath('scattering_routines','everest','properties.h'),
27
+ _pkg_root.joinpath('scattering_routines','everest','ionisation_loss.h'),
27
28
  _pkg_root.joinpath('scattering_routines','everest','multiple_coulomb_scattering.h'),
28
29
  _pkg_root.joinpath('scattering_routines','everest','nuclear_interaction.h'),
29
30
  _pkg_root.joinpath('scattering_routines','everest','crystal_parameters.h'),
30
31
  _pkg_root.joinpath('scattering_routines','everest','amorphous.h'),
31
32
  _pkg_root.joinpath('scattering_routines','everest','jaw.h'),
32
- _pkg_root.joinpath('scattering_routines','everest','channeling.h')
33
+ _pkg_root.joinpath('scattering_routines','everest','channelling.h')
33
34
  ]
@@ -0,0 +1,141 @@
1
+ // copyright ############################### #
2
+ // This file is part of the Xcoll package. #
3
+ // Copyright (c) CERN, 2025. #
4
+ // ######################################### #
5
+
6
+ #ifndef XCOLL_EVEREST_IONLOSS_H
7
+ #define XCOLL_EVEREST_IONLOSS_H
8
+ #include <stdlib.h>
9
+ #include <math.h>
10
+ #include <stdio.h>
11
+
12
+ /*gpufun*/
13
+ void calculate_ionisation_properties(EverestData restrict everest, double pc) {
14
+ if (everest->coll->only_mcs){ // TODO: this should be done smarter
15
+ return;
16
+ }
17
+
18
+ // Material properties
19
+ double const exenergy = everest->coll->exenergy*1.0e3; // [MeV]
20
+ double const rho = everest->coll->rho;
21
+ double const anuc = everest->coll->anuc;
22
+ double const zatom = everest->coll->zatom;
23
+
24
+ // Energy variables
25
+ double momentum = pc*1.0e3; // [MeV]
26
+ double energy = sqrt(pow(momentum, 2.) + pow(XC_PROTON_MASS, 2.)); // [MeV]
27
+ double gammar = energy/XC_PROTON_MASS;
28
+ double betar = momentum/energy;
29
+ double bgr = betar*gammar;
30
+ double mep = XC_ELECTRON_MASS/XC_PROTON_MASS; // Electron/proton
31
+
32
+ // tmax is max energy loss from kinematics
33
+ // mep = mass_electron / mass_beam
34
+ double tmax = 2.*XC_ELECTRON_MASS*pow(bgr, 2.)/ (1. + 2.*gammar*mep + pow(mep, 2.)); // [MeV]
35
+ double plen = sqrt(rho*zatom/anuc)*28.816e-6; // [MeV]
36
+
37
+ // TODO: Bete-Bloch needs to be adapted for high energy (more loss due to delta ray radiation)
38
+ // and low energy (nuclear scattering)
39
+ // TODO: should scale with z^2 (incoming charge)
40
+ double BB_fac = XC_BETHE_BLOCH/2*zatom/anuc/betar/betar; // [MeV*cm^2/g]
41
+ everest->energy_loss_xi_m = BB_fac*rho*1.0e-1; // [GeV/m] xi per meter
42
+ double e_ionisation = log(2.*XC_ELECTRON_MASS*bgr*bgr/exenergy);
43
+ double density = 2*log(plen/exenergy) + 2*log(bgr) - 1;
44
+ everest->energy_loss_m = e_ionisation + log(tmax/exenergy) - 2*pow(betar, 2.) - density;
45
+ everest->energy_loss_m *= everest->energy_loss_xi_m; // [GeV/m]
46
+
47
+ // Straggling: energy loss is Gaussian for thick absorbers (TODO: it's Landau-Vavilov for thin absorbers when eps << Tmax)
48
+ // TODO: does it come naturally from variations in trajectory (when using NewGeometry)?
49
+ everest->energy_loss_most_probable_m = e_ionisation - log(exenergy*1.e-3) + 0.194 - pow(betar, 2.) - density;
50
+ everest->energy_loss_most_probable_m *= everest->energy_loss_xi_m; // [GeV/m] missing factor xi ln xi
51
+
52
+ everest->energy_loss_tail_m = e_ionisation+ log(tmax/exenergy) - 2*pow(betar, 2.) - density; // Bethe-Bloch
53
+ everest->energy_loss_tail_m += 2*tmax*tmax/8/energy/energy;
54
+ everest->energy_loss_tail_m *= everest->energy_loss_xi_m; // [GeV/m]
55
+
56
+ double Tt = everest->energy_loss_m*1.0e3 + 8*everest->energy_loss_xi_m*1e3; // [MeV/m]
57
+
58
+ // Calculate different coefficients for terms in dz (length) to get the tail probability
59
+ double const prob_factor = everest->energy_loss_xi_m*1.e3; // [MeV/m]
60
+ everest->prob_tail_c1 = prob_factor / Tt;
61
+ everest->prob_tail_c2 = prob_factor * (
62
+ 2*tmax/(4.*pow(energy, 2.)) - 1/tmax
63
+ - log(tmax/Tt)*pow(betar,2.)/tmax
64
+ ); // * dz
65
+ everest->prob_tail_c3 = prob_factor * pow(betar,2.)/tmax; // * dz * log(dz)
66
+ everest->prob_tail_c4 = -prob_factor * Tt/(2.*pow(energy, 2.)); // * dz * dz
67
+ }
68
+
69
+
70
+ /*gpufun*/
71
+ double calcionloss(EverestData restrict everest, LocalParticle* part, double ionisation_length, double pc, double scale_factor) {
72
+
73
+ #ifdef XCOLL_REFINE_ENERGY
74
+ calculate_ionisation_properties(everest, pc);
75
+ #endif
76
+
77
+ double ionisation_loss;
78
+ InteractionRecordData record = everest->coll->record;
79
+ RecordIndex record_index = everest->coll->record_index;
80
+ int8_t sc = everest->coll->record_scatterings;
81
+
82
+ double mp = LocalParticle_get_mass0(part)/1.e9; // [GeV] TODO: update when allowing other than protons
83
+ double kinetic_energy = sqrt(pow(pc, 2.) + pow(mp, 2.)) - mp;
84
+ int8_t dead = 0;
85
+ double cutoff = 1.e-6; // Lower cutoff of 1keV
86
+ double new_pc = 0;
87
+ double new_pc_2 = 0;
88
+
89
+ double prob_tail = everest->prob_tail_c1 + everest->prob_tail_c2 * ionisation_length
90
+ + everest->prob_tail_c3 * ionisation_length * log(ionisation_length)
91
+ + everest->prob_tail_c4 * ionisation_length * ionisation_length;
92
+
93
+ double xi = ionisation_length*everest->energy_loss_xi_m;
94
+ if (RandomUniform_generate(part) < prob_tail) {
95
+ ionisation_loss = ionisation_length*everest->energy_loss_tail_m;
96
+ } else {
97
+ ionisation_loss = ionisation_length*everest->energy_loss_most_probable_m;
98
+ ionisation_loss += xi*log(xi);
99
+ }
100
+
101
+ // Straggling: energy loss is double Gaussian-like for thick absorbers (TODO: it's Landau-Vavilov for thin absorbers when xi << Tmax)
102
+ double ran1 = RandomNormal_generate(part);
103
+ double ran2 = RandomUniform_generate(part);
104
+ // Sample from two Gaussians, to mimic the fat tail of the Landau distribution
105
+ if (ran2 >= 0.8) {
106
+ ionisation_loss += 3*xi + ran1*xi*3.39729; // 3.39729 = 4/sqrt(2ln2)
107
+ } else {
108
+ ionisation_loss += xi + ran1*xi*1.69864; // 1.69864 = 2/sqrt(2ln2)
109
+ }
110
+ if (ionisation_loss < 1.e-12) {
111
+ ionisation_loss = 0;
112
+ } else {
113
+ ionisation_loss *= scale_factor;
114
+ }
115
+
116
+ if (ionisation_loss > kinetic_energy - cutoff) {
117
+ // All energy lost due to ionisation!
118
+ dead = 1;
119
+ } else {
120
+ new_pc_2 = pow(kinetic_energy - ionisation_loss + mp, 2.) - pow(mp, 2.);
121
+ if (new_pc_2 <= 1.e-12 || new_pc_2 != new_pc_2){
122
+ // Rounding error. Kill particle to avoid NaN (a != a is true only for NaN)
123
+ dead = 1;
124
+ } else {
125
+ new_pc = sqrt(new_pc_2);
126
+ if (new_pc != new_pc){
127
+ // NaN
128
+ dead = 1;
129
+ }
130
+ }
131
+ }
132
+ if (dead) {
133
+ if (sc) InteractionRecordData_log(record, record_index, part, XC_ABSORBED);
134
+ LocalParticle_set_state(part, XC_LOST_ON_EVEREST_COLL);
135
+ return cutoff;
136
+ } else {
137
+ return new_pc;
138
+ }
139
+ }
140
+
141
+ #endif /* XCOLL_EVEREST_IONLOSS_H */
@@ -10,56 +10,51 @@
10
10
 
11
11
 
12
12
  /*gpufun*/
13
- double jaw(EverestData restrict everest, LocalParticle* part, double p, double length, int edge_check) {
13
+ double jaw(EverestData restrict everest, LocalParticle* part, double pc, double length, int edge_check) {
14
14
  if (LocalParticle_get_state(part) < 1){
15
15
  // Do nothing if already absorbed
16
- return p;
16
+ return pc;
17
17
  }
18
18
 
19
- double rlen = length;
20
- double s0 = LocalParticle_get_s(part);
21
- p /= 1e9; // Energy (not momentum) in GeV
19
+ pc /= 1.e9; // [GeV]
22
20
 
23
21
  if (everest->coll->only_mcs) {
24
- mcs(everest, part, rlen, p, edge_check);
22
+ // TODO: ionisation loss should also be calculated when only_mcs
23
+ mcs(everest, part, length, pc, edge_check);
25
24
 
26
25
  } else {
27
- // Do a step for a point-like interaction.
28
- // Get monte-carlo interaction length.
26
+ double rlen = length;
27
+ double s0 = LocalParticle_get_s(part);
29
28
  while (1) {
30
- calculate_ionisation_properties(everest, p);
29
+ // Length of the step until nuclear interaction
31
30
  double length_step = everest->xintl*RandomExponential_generate(part);
32
31
 
33
- // If the monte-carlo interaction length is longer than the remaining
34
- // length, then put it to the remaining length, do mcs and return.
35
32
  if (length_step > rlen) {
36
- mcs(everest, part, rlen, p, edge_check);
33
+ // Length to nuclear interaction is longer than remaining: MCS to end and exit collimator
34
+ mcs(everest, part, rlen, pc, edge_check);
37
35
  break;
38
36
  }
39
37
 
40
- // Otherwise do multi-coulomb scattering.
41
- mcs(everest, part, length_step, p, edge_check);
42
-
43
- if(LocalParticle_get_x(part) <= 0) {
44
- // PARTICLE LEFT COLLIMATOR BEFORE ITS END.
38
+ mcs(everest, part, length_step, pc, edge_check);
39
+ if (LocalParticle_get_state(part) < 1 || (edge_check && LocalParticle_get_x(part) <= 0)){
40
+ // Particle lost all energy due to ionisation, or left the collimator
45
41
  break;
46
42
  }
47
43
 
48
- p = nuclear_interaction(everest, part, p);
44
+ pc = nuclear_interaction(everest, part, pc);
49
45
  if (LocalParticle_get_state(part) < 1){
50
- // PARTICLE WAS ABSORBED INSIDE COLLIMATOR DURING MCS.
46
+ // Particle was absorbed
51
47
  break;
52
48
  }
53
49
 
54
50
  // Calculate the remaining interaction length and close the iteration loop.
55
51
  rlen = rlen - length_step;
56
52
  }
57
- // TODO: ionisation loss should also be calculated when only_mcs
58
- double m_dpodx = calcionloss(everest, part, rlen); // DM routine to include tail // TODO: should not be rlen but s after updating
59
- double s = LocalParticle_get_s(part) - s0;
60
- p = p-m_dpodx*s; // TODO: This is correct: ionisation loss is only calculated and applied at end of while (break)
53
+ calculate_ionisation_properties(everest, pc);
54
+ double ionisation_length = LocalParticle_get_s(part) - s0;
55
+ pc = calcionloss(everest, part, ionisation_length, pc, 1);
61
56
  }
62
- return p*1e9; // Back to eV
57
+ return pc*1e9; // Back to eV
63
58
  }
64
59
 
65
60
  #endif /* XCOLL_EVEREST_JAW_H */
@@ -37,6 +37,8 @@ class GeneralMaterial(xo.HybridClass):
37
37
  '_only_mcs': xo.Int8
38
38
  }
39
39
 
40
+ _depends_on = [xo.Float64]
41
+
40
42
  def __init__(self, **kwargs):
41
43
  if '_xobject' not in kwargs:
42
44
  kwargs.setdefault('hcut', 0.02)