Ejemplo n.º 1
0
  Only show couplings where the coupling in the opposite direction exists in another calculation.
"""

import os
import sys

from magres.format import BadVersion
from magres.atoms import MagresAtoms
from magres.utils import load_all_magres

cwd = "."

if len(sys.argv)>1:
    cwd = str(sys.argv[1])

magres_atoms = load_all_magres(cwd)

find_s = str(sys.argv[2])

if len(sys.argv) >= 4:
  find_i = int(sys.argv[3])
else:
  find_i = None

tensors = ['efg', 'efg_local', 'efg_nonlocal']

lines = []

def get_numeric(s):
  return "".join([c for c in s if ord("0") <= ord(c) <= ord("9")])
Ejemplo n.º 2
0
if atoms_filter_str:
  atoms_filter = parse_atom_list(atoms_filter_str)
else:
  atoms_filter = lambda x: True

tensors = ['ms']

lines = []

print "# Number\tAtom\tIso\tAniso\tAsym\tPath"

if os.path.isfile(a.source_dir):
  magres_atoms = [MagresAtoms.load_magres(a.source_dir)]
else:
  magres_atoms = load_all_magres(a.source_dir)

isos = {}

for iso_ in a.iso:
  num = re.findall('([0-9]+)', iso_)[0]
  sym = re.findall('([A-Za-z]+)', iso_)[0]

  isos[sym] = int(num)

for i, atoms in enumerate(magres_atoms):
  num = get_numeric(atoms.magres_file.path)

  for s, iso in isos.items():
    for atom in atoms.species(s):
      atom.isotope = iso
Ejemplo n.º 3
0
  Only show couplings where the coupling in the opposite direction exists in another calculation.
"""

import os
import sys

from magres.format import BadVersion
from magres.atoms import MagresAtoms
from magres.utils import load_all_magres

cwd = "."

if len(sys.argv)>1:
    cwd = str(sys.argv[1])

magres_atoms = load_all_magres(cwd)

find_s1 = str(sys.argv[2])
find_i1 = int(sys.argv[3])

if len(sys.argv) >= 5:
  find_s2 = str(sys.argv[4])
else:
  find_s2 = None

if len(sys.argv) >= 6:
  find_i2 = int(sys.argv[5])
else:
  find_i2 = None

all_Js = {}
Ejemplo n.º 4
0
tensors = [
    'efg',
]  # 'efg_local', 'efg_nonlocal']

lines = []

if a.numbers:
    print("# Number\tAtom\tCq\tEta\tPath")
else:
    print("# Atom\tCq\tEta\tPath")

if os.path.isfile(a.source):
    magres_atoms = [MagresAtoms.load_magres(a.source)]
else:
    magres_atoms = load_all_magres(a.source)

for i, atoms in enumerate(magres_atoms):
    num = get_numeric(atoms.magres_file.path)

    if num:
        idx = num
    else:
        idx = [i]

    for atom in atoms:
        if atoms_filter(atom) and \
                hasattr(atom, 'efg'):

            lines.append(
                (idx, atoms.magres_file.path, str(atom),
Ejemplo n.º 5
0
    omega = 3A(2|m| + 1)/hbar

  for all available transitions m->m+1

"""
import sys
import math
from magres.atoms import MagresAtoms
from magres.utils import load_all_magres
import magres.units as units

s = sys.argv[1]

atomss = []
for f in sys.argv[2:]:
  atomss += load_all_magres(f)

def frange(a, b, x):
  while a < b:
    yield a
    a += x

for atoms in atomss:
  print atoms.magres_file.path

  vals = []

  first = True

  for atom in atoms:
    if atom.species == s:
Ejemplo n.º 6
0
    omega = 3A(2|m| + 1)/hbar

  for all available transitions m->m+1

"""
import sys
import math
from magres.atoms import MagresAtoms
from magres.utils import load_all_magres
import magres.units as units

s = sys.argv[1]

atomss = []
for f in sys.argv[2:]:
  atomss += load_all_magres(f)

def frange(a, b, x):
  while a < b:
    yield a
    a += x

for atoms in atomss:
  print atoms.magres_file.path

  vals = []

  first = True

  for atom in atoms:
    if atom.species == s: