tutorial_TOPilot_AI
TOPilot AI in TOPAS
The VS Code topas-editor extension lets you install a set of skills to work with either Claude Code, ChatGPT’s Codex or GitHub Copilot. The skill (topas-inp-writer) has been developed by John, Alan and Oliver Wagstaff based on the TOPAS manual, the source code, this website, the wiki, other training material and 1000s of pre-existing INP files. It makes use of a library of python scripts to help with some of the topas-specific crystallography.
You should treat it as experimental and remember that you are responsible for all INP files created.
The development and testing has been done with Claude Code but the skill should work with other AI models. Copilot is currently likely to be the least well adapted of the three.
How to install and configure.
1. You will normally be asked to configure TOPilot when topas-editor updates. You should then update the topas-inp-writer skill periodically: go to the “TOPilot AI interface” menu and click “Install/update TOPAS AI skills”.
2. Information about how to configure TOPilot is in the “TOPilot help/disclaimer” menu.
3. There is information on using TOPilot on my YouTube channel.
3. You will need a Claude/Codex/Copilot account and the relevant VS Code extension installed.
4. You will need a python installation as TOPilot makes extensive use of python scripts for much of the crystallographic decision making and model testing.
5. We recommend that you don’t change the distributed topas-inp-writer skill as changes will be overwritten by updates; instead develop your own skill to work in parallel.
6. As you work with TOPilot you might like to permantly allow certain commands to avoid prompts. Claude can save your preferences in a global settings.json file.
Example use
1. In VS Code open the folder c:\users\your_user_name\.claude\skills\topas-inp-writer\test_examples. You might want to make a copy of the folder.
2. Open the “instructions.md” file in each folder. With Claude, click on the orange star in the top right of the window and ask Claude to “execute the instructions in instructions.md”. Watch what happens. You may get prompted to allow commands. At various points it will open html files with plots or other results. Each analysis might take 30 minutes to run. Start with the simplest lamno3_rietveld example.
3. There are some very short prewritten prompts you can send directly to each of the AI tools. If you have a pay-as-you go account these may be the cheapest route. These are in the “TOPilot AI Interface” menu. You can add your own commands (see instructions there).
4. Try some of the following commands on an open INP file:
- Summarise this input file
- Check the input file (e.g. add some typographical errors first)
- Set the topas hierarchy (will make nice tab indents)
- Set coordinates and cell parameters to refine as allowed by symmetry.
- Fit and plot
- Create a report of the Rietveld analysis as a word document.
- Expand INP file (expands macros and #include files)
- Add ADPs to selected sites
- Plot str in 3D (ADPs are plotted)
- Show heatmap (if you have a correlation matrix)
- Macro Browser (loads the html in TOPAS_DIR)
5. Open any folder containing a powder pattern and a structural model (e.g. in a CIF file). Ask TOPilot to “do a Rietveld fit of pattern.xy using the model in structure.cif”.
7. Try any other powder-related analysis commands you like.
8. Be very critical of any analysis performed. Check the INP files yourself and rerun them in TOPAS to test any other aspects of the model.