Last active
November 25, 2022 15:58
-
-
Save pjknowles/5ebddbb5b250eb8d9f89451b27c3a218 to your computer and use it in GitHub Desktop.
calculation on all elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 37, | |
| "metadata": { | |
| "collapsed": true | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "elements=['X','H','He',\n", | |
| " 'Li','Be','B','C','N','O','F','Ne',\n", | |
| " 'Na','Mg','Al','Si','P','S','Cl','Ar',\n", | |
| " 'K','Ca',\n", | |
| " 'Sc','Ti','V','Cr','Mn','Fe','Co','Ni','Cu','Zn',\n", | |
| " 'Ga','Ge','As','Se','Br','Kr',\n", | |
| " 'Rb','Sr',\n", | |
| " 'Y','Zr','Nb','Mo','Tc','Ru','Rh','Pd','Ag','Cd',\n", | |
| " 'In','Sn','Sb','Te','I','Xe',\n", | |
| " 'Cs','Ba',\n", | |
| " 'La','Ce','Pr','Nd','Pm','Sm','Eu','Gd','Tb','Dy','Ho','Er','Tm','Yb',\n", | |
| " 'Lu','Hf','Ta','W','Re','Os','Ir','Pt','Au','Hg',\n", | |
| " 'Tl','Pb','Bi','Po','At','Rn',\n", | |
| " 'Fr','Ra',\n", | |
| " 'Ac','Th','Pa','U','Np','Pu','Am','Cm','Bk','Cf','Es','Fm','Md','No',\n", | |
| " 'Lr','Rf','Db','Sg','Bh','Hs','Mt','Ds','Rg','Cn',\n", | |
| " 'Nh','Fl','Mc','Lv','Ts','Og']" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 50, | |
| "outputs": [], | |
| "source": [ | |
| "basis=\"cc-pVTZ-pp\"\n", | |
| "basis=\"def2-TZVPP\"\n", | |
| "parallel=10\n", | |
| "last_element=86\n", | |
| "backend=\"local\"" | |
| ], | |
| "metadata": { | |
| "collapsed": false, | |
| "pycharm": { | |
| "name": "#%%\n" | |
| } | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 51, | |
| "outputs": [], | |
| "source": [ | |
| "import pymolpro\n", | |
| "projects={}\n", | |
| "import os\n", | |
| "project_directory = \"elements\"\n", | |
| "if not os.path.exists(project_directory):\n", | |
| " os.makedirs(project_directory)\n", | |
| "for z in range(1,last_element+1):\n", | |
| " element = elements[z]\n", | |
| " projects[element]=pymolpro.Project(element, location=project_directory)\n", | |
| " projects[element].write_input(f\"\"\"\n", | |
| "basis,{basis}\n", | |
| "r=1.8 angstrom\n", | |
| "geometry={{{element};{element},{element},r}}\n", | |
| "rhf\n", | |
| "\"\"\")" | |
| ], | |
| "metadata": { | |
| "collapsed": false, | |
| "pycharm": { | |
| "name": "#%%\n" | |
| } | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 52, | |
| "outputs": [], | |
| "source": [ | |
| "from multiprocessing.dummy import Pool\n", | |
| "from operator import methodcaller\n", | |
| "with Pool(processes=parallel) as pool:\n", | |
| " pool.map(methodcaller('run', backend=backend, wait=True),\n", | |
| " list(projects.values()), 1)\n", | |
| "assert pymolpro.all_completed(projects.values()) and pymolpro.no_errors(projects.values())" | |
| ], | |
| "metadata": { | |
| "collapsed": false, | |
| "pycharm": { | |
| "name": "#%%\n" | |
| } | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 53, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "{'H': -0.953725317670763, 'He': -5.71442589661403, 'Li': -14.8201380596885, 'Be': -29.0778670051639, 'B': -49.0835235736945, 'C': -75.398031591878, 'N': -108.482032145095, 'O': -149.383801771276, 'F': -198.671312197322, 'Ne': -257.046894617487, 'Na': -323.620668126361, 'Mg': -398.979909590207, 'Al': -483.626449816599, 'Si': -577.645239609011, 'P': -681.478955074122, 'S': -795.067781777571, 'Cl': -918.964596575535, 'Ar': -1053.24559169146, 'K': -1197.94508287313, 'Ca': -1353.01409062349, 'Sc': -1519.22893917371, 'Ti': -1696.51217068938, 'V': -1885.30319833681, 'Cr': -2085.81746366758, 'Mn': -2298.73198318202, 'Fe': -2524.04986524464, 'Co': -2762.18499243083, 'Ni': -3013.18545094257, 'Cu': -3277.78243371029, 'Zn': -3555.42574408269, 'Ga': -3846.31757603715, 'Ge': -4150.52841386615, 'As': -4468.34329158584, 'Se': -4799.59506233707, 'Br': -5144.66075588905, 'Kr': -5503.3552545686, 'Rb': -46.8586979749067, 'Sr': -60.0335214594086, 'Y': -75.2252564791818, 'Zr': -92.6690418907717, 'Nb': -112.42063362635, 'Mo': -134.805406014081, 'Tc': -159.912060789353, 'Ru': -187.978795218521, 'Rh': -219.202369889856, 'Pd': -253.723332983857, 'Ag': -291.933538408101, 'Cd': -333.350229733065, 'In': -378.037619026369, 'Sn': -426.293469965826, 'Sb': -478.135961297219, 'Te': -533.521989071884, 'I': -588.520327932553, 'Xe': -655.35659201209, 'Cs': -38.3949128360736, 'Ba': -49.0463751869766, 'La': -61.1880454691257, 'Ce': -946.437333524625, 'Pr': -1029.88975714207, 'Nd': -1117.98403938662, 'Pm': -1211.05455787634, 'Sm': -1309.99394268369, 'Eu': -1414.28972974166, 'Gd': -1524.25730065275, 'Tb': -1639.78705588399, 'Dy': -1761.63983445408, 'Ho': -1889.98781759984, 'Er': -2023.09049996117, 'Tm': -2163.71562832325, 'Yb': -2310.85515700652, 'Lu': -2464.30087026249, 'Hf': -94.4129863722356, 'Ta': -112.354193768636, 'W': -132.424502787965, 'Re': -154.70697972271, 'Os': -179.396718534221, 'Ir': -206.594318874352, 'Pt': -236.452387485489, 'Au': -269.158673426783, 'Hg': -304.517965281843, 'Tl': -342.459994209773, 'Pb': -383.074838984436, 'Bi': -426.507039626805, 'Po': -472.646643107211, 'At': -521.735778419109, 'Rn': -573.439771435029}\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "energies={}\n", | |
| "for element,p in projects.items():\n", | |
| " energies[element]=p.energy()\n", | |
| "print(energies)" | |
| ], | |
| "metadata": { | |
| "collapsed": false, | |
| "pycharm": { | |
| "name": "#%%\n" | |
| } | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "outputs": [], | |
| "source": [], | |
| "metadata": { | |
| "collapsed": false, | |
| "pycharm": { | |
| "name": "#%%\n" | |
| } | |
| } | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 2 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython2", | |
| "version": "2.7.6" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment