soprano.calculate.nmr.simpson#

Classes and functions for interfacing with the SIMPSON spin dynamics software.

Functions

load_simpson_dat(filename)

Load a SIMPSON output .dat file and return it as a numpy array.

write_spinsys(s[, isotope_list, use_ms, ...])

Write a .spinsys input file for use with SIMPSON, given the details of a system.

Classes

SimpsonSequence(spinsys_source)

A class storing parameters and scripts for the production of a SIMPSON input file.

class soprano.calculate.nmr.simpson.SimpsonSequence(spinsys_source)[source]#

Bases: object

A class storing parameters and scripts for the production of a SIMPSON input file. The parameters of the simulation are stored in a dictionary member accessible as .pars and can be set at will.

Args:
spinsys_source (str): path of the .spinsys file to use in the
simulation
write_input(path=None)[source]#

Print out the .in file.

Args:
path (str): path to save the newly created file to. If not provided,
the contents will be simply returned as a string.
soprano.calculate.nmr.simpson._write_spinsys_legacy(s, isotope_list, use_ms, ms_iso, ms_tag, q_order, efg_tag, dip_sel, path, ref, grad, obs_nuc)[source]#

Legacy backend for write_spinsys. Uses per-property extraction directly.

soprano.calculate.nmr.simpson._write_spinsys_spinsys(s, isotope_list, use_ms, ms_iso, ms_tag, q_order, efg_tag, dip_sel, path, ref, grad, obs_nuc, include_cross_terms=True)[source]#

SpinSystem backend for write_spinsys.

soprano.calculate.nmr.simpson.load_simpson_dat(filename)[source]#

Load a SIMPSON output .dat file and return it as a numpy array.

soprano.calculate.nmr.simpson.write_spinsys(s, isotope_list=None, use_ms=False, ms_iso=False, ms_tag='ms', q_order=0, efg_tag='efg', dip_sel=None, path=None, ref=None, grad=-1.0, obs_nuc=None, backend='spinsys', include_cross_terms=True)[source]#

Write a .spinsys input file for use with SIMPSON, given the details of a system. This is meant to be a low-level function, used by other higher level interfaces in NMRCalculator.

Parameters:
  • s (ase.Atoms) – atomic structure containing the desired spins. All atoms will be included - if that is not the desired result, this should be accomplished by making this a subset of the full structure.

  • isotope_list ([int]) – list of isotopes for each element in the system. If left to None, default NMR-active isotopes will be used.

  • use_ms (bool) – if True, include shift interactions from magnetic shieldings.

  • ms_iso (bool) – if True, all magnetic shieldings will be made isotropic.

  • ms_tag (str) – tag for the magnetic shielding tensor array. Default: ‘ms’.

  • q_order (int) – if greater than 0, include quadrupolar interactions from Electric Field Gradients at the given order (1 or 2).

  • efg_tag (str) – tag for the EFG tensor array. Default: ‘efg’.

  • dip_sel (AtomSelection) – if not None, include dipolar couplings between atoms belonging to this set.

  • path (str) – path to save the newly created file to. If not provided, the contents will be simply returned as a string.

  • ref (dict) – dictionary of reference values for the calculation. This is used to convert from raw shielding values to chemical shifts. The dictionary should be in the form {element: value}, where value is the reference shielding for that element in ppm.

  • grad (float|dict|list) – gradient to use when converting from raw shielding values to chemical shifts. If a float is provided, it will be used for all elements. If a dictionary is provided, it should be in the form {element: value}, where value is the gradient for that element. If a list is provided, it should have one value per site. Defaults to a gradient of -1.0 for all elements.

  • obs_nuc (str) – specify the nucleus to be observed, e.g. ‘1H’.

  • backend (str) – backend to use. Options are ‘spinsys’ (default) or ‘legacy’. The ‘legacy’ backend is deprecated and will be removed in a future version.

  • include_cross_terms (bool) – if True (default), include second-order cross-term keywords (quadrupole_x_dipole and quadrupole_x_shift) when the system contains both quadrupolar and dipolar/shift interactions. Set to False to suppress them (e.g. for single-crystal simulations where only first-order terms are needed). Only used with the ‘spinsys’ backend.

Returns:

spinsys file in string format. Only returned if

no save path is provided.

Return type:

file_contents (str)