import sys from magres.format import MagresFile from magres.utils import find_all_magres from magres.atoms import MagresAtoms magres_files = [MagresFile(f) for f in find_all_magres(sys.argv[1])] atoms = MagresAtoms.load_magres(magres_files) coupling_atom = atoms.get_species('C', 1) # Set a bunch of arbitrary references for the magnetic shielding atoms.set_reference('H', 100.0) atoms.set_reference('C', 55.0) atoms.set_reference('O', -2.0) for atom in atoms: print atom, atom.efg.Cq, atom.ms.iso, atom.isc[coupling_atom].J_iso
#!python import sys from magres.format import MagresFile, BadVersion from magres.atoms import MagresAtoms from magres.utils import find_all_magres magres_files = [] for f in find_all_magres(sys.argv[1]): try: magres_files.append(MagresFile(f)) except BadVersion: continue s1 = sys.argv[2] i1 = int(sys.argv[3]) s2 = sys.argv[4] i2 = int(sys.argv[5]) tensor = 'isc' if len(sys.argv) >= 7: tensor = sys.argv[6] atoms = MagresAtoms.load_magres(magres_files) atom1 = atoms.get_species(s1, i1) atom2 = atoms.get_species(s2, i2) if tensor == "isc_spin_total": K1 = atom1.isc_fc[atom2].K + atom1.isc_spin[atom2].K K2 = atom2.isc_fc[atom1].K + atom2.isc_spin[atom1].K else:
#!/usr/bin/python import sys from numpy.linalg import det from magres.format import MagresFile, BadVersion from magres.atoms import MagresAtoms from magres.utils import find_all_magres magres_files = [] for f in find_all_magres(sys.argv[1]): try: magres_files.append(MagresFile(f)) except BadVersion: continue s1 = sys.argv[2] i1 = int(sys.argv[3]) s2 = sys.argv[4] i2 = int(sys.argv[5]) tensor = 'isc' if len(sys.argv) >= 7: tensor = sys.argv[6] atoms = MagresAtoms.load_magres(magres_files) atom1 = atoms.get_species(s1, i1) atom2 = atoms.get_species(s2, i2) if tensor == "isc_spin_total": K1 = atom1.isc_fc[atom2].K + atom1.isc_spin[atom2].K K2 = atom2.isc_fc[atom1].K + atom2.isc_spin[atom1].K