Skip to content
Dirac4piPublic

About

GaussView scripts for vsualization and modeling in xyz format

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

PolyGView (GView for Everything)

    Modeling and result-visualization are key points to computational chemistry workflows, and GaussView (GView) excels in these areas. However, due to its status as commercial software, GView’s applications are limited. PolyGView is a collection of Python scripts that extends GView’s capabilities, ensuring users can perform modeling and result-visualization in the easiest and most powerful way possible.
    PolyGView is available on Windows, Linux and macOS, but some configuration is required. Taking Linux as example, add the following to ~/.bashrc:

gview.py() {
    source /opt/g16/bsd/g16.profile
    export GAUSS_MEMDEF=8GB
    /path/to/gv/gview.py "$@"
}
export PATH=$PATH:/path/to/polygview
export g16root='/opt/'
export GAUSS_SCRDIR='/opt/g16/scratch'
export GV_ROOT='/path/to/gv'

    You need to create an environment with networkx, NumPy, RDKit, QCElemental; optionally, install scipy, dftd4, pyscf for quantmol.py, and xtb, freesasa-python for solvmol.py. If you are working with a Linux machine, it is recommended that you grant all scripts executable permissions and replace the shebangs in all the scripts with the path to the Python interpreter of the environment, it will enable you to use scripts in any scenario.

gview.py

    Usage: gview.py input.[xyz|gjf|log|out|cif|fch|cdxml|...] Compared to the original GView, gview.py supports the following features without affecting its original functionality:

1. Edit of Single-Frame XYZ Files

    XYZ files are the most commonly used 3D model files in quantum chemistry calculations and first-principle calculations. One can visualize and edit single-frame XYZ files directly using gview.py input.xyz, similar to handling GJF files, supporting both isolated and periodic systems.

2. Visualization of Multi-Frame XYZ Trajectories

    For mature computational chemistry packages such as ORCA, PySCF (through geomeTRIC) and CP2K, although the XYZ trajectory files generated by them contain limited info (compared to their output files), most issues can still be resolved by analyzing them with gview.py. gview.py visualizes energy and displacement of the trajectory and, can be used in conjunction with mdf.py to analyze the positional fluctuations of individual atoms within the trajectory, is well-suited for studying geometric optimization, potential surface scans, and comparisons of local minima across potential surfaces, etc.
    The irreplaceable value of analyzing multi-frame XYZ trajectory files lies in the fact that it is applicable to any program, at any computational level, and for any keyword-based task.

3. Edit of ORCA Input Files

    You may be accustomed to saving coordinates directly into ORCA input files; gview.py supports the direct visualization and editing of ORCA .inp files, just as it does for .gjf/xyz files.

4. Visualization of ORCA Output Files

    If you have install OfakeG in GView directory, gview.py can directly call it to visualize ORCA output files just like Gaussian output files. Unlike a direct call to OfakeG, gview.py add the |Force on Nucleus| data when working on ORCA geometric optimization tasks, etc. It can be visualized under Results -> Atom properties.
    gview.py automatically recognizes Gaussian/ORCA output files.

5. Visualization of CP2K MOLDEN Files

    If you have install MfakeG in GView directory, gview.py can call it to visualize vibration modes in CP2K MOLDEN format files.

6. Modeling Based on ChemDraw 2D Structures

    RDKit can accurately and rapidly convert ChemDraw 2D structures into 3D structures; it supports hydrogen addition and molecular force field optimization, and—most critically—it is capable of distinguishing between stereoconfigurations. gview.py can invoke it to model 3D structures based on .cdxml files, it's the most powerful and straightforward method for converting 2D models into 3D models.

gjf2xyz.py

    Convert GJF files to XYZ files, supporting isolated and periodic systems. Usage: gjf2xyz.py input.gjf.

log2xyz.py

    Extract a selected geometry from a Gaussian optimization or relaxed scan log as a single-frame XYZ file, preserving atom order and Angstrom coordinates. Usage: log2xyz.py abc.log -12 exports forward-counted frame 12 to 12_abc.xyz in the current directory; -12 does not mean counting backward.
    Frame numbering uses one orientation convention within the selected job (Standard orientation preferred), retaining the final printed optimization geometry while excluding subsequent frequency jobs. The XYZ comment records the source job, frame and log line for traceability.

gjf2inp.py

    Convert GJF files to ORCA INP files. An .inp file (for setting up the calculation) and an .xyz file (for saving the geometry) will be generated, facilitating project management and workflow construction. Usage: gjf2inp.py input.gjf.

xyzdump.py

    Export the last frame in a multi-frame XYZ file as a single-frame XYZ file. If the multi-frame XYZ file was generated by CP2K, it will export a single-frame XYZ file containing cell information. Usage: xyzdump.py multi.xyz single.xyz.

diffmol.py

    Compare two XYZ conformers or corresponding molecular fragments through an integrated, multiscale analysis—from local connectivity and structural distortion to global spatial organization. Rather than reporting a single similarity score, diffmol.py identifies where the structures differ and provides concise interpretations of those differences.

