diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 1c5533de2..511f495a2 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -62,7 +62,7 @@ These live in the source tree (see the path) rather than being fetched; traccc a | [stb_image_write](https://github.com/nothings/stb) (v1.16, commit 31c1ad3) | `preview/stb/` | Sean Barrett | MIT OR Unlicense | [stb_image_write.txt](licenses/stb_image_write.txt) | | ICMP responder and IP header checksum (HPCN Group, UAM) | `fpga/hls/icmp.cpp`, `fpga/hls/ip_header_checksum.h` | HPCN Group, UAM Spain; modifications PSI | BSD-3-Clause | [hpcn-uam.txt](licenses/hpcn-uam.txt) | | [fast-feedback-indexer](https://github.com/paulscherrerinstitute/fast-feedback-indexer) (commit a94fd4f) | `image_analysis/indexing/fast-feedback-indexer/` | PSI | BSD-3-Clause | [fast-feedback-indexer.txt](licenses/fast-feedback-indexer.txt) | -| [GEMMI](https://github.com/project-gemmi/gemmi) (0.7.5, trimmed) | `gemmi_gph/` | Global Phasing Ltd. | MPL-2.0 | [gemmi.txt](licenses/gemmi.txt) | +| [GEMMI](https://github.com/project-gemmi/gemmi) (0.7.5, trimmed and locally modified) | `gemmi_gph/` | Global Phasing Ltd. | MPL-2.0 | [gemmi.txt](licenses/gemmi.txt) | | [stb_sprintf](https://github.com/nothings/stb) (v1.10, bundled with GEMMI) | `gemmi_gph/stb/stb_sprintf.h` | Jeff Roberts / RAD Game Tools; Sean Barrett | MIT OR Unlicense | [stb_sprintf.txt](licenses/stb_sprintf.txt) | | 3x3 symmetric eigensolver (Connelly Barnes, after JAMA; bundled with GEMMI) | `gemmi_gph/eig3.cpp` | — | public domain (no SPDX id) | — | | [CCP4 Monomer Library](https://github.com/MonomerLibrary/monomers) (modified subset: restraint dictionary data) | `image_analysis/structure_refinement/monomers/` | CCP4 / the Monomer Library authors (Vagin et al.) | LGPL-3.0-only | [ccp4-monomer-library.txt](licenses/ccp4-monomer-library.txt) | @@ -76,7 +76,8 @@ These live in the source tree (see the path) rather than being fetched; traccc a | [traccc (ACTS)](https://github.com/acts-project/traccc) | `image_analysis/spot_finding/StrongPixelSet.cpp`, `SpotExtractorGPU.cu` | CERN, for the benefit of the ACTS project | MPL-2.0 | [traccc.txt](licenses/traccc.txt) | | [fast-feedback-indexer](https://github.com/paulscherrerinstitute/fast-feedback-indexer) (adapted) | `image_analysis/indexing/FFBIDXIndexerCPU.cpp` | PSI | BSD-3-Clause | [fast-feedback-indexer.txt](licenses/fast-feedback-indexer.txt) | | [Ceres Solver](https://github.com/ceres-solver/ceres-solver) (adapted) | `image_analysis/geom_refinement/LMSolver.h`, `LMSolver.cpp` | Google Inc. | BSD-3-Clause | [ceres-solver.txt](licenses/ceres-solver.txt) | -| [GEMMI](https://github.com/project-gemmi/gemmi) (adapted) | `image_analysis/structure_refinement/ModelScaling.cpp`, `ModelMaskGPU.cu`, `ModelStructureFactorsGPU.cpp`, `ModelDensityMetal.metal`, `AtomGradientMetal.metal` | Global Phasing Ltd. | MPL-2.0 | [gemmi.txt](licenses/gemmi.txt) | +| [GEMMI](https://github.com/project-gemmi/gemmi) (adapted) | `image_analysis/structure_refinement/ModelScaling.cpp`, `ModelScaleGPU.cu`, `ModelGrid.cpp`, `ModelFFT.cpp`, `ModelMaskGPU.cu`, `ModelStructureFactorsGPU.cpp`, `ModelStructureFactorsGPU.cu`, `ModelDensityGPU.cu`, `RefinementGPU.cu`, `RigidBodyGPU.cu`, `ModelDensityMetal.metal`, `AtomGradientMetal.metal` | Global Phasing Ltd. | MPL-2.0 | [gemmi.txt](licenses/gemmi.txt) | +| [SIMD-math-prims](https://github.com/jhjourdan/SIMD-math-prims) (`expapprox()`, as GEMMI's `unsafe_expapprox()` adapts it) | `gemmi_gph/gemmi/formfact.hpp`; `image_analysis/structure_refinement/ModelDensityGPU.cu`, `RefinementGPU.cu`, `ModelDensityMetal.metal`, `AtomGradientMetal.metal` | Jacques-Henri Jourdan | MIT | [simd-math-prims.txt](licenses/simd-math-prims.txt) | | [Durin](https://github.com/DiamondLightSource/durin) (adapted) | `xds-plugin/plugin.h`, `plugin.cpp` | Diamond Light Source Ltd.; Global Phasing Ltd. | BSD-3-Clause | [durin.txt](licenses/durin.txt) | | [xbflash.qspi](https://github.com/Xilinx/XRT) | `tools/xbflash.qspi/` | Xilinx / AMD | Apache-2.0 | [xbflash-qspi.txt](licenses/xbflash-qspi.txt) | | [wingetopt](https://github.com/alex85k/wingetopt) | `tools/wingetopt/` | Todd C. Miller; The NetBSD Foundation | ISC AND BSD-2-Clause | [wingetopt.txt](licenses/wingetopt.txt) | @@ -149,10 +150,13 @@ served frontend, so the shipped web UI carries its own attribution. * **fast-feedback-indexer** is also vendored and linked in CUDA builds (table above); separately, `FFBIDXIndexerCPU.cpp` ports its CUDA kernels to the CPU. The file names the origin at the top and is covered by `licenses/fast-feedback-indexer.txt`. -* **GEMMI** is also vendored (table above); separately, `ModelScaling.cpp`, `ModelMaskGPU.cu`, - `ModelStructureFactorsGPU.cpp`, `ModelDensityMetal.metal` and `AtomGradientMetal.metal` in - `image_analysis/structure_refinement/` follow GEMMI's scaling, Levenberg-Marquardt, solvent-mask, reciprocal-grid and form-factor code. - Each names the GEMMI source it follows and is covered by `licenses/gemmi.txt`. +* **GEMMI** is also vendored (table above); separately, `ModelScaling.cpp`, `ModelScaleGPU.cu`, + `ModelGrid.cpp`, `ModelFFT.cpp`, `ModelMaskGPU.cu`, `ModelStructureFactorsGPU.cpp`, `ModelStructureFactorsGPU.cu`, + `ModelDensityGPU.cu`, `RefinementGPU.cu`, `RigidBodyGPU.cu`, `ModelDensityMetal.metal` and `AtomGradientMetal.metal` in + `image_analysis/structure_refinement/` follow GEMMI's scaling, Levenberg-Marquardt, grid, solvent-mask, reciprocal-grid and form-factor code. + Each names the GEMMI source it follows and is covered by `licenses/gemmi.txt`. The fast exponential in + GEMMI's form-factor code, and in the four of these files that compute atomic density, is SIMD-math-prims' + `expapprox()` (MIT, `licenses/simd-math-prims.txt`). * **Durin** (`xds-plugin/plugin.h`/`.cpp`): the XDS plugin's entry points are based on the Durin plugin of Diamond Light Source and Global Phasing; both files name the origin at the top and are covered by `licenses/durin.txt`. diff --git a/image_analysis/structure_refinement/AtomGradientMetal.metal b/image_analysis/structure_refinement/AtomGradientMetal.metal index d2ffc4ed6..43f9857d4 100644 --- a/image_analysis/structure_refinement/AtomGradientMetal.metal +++ b/image_analysis/structure_refinement/AtomGradientMetal.metal @@ -1,5 +1,5 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 AND MIT // The refinement gradient's sums over the map (AtomGradientMetal.h), compiled when it is first used from this source, // which CMakeLists.txt copies into the binary. The place of a point and the test against the radius are spelled as diff --git a/image_analysis/structure_refinement/ModelDensityGPU.cu b/image_analysis/structure_refinement/ModelDensityGPU.cu index 8fcdf1737..a804d34e2 100644 --- a/image_analysis/structure_refinement/ModelDensityGPU.cu +++ b/image_analysis/structure_refinement/ModelDensityGPU.cu @@ -1,5 +1,11 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 AND MIT + +// The atom box and density follow GEMMI's grid.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/grid.hpp) and formfact.hpp +// (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/formfact.hpp) +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 +// The exponential is gemmi's unsafe_expapprox() (formfact.hpp), itself based on expapprox() of SIMD-math-prims +// (https://github.com/jhjourdan/SIMD-math-prims) (c) 2015 Jacques-Henri Jourdan, MIT License #include "ModelDensityGPU.h" diff --git a/image_analysis/structure_refinement/ModelDensityMetal.metal b/image_analysis/structure_refinement/ModelDensityMetal.metal index 3811c0d41..3b94b2658 100644 --- a/image_analysis/structure_refinement/ModelDensityMetal.metal +++ b/image_analysis/structure_refinement/ModelDensityMetal.metal @@ -1,5 +1,5 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 AND MIT // The model density's gather (ModelDensityMetal.h), compiled when it is first used from this source, which // CMakeLists.txt copies into the binary - with fast math off and no a*b+c contracted, as on the host, so that @@ -38,8 +38,8 @@ struct Grid { // ModelDensityMetalGrid }; // gemmi's unsafe_expapprox() (formfact.hpp, MPL-2.0; https://github.com/project-gemmi/gemmi), which is based on -// expapprox() from https://github.com/jhjourdan/SIMD-math-prims: the same operations, the bits moved with as_type -// where gemmi uses memcpy. +// expapprox() from https://github.com/jhjourdan/SIMD-math-prims ((c) 2015 Jacques-Henri Jourdan, MIT License): +// the same operations, the bits moved with as_type where gemmi uses memcpy. static float expapprox(float x) { const float val = 12102203.1615614f * x + 1065353216.f; const int vali = static_cast(val); diff --git a/image_analysis/structure_refinement/ModelFFT.cpp b/image_analysis/structure_refinement/ModelFFT.cpp index 014b359a6..d0572276f 100644 --- a/image_analysis/structure_refinement/ModelFFT.cpp +++ b/image_analysis/structure_refinement/ModelFFT.cpp @@ -1,5 +1,8 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 + +// MapToFPhi follows transform_map_to_f_phi() of GEMMI's fourier.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/fourier.hpp) +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 #include "ModelFFT.h" diff --git a/image_analysis/structure_refinement/ModelGrid.cpp b/image_analysis/structure_refinement/ModelGrid.cpp index 65468c364..220be4706 100644 --- a/image_analysis/structure_refinement/ModelGrid.cpp +++ b/image_analysis/structure_refinement/ModelGrid.cpp @@ -1,5 +1,10 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 + +// The atom box walk and symmetrisation follow GEMMI's grid.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/grid.hpp), the atom density +// GEMMI's formfact.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/formfact.hpp) and dencalc.hpp, and ShrinkMask GEMMI's +// solmask.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/solmask.hpp) +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 #include "ModelGrid.h" diff --git a/image_analysis/structure_refinement/ModelScaleGPU.cu b/image_analysis/structure_refinement/ModelScaleGPU.cu index 4c94139fb..ae9090cfa 100644 --- a/image_analysis/structure_refinement/ModelScaleGPU.cu +++ b/image_analysis/structure_refinement/ModelScaleGPU.cu @@ -1,5 +1,9 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 + +// The scaling target follows GEMMI's scaling.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/scaling.hpp), and +// JordanSolve / LevMarRun the Levenberg-Marquardt of GEMMI's levmar.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/levmar.hpp) +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 #include "ModelScaleGPU.h" diff --git a/image_analysis/structure_refinement/ModelStructureFactorsGPU.cu b/image_analysis/structure_refinement/ModelStructureFactorsGPU.cu index 1b23b06ca..7dedcdc44 100644 --- a/image_analysis/structure_refinement/ModelStructureFactorsGPU.cu +++ b/image_analysis/structure_refinement/ModelStructureFactorsGPU.cu @@ -1,5 +1,9 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 + +// The grid layout, operators and map transforms follow GEMMI's fourier.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/fourier.hpp) +// and symmetry.hpp, as ModelStructureFactorsGPU.cpp does +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 #include "ModelStructureFactorsGPUEngine.h" diff --git a/image_analysis/structure_refinement/RefinementGPU.cu b/image_analysis/structure_refinement/RefinementGPU.cu index d5d4c427f..7ae808a8b 100644 --- a/image_analysis/structure_refinement/RefinementGPU.cu +++ b/image_analysis/structure_refinement/RefinementGPU.cu @@ -1,5 +1,10 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 AND MIT + +// The atom density follows GEMMI's formfact.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/formfact.hpp) +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 +// The exponential is gemmi's unsafe_expapprox() (formfact.hpp), itself based on expapprox() of SIMD-math-prims +// (https://github.com/jhjourdan/SIMD-math-prims) (c) 2015 Jacques-Henri Jourdan, MIT License #include "RefinementGPUEngine.h" diff --git a/image_analysis/structure_refinement/RigidBodyGPU.cu b/image_analysis/structure_refinement/RigidBodyGPU.cu index 0c1528b62..23db9299d 100644 --- a/image_analysis/structure_refinement/RigidBodyGPU.cu +++ b/image_analysis/structure_refinement/RigidBodyGPU.cu @@ -1,5 +1,8 @@ // SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute -// SPDX-License-Identifier: GPL-3.0-only +// SPDX-License-Identifier: GPL-3.0-only AND MPL-2.0 + +// The scaled F_calc and its derivatives follow GEMMI's scaling.hpp (https://github.com/project-gemmi/gemmi/blob/master/include/gemmi/scaling.hpp) +// (c) Global Phasing Ltd., Mozilla Public License Version 2.0 #include "RigidBodyGPUEngine.h" diff --git a/licenses/COLLECT.sh b/licenses/COLLECT.sh index e998098f8..ca0d6d650 100644 --- a/licenses/COLLECT.sh +++ b/licenses/COLLECT.sh @@ -98,6 +98,7 @@ copy_license Qt6-LGPL-3.0.txt /usr/share/common-licenses/LGPL-3 copy_license NVIDIA-CUDA-EULA.txt \ /usr/local/cuda/EULA.txt /usr/local/cuda-12.8/EULA.txt -# hpcn-uam.txt (fpga/hls/icmp.cpp, ip_header_checksum.h) and stb_sprintf.txt (gemmi_gph/stb/stb_sprintf.h) +# hpcn-uam.txt (fpga/hls/icmp.cpp, ip_header_checksum.h), stb_sprintf.txt (gemmi_gph/stb/stb_sprintf.h) and +# simd-math-prims.txt (the LICENSE of github.com/jhjourdan/SIMD-math-prims, whose expapprox() GEMMI adapts) # are the licence comments of those files, kept by hand - re-extract them if the files change. -echo "Done. base64-macaron.txt, traccc.txt, rapidjson.txt, hpcn-uam.txt, stb_sprintf.txt, Qt6-NOTICE.txt and NVIDIA-CUDA-NOTICE.txt are maintained by hand." +echo "Done. base64-macaron.txt, traccc.txt, rapidjson.txt, hpcn-uam.txt, stb_sprintf.txt, simd-math-prims.txt, Qt6-NOTICE.txt and NVIDIA-CUDA-NOTICE.txt are maintained by hand." diff --git a/licenses/simd-math-prims.txt b/licenses/simd-math-prims.txt new file mode 100644 index 000000000..982443aa1 --- /dev/null +++ b/licenses/simd-math-prims.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jacques-Henri Jourdan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +