Difference between revisions of "G2spinach.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(→‎Returns)
 
(sync with Spinach main 3975f139: renamed basis field)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
−
Forms ''Spinach'' data structures from Gaussian parsing output returned by [[gparse.m]] function.
+
{{DISPLAYTITLE:g2spinach.m}} __NOTOC__
 +
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)
  
−
==Description==
+
==Parameters==
−
This function converts the information obtained by parsing a Gaussian log file into the form that ''Spinach'' gateway function [[create.m]] understands.
 
  
−
==Arguments==
+
     props      - the output of [[gparse.m]] function
−
 
+
−
     props      - the data structure obtained from [[gparse.m]]
+
    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:
 
   
 
   
−
    nuclei    - a cell array of the following form: {{'H','1H'},{'N','15N'}...}
+
                  GIAO                  13C      1H
−
                  giving the list of isotopes that should be imported. All other spins
+
                  B3LYP/6-31G*        189.6621  32.1833
−
                  will be ignored. If the isotope list involves an electron, e.g.
+
                  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
 
   
 
   
−
                                  {{'E','E'},{'H','1H'}...}
+
                  CSGT                  13C      1H  
−
   
+
                  B3LYP/6-31G*        188.5603  29.1952
−
                  then ESR mode is assumed - chemical shielding and scalar couplings
+
                  B3LYP/6-311+G(2d,p) 182.1386  31.7788
−
                  are ignored, but g-tensor and hyperfine couplings are included.
+
                  HF/6-31G*          196.8670  29.5517
 +
                  HF/6-311+G(2d,p)    192.5701  31.5989
 
   
 
   
−
    references - a vector of reference chemical shielding values in ppm. It is usually
+
                  This setting is ignored when electrons are
−
                   necessary to run Gaussian on, say, TMS with the same method, and the
+
                   present in the system.
−
                  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
+
     options.min_j    -  scalar coupling threshold in Hz. J-coup-
−
                         smaller than this value will be ignored in the
+
                         lings smaller than this value will be  
−
                        NMR mode.
+
                        ignored in the NMR mode.
 
   
 
   
−
     options.min_hfc  -  hyperfine coupling threshold in Hz. Hyperfine
+
     options.min_hfc  -  hyperfine coupling threshold in Hz. Hy-
−
                         tensors with a Frobenius norm smaller than  
+
                         perfine tensors with a Frobenius norm  
−
                        this value will be ignored in the EPR mode.
+
                        smaller than this value will be ignored
 +
                        in the EPR mode.
 
   
 
   
−
     options.purge    -  if set to 'on' in EPR mode, removes the spins
+
     options.purge    -  if set to 'on' in EPR mode, removes the
−
                         with hyperfine coupling below options.min_hfc
+
                         spins with hyperfine coupling below  
−
                        from the spin system.
+
                        options.min_hfc from the spin system.
 
   
 
   
−
     options.no_xyz  -  if set to 1, causes the function to ignore the
+
     options.no_xyz  -  if set to 1, causes the function to ig-
−
                         coordinate information in the Gaussian log.
+
                         nore the coordinate information and
 +
                        only keep the interaction tensors
  
 
==Returns==
 
==Returns==
−
The following sybfields of sys and inter data structures are returned:
+
The following subfields of sys and inter data structures are set by this function:
  
 
     sys.isotopes          - Nspins x 1 cell array of strings
 
     sys.isotopes          - Nspins x 1 cell array of strings
Line 63: 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 78: 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 112: Line 137:
 
     % Plotting
 
     % Plotting
 
     plot_1d(spin_system,real(spectrum),parameters);
 
     plot_1d(spin_system,real(spectrum),parameters);
 +
 +
'''Further examples of Gaussian inputs:''' [[:File:gaussian_a.txt|gaussian_a.txt]], [[:File:gaussian_b.txt|gaussian_b.txt]], [[:File:gaussian_c.txt|gaussian_c.txt]] - note that the extra printing flag (#p) should always be present.
  
 
==Notes==
 
==Notes==
Line 126: Line 153:
 
     B3LYP/6-311+G(2d,p) 182.1386  31.7788  
 
     B3LYP/6-311+G(2d,p) 182.1386  31.7788  
 
     HF/6-31G*          196.8670  29.5517  
 
     HF/6-31G*          196.8670  29.5517  
−
     HF/6-311+G(2d,p)    192.5701  31.5989  
+
     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==
 
==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]]
−
 
 
  
−
''Revision 3284, 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