Code-agnostic input file format

Hello,

this is not directly related to OpenMC, but I was hoping this community might provide reasonable opinions on this. If it’s off-topic, I’d be happy to hear where to move the discussion.

Question: Is there anything like code-independant input file format for calculation codes?

Rationale

In my experience so far, almost every nuclear code had different input syntax - e.g. compare OpenMC, Serpent and Helios. I don’t like writing input files by hand, as it feels tedious, repetitive and very error-prone, especially with older codes.

Several times I have seen different scripts like convert_codeX_to_codeY.py or load_latticeCodeX_to_diffusionCodeYlibrary.py . This seems to be more DRY approach, but requires many conversion scripts.

Ideas

Defining something like “input database”, e.g. by JSON/YAML/TOML/XML configs and then having some script that load and validate it and provide API like

assembly = FuelAssembly("my_fa.yaml")
assembly.to_openmc()
assembly.to_serpent()
assembly.to_mcnp()
assembly.to_openmoc()

would be great. Do you know if anything like this exists so far? I don’t want to re-invent the wheel, I’m pretty sure someone has thought about this already.

Or even better, would there by code-agnostic input file format? E.g. one input that would work for multiple codes?

Research

I prompted some AI chat about it and it mentioned

  • DAGMC - mentioned to be great for geometry portability, but it does not describe materials etc.
  • OpenMC’s Model class - one would just have to implement Model.to_codeX()
  • ARMI (Advanced Reactor Modeling Interface) -I’ve never used it - does anyone have experience?

My idea

I was wondering if creating blueprints using OpenMC Python API and Pydantic models could be reasonable. It would be great for validation of user input and automatically exporting JSONSchema, which can be later used for IDE support. Downside of this would be still the tedious Model.to_codeX() approach. Has anyone done something similar already?

Thanks for any opinions on this.

It’s a compelling idea and you’re not the first one or the last one to think about this (the thought has crossed my mind many times). As you suggest, conceptually it wouldn’t be difficult to have the Model class in OpenMC have export_to_mcnp, export_to_serpent, etc. methods that would write out those formats. The problem is that OpenMC developers understandably don’t really want to maintain those methods just for the sake of running in another code. We do have MCNP and Serpent input converters, but they only convert one way (to OpenMC).

So, I think you’d really need to have a separate API/format that converts to all relevant codes, and in that case the challenge is dealing with the idiosyncracies of each code. The hardest part of all is getting buy-in from the community and attracting real users. MCNPy I think was kind of intended to be this but never got much traction as far as I’m aware.

One data point on a third route: a plain-language spec as the “neutral format,” with an LLM writing the code-specific input. I benchmarked this for OpenMC shielding problems (nine models, three vendors). The catch is verification: many inputs that ran without error had the wrong physics, and some never ran the calculation at all. Whatever the format, each code’s output still has to be checked against a reference case.

Paper: DOI 10.5281/zenodo.23067522

Relevant XKCD xkcd: Standards

Paul’s buy-in point is the real bottleneck; MCNPy’s fate suggests a full multi-code abstraction can’t rely on volunteer maintenance. One pragmatic route: keep the neutral schema deliberately thin — geometry, materials, temperature, source — and give code-specific settings a passthrough/escape-hatch block. Then each converter stays small enough for one person to own. On alanhalley’s verification worry, converters should ship with a reference case per code (same simple assembly, compare keff within statistics) so a broken translation fails loudly instead of silently running wrong physics.