from magres.atoms import MagresAtoms from magres.utils import load_all_magres, get_numeric, parse_atom_list parser = argparse.ArgumentParser(description='Extract magnetic shielding parameters from a set of calculations.') parser.add_argument('-N', '--numbers', action="store_const", help="Parse numbers from path and print. This is useful for e.g. convergence calculations.", default=False, const=True) parser.add_argument('source_dir', help='Directory to look for calculations below.') parser.add_argument('--iso', action='append') parser.add_argument('atoms', nargs='?', type=str, default=None, help='Which atoms to print shieldings of. Specify with atom list notation, e.g. "H1" or "H1,H2,H3" or "H,C" or "H1-3".') a = parser.parse_args(sys.argv[1:]) atoms_filter_str = a.atoms 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 = {}
parser.add_argument('source_dir', help='Directory to look for calculations in') parser.add_argument('atoms1', nargs='?', type=str, default=None, help='Only print couplings from these atoms. Specify with atom list notation, e.g. "H1", "H1,H2,' 'H3", "H,C", or "H1-3".') parser.add_argument('atoms2', nargs='?', type=str, default=None, help='Only print couplings to these atoms. Specify with atom list notation, e.g. "H1", "H1,H2,' 'H3", "H,C", or "H1-3".') a = parser.parse_args(sys.argv[1:]) atoms1 = a.atoms1 atoms2 = a.atoms2 if atoms1: atoms1_filter = parse_atom_list(atoms1) else: atoms1_filter = lambda x: True if atoms2: atoms2_filter = parse_atom_list(atoms2) else: atoms2_filter = lambda x: True all_Js = {} tensors = ['isc', 'isc_fc', 'isc_spin', 'isc_orbital_p', 'isc_orbital_d'] if a.J_tensor: print("# Showing in Hz (J)") property = "J_iso"
parser.add_argument( 'atoms', nargs='?', type=str, default=None, help= 'Which atoms to print shieldings of. Specify with atom list notation, e.g. "H1" or "H1,H2,' 'H3" or "H,C" or "H1-3".') a = parser.parse_args(sys.argv[1:]) atoms_filter_str = a.atoms if atoms_filter_str: atoms_filter = parse_atom_list(atoms_filter_str) else: atoms_filter = lambda x: True 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):
parser.add_argument( 'atoms2', nargs='?', type=str, default=None, help= 'Only print couplings to these atoms. Specify with atom list notation, e.g. "H1", "H1,H2,' 'H3", "H,C", or "H1-3".') a = parser.parse_args(sys.argv[1:]) atoms1 = a.atoms1 atoms2 = a.atoms2 if atoms1: atoms1_filter = parse_atom_list(atoms1) else: atoms1_filter = lambda x: True if atoms2: atoms2_filter = parse_atom_list(atoms2) else: atoms2_filter = lambda x: True all_Js = {} tensors = ['isc', 'isc_fc', 'isc_spin', 'isc_orbital_p', 'isc_orbital_d'] if a.J_tensor: print("# Showing in Hz (J)") property = "J_iso"