xcoll 0.5.12__py3-none-any.whl → 0.6.1__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 (336) hide show
  1. xcoll/__init__.py +5 -18
  2. xcoll/__init__.py.orig +26 -0
  3. xcoll/beam_elements/__init__.py +1 -0
  4. xcoll/beam_elements/absorber.py +12 -2
  5. xcoll/beam_elements/base.py +162 -62
  6. xcoll/beam_elements/blowup.py +1 -0
  7. xcoll/beam_elements/elements_src/black_absorber.h +57 -58
  8. xcoll/beam_elements/elements_src/black_crystal.h +49 -50
  9. xcoll/beam_elements/elements_src/everest_block.h +21 -11
  10. xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
  11. xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
  12. xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
  13. xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
  14. xcoll/beam_elements/everest.py +16 -5
  15. xcoll/beam_elements/monitor.py +1 -0
  16. xcoll/beam_elements/transparent.py +83 -0
  17. xcoll/colldb.py +15 -6
  18. xcoll/general.py +1 -1
  19. xcoll/general.py.orig +20 -0
  20. xcoll/headers/particle_states.py +51 -0
  21. xcoll/initial_distribution.py +121 -91
  22. xcoll/initial_distribution.py.orig +256 -0
  23. xcoll/interaction_record/interaction_record.py +2 -1
  24. xcoll/interaction_record/interaction_types.py +2 -2
  25. xcoll/line_tools.py +163 -73
  26. xcoll/lossmap.py +519 -127
  27. xcoll/plot.py +109 -0
  28. xcoll/rf_sweep.py +6 -0
  29. xcoll/scattering_routines/engine.py +414 -217
  30. xcoll/scattering_routines/environment.py +297 -0
  31. xcoll/scattering_routines/everest/amorphous.h +95 -71
  32. xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
  33. xcoll/scattering_routines/everest/constants.h +1 -1
  34. xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
  35. xcoll/scattering_routines/everest/everest.h +8 -3
  36. xcoll/scattering_routines/everest/everest.py +2 -1
  37. xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
  38. xcoll/scattering_routines/everest/jaw.h +19 -24
  39. xcoll/scattering_routines/everest/materials.py +2 -0
  40. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  41. xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
  42. xcoll/scattering_routines/everest/properties.h +3 -72
  43. xcoll/xaux.py +65 -109
  44. {xcoll-0.5.12.dist-info → xcoll-0.6.1.dist-info}/METADATA +5 -5
  45. xcoll-0.6.1.dist-info/RECORD +138 -0
  46. xcoll/_manager.py +0 -22
  47. xcoll/headers/particle_states.h +0 -25
  48. xcoll/install.py +0 -35
  49. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  50. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  51. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  52. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  53. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  54. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  55. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  56. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  57. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  58. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  281. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  282. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  283. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  284. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  285. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  286. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  287. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  288. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  289. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  290. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  291. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  292. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  293. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  296. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
  297. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
  298. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  299. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  300. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  301. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
  302. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  303. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
  304. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  305. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  306. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  307. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  308. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
  309. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  310. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  311. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  312. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  313. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  314. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  315. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  316. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  317. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  318. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
  319. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  320. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  321. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  322. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  323. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  324. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  325. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  326. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  327. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
  328. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
  329. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
  330. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  331. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  332. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
  333. xcoll-0.5.12.dist-info/RECORD +0 -415
  334. {xcoll-0.5.12.dist-info → xcoll-0.6.1.dist-info}/LICENSE +0 -0
  335. {xcoll-0.5.12.dist-info → xcoll-0.6.1.dist-info}/NOTICE +0 -0
  336. {xcoll-0.5.12.dist-info → xcoll-0.6.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,297 @@
1
+ # copyright ############################### #
2
+ # This file is part of the Xcoll Package. #
3
+ # Copyright (c) CERN, 2025. #
4
+ # ######################################### #
5
+
6
+ import os
7
+ import sys
8
+ import json
9
+ import tempfile
10
+ from subprocess import run, PIPE
11
+ # from platformdirs import user_config_dir, user_data_dir
12
+
13
+ from ..general import _pkg_root
14
+ try:
15
+ from xaux import FsPath # TODO: once xaux is in Xsuite keep only this
16
+ except (ImportError, ModuleNotFoundError):
17
+ from ..xaux import FsPath
18
+
19
+
20
+ class BaseEnvironment:
21
+ _pkg_root
22
+ _config_dir = (_pkg_root / 'config').resolve()
23
+ _data_dir = (_pkg_root / 'lib').resolve()
24
+ # _config_dir = FsPath(user_config_dir('xcoll')).resolve()
25
+ # _data_dir = FsPath(user_data_dir('xcoll')).resolve()
26
+ _paths = {} # The value is the parent depth that needs to be brute-forced (0 = file itself, None = no brute-force)
27
+ _read_only_paths = {}
28
+
29
+ def __init__(self, *args, **kwargs):
30
+ self._old_sys_path = None
31
+ self._old_os_env = None
32
+ self._temp_dir = None
33
+ for path in self._paths.keys():
34
+ setattr(self, f'_{path}', None)
35
+ self._config_file = self._config_dir / f'{self.__class__.__name__[:-11].lower()}.config.json'
36
+ sys.path.append(self._data_dir.as_posix())
37
+ self._in_constructor = True
38
+ self.load()
39
+ self._in_constructor = False
40
+
41
+ def __del__(self):
42
+ self.restore_environment()
43
+ if self._temp_dir:
44
+ self._temp_dir.cleanup()
45
+
46
+ def __repr__(self):
47
+ return f"<{self.__class__.__name__} at {hex(id(self))} (use .show() to see the paths)>"
48
+
49
+ def __str__(self):
50
+ res = ["XcollEnvironment"]
51
+ res.append(f" Configuration file: {self._config_file.as_posix()}")
52
+ res.append(f" Configuration dir: {self._config_dir.as_posix()}")
53
+ res.append(f" Data dir: {self._data_dir.as_posix()}")
54
+ if self._temp_dir:
55
+ res.append(f" Temporary dir: {self._temp_dir.name}")
56
+ if self.__class__ is not BaseEnvironment:
57
+ res.append("")
58
+ res.append(f"{self.__class__.__name__}")
59
+ for path in self._paths.keys():
60
+ value = getattr(self, f'_{path}', None)
61
+ path = f'{path}:'
62
+ if value is None:
63
+ res.append(f" {path:<20} None")
64
+ else:
65
+ res.append(f" {path:<20} {value.as_posix()}")
66
+ for path in self._read_only_paths.keys():
67
+ value = getattr(self, path)
68
+ path = f'{path} (read-only):'
69
+ res.append(f" {path:<20} {value.as_posix()}")
70
+ if self._old_sys_path and self._old_os_env:
71
+ res.append("")
72
+ res.append("Custom environment stored:")
73
+ res.append(f" sys.path: {self._old_sys_path}")
74
+ res.append(f" os.environ: {self._old_os_env}")
75
+ return "\n".join(res)
76
+
77
+ @property
78
+ def config_file(self):
79
+ """The environment configuration file."""
80
+ return self._config_file
81
+
82
+ @property
83
+ def config_dir(self):
84
+ """The directory where the configuration files are stored."""
85
+ return self._config_dir
86
+
87
+ @property
88
+ def data_dir(self):
89
+ """The directory where the data files are stored."""
90
+ return self._data_dir
91
+
92
+ @property
93
+ def initialised(self):
94
+ return all(getattr(self, path, None) is not None and getattr(self, path, None).exists()
95
+ for path in self._paths.keys())
96
+
97
+ @property
98
+ def compiled(self):
99
+ raise NotImplementedError("This property should be implemented in the subclass.")
100
+
101
+ @property
102
+ def temp_dir(self):
103
+ if not self._temp_dir:
104
+ self._temp_dir = tempfile.TemporaryDirectory()
105
+ return FsPath(self._temp_dir.name)
106
+
107
+ @temp_dir.setter
108
+ def temp_dir(self, value):
109
+ if value is None:
110
+ if self._temp_dir:
111
+ self._temp_dir.cleanup()
112
+ self._temp_dir = None
113
+ return
114
+ if self._temp_dir:
115
+ self._temp_dir.cleanup()
116
+ self._temp_dir = None
117
+ if isinstance(value, FsPath):
118
+ value = value.resolve()
119
+ elif isinstance(value, str):
120
+ value = FsPath(value).resolve()
121
+ else:
122
+ raise TypeError("temp_dir must be a string or FsPath.")
123
+ if not value.exists():
124
+ raise FileNotFoundError(f"Provided temp_dir {value} does not exist!")
125
+ self._temp_dir = tempfile.TemporaryDirectory(dir=value)
126
+
127
+ @temp_dir.deleter
128
+ def temp_dir(self):
129
+ self.temp_dir = None
130
+
131
+ def show(self):
132
+ """Print the environment paths."""
133
+ print(self)
134
+
135
+ def save(self):
136
+ if not self._config_dir.exists():
137
+ self._config_dir.mkdir(parents=True, exist_ok=True)
138
+ data = {}
139
+ for path in self._paths.keys():
140
+ value = getattr(self, path, None)
141
+ if value:
142
+ value = FsPath(value).as_posix()
143
+ data[path] = value
144
+ with open(self._config_file, 'w') as fid:
145
+ json.dump(data, fid, indent=4)
146
+
147
+ def load(self):
148
+ if not self._config_file.exists():
149
+ self.save()
150
+ with open(self._config_file, 'r') as fid:
151
+ data = json.load(fid)
152
+ for key, value in data.items():
153
+ setattr(self, key, FsPath(value) if value else None)
154
+
155
+ def store_environment(self):
156
+ self._old_sys_path = sys.path.copy()
157
+ self._old_os_env = os.environ.copy()
158
+
159
+ def restore_environment(self):
160
+ if self._old_sys_path:
161
+ sys.path = self._old_sys_path
162
+ self._old_sys_path = None
163
+ if self._old_os_env:
164
+ os.environ = self._old_os_env
165
+ self._old_os_env = None
166
+
167
+ def brute_force_path(self, path):
168
+ num_parents = 0
169
+ if path in self._paths:
170
+ num_parents = self._paths[path]
171
+ path = getattr(self, path)
172
+ if path in self._read_only_paths:
173
+ num_parents = self._read_only_paths[path]
174
+ path = getattr(self, path)
175
+ if path is None:
176
+ return
177
+ path = FsPath(path).resolve()
178
+ if num_parents > 0:
179
+ path = path.parents[num_parents-1]
180
+ if not path.exists():
181
+ raise FileNotFoundError(f"Could not find path {path}!")
182
+ try:
183
+ cmd = run(['tree', path.as_posix()], stdout=PIPE, stderr=PIPE)
184
+ except FileNotFoundError:
185
+ # No tree executable. Return as no more can be done. TODO: alternatives for mac and windows?
186
+ return
187
+ if cmd.returncode != 0:
188
+ stderr = cmd.stderr.decode('UTF-8').strip().split('\n')
189
+ raise RuntimeError(f"Could not resolve {path} tree!\nError given is:\n{stderr}")
190
+
191
+ def __getattr__(self, key):
192
+ if key in self._paths.keys():
193
+ value = getattr(self, f'_{key}', None)
194
+ if value:
195
+ return FsPath(value)
196
+ else:
197
+ raise AttributeError(f"{self.__class__.__name__} has no attribute '{key}'")
198
+
199
+ def __setattr__(self, key, value):
200
+ if key in self._paths.keys():
201
+ if value:
202
+ value = FsPath(value)
203
+ if not self._in_constructor:
204
+ self.brute_force_path(value)
205
+ setattr(self, f'_{key}', value)
206
+ if not self._in_constructor:
207
+ self.save()
208
+ elif key in self._read_only_paths.keys():
209
+ raise AttributeError(f"Attribute '{key}' of {self.__class__.__name__} "
210
+ + f"is read-only!")
211
+ else:
212
+ super().__setattr__(key, value)
213
+
214
+ def __delattr__(self, item):
215
+ if item in self._paths.keys():
216
+ self.__setattr__(self, f'_{item}', None)
217
+ self.save()
218
+
219
+ def assert_make_installed(self, verbose=False):
220
+ if hasattr(self, '_make_installed') and hasattr(self, '_cmake_installed'):
221
+ return self._make_installed and self._cmake_installed
222
+ try:
223
+ cmd = run(["make", "--version"], stdout=PIPE, stderr=PIPE)
224
+ except FileNotFoundError:
225
+ self._make_installed = False
226
+ raise RuntimeError("Could not find make installation!")
227
+ if cmd.returncode == 0:
228
+ self._make_installed = True
229
+ else:
230
+ stderr = cmd.stderr.decode('UTF-8').strip().split('\n')
231
+ self._make_installed = False
232
+ raise RuntimeError(f"Could not run make! Verify its installation.\nError given is:\n{stderr}")
233
+ try:
234
+ cmd = run(["cmake", "--version"], stdout=PIPE, stderr=PIPE)
235
+ except FileNotFoundError:
236
+ self._cmake_installed = False
237
+ raise RuntimeError("Could not find cmake installation!")
238
+ if cmd.returncode == 0:
239
+ self._cmake_installed = True
240
+ else:
241
+ stderr = cmd.stderr.decode('UTF-8').strip().split('\n')
242
+ self._cmake_installed = False
243
+ raise RuntimeError(f"Could not run cmake! Verify its installation.\nError given is:\n{stderr}")
244
+
245
+ def assert_gcc_isntalled(self, verbose=False):
246
+ if hasattr(self, '_gcc_installed'):
247
+ return self._gcc_installed
248
+ try:
249
+ cmd = run(["gcc", "-dumpversion"], stdout=PIPE, stderr=PIPE)
250
+ except FileNotFoundError:
251
+ self._gcc_installed = False
252
+ raise RuntimeError("Could not find gcc installation! Need gcc 9 or higher.")
253
+ if cmd.returncode == 0:
254
+ version = cmd.stdout.decode('UTF-8').strip().split('\n')[0]
255
+ if int(version.split('.')[0]) < 9:
256
+ self._gcc_installed = False
257
+ raise RuntimeError(f"Need gcc 9 or higher, but found gcc {version}!")
258
+ self._gcc_installed = True
259
+ if verbose:
260
+ cmd2 = run(["which", "gcc"], stdout=PIPE, stderr=PIPE)
261
+ if cmd2.returncode == 0:
262
+ file = cmd2.stdout.decode('UTF-8').strip().split('\n')[0]
263
+ print(f"Found gcc {version} in {file}", flush=True)
264
+ else:
265
+ stderr = cmd2.stderr.decode('UTF-8').strip().split('\n')
266
+ raise RuntimeError(f"Could not run `which gcc`!\nError given is:\n{stderr}")
267
+ else:
268
+ stderr = cmd.stderr.decode('UTF-8').strip().split('\n')
269
+ self._gcc_installed = False
270
+ raise RuntimeError(f"Could not run gcc! Verify its installation.\nError given is:\n{stderr}")
271
+
272
+ def assert_gfortran_installed(self, verbose=False):
273
+ if hasattr(self, '_gfortran_installed'):
274
+ return self._gfortran_installed
275
+ try:
276
+ cmd = run(["gfortran", "-dumpversion"], stdout=PIPE, stderr=PIPE)
277
+ except FileNotFoundError:
278
+ self._gfortran_installed = False
279
+ raise RuntimeError("Could not find gfortran installation! Need gfortran 9 or higher.")
280
+ if cmd.returncode == 0:
281
+ version = cmd.stdout.decode('UTF-8').strip().split('\n')[0]
282
+ if int(version.split('.')[0]) < 9:
283
+ self._gfortran_installed = False
284
+ raise RuntimeError(f"Need gfortran 9 or higher, but found gfortran {version}!")
285
+ self._gfortran_installed = True
286
+ if verbose:
287
+ cmd2 = run(["which", "gfortran"], stdout=PIPE, stderr=PIPE)
288
+ if cmd2.returncode == 0:
289
+ file = cmd2.stdout.decode('UTF-8').strip().split('\n')[0]
290
+ print(f"Found gfortran {version} in {file}", flush=True)
291
+ else:
292
+ stderr = cmd2.stderr.decode('UTF-8').strip().split('\n')
293
+ raise RuntimeError(f"Could not run `which gfortran`!\nError given is:\n{stderr}")
294
+ else:
295
+ stderr = cmd.stderr.decode('UTF-8').strip().split('\n')
296
+ self._gfortran_installed = False
297
+ raise RuntimeError(f"Could not run gfortran! Verify its installation.\nError given is:\n{stderr}")
@@ -18,9 +18,10 @@ void volume_reflection(EverestData restrict everest, LocalParticle* part, int8_t
18
18
  int8_t sc = everest->coll->record_scatterings;
19
19
  int64_t i_slot = -1;
20
20
 
21
-
22
21
  double Ang_avr = everest->Ang_avr;
23
- double Ang_rms = everest->Ang_rms;
22
+ double Ang_rms = everest->Ang_rms * RandomNormal_generate(part);
23
+ // TODO: Use standard MCS
24
+ // TODO: should we automatically channel after VC? Now it will still roll a dice, and do VRCH if failed. Many VR are missed this way
24
25
 
25
26
  if (transition == XC_VOLUME_REFLECTION_TRANS_CH){
26
27
  // We are in transition from CH to VR
@@ -31,22 +32,13 @@ void volume_reflection(EverestData restrict everest, LocalParticle* part, int8_t
31
32
  if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_VOLUME_REFLECTION_TRANS_CH);
32
33
 
33
34
  } else if (transition == XC_VOLUME_REFLECTION_TRANS_MCS){
34
- // We are in transition from VR to MCS
35
- // double t_c = everest->t_c;
36
- // double t_P = everest->t_P;
37
- // double xp_rel = LocalParticle_get_xp(part) - everest->t_I;
38
- // // TODO: where does 3 come from
39
- // Ang_rms *= -3.*(xp_rel-t_P)/(2.*t_c); // TODO: why no random number?
40
- Ang_rms *= RandomNormal_generate(part);
41
35
  if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_VOLUME_REFLECTION_TRANS_MCS);
42
36
 
43
37
  } else {
44
- Ang_rms *= RandomNormal_generate(part);
45
38
  if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_VOLUME_REFLECTION);
46
- }
47
39
 
