Example #1
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]
    ### run GUI by default ###
    args = sys.argv[1:]
    gui = True
    cmd = False
    if len(args)==0 and not qtflag:
        print "\nGUI not supported since PyQt5 can not be loaded. Please use commandline version.\n"
        exit()
    ####################################
    ### print help ###
    elif '-h' in args or '-H' in args or '--help' in args:
        if 'advanced' in args:
            parser = argparse.ArgumentParser(description=DescString_advanced)
            parseinputs_advanced(parser)            
        if 'slabgen' in args:
            parser = argparse.ArgumentParser(description=DescString_slabgen)
            parseinputs_slabgen(parser)
    #    elif 'chainb' in args:
    #        parser = argparse.ArgumentParser(description=DescString_chainb)
    #        parseinputs_chainb(parser)            
    #    elif 'autocorr' in args:
    #        parser = argparse.ArgumentParser(description=DescString_autocorr)
    #        parseinputs_autocorr(parser)           
        elif 'db' in args:
            parser = argparse.ArgumentParser(description=DescString_db)
            parseinputs_db(parser)       
        elif 'inputgen' in args:
            parser = argparse.ArgumentParser(description=DescString_inputgen)
            parseinputs_inputgen(parser)            
        elif 'postproc' in args:
            parser = argparse.ArgumentParser(description=DescString_postproc)
            parseinputs_postproc(parser)         
        elif 'random' in args:
            parser = argparse.ArgumentParser(description=DescString_random)
            parseinputs_random(parser)
        elif 'binding' in args:
            parser = argparse.ArgumentParser(description=DescString_binding)
            parseinputs_binding(parser)            
        elif 'tsgen' in args:
            parser = argparse.ArgumentParser(description=DescString_tsgen)
            parseinputs_tsgen(parser)            
        elif 'customcore' in args:
            parser = argparse.ArgumentParser(description=DescString_customcore)
            parseinputs_customcore(parser) 
        elif 'naming' in args:
            parser = argparse.ArgumentParser(description=DescString_naming)
            parseinputs_naming(parser)                          
        else:
            # print basic help    
            parser = argparse.ArgumentParser(description=DescString_basic,formatter_class=argparse.RawDescriptionHelpFormatter)
            parseinputs_basic(parser) 
        exit()
    ### run with gui ###
    elif gui and len(args)==0:
        print('molSimplify is starting!')
        ### create main application
        app = QApplication(sys.argv) # main application
        gui = mGUI(app) # main GUI class
        app.processEvents()
        app.exec_()
    ### if input file is specified run without GUI ###
    elif '-i' in args:
        print('Input file detected, reading arguments from input file')
        print('molSimplify is starting!')
        gui = False
        # run from commandline
        emsg = startgen(sys.argv,False,gui)
    ### grab from commandline arguments ###
    else:
        print('No input file detected, reading arguments from commandline')
        print('molSimplify is starting!')
        gui = False
        # create input file from commandline
        infile = parseCLI(filter(None,args))
        args = ['main.py','-i',infile]
        emsg = startgen(args,False,gui)
Example #2
0
def main(args=None):
    if args is None:
        args = sys.argv[1:]
    ### run GUI by default ###
    args = sys.argv[1:]
    gui = True
    cmd = False
    if len(args) == 0 and not qtflag:
        print "\nGUI not supported since PyQt5 can not be loaded. Please use commandline version.\n"
        exit()
    ####################################
    ### print help ###
    elif '-h' in args or '-H' in args or '--help' in args:
        if 'advanced' in args:
            parser = argparse.ArgumentParser(description=DescString_advanced)
            parseinputs_advanced(parser)
        if 'slabgen' in args:
            parser = argparse.ArgumentParser(description=DescString_slabgen)
            parseinputs_slabgen(parser)
    #    elif 'chainb' in args:
    #        parser = argparse.ArgumentParser(description=DescString_chainb)
    #        parseinputs_chainb(parser)
    #    elif 'autocorr' in args:
    #        parser = argparse.ArgumentParser(description=DescString_autocorr)
    #        parseinputs_autocorr(parser)
        elif 'db' in args:
            parser = argparse.ArgumentParser(description=DescString_db)
            parseinputs_db(parser)
        elif 'inputgen' in args:
            parser = argparse.ArgumentParser(description=DescString_inputgen)
            parseinputs_inputgen(parser)
        elif 'postproc' in args:
            parser = argparse.ArgumentParser(description=DescString_postproc)
            parseinputs_postproc(parser)
        elif 'random' in args:
            parser = argparse.ArgumentParser(description=DescString_random)
            parseinputs_random(parser)
        elif 'binding' in args:
            parser = argparse.ArgumentParser(description=DescString_binding)
            parseinputs_binding(parser)

        elif 'customcore' in args:
            parser = argparse.ArgumentParser(description=DescString_customcore)
            parseinputs_customcore(parser)
        elif 'naming' in args:
            parser = argparse.ArgumentParser(description=DescString_naming)
            parseinputs_naming(parser)
        else:
            # print basic help
            parser = argparse.ArgumentParser(
                description=DescString_basic,
                formatter_class=argparse.RawDescriptionHelpFormatter)
            parseinputs_basic(parser)
        exit()
    ### run with gui ###
    elif gui and len(args) == 0:
        print('molSimplify is starting!')
        ### create main application
        app = QApplication(sys.argv)  # main application
        gui = mGUI(app)  # main GUI class
        app.processEvents()
        app.exec_()
    ### if input file is specified run without GUI ###
    elif '-i' in args:
        print('Input file detected, reading arguments from input file')
        print('molSimplify is starting!')
        gui = False
        # run from commandline
        emsg = startgen(sys.argv, False, gui)
    ### grab from commandline arguments ###
    else:
        print('No input file detected, reading arguments from commandline')
        print('molSimplify is starting!')
        gui = False
        # create input file from commandline
        infile = parseCLI(filter(None, args))
        args = ['main.py', '-i', infile]
        emsg = startgen(args, False, gui)
