How to use the gc3pie.gc3apps.gamess.import-gmtkn24.Gmtkn24 function in gc3pie

To help you get started, we’ve selected a few gc3pie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gc3pie / gc3pie / gc3pie / gc3apps / gamess / import-gmtkn24.py View on Github external
def _list_subsets(self):
        """Return dictionary mapping GMTKN24 subset names to download URLs."""
        html = BeautifulSoup(self._browser.open(Gmtkn24.BASE_URL + 'GMTKN24main.html'))
        links = html.findAll(name="a")
        result = { }
        for a in links:
	     if a.string is not None:
                match = Gmtkn24._subset_link_re.match(a.string)
                if match is not None:
                    print a
		    # if a subset has several names, add all of them
                    for name in match.group(1).split(' '):
                        if name == 'and':
                            continue
                        result[name] = Gmtkn24.BASE_URL + a['href']
        print result
	#result = ['google.com', 'cnn.com']
	return result
github gc3pie / gc3pie / gc3pie / gc3apps / gamess / import-gmtkn24.py View on Github external
return args[argno]
    except:
        logger.info("Missing argument %s, using default '%s'", argname, default)
        return default


if "__main__" == __name__:
    if len(args) < 1:
        logger.critical("%s: Need at least the ACTION argument."
                        " Type '%s --help' to get usage help."
                        % (PROG, PROG))
        sys.exit(1)

    try:
        if 'import' == args[0]:
            gmtkn24 = Gmtkn24()
            subset = get_optional_argument(args, 1, "SUBSET", None)
            subset_urls = gmtkn24.list()
            if subset:
                subsets = [ subset ]
            else:
                subsets = [ name for name in subset_urls.keys() ]
            tempdir = tempfile.mkdtemp(prefix=PROG)
            destdir = options.destdir
            if not os.path.isabs(destdir):
                destdir = os.path.join(os.getcwd(), destdir)
            template = options.template
            for subset in subsets:
                url = subset_urls[subset]
                if not os.path.exists(os.path.join(destdir, subset)):
                    os.mkdir(os.path.join(destdir, subset))
                ## download geometries and convert to GAMESS .inp format
github gc3pie / gc3pie / gc3pie / gc3apps / gamess / import-gmtkn24.py View on Github external
def _list_subsets(self):
        """Return dictionary mapping GMTKN24 subset names to download URLs."""
        html = BeautifulSoup(self._browser.open(Gmtkn24.BASE_URL + 'GMTKN24main.html'))
        links = html.findAll(name="a")
        result = { }
        for a in links:
	     if a.string is not None:
                match = Gmtkn24._subset_link_re.match(a.string)
                if match is not None:
                    print a
		    # if a subset has several names, add all of them
                    for name in match.group(1).split(' '):
                        if name == 'and':
                            continue
                        result[name] = Gmtkn24.BASE_URL + a['href']
        print result
	#result = ['google.com', 'cnn.com']
	return result
github gc3pie / gc3pie / gc3pie / gc3apps / gamess / import-gmtkn24.py View on Github external
elif 'list' == args[0]:
            subset = get_optional_argument(args, 1, "SUBSET")
            if subset:
                print ("Molecules in the %s subset:" % subset)
                for name in Gmtkn24().get_molecule_names(subset):
                    print ("  %s" % name)
            else:
                print ("Available subsets of GMTKN24:")
                ls = Gmtkn24().list()
                for name, url in ls.items():
                    print ("  %s --> %s" % (name, url))
            
        elif 'refdata' == args[0]:
            subset = get_required_argument(args, 1, "SUBSET")
            for r,d in Gmtkn24().get_reference_data(subset):
                print ("%s = %.3f" 
                       % (str.join(' + ', 
                                   [ ("%d*%s" % (qty, sy)) for sy,qty in r.items() ]), 
                          d))

        elif 'doctest' == args[0]:
            import doctest
            doctest.testmod(name="gmtkn24",
                            optionflags=doctest.NORMALIZE_WHITESPACE)

        else:
            logger.critical("Unknown ACTION word '%s'."
                            " Type '%s --help' to get usage help."
                            % (args[0], PROG))
        sys.exit(1)
github gc3pie / gc3pie / gc3pie / gc3apps / gamess / import-gmtkn24.py View on Github external
'subset':subset, 
        # XXX: URLs need to be relative to the Wiki top-level?
        'refdata_csv':os.path.join(subset, os.path.basename(refdata_csv))
        })
                output.close()
                                 

        elif 'list' == args[0]:
            subset = get_optional_argument(args, 1, "SUBSET")
            if subset:
                print ("Molecules in the %s subset:" % subset)
                for name in Gmtkn24().get_molecule_names(subset):
                    print ("  %s" % name)
            else:
                print ("Available subsets of GMTKN24:")
                ls = Gmtkn24().list()
                for name, url in ls.items():
                    print ("  %s --> %s" % (name, url))
            
        elif 'refdata' == args[0]:
            subset = get_required_argument(args, 1, "SUBSET")
            for r,d in Gmtkn24().get_reference_data(subset):
                print ("%s = %.3f" 
                       % (str.join(' + ', 
                                   [ ("%d*%s" % (qty, sy)) for sy,qty in r.items() ]), 
                          d))

        elif 'doctest' == args[0]:
            import doctest
            doctest.testmod(name="gmtkn24",
                            optionflags=doctest.NORMALIZE_WHITESPACE)
github gc3pie / gc3pie / gc3pie / gc3apps / gamess / import-gmtkn24.py View on Github external
These data have initially been imported from the online
[%(database)s database](%(database_url)s)
""" % { 'database':'GMTKN24',
        'database_url':url,
        'subset':subset, 
        # XXX: URLs need to be relative to the Wiki top-level?
        'refdata_csv':os.path.join(subset, os.path.basename(refdata_csv))
        })
                output.close()
                                 

        elif 'list' == args[0]:
            subset = get_optional_argument(args, 1, "SUBSET")
            if subset:
                print ("Molecules in the %s subset:" % subset)
                for name in Gmtkn24().get_molecule_names(subset):
                    print ("  %s" % name)
            else:
                print ("Available subsets of GMTKN24:")
                ls = Gmtkn24().list()
                for name, url in ls.items():
                    print ("  %s --> %s" % (name, url))
            
        elif 'refdata' == args[0]:
            subset = get_required_argument(args, 1, "SUBSET")
            for r,d in Gmtkn24().get_reference_data(subset):
                print ("%s = %.3f" 
                       % (str.join(' + ', 
                                   [ ("%d*%s" % (qty, sy)) for sy,qty in r.items() ]), 
                          d))

        elif 'doctest' == args[0]: