For writing a new BornAgain script, or for adapting an existing example to the problem, we recommend asking a large language model (LLM) — ChatGPT, Claude, Gemini, Grok, or any comparable assistant.
This applies to newcomers and to experienced users alike. Both modes work well:
BornAgain is open source. The complete source tree — core, Python API, and the example library — is publicly readable. That is the decisive advantage:
In other words, the LLM gets the full context of BornAgain’s API.
The single most important step is to pin the LLM to the installed BornAgain version. Otherwise it may mix in constructs from old releases, or invent things remembered from unrelated projects.
The prompt should include two links pointing to the installed version:
https://jugit.fz-juelich.de/mlz/bornagain/-/tree/v24.0,
which gives the LLM access to the complete library and to the
example scripts;https://bornagainproject.org/24/,
which gives it the prose explanations, conventions, and tutorials.Modern web chat assistants can follow these links and read what they find there. Agentic assistants additionally have direct access to the local source tree, which works even better.
I am writing a Python script using BornAgain version
24.0. Please use only constructs that are valid in this version. Source code:https://jugit.fz-juelich.de/mlz/bornagain/-/tree/v24.0. Documentation:https://bornagainproject.org/24/.The script should ⟨describe your simulation or fit here⟩. Start from the example that most closely resembles this problem, and adapt it.
The prompt can be refined iteratively: by asking for explanations, alternative formulations, more comments, a different plotting style, wrapping the simulation in a fit, and so on.
Given the open source code as context, an LLM is genuinely good at producing correct, idiomatic BornAgain scripts — often faster and more reliably than working through the documentation page by page. The quality of the answer depends on the available context, and for BornAgain that context is public and complete.
LLMs still make mistakes, and the BornAgain Python API evolves between releases. As always: