Metadata-Version: 2.3
Name: mckit
Version: 0.8.4
Summary: Tools to process MCNP models and results
License: GPL3
Keywords: mckit,MCNP
Author: rrn
Maintainer: dvp2015
Maintainer-email: dmitri_portnov@yahoo.com
Requires-Python: >=3.10,<3.14
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Dist: attrs (>=21.2.0)
Requires-Dist: click (>=8.0.1)
Requires-Dist: intel-cmplr-lib-ur (==2025.0.4)
Requires-Dist: loguru (>=0.6.0)
Requires-Dist: mkl-devel (>=2025.0.1)
Requires-Dist: numpy (>=2.1.3)
Requires-Dist: ply (>=3.11)
Requires-Dist: python-dotenv (>=0.20.0)
Requires-Dist: scipy (>=1.14.0)
Requires-Dist: sly (>=0.4)
Requires-Dist: tomli (>=2.0.1) ; python_version < "3.11"
Requires-Dist: tomli-w (>=1.0.0)
Requires-Dist: tqdm (>=4.55.1)
Requires-Dist: typer[all] (>=0.9.0)
Project-URL: Bug Tracker, https://github.com/MC-kit/mckit/issues
Project-URL: Documentation, https://mckit.readthedocs.io
Project-URL: Homepage, https://github.com/MC-kit/mckit
Project-URL: Repository, https://github.com/MC-kit/mckit
Description-Content-Type: text/x-rst

.. image:: https://img.shields.io/badge/Maintained%3F-yes-green.svg
   :target: https://github.com/MC-kit/mckit/graphs/commit-activity

.. image:: https://github.com/MC-kit/mckit/workflows/Tests/badge.svg
   :target: https://github.com/MC-kit/mckit/actions

.. image:: https://codecov.io/gh/MC-kit/mckit/branch/devel/graph/badge.svg?token=05OFBQS3RX
   :target: https://codecov.io/gh/MC-kit/mckit

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/psf/black

.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
    :target: https://pycqa.github.io/isort/

.. image:: https://img.shields.io/github/license/MC-kit/mckit
   :target: https://github.com/MC-kit/mckit

.. image:: https://img.shields.io/badge/security-bandit-yellow.svg
    :target: https://github.com/PyCQA/bandit
    :alt: Security Status


MCKIT: MCNP model and results processing utilities
==================================================

The mckit package provides a programming framework and command line tools to manipulate complex MCNP models.
When a model is rather complex and its description occupies thousands of text lines it becomes hard to modify it and integrate several model manually.
The package automates integration process.

.. TODO The complete documentation is available in the following languages:

.. * `English documentation`_
.. * `Russian documentation`_

.. .. _English documentation: https://mckit.readthedocs.io/en/latest/
.. .. _Russian documentation: https://mckit.readthedocs.io/ru/latest/

.. contents:: Table of contents

Usage
-----

Command line interface
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash

    Usage: mckit [OPTIONS] COMMAND [ARGS]...

      Tools to process MCNP models and results

    Options:
      --override / --no-override
      --version                   Show the version and exit.
      -v, --verbose               Log debugging info to stderr.  [default: False]
      -q, --quiet                 Suppress info to stderr.  [default: False]
      --logfile / --no-logfile    Log to file.  [default: True]
      --profile_mem               Profile peak memory use.  [default: False]
      --help                      Show this message and exit.

    Commands:
      check      Read MCNP model(s) and show statistics and clashes.
      compose    Merge universes and envelopes into MCNP model using merge...
      concat     Concat text files.
      decompose  Separate an MCNP model to envelopes and filling universes
      split      Splits MCNP model to text portions (opposite to concat)
      transform  Transform MCNP model(s) with one of specified transformation.


Library
~~~~~~~

The library allows subtraction and merging models, renaming objects (cells, surfaces, compositions, universes),
simplification of cell expressions (removing redundant surfaces), homogenization, computation of cell volumes and
material masses, and more.

.. code-block:: python

    LOG.info("Loading c-model envelopes")
    envelopes = load_model(str(CMODEL_ROOT / "c-model.universes/envelopes.i"))

    cells_to_fill = [11, 14, 75]
    cells_to_fill_indexes = [c - 1 for c in cells_to_fill]

    LOG.info("Attaching bounding boxes to c-model envelopes %s", cells_to_fill)
    attach_bounding_boxes(
        [envelopes[i] for i in cells_to_fill_indexes], tolerance=5.0, chunk_size=1
    )
    LOG.info("Backing up original envelopes")
    envelopes_original = envelopes.copy()

    antenna_envelop.rename(start_cell=200000, start_surf=200000)

    LOG.info("Subtracting antenna envelop from c-model envelopes %s", cells_to_fill)
    envelopes = subtract_model_from_model(
        envelopes, antenna_envelop, cells_filter=lambda c: c in cells_to_fill
    )
    LOG.info("Adding antenna envelop to c-model envelopes")
    envelopes.add_cells(antenna_envelop, name_rule="clash")
    envelopes_path = "envelopes+antenna-envelop.i"
    envelopes.save(envelopes_path)
    LOG.info("The model of HFSR in envelopes is saved to %s", envelopes_path)



Installation
------------

Installing from pypi:

.. code-block:: bash

    pip3 install mckit


Installing from github.com:

.. code-block:: bash

    pip3 install git+https://github.com/MC-kit/mckit.git


Versioning
----------

This software follows `Semantic Versioning`_

.. _Semantic Versioning: http://semver.org/


Contributors
------------

* `Roman Rodionov <mailto:r.rodionov@iterrf.ru>`_
* `Dmitri Portnov <mailto:dmitri_portnov@yahoo.com>`_

