# cnok **Repository Path**: asiarabbit/cnok ## Basic Information - **Project Name**: cnok - **Description**: CNOK: A C++ Glauber model code for one-nucleon knockout - **Primary Language**: C++ - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: https://gitee.com/asiarabbit/cnok - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-02-25 - **Last Updated**: 2025-11-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CNOK ## What CNOK does CNOK is to calculate the cross sections (c.s.) and the longitudinal momentum distribution of the heavy reaction residue (the core) (momentum distribution) in single-nucleon knockout reactions induced by intermediate-energy (30MeV/nucleon- 2GeV/nucleon) beams of stable and radioactive nuclei. ## How to get the code Gitee is a github-like webset providing code hosting serveices. Just download the code via git clone by > git clone --depth=1 -b master https://gitee.com/asiarabbit/cnok ## Build prerequisites ### yaml-cpp and catch The code needs [*yaml-cpp*](https://github.com/jbeder/yaml-cpp) for reading YAML configuration files. Unit test tool [*catch*](https://github.com/catchorg/Catch2) is optional. They are ususally distributed with standard linux repositories, and can be installed in command line, e.g., in Ubuntu yaml-cpp is installed via > sudo apt install libyaml-cpp-dev Alternatively one can download the sources from github, compile and install them. ### ROOT (Optional package for visualization) [ROOT](https://root.cern) is a data analysis framework initially developped for high-energy physics experiment data analysis. It is in C++, open-source, and has many fine, convenient and versatile classes for data visualization. It is usually an indispensable toolkit for researchers with interests in high-energy experimental physics. CNOK includes many ROOT scripts for data visualization of the intermediate and final outputs of the program. If you want to use the built-in ROOT scripts for quick and convenient visualization, please go to ROOT offical [website](https://root.cern/install) for detailed installation guide. ## Build the program After downloading the code, create a build directory outside your source directory and run with > cmake && make -j and then you will get a bunch of executables. Among which *mom*, compiled from `src/momd.cxx`, is the main program, which claculates cross sections and momentum distributions. ## User input ### **Single mode** for single configuration calculation Each valence configuration (bound core (c) state+valence nucleon (v) orbit) needs a separate configuration file (suffixed with '.yaml', YAML file) providing the information about the scattering, including the scattering energy, the (A,Z) of the projectile, the target and the core, also the info for the valence orbit (nlj). Densities for the target and the core are demanded in user input to build the scattering optical potentials via the so-called $t$-$\rho$-$\rho$ approximation. See the comments of the YAML files for details of each item. The path to the YAML file has to be written in `config/basedir.yaml`, so as to save the effort to type them in the command line for every run. #### Running single mode The main executable is *mom*, compiled from 'src/momd.cxx'. The naming of the YAML file has to abide by certain rules in **batch mode** (introduced later), because the program relies on it to deduce the name of the YAML file for the configuration. The naming rules are simple. Let's see an example. Run with > ./mom 0d55p would calculate the valence configuration of 0d5/2⊕5/2+. The trailing 5/2+ is the angular momentum and parity of the core. Note that the program would then search a YAML configuration file named '0d55p.yaml' in the path designated in 'config/basedir.yaml'. So prepare the YAML file first before running with `mom`, and write the path to the YAML file in 'config/basedir.yaml'. If the spin _J_ of the core is an integer, just use _J_ in the argument of `mom`. For example, one uses 1s10p for 1s1/2⊕0+. Although this naming convention is not requird in single mode, it is _mandatory_ in **batch mode**, where the program use the naming convention to deduce the names of the YAML files of the valence configurations. The YAML files named otherwise would not be found by the program. ### **Batch mode** for multiple configurations This multiple configurations all belong to the same projectile nuclei. The calculated c.s. and momentum distributions are summed over the configurations, weighted by the spectroscopic factors of each configuration. So one has to provide a dedicated YAML file, giving information of each configuration. See `config/C/C16/rs.yaml` for example. The path to this YAML file has to be written in `config/basedir.yaml`, so as to save the effort to type them in the command line for every run. Then the batch mode is kick-started by > ./mom -b rs.yaml ### **Super Batch mode** for multiple nuclei This mode does multiple batch mode calculations at one run. The usage is simple. Just designate the YAML files (e.g, `rs.yaml`) for each nucleus in the `ob` parameter in a new YAML file (see `config/C/batch.yaml` for example), and run > ./mom -b batch.yaml The path to the YAML file has to be written in `config/basedir.yaml`, so as to save the effort to type them in the command line for every run. Note that the program does not depend on the name of the YAML file to distringuish between batch mode and super batch mode, but the content of the YAML files. The YAML files for the two working modes have different parameters. ### Calculating the momentum distribution The program calculates the cross sections by default. `-m` option would direct the program to calculate the momentum distribution. This options applies in single, batch, and super batch mode. For example, > ./mom 0d55p -m > ./mom -b rs.yaml -m > ./mom -b batch.yaml -m And adding a `c` to `-m` (i.e., `-mc` option) would drive the program to convolve the calculated momentum distribution with experimental resolutions. The experimental resolutions are input via a YAML file `config/expres.yaml`. The items are explained in detail in the YAML file. # Documentation on the theory and the math A detailed documentation on the formalism and derivation of eikonal model, Glauber model for scattering of composite nuclei and one-nucleon knockout reaction can be found in [cnok.pdf](docs/cnok/cnok.pdf), which also includes the techniques used in numerical implementation of the multiple integrations and basic mathematical tasks such as the solution of radial Schrödinger equation, polynomial interpolation, root-finding of nonlinear equation sets, etc.