TOPAS LCCEM
Menus, snippets, CIF/checkCIF tools and INP-template customizations used at LCCEM (Laboratório de Cristalografia e Caracterização Estrutural de Materiais, UFABC, Brazil) with TOPAS-Academic in Visual Studio Code.
TOPAS LCCEM works on top of the TOPAS Editor extension by John Evans, which is installed automatically as a dependency.
Features
A TOPAS_LCCEM menu is added to the TOPAS Editor menus, organised by workflow:
| Menu |
Contents |
| 1. Rietveld or Pawley INP file |
New INP from a data file; instrument blocks for the Stoe STADI-P (Cu, Mo, Ag, transmission, Ge(111) monochromator, Mythen 1K); zero-error and sample-shift corrections; phases from CIF, str/ISODISTORT or by hand; Pawley phase; preferred orientation (March–Dollase, spherical harmonics) |
| 2. Peak Fitting |
Peak-fitting INP, STADI-P instrument parameters, xo_Is peak-fitting block |
| 3. Indexing |
Indexing template INP |
| 4. Anisotropic Broadening |
Anisotropic size (general, AnisoCS) and strain (spherical harmonics; Stephens model for tetragonal, monoclinic, hexagonal/trigonal, orthorhombic) |
| 5. LCCEM Validation |
Extract Rietveld Stats: builds <name>_complete.cif from the open .inp and its .out/.cif/.fcf (publication boilerplate, R-factors, cell, reflection list and, when TOPAS can be run, bonds/angles). Rietveld → CheckCIF Report: reveals that CIF in Explorer and opens checkCIF in the browser. |
| 6. Structure Determination (SDPD) |
Step-by-step structure solution from powder data. Each item reads the open INP (or its newer .out) and writes the next one: 1 peak-fit INP, instrument, xo_Is block, and GUI peaks → refinable for the Position/Area columns copied from the TOPAS GUI; 2 peak fit → indexing INP; 3 indexing solution (chosen from the .ndx in the terminal) + space group → Pawley INP; 4a Pawley + .mol → simulated-annealing INP (z-matrix rigid body, free torsions, Auto_T); 4b Pawley → charge-flipping INP (Pawley A matrix); 4c Pawley → simulated annealing with free atoms and occ_merge, for inorganic structures; 5 SA result (or CF/Pawley) → Rietveld INP with CIF/FCF output. SDPD – where am I? lists the files of the sample and the next step. SDPD tutorial (Português / English) opens the step-by-step tutorial (worked examples: BES, molecular, and CsPbBr₃, inorganic) in the browser; Tutorial data: … -> copy to a folder copies the data files of each example to a folder of your choice. |
| 7. Microstructure (EnvACS) |
Crystallite-size distribution from the Bragg profile with the EnvACS envelope (Gesing & Robben, J. Appl. Cryst. 57 (2024) 1466; Howell n/D model) as size Fourier coefficients. Snippets for the sample term EnvACS(Dm, …, n, …) and for a fixed instrument residual refined on LaB₆. EnvACS: report of the open file writes <file>_envacs.html/.csv and opens an interactive report (Dm, n, mode, σ, LVol, LArea, fit, envelope, volume- and number-weighted distributions); + G(r) comparison also applies the original G(r)-maxima procedure to a chosen G(r). Install EnvACS macros in TOPAS copies envacs_howell.inc and adds it to local.inc (once per computer). |
| 8. Total Scattering / PDF (G(r)) |
From a converged Rietveld refinement to the pair distribution function with TOPAS's own Include_PDF_Generate: operation 0 (reciprocal-space fit with the empty capillary), operation 1 (F(Q) and G(r), with a report), operation 2 (Qdamp/Qbroad on a standard, then the structure of the sample against G(r)) and EnvACS on the G(r). The standard is remembered per wavelength. PDF guide (Português / English) opens the guide in the browser. |
SDPD file chain
Files are written next to the data, never overwriting (_01, _02, …):
<base>_pkfit_NN.inp → <base>_indx_NN.inp (+ .ndx) → <base>_pawley_NN.inp (+ .a) → <base>_sa_NN.inp or <base>_cf_NN.inp → <base>_riet_NN.inp.
Each file starts with ' LCCEM-SDPD stage/parent/pkfit/pawley/data: lines, and the instrument, cell, peak shape and structure are kept between '<<instrument>> … '<</instrument>>-type markers, which the next step copies. Keep those lines when editing.
The instrument snippets describe the LCCEM diffractometers; users of other instruments can use them as a starting point.
INP-template customizations
TOPAS LCCEM adjusts the text that TOPAS Editor writes into new INP files:
- new INP header with one R-factor per line,
macro ciffile { <name>.cif }, do_errors and no_LIMIT_warnings;
Out_pdCIF writes to the ciffile macro;
- phases imported from CIF get
Phase_Density_g_on_cm3(0) and a tidier layout;
- the default
TCHZ_Peak_Type line is inserted commented out (the instrument block defines the peak shape);
- background written one coefficient per line, without
Simple_Axial_Model.
These changes are made to TOPAS Editor's own dist/extension.js (the original is kept as extension.js.orig) and are re-applied automatically after every TOPAS Editor update. If a new TOPAS Editor version changes the relevant code, nothing is modified and a warning is shown.
Don't want them? Set topasLccem.applyEdits to false, or run TOPAS LCCEM: Disable edits and restore original TOPAS Editor files. The original TOPAS Editor files are restored and the menus keep working.
Requirements
- TOPAS-Academic (licence required) and the TOPAS Editor extension (installed automatically).
- Python 3 for menus 5. LCCEM Validation, 6. Structure Determination (from item 1d on), 7. Microstructure and 8. Total Scattering / PDF (python.org; tick "Add python.exe to PATH", then restart VS Code; check with
python --version in a VS Code terminal). Menus 5 and 6 use only the standard library; menus 7 and 8 also need numpy (python -m pip install numpy).
Getting started
- Install TOPAS LCCEM from the Extensions panel (this also installs TOPAS Editor). On the extension page, keep Auto Update ticked: new versions are then installed automatically and take effect after Developer: Reload Window.
- Complete the TOPAS Editor setup when asked (choose your TOPAS directory).
- When "TOPAS LCCEM: … Reload the window to use them." appears, click Reload now.
The LCCEM menus then appear together with the TOPAS Editor menus. If TOPAS Editor's own "menu setup" is run later, the LCCEM menus are restored automatically.
Commands
| Command |
What it does |
TOPAS LCCEM: Reapply edits and menus |
Re-applies the template customizations and the LCCEM menus |
TOPAS LCCEM: Disable edits and restore original TOPAS Editor files |
Sets topasLccem.applyEdits to false and restores TOPAS Editor's original files |
Settings
| Setting |
Default |
Description |
topasLccem.applyEdits |
true |
Apply the INP-template customizations to TOPAS Editor |
topasLccem.scriptsDir |
(empty) |
Folder with the LCCEM Python scripts; empty = use the copy bundled with the extension |
Troubleshooting
View → Output → TOPAS LCCEM shows what the extension did (edits applied or already present, menus updated, errors). Please include it when reporting a problem.
About
Developed at LCCEM, Federal University of ABC (UFABC), Brazil.
Contact: Fabio Furlan — lccem.ufabc@gmail.com
TOPAS Editor is developed by John Evans (Durham University); TOPAS-Academic by Alan Coelho. TOPAS LCCEM is an independent add-on and is not affiliated with either.
Released under the MIT License.
| |