Difference between revisions of "G2spinach.m"

From Spinach Documentation Wiki
Jump to: navigation, search
m (Spot-edit Spinach function page first-line NOTOC and template fields)
(sync with Spinach main 3975f139: renamed basis field)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:g2spinach.m}} __NOTOC__
 
{{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.
+
Makes ''Spinach'' data structures from parsed outputs of electronic structure theory packages, such as Gaussian and ORCA. This function converts the information obtained by parsing an electronic structure theory log file into the form that ''Spinach'' gateway function [[create.m]] understands.
  
 
==Syntax==
 
==Syntax==
  
−
     [sys,inter]=g2spinach(props,nuclei,references,options)
+
     [sys,inter]=g2spinach(props,particles,references,options)
  
−
==Arguments==
+
==Parameters==
  
−
     props      - the data structure obtained from [[gparse.m]]
+
     props      - the output of [[gparse.m]] function
 
   
 
   
−
     nuclei    - a cell array of the following form: {{'H','1H'},{'N','15N'}...}
+
     particles  - a cell array of the following form:
−
                  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'}...}
+
                          {{'H','1H'},{'N','15N'}...}
 
   
 
   
−
                   then ESR mode is assumed - chemical shielding and scalar couplings  
+
                  giving the list of elements and isotopes that
−
                  are ignored, but g-tensor and hyperfine couplings are included.
+
                  should be imported; all other spins will be
 +
                  ignored. If the isotope list contains
 +
                  an electron, e.g. {{'E','E'},{'H','1H'}...},
 +
                   then EPR 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
+
     references - a vector of absolute shielding values for
−
                   necessary to run Gaussian on, say, TMS with the same method, and the
+
                  the reference substances that are to be
−
                   resulting chemical shift goes here. It is used to convert absolute
+
                  placed at zero ppm chemical shift; you ne-
−
                   chemical shielding into chemical shift that [[create.m]] requires.
+
                   ed to run separate electronic structure
 +
                  theory calculations for those substances
 +
                  wuth the same method. Absolute isotropic
 +
                   shielding values for tetramethylsilane in
 +
                   vacuum are:
 
   
 
   
−
    options.min_j    -  scalar coupling threshold in Hz. J-couplings
+
                  GIAO                  13C      1H
−
                        smaller than this value will be ignored in the
+
                  B3LYP/6-31G*        189.6621  32.1833
−
                        NMR mode.
+
                  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
 
   
 
   
−
    options.min_hfc -  hyperfine coupling threshold in Hz. Hyperfine
+
                  CSGT                  13C      1H
−
                        tensors with a Frobenius norm smaller than
+
                  B3LYP/6-31G*        188.5603 29.1952
−
                        this value will be ignored in the EPR mode.
+
                  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
 
   
 
   
−
    options.purge    -  if set to 'on' in EPR mode, removes the spins
+
                  This setting is ignored when electrons are
−
                        with hyperfine coupling below options.min_hfc
+
                  present in the system.
−
                        from the spin system.
 
 
   
 
   
−
     options.no_xyz  -  if set to 1, causes the function to ignore the
+
    options.min_j    -  scalar coupling threshold in Hz. J-coup-
−
                         coordinate information in the Gaussian log.
+
                        lings smaller than this value will be
 +
                        ignored in the NMR mode.
 +
 +
    options.min_hfc  -  hyperfine coupling threshold in Hz. Hy-
 +
                        perfine 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 ig-
 +
                         nore the coordinate information and
 +
                        only keep the interaction tensors
  
 
==Returns==
 
==Returns==
Line 61: Line 85:
 
                             couplings, all in Hz. Zero couplings are
 
                             couplings, all in Hz. Zero couplings are
 
                             returned as zeros.
 
                             returned as zeros.
 +
 +
    inter.spinrot.matrix  - spin-rotation coupling tensors for
 +
                            each nucleus
  
 
==Examples==
 
==Examples==
Line 76: Line 103:
 
     bas.approximation='IK-2';
 
     bas.approximation='IK-2';
 
     bas.connectivity='scalar_couplings';
 
     bas.connectivity='scalar_couplings';
−
     bas.space_level=2;
+
     bas.prox_level=2;
 
      
 
      
 
     % Relaxation theory parameters
 
     % Relaxation theory parameters
Line 131: Line 158:
  
 
==See also==
 
==See also==
−
[[gparse.m]], [[oparse.m]], [[create.m]]
+
[[gparse.m]], [[oparse.m]], [[create.m]], [[shift_iso.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 1.9, authors: [[Ilya Kuprov]]''
 
''Version 1.9, authors: [[Ilya Kuprov]]''

Latest revision as of 11:00, 18 September 2026

Makes Spinach data structures from parsed outputs of electronic structure theory packages, such as Gaussian and ORCA. This function converts the information obtained by parsing an electronic structure theory log file into the form that Spinach gateway function create.m understands.

Syntax

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

Parameters

    props      - the output of gparse.m function

    particles  - a cell array of the following form:

                         {{'H','1H'},{'N','15N'}...}

                 giving the list of elements and isotopes that
                 should be imported; all other spins will be
                 ignored. If the isotope list contains
                 an electron, e.g. {{'E','E'},{'H','1H'}...}, 
                 then EPR mode is assumed - chemical shielding 
                 and scalar couplings are ignored, but g-tensor
                 and hyperfine couplings are included.

    references - a vector of absolute shielding values for 
                 the reference substances that are to be
                 placed at zero ppm chemical shift; you ne-
                 ed to run separate electronic structure 
                 theory calculations for those substances
                 wuth the same method. Absolute isotropic 
                 shielding values for tetramethylsilane in
                 vacuum are:

                  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

                 This setting is ignored when electrons are
                 present in the system.

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

    options.min_hfc  -  hyperfine coupling threshold in Hz. Hy-
                        perfine 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 ig-
                        nore the coordinate information and
                        only keep the interaction tensors

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.

    inter.spinrot.matrix  - spin-rotation coupling tensors for
                            each nucleus

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

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, shift_iso.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 1.9, authors: Ilya Kuprov