48
- double t_VR = Ang_avr + Ang_rms;
49
- LocalParticle_add_to_xp(part, t_VR);
40
+ }
41
+ LocalParticle_add_to_xp(part, Ang_avr + Ang_rms);
50
42
  if (sc) InteractionRecordData_log_child(record, i_slot, part);
51
43
  }
52
44
 
@@ -69,10 +61,6 @@ double amorphous_transport(EverestData restrict everest, LocalParticle* part, do
69
61
  if (transition == XC_MULTIPLE_COULOMB_TRANS_VR){
70
62
  // Transition MCS
71
63
  if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_MULTIPLE_COULOMB_TRANS_VR);
72
- // double xp_rel = LocalParticle_get_xp(part) - everest->t_I;
73
- // double t_P = everest->t_P;
74
- // double t_c = everest->t_c;
75
- // dya *= 1 - (xp_rel-t_P)/(2.*t_c);
76
64
  } else {
77
65
  // Normal MCS
78
66
  if (sc) i_slot = InteractionRecordData_log(record, record_index, part, XC_MULTIPLE_COULOMB_SCATTERING);
@@ -84,8 +72,7 @@ double amorphous_transport(EverestData restrict everest, LocalParticle* part, do
84
72
  Drift_single_particle_4d(part, length);
85
73
 
86
74
  // Energy lost because of ionisation process[GeV]
87
- double energy_loss = calcionloss(everest, part, length);
88
- pc = pc - energy_loss*length;
75
+ pc = calcionloss(everest, part, length, pc, 1);
89
76
 
90
77
  // Store new angles
91
78
  LocalParticle_add_to_xp_yp(part, kxmcs, kymcs);
@@ -96,9 +83,40 @@ double amorphous_transport(EverestData restrict everest, LocalParticle* part, do
96
83
  return pc;
97
84
  }
98
85
 
86
+
99
87
  double Channel(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length);
88
+ double Amorphous(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length, int8_t allow_VI);
100
89
 
101
- /*gpufun*/
90
+ double volume_interaction(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length, int8_t transition){
91
+ #ifdef XCOLL_REFINE_ENERGY
92
+ calculate_VI_parameters(everest, part, pc);
93
+ #endif
94
+ // Are we reflecting or captured?
95
+ if (RandomUniform_generate(part) > everest->Vcapt) {
96
+ // Volume Reflection
97
+ volume_reflection(everest, part, transition);
98
+ // We call the main Amorphous function for the leftover
99
+ pc = Amorphous(everest, part, cg, pc, length, 0);
100
+
101
+ } else {
102
+ // Volume Capture
103
+ if (everest->coll->record_scatterings){
104
+ InteractionRecordData record = everest->coll->record;
105
+ RecordIndex record_index = everest->coll->record_index;
106
+ InteractionRecordData_log(record, record_index, part, XC_VOLUME_CAPTURE);
107
+ }
108
+ // We call the main Channel function for the leftover
109
+ calculate_initial_angle(everest, part, cg);
110
+ calculate_opening_angle(everest, part, cg);
111
+ #ifdef XCOLL_REFINE_ENERGY
112
+ calculate_critical_angle(everest, part, cg, pc);
113
+ #endif
114
+ pc = Channel(everest, part, cg, pc, length);
115
+ }
116
+ return pc;
117
+ }
118
+
119
+ // /*gpufun*/
102
120
  double Amorphous(EverestData restrict everest, LocalParticle* part, CrystalGeometry restrict cg, double pc, double length, int8_t allow_VI) {
103
121
 
104
122
  if (LocalParticle_get_state(part) < 1){
@@ -106,10 +124,6 @@ double Amorphous(EverestData restrict everest, LocalParticle* part, CrystalGeome
106
124
  return pc;
107
125
  }
108
126
 
109
- InteractionRecordData record = everest->coll->record;
110
- RecordIndex record_index = everest->coll->record_index;
111
- int8_t sc = everest->coll->record_scatterings;
112
-
113
127
  calculate_initial_angle(everest, part, cg);
114
128
 
115
129
  // -----------------------------------------------
@@ -148,71 +162,81 @@ double Amorphous(EverestData restrict everest, LocalParticle* part, CrystalGeome
148
162
  // --------------------------------------------------------------
149
163
  // This happens when the particle is tangential to the crystal planes.
150
164
  // The (straight) trajectory until the point of reflection is r sin(xp - t_I),
151
- // hence the longitudinal length is r sin(xp - miscut) cos xp
152
- double length_VI = everest->r * sin(xp - everest->t_I) * cos(xp);
153
- // If length_VI is negative, VI is not possible, so set to a big value
154
- if (length_VI < 0) {length_VI = 1e10;}
165
+ // hence the longitudinal length is r sin(xp - t_I) cos xp
166
+ double length_VI = 1e10;
167
+ if (xp > everest->t_I){
168
+ // xp has to be larger than t_I to be able to VR (no matter which transition we consider)
169
+ // #ifdef XCOLL_TRANSITION_VRAM
170
+ // // Transition region between VR and AM for t_B < xp - tI < t_B + t_c (or t_B + 2t_c if OLD)
171
+ // length_VI = everest->r * sin(xp - everest->t_I) * cos(xp);
172
+ // // #else
173
+ // // #ifdef XCOLL_TRANSITION_VRAM
174
+ // // // Transition region between VR and AM for t_B < xp - tI < t_B + t_c
175
+ // // // We need to start transitioning earlier than t_B
176
+ // // length_VI = everest->r * sin(xp - everest->t_I + everest->t_c) * cos(xp);
177
+ // #else
178
+ // // Normal behaviour, no transition
179
+ length_VI = everest->r * sin(xp - everest->t_I) * cos(xp);
180
+ // // #endif
181
+ // #endif
182
+ }
155
183
  // Calculate extra length to transition region between VR and AM
156
- double length_VR_trans = everest->r * sin(xp - everest->t_I - 2.*everest->t_c) * cos(xp - 2.*everest->t_c);
157
- if (length_VR_trans < 0) {length_VR_trans = 1e10;}
184
+ double length_VR_trans = 1e10;
185
+ #ifdef XCOLL_TRANSITION_VRAM_OLD
186
+ // Transition region between VR and AM for t_B < xp - tI < t_B + 2t_c
187
+ if (xp - 2.*everest->t_c > everest->t_I){
188
+ length_VR_trans = everest->r * sin(xp - everest->t_I - 2.*everest->t_c) * cos(xp);
189
+ }
190
+ #else
191
+ #ifdef XCOLL_TRANSITION_VRAM
192
+ // Transition region between VR and AM for t_B < xp - tI < t_B + t_c
193
+ if (xp - everest->t_c > everest->t_I){
194
+ length_VR_trans = everest->r * sin(xp - everest->t_I - everest->t_c) * cos(xp);
195
+ }
196
+ #endif
197
+ #endif
158
198
 
159
199
  // ------------------------------------------------------------------------
160
200
  // Compare the 3 lengths: the first one encountered is what will be applied
161
201
  // ------------------------------------------------------------------------
162
- if (length_VI <= fmin(length_nucl, length_exit) && allow_VI == 1){
163
- // MCS to volume interaction
164
- pc = amorphous_transport(everest, part, pc, length_VI, 0);
165
- #ifdef XCOLL_REFINE_ENERGY
166
- calculate_VI_parameters(everest, part, pc);
167
- #endif
168
- // Are we reflecting or captured?
169
- if (RandomUniform_generate(part) > everest->Vcapt) {
170
- // Volume Reflection
171
- volume_reflection(everest, part, 0);
172
- // We call the main Amorphous function for the leftover
173
- pc = Amorphous(everest, part, cg, pc, length - length_VI, 0);
174
202
 
203
+ if (length_nucl < fmin(length_VI, length_exit)) {
204
+ // MCS to nuclear interaction
205
+ pc = amorphous_transport(everest, part, pc, length_nucl, 0);
206
+ // interact
207
+ pc = nuclear_interaction(everest, part, pc);
208
+ if (LocalParticle_get_state(part) == XC_LOST_ON_EVEREST_COLL){
209
+ LocalParticle_set_state(part, XC_LOST_ON_EVEREST_CRYSTAL);
175
210
  } else {
176
- // Volume Capture
177
- if (sc) InteractionRecordData_log(record, record_index, part, XC_VOLUME_CAPTURE);
178
- // We call the main Channel function for the leftover
179
- pc = Channel(everest, part, cg, pc, length - length_VI);
211
+ // We call the main Amorphous function for the leftover
212
+ pc = Amorphous(everest, part, cg, pc, length - length_nucl, 1);
180
213
  }
181
214
 
182
- #ifdef XCOLL_TRANSITION
183
- } else if (length_VR_trans <= fmin(length_nucl, length_exit) && allow_VI == 1){
184
- // Transition region between VR and AM for t_P < xp - tI < t_P + 2t_c
185
- #ifdef XCOLL_REFINE_ENERGY
186
- calculate_critical_angle(everest, part, cg, pc);
187
- #endif
188
- double xp_rel = xp - everest->t_I;
189
- double t_P = everest->t_P;
190
- double t_c = everest->t_c;
191
- double prob_MCS = (xp_rel - t_P) / (2*t_c);
215
+ } else if (length_VI <= length_exit && allow_VI == 1){
216
+ // MCS to volume interaction
217
+ pc = amorphous_transport(everest, part, pc, length_VI, 0);
218
+ pc = volume_interaction(everest, part, cg, pc, length - length_VI, 0);
219
+
220
+ } else if (length_VR_trans <= length_exit && allow_VI == 1){
221
+ // We estimate where we are in the transition region (rather on the VR side or rather on the AM side)
222
+ // by looking at how much correction we needed on the length. If length_VI is closest to length_exit,
223
+ // we are on the VR side. On the other hand, if length_VR_trans is closest to length_exit, we are on the
224
+ // AM side. Note that, by reaching this part we automatically have length_VI > length_exit > length_VR_trans.
225
+ double prob_MCS = (length_VI - length_exit) / (length_VI - length_VR_trans);
192
226
  if (RandomUniform_generate(part) > prob_MCS){
193
227
  // We are on the VR side
194
228
  pc = amorphous_transport(everest, part, pc, length_VR_trans, 0);
195
- volume_reflection(everest, part, XC_VOLUME_REFLECTION_TRANS_MCS);
196
- pc = Amorphous(everest, part, cg, pc, length - length_VR_trans, 0);
229
+ pc = volume_interaction(everest, part, cg, pc, length - length_VR_trans, XC_VOLUME_REFLECTION_TRANS_MCS);
230
+ // // Volume Reflection
231
+ // volume_reflection(everest, part, XC_VOLUME_REFLECTION_TRANS_MCS);
232
+ // // We call the main Amorphous function for the leftover
233
+ // pc = Amorphous(everest, part, cg, pc, length - length_VR_trans, 0);
197
234
  } else {
198
235
  // We are on the AM side
199
236
  // if (sc) InteractionRecordData_log(record, record_index, part, XC_MULTIPLE_COULOMB_TRANS_VR);
200
237
  pc = amorphous_transport(everest, part, pc, length_VR_trans, XC_MULTIPLE_COULOMB_TRANS_VR);
201
238
  pc = Amorphous(everest, part, cg, pc, length - length_VR_trans, 0);
202
239
  }
203
- #endif
204
-
205
- } else if (length_nucl < length_exit) {
206
- // MCS to nuclear interaction
207
- pc = amorphous_transport(everest, part, pc, length_nucl, 0);
208
- // interact
209
- pc = nuclear_interaction(everest, part, pc);
210
- if (LocalParticle_get_state(part) == XC_LOST_ON_EVEREST_COLL){
211
- LocalParticle_set_state(part, XC_LOST_ON_EVEREST_CRYSTAL);
212
- } else {
213
- // We call the main Amorphous function for the leftover
214
- pc = Amorphous(everest, part, cg, pc, length - length_nucl, 1);
215
- }
216
240
 
217
241
  } else {
218
242
  // Exit crystal