Example #3
0
def main(args=None):
    ## issue a call to test TF, this is needed to keep
    ## ordering between openbabel and TF calls consistent
    ## on some sytems
    if globs.testTF():
        print('TensorFlow connection successful')
        tensorflow_silence()
    else:
        print('TensorFlow connection failed')
    if not globs.custom_path or not os.path.exists(str(globs.custom_path)):
        print(
            'First time use, need to set a custom path. Please enter a writeable file path:'
        )
        new_path = input('path=(~/.molsimplify/)')
        if not new_path: new_path = os.path.expanduser("~/.molsimplify/")
        globs.add_custom_path(new_path)
        copy_to_custom_path()

    if args is None:
        args = sys.argv[1:]
    ### run GUI by default ###
    args = sys.argv[1:]
    gui = True
    cmd = False
    if len(args) == 0 and not qtflag:
        print(
            "\nGUI not supported since PyQt5 can not be loaded. Please use commandline version.\n"
        )
        exit()
    ####################################
    ### print help ###
    elif '-h' in args or '-H' in args or '--help' in args:
        if 'advanced' in args:
            parser = argparse.ArgumentParser(description=DescString_advanced)
            parseinputs_advanced(parser)
        if 'slabgen' in args:
            parser = argparse.ArgumentParser(description=DescString_slabgen)
            parseinputs_slabgen(parser)
        #    elif 'chainb' in args:
        #        parser = argparse.ArgumentParser(description=DescString_chainb)
        #        parseinputs_chainb(parser)
        #    elif 'autocorr' in args:
        #        parser = argparse.ArgumentParser(description=DescString_autocorr)
        #        parseinputs_autocorr(parser)
        elif 'db' in args:
            parser = argparse.ArgumentParser(description=DescString_db)
            parseinputs_db(parser)
        elif 'inputgen' in args:
            parser = argparse.ArgumentParser(description=DescString_inputgen)
            parseinputs_inputgen(parser)
        elif 'postproc' in args:
            parser = argparse.ArgumentParser(description=DescString_postproc)
            parseinputs_postproc(parser)
        elif 'random' in args:
            parser = argparse.ArgumentParser(description=DescString_random)
            parseinputs_random(parser)
        elif 'binding' in args:
            parser = argparse.ArgumentParser(description=DescString_binding)
            parseinputs_binding(parser)
        elif 'tsgen' in args:
            parser = argparse.ArgumentParser(description=DescString_tsgen)
            parseinputs_tsgen(parser)
        elif 'customcore' in args:
            parser = argparse.ArgumentParser(description=DescString_customcore)
            parseinputs_customcore(parser)
        elif 'naming' in args:
            parser = argparse.ArgumentParser(description=DescString_naming)
            parseinputs_naming(parser)
        else:
            # print basic help
            parser = argparse.ArgumentParser(
                description=DescString_basic,
                formatter_class=argparse.RawDescriptionHelpFormatter)
            parseinputs_basic(parser)
        exit()
    ### run with gui ###
    elif gui and len(args) == 0:
        print('molSimplify is starting!')
        ### create main application
        app = QApplication(sys.argv)  # main application
        gui = mGUI(app)  # main GUI class
        app.processEvents()
        app.exec_()
    ### if input file is specified run without GUI ###
    elif '-i' in args:
        print('Input file detected, reading arguments from input file')
        print('molSimplify is starting!')
        gui = False
        # run from commandline
        emsg = startgen(sys.argv, False, gui)
    ### grab from commandline arguments ###
    else:
        print('No input file detected, reading arguments from commandline')
        print('molSimplify is starting!')
        gui = False
        # create input file from commandline
        infile = parseCLI([_f for _f in args if _f])
        args = ['main.py', '-i', infile]
        emsg = startgen(args, False, gui)