c2x(1)

๐Ÿ“ฆ
version 2.42.a ยท 5 versions
, in ubuntu resolute, ubuntu stonking

โœจ c2x โœจ (section 1 of the manual, bestie)

okay so this is c2x(1) โ€” it lives in the General Commands Manual and it is, no exaggeration, the most chaotic little format-goblin you will ever meet. buckle up ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

c2x โ€” converts various crystal formats including density grid data ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

c2x [-OPTIONS] [--FORMAT] [--OPERATION] infile [outfile]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so c2x converts, like, primarily a CASTEP .check file into a whole bunch of output formats, and on top of that it extracts densities (charge, spin, band or psi โ€” pick your poison) and forces. main character energy fr fr ๐Ÿ‘‘

it can also read CASTEP .cell files and PDB files, Onetep .dat files, and several input and output files from Abinit, Quantum Espresso, Siesta and VASP, with some support for Elk too. think of it as a sort of Babel with support for gridded data and .check files, plus the ability to transform cells and do simple analysis (integration, interpolation, dipole moment calculation, band parity identification). it's giving swiss army knife but make it crystals ๐Ÿ”ฅ

it may have been compiled to give access to symmetry functions from spglib too. so if the symmetry stuff works, that's why ๐Ÿ’…

for a full list of supported formats, run c2x with the --formats option. do it. it's iconic.

now the โœจvibe checkโœจ on how it guesses your format from the filename, because this is genuinely important:

  • a file whose name ends .pdb is assumed to be in pdb format
  • ending in .cif โ†’ assumed to be in cif format
  • ending in .res โ†’ assumed to be in shelx97
  • ending .cub or .cube โ†’ assumed to be in cube format
  • ending .in โ†’ assumed to be an Abinit or Quantum Espresso input file
  • ending .xml โ†’ assumed to be a Quantum Espresso output file
  • ending in .xsf โ†’ assumed to be in xsf format
  • ending in .xv or XV โ†’ assumed to be in Siesta's XV format
  • input files ending CHG, CHGCAR, POSCAR, CONTCAR, LOCPOT or WAVECAR โ†’ assumed to be in VASP 5.x format
  • input files ending in DEN, ELF, POT or WFK โ†’ assumed to be in Abinit format
  • otherwise, if the first byte is either zero, 10 or 30 it is assumed to be a .check file, else it is assumed to be a .cell file ๐Ÿซถ

it can also read .orbitals files (which are identical to .check files in format), and .castep_bin files (which lack wavefunctions). furthermore, it can read .chdiff files and .cst_esp files. in these cases it needs a .cell or a .check file as well in order to obtain unit cell information. so don't come for it with just the one file, it needs a buddy ๐Ÿ˜ญ


โœจ OPTIONS โœจ

so many flags. every single one. let's go ๐Ÿ’…

  • -a โ€” rotate as though outputing in abc format, i.e. place a along x axis, b in xy plane, and abc form a right hand set. useful if one wants a dx file consistent with a pdb file. see also -3. ๐Ÿ‘‘
  • -A โ€” accumulate (sum) bands requested by -b= or -B=.
  • -b[=range] โ€” include specified bands as psi (real).
  • --bands_fmt โ€” plot band diagram, fmt is one of gnu (gnuplot) or eps. optionally append _ns to prevent the identification of special points. c2x's identification of special points is incomplete. (its words, not mine, bestie ๐Ÿซถ)
  • --bravais[=(k1,k2,k3)] โ€” report Bravais lattice detected, and report label for optional special point.
  • -B[=range] โ€” include specified bands as densities (psi*conjg(psi)).
  • -c โ€” include charge density (units electrons per cubic Angstrom).
  • --calc โ€” evaluate next arg with arithmetic parser and exit.
  • --constants โ€” report internal conversion constants and exit.
  • --cubic โ€” equivalent to --simpson --tricubic.
  • -C โ€” find "compact" (near-cubic) set of cell vectors.
  • -d โ€” read also a corresponding .chdiff file, and output its contents. the filename given must still be that of a .cell or .check file, as a .chdiff file contains no axes.
  • --div โ€” replace a vector dataset with its (scalar) divergence.
  • --dos_fmt[=s][:n][flags] โ€” produce a Density of States plot. fmt is one of eps, gnu (for gnuplot) or raw. Gaussian smearing width of s eV, number of bins is n. valid flags are:
    • a (add all spins together)
    • g (adjust smearing to preserve gaps)
    • G (always use Gaussians, not tetrahedra)
    • m (mirror plot)
    • r (rotated plot, eps only)

