acid2pov.py -- the AICD picture: ACID isosurface with current arrows (POV-Ray)
==============================================================================
Builds the classic 3D picture of Herges' AICD program from <stem>.JCUR.vtk
written with --export-vtk jcur,acid: an isosurface of the ACID
scalar with the current-density arrows sitting on it, plus the atoms. The script
writes a POV-Ray scene (<stem>.ACID_<field>.pov) and, when povray is on the
PATH, renders it to PNG. numpy only; POV-Ray 3.7 for the rendering.

Usage
  python3 acid2pov.py STEM.JCUR.vtk [--field total|edlb|eddb|other|sel|moset]
                      [--iso 0.05] [--refine 2] [--smooth 2] [--spacing 0.5] [--arrow-scale F] [--jfield NAME]
                      [--colour uniform|sign|mag] [--sign global|ring|X,Y,Z] [--arrow-rgb R,G,B]
                      [--arrow-width F] [--style plain|aicd] [--tilt DEG] [--azimuth DEG] [--zoom F]
                      [--roll DEG] [--view tilt|top|side] [--camera X,Y,Z] [--look-at X,Y,Z]
                      [--size WxH] [--no-atoms] [--transparent] [--pov-only] [-o OUT.png]

  --field      the current: surface ACID_<field>, arrows J_<field> (total default);
               sel = the -a/-s selection, moset = the --nmr-mos set; in a scoped run
               (-f/-p/-r/-h) eddb -> ACID_EDDB_F / J_EDDB_F and edlb -> the 'rest' field
  --jfield     another vector array on the same surface, e.g. --field eddb --jfield J_total
  --iso        isolevel in a.u. of J/B (Herges' standard 0.05; the EDDB torus of
               benzene peaks at 0.056, so 0.02-0.04 for the parts)
  --refine N   resample the ACID grid N times finer (trilinear) before extracting
               the surface (default 2); --smooth K = K passes of Laplacian mesh
               smoothing (default 2): the rounded look of the AICD program at no
               extra cost; --refine 1 --smooth 0 shows the raw grid surface
  --spacing    one arrow per cube of this edge (Angstrom) on the surface; arrow
               length follows |J|, capped at 1.6 x spacing (--arrow-scale F)
  --colour     uniform (default): every arrow in one colour (--arrow-rgb R,G,B, dark
               green); the sense of the circulation is read from the arrows, as in
               AICD, and no reference centre is implied. sign: red = diatropic, blue =
               paratropic about the reference of --sign. mag: colour by |J|.
  --sign       reference of the diatropic sense (for --colour sign and the dia/para
               count printed by the script): global = molecular centre, ring = the
               nearest 5-7-membered ring centre (local ring currents), X,Y,Z = a point.
               A macrocycle with local benzene currents has no single right reference:
               about the macrocycle centre each local loop is half red / half blue,
               about the benzenes a global current would be. Hence uniform by default;
               choose the reference consciously and say so in the caption.
  --arrow-width F  thickness (1.0 = 0.025 A shaft, 0.065 A head); --arrow-scale F = length
  --surface-rgb R,G,B  surface colour (default pastel mint 0.72,0.90,0.82); --transmit F
               transparency 0 (default, opaque: the far-side arrows stay hidden) .. 1
  --style      plain (default: mint opaque surface, dark-green arrows) | aicd (gold
               translucent surface,
               green arrows: the classic Herges look)
  camera       --tilt = angle between the line of sight and the field axis n
               (0 = down the axis, 30 default, 90 = in the molecular plane,
               > 90 = from the -n side, where diatropic turns anticlockwise);
               --azimuth = rotation of the viewpoint about n; --zoom (> 1 closer);
               --roll about the line of sight; --view = presets tilt 0/30/90;
               --camera X,Y,Z = explicit position (looks at the molecular centre
               or at --look-at). The camera is ONE line of the .pov file, so it
               can be edited by hand and the scene re-rendered with povray alone.
  --size       image size (1600x1200); --transparent = transparent background
  --pov-only   write the scene, do not call povray

Examples
  runEDDB -i benzene.fchk --nics-rings 6 -a --export-vtk jcur,acid -n 8
  python3 acid2pov.py benzene.JCUR.vtk                               # total, 0.05
  python3 acid2pov.py benzene.JCUR.vtk --field eddb --iso 0.03       # the pi torus
  python3 acid2pov.py benzene.JCUR.vtk --field edlb --iso 0.05       # the sigma frame
  python3 acid2pov.py benzene.JCUR.vtk --field eddb --iso 0.03 --style aicd
  python3 acid2pov.py benzene.JCUR.vtk --field total --iso 0.05 --colour sign   # red/blue about the centre
  python3 acid2pov.py pct.JCUR.vtk --field eddb --iso 0.02 --colour sign --sign ring  # local ring currents
  python3 acid2pov.py benzene.JCUR.vtk --field eddb --iso 0.03 --tilt 60 --azimuth 20 --zoom 1.1
  povray +Ibenzene.ACID_EDDB.pov +Obenzene.png +W2400 +H1800 -D +A0.3 +FN   # re-render

Reading the picture
  The surface encloses the region where the current responds anisotropically to
  the field (Herges' "delocalized electrons"); the arrows give the sense of the
  circulation. In benzene the total surface at 0.05 shows the ring and the C-H
  bonds with an outer diatropic and an inner paratropic loop; the EDDB torus
  (0.03) is diatropic throughout, and the inner paratropic loop sits entirely on
  the EDLB (sigma) surface. ACID is quadratic in J, so the ACID of the parts does
  not add up to the ACID of the total; each surface is a picture of its own
  current. Reference: R. Herges, D. Geuenich, J. Phys. Chem. A 105, 3214 (2001).
