https://github.com/alphal00p/momtrop
Simple rust crate for tropical sampling in momentum space
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.6%) to scientific vocabulary
Repository
Simple rust crate for tropical sampling in momentum space
Basic Info
- Host: GitHub
- Owner: alphal00p
- Language: Rust
- Default Branch: main
- Size: 132 KB
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Momtrop
momtrop is a Rust library implementing the tropical Feynman sampling algorithm for loop integrals in momentum space (https://arxiv.org/abs/2504.09613). It is designed for maximum flexibility: the user retains full control over the evaluation of the integrand, and the sampling process is fully generic over floating-point types.
Defining a Graph
To begin integrating with momtrop, you first need to define a graph. Graphs in momtrop are specified as a list of undirected edges. Each edge defines the two vertices it connects, a boolean indicating whether it has mass, and an f64 value representing its weight ν_e.
You must also provide a list of vertices with incoming external momenta. The following example defines a triangle graph:
```rust use momtrop::{Edge, Graph};
let weight = 2.0 / 3.0;
let triangleedges = vec![ Edge { vertices: (0, 1), ismassive: false, weight, }, Edge { vertices: (1, 2), ismassive: false, weight, }, Edge { vertices: (2, 0), ismassive: false, weight, }, ];
let externals = vec![0, 1, 2];
let graph = Graph { edges: triangle_edges, externals, }; ```
The SampleGenerator
Sampling is performed using the SampleGenerator<D> struct, where D is the dimension. A SampleGenerator can be constructed from a Graph by supplying a signature matrix. The following code creates a SampleGenerator for our triangle graph in D = 3 dimensions:
rust
let loop_signature = vec![vec![1]; 3];
let sampler = graph.build_sampler::<3>(loop_signature).unwrap();
Kinematic Data
To generate a sample point, you must provide the kinematic data for each edge using the Vector<T, D> type, where T is a floating-point type.
This data is passed as a Vec<(Option<T>, Vector<T, D>)>. Each entry contains the optional mass me of the edge (use None for massless edges), and the shift vector pe.
Example for massless edges:
```rust use momtrop::Vector;
let p1 = Vector::fromarray([3.0, 4.0, 5.0]); let p2 = Vector::fromarray([6.0, 7.0, 8.0]);
let edgedata = vec![ (None, Vector::newfrom_num(&0.0)), (None, p1), (None, &p1 + &p2), ];
let settings = TropicalSamplingSettings { ..Default::default() }; ```
Generating a Sample Point
```rust use rand::SeedableRng;
let mut rng = rand::rngs::StdRng::seedfromu64(42);
let sample = sampler .generatesamplefromrng( edgedata.clone(), &settings, &mut rng, ) .unwrap(); ```
Alternatively, you can supply the uniform random numbers in the hypercube manually:
```rust
let numvars = sampler.getdimension();
let xspacepoint = repeatwith(|| rng.gen::
let sample = sampler.generatesamplefromxspacepoint( xspacepoint, edgedata, settings, ); ```
Arbitrary Precision
To use momtrop with floating-point types other than f64, you must implement the MomtropFloat trait for your desired type. For a complete list of required methods, consult the documentation.
If you do not own the type (e.g., it is from an external crate), wrap it in a new struct before implementing the trait.
Reproducing Results from the Paper
You can reproduce the results from the associated paper using gammaloop. Configuration files for the examples are provided in the trop_paper_cards directory.
bash
pip install gammaloop==0.3.3
gammaloop --build_dependencies
gammaloop trop_paper_cards/2_point_3_loop.gL
If you encounter error: externally-managed-environment, please install gammaloop in a virtual environment.
Owner
- Name: alphaLoop
- Login: alphal00p
- Kind: organization
- Email: valentin.hirschi@gmail.com
- Location: Switzerland
- Website: www.alphaloop.ch
- Repositories: 4
- Profile: https://github.com/alphal00p
Projects relating to Local Unitarity
GitHub Events
Total
- Watch event: 1
- Delete event: 2
- Push event: 45
- Create event: 7
Last Year
- Watch event: 1
- Delete event: 2
- Push event: 45
- Create event: 7
Packages
- Total packages: 1
-
Total downloads:
- cargo 866 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
- Total maintainers: 1
crates.io: momtrop
Simple rust crate for tropical sampling in momentum space
- Documentation: https://docs.rs/momtrop/
- License: MIT
-
Latest release: 0.2.1
published about 1 year ago