Difference between revisions of "Gparse.m"
m (Spot-edit Spinach function page first-line NOTOC and template fields) |
(sync with Spinach main 3975f139: isotope table outputs, pickett frame, NoSymm, Link1, consistency checks) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:gparse.m}} __NOTOC__ | {{DISPLAYTITLE:gparse.m}} __NOTOC__ | ||
| − | A parser for | + | A parser for Gaussian (03, 09, 16) calculation logs. The function extracts all potentially useful information from the Gaussian log. The following keywords must be added to the route section of the Gaussian input file to produce a useful log: |
| − | #p nmr=(giao,spinspin,susceptibility) output=pickett | + | #p nmr=(giao,spinspin,susceptibility) |
| + | output=pickett pop=minimal IOp(6/82=1) | ||
Examples of complete Gaussian input files that perform geometry optimisation followed by magnetic properties calculations may be downloaded [[Media:gaussian_input_example_1.txt|here]], [[Media:gaussian_input_example_2.txt|here]], and [[Media:gaussian_input_example_3.txt|here]]. Some real-life Gaussian logs that may be used for practice with data import are given in examples/standard_systems directory. | Examples of complete Gaussian input files that perform geometry optimisation followed by magnetic properties calculations may be downloaded [[Media:gaussian_input_example_1.txt|here]], [[Media:gaussian_input_example_2.txt|here]], and [[Media:gaussian_input_example_3.txt|here]]. Some real-life Gaussian logs that may be used for practice with data import are given in examples/standard_systems directory. | ||
| Line 10: | Line 11: | ||
props=gparse(filename,options) | props=gparse(filename,options) | ||
| − | == | + | ==Parameters== |
filename - the name of the file to be parsed, a character string | filename - the name of the file to be parsed, a character string | ||
| − | options - a cell array of character | + | options - a cell array of character strings. By default |
| + | all interaction tensors are symmetrised; the | ||
| + | symmetrisation may be turned off by adding the | ||
| + | following strings: | ||
'g_nosymm' - turns off g-tensor symmetrisation | 'g_nosymm' - turns off g-tensor symmetrisation | ||
| Line 50: | Line 54: | ||
props.cst - absolute shielding tensors, natoms x 1 cell array of 3x3 matrices, ppm relative to bare nucleus in vacuum | props.cst - absolute shielding tensors, natoms x 1 cell array of 3x3 matrices, ppm relative to bare nucleus in vacuum | ||
| + | |||
| + | props.k_couplings - isotropic K-couplings, Hz | ||
props.j_couplings - isotropic J-couplings, nspins x nspins matrix, Hz | props.j_couplings - isotropic J-couplings, nspins x nspins matrix, Hz | ||
| Line 61: | Line 67: | ||
props.gibbs - Gibbs free energy, Hartree | props.gibbs - Gibbs free energy, Hartree | ||
| − | props.symbols - atomic symbols, nspins x 1 cell array of character strings | + | props.symbols - atomic symbols, nspins x 1 cell array of character strings; 'Bq' for ghost atoms, 'X' for dummy atoms, 'TV' for translation vectors |
| + | |||
| + | props.isotopes - mass numbers of the isotopes for which hyperfine couplings are reported | ||
| + | |||
| + | props.mass_numbers - mass numbers of the isotopes used by Gaussian for atomic masses | ||
| + | |||
| + | props.atom_masses - atomic masses used by Gaussian, atomic mass units | ||
| + | |||
| + | props.nuc_spins - spin quantum numbers of the mass isotopes | ||
| + | |||
| + | props.nuc_qmom - quadrupole moments of the mass isotopes, fm^2 | ||
| + | |||
| + | props.nuc_mmom - magnetic moments of the mass isotopes, nuclear magnetons | ||
props.atomic_numbers - atomic numbers, nspins x 1 array of integers | props.atomic_numbers - atomic numbers, nspins x 1 array of integers | ||
| + | |||
| + | props.charge - overall charge | ||
| + | |||
| + | props.el_dip_std - electric dipole moment, Debye | ||
| + | |||
| + | props.multiplicity - overall multiplicity | ||
props.filename - log file name, a character string | props.filename - log file name, a character string | ||
| − | props.error - set to | + | props.error - set to true if the calculation contains an error of any type |
==Examples== | ==Examples== | ||
| Line 83: | Line 107: | ||
bas.approximation='IK-2'; | bas.approximation='IK-2'; | ||
bas.connectivity='scalar_couplings'; | bas.connectivity='scalar_couplings'; | ||
| − | bas. | + | bas.prox_level=2; |
% Relaxation theory parameters | % Relaxation theory parameters | ||
| Line 126: | Line 150: | ||
# Spin-rotation tensors are imported, but not used anywhere in ''Spinach'' at the moment. | # Spin-rotation tensors are imported, but not used anywhere in ''Spinach'' at the moment. | ||
# Hyperfine tensors are imported in Gauss because Gauss units do not depend on the electron g-tensor. | # Hyperfine tensors are imported in Gauss because Gauss units do not depend on the electron g-tensor. | ||
| + | # Gaussian divides its isotropic Fermi contact couplings by 2S=multiplicity-1, but prints the anisotropic spin dipole couplings without that normalisation; the two blocks therefore disagree by 2S for anything above a doublet. This is corrected here, and the hyperfine tensors returned are the ones that enter the spin Hamiltonian as S*A*I, in agreement with [[oparse.m]]. | ||
# This function parses Gaussian logs. Use [[g2spinach.m]] to convert that information into ''Spinach'' input structures. | # This function parses Gaussian logs. Use [[g2spinach.m]] to convert that information into ''Spinach'' input structures. | ||
| + | # Gaussian prints the spin-rotation and quadrupole tensors of the output=pickett block in the principal axis frame of the inertia tensor, not in the standard orientation used for everything else. They are rotated into the standard orientation using a rotation fitted between the principal axis coordinates that Gaussian prints before them and the current orientation. The rotation matrix Gaussian prints is not used because it is an identity matrix in some logs where the principal axis coordinates are visibly permuted. | ||
| + | # When the calculation is run with NoSymm, Gaussian does not reorient the molecule and prints no standard orientation; the input orientation is then returned as the standard one because all tensors refer to it. | ||
| + | # In multi-job (Link1) logs, the last occurrence of each quantity is returned. A warning is printed when the number of atoms changes between jobs. | ||
| + | # Parsed g-tensors, shielding tensors, and hyperfine couplings are checked against the principal g-shifts, isotropic shieldings, and unit conversions that Gaussian prints alongside them; a disagreement is an error. | ||
# The parser is a bit old-school. If you are proficient with regular expressoins, we would really appreciate a hand. | # The parser is a bit old-school. If you are proficient with regular expressoins, we would really appreciate a hand. | ||
==See also== | ==See also== | ||
| − | [[oparse.m]], [[g2spinach.m]], [[cst_display.m]], [[hfc_display.m]], [[molplot.m]] | + | [[oparse.m]], [[g2spinach.m]], [[cst_display.m]], [[hfc_display.m]], [[molplot.m]], [[c2spinach.m]], [[cyprinol.m]], [[fatty_acid.m]], [[gissmo2spinach.m]], [[karplus_fit.m]], [[killcross.m]], [[killdiag.m]], [[merge_inp.m]], [[methyl_group.m]], [[nuclacid.m]], [[ocparse.m]], [[parsexml.m]], [[protein.m]], [[read_bmrb.m]], [[read_pdb_nuc.m]], [[read_pdb_pro.m]], [[v2spinach.m]], [[weblab2nqi.m]], [[x2spinach.m]], [[Import,_export,_and_visualisation]] |
| − | ''Version 2.2, authors: [[Ilya Kuprov]], [[Gareth Charnock]], [[Jennifer Handsel]]'' | + | ''Version 2.2, authors: [[Ilya Kuprov]], [[Gareth Charnock]], [[Jennifer Handsel]], [[Luke Ward]]'' |
Latest revision as of 10:59, 18 September 2026
A parser for Gaussian (03, 09, 16) calculation logs. The function extracts all potentially useful information from the Gaussian log. The following keywords must be added to the route section of the Gaussian input file to produce a useful log:
#p nmr=(giao,spinspin,susceptibility)
output=pickett pop=minimal IOp(6/82=1)
Examples of complete Gaussian input files that perform geometry optimisation followed by magnetic properties calculations may be downloaded here, here, and here. Some real-life Gaussian logs that may be used for practice with data import are given in examples/standard_systems directory.
Syntax
props=gparse(filename,options)
Parameters
filename - the name of the file to be parsed, a character string
options - a cell array of character strings. By default
all interaction tensors are symmetrised; the
symmetrisation may be turned off by adding the
following strings:
'g_nosymm' - turns off g-tensor symmetrisation
'cst_nosymm' - turns off shielding tensor symmetrisation
'hfc_nosymm' - turns off hyperfine tensor symmetrisation
Returns
The following output fields are returned, if the corresponding information is present in the log file:
props.inp_geom - input geometry, natoms x 3 array, Angstrom
props.std_geom - standard geometry, natoms x 3 array, Angstrom
props.natoms - number of atoms, an integer
props.method - model chemistry Gaussian had used, e.g. 'B3LYP'
props.energy - SCF energy, Hartree
props.hfc.iso - isotropic hyperfine couplings, natoms x 1 array, Gauss
props.hfc.full.eigvals - HFC eigenvalues, natoms x 1 cell array of 3-vectors, Gauss
props.hfc.full.eigvecs - HFC eigenvectors, natoms x 1 cell array of 3x3 matrices
props.hfc.full.matrix - HFC tensors, natoms x 1 cell array of 3x3 matrices, Gauss
props.g_tensor.eigvecs - g-tensor eigenvectors, 3x3 matrix
props.g_tensor.eigvals - g-tensor eigenvalues, 3-vector, Bohr magneton units
props.g_tensor.matrix - g-tensor, 3x3 matrix, Bohr magneton units
props.cst - absolute shielding tensors, natoms x 1 cell array of 3x3 matrices, ppm relative to bare nucleus in vacuum
props.k_couplings - isotropic K-couplings, Hz
props.j_couplings - isotropic J-couplings, nspins x nspins matrix, Hz
props.srt - spin-rotation tensor, nspins x 1 cell array of 3x3 matrices, Hz
props.nqi - nuclear quadrupole interaction tensors, nspins x 1 cell array of 3x3 matrices, Hz
props.chi - magnetic susceptibility tensor, 3x3 matrix, cubic Angstroms
props.gibbs - Gibbs free energy, Hartree
props.symbols - atomic symbols, nspins x 1 cell array of character strings; 'Bq' for ghost atoms, 'X' for dummy atoms, 'TV' for translation vectors
props.isotopes - mass numbers of the isotopes for which hyperfine couplings are reported
props.mass_numbers - mass numbers of the isotopes used by Gaussian for atomic masses
props.atom_masses - atomic masses used by Gaussian, atomic mass units
props.nuc_spins - spin quantum numbers of the mass isotopes
props.nuc_qmom - quadrupole moments of the mass isotopes, fm^2
props.nuc_mmom - magnetic moments of the mass isotopes, nuclear magnetons
props.atomic_numbers - atomic numbers, nspins x 1 array of integers
props.charge - overall charge
props.el_dip_std - electric dipole moment, Debye
props.multiplicity - overall multiplicity
props.filename - log file name, a character string
props.error - set to true if the calculation contains an error of any type
Examples
A typical example of a Spinach input that uses data import from a Gaussian log appears below.
% Read the spin system properties (vacuum DFT calculation)
options.min_j=1.0;
[sys,inter]=g2spinach(gparse('../standard_systems/sucrose.log'),{ {'H','1H'} },31.8,options);
% Magnet field
sys.magnet=14.1;
% Basis set
bas.formalism='sphten-liouv';
bas.approximation='IK-2';
bas.connectivity='scalar_couplings';
bas.prox_level=2;
% Relaxation theory parameters
inter.relaxation={'redfield'};
inter.rlx_keep='secular';
inter.tau_c=1e-9;
% Spinach housekeeping
spin_system=create(sys,inter);
spin_system=basis(spin_system,bas);
% Sequence parameters
parameters.spins={'1H'};
parameters.rho0=state(spin_system,'L+','1H','cheap');
parameters.coil=state(spin_system,'L+','1H','cheap');
parameters.decouple={};
parameters.offset=1800;
parameters.sweep=5000;
parameters.npoints=8192;
parameters.zerofill=65536;
parameters.axis_units='ppm';
parameters.invert_axis=1;
% Simulation
fid=liquid(spin_system,@acquire,parameters,'nmr');
% Apodization
fid=apodization(fid,'crisp-1d');
% Fourier transform
spectrum=fftshift(fft(fid,parameters.zerofill));
% Plotting
plot_1d(spin_system,real(spectrum),parameters);
Further examples of Gaussian inputs: gaussian_a.txt, gaussian_b.txt, gaussian_c.txt - note that the extra printing flag (#p) should always be present.
Notes
- Gaussian prints all anisotropic quantities relative to what it calls "standard orientation". Do not use the "input orientation", that would be wrong.
- Do not instruct Gaussian to print eigenvectors of shielding tensors (nmr=printeigenvectors): that option has a bug that makes the eigenvectors refer to the symmetric part of the shielding tensor. Eigenvectors are not necessary anyway - the relevant orientation information is already contained in the shielding tensor matrix.
- Chemical shielding is not the same as chemical shift.
- Spin-rotation tensors are imported, but not used anywhere in Spinach at the moment.
- Hyperfine tensors are imported in Gauss because Gauss units do not depend on the electron g-tensor.
- Gaussian divides its isotropic Fermi contact couplings by 2S=multiplicity-1, but prints the anisotropic spin dipole couplings without that normalisation; the two blocks therefore disagree by 2S for anything above a doublet. This is corrected here, and the hyperfine tensors returned are the ones that enter the spin Hamiltonian as S*A*I, in agreement with oparse.m.
- This function parses Gaussian logs. Use g2spinach.m to convert that information into Spinach input structures.
- Gaussian prints the spin-rotation and quadrupole tensors of the output=pickett block in the principal axis frame of the inertia tensor, not in the standard orientation used for everything else. They are rotated into the standard orientation using a rotation fitted between the principal axis coordinates that Gaussian prints before them and the current orientation. The rotation matrix Gaussian prints is not used because it is an identity matrix in some logs where the principal axis coordinates are visibly permuted.
- When the calculation is run with NoSymm, Gaussian does not reorient the molecule and prints no standard orientation; the input orientation is then returned as the standard one because all tensors refer to it.
- In multi-job (Link1) logs, the last occurrence of each quantity is returned. A warning is printed when the number of atoms changes between jobs.
- Parsed g-tensors, shielding tensors, and hyperfine couplings are checked against the principal g-shifts, isotropic shieldings, and unit conversions that Gaussian prints alongside them; a disagreement is an error.
- The parser is a bit old-school. If you are proficient with regular expressoins, we would really appreciate a hand.
See also
oparse.m, g2spinach.m, cst_display.m, hfc_display.m, molplot.m, c2spinach.m, cyprinol.m, fatty_acid.m, gissmo2spinach.m, karplus_fit.m, killcross.m, killdiag.m, merge_inp.m, methyl_group.m, nuclacid.m, ocparse.m, parsexml.m, protein.m, read_bmrb.m, read_pdb_nuc.m, read_pdb_pro.m, v2spinach.m, weblab2nqi.m, x2spinach.m, Import,_export,_and_visualisation
Version 2.2, authors: Ilya Kuprov, Gareth Charnock, Jennifer Handsel, Luke Ward