GithubHelp home page GithubHelp logo

gdnp's Introduction

GDNP

(GDML to MCNP converter)

Warning : this is a work in progress. See the Contributing section.

Description

The gdnp.py Python script converts a GDML geometry description to an MCNP card. Usage is as following:

./gdnp.py FILE.GDML

This will dump the result to stdout. Optionally, an output file can also be provided as 2nd argument:

./gdnp.py FILE.GDML MCNP.CARD

An example of converted geometry is available in the examples folder. The corresponding input GDML is also provided.

Note that the script is implemented in bare Python 2.7, i.e. without dependencies. However, note also that it was only tested on Linux so far.

Contributing

Currently, the converter only supports a limited number of GDML geometries: tube (closed, centered), ellipsoid and intersection. Rotations are not implemented as well. In addition, the materials data needs to be manually filled in at the end of the card. Note that the materials index are properly mapped, though.

Additional geometries can be added by defining a convert_gdml_{{volume}} function, where {{volume}} must be substituted by the GDML name of the volume to convert. This function must return the MCNP bounding surfaces of the volume as a list of tuples. See for example the convert_gdml_tube function. The snippet below illustrates the syntax by converting a GDML centered Orb:

def convert_gdml_orb(volume, placement):
    """Convert a centered GDML orb to MCNP surfaces
    """
    r = volume["r"]
    if (placement[0] != 0) or (placement[1] != 0) or (placement[2] != 0):
        raise NotImplemented("offset orb")
    else:
        return [(-1, "SO", r)]

Each line of the returned list corresponds to a bounding surface. Note that the first item of the surface definition must indicate the surface sign for being inside the volume, see e.g. pages 3 and 4 of the MCNP primer.

License

The gdnp.py utility is under the MIT license. See the provided LICENSE file.

gdnp's People

Contributors

niess avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.