Bloechl's tetrahedron method is used if a regular grid is detected unless the G flag is present. ๐ŸŒˆ

  • -D=[x,y,z] โ€” if charge density read (-c), calculate dipole moment about fractional co-ordinates x,y,z, or 0.5,0.5,0.5 if co-ordinates not given. assumes density has been read as eA^-3.
  • -Da=[x,y,z] โ€” as above, but also report post-hoc energy correction for slab geometry for the a axis being the non-periodic axis. valid values of a: a, b and c.
  • -Dm=[x,y,z] โ€” as above, but also report post-hoc energy correction for a molecule in a cubic box, or for a molecule in a tetragonal box if dipole moment is parallel to c.
  • -e โ€” read also a corresponding .cst_esp file, and output its contents. the filename given must still be that of a .cell or .check file, as a .cst_esp file contains no axes.
  • -e=tol โ€” set symmetry tolerance to given number of Angstroms.
  • -E[=[-][mu]] โ€” calculate electrostatic potential, assuming that an electron density has been read (implies -c). ions are treated as Gaussian blobs of charge of extent exp(-mu^2r^2). if the ionic charge differs from the atomic number, a further localised smoothing of the atomic potential occurs, unless the first character after the = is -. with -E=0, a bare Coulomb potential is used.
  • -f โ€” calculate first failure start of k-point set.
  • --fbz โ€” calculate first Brillouin zone.
  • --fft โ€” use FFT interpolation to move gridded data between different unit cells, and with -z.
  • --formats โ€” list supported formats.
  • --frame=N โ€” extract single frame from series of time steps. frames are numbered from zero, and negative numbers represent offsets from the end of the sequence, so --frame=-1 will extract the final frame. (negative indexing, we love to see it ๐Ÿ’…)
  • -F โ€” calculate the potential, then its gradient, to give an electric field.
  • --gap โ€” print band gap in eV.
  • --grad โ€” replace a scalar dataset with its (vector) gradient.
  • --grad2 โ€” replace a scalar dataset with the result of the Laplacian operator.
  • -H โ€” shift atoms by half a grid cell. for use with xplor data format, see below.
  • -i=nx,ny,nz โ€” Fourier interpolate onto specified grid size. new grid may be coarser or finer than original. any dimension given as zero is replaced by old grid size. if reading wavefunction, any grid truncation is done after transforming back to real space and converting to density etc.
  • --ibz โ€” calculate irreducible Brillouin zone.
  • -I[=range] โ€” report whether bands have inversion, and parity under inversion. if combined with -b or -B, the last range given is used.
  • -k[=range] โ€” include given kpoints for bands (default range is 1).
  • -l โ€” if k-points are to be included in a .cell file, explicitly list them rather than using the MP generation parameters.
  • --ldos=spec โ€” in combination with --dos, locally project DoS. the spec is in one of the below forms:
    • f1-f2a defines a slab. the final character, from the set abcABC, gives the axis. if the axis is lowercase, f1 and f2 are in fractional co-ordinates. if uppercase, Angstroms.
    • {atom}:{radius}[+{atom}:{radius}[+...]] (a,b,c):{radius}[+...] defines one or more spheres, radii in Angstrom, or in Bohr if B is suffixed. co-ordinates are fractional. if {atom} is an atomic symbol, the first such atom is used. suffix with an integer to select a particular atom, or with a * to select all atoms of that species. e.g.
--ldos=Fe1:0.8+Fe2:0.8
--ldos=Fe*:1.6B
  • {atom}:r{r1}-{r2}[a|b|c] (a,b,c):r{r1}-{r2}[a|b|c] M:r{r1}-{r2}[a|b|c] defines a cylindrical shell. co-ordinates give centre of cylinder, with M being (0.5,0.5,0.5). the :r identifies this as a cylindrical projection. radii in Angstrom unless each is suffixed with B. final letter gives the axis, with c assumed if absent.
  • -L โ€” output in abc format assuming that abc describes a left-handed set of axes.
do not use this unless you understand why you should not! ๐Ÿšจ for real for real, this one is a trap and it is telling you so.
  • -m[=a,b,c] โ€” assume input is molecule, not crystal. try to avoid outputing a cell, shift if some co-ordinates are negative, or if a,b,c given shift by those numbers of FFT grid cells.
  • -m=(a,b,c) โ€” assume input is molecule, not crystal. try to avoid outputing a cell, shift atoms by fractional co-ordinates given.
  • -n โ€” discard symmetry information, and, if output is XSF, discard forces. give twice to discard k-points too.
  • -N โ€” normalise by reducing fractional coords to 0<=x<1. in conjunction with -m, do output a cell.
  • -O โ€” print band occupancies and evalues to stderr.
  • -P โ€” find primitive cell with own internal algorithm, not spglib.
  • -P=p1:p2:nn โ€” output data as line of nn points from p1 to p2. express p's as either fractional co-ordinates in the form (x,y,z), or an atom position as, e.g., Si3 for silicon atom number 3, or simply Si for the first Si atom. using a 0 (zero) for a p is equivalent to (0,0,0), and the three cell axes "(0,0,0):(1,0,0):ngx+1" (etc.) can be specified as a, b and c. each co-ordinate is passed to the arithmetic parser, so 1/3 is acceptable for a third, etc. ๐Ÿ’…
  • -P=p1:rl[a]:nn โ€” output data with cylindrical averaging. p1 is the centre of the cylinder, rl (literal r, followed by a length, suffixed by B if Bohr) is the radius, and nn the number of points. the axis of the cylinder is given by the optional character a, and defaults to c if not given. the other axes must be perpendicular. data are averaged over the cylinder's axis and theta. append w to number of points to weight samples by two pi times radius, or a to weight and accumulate.
  • -P=p1:Rl:nn โ€” output data with spherical averaging. p1 is the centre of the sphere, Rl (literal R, followed by a length, suffixed by B if Bohr) is the radius, and nn the number of points output. the number of points for sampling around the spherical surface is chosen to give a similar point separation to that along the line. a length of zero will set the length to the maximum possible given the periodicity. data are averaged over theta and phi. append w to number of points to weight samples by four pi times radius squared, or a to weight and accumulate. ๐ŸŒธ
  • -q โ€” calculate post hoc energy correction for charged isolated system. implies -c.
  • -q[abc] โ€” calculate post hoc energy correction for charged 2D system. the axis given (a, b or c) is the aperiodic one. implies -c.
  • -Q โ€” sort the atoms on output in descending atomic order.
  • -Q2 โ€” sort the atoms on output in ascending atomic order.

okay bestie that's not even the whole options list, we are literally mid-flag right now โ€” the page keeps going, so hold that thought ๐Ÿ’œ

  • -r โ€” only reduced (symmetry inequivalent) atoms in cif output, or, if you're rolling with --fbz or --ibz, reduce k-points down to the relevant zone and adjust the weights accordingly ๐Ÿ’…
  • --rhs โ€” if you've got left handed axes, this makes them right handed by exchanging the second and third axes. And if you also pass -3, the exchange is of the first and second axes instead. K-points, symmetry operations and grid data all get converted. no cap โœจ
  • -R โ€” don't even try to rescale densities, just output them raw. Charge density becomes electrons per unit cell if you're reading from Castep, for instance. Also: no attempting to adjust radius to maintain bond length when you're making a nanotube. raw is raw bestie ๐Ÿ’€
  • -R=x โ€” rescale grid data by factor x, not whatever factor (if any) would normally get used. And if that factor is suffixed with an "x", then yes, do include c2x's usual conversion factor too ๐ŸŽ€
  • -s โ€” include spin density (scalar or vector).
  • --simpson โ€” use Simpson's rule for accumulating/integrating, not trapezium rule. fancy math slay ๐Ÿ”ฅ
  • --sym_list โ€” list symmetry elements found in input, without calling SPGlib.
  • -S[=range] โ€” include specified spins or spinors for bands (default range is -, and the spins are numbered 0 and 1).
  • -t=(x1,y1,z1)(x2,y2,z2)[(x3,y3,z3)] โ€” rotate the co-ordinate system so that the first vector becomes the second. First vector given in relative co-ordinates. If a third axis is given, it's used as the rotation axis. Otherwise the rotation axis will be perpendicular to the two axes given.
  • --title=str โ€” set title. cute ๐ŸŽ€
  • --tricubic โ€” when interpolating, use tricubic (spline) interpolation in place of trilinear interpolation. Slower, might not preserve monotonicity, but it does keep the first derivative continuous. it's giving smooth โœจ
  • -T=(x1,y1,z1)(x2,y2,z2)[(x3,y3,z3)] โ€” rotate the co-ordinate system so that the first vector becomes the second. All vectors given in absolute co-ordinates. If a third axis is given, it's used as the rotation axis. Otherwise the rotation axis will be perpendicular to the two axes given.
  • -u โ€” use atomic units (Bohrs) when writing .cell files and 1D data. Scale densities from A^-3 to Bohr^-3 when writing .cube files.
  • -U โ€” scale densities from Bohr^-3 to A^-3 when reading .cube files.
  • -v โ€” be verbose. Far too much output can be generated if specified more than twice. ๐Ÿ˜ญ you have been warned
  • --vec2force[=[species[,species]:]r[i][f]] โ€” convert vector field to "forces" on each atom. Use the value of the vector at the atom, unless =r is given, in which case average over a sphere of radius r (Angstroms, unless suffixed with B for Bohr). If i is given, integrate rather than average. If f is given, use a finer grid for averages/integrals. The f may be repeated. If species is given, limit "forces" to the given atomic species. See also --cubic. ๐Ÿฆ‹
  • --version โ€” print version information. If preceeded by -v, also print internal conversion factors. (yes, "preceeded" โ€” that's how the manpage spells it, we're keeping it ๐Ÿ’–)
  • --vmod โ€” replace vector grid data by its scalar modulus.
  • -w โ€” weight bands by occupancies, or sqrt(occ) if not calculating density.
  • -w=k โ€” weight bands by k-point weight, but not occupancy.
  • --widths โ€” calculate band widths naively. Makes sense only if bands do not cross. โš ๏ธ like, only if they don't cross, bestie
  • -W โ€” weight bands by occupancies and k-point weight, or sqrt thereof if not calculating density.
  • -x=(x1,x2,x3)(y1,y2,y3)(z1,z2,z3)[:n1xn2xn3] โ€” expand unit cell to a new cell specified in terms of the old cell axes. Each co-ordinate is passed to the arithmetic parser, so 'sqrt(3)/2' etc is acceptable. Optionally also specify new grid size for gridded data, else this is calculated automatically. math girlies rise ๐ŸŒธ
  • -x=ixjxk โ€” expand cell with a trivial tiling.
  • -X=(x1,x2,x3)(y1,y2,y3)(z1,z2,z3)[:n1xn2xn3] โ€” expand unit cell to a new cell specified in absolute co-ordinates. Optionally also specify new grid size for gridded data, else this is calculated automatically.
  • -X[abc]=x โ€” change the given axis/axes to a new length by inserting / removing vacuum around the origin. Removing non-existent vacuum will produce nonsense. ๐Ÿ’€ Length may be suffixed with B (for Bohr) or nm.
  • -y=i,j[:x] โ€” make nanotube. The input cell must have c perpendicular to the ab plane, and c as the nonperiodic direction of the sheet to be rolled. The circumference is then defined by the vector i*a+j*b. The vector along the tube's length is found automatically, and the size of the cell perpendicular to the tube's length is given by the optional parameter x, which may be suffixed with B (for Bohr) or nm. nanotube era ๐Ÿงš
  • -z=p1 โ€” print to stdout data at the given point, and set output type to null. For specification of p1, see the -P= option.
  • -Z=p1 โ€” ditto, but assume that data represents an electron density in A^-3, and also output Perdew Zunger 81 XC energy.
  • -3 โ€” when moving from a left hand set of axes to a right hand set, rather than exchanging the 2nd and 3rd axes, preserve the 3rd and exchange the 1st and 2nd. This transformation is required if the input is cartesian and left handed, and an abc output is requested. Specifying this flag twice will cause the 1st and 3rd axes to be exchanged. ๐Ÿ‘‘

๐ŸŒˆ COMBINING OPERATIONS ๐ŸŒˆ

The following options expect multiple input files to be given, and perform the specified operation. group project but it actually works ๐Ÿซถ

  • --add โ€” Add datasets element-wise.
  • --diff โ€” Subtract datasets element-wise.
  • --mask โ€” Multiply datasets element-wise. Although it is assumed that one dataset will be a mask of ones and zeros, it need not be so.
  • --merge โ€” Merge datasets. The expected use is merging an atoms-only format with a density-only format to create an output containing both atoms and density. โœจ the glow-up merge
  • --merge_path โ€” Bandstructure or path data from second dataset will be merged into the first as path data.
  • --mult โ€” Alternative for --mask.
  • --sub โ€” Alternative for --diff.
  • --sum โ€” Alternative for --add.

When merging, if files contain conflicting data, the one on the right usually has precidence. (again, keeping the spelling fr fr)

When performing operations on grids, the grids must be the same size. The use of -i may assist. In all cases, the cells must be the same.

โš ๏ธ bestie the cells must be the same. no exceptions, that's the vibe check.

๐Ÿ’– FORMATS ๐Ÿ’–

The following output formats are recognised. (See the output of the --formats option for the complete list. Most are also recognised for input provided that their filenames have the expected suffix.) it's giving a whole wardrobe of formats ๐Ÿ‘‘

  • --abinit โ€” Abinit .abi file (for Abinit version 9 and beyond).
  • --abinit8 โ€” Abinit .in file. The output is insufficient to be a valid input file to Abinit, but can easily be made so.
  • --bands โ€” CASTEP .bands file, no sorting of bands.
  • --bxsf โ€” XCrysDen / FermiSurfer file for plotting Fermi surfaces. A symmetry-reduced kpoint set will be expanded. (Not accepted as input.) ๐Ÿšซ no takebacks
  • --ccp4 โ€” CCP4 density map format. Note no atomic positions can be recorded in this format, and c2x will always produce a right-hand set of axes unless the input is a lhs and the option -L is given.
  • --cell โ€” CASTEP .cell, cartesian cell, fractional co-ordinates.
  • --cell_abc โ€” CASTEP .cell, abc cell, fractional co-ordinates.
  • --cell_abs โ€” CASTEP .cell, cartesian cell, absolute co-ordinates.
  • --cell_abc_abs โ€” CASTEP .cell, abc cell, absolute co-ordinates.
  • --chgcar โ€” VASP 5.x chgcar output.
  • --cif โ€” a very basic and rigid format which may be compatible with some CIF-reading software. (lowkey rigid, highkey works)
  • --cml โ€” Chemical Markup Language.
  • --cube โ€” Gaussian cube. Atoms and at most one data set.
  • --dx โ€” Data Explorer. Data set only.
  • --denfmt โ€” CASTEP formatted density
  • --elk โ€” Elk elk.in format.
  • --fdf โ€” Siesta. If a density has been read, a corresponding .RHO file will be written.
  • --gcoeff โ€” An ASCII wavefunction coefficient representation
  • --gcoeff_sorted โ€” The same, sorted by |g|
  • --gnu โ€” Gnuplot command file for 1D data.
  • --jmol_recip โ€” Jmol output for Brillouin zones (with --fbz or --ibz only).
  • --npy โ€” Numpy array, single dataset, as doubles with -15, else single precision.
  • --null โ€” Null output. Throw away all output, but still write some useful information the input to stderr. ๐Ÿ’€ yeet
  • --one โ€” Onetep .dat, very similar to .cell. Also one_abc, one_abs, and one_abc_abs.
  • --pdb โ€” PDB
  • --pdbn โ€” PDB, but label the atoms with element symbol and number within that species, e.g. C8, H24, Ca2, rather than just with element symbol. The whole string can contain no more than four characters, so * is used for the numeric part if it would not otherwise fit. four chars max bestie ๐ŸŽ€
  • --py โ€” a python dictionary, compatible with the Atoms data structure from ASE.
  • --pya โ€” a python ASE Atoms data structure.
  • --qe โ€” Quantum Espresso. Non colinear spins not supported.
  • --qef โ€” Ditto, atoms in fractional co-ordinates.
  • --shelx โ€” a subset of the SHELX97 format.
  • --vasp โ€” VASP 5.x output (poscar or chg).
  • --verts โ€” raw list of vertices for Brillouin zones (with --fbz or --ibz only). Also --verts_frac for vertices in fractional coordinates.
  • --vmd_recip โ€” VMD output for Brillouin zones (with --fbz or --ibz only).
  • --xplor โ€” Xplor format. Data set only. The grid used in this format is offset by half a grid cell compared to Castep, and as interpolating is inexact, this program does not in this case. Also the grid axes are described in terms of a, b, c, alpha, beta, gamma, so information about orientation in space is lost. To produce a compatible pdb file of atomic co-ordinates, specify -Hc when creating the pdb file. ๐Ÿ˜ญ so much lore
  • --xsf โ€” XCrysDen format. Default. The only format in which multiple data sets are supported. ๐Ÿ‘‘ main character format
  • --xv โ€” Siesta's .XV format (positions only, velocities written as zero). Will also write a .RHO file if grid data have been read. On reading, will also read a FORCE_STRESS if present. Note that FORCE_STRESS has no prefix.
  • --xyz โ€” XYZ format. Atoms only, no unit cell.

Where a range is required, it can be specified as a single integer, two integers separated by a hyphen (all integers in the given range), or a comma-separated list of any of these elements. Only for the xsf output format is a range including more than a single integer meaningful. ๐ŸŒธ

๐Ÿ› ๏ธ OPERATION ๐Ÿ› ๏ธ

okay so if your c2x got compiled with spglib riding along, then bestieโ€ฆ a whole lil suite of spglib operations opens up for you. here's the tea:

  • --int โ€” runs spg_get_dataset() and reports back the international symbol โœจ
  • --list โ€” runs spg_get_dataset() and lists out the symmetry ops for you
  • --point โ€” runs spg_get_dataset() and then follows up with spg_get_pointgroup()
  • --primitive โ€” runs spg_find_primitive(), which is equivalent to spg_standardize_cell(to_primitive=1, no_idealize=0). heads up: this may rotate the cell to a standardised orientation ๐Ÿ”„
  • --primitive_nr โ€” runs spg_standardize_cell(to_primitive=1, no_idealize=1), so likeโ€ฆ primitive, no rotation. periodt.
  • --refine โ€” runs spg_refine_cell()
  • --schoen โ€” runs spg_get_schoenflies()
  • --snap โ€” runs spg_standardize_cell() and then expands back out to a snapped version of the original cell ๐Ÿซฐ
  • --snap_tr โ€” ditto bestie, but this time it includes any translation introduced by spglib
  • --standardise โ€” runs spg_standardize_cell(no_idealize=1)
  • --std_ideal โ€” runs spg_standardize_cell(no_idealize=0)
  • --symmetry or --symm โ€” runs spg_get_dataset() and keeps the symmetry ops

๐Ÿ“ NOTES ๐Ÿ“

okay this is the part where we get into the โœจdetailsโœจ so lock in.

For the pdb formats, literally just the unit cell and the atomic positions get read or written. that's it. For the dx and xplor formats, just a single data set is written. For the Gaussian cube format, atomic positions and at most one data set are recorded. And for the XCrysDen format? unit cell, atomic positions, forces, and any number of data sets get recorded. she does the most ๐Ÿ’…

When you're reading a .geom file and writing out a format that holds a single frame, the last frame is what gets written โ€” unless you pass the --frame option, then it's whatever you asked for.

When it reports symmetry operations, all co-ordinates are fractional. noted ๐Ÿ“Œ

no cap, the pdb format has a very low precision for storing co-ordinates. and because it stores the unit cell in abc format while the atoms go in absolute coordinates, a rotation is likely gonna be required to place a on the cartesian x axis, etc. if so, it gets done automatically. same deal for the abc varients of the cell format and for the Xplor and cif file formats. for other formats, you can specify that rotation explicitly. additionally, the axes must form a right-handed set. if they don't? two axes get interchanged. by default, b and c are the ones exchanged, but the flag -3 will cause a and b to be exchanged instead.

The cif reader reads little more than c2x's own cif output. it is very basic, and it will fail to read correctly a large number of valid cif files. and ngl there is currently no intention to produce a proper cif reader. she said what she said ๐Ÿ™ˆ

When outputting psi, it's assumed that it's possible to make psi real by unwinding any phase produced by the k-point, and then multiplying all points by the same arbitrary complex constant. if that's not the caseโ€ฆ the band was probably nonsense anyway ๐Ÿ’€. and the final choice of a factor of -1 is arbitrary. this scheme produces nonsense if you try to plot a degenerate band. you've been warned bestie.

When doing the conversions that come from -x, a new grid gets chosen with a density similar to the old one, and the data gets interpolated onto that new grid using trilinear interpolation. Extrapolating psis (rather than densities) is meaningless except at gamma, because the phase due to the k point isn't considered. so don't even try it ๐Ÿ˜ญ

Densities by default are in Angstroms**-3, and psis are in Angstroms**-1.5 โ€” save that .RHO files are written in Bohr**-3 as expected. keeping it classic.


๐ŸŒŸ EXAMPLES ๐ŸŒŸ

okay bestie, here's how you actually do things.

To extract the charge density in xsf format:

c2x -c input.check output.xsf

To extract the first four bands as psi at the second k-point in xsf format:

c2x -b=1-4 -k=2 input.check output.xsf

To convert a check file to a pdb file:

c2x --pdb input.check output.pdb

To convert a cell to something containing two repeat units in the a and b directions, and one in the c direction:

c2x --cell -x='(2,0,0)(0,2,0)(0,0,1)' in.cell out.cell

or, from c2x version 2.30:

c2x --cell -x=2x2x1 in.cell out.cell

Assuming the above cell was a 3.5A cube, the same in absolute co-ordinates:

c2x --cell -X='(7,0,0)(0,7,0)(0,0,3.5)' in.cell out.cell

To change a cell containing one layer of bulk in the c direction to one containing four layers, and sufficient vacuum to make a total length of 30A:

c2x --cell -x=1x1x4 -Xc=30 in.cell out.cell

slay. go make some crystals โœจ๐Ÿ”ฎ


๐Ÿ‘€ VIEWERS ๐Ÿ‘€

The following viewers have been used during the development of c2x: Avogadro, FermiSurfer, gabedit, Jmol, pymol, VESTA, VMD and XCrysDen. the whole squad showed up ๐Ÿซถ


๐Ÿ› BUGS ๐Ÿ›

None known. ๐Ÿ’…โœจ

Please report others to MJR.


๐Ÿ’– ACKNOWLEGEMENTS ๐Ÿ’–

If you wish to cite, please do so as "C2x: a tool for visualisation and input preparation for Castep and other electronic structure codes", MJ Rutter, Computer Physics Communications, vol 225 pages 174-179 (2018).

http://dx.doi.org/10.1016/j.cpc.2017.12.008

Details of spglib can be found at https://atztogo.github.io/spglib/


๐Ÿ”— SEE ALSO ๐Ÿ”—


and that's the whole page, bestie ๐Ÿ’œ this was the c2x(1) manual โ€” go forth and visualise, mwah ๐ŸŽ€

๐Ÿ“ฆ where this page comes from