def run(args): if not Kdb().check_version(): sys.exit() if len(args) < 1: print "first parameter sohuld be either: inert or query" sys.exit() if args[0] == 'insert': if len(args) < 4: print "parameters for insert should include reactant, saddle, and product files." sys.exit() try: reactant = read_any(args[1]) saddle = read_any(args[2]) product = read_any(args[3]) except IOError: print "One or more files could not be read." sys.exit() try: mode = Kdb().load_mode(args[3]) except: mode = None server_insert(reactant, saddle, product, mode) elif args[0] == 'query': if len(args) < 2: print "parameters for query should include a reactant file." sys.exit() try: reactant = read_any(args[1]) except IOError: print "could not read reactant file." sys.exit() server_query(reactant)
name = db.get_name(args['reactant'].get_chemical_symbols()) entries = db.get_process(name) return entries, name if __name__ == "__main__": # Parse command line options. parser = OptionParser(usage = "%prog [options] reactant.con") parser.add_option("-a", "--alias", dest = "alias", help = "the name of the SQL kdb", default = KDB_NAME) parser.add_option("--nodupes", dest = "nodupes", action="store_true", help = "detect and remove duplicate suggestions (can be expensive)") options, args = parser.parse_args() # Make sure we get the reactant file name. if len(args) < 1: parser.print_help() sys.exit() # Load the reactant con file. reactant = read_any(args[0]) # get database params db = LocalDB(options.alias) params = db.get_params() #create isntance of LocalQuery and run query() query_sub_class = LocalQuery() query_sub_class.query(reactant, "./kdbmatches", dc=params['dc'], nf=params['nf'], nodupes=options.nodupes, kdbname=options.alias)
#!/usr/bin/env python import aselite from sys import argv, exit if len(argv) < 3: print 'usage: center.py FILE STDDEV' print ' randomly displaces the atoms in FILE by a gaussian with' print ' a standard deviation of STDDEV' print exit(0) filename = argv[1] stddev = float(argv[2]) atoms = aselite.read_any(filename) atoms.rattle(stddev) atoms.write(filename)
dest="alias", help="the name of the SQL kdb", default=KDB_NAME) parser.add_option( "--nodupes", dest="nodupes", action="store_true", help="detect and remove duplicate suggestions (can be expensive)") options, args = parser.parse_args() # Make sure we get the reactant file name. if len(args) < 1: parser.print_help() sys.exit() # Load the reactant con file. reactant = read_any(args[0]) # get database params db = LocalDB(options.alias) params = db.get_params() #create isntance of LocalQuery and run query() query_sub_class = LocalQuery() query_sub_class.query(reactant, "./kdbmatches", dc=params['dc'], nf=params['nf'], nodupes=options.nodupes, kdbname=options.alias)
#!/usr/bin/env python import aselite from sys import argv, exit if len(argv) < 2 or len(argv) > 3 or '-h' in argv: print('usage: center.py FILE [DISTANCE]') print(' centers the structure in the current box and') print(' optionally adds DISTANCE amount of vacuum to FILE') print() exit(0) filename = argv[1] if len(argv) == 3: distance = float(argv[2]) else: distance = None atoms = aselite.read_any(filename) if distance: atoms.center(distance) else: atoms.center() atoms.write(filename)
parser.add_option("-m", "--mac", dest="mac", action="store", type="float", help="mobile atom cutoff parameter", default=None) options, args = parser.parse_args() # Make sure we get the reactant, saddle, product, and mode files. if len(args) < 3: parser.print_help() sys.exit() # Load the reactant, saddle, product, and mode files. reactant = read_any(args[0]) saddle = read_any(args[1]) product = read_any(args[2]) mode = None if options.mode is not None: mode = insert_sub_class.load_mode(options.mode) # load previous params db = LocalDB(KDB_NAME) params = db.get_params() if options.nf is None: options.nf = params['nf'] if options.dc is None: options.dc = params['dc'] if options.mac is None: options.mac = params['mac']
if __name__ == "__main__": insert_sub_class = RemoteInsert() # Parse command line options. parser = OptionParser(usage = "%prog [options] reactant saddle product mode") parser.add_option("-o", "--mode", dest = "mode", help = "optional mode file", default = None) options, args = parser.parse_args() # Make sure we get the reactant, saddle, product, and mode files. if len(args) < 3: parser.print_help() sys.exit() # Load the reactant, saddle, product, and mode files. reactant = read_any(args[0]) saddle = read_any(args[1]) product = read_any(args[2]) mode = None if options.mode is not None: mode = insert_sub_class.load_mode(options.mode) # load previous params db = RemoteDB() params = db.get_params() nf = params['nf'] dc = params['dc'] mac = params['mac'] insert_sub_class.insert(reactant, saddle, product, mode, nf=nf, dc=dc, mac=mac)
#!/usr/bin/env python import sys import aselite if len(sys.argv) < 3: print 'usage: 2con.py IN OUT' print ' converts file IN of type POSCAR or xyz to con and saves it to OUT' print sys.exit(0) traj = aselite.read_any(sys.argv[1]) aselite.write_con(sys.argv[2], traj)