Difference between revisions of "G2spinach.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Sync syntax/arguments/outputs with current Spinach source)
(Restore pre-bulk-edit wiki content)
Line 1: Line 1:
{{DISPLAYTITLE:g2spinach.m}} __NOTOC__
 
 
 
Forms ''Spinach'' data structures from Gaussian parsing output returned by [[gparse.m]] function. This function converts the information obtained by parsing a Gaussian log file into the form that ''Spinach'' gateway function [[create.m]] understands.
 
Forms ''Spinach'' data structures from Gaussian parsing output returned by [[gparse.m]] function. This function converts the information obtained by parsing a Gaussian log file into the form that ''Spinach'' gateway function [[create.m]] understands.
  
 
==Syntax==
 
==Syntax==
  
[sys,inter]=g2spinach(props,particles,references,options)
+
    [sys,inter]=g2spinach(props,nuclei,references,options)
  
 
==Arguments==
 
==Arguments==
  
props      - the data structure obtained from [[gparse.m]]
+
    props      - the data structure obtained from [[gparse.m]]
 
   
 
   
 
     nuclei    - a cell array of the following form: {{'H','1H'},{'N','15N'}...}
 
     nuclei    - a cell array of the following form: {{'H','1H'},{'N','15N'}...}
Line 39: Line 37:
 
     options.no_xyz  -  if set to 1, causes the function to ignore the
 
     options.no_xyz  -  if set to 1, causes the function to ignore the
 
                         coordinate information in the Gaussian log.
 
                         coordinate information in the Gaussian log.
 +
 +
==Returns==
 +
The following subfields of sys and inter data structures are set by this function:
 +
 +
    sys.isotopes          - Nspins x 1 cell array of strings
 +
 +
    inter.coordinates    - Nspins x 3 dense matrix, Angstrom. Not
 +
                            returned if there is an electron in the
 +
                            isotope list (in the EPR case it is not
 +
                            a good idea to use the molecular
 +
                            coordinates for spins).
 +
 +
    inter.zeeman.matrix  - Nspins x 1 cell array of 3x3 matrices,
 +
                            ppm for nuclei, g-tensor for electrons.
 +
                            Zero interactions have zero matrices.
 +
 +
    inter.coupling.matrix - Nspins x Nspins cell array of 3x3 matrices,
 +
                            all in Hz. Zero interactions have zero
 +
                            matrices.
 +
 +
    inter.coupling.scalar - Nspins x Nspins cell array of scalar
 +
                            couplings, all in Hz. Zero couplings are
 +
                            returned as zeros.
  
 
==Examples==
 
==Examples==
 
 
A typical example of a Spinach input that uses data import from a Gaussian log appears below.
 
A typical example of a Spinach input that uses data import from a Gaussian log appears below.
  
Line 93: Line 113:
  
 
==Notes==
 
==Notes==
 
 
As a reference, here are absolute isotropic shielding values for TMS in vacuum:
 
As a reference, here are absolute isotropic shielding values for TMS in vacuum:
 
   
 
   
Line 111: Line 130:
  
 
==See also==
 
==See also==
 
 
[[gparse.m]], [[oparse.m]], [[create.m]]
 
[[gparse.m]], [[oparse.m]], [[create.m]]
  
  
 
''Version 1.9, authors: [[Ilya Kuprov]]''
 
''Version 1.9, authors: [[Ilya Kuprov]]''
 
==Returns==
 
 
The following subfields of sys and inter data structures are set by this function:
 
 
    sys.isotopes          - Nspins x 1 cell array of strings
 
 
    inter.coordinates    - Nspins x 3 dense matrix, Angstrom. Not
 
                            returned if there is an electron in the
 
                            isotope list (in the EPR case it is not
 
                            a good idea to use the molecular
 
                            coordinates for spins).
 
 
    inter.zeeman.matrix  - Nspins x 1 cell array of 3x3 matrices,
 
                            ppm for nuclei, g-tensor for electrons.
 
                            Zero interactions have zero matrices.
 
 
    inter.coupling.matrix - Nspins x Nspins cell array of 3x3 matrices,
 
                            all in Hz. Zero interactions have zero
 
                            matrices.
 
 
    inter.coupling.scalar - Nspins x Nspins cell array of scalar
 
                            couplings, all in Hz. Zero couplings are
 
                            returned as zeros.
 

Revision as of 15:48, 5 April 2026

Forms Spinach data structures from Gaussian parsing output returned by gparse.m function. This function converts the information obtained by parsing a Gaussian log file into the form that Spinach gateway function create.m understands.

Syntax

    [sys,inter]=g2spinach(props,nuclei,references,options)

Arguments

    props      - the data structure obtained from gparse.m

    nuclei     - a cell array of the following form: {{'H','1H'},{'N','15N'}...}
                 giving the list of isotopes that should be imported. All other spins
                 will be ignored. If the isotope list involves an electron, e.g.

                                  {{'E','E'},{'H','1H'}...}
    
                 then ESR mode is assumed - chemical shielding and scalar couplings 
                 are ignored, but g-tensor and hyperfine couplings are included.

    references - a vector of reference chemical shielding values in ppm. It is usually
                 necessary to run Gaussian on, say, TMS with the same method, and the 
                 resulting chemical shift goes here. It is used to convert absolute 
                 chemical shielding into chemical shift that create.m requires.

    options.min_j    -  scalar coupling threshold in Hz. J-couplings
                        smaller than this value will be ignored in the
                        NMR mode.

    options.min_hfc  -  hyperfine coupling threshold in Hz. Hyperfine
                        tensors with a Frobenius norm smaller than 
                        this value will be ignored in the EPR mode.

    options.purge    -  if set to 'on' in EPR mode, removes the spins
                        with hyperfine coupling below options.min_hfc
                        from the spin system.

    options.no_xyz   -  if set to 1, causes the function to ignore the
                        coordinate information in the Gaussian log.

Returns

The following subfields of sys and inter data structures are set by this function:

    sys.isotopes          - Nspins x 1 cell array of strings

    inter.coordinates     - Nspins x 3 dense matrix, Angstrom. Not
                            returned if there is an electron in the
                            isotope list (in the EPR case it is not
                            a good idea to use the molecular 
                            coordinates for spins).

    inter.zeeman.matrix   - Nspins x 1 cell array of 3x3 matrices,
                            ppm for nuclei, g-tensor for electrons.
                            Zero interactions have zero matrices.

    inter.coupling.matrix - Nspins x Nspins cell array of 3x3 matrices,
                            all in Hz. Zero interactions have zero 
                            matrices.

    inter.coupling.scalar - Nspins x Nspins cell array of scalar
                            couplings, all in Hz. Zero couplings are
                            returned as zeros.

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.space_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

As a reference, here are absolute isotropic shielding values for TMS in vacuum:

    GIAO                  13C       1H 
    B3LYP/6-31G*        189.6621  32.1833 
    B3LYP/6-311+G(2d,p) 182.4485  31.8201 
    HF/6-31G*           199.9711  32.5957 
    HF/6-311+G(2d,p)    192.5828  32.0710
    CSGT                  13C       1H 
    B3LYP/6-31G*        188.5603  29.1952 
    B3LYP/6-311+G(2d,p) 182.1386  31.7788 
    HF/6-31G*           196.8670  29.5517 
    HF/6-311+G(2d,p)    192.5701  31.5989

For chemical shift tensors, the anisotropies computed with electronic structure methods (DFT, MP2, etc.) are usually satisfactory for the purposes of relaxation theory, but the isotropic chemical shifts can differ significantly from the experimental values. After the import is complete, the isotropic parts of chemical shift tensors may be replaced with their experimental values using shift_iso.m function.

See also

gparse.m, oparse.m, create.m


Version 1.9, authors: Ilya Kuprov