The report comprises five complementary sections:

  • CONNECTION: compares connectivity and noncovalent contact patterns.
  • DISPLACEMENT: summarizes internal-distance changes and extracts dominant difference patterns through distance-matrix decomposition.
  • CORE: examines stereochemical, coordination and ring-conformation changes.
  • INTERNAL_COORD: ranks the largest local geometric changes and their impact and correlation.
  • WHOLE_MOLECULE: compares overall topology and shape when both selections cover the entire molecule.

    Combining local diagnostics with global difference patterns helps distinguish changes in molecular size and shape from localized rearrangements. Explicit atom correspondence, structured terminal reports, CSV export and transparent heuristic interpretations make the script practical for comparing optimized structures, selected fragments and alternative conformations.

Usage: diffmol.py ref.xyz probe.xyz. Select paired atoms using 1-based numbers/ranges (e.g. 1-9,16-23,25), or enter C/c for both structures to enable whole-molecule analysis. Use --all for non-interactive full-molecule comparison and --csv-prefix compare to export results.

diffmol.py ref.xyz probe.xyz --all --csv-prefix compare

    For more info, run diffmol.py --help

quantmol.py

    Analyze a single XYZ conformer or compare two conformers through complementary numerical diagnostics and model-based physical descriptors. Extending the geometry-focused analysis of diffmol.py, quantmol.py examines basis redundancy, overlap-environment changes, dispersion contributions and nonbonded contact organization without optimizing the input structures or running molecular SCF calculations.

The analysis combines six complementary modules:

  • BASIS_HEALTH: checks overlap conditioning, locates near-redundant atomic shells and provides auxiliary kinetic-spectrum diagnostics.
  • FINGERPRINT: stores a single-structure overlap signature or compares global and local overlap environments between conformers.
  • METRIC: measures relative AO-metric distortion in two-conformer mode; it is not an occupied-orbital distance or a prediction of SCF failure.
  • DISPERSION: resolves D4 contributions by atom pair and reporting fragment, separating local redistribution from the total dispersion difference.
  • POLARIZATION: estimates classical static response using a damped Thole model, subject to explicit parameter coverage and response-stability checks.
  • IGM: maps reference-density contacts, with covalent-neighbor filtering and grid/box sensitivity checks for selected absolute integrals or conformer changes.

    Single-conformer mode provides a numerical health check and contact/dispersion contribution tables; comparison mode identifies where these quantities change. Concise terminal interpretations, explicit verification labels and JSON/CSV exports support screening optimized structures, tracing ligand or substrate contact rearrangements, and deciding which regions merit further study. These are model diagnostics, not total conformer energies, interaction-energy maps, multireference diagnoses or quantitative reactivity predictions.

Usage: quantmol.py input.xyz for one conformer, or quantmol.py ref.xyz probe.xyz for comparison. Enter C/c at the selection prompt(s), or use --all to analyze complete molecules without prompts. Ordered 1-based selections use --ref-atoms and, in comparison mode, --probe-atoms. Selected atoms form the complete modeled subsystem without capping; prefer full molecules with --fragments fragments.json for physical interpretation.

quantmol.py Fe1.xyz --all --charge 0 --skip-polar --csv-prefix Fe1_single
quantmol.py Fe1.xyz Fe2.xyz --all --basis def2-tzvpd --charge 0 --skip-polar --csv-prefix Fe1_Fe2

    Set the actual molecular charge with --charge (default 0), and choose the AO basis with --basis (default def2-svp). --d4-method selects a damping parameter set, not a DFT calculation. --fragments accepts disjoint named lists of original REF atom numbers in JSON; unlisted selected atoms form an additional reporting fragment. --top limits printed rows, while --csv-prefix exports detailed results. Existing outputs require --overwrite.

    For more info, run quantmol.py --help

solvmol.py

    Compare how a selected solvent affects two whole-molecule conformers through an integrated analysis of electronic response, surface accessibility and implicit-solvent energetics. Combining GFN-xTB/ALPB with FreeSASA, solvmol.py distinguishes intrinsic conformer preference from differential solvent stabilization, rather than inferring stability from polarity or exposed surface alone.
    Fixed-geometry calculations preserve the structures being compared, while concise interpretations connect energetic preferences with their underlying model contributions. Source-tagged solvent probe presets, manual overrides and retained calculation records provide a reproducible workflow for rapid conformer screening and solvent-effect analysis. Results are model-based comparisons, not complete conformational free energies or explicit solvent-binding energies.

Usage: solvmol.py ref.xyz probe.xyz --water, or specify another supported solvent with --solvent NAME. The script prompts for a common charge and number of unpaired electrons when omitted. If the selected solvent has no local FreeSASA probe-radius preset, enter the radius in Angstrom when prompted.

solvmol.py ref.xyz probe.xyz --solvent water --charge 0 --uhf 0

    For more info, run solvmol.py --help

mdf.py

    Calculate the Mean Distance Fluctuation (MDF) of atoms within a molecular trajectory (provided via a multi-frame XYZ file). MDF is dimensionally consistent and remains invariant under translational and rotational transformations. Usage: mdf.py traj.xyz

$$ MDF_i = \frac{1}{N-1} \sum_{j \neq i}^{N} \sqrt{\langle d_{ij}^2 \rangle - \langle d_{ij} \rangle^2} $$

About

GaussView scripts for vsualization and modeling in xyz format

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages