
A MoleditPy plugin that detects rings in the loaded molecule and places ghost atoms at NICS(0) and NICS(1) probe positions for use in NICS (Nucleus-Independent Chemical Shift) calculations with ORCA or Gaussian.
Interactive 3-state sphere preview in the 3D viewport:
| Colour | Meaning | Interaction |
|---|---|---|
| Yellow (semi-transparent) | Available, not staged | Click → turns red |
| Red (semi-transparent) | Staged for placement | Click → turns yellow; Apply → places atom |
| Green | Already placed in molecule | Clear All to remove |
Ghost atom symbol selector — choose per project or set a persistent default:
| Symbol | Software |
|---|---|
Bq |
Gaussian; also valid in ORCA (default) |
H: |
ORCA native ghost atom notation |
custom_symbol atom propertyBq or H:) from the combo box.settings.json)The selected ghost atom symbol is saved to nics_placer/settings.json whenever it is changed. This is the user default — it persists across all sessions and documents.
.pmeprj project file)When a project is saved, the current ghost symbol and all placed ghost atom indices are stored in the project file. Loading a project restores both, overriding the plugin default for that session. Closing the project (File → New) reverts to the plugin default from settings.json.
Copy the nics_placer/ folder into your MoleditPy plugins directory:
moleditpy_nics_placer/
nics_placer/
__init__.py ← plugin entry point
dialog.py ← NicsPlacerDialog (PyQt6 + PyVista)
nics_math.py ← pure numpy ring geometry
settings.json ← auto-created on first symbol change (gitignored)
The test suite runs fully headless (no Qt, RDKit, or PyVista required):
cd moleditpy_nics_placer
python -m pytest tests/ -v
| Test file | Coverage |
|---|---|
test_nics_math.py |
Pure geometry: centroid, SVD normal, NICS point computation, ring extraction |
test_plugin_integration.py |
Plugin contract: save/load/reset handlers, ghost label persistence, symbol persistence |
The ring normal is computed via SVD of the mean-centred atom positions:
centered = positions - mean(positions)
U, S, Vt = SVD(centered)
normal = Vt[-1] # last singular vector = direction of minimum variance
normal /= ‖normal‖
This gives the least-squares best-fit plane normal, robust for all planar and near-planar rings.
Ghost atoms are rdkit.Chem.Atom(0) (atomic number 0, dummy atom) with SetProp("custom_symbol", symbol). The custom_symbol property is the shared convention used by MoleditPy’s XYZ Editor, ORCA Input Generator Pro, and Gaussian Input Generator Neo.
1.0.0 — HiroYokoyama