Skip to content

Commit

Permalink
updated the models folder readme file (#333)
Browse files Browse the repository at this point in the history
* updated the models folder readme file

* Update README.md

* fix typo
  • Loading branch information
jorindevandevis authored Oct 30, 2024
1 parent baf8f9a commit aad9a6e
Showing 1 changed file with 17 additions and 87 deletions.
104 changes: 17 additions & 87 deletions Models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,31 @@

## Overview

To run specific models, each folder contains a
Makefile that can simply be run inside a specific model folder.
The workflow includes running WolframScript to generate matrix elements, using Python to generate collision data, and finally processing the data with the main Python script.
This folder contains individual model directories, each equipped with a Python script to calculate the wall velocity specific to that model. Additional files within each model directory support the computation of matrix elements and collision integrations.

## Directory Structure

- `MatrixElements/` - Contains the script and data files for matrix element generation.
- `CollisionOutput/` - Directory where collision data files are stored.
Each model directory includes the following files and subdirectories:
- `<nameOfModel>.py` - Contains the model definition and the commands for finding the wall velocity.
- `<nameOfModel>Config.ini` - An optional configuration file containing model-specific configuration settings. (Note: This file is not included for the Yukawa model.)
- `exampleCollisionDefs.py` - Defines collision generation settings specific to the model.
- `MatrixElements/` - A subdirectory holding scripts (with .m extensions) used for generating matrix elements, as well as a .json file containing the computed matrix elements.
- `CollisionOutput_N<spatialGridSize>/` - Subdirectories for storing collision data files for each pair of out-of-equilibrium particles, with each folder corresponding to a specific spatial grid size.

Additionally, the Models folder contains a common utility file:

## Makefile Targets
- `wallGoExampleBase.py` - This script provides a shared template for wall velocity computations. It is used by all models except the Yukawa model.

### `all`
## Running a model

This is the default target which runs the `model` target.
The examples can be run directly with e.g.

### `generateMatrixElements`
Generates matrix Elements at `MatrixElements.txt` from
`MatrixElements/<Model>.m`
as sometimes only the matrix elements need to be generated.
python3 Models/SingletStandardModel_Z2/singletStandardModelZ2.py

For models that use the common `wallGoExampleBase.py', additional command line arguments are available to (re)calculate matrix elements and collisions, and adjust the momentum grid size e.g.

### `model`
Runs only the model file
`<model-name>.py`
as sometimes no new matrix elements or collision integrals need to be generated.
python3 Models/SingletStandardModel_Z2/singletStandardModelZ2.py --recalculateMatrixElements --recalculateCollisions --momentumGridSize 5

### `generate_collisions`
## Requirements

Generates collision data files using the matrix elements. This target depends on `MatrixElements.txt`, which is generated by running a WolframScript file.

### `clean`

Removes the `CollisionOutput` and `MatrixElements` directories and all their contents.

## Dependencies

- `python3` - Required for running Python scripts.
- `wolframscript` - Required for running the WolframScript file to generate matrix elements.


- `matrixElements.m` -
MatrixElement script based on DRalgo.
See [https://github.com/Wall-Go/MatrixElements](https://github.com/Wall-Go/MatrixElements).
- `DRalgo` - See [https://github.com/DR-algo/DRalgo](https://github.com/DR-algo/DRalgo).

Both `matrixElements.m` and the `DRalgo` folder should be placed in a directory visible to Mathematica. The best options are to place it in the Applications subfolder of
`$BaseDirectory` or `$UserBaseDirectory`.
Often, the paths are the following:

### For Linux

/usr/share/Mathematica/Applications
/home/<computer-name>/.Mathematica/Applications

### For Windows

C:\ProgramData\Mathematica\Applications
C:\Users\<computer-name>\AppData\Roaming\Mathematica\Applications

## Usage

### Full pipeline
1. **Generate Collisions**:
Ensure that the matrix elements data file `MatrixElements.txt` exists, then generate collision data by running:
```sh
make generate_collisions
```

2. **Run Main (Model) Script**:
Once collision data files are generated, run the main Python script:
```sh
make model
```

4. **Clean Up**:
To clean up the generated collision data files and matrix elements:
```sh
make clean
```

### Matrix Elements
1. **Generate Matrix Elements**:
In that case it suffices to run:
```sh
make generateMatrixElements
```

## File Descriptions

- `MatrixElements/matrixElements.qcd.m` - WolframScript file for generating matrix elements.
- `MatrixElements.txt` - Output data file containing matrix elements.
- `collisionGenerator.py` - Python script for generating collision data.
- `<model-name>.py` - Main Python Model script that uses the collision data e.g. `SingletStandardModel_Z2.py`

## Notes

- Ensure that the necessary Python and WolframScript dependencies are installed and properly configured in your environment.
- The `CollisionOutput` directory is automatically created if it does not exist when running the `generate_collisions` target.
Running the model files requires a valid installation of [**WallGo**](https://github.com/Wall-Go/WallGo) . Generation of new matrix elements and collisions furthermore requires installations of [**WallGoMatrix**](https://github.com/Wall-Go/WallGoMatrix) and [**WallGoCollision**](https://github.com/Wall-Go/WallGoCollision) respectively.

0 comments on commit aad9a6e

Please sign in to comment.