PYPI PACKAGE AUDIT v0.0.27 Healthy Package

mcta

McTa (Meta Crystal Toolkit & Analysis).

PyPkgScore mcta
Methodology & Criteria ♥ Donate
670 / 1000
Quick Install
pip install mcta
1. Governance
50/200
2. PEP Metadata
200/200
3. Security
200/200
4. Docs & SEO
155/200
5. CI Engineering
65/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
1101
Last 30 days
2890
Total (180 days)
2890
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✓ Verified OIDC PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 670 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✕ 0 pts
CONTRIBUTING.md✕ 0 pts
CODE_OF_CONDUCT.md✕ 0 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain200 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem155 / 200 ▾
Structured README✓ 60 pts
Read the Docs✓ 50 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality65 / 200 ▾
Automated Tests✕ 0 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✕ 0 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✕ 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — mcta

PyPI Metadata v0.0.27
Show full original documentation (English README) ▾

mcta mcta mcta mcta mcta mcta mcta

Meta Crystal Toolkit & Analysis (McTa)

  • Install (Python ≥ 3.9; core dependencies: numpy, matplotlib, ase, spglib, paramiko):
pip install mcta          # plotting tools only
pip install mcta[seek]    # + mt.seek (pymatgen, mp-api, openai); also enables mt.skl
pip install mcta[skl]     # + mt.skl (scikit-learn, joblib)
pip install mcta[sqs]     # + mt.sqs (sqsgenerator)
pip install mcta[mc]      # + mt.mc (numba)
pip install mcta[all]     # all: seek + skl + sqs + mc

Every extra is optional; only the tools that need one ask for it (mt.seek → mcta[seek], mt.skl → mcta[skl], mt.sqs → mcta[sqs], mt.mc → mcta[mc]).


mt prints an overview, checks the current directory and suggests the next command.


mt.band / mt.phband: electronic and phonon band structures, with an optional DOS panel

  • mt.band reads VASP output from a directory (-i, default: current), preferring it over BAND.dat / PBAND*.dat / PDOS*.dat; -d adds DOS, -r -p Mo-d adds projections, -D -d makes a spin-polarized mirror plot, -m calculates effective masses, and two or three directories compare calculations.
  • Energies are shifted to the Fermi level (--no-shift disables this); -l sets k-path labels (from KPOINTS / KLABELS or computed automatically) and --export-dat DIR exports vaspkit-style data. For combined SCF-mesh/band-path calculations, only zero-weight path points are plotted (--keep-weights keeps every k point); vaspkit .dat files are used unchanged.
  • mt.phband reads BAND.dat written by phonopy-bandplot --gnuplot; -l labels high-symmetry points, -y sets the frequency window, -d [FILE] adds a DOS panel sharing the axis (projected_dos.dat / total_dos.dat auto-detected), and -B start end breaks the axis for optical branches; two or three files are compared side by side.
mt.band                         # bands of the current directory
mt.band -i calc_PBE -d -z       # bands + DOS (DOSCAR or PDOS*.dat)
mt.band -i calc_PBE -r -p Mo-d  # projected bands from PROCAR
mt.band -i calc_PBE -D -d       # spin-polarized bands + mirror DOS
mt.band -i calc_PBE -m 0.15     # effective masses from EIGENVAL
mt.band -i calc_PBE calc_HSE    # compare calculations
mt.phband -i BAND.dat -o BAND.png -l g m k g -d projected_dos.dat -z
mt.phband -B 23 100 -l g m k g -y -2 110    # broken axis
mt.phband -i BAND1.dat BAND2.dat -B 20 100  # several files

mt.dos / mt.phdos: standalone DOS figures for electrons or phonons, energy / frequency on the horizontal axis

  • mt.dos reads DOSCAR (needs LORBIT = 11) or vaspkit PDOS*.dat / TDOS*.dat, from a directory or .dat files via -i; -p picks projections, -e renames the legend, -x sets the DOS range, -y the energy window, and -z fills the curves. -n exchanges the axes for the mt.band -d orientation, and --no-mirror keeps the spin-down DOS positive.
  • mt.phdos reads projected_dos.dat / total_dos.dat; -e, -x, -y (frequency), -z work as above, and -n matches the mt.phband -d orientation.
mt.dos -i calc                 # DOS from DOSCAR / PDOS*.dat (energy on x)
mt.dos -i calc -p d -x 0 30    # d-orbital PDOS with a fixed DOS range
mt.dos -i calc -o PDOS.png -z  # filled curves
mt.dos -i calc -n              # energy vertical (mt.band -d orientation)
mt.phdos -i calc -z            # filled curves
mt.phdos -i calc -x 0 0.6      # fix the DOS range
mt.phdos -i calc -n            # frequency vertical (mt.phband -d orientation)

mt.ph / mt.ph3: phonopy and phono3py workflow helpers

  • mt.ph runs the interactive supercell → force constants → band → DOS workflow; -b -d writes band.conf + mesh.conf, -Y skips confirmation, and -R only prints commands. The unit cell is auto-detected (POSCAR-unitcell → CONTCAR → POSCAR) or set with -c; commands adapt to phonopy v3/v4.
  • mt.ph fs collects force data (one vasprun.xml uses --fc, several files or displacement directories use --sp -f; sources come from names, -n, or -x); other steps include band, dos, tprop, born, symmetry, qha, and gruneisen (see mt.ph -h).
  • mt.ph3 guides supercell generation, force collection, and thermal conductivity, adapting to phono3py v3/v4 with the same -Y / -R; -s / -S set FC3 / FC2 supercell dimensions, -c the unit cell, and --rd creates random-direction displacements. cf3 / cf2 collect forces, cfs and fs2f2 convert force-set formats, and --sp writes phono3py_params.yaml.
  • kappa runs RTA by default (--lbte for direct LBTE), kaccum writes cumulative conductivity, and kdeplot shows lifetime distributions; w / W query the offline English/Chinese wordbook (w c lists setting tags, --path shows its location, MT_PH_DOCS selects a custom JSON file).
mt.ph                      # interactive workflow (default: supercell)
mt.ph -b -d                # write band.conf + mesh.conf
mt.ph fs 001-003           # collect forces from displacement directories
mt.ph w --dim BAND_LABELS  # English original, then Chinese translation
mt.ph3 supercell -s 2 2 2 -S 4 4 4   # separate FC3 and FC2 supercells
mt.ph3 kappa -m 11 11 11             # RTA -> kappa-m111111.hdf5
mt.ph3 kaccum -k kappa-m111111.hdf5  # cumulative conductivity -> kaccum.dat
mt.ph3 w --br --symfc                # English original, then Chinese translation

mt.seek / mt.sqs / mt.skl: structure retrieval, SQS generation, and data-driven analysis

  • mt.seek: Materials Project retrieval and curation, run directly on the server. Retrieves structures and writes one export directory <name>/ in the working root — containing README.md, manifest.csv, mt.seek.db and one <id>/ directory per structure (CIF / POSCAR / JSON, plus INCAR / KPOINTS / job script when requested; POTCAR is concatenated into the POSCAR directory with mt.sh po when a pseudopotential directory is configured). No tarball, no upload; internal cache/state stay hidden in .mt.seek/. Also filters or deduplicates local datasets; no calculations run locally. Set the API key once (free account at https://next-gen.materialsproject.org).
  • mt.sqs: special quasirandom structures from a custom unit cell. Reads POSCAR / CONTCAR / CIF / JSON, expands a supercell, and randomises one sublattice toward a target composition using sqsgenerator; no network access is required.
  • mt.skl: data-driven analysis of exported structures with scikit-learn. Runs two regression tasks (ehull stability and band_gap) with a random forest and 5-fold cross-validation, writing results to <home>/ml/; --home DIR sets the working root (default: current directory).
mkdir -p ~/.config/mcta
echo 'MP_API_KEY=your-key' >> ~/.config/mcta/config
chmod 600 ~/.config/mcta/config
mt.seek -c Ti-C -k 3 -n ti-c        # search by chemical system, export top 3
mt.seek -f MoS2 -k 5 -F cif,poscar  # search by formula
mt.seek -r -D 8 -o my-pick          # deduplicate + pick 8 diverse structures
mt.sqs -c cell.vasp -a "Cu:0.5,Au:0.5" -x 4,4,4 -n cuau-sqs
mt.sqs -c LaAlO3.cif --host La -a "La:0.5,Sr:0.5" -x 2,2,2    # A-site only
mt.sqs -c cell.vasp -a Cu,Au --iterations 1000 --number 5 -R  # dry-run: no disk write
mt.skl                              # analyse <name>/manifest.csv from each export bundle

mt.seek exports land in <name>/ directly under the working root (no exports/, no .tar.gz, no upload): each bundle holds README.md, manifest.csv, mt.seek.db, and one <id>/ directory per structure containing that id's CIF / POSCAR / JSON (INCAR / KPOINTS / job script are written into the same <id>/ when requested; POTCAR is generated there by mt.sh po only when a pseudopotential directory such as PBE_PATH is set and exists). -I accepts MP IDs, -t accepts natural-language tasks, and -T downloads more structures. mt.sqs bundles additionally contain sqs.json and sqs_summary.csv. mt.seek -h lists all options, LLM engines, and MT_SEEK_* environment variables; short options are case-sensitive; mt.sqs -h lists every flag and default.

Structure data comes from the Materials Project: A. Jain et al., APL Materials 1, 011002 (2013).


mt.mc: Monte Carlo simulation of phase transitions in 2D/3D magnetic materials

  • Runs the Metropolis Ising model on built-in lattices (square, triangular, bilayer, simple-cubic) or any crystal structure (-s POSCAR -A Fe -D 3.0 3.6 -x 2 -y 2 -z 2); any of -a, -J, -K switches to the Heisenberg model. Requires numba (pip install mcta[mc]); ASE is needed for structure mode.
  • -x/-X, -y/-Y, -z/-Z set the lattice size or supercell multiplier (default 32, -z ignored for 2D); -e/-w set equilibration/sampling sweeps, -p/-J/-K couplings, -a anisotropy, -i initial state, and -C / -W / -S control parallel chains, replica exchange and reproducibility. -t accepts a count (35), a range (20 25), start/stop/step (20 26 2), separate temperatures (20 25 30), or chained ranges.
  • Structure mode (-s) reads any ASE-supported file, picks magnetic atoms (-A Fe,Co or auto d/f-block), expands the supercell and builds the neighbor table by distance bins (-D); --mom sets nominal moments (default 2 → S=±1) and --ini the initial state (fm / afm / random or a ±1 list); -c is ignored with -s. Plots are automatic unless -R, and -o FILE -I pdf re-plots a finished run.
mt.mc -x 128 -y 128 -t 0 40 2 -C 6 -S 42   # 6 parallel chains, reproducible
mt.mc -c triangular -t 0 60 2 -S 42        # triangular lattice
mt.mc -c square -a 0.1 -t 20 40 2 -p 5 -J 4 -K 3     # vector spins with anisotropy
mt.mc -s POSCAR -A Fe -D 2.7 3.2 -x 2 -y 2 -z 2 -t 10 30 10 -p 5 2  # from crystal
mt.mc -o square_Ising_32_32.log -I pdf               # re-plot a finished run

mt.sh: run bash helper scripts by short name

  • mt.sh NAME [args...] runs NAME.sh with bash; local ./NAME.sh overrides $MTSH_SCRIPTS, then bundled scripts. Bare mt.sh lists available scripts.
  • Strain scans x|y|xy [POSCAR] [NPOINTS] [STEP] write <factor>/POSCAR under x/, y/, or xy/; defaults are 4 points per side and step 0.01.
  • kb [POSCAR] [a [b [c]]] [OUT] expands the structure with ASE and writes SPOSCAR by default; missing multipliers default to 1.
  • sy [POSCAR] [symprec] reports spglib space-group and Wyckoff-site information; the default tolerance is 1e-3 Å.
  • Bundled VASP helpers target Linux/WSL; on Windows use Git Bash with sed / awk / bc available.
mt.sh x                  # x strain: x/0.960 ... x/1.040 (8 points, step 0.01)
mt.sh y POSCAR 2 0.02    # y strain, 2 points per side, step 0.02
mt.sh xy POSCAR          # x and y strained together
mt.sh kb POSCAR 2 2 1    # POSCAR -> SPOSCAR (2x2x1)
mt.sh sy POSCAR          # space group + Wyckoff sites (symprec 1e-3)
mt.sh sy CONTCAR 0.0001  # tighter tolerance: may lower the symmetry

mt.server: local file service, structure viewer and terminal in the browser

  • mt.server [-d PATH] [-p PORT | --socket PATH] [--remote-socket PATH] [-f] [-L HOST] [-R SPEC] [-S] [-o [PATH]] [--status]: background on port 9068 by default; -d sets the starting directory (defaults to cwd); restarting on the same port replaces the old instance, and the service stops when that terminal closes or exits. -f runs it in the terminal (Ctrl+C to stop), -S stops it, and no log file is written unless -o is given (-o alone writes mcta-server-<port>.log, -o DIR|FILE chooses the location, an existing file is overwritten; with -f -o the startup banner and interactive prompts remain in the terminal while errors go to the log). --status lists every port where you have a service running, and -S --all stops all of them.
  • -R/--ssh connects to a remote server. SPEC accepts user@host:22, user@host 22, user host 22, host 22 and host; the user defaults to the local user and the port to 22. Startup first probes the server non-interactively, then tries ssh-agent and local private keys (~/.ssh/id_ed25519, id_ecdsa, id_rsa, …). If no key is available or key authentication fails, it asks for a password directly (no y/N prompt) and automatically stays in the foreground; the password is read with getpass (no echo, 90-second timeout, Ctrl+Z ends the process) and is never written to the command line, environment or log, but is kept in server memory for automatic reconnects. The SSH port belongs in -R; -p remains the web port. Legacy servers using diffie-hellman-group14-sha1, diffie-hellman-group1-sha1 or ssh-rsa work with paramiko 3/5 without downgrading: the equivalent of -oKexAlgorithms=+... -oHostKeyAlgorithms=+ssh-rsa is registered at runtime. In this mode -d is a directory on the server; an invalid path falls back to the SSH default directory. Directory listings, uploads and downloads use a dedicated SSH/SFTP connection, while the terminal is an interactive shell over a separate SSH connection, so large transfers do not block the shell; files are downloaded to a local temporary directory before the text viewer / ASE / 3Dmol reads them. Page paths and terminal cd targets are always remote absolute paths; the local cache directory is never shown or sent to the shell. Audio/video is streamed from SFTP on demand with HTTP Range support; only the browser playback buffer is kept locally, never the whole file. If the connection drops, SSH/SFTP and the shell reconnect automatically. In remote mode you can drop local files or folders into the file panel to upload them into the current directory, and select multiple files to download them as a ZIP.
  • Remote 3D rendering over a Unix socket (fifth channel). When -R is active and the remote host has an mt.server executable on PATH, in ~/.local/bin, in a common conda env, or as python3 -m mcta server — the local server only checks the executable path (keep mcta versions in sync manually) and opens a system ssh tunnel (-L 127.0.0.1:PORT:/path/to/socket, never paramiko) to a remote Unix domain socket and lets the remote mt.server parse structures / downsample VASP volumetric data. Only the 3D structure/volume request (/api/structure) uses this channel: the terminal, directory browsing, upload and download keep using the original four channels. The remote process runs in the foreground under exec with a forced PTY, so it exits together with the SSH connection; it listens on no TCP port (SSH 22 excepted). The default socket is ~/.config/mcta/sock/mcta.sock: its parent directory is created with mode 0700 and the socket itself is 0600. Override the path with --remote-socket PATH on the local server or the environment variable MCTA_REMOTE_SOCKET; mt.server --socket PATH makes a mt.server itself serve HTTP only on a Unix socket (foreground, mutually exclusive with -p). Rendering results are cached locally by remote path, mtime and size; opening the same file again does not touch the tunnel, and saving structure edits invalidates that cache. Files below the threshold continue to use SFTP plus local ASE. The threshold is 8 MB for both structures and volumetric data; set MCTA_REMOTE_RENDER_MIN_MB=N to change it (lower values send more work to the remote host, which helps on slow networks). At most two render requests per remote host run concurrently. If the remote tool is missing, the tunnel cannot be established, a request times out (30 s), or the remote returns an error, the request automatically falls back to SFTP + local parsing and a message is printed in the terminal; nothing else is affected. Key/agent and password authentication are both supported without extra local tools: with a password, OpenSSH's built-in askpass helper is used (the secret lives only in the process environment and the helper is deleted when the tunnel closes); legacy SHA1 KEX/host-key algorithms are enabled automatically for older sshd servers.
  • Remote caches. In -R mode the working file cache is a per-process temporary directory created by tempfile.mkdtemp(prefix="mcta-ssh-") (for example /tmp/mcta-ssh-u31_8qyd); it mirrors remote paths only while the service runs and is deleted when the service exits. ZIP downloads reuse this cache when size/mtime still match, so already previewed or uploaded files are not fetched again. The separate 3D render cache is persistent at $XDG_CACHE_HOME/mcta/render-cache (default ~/.cache/mcta/render-cache), keyed by remote path, mtime, size and frame flag; bodies are gzip-compressed when worthwhile, streamed back without loading the whole file into memory, and pruned by LRU. Set MCTA_RENDER_CACHE_MAX_MB=N (default 512) to change its size limit, MCTA_REMOTE_LIST_TTL=N (seconds, default 1, 0 disables) for directory listing cache TTL, and MCTA_RENDER_RETRY_SECONDS=N (default 30) for the negative cache after a remote render channel fails. Remote write operations invalidate the affected directory listings.
  • The tokenized URL (?t=...) printed at startup is the only credential — do not share it. -N (no token) and -L on a non-loopback address are dangerous: each asks you to type yes / YES, using both asks twice, and -L 0.0.0.0 prints a warning.
  • Runs as the current user with no login: browse, edit and download any accessible file, with a real PTY shell (xterm.js) whose cd the file list follows, image previews, and a 3Dmol.js viewer for structures, trajectories and VASP charge-density files (CHGCAR, CHG, LOCPOT, including spin-polarised pairs). The viewer is orthographic by default with a perspective toggle, fixed-angle rotation (Z-axis 45° default), stepped zoom buttons, reset view, 1x-8x PNG/JPEG/WebP export, vertical sliders for isovalue and opacity (live update while dragging), playback for multi-frame trajectories (capped at 300 frames), and automatic CUBE conversion from ASE so that 3Dmol.js handles all formats uniformly.
mt.server               # background on port 9068; the tokenized URL is printed
mt.server -d ./examples # serve a different directory
mt.server -p 8080       # another port
mt.server -L 0.0.0.0    # listen on all interfaces (asks for yes, then prints a warning)
mt.server -f            # foreground; Ctrl+C to stop
mt.server -N            # no token (asks for yes): open http://127.0.0.1:9068/ directly
mt.server -o run.log    # keep the startup output in run.log (overwritten each start)
mt.server -R user@host:22 -d /home/user/project
MCTA_REMOTE_RENDER_MIN_MB=2 mt.server -R user@host   # send files >2 MB to the remote renderer
mt.server --socket /tmp/mcta.sock -N -Y -f           # Unix socket only, no TCP port
MCTA_RENDER_CACHE_MAX_MB=256 mt.server -R user@host  # cap persistent render cache at 256 MB
MCTA_REMOTE_LIST_TTL=0 mt.server -R user@host        # always re-read remote directory listings
mt.server -S            # stop the service on port 9068
mt.server --status      # list every port where mt.server is running
mt.server -S --all      # stop all of them