From edca17607bf0eb4874fea93552c9ae6ad35177b6 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Fri, 9 Jan 2015 17:29:59 +0100 Subject: [PATCH 1/7] Add elets_abrev --- src/elts_abrev.dat | 118 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/elts_abrev.dat diff --git a/src/elts_abrev.dat b/src/elts_abrev.dat new file mode 100644 index 0000000..881735e --- /dev/null +++ b/src/elts_abrev.dat @@ -0,0 +1,118 @@ +1 - H - Hydrogen +2 - He - Helium +3 - Li - Lithium +4 - Be - Beryllium +5 - B - Boron +6 - C - Carbon +7 - N - Nitrogen +8 - O - Oxygen +9 - F - Fluorine +10 - Ne - Neon +11 - Na - Sodium +12 - Mg - Magnesium +13 - Al - Aluminum +14 - Si - Silicon +15 - P - Phosphorus +16 - S - Sulfur +17 - Cl - Chlorine +18 - Ar - Argon +19 - K - Potassium +20 - Ca - Calcium +21 - Sc - Scandium +22 - Ti - Titanium +23 - V - Vanadium +24 - Cr - Chromium +25 - Mn - Manganese +26 - Fe - Iron +27 - Co - Cobalt +28 - Ni - Nickel +29 - Cu - Copper +30 - Zn - Zinc +31 - Ga - Gallium +32 - Ge - Germanium +33 - As - Arsenic +34 - Se - Selenium +35 - Br - Bromine +36 - Kr - Krypton +37 - Rb - Rubidium +38 - Sr - Strontium +39 - Y - Yttrium +40 - Zr - Zirconium +41 - Nb - Niobium +42 - Mo - Molybdenum +43 - Tc - Technetium +44 - Ru - Ruthenium +45 - Rh - Rhodium +46 - Pd - Palladium +47 - Ag - Silver +48 - Cd - Cadmium +49 - In - Indium +50 - Sn - Tin +51 - Sb - Antimony +52 - Te - Tellurium +53 - I - Iodine +54 - Xe - Xenon +55 - Cs - Cesium +56 - Ba - Barium +57 - La - Lanthanum +58 - Ce - Cerium +59 - Pr - Praseodymium +60 - Nd - Neodymium +61 - Pm - Promethium +62 - Sm - Samarium +63 - Eu - Europium +64 - Gd - Gadolinium +65 - Tb - Terbium +66 - Dy - Dysprosium +67 - Ho - Holmium +68 - Er - Erbium +69 - Tm - Thulium +70 - Yb - Ytterbium +71 - Lu - Lutetium +72 - Hf - Hafnium +73 - Ta - Tantalum +74 - W - Tungsten +75 - Re - Rhenium +76 - Os - Osmium +77 - Ir - Iridium +78 - Pt - Platinum +79 - Au - Gold +80 - Hg - Mercury +81 - Tl - Thallium +82 - Pb - Lead +83 - Bi - Bismuth +84 - Po - Polonium +85 - At - Astatine +86 - Rn - Radon +87 - Fr - Francium +88 - Ra - Radium +89 - Ac - Actinium +90 - Th - Thorium +91 - Pa - Protactinium +92 - U - Uranium +93 - Np - Neptunium +94 - Pu - Plutonium +95 - Am - Americium +96 - Cm - Curium +97 - Bk - Berkelium +98 - Cf - Californium +99 - Es - Einsteinium +100 - Fm - Fermium +101 - Md - Mendelevium +102 - No - Nobelium +103 - Lr - Lawrencium +104 - Rf - Rutherfordium +105 - Db - Dubnium +106 - Sg - Seaborgium +107 - Bh - Bohrium +108 - Hs - Hassium +109 - Mt - Meitnerium +110 - Ds - Darmstadtium +111 - Rg - Roentgenium +112 - Cn - Copernicium +113 - Uut - Ununtrium +114 - Fl - Flerovium +115 - Uup - Ununpentium +116 - Lv - Livermorium +117 - Uus - Ununseptium +118 - Uuo - Ununoctium \ No newline at end of file From 50216ccaf26b07b22c7a7bd5634fbfd0fd623ae9 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Mon, 12 Jan 2015 14:22:13 +0100 Subject: [PATCH 2/7] Reput pip install request --- src/EMSL_utility.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/EMSL_utility.py b/src/EMSL_utility.py index 4d8289a..192fa9c 100755 --- a/src/EMSL_utility.py +++ b/src/EMSL_utility.py @@ -19,6 +19,29 @@ for i in data: dict_ele[l[1].strip().lower()] = l[2].strip().lower() +def install_with_pip(name): + + ins = False + d = {'y': True, + 'n': False} + + while True: + choice = raw_input('Do you want to install it ? [Y/N]') + try: + ins = d[choice.lower()] + break + except: + print "not a valid choice" + + if ins: + try: + import pip + pip.main(['install', name]) + except: + print "You need pip, (http://pip.readthedocs.org/en/latest/installing.html)" + sys.exit(1) + + def cond_sql_or(table_name, l_value): l = [] @@ -36,8 +59,13 @@ class EMSL_dump: self.format = format self.contraction = str(contraction) - import requests - self.requests = requests + try: + import requests + except: + print "You need the requests package" + install_with_pip("requests") + finally: + self.requests = requests def set_db_path(self, path): """Define the database path""" @@ -132,7 +160,7 @@ class EMSL_dump: data = data.replace("D+", "E+") data = data.replace("D-", "E-") - data = data[b + 5:e-1].split('\n\n') + data = data[b + 5:e - 1].split('\n\n') for (elt, data_elt) in zip(elts, data): @@ -193,7 +221,7 @@ class EMSL_dump: q_out.put(([name, url, des, elts], basis_data)) q_in.task_done() except: - print name,url,des + print name, url, des raise def enqueue(): From 845d9d6f6c22e27f0d0936041defa430c0163a72 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Mon, 12 Jan 2015 16:01:52 +0100 Subject: [PATCH 3/7] Update README.md Gif !!! --- README.md | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 74f75a2..e980375 100644 --- a/README.md +++ b/README.md @@ -5,30 +5,36 @@ EMSL_Basis_Set_Exchange_Local Create of Local Copy of the famous [EMSL Basis Set Exchange](https://bse.pnl.gov/bse/portal) and use it easily with the API. * Make a slight copy (40Mo Sqlite3 database) of the EMSL Basis Set Exchange website (One database for all the basis set of one format); -* API for scripting ; -* Quick local access without delay ; +* API for scripting; +* Quick local access without delay; * Only need [Python](https://www.python.org/) and [Request](http://docs.python-requests.org/en/latest/) module. ##Dependancy * Python >2.6 -* Request ```pip install requests``` +* Request ```pip install requests``` (in a virtual env or with sudo) ##Installation * Download the git (```$ git clone https://github.com/TApplencourt/EMSL_Basis_Set_Exchange_Local.git``` for example) -* ```cd``` into & run ```$ ./setup.py``` -* ```source EMSL_api.rc``` -* Done ! You can now, use ```EMSL_api.py``` or use all the python fonction inside ```./src``` +* Done ! You can now, use ```EMSL_api.py``` ##Usage ``` EMSL Api. Usage: - EMSL_api.py get_list_basis - EMSL_api.py get_list_elements - EMSL_api.py get_basis_data ... - EMSL_api.py get_list_formats - EMSL_api.py create_db [--no-contraction] + EMSL_api.py list_basis [--atom=...] + [--db_path=] + EMSL_api.py list_atoms --basis= + [--db_path=] + EMSL_api.py get_basis_data --basis= + [--atom=...] + [--db_path=] + [--with_l] + [(--save [--path=])] + EMSL_api.py list_formats + EMSL_api.py create_db --db_path= + --format= + [--no-contraction] EMSL_api.py (-h | --help) EMSL_api.py --version @@ -38,7 +44,13 @@ Options: --no-contraction Basis functions are not contracted is the path to the SQLite3 file containing the Basis sets. +By default is $EMSL_API_ROOT/db/Gausian_uk.db ``` +##Demonstration + +![](http://fat.gfycat.com/WelcomePerkyChrysomelid.gif) + +(For a beter quality see the [Source](https://asciinema.org/api/asciicasts/15380)) ##To do For now we can only parse Gaussian-US basis set type file. (Look at ```./src/EMSL_utility.py#EMSL_dump.basis_data_row_to_array```) From ed3765d4b08ee9b81289c98923a3486b6f5e4384 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Mon, 12 Jan 2015 20:52:01 +0100 Subject: [PATCH 4/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e980375..af548d7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Create of Local Copy of the famous [EMSL Basis Set Exchange](https://bse.pnl.gov * Quick local access without delay; * Only need [Python](https://www.python.org/) and [Request](http://docs.python-requests.org/en/latest/) module. -##Dependancy +##Dependency * Python >2.6 * Request ```pip install requests``` (in a virtual env or with sudo) From d9aa10f2586c236e9462139076d16c77b0bc829f Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 13 Jan 2015 10:01:33 +0100 Subject: [PATCH 5/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af548d7..d5d8090 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ Create of Local Copy of the famous [EMSL Basis Set Exchange](https://bse.pnl.gov * Request ```pip install requests``` (in a virtual env or with sudo) ##Installation -* Download the git (```$ git clone https://github.com/TApplencourt/EMSL_Basis_Set_Exchange_Local.git``` for example) -* Done ! You can now, use ```EMSL_api.py``` +* Download the git repertory (```$ git clone https://github.com/TApplencourt/EMSL_Basis_Set_Exchange_Local.git``` for example) +* That all! You can now, use ```EMSL_api.py``` ##Usage ``` From 502d3dd77e0f8715a18bfc0612d6820553afdd36 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 13 Jan 2015 10:07:13 +0100 Subject: [PATCH 6/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index d5d8090..451f0fe 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Create of Local Copy of the famous [EMSL Basis Set Exchange](https://bse.pnl.gov ##Dependency * Python >2.6 + +###### Optional +If you plan to download manually some database -not using the pre existing one- you need : * Request ```pip install requests``` (in a virtual env or with sudo) ##Installation From 680a26e575b6377ed5cc189d4f99841c46e2e30e Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Tue, 13 Jan 2015 10:09:57 +0100 Subject: [PATCH 7/7] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 451f0fe..f2358e5 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,17 @@ Create of Local Copy of the famous [EMSL Basis Set Exchange](https://bse.pnl.gov * Make a slight copy (40Mo Sqlite3 database) of the EMSL Basis Set Exchange website (One database for all the basis set of one format); * API for scripting; * Quick local access without delay; -* Only need [Python](https://www.python.org/) and [Request](http://docs.python-requests.org/en/latest/) module. +* Only need [Python](https://www.python.org/) ##Dependency * Python >2.6 ###### Optional If you plan to download manually some database -not using the pre existing one- you need : -* Request ```pip install requests``` (in a virtual env or with sudo) +* [Request](http://docs.python-requests.org/en/latest/) python module. ```$pip install requests``` (do it in a virtual env or with sudo) ##Installation -* Download the git repertory (```$ git clone https://github.com/TApplencourt/EMSL_Basis_Set_Exchange_Local.git``` for example) +* Download the git repertory (```$git clone https://github.com/TApplencourt/EMSL_Basis_Set_Exchange_Local.git``` for example) * That all! You can now, use ```EMSL_api.py``` ##Usage