├── .bumpversion.cfg ├── .gitignore ├── AUTHORS ├── COPYING ├── MANIFEST.in ├── README.rst ├── c-src ├── cubecutperiodic.c └── espfilter.c ├── docs ├── Makefile ├── make.bat ├── rtfd_requirements.txt └── source │ ├── api.rst │ ├── api │ ├── espresso.rst │ ├── nebespresso.rst │ ├── siteconfig.rst │ ├── utils.rst │ └── vibespresso.rst │ ├── conf.py │ ├── ethane.png │ ├── index.rst │ ├── install.rst │ ├── nebespresso.rst │ └── rotation-barrier.png ├── espresso ├── __init__.py ├── atomic_configs.py ├── espresso.py ├── nebespresso.py ├── siteconfig.py ├── utils.py ├── vibespresso.py └── worldstub.py ├── requirements.txt ├── scripts └── pwlog2traj ├── setup.py ├── site-files ├── espsite.py.example.PBSfifompich2 ├── espsite.py.example.PBSstdinopenmpi ├── espsite.py.example.SLURMsherlock ├── espsite.py.example.abel ├── espsite.py.example.suncatfifo └── espsite.py.example.suncatstdin └── tests ├── test_nebespresso.py ├── test_relaxation.py ├── test_scf_single_point.py ├── test_siteconfig.py └── test_vibrations.py /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 0.3.4 3 | commit = True 4 | tag = True 5 | 6 | [bumpversion:file:setup.py] 7 | 8 | [bumpversion:file:espresso/__init__.py] 9 | 10 | [bumpversion:file:espresso/espresso.py] 11 | 12 | [bumpversion:file:espresso/siteconfig.py] 13 | 14 | [bumpversion:file:espresso/utils.py] 15 | 16 | [bumpversion:file:espresso/vibespresso.py] 17 | 18 | [bumpversion:file:espresso/nebespresso.py] 19 | 20 | [bumpversion:file:docs/source/conf.py] 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Byte-compiled / optimized / DLL files 3 | __pycache__/ 4 | *.py[cod] 5 | # C extensions 6 | *.so 7 | # Distribution / packaging 8 | .Python 9 | env/ 10 | build/ 11 | develop-eggs/ 12 | dist/ 13 | downloads/ 14 | jupyternb/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | # PyInstaller 25 | # Usually these files are written by a python script from a template 26 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 27 | *.manifest 28 | *.spec 29 | # Installer logs 30 | pip-log.txt 31 | pip-delete-this-directory.txt 32 | # Unit test / coverage reports 33 | htmlcov/ 34 | .tox/ 35 | .coverage 36 | .cache 37 | nosetests.xml 38 | coverage.xml 39 | # Translations 40 | *.mo 41 | *.pot 42 | # Django stuff: 43 | *.log 44 | # Sphinx documentation 45 | docs/_build/ 46 | docs/source/_reference/ 47 | # PyBuilder 48 | target/ 49 | c-src/*.o 50 | 51 | 52 | ### Vim swap files 53 | .*.swp 54 | 55 | _site/ 56 | .sass-cache/ 57 | 58 | 59 | # sublim project files 60 | espresso.sublime-project 61 | espresso.sublime-workspace 62 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The current fork is developed by: 2 | Łukasz Mentel 3 | Rasmus Brogaard 4 | 5 | The original code was developed by: 6 | Johannes Voss 7 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Original work Copyright (C) 2013-2015 SUNCAT 2 | Modified work Copyright 2015-2017 Lukasz Mentel 3 | 4 | GNU GENERAL PUBLIC LICENSE 5 | Version 3, 29 June 2007 6 | 7 | Copyright (C) 2007 Free Software Foundation, Inc. 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | 11 | Preamble 12 | 13 | The GNU General Public License is a free, copyleft license for 14 | software and other kinds of works. 15 | 16 | The licenses for most software and other practical works are designed 17 | to take away your freedom to share and change the works. By contrast, 18 | the GNU General Public License is intended to guarantee your freedom to 19 | share and change all versions of a program--to make sure it remains free 20 | software for all its users. We, the Free Software Foundation, use the 21 | GNU General Public License for most of our software; it applies also to 22 | any other work released this way by its authors. You can apply it to 23 | your programs, too. 24 | 25 | When we speak of free software, we are referring to freedom, not 26 | price. Our General Public Licenses are designed to make sure that you 27 | have the freedom to distribute copies of free software (and charge for 28 | them if you wish), that you receive source code or can get it if you 29 | want it, that you can change the software or use pieces of it in new 30 | free programs, and that you know you can do these things. 31 | 32 | To protect your rights, we need to prevent others from denying you 33 | these rights or asking you to surrender the rights. Therefore, you have 34 | certain responsibilities if you distribute copies of the software, or if 35 | you modify it: responsibilities to respect the freedom of others. 36 | 37 | For example, if you distribute copies of such a program, whether 38 | gratis or for a fee, you must pass on to the recipients the same 39 | freedoms that you received. You must make sure that they, too, receive 40 | or can get the source code. And you must show them these terms so they 41 | know their rights. 42 | 43 | Developers that use the GNU GPL protect your rights with two steps: 44 | (1) assert copyright on the software, and (2) offer you this License 45 | giving you legal permission to copy, distribute and/or modify it. 46 | 47 | For the developers' and authors' protection, the GPL clearly explains 48 | that there is no warranty for this free software. For both users' and 49 | authors' sake, the GPL requires that modified versions be marked as 50 | changed, so that their problems will not be attributed erroneously to 51 | authors of previous versions. 52 | 53 | Some devices are designed to deny users access to install or run 54 | modified versions of the software inside them, although the manufacturer 55 | can do so. This is fundamentally incompatible with the aim of 56 | protecting users' freedom to change the software. The systematic 57 | pattern of such abuse occurs in the area of products for individuals to 58 | use, which is precisely where it is most unacceptable. Therefore, we 59 | have designed this version of the GPL to prohibit the practice for those 60 | products. If such problems arise substantially in other domains, we 61 | stand ready to extend this provision to those domains in future versions 62 | of the GPL, as needed to protect the freedom of users. 63 | 64 | Finally, every program is threatened constantly by software patents. 65 | States should not allow patents to restrict development and use of 66 | software on general-purpose computers, but in those that do, we wish to 67 | avoid the special danger that patents applied to a free program could 68 | make it effectively proprietary. To prevent this, the GPL assures that 69 | patents cannot be used to render the program non-free. 70 | 71 | The precise terms and conditions for copying, distribution and 72 | modification follow. 73 | 74 | TERMS AND CONDITIONS 75 | 76 | 0. Definitions. 77 | 78 | "This License" refers to version 3 of the GNU General Public License. 79 | 80 | "Copyright" also means copyright-like laws that apply to other kinds of 81 | works, such as semiconductor masks. 82 | 83 | "The Program" refers to any copyrightable work licensed under this 84 | License. Each licensee is addressed as "you". "Licensees" and 85 | "recipients" may be individuals or organizations. 86 | 87 | To "modify" a work means to copy from or adapt all or part of the work 88 | in a fashion requiring copyright permission, other than the making of an 89 | exact copy. The resulting work is called a "modified version" of the 90 | earlier work or a work "based on" the earlier work. 91 | 92 | A "covered work" means either the unmodified Program or a work based 93 | on the Program. 94 | 95 | To "propagate" a work means to do anything with it that, without 96 | permission, would make you directly or secondarily liable for 97 | infringement under applicable copyright law, except executing it on a 98 | computer or modifying a private copy. Propagation includes copying, 99 | distribution (with or without modification), making available to the 100 | public, and in some countries other activities as well. 101 | 102 | To "convey" a work means any kind of propagation that enables other 103 | parties to make or receive copies. Mere interaction with a user through 104 | a computer network, with no transfer of a copy, is not conveying. 105 | 106 | An interactive user interface displays "Appropriate Legal Notices" 107 | to the extent that it includes a convenient and prominently visible 108 | feature that (1) displays an appropriate copyright notice, and (2) 109 | tells the user that there is no warranty for the work (except to the 110 | extent that warranties are provided), that licensees may convey the 111 | work under this License, and how to view a copy of this License. If 112 | the interface presents a list of user commands or options, such as a 113 | menu, a prominent item in the list meets this criterion. 114 | 115 | 1. Source Code. 116 | 117 | The "source code" for a work means the preferred form of the work 118 | for making modifications to it. "Object code" means any non-source 119 | form of a work. 120 | 121 | A "Standard Interface" means an interface that either is an official 122 | standard defined by a recognized standards body, or, in the case of 123 | interfaces specified for a particular programming language, one that 124 | is widely used among developers working in that language. 125 | 126 | The "System Libraries" of an executable work include anything, other 127 | than the work as a whole, that (a) is included in the normal form of 128 | packaging a Major Component, but which is not part of that Major 129 | Component, and (b) serves only to enable use of the work with that 130 | Major Component, or to implement a Standard Interface for which an 131 | implementation is available to the public in source code form. A 132 | "Major Component", in this context, means a major essential component 133 | (kernel, window system, and so on) of the specific operating system 134 | (if any) on which the executable work runs, or a compiler used to 135 | produce the work, or an object code interpreter used to run it. 136 | 137 | The "Corresponding Source" for a work in object code form means all 138 | the source code needed to generate, install, and (for an executable 139 | work) run the object code and to modify the work, including scripts to 140 | control those activities. However, it does not include the work's 141 | System Libraries, or general-purpose tools or generally available free 142 | programs which are used unmodified in performing those activities but 143 | which are not part of the work. For example, Corresponding Source 144 | includes interface definition files associated with source files for 145 | the work, and the source code for shared libraries and dynamically 146 | linked subprograms that the work is specifically designed to require, 147 | such as by intimate data communication or control flow between those 148 | subprograms and other parts of the work. 149 | 150 | The Corresponding Source need not include anything that users 151 | can regenerate automatically from other parts of the Corresponding 152 | Source. 153 | 154 | The Corresponding Source for a work in source code form is that 155 | same work. 156 | 157 | 2. Basic Permissions. 158 | 159 | All rights granted under this License are granted for the term of 160 | copyright on the Program, and are irrevocable provided the stated 161 | conditions are met. This License explicitly affirms your unlimited 162 | permission to run the unmodified Program. The output from running a 163 | covered work is covered by this License only if the output, given its 164 | content, constitutes a covered work. This License acknowledges your 165 | rights of fair use or other equivalent, as provided by copyright law. 166 | 167 | You may make, run and propagate covered works that you do not 168 | convey, without conditions so long as your license otherwise remains 169 | in force. You may convey covered works to others for the sole purpose 170 | of having them make modifications exclusively for you, or provide you 171 | with facilities for running those works, provided that you comply with 172 | the terms of this License in conveying all material for which you do 173 | not control copyright. Those thus making or running the covered works 174 | for you must do so exclusively on your behalf, under your direction 175 | and control, on terms that prohibit them from making any copies of 176 | your copyrighted material outside their relationship with you. 177 | 178 | Conveying under any other circumstances is permitted solely under 179 | the conditions stated below. Sublicensing is not allowed; section 10 180 | makes it unnecessary. 181 | 182 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 183 | 184 | No covered work shall be deemed part of an effective technological 185 | measure under any applicable law fulfilling obligations under article 186 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 187 | similar laws prohibiting or restricting circumvention of such 188 | measures. 189 | 190 | When you convey a covered work, you waive any legal power to forbid 191 | circumvention of technological measures to the extent such circumvention 192 | is effected by exercising rights under this License with respect to 193 | the covered work, and you disclaim any intention to limit operation or 194 | modification of the work as a means of enforcing, against the work's 195 | users, your or third parties' legal rights to forbid circumvention of 196 | technological measures. 197 | 198 | 4. Conveying Verbatim Copies. 199 | 200 | You may convey verbatim copies of the Program's source code as you 201 | receive it, in any medium, provided that you conspicuously and 202 | appropriately publish on each copy an appropriate copyright notice; 203 | keep intact all notices stating that this License and any 204 | non-permissive terms added in accord with section 7 apply to the code; 205 | keep intact all notices of the absence of any warranty; and give all 206 | recipients a copy of this License along with the Program. 207 | 208 | You may charge any price or no price for each copy that you convey, 209 | and you may offer support or warranty protection for a fee. 210 | 211 | 5. Conveying Modified Source Versions. 212 | 213 | You may convey a work based on the Program, or the modifications to 214 | produce it from the Program, in the form of source code under the 215 | terms of section 4, provided that you also meet all of these conditions: 216 | 217 | a) The work must carry prominent notices stating that you modified 218 | it, and giving a relevant date. 219 | 220 | b) The work must carry prominent notices stating that it is 221 | released under this License and any conditions added under section 222 | 7. This requirement modifies the requirement in section 4 to 223 | "keep intact all notices". 224 | 225 | c) You must license the entire work, as a whole, under this 226 | License to anyone who comes into possession of a copy. This 227 | License will therefore apply, along with any applicable section 7 228 | additional terms, to the whole of the work, and all its parts, 229 | regardless of how they are packaged. This License gives no 230 | permission to license the work in any other way, but it does not 231 | invalidate such permission if you have separately received it. 232 | 233 | d) If the work has interactive user interfaces, each must display 234 | Appropriate Legal Notices; however, if the Program has interactive 235 | interfaces that do not display Appropriate Legal Notices, your 236 | work need not make them do so. 237 | 238 | A compilation of a covered work with other separate and independent 239 | works, which are not by their nature extensions of the covered work, 240 | and which are not combined with it such as to form a larger program, 241 | in or on a volume of a storage or distribution medium, is called an 242 | "aggregate" if the compilation and its resulting copyright are not 243 | used to limit the access or legal rights of the compilation's users 244 | beyond what the individual works permit. Inclusion of a covered work 245 | in an aggregate does not cause this License to apply to the other 246 | parts of the aggregate. 247 | 248 | 6. Conveying Non-Source Forms. 249 | 250 | You may convey a covered work in object code form under the terms 251 | of sections 4 and 5, provided that you also convey the 252 | machine-readable Corresponding Source under the terms of this License, 253 | in one of these ways: 254 | 255 | a) Convey the object code in, or embodied in, a physical product 256 | (including a physical distribution medium), accompanied by the 257 | Corresponding Source fixed on a durable physical medium 258 | customarily used for software interchange. 259 | 260 | b) Convey the object code in, or embodied in, a physical product 261 | (including a physical distribution medium), accompanied by a 262 | written offer, valid for at least three years and valid for as 263 | long as you offer spare parts or customer support for that product 264 | model, to give anyone who possesses the object code either (1) a 265 | copy of the Corresponding Source for all the software in the 266 | product that is covered by this License, on a durable physical 267 | medium customarily used for software interchange, for a price no 268 | more than your reasonable cost of physically performing this 269 | conveying of source, or (2) access to copy the 270 | Corresponding Source from a network server at no charge. 271 | 272 | c) Convey individual copies of the object code with a copy of the 273 | written offer to provide the Corresponding Source. This 274 | alternative is allowed only occasionally and noncommercially, and 275 | only if you received the object code with such an offer, in accord 276 | with subsection 6b. 277 | 278 | d) Convey the object code by offering access from a designated 279 | place (gratis or for a charge), and offer equivalent access to the 280 | Corresponding Source in the same way through the same place at no 281 | further charge. You need not require recipients to copy the 282 | Corresponding Source along with the object code. If the place to 283 | copy the object code is a network server, the Corresponding Source 284 | may be on a different server (operated by you or a third party) 285 | that supports equivalent copying facilities, provided you maintain 286 | clear directions next to the object code saying where to find the 287 | Corresponding Source. Regardless of what server hosts the 288 | Corresponding Source, you remain obligated to ensure that it is 289 | available for as long as needed to satisfy these requirements. 290 | 291 | e) Convey the object code using peer-to-peer transmission, provided 292 | you inform other peers where the object code and Corresponding 293 | Source of the work are being offered to the general public at no 294 | charge under subsection 6d. 295 | 296 | A separable portion of the object code, whose source code is excluded 297 | from the Corresponding Source as a System Library, need not be 298 | included in conveying the object code work. 299 | 300 | A "User Product" is either (1) a "consumer product", which means any 301 | tangible personal property which is normally used for personal, family, 302 | or household purposes, or (2) anything designed or sold for incorporation 303 | into a dwelling. In determining whether a product is a consumer product, 304 | doubtful cases shall be resolved in favor of coverage. For a particular 305 | product received by a particular user, "normally used" refers to a 306 | typical or common use of that class of product, regardless of the status 307 | of the particular user or of the way in which the particular user 308 | actually uses, or expects or is expected to use, the product. A product 309 | is a consumer product regardless of whether the product has substantial 310 | commercial, industrial or non-consumer uses, unless such uses represent 311 | the only significant mode of use of the product. 312 | 313 | "Installation Information" for a User Product means any methods, 314 | procedures, authorization keys, or other information required to install 315 | and execute modified versions of a covered work in that User Product from 316 | a modified version of its Corresponding Source. The information must 317 | suffice to ensure that the continued functioning of the modified object 318 | code is in no case prevented or interfered with solely because 319 | modification has been made. 320 | 321 | If you convey an object code work under this section in, or with, or 322 | specifically for use in, a User Product, and the conveying occurs as 323 | part of a transaction in which the right of possession and use of the 324 | User Product is transferred to the recipient in perpetuity or for a 325 | fixed term (regardless of how the transaction is characterized), the 326 | Corresponding Source conveyed under this section must be accompanied 327 | by the Installation Information. But this requirement does not apply 328 | if neither you nor any third party retains the ability to install 329 | modified object code on the User Product (for example, the work has 330 | been installed in ROM). 331 | 332 | The requirement to provide Installation Information does not include a 333 | requirement to continue to provide support service, warranty, or updates 334 | for a work that has been modified or installed by the recipient, or for 335 | the User Product in which it has been modified or installed. Access to a 336 | network may be denied when the modification itself materially and 337 | adversely affects the operation of the network or violates the rules and 338 | protocols for communication across the network. 339 | 340 | Corresponding Source conveyed, and Installation Information provided, 341 | in accord with this section must be in a format that is publicly 342 | documented (and with an implementation available to the public in 343 | source code form), and must require no special password or key for 344 | unpacking, reading or copying. 345 | 346 | 7. Additional Terms. 347 | 348 | "Additional permissions" are terms that supplement the terms of this 349 | License by making exceptions from one or more of its conditions. 350 | Additional permissions that are applicable to the entire Program shall 351 | be treated as though they were included in this License, to the extent 352 | that they are valid under applicable law. If additional permissions 353 | apply only to part of the Program, that part may be used separately 354 | under those permissions, but the entire Program remains governed by 355 | this License without regard to the additional permissions. 356 | 357 | When you convey a copy of a covered work, you may at your option 358 | remove any additional permissions from that copy, or from any part of 359 | it. (Additional permissions may be written to require their own 360 | removal in certain cases when you modify the work.) You may place 361 | additional permissions on material, added by you to a covered work, 362 | for which you have or can give appropriate copyright permission. 363 | 364 | Notwithstanding any other provision of this License, for material you 365 | add to a covered work, you may (if authorized by the copyright holders of 366 | that material) supplement the terms of this License with terms: 367 | 368 | a) Disclaiming warranty or limiting liability differently from the 369 | terms of sections 15 and 16 of this License; or 370 | 371 | b) Requiring preservation of specified reasonable legal notices or 372 | author attributions in that material or in the Appropriate Legal 373 | Notices displayed by works containing it; or 374 | 375 | c) Prohibiting misrepresentation of the origin of that material, or 376 | requiring that modified versions of such material be marked in 377 | reasonable ways as different from the original version; or 378 | 379 | d) Limiting the use for publicity purposes of names of licensors or 380 | authors of the material; or 381 | 382 | e) Declining to grant rights under trademark law for use of some 383 | trade names, trademarks, or service marks; or 384 | 385 | f) Requiring indemnification of licensors and authors of that 386 | material by anyone who conveys the material (or modified versions of 387 | it) with contractual assumptions of liability to the recipient, for 388 | any liability that these contractual assumptions directly impose on 389 | those licensors and authors. 390 | 391 | All other non-permissive additional terms are considered "further 392 | restrictions" within the meaning of section 10. If the Program as you 393 | received it, or any part of it, contains a notice stating that it is 394 | governed by this License along with a term that is a further 395 | restriction, you may remove that term. If a license document contains 396 | a further restriction but permits relicensing or conveying under this 397 | License, you may add to a covered work material governed by the terms 398 | of that license document, provided that the further restriction does 399 | not survive such relicensing or conveying. 400 | 401 | If you add terms to a covered work in accord with this section, you 402 | must place, in the relevant source files, a statement of the 403 | additional terms that apply to those files, or a notice indicating 404 | where to find the applicable terms. 405 | 406 | Additional terms, permissive or non-permissive, may be stated in the 407 | form of a separately written license, or stated as exceptions; 408 | the above requirements apply either way. 409 | 410 | 8. Termination. 411 | 412 | You may not propagate or modify a covered work except as expressly 413 | provided under this License. Any attempt otherwise to propagate or 414 | modify it is void, and will automatically terminate your rights under 415 | this License (including any patent licenses granted under the third 416 | paragraph of section 11). 417 | 418 | However, if you cease all violation of this License, then your 419 | license from a particular copyright holder is reinstated (a) 420 | provisionally, unless and until the copyright holder explicitly and 421 | finally terminates your license, and (b) permanently, if the copyright 422 | holder fails to notify you of the violation by some reasonable means 423 | prior to 60 days after the cessation. 424 | 425 | Moreover, your license from a particular copyright holder is 426 | reinstated permanently if the copyright holder notifies you of the 427 | violation by some reasonable means, this is the first time you have 428 | received notice of violation of this License (for any work) from that 429 | copyright holder, and you cure the violation prior to 30 days after 430 | your receipt of the notice. 431 | 432 | Termination of your rights under this section does not terminate the 433 | licenses of parties who have received copies or rights from you under 434 | this License. If your rights have been terminated and not permanently 435 | reinstated, you do not qualify to receive new licenses for the same 436 | material under section 10. 437 | 438 | 9. Acceptance Not Required for Having Copies. 439 | 440 | You are not required to accept this License in order to receive or 441 | run a copy of the Program. Ancillary propagation of a covered work 442 | occurring solely as a consequence of using peer-to-peer transmission 443 | to receive a copy likewise does not require acceptance. However, 444 | nothing other than this License grants you permission to propagate or 445 | modify any covered work. These actions infringe copyright if you do 446 | not accept this License. Therefore, by modifying or propagating a 447 | covered work, you indicate your acceptance of this License to do so. 448 | 449 | 10. Automatic Licensing of Downstream Recipients. 450 | 451 | Each time you convey a covered work, the recipient automatically 452 | receives a license from the original licensors, to run, modify and 453 | propagate that work, subject to this License. You are not responsible 454 | for enforcing compliance by third parties with this License. 455 | 456 | An "entity transaction" is a transaction transferring control of an 457 | organization, or substantially all assets of one, or subdividing an 458 | organization, or merging organizations. If propagation of a covered 459 | work results from an entity transaction, each party to that 460 | transaction who receives a copy of the work also receives whatever 461 | licenses to the work the party's predecessor in interest had or could 462 | give under the previous paragraph, plus a right to possession of the 463 | Corresponding Source of the work from the predecessor in interest, if 464 | the predecessor has it or can get it with reasonable efforts. 465 | 466 | You may not impose any further restrictions on the exercise of the 467 | rights granted or affirmed under this License. For example, you may 468 | not impose a license fee, royalty, or other charge for exercise of 469 | rights granted under this License, and you may not initiate litigation 470 | (including a cross-claim or counterclaim in a lawsuit) alleging that 471 | any patent claim is infringed by making, using, selling, offering for 472 | sale, or importing the Program or any portion of it. 473 | 474 | 11. Patents. 475 | 476 | A "contributor" is a copyright holder who authorizes use under this 477 | License of the Program or a work on which the Program is based. The 478 | work thus licensed is called the contributor's "contributor version". 479 | 480 | A contributor's "essential patent claims" are all patent claims 481 | owned or controlled by the contributor, whether already acquired or 482 | hereafter acquired, that would be infringed by some manner, permitted 483 | by this License, of making, using, or selling its contributor version, 484 | but do not include claims that would be infringed only as a 485 | consequence of further modification of the contributor version. For 486 | purposes of this definition, "control" includes the right to grant 487 | patent sublicenses in a manner consistent with the requirements of 488 | this License. 489 | 490 | Each contributor grants you a non-exclusive, worldwide, royalty-free 491 | patent license under the contributor's essential patent claims, to 492 | make, use, sell, offer for sale, import and otherwise run, modify and 493 | propagate the contents of its contributor version. 494 | 495 | In the following three paragraphs, a "patent license" is any express 496 | agreement or commitment, however denominated, not to enforce a patent 497 | (such as an express permission to practice a patent or covenant not to 498 | sue for patent infringement). To "grant" such a patent license to a 499 | party means to make such an agreement or commitment not to enforce a 500 | patent against the party. 501 | 502 | If you convey a covered work, knowingly relying on a patent license, 503 | and the Corresponding Source of the work is not available for anyone 504 | to copy, free of charge and under the terms of this License, through a 505 | publicly available network server or other readily accessible means, 506 | then you must either (1) cause the Corresponding Source to be so 507 | available, or (2) arrange to deprive yourself of the benefit of the 508 | patent license for this particular work, or (3) arrange, in a manner 509 | consistent with the requirements of this License, to extend the patent 510 | license to downstream recipients. "Knowingly relying" means you have 511 | actual knowledge that, but for the patent license, your conveying the 512 | covered work in a country, or your recipient's use of the covered work 513 | in a country, would infringe one or more identifiable patents in that 514 | country that you have reason to believe are valid. 515 | 516 | If, pursuant to or in connection with a single transaction or 517 | arrangement, you convey, or propagate by procuring conveyance of, a 518 | covered work, and grant a patent license to some of the parties 519 | receiving the covered work authorizing them to use, propagate, modify 520 | or convey a specific copy of the covered work, then the patent license 521 | you grant is automatically extended to all recipients of the covered 522 | work and works based on it. 523 | 524 | A patent license is "discriminatory" if it does not include within 525 | the scope of its coverage, prohibits the exercise of, or is 526 | conditioned on the non-exercise of one or more of the rights that are 527 | specifically granted under this License. You may not convey a covered 528 | work if you are a party to an arrangement with a third party that is 529 | in the business of distributing software, under which you make payment 530 | to the third party based on the extent of your activity of conveying 531 | the work, and under which the third party grants, to any of the 532 | parties who would receive the covered work from you, a discriminatory 533 | patent license (a) in connection with copies of the covered work 534 | conveyed by you (or copies made from those copies), or (b) primarily 535 | for and in connection with specific products or compilations that 536 | contain the covered work, unless you entered into that arrangement, 537 | or that patent license was granted, prior to 28 March 2007. 538 | 539 | Nothing in this License shall be construed as excluding or limiting 540 | any implied license or other defenses to infringement that may 541 | otherwise be available to you under applicable patent law. 542 | 543 | 12. No Surrender of Others' Freedom. 544 | 545 | If conditions are imposed on you (whether by court order, agreement or 546 | otherwise) that contradict the conditions of this License, they do not 547 | excuse you from the conditions of this License. If you cannot convey a 548 | covered work so as to satisfy simultaneously your obligations under this 549 | License and any other pertinent obligations, then as a consequence you may 550 | not convey it at all. For example, if you agree to terms that obligate you 551 | to collect a royalty for further conveying from those to whom you convey 552 | the Program, the only way you could satisfy both those terms and this 553 | License would be to refrain entirely from conveying the Program. 554 | 555 | 13. Use with the GNU Affero General Public License. 556 | 557 | Notwithstanding any other provision of this License, you have 558 | permission to link or combine any covered work with a work licensed 559 | under version 3 of the GNU Affero General Public License into a single 560 | combined work, and to convey the resulting work. The terms of this 561 | License will continue to apply to the part which is the covered work, 562 | but the special requirements of the GNU Affero General Public License, 563 | section 13, concerning interaction through a network will apply to the 564 | combination as such. 565 | 566 | 14. Revised Versions of this License. 567 | 568 | The Free Software Foundation may publish revised and/or new versions of 569 | the GNU General Public License from time to time. Such new versions will 570 | be similar in spirit to the present version, but may differ in detail to 571 | address new problems or concerns. 572 | 573 | Each version is given a distinguishing version number. If the 574 | Program specifies that a certain numbered version of the GNU General 575 | Public License "or any later version" applies to it, you have the 576 | option of following the terms and conditions either of that numbered 577 | version or of any later version published by the Free Software 578 | Foundation. If the Program does not specify a version number of the 579 | GNU General Public License, you may choose any version ever published 580 | by the Free Software Foundation. 581 | 582 | If the Program specifies that a proxy can decide which future 583 | versions of the GNU General Public License can be used, that proxy's 584 | public statement of acceptance of a version permanently authorizes you 585 | to choose that version for the Program. 586 | 587 | Later license versions may give you additional or different 588 | permissions. However, no additional obligations are imposed on any 589 | author or copyright holder as a result of your choosing to follow a 590 | later version. 591 | 592 | 15. Disclaimer of Warranty. 593 | 594 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 595 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 596 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 597 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 598 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 599 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 600 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 601 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 602 | 603 | 16. Limitation of Liability. 604 | 605 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 606 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 607 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 608 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 609 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 610 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 611 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 612 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 613 | SUCH DAMAGES. 614 | 615 | 17. Interpretation of Sections 15 and 16. 616 | 617 | If the disclaimer of warranty and limitation of liability provided 618 | above cannot be given local legal effect according to their terms, 619 | reviewing courts shall apply local law that most closely approximates 620 | an absolute waiver of all civil liability in connection with the 621 | Program, unless a warranty or assumption of liability accompanies a 622 | copy of the Program in return for a fee. 623 | 624 | END OF TERMS AND CONDITIONS 625 | 626 | How to Apply These Terms to Your New Programs 627 | 628 | If you develop a new program, and you want it to be of the greatest 629 | possible use to the public, the best way to achieve this is to make it 630 | free software which everyone can redistribute and change under these terms. 631 | 632 | To do so, attach the following notices to the program. It is safest 633 | to attach them to the start of each source file to most effectively 634 | state the exclusion of warranty; and each file should have at least 635 | the "copyright" line and a pointer to where the full notice is found. 636 | 637 | 638 | Copyright (C) 639 | 640 | This program is free software: you can redistribute it and/or modify 641 | it under the terms of the GNU General Public License as published by 642 | the Free Software Foundation, either version 3 of the License, or 643 | (at your option) any later version. 644 | 645 | This program is distributed in the hope that it will be useful, 646 | but WITHOUT ANY WARRANTY; without even the implied warranty of 647 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 648 | GNU General Public License for more details. 649 | 650 | You should have received a copy of the GNU General Public License 651 | along with this program. If not, see . 652 | 653 | Also add information on how to contact you by electronic and paper mail. 654 | 655 | If the program does terminal interaction, make it output a short 656 | notice like this when it starts in an interactive mode: 657 | 658 | Copyright (C) 659 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 660 | This is free software, and you are welcome to redistribute it 661 | under certain conditions; type `show c' for details. 662 | 663 | The hypothetical commands `show w' and `show c' should show the appropriate 664 | parts of the General Public License. Of course, your program's commands 665 | might be different; for a GUI interface, you would use an "about box". 666 | 667 | You should also get your employer (if you work as a programmer) or school, 668 | if any, to sign a "copyright disclaimer" for the program, if necessary. 669 | For more information on this, and how to apply and follow the GNU GPL, see 670 | . 671 | 672 | The GNU General Public License does not permit incorporating your program 673 | into proprietary programs. If your program is a subroutine library, you 674 | may consider it more useful to permit linking proprietary applications with 675 | the library. If this is what you want to do, use the GNU Lesser General 676 | Public License instead of this License. But first, please read 677 | . 678 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include COPYING 2 | recursive-include c-src *.c 3 | recursive-include site-files * 4 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | ase-espresso 3 | ============ 4 | 5 | |Documentation| 6 | 7 | `ase-espresso `__ provides a 8 | Python interface compatible with `Atomic Simulation Environment 9 | (ASE) `__ for managing 10 | calculations with the `Quantum 11 | Espresso `__ code. 12 | 13 | This is a fork from `vossjo `__ 14 | that offers a lot of improvements over the original version, the most 15 | important ones include: 16 | 17 | - the files were restructured into a python package 18 | - a ``setup.py`` file was introduced to allow installation through 19 | `pip `__ or 20 | `setuptools `__ 21 | - configuration for the documentation is provided through 22 | `sphinx `__ and a lot of 23 | docstrings were updated 24 | - the ``site.cfg`` is obsolete now, and no additional configuration is 25 | required, the functionality is replaced by a new ``SiteConfig`` class 26 | that dynamically gathers information about the execution environment 27 | - the old ``espresso`` class is now split into two: ``Espresso`` 28 | preserving the standard functionality and ``iEspresso`` responsible 29 | for dynamic/interactive jobs with a custom version of pw.x 30 | - changes were made to establish python 3.x compatibility 31 | - the ``Espresso`` class were restructured according to 32 | `ase `__ guidelines 33 | regarding calculator objects to support full compatibility with 34 | `ase `__ 35 | - most of the system calls are now handled by 36 | `pexpect `__ and 37 | `subprocess `__ 38 | instead of the ``os.system``, ``os.popen()``, ``os.popen2()``, 39 | ``os.popen3()`` 40 | - tests were added 41 | - code style and readability were improved 42 | 43 | Installation 44 | ============ 45 | 46 | Dependencies 47 | ------------ 48 | 49 | - `Atomic Simulation Environment 50 | (ASE) `__ 51 | - `numpy `__ 52 | - `pexpect `__ 53 | - `future `__ 54 | - `path.py `__ 55 | - `python-hostlist `__ 56 | 57 | The recommended installation method is with 58 | `pip `__. The current version can be 59 | installed directly from 60 | `github `__: 61 | 62 | .. code:: bash 63 | 64 | pip install https://github.com/lmmentel/ase-espresso/archive/master.zip 65 | 66 | or cloned first 67 | 68 | .. code:: bash 69 | 70 | git clone https://github.com/lmmentel/ase-espresso.git 71 | 72 | and installed via 73 | 74 | .. code:: bash 75 | 76 | pip install ./ase-espresso 77 | 78 | Documentation 79 | ------------- 80 | 81 | The documentation is hosted on 82 | `ase-espresso.readthedocs.io `__. 83 | 84 | You can also generate the documentation locally using 85 | `sphinx `__ by going to the 86 | ``docs`` directory and typing: 87 | 88 | .. code:: bash 89 | 90 | make html 91 | 92 | The built documentation can be viewed in a any browser 93 | 94 | .. code:: bash 95 | 96 | firefox build/html/index.html 97 | 98 | .. |Documentation| image:: https://readthedocs.org/projects/ase-espresso/badge/?version=latest 99 | :target: http://ase-espresso.readthedocs.io/en/latest/?badge=latest 100 | -------------------------------------------------------------------------------- /c-src/cubecutperiodic.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (C) 2013 SUNCAT 3 | This file is distributed under the terms of the 4 | GNU General Public License. See the file `COPYING' 5 | in the root directory of the present distribution, 6 | or http://www.gnu.org/copyleft/gpl.txt . 7 | 8 | 9 | cubecutperiodic removes periodic image planes (x=1,y=1,z=1) from 10 | cube files produced by espresso's pp.x for analysis tools 11 | that expect input without these planes 12 | (e.g. the bader tool from the Henkelman group) 13 | ****************************************************************************/ 14 | 15 | #include 16 | #include 17 | 18 | #define nbuf 65536 19 | 20 | void readerror(const char *s) { 21 | fprintf(stderr, "error reading from file %s\n", s); 22 | exit(4); 23 | } 24 | 25 | int main(int argc, char **argv) { 26 | char buf[nbuf],buf2[512],buf3[512],buf4[512]; 27 | FILE *inp,*out; 28 | int i,j,k,natoms,nx,ny,nz,nx1,ny1,nz1,counter; 29 | 30 | if(argc!=3) { 31 | fprintf(stderr, "usage: %s in.cube out.cube\n", argv[0]); 32 | return 1; 33 | } 34 | 35 | inp = fopen(argv[1], "r"); 36 | if(!inp) { 37 | fprintf(stderr, "cannot open cube input file %s for reading.\n", argv[1]); 38 | return 2; 39 | } 40 | 41 | out = fopen(argv[2], "w"); 42 | if(!out) { 43 | fprintf(stderr, "cannot open cube output file %s for writing.\n", argv[2]); 44 | return 3; 45 | } 46 | 47 | for(i=0;i<3;i++) { 48 | if(!fgets(buf, nbuf, inp)) readerror(argv[1]); 49 | fputs(buf, out); 50 | } 51 | 52 | sscanf(buf, "%d", &natoms); 53 | 54 | if(!fgets(buf, nbuf, inp)) readerror(argv[1]); 55 | sscanf(buf, "%d%512s%512s%512s", &nx, buf2, buf3, buf4); 56 | fprintf(out, " %d %s %s %s\n", nx-1, buf2, buf3, buf4); 57 | 58 | if(!fgets(buf, nbuf, inp)) readerror(argv[1]); 59 | sscanf(buf, "%d%512s%512s%512s", &ny, buf2, buf3, buf4); 60 | fprintf(out, " %d %s %s %s\n", ny-1, buf2, buf3, buf4); 61 | 62 | if(!fgets(buf, nbuf, inp)) readerror(argv[1]); 63 | sscanf(buf, "%d%512s%512s%512s", &nz, buf2, buf3, buf4); 64 | fprintf(out, " %d %s %s %s\n", nz-1, buf2, buf3, buf4); 65 | 66 | for(i=0;i 13 | #include 14 | #include 15 | 16 | #define bufstep (1024*1024) 17 | 18 | void dump(char *b, size_t r) 19 | { 20 | size_t i; 21 | 22 | for(i=0; i+1023=currsize) 92 | { 93 | currsize += bufstep; 94 | buf = (char *) realloc(buf, currsize); 95 | if(!buf) 96 | { 97 | fputs("Buffer memory re-allocation error!\n", stderr); 98 | return 1; 99 | } 100 | p = buf+bytesread; 101 | } 102 | } 103 | 104 | if(bytesread>0) dump(buf, bytesread); 105 | 106 | fclose(log); 107 | 108 | return 0; 109 | } 110 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " applehelp to make an Apple Help Book" 34 | @echo " devhelp to make HTML files and a Devhelp project" 35 | @echo " epub to make an epub" 36 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 37 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 38 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 39 | @echo " text to make text files" 40 | @echo " man to make manual pages" 41 | @echo " texinfo to make Texinfo files" 42 | @echo " info to make Texinfo files and run them through makeinfo" 43 | @echo " gettext to make PO message catalogs" 44 | @echo " changes to make an overview of all changed/added/deprecated items" 45 | @echo " xml to make Docutils-native XML files" 46 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 47 | @echo " linkcheck to check all external links for integrity" 48 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 49 | @echo " coverage to run coverage check of the documentation (if enabled)" 50 | 51 | clean: 52 | rm -rf $(BUILDDIR)/* 53 | 54 | html: 55 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 56 | @echo 57 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 58 | 59 | dirhtml: 60 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 61 | @echo 62 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 63 | 64 | singlehtml: 65 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 66 | @echo 67 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 68 | 69 | pickle: 70 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 71 | @echo 72 | @echo "Build finished; now you can process the pickle files." 73 | 74 | json: 75 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 76 | @echo 77 | @echo "Build finished; now you can process the JSON files." 78 | 79 | htmlhelp: 80 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 81 | @echo 82 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 83 | ".hhp project file in $(BUILDDIR)/htmlhelp." 84 | 85 | qthelp: 86 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 87 | @echo 88 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 89 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 90 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ase-espresso.qhcp" 91 | @echo "To view the help file:" 92 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ase-espresso.qhc" 93 | 94 | applehelp: 95 | $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp 96 | @echo 97 | @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." 98 | @echo "N.B. You won't be able to view it unless you put it in" \ 99 | "~/Library/Documentation/Help or install it in your application" \ 100 | "bundle." 101 | 102 | devhelp: 103 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 104 | @echo 105 | @echo "Build finished." 106 | @echo "To view the help file:" 107 | @echo "# mkdir -p $$HOME/.local/share/devhelp/ase-espresso" 108 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ase-espresso" 109 | @echo "# devhelp" 110 | 111 | epub: 112 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 113 | @echo 114 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 115 | 116 | latex: 117 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 118 | @echo 119 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 120 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 121 | "(use \`make latexpdf' here to do that automatically)." 122 | 123 | latexpdf: 124 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 125 | @echo "Running LaTeX files through pdflatex..." 126 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 127 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 128 | 129 | latexpdfja: 130 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 131 | @echo "Running LaTeX files through platex and dvipdfmx..." 132 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 133 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 134 | 135 | text: 136 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 137 | @echo 138 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 139 | 140 | man: 141 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 142 | @echo 143 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 144 | 145 | texinfo: 146 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 147 | @echo 148 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 149 | @echo "Run \`make' in that directory to run these through makeinfo" \ 150 | "(use \`make info' here to do that automatically)." 151 | 152 | info: 153 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 154 | @echo "Running Texinfo files through makeinfo..." 155 | make -C $(BUILDDIR)/texinfo info 156 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 157 | 158 | gettext: 159 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 160 | @echo 161 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 162 | 163 | changes: 164 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 165 | @echo 166 | @echo "The overview file is in $(BUILDDIR)/changes." 167 | 168 | linkcheck: 169 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 170 | @echo 171 | @echo "Link check complete; look for any errors in the above output " \ 172 | "or in $(BUILDDIR)/linkcheck/output.txt." 173 | 174 | doctest: 175 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 176 | @echo "Testing of doctests in the sources finished, look at the " \ 177 | "results in $(BUILDDIR)/doctest/output.txt." 178 | 179 | coverage: 180 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage 181 | @echo "Testing of coverage in the sources finished, look at the " \ 182 | "results in $(BUILDDIR)/coverage/python.txt." 183 | 184 | xml: 185 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 186 | @echo 187 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 188 | 189 | pseudoxml: 190 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 191 | @echo 192 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 193 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source 10 | set I18NSPHINXOPTS=%SPHINXOPTS% source 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | echo. coverage to run coverage check of the documentation if enabled 41 | goto end 42 | ) 43 | 44 | if "%1" == "clean" ( 45 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 46 | del /q /s %BUILDDIR%\* 47 | goto end 48 | ) 49 | 50 | 51 | REM Check if sphinx-build is available and fallback to Python version if any 52 | %SPHINXBUILD% 2> nul 53 | if errorlevel 9009 goto sphinx_python 54 | goto sphinx_ok 55 | 56 | :sphinx_python 57 | 58 | set SPHINXBUILD=python -m sphinx.__init__ 59 | %SPHINXBUILD% 2> nul 60 | if errorlevel 9009 ( 61 | echo. 62 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 63 | echo.installed, then set the SPHINXBUILD environment variable to point 64 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 65 | echo.may add the Sphinx directory to PATH. 66 | echo. 67 | echo.If you don't have Sphinx installed, grab it from 68 | echo.http://sphinx-doc.org/ 69 | exit /b 1 70 | ) 71 | 72 | :sphinx_ok 73 | 74 | 75 | if "%1" == "html" ( 76 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 77 | if errorlevel 1 exit /b 1 78 | echo. 79 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 80 | goto end 81 | ) 82 | 83 | if "%1" == "dirhtml" ( 84 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 85 | if errorlevel 1 exit /b 1 86 | echo. 87 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 88 | goto end 89 | ) 90 | 91 | if "%1" == "singlehtml" ( 92 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 93 | if errorlevel 1 exit /b 1 94 | echo. 95 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 96 | goto end 97 | ) 98 | 99 | if "%1" == "pickle" ( 100 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 101 | if errorlevel 1 exit /b 1 102 | echo. 103 | echo.Build finished; now you can process the pickle files. 104 | goto end 105 | ) 106 | 107 | if "%1" == "json" ( 108 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 109 | if errorlevel 1 exit /b 1 110 | echo. 111 | echo.Build finished; now you can process the JSON files. 112 | goto end 113 | ) 114 | 115 | if "%1" == "htmlhelp" ( 116 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 117 | if errorlevel 1 exit /b 1 118 | echo. 119 | echo.Build finished; now you can run HTML Help Workshop with the ^ 120 | .hhp project file in %BUILDDIR%/htmlhelp. 121 | goto end 122 | ) 123 | 124 | if "%1" == "qthelp" ( 125 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 129 | .qhcp project file in %BUILDDIR%/qthelp, like this: 130 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\ase-espresso.qhcp 131 | echo.To view the help file: 132 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\ase-espresso.ghc 133 | goto end 134 | ) 135 | 136 | if "%1" == "devhelp" ( 137 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 138 | if errorlevel 1 exit /b 1 139 | echo. 140 | echo.Build finished. 141 | goto end 142 | ) 143 | 144 | if "%1" == "epub" ( 145 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 146 | if errorlevel 1 exit /b 1 147 | echo. 148 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 149 | goto end 150 | ) 151 | 152 | if "%1" == "latex" ( 153 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 154 | if errorlevel 1 exit /b 1 155 | echo. 156 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 157 | goto end 158 | ) 159 | 160 | if "%1" == "latexpdf" ( 161 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 162 | cd %BUILDDIR%/latex 163 | make all-pdf 164 | cd %~dp0 165 | echo. 166 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 167 | goto end 168 | ) 169 | 170 | if "%1" == "latexpdfja" ( 171 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 172 | cd %BUILDDIR%/latex 173 | make all-pdf-ja 174 | cd %~dp0 175 | echo. 176 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 177 | goto end 178 | ) 179 | 180 | if "%1" == "text" ( 181 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 182 | if errorlevel 1 exit /b 1 183 | echo. 184 | echo.Build finished. The text files are in %BUILDDIR%/text. 185 | goto end 186 | ) 187 | 188 | if "%1" == "man" ( 189 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 190 | if errorlevel 1 exit /b 1 191 | echo. 192 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 193 | goto end 194 | ) 195 | 196 | if "%1" == "texinfo" ( 197 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 198 | if errorlevel 1 exit /b 1 199 | echo. 200 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 201 | goto end 202 | ) 203 | 204 | if "%1" == "gettext" ( 205 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 206 | if errorlevel 1 exit /b 1 207 | echo. 208 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 209 | goto end 210 | ) 211 | 212 | if "%1" == "changes" ( 213 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 214 | if errorlevel 1 exit /b 1 215 | echo. 216 | echo.The overview file is in %BUILDDIR%/changes. 217 | goto end 218 | ) 219 | 220 | if "%1" == "linkcheck" ( 221 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 222 | if errorlevel 1 exit /b 1 223 | echo. 224 | echo.Link check complete; look for any errors in the above output ^ 225 | or in %BUILDDIR%/linkcheck/output.txt. 226 | goto end 227 | ) 228 | 229 | if "%1" == "doctest" ( 230 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 231 | if errorlevel 1 exit /b 1 232 | echo. 233 | echo.Testing of doctests in the sources finished, look at the ^ 234 | results in %BUILDDIR%/doctest/output.txt. 235 | goto end 236 | ) 237 | 238 | if "%1" == "coverage" ( 239 | %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage 240 | if errorlevel 1 exit /b 1 241 | echo. 242 | echo.Testing of coverage in the sources finished, look at the ^ 243 | results in %BUILDDIR%/coverage/python.txt. 244 | goto end 245 | ) 246 | 247 | if "%1" == "xml" ( 248 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 249 | if errorlevel 1 exit /b 1 250 | echo. 251 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 252 | goto end 253 | ) 254 | 255 | if "%1" == "pseudoxml" ( 256 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 257 | if errorlevel 1 exit /b 1 258 | echo. 259 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 260 | goto end 261 | ) 262 | 263 | :end 264 | -------------------------------------------------------------------------------- /docs/rtfd_requirements.txt: -------------------------------------------------------------------------------- 1 | ase 2 | numpy 3 | sphinx_bootstrap_theme 4 | -------------------------------------------------------------------------------- /docs/source/api.rst: -------------------------------------------------------------------------------- 1 | .. _api: 2 | 3 | ************* 4 | API Reference 5 | ************* 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | :caption: Modules 10 | 11 | espresso 12 | nebespresso 13 | vibespresso 14 | siteconfig 15 | utils 16 | -------------------------------------------------------------------------------- /docs/source/api/espresso.rst: -------------------------------------------------------------------------------- 1 | espresso module 2 | =============== 3 | 4 | .. automodule:: espresso.espresso 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/source/api/nebespresso.rst: -------------------------------------------------------------------------------- 1 | nebespresso module 2 | ================== 3 | 4 | .. automodule:: espresso.nebespresso 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/source/api/siteconfig.rst: -------------------------------------------------------------------------------- 1 | siteconfig module 2 | ================= 3 | 4 | .. automodule:: espresso.siteconfig 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/source/api/utils.rst: -------------------------------------------------------------------------------- 1 | utils module 2 | ============ 3 | 4 | .. automodule:: espresso.utils 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/source/api/vibespresso.rst: -------------------------------------------------------------------------------- 1 | vibespresso module 2 | ================== 3 | 4 | .. automodule:: espresso.vibespresso 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # ase-espresso documentation build configuration file, created by 4 | # sphinx-quickstart on Wed Nov 25 10:09:02 2015. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys 16 | import os 17 | import inspect 18 | import sphinx_bootstrap_theme 19 | 20 | if sys.version_info.major == 3: 21 | from unittest.mock import MagicMock 22 | else: 23 | from mock import Mock as MagicMock 24 | 25 | 26 | class Mock(MagicMock): 27 | @classmethod 28 | def __getattr__(cls, name): 29 | return MagicMock() 30 | 31 | 32 | MOCK_MODULES = ['argparse', 'hostlist', 'seaborn', 33 | 'matplotlib', 'matplotlib.pyplot', 'matplotlib.colors', 34 | 'matplotlib.cm', 'scipy', 'scipy.optimize', 35 | 'scipy.interpolate', 'pandas', 'path', 'pexpect'] 36 | 37 | sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) 38 | 39 | 40 | on_rtd = os.environ.get('READTHEDOCS') == 'True' 41 | if not on_rtd: 42 | __location__ = os.path.join(os.getcwd(), os.path.dirname( 43 | inspect.getfile(inspect.currentframe()))) 44 | module_dir = os.path.normpath(os.path.join(__location__, "../../")) 45 | sys.path.insert(0, os.path.abspath(module_dir)) 46 | 47 | autosummary_generate = True 48 | 49 | # If extensions (or modules to document with autodoc) are in another directory, 50 | # add these directories to sys.path here. If the directory is relative to the 51 | # documentation root, use os.path.abspath to make it absolute, like shown here. 52 | 53 | # -- General configuration ------------------------------------------------ 54 | 55 | # If your documentation needs a minimal Sphinx version, state it here. 56 | # needs_sphinx = '1.0' 57 | 58 | # Add any Sphinx extension module names here, as strings. They can be 59 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 60 | # ones. 61 | extensions = [ 62 | 'sphinx.ext.autodoc', 63 | 'sphinx.ext.autosummary', 64 | 'sphinx.ext.mathjax', 65 | 'sphinx.ext.viewcode', 66 | 'sphinx.ext.intersphinx', 67 | 'sphinx.ext.napoleon', 68 | ] 69 | 70 | # Add any paths that contain templates here, relative to this directory. 71 | templates_path = ['_templates'] 72 | 73 | # The suffix(es) of source filenames. 74 | # You can specify multiple suffix as a list of string: 75 | # source_suffix = ['.rst', '.md'] 76 | source_suffix = '.rst' 77 | 78 | # The encoding of source files. 79 | #source_encoding = 'utf-8-sig' 80 | 81 | # The master toctree document. 82 | master_doc = 'index' 83 | 84 | # General information about the project. 85 | project = u'ase-espresso' 86 | copyright = u'2017, Lukasz Mentel' 87 | author = u'Lukasz Mentel' 88 | 89 | # The version info for the project you're documenting, acts as replacement for 90 | # |version| and |release|, also used in various other places throughout the 91 | # built documents. 92 | # 93 | # The short X.Y version. 94 | version = '0.3.4' 95 | # The full version, including alpha/beta/rc tags. 96 | release = '0.3.4' 97 | 98 | # The language for content autogenerated by Sphinx. Refer to documentation 99 | # for a list of supported languages. 100 | # 101 | # This is also used if you do content translation via gettext catalogs. 102 | # Usually you set "language" from the command line for these cases. 103 | language = None 104 | 105 | # There are two options for replacing |today|: either, you set today to some 106 | # non-false value, then it is used: 107 | #today = '' 108 | # Else, today_fmt is used as the format for a strftime call. 109 | #today_fmt = '%B %d, %Y' 110 | 111 | # List of patterns, relative to source directory, that match files and 112 | # directories to ignore when looking for source files. 113 | exclude_patterns = [] 114 | 115 | # The reST default role (used for this markup: `text`) to use for all 116 | # documents. 117 | #default_role = None 118 | 119 | # If true, '()' will be appended to :func: etc. cross-reference text. 120 | #add_function_parentheses = True 121 | 122 | # If true, the current module name will be prepended to all description 123 | # unit titles (such as .. function::). 124 | #add_module_names = True 125 | 126 | # If true, sectionauthor and moduleauthor directives will be shown in the 127 | # output. They are ignored by default. 128 | #show_authors = False 129 | 130 | # The name of the Pygments (syntax highlighting) style to use. 131 | pygments_style = 'sphinx' 132 | 133 | # A list of ignored prefixes for module index sorting. 134 | #modindex_common_prefix = [] 135 | 136 | # If true, keep warnings as "system message" paragraphs in the built documents. 137 | #keep_warnings = False 138 | 139 | # If true, `todo` and `todoList` produce output, else they produce nothing. 140 | todo_include_todos = False 141 | 142 | # -- Options for HTML output ---------------------------------------------- 143 | 144 | # The theme to use for HTML and HTML Help pages. See the documentation for 145 | # a list of builtin themes. 146 | html_theme = 'bootstrap' 147 | 148 | # Theme options are theme-specific and customize the look and feel of a theme 149 | # further. For a list of options available for each theme, see the 150 | # documentation. 151 | 152 | html_theme_options = {'bootswatch_theme': 'yeti'} 153 | 154 | # Add any paths that contain custom themes here, relative to this directory. 155 | # html_theme_path = [] 156 | html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() 157 | 158 | # The name for this set of Sphinx documents. If None, it defaults to 159 | # " v documentation". 160 | #html_title = None 161 | try: 162 | from espresso import __version__ as version 163 | except ImportError: 164 | pass 165 | else: 166 | release = version 167 | 168 | # A shorter title for the navigation bar. Default is the same as html_title. 169 | #html_short_title = None 170 | 171 | # The name of an image file (relative to this directory) to place at the top 172 | # of the sidebar. 173 | #html_logo = None 174 | 175 | # The name of an image file (within the static path) to use as favicon of the 176 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 177 | # pixels large. 178 | #html_favicon = None 179 | 180 | # Add any paths that contain custom static files (such as style sheets) here, 181 | # relative to this directory. They are copied after the builtin static files, 182 | # so a file named "default.css" will overwrite the builtin "default.css". 183 | html_static_path = ['_static'] 184 | 185 | # Add any extra paths that contain custom files (such as robots.txt or 186 | # .htaccess) here, relative to this directory. These files are copied 187 | # directly to the root of the documentation. 188 | #html_extra_path = [] 189 | 190 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 191 | # using the given strftime format. 192 | #html_last_updated_fmt = '%b %d, %Y' 193 | 194 | # If true, SmartyPants will be used to convert quotes and dashes to 195 | # typographically correct entities. 196 | #html_use_smartypants = True 197 | 198 | # Custom sidebar templates, maps document names to template names. 199 | #html_sidebars = {} 200 | 201 | # Additional templates that should be rendered to pages, maps page names to 202 | # template names. 203 | #html_additional_pages = {} 204 | 205 | # If false, no module index is generated. 206 | #html_domain_indices = True 207 | 208 | # If false, no index is generated. 209 | #html_use_index = True 210 | 211 | # If true, the index is split into individual pages for each letter. 212 | #html_split_index = False 213 | 214 | # If true, links to the reST sources are added to the pages. 215 | #html_show_sourcelink = True 216 | 217 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 218 | #html_show_sphinx = True 219 | 220 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 221 | #html_show_copyright = True 222 | 223 | # If true, an OpenSearch description file will be output, and all pages will 224 | # contain a tag referring to it. The value of this option must be the 225 | # base URL from which the finished HTML is served. 226 | #html_use_opensearch = '' 227 | 228 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 229 | #html_file_suffix = None 230 | 231 | # Language to be used for generating the HTML full-text search index. 232 | # Sphinx supports the following languages: 233 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 234 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' 235 | #html_search_language = 'en' 236 | 237 | # A dictionary with options for the search language support, empty by default. 238 | # Now only 'ja' uses this config value 239 | #html_search_options = {'type': 'default'} 240 | 241 | # The name of a javascript file (relative to the configuration directory) that 242 | # implements a search results scorer. If empty, the default will be used. 243 | #html_search_scorer = 'scorer.js' 244 | 245 | # Output file base name for HTML help builder. 246 | htmlhelp_basename = 'ase-espressodoc' 247 | 248 | # -- Options for LaTeX output --------------------------------------------- 249 | 250 | latex_elements = { 251 | # The paper size ('letterpaper' or 'a4paper'). 252 | #'papersize': 'letterpaper', 253 | 254 | # The font size ('10pt', '11pt' or '12pt'). 255 | #'pointsize': '10pt', 256 | 257 | # Additional stuff for the LaTeX preamble. 258 | #'preamble': '', 259 | 260 | # Latex figure (float) alignment 261 | #'figure_align': 'htbp', 262 | } 263 | 264 | # Grouping the document tree into LaTeX files. List of tuples 265 | # (source start file, target name, title, 266 | # author, documentclass [howto, manual, or own class]). 267 | latex_documents = [ 268 | (master_doc, 'ase-espresso.tex', u'ase-espresso Documentation', 269 | u'Lukasz Mentel', 'manual'), 270 | ] 271 | 272 | # The name of an image file (relative to this directory) to place at the top of 273 | # the title page. 274 | #latex_logo = None 275 | 276 | # For "manual" documents, if this is true, then toplevel headings are parts, 277 | # not chapters. 278 | #latex_use_parts = False 279 | 280 | # If true, show page references after internal links. 281 | #latex_show_pagerefs = False 282 | 283 | # If true, show URL addresses after external links. 284 | #latex_show_urls = False 285 | 286 | # Documents to append as an appendix to all manuals. 287 | #latex_appendices = [] 288 | 289 | # If false, no module index is generated. 290 | #latex_domain_indices = True 291 | 292 | 293 | # -- Options for manual page output --------------------------------------- 294 | 295 | # One entry per manual page. List of tuples 296 | # (source start file, name, description, authors, manual section). 297 | man_pages = [ 298 | (master_doc, 'ase-espresso', u'ase-espresso Documentation', 299 | [author], 1) 300 | ] 301 | 302 | # If true, show URL addresses after external links. 303 | #man_show_urls = False 304 | 305 | 306 | # -- Options for Texinfo output ------------------------------------------- 307 | 308 | # Grouping the document tree into Texinfo files. List of tuples 309 | # (source start file, target name, title, author, 310 | # dir menu entry, description, category) 311 | texinfo_documents = [ 312 | (master_doc, 'ase-espresso', u'ase-espresso Documentation', 313 | author, 'ase-espresso', 'One line description of project.', 314 | 'Miscellaneous'), 315 | ] 316 | 317 | # Documents to append as an appendix to all manuals. 318 | #texinfo_appendices = [] 319 | 320 | # If false, no module index is generated. 321 | #texinfo_domain_indices = True 322 | 323 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 324 | #texinfo_show_urls = 'footnote' 325 | 326 | # If true, do not generate a @detailmenu in the "Top" node's menu. 327 | #texinfo_no_detailmenu = False 328 | -------------------------------------------------------------------------------- /docs/source/ethane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmmentel/ase-espresso/ec3273cb2bdc352061f3676c59bb8d73c6cb18da/docs/source/ethane.png -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. ase-espresso documentation master file, created by 2 | sphinx-quickstart on Wed Nov 25 10:09:02 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to ase-espresso's documentation! 7 | ======================================== 8 | 9 | `ase-espresso`_ is a python interface for `Quantum Espresso`_ using the `Atomic Simulation Environment (ASE)`_. 10 | 11 | The main purpose of the `ase-espresso`_ interface is to allow for 12 | python-controlled ionic updates (e.g. ase-based structural relaxation) and to 13 | provide post-processed `Quantum Espresso`_ output (e.g. charge densities, DOS) as 14 | numpy_ arrays. While the `ase-espresso`_ interface can be used to create input 15 | files for `Quantum Espresso`_ only, there are alternative python interfaces for 16 | input file generation (or for running static calculations ionic step by ionic 17 | step): 18 | 19 | - `ase_qe_intrfce `_, 20 | - `PWscfInput `_, 21 | - `qecalc `_, 22 | - `qecalc by P. T. Jochym `_, 23 | - `espresso `_, 24 | 25 | 26 | .. _ase-espresso: https://github.com/vossjo/ase-espresso 27 | .. _Quantum Espresso: http://www.quantum-espresso.org/ 28 | .. _Atomic Simulation Environment (ASE): (https://wiki.fysik.dtu.dk/ase/ 29 | .. _numpy: http://www.numpy.org/ 30 | 31 | Contents: 32 | 33 | .. toctree:: 34 | :maxdepth: 2 35 | 36 | Installation 37 | NEBEspresso 38 | API Reference 39 | 40 | Indices and tables 41 | ================== 42 | 43 | * :ref:`genindex` 44 | * :ref:`modindex` 45 | * :ref:`search` 46 | -------------------------------------------------------------------------------- /docs/source/install.rst: -------------------------------------------------------------------------------- 1 | Dependencies 2 | ============ 3 | 4 | - ASE_ 5 | - `numpy `_ 6 | - `pexpect `_ 7 | - `future `_ 8 | - `path.py `_ 9 | - `hostname `_ 10 | 11 | Installation 12 | ============ 13 | 14 | The recommended installation method is with pip_ and can be installed directly from the 15 | `ase_espresso repository `_: 16 | 17 | .. code-block:: bash 18 | 19 | pip install git+git://github.com/lmmentel/ase-espresso.git 20 | 21 | or cloned first 22 | 23 | .. code-block:: bash 24 | 25 | git clone https://github.com/lmmentel/ase-espresso.git 26 | 27 | and installed via 28 | 29 | .. code-block:: bash 30 | 31 | pip install ./ase-espresso 32 | 33 | 34 | You can verify that your installation was successful by opening a python console 35 | and trying to import :py:class:`Espresso `:: 36 | 37 | >>> from espresso import Espresso 38 | 39 | 40 | Configuration 41 | ============= 42 | 43 | To run properly `ase-espresso`_ requires that the `Quantum Espresso`_ code is 44 | properly compiled and the executables are available to the shell. You can to that 45 | by extending the ``PATH`` variable with the location of your `Quantum Espresso`_ 46 | 47 | .. code-block:: bash 48 | 49 | export PATH=$PATH:/path/to/your/quantum-espresso/executables 50 | 51 | Another thing that is required is setting the environmental variable with the path 52 | to the directory containing pseudopotential files 53 | 54 | .. code-block:: bash 55 | 56 | export ESP_PSP_PATH=/path/to/pseudo/pseudopotentials 57 | 58 | 59 | .. _ASE: https://wiki.fysik.dtu.dk/ase/index.html 60 | .. _github: https://github.com 61 | .. _pip: https://pip.pypa.io/en/stable/ 62 | .. _vossjo: https://github.com/vossjo/ase-espresso 63 | .. _wiki: https://github.com/vossjo/ase-espresso/wiki 64 | .. _ase-espresso: https://github.com/lmmentel/ase-espresso 65 | .. _Quantum Espresso: http://www.quantum-espresso.org/ 66 | -------------------------------------------------------------------------------- /docs/source/nebespresso.rst: -------------------------------------------------------------------------------- 1 | .. sectionauthor:: Rasmus Yding Brogaard 2 | 3 | NEBEspresso 4 | =========== 5 | Derived from the :class:`ase.neb.NEB` class, :class:`NEBEspresso` orchestrates (i)Espresso calculators of individual images in a NEB calculation. This way a :class:`NEBEspresso` object facilitates parallel NEB jobs, where each image calculator uses a subset of the pool of CPUs available to the job. 6 | 7 | This tutorial explains the use of :class:`NEBEspresso` to do a NEB calculation on methyl group rotation in ethane, built on `this ASE example `_. 8 | 9 | Initial and final structures of the NEB 10 | ---------------------------------------- 11 | As opposed to the Effective Medium Potential used in the original example, Quantum Espresso needs periodic boundaries defined by a unit cell. That is defined in the ``ethane.traj`` trajectory file containing the optimized structure. The final structure is created simply by permuting the H atoms in one of the methyl groups. 12 | 13 | .. image:: ethane.png 14 | :width: 30% 15 | 16 | .. code-block:: python 17 | 18 | from espresso import iEspresso 19 | from ase.io import read 20 | 21 | initial = read('ethane.traj') 22 | initial.get_potential_energy() 23 | final = initial.copy() 24 | final.positions[2:5] = initial.positions[[3, 4, 2]] 25 | final.get_potential_energy() 26 | 27 | Assigning calculators to intermediate images 28 | ------------------------------------------------------- 29 | Initially, images are created as copies of the initial structure and are each asssigned a calculator. Here we use the interactive :class:`iEspresso` calculator, but the non-interactive :class:`Espresso` calculator is equally valid. 30 | 31 | .. code-block:: python 32 | 33 | images = [initial] 34 | for _ in range(7): 35 | image = initial.copy() 36 | image.set_calculator(iEspresso(pw=300, dw=4000,kpts='gamma',xc='PBE')) 37 | images.append(image) 38 | images.append(final) 39 | 40 | Running the NEB calculation and analyzing the results 41 | ------------------------------------------------------- 42 | The :class:`NEBEspresso` class is instantiated with the list of images and is used just as the :class:`ase.neb.NEB` super class, with one exception: the ``parallel`` keyword. :class:`NEBEspresso` ignores ``'parallel'=False`` and will always attempt to distribute the image calculators over the CPU pool available to the job. 43 | 44 | .. code-block:: python 45 | 46 | from espresso.nebespresso import NEBEspresso 47 | from ase.optimize.fire import FIRE as QuasiNewton 48 | 49 | neb = NEBEspresso(images) 50 | neb.interpolate('idpp') 51 | 52 | qn = QuasiNewton(neb, logfile='ethane_linear.log', trajectory='neb.traj') 53 | qn.run(fmax=0.05) 54 | 55 | from ase.neb import NEBTools 56 | nt = NEBTools(neb.images) 57 | fig = nt.plot_band() 58 | fig.savefig('rotation-barrier.png') 59 | 60 | .. image:: rotation-barrier.png 61 | :width: 60% 62 | -------------------------------------------------------------------------------- /docs/source/rotation-barrier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmmentel/ase-espresso/ec3273cb2bdc352061f3676c59bb8d73c6cb18da/docs/source/rotation-barrier.png -------------------------------------------------------------------------------- /espresso/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Copyright 2015-2017 Lukasz Mentel 5 | # 6 | # This file is distributed under the terms of the 7 | # GNU General Public License. See the file 'COPYING' 8 | # in the root directory of the present distribution, 9 | # or http://www.gnu.org/copyleft/gpl.txt . 10 | # **************************************************************************** 11 | 12 | from __future__ import absolute_import 13 | 14 | from .espresso import Espresso, iEspresso 15 | from .vibespresso import Vibespresso 16 | from .nebespresso import NEBEspresso 17 | 18 | __version__ = "0.3.4" 19 | -------------------------------------------------------------------------------- /espresso/atomic_configs.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Original work Copyright (C) 2013-2015 SUNCAT 5 | # Modified work Copyright 2015-2017 Lukasz Mentel 6 | # 7 | # This file is distributed under the terms of the 8 | # GNU General Public License. See the file 'COPYING' 9 | # in the root directory of the present distribution, 10 | # or http://www.gnu.org/copyleft/gpl.txt . 11 | # **************************************************************************** 12 | 13 | 14 | atomic_configs = [ 15 | # 1 H: 1s1 16 | ([1, 0, 1],), 17 | # 2 He: 1s2 18 | ([1, 0, 2],), 19 | # 3 Li: 1s2 2s1 20 | ([1, 0, 2], [2, 0, 1]), 21 | # 4 Be: 1s2 2s2 22 | ([1, 0, 2], [2, 0, 2]), 23 | # 5 B: 1s2 2s2 2p1 24 | ([1, 0, 2], [2, 0, 2], [2, 1, 1]), 25 | # 6 C: 1s2 2s2 2p2 26 | ([1, 0, 2], [2, 0, 2], [2, 1, 2]), 27 | # 7 N: 1s2 2s2 2p3 28 | ([1, 0, 2], [2, 0, 2], [2, 1, 3]), 29 | # 8 O: 1s2 2s2 2p4 30 | ([1, 0, 2], [2, 0, 2], [2, 1, 4]), 31 | # 9 F: 1s2 2s2 2p5 32 | ([1, 0, 2], [2, 0, 2], [2, 1, 5]), 33 | # 10 Ne: 1s2 2s2 2p6 34 | ([1, 0, 2], [2, 0, 2], [2, 1, 6]), 35 | # 11 Na: [Ne] 3s1 36 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 1]), 37 | # 12 Mg: [Ne] 3s2 38 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2]), 39 | # 13 Al: [Ne] 3s2 3p1 40 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 1]), 41 | # 14 Si: [Ne] 3s2 3p2 42 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 2]), 43 | # 15 P: [Ne] 3s2 3p3 44 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 3]), 45 | # 16 S: [Ne] 3s2 3p4 46 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 4]), 47 | # 17 Cl: [Ne] 3s2 3p5 48 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 5]), 49 | # 18 Ar: [Ne] 3s2 3p6 50 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6]), 51 | # 19 K: [Ar] 4s1 52 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [4, 0, 1]), 53 | # 20 Ca: [Ar] 4s2 54 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [4, 0, 2]), 55 | # 21 Sc: [Ar] 3d1 4s2 56 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 1], [4, 0, 2]), 57 | # 22 Ti: [Ar] 3d2 4s2 58 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 2], [4, 0, 2]), 59 | # 23 V: [Ar] 3d3 4s2 60 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 3], [4, 0, 2]), 61 | # 24 Cr: [Ar] 3d5 4s1 62 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 5], [4, 0, 1]), 63 | # 25 Mn: [Ar] 3d5 4s2 64 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 5], [4, 0, 2]), 65 | # 26 Fe: [Ar] 3d6 4s2 66 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 6], [4, 0, 2]), 67 | # 27 Co: [Ar] 3d7 4s2 68 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 7], [4, 0, 2]), 69 | # 28 Ni: [Ar] 3d8 4s2 70 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 8], [4, 0, 2]), 71 | # 29 Cu: [Ar] 3d10 4s1 72 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 10], [4, 0, 1]), 73 | # 30 Zn: [Ar] 3d10 4s2 74 | ([1, 0, 2], [2, 0, 2], [2, 1, 6], [3, 0, 2], [3, 1, 6], [3, 2, 10], [4, 0, 2]), 75 | # 31 Ga: [Ar] 3d10 4s2 4p1 76 | ( 77 | [1, 0, 2], 78 | [2, 0, 2], 79 | [2, 1, 6], 80 | [3, 0, 2], 81 | [3, 1, 6], 82 | [3, 2, 10], 83 | [4, 0, 2], 84 | [4, 1, 1], 85 | ), 86 | # 32 Ge: [Ar] 3d10 4s2 4p2 87 | ( 88 | [1, 0, 2], 89 | [2, 0, 2], 90 | [2, 1, 6], 91 | [3, 0, 2], 92 | [3, 1, 6], 93 | [3, 2, 10], 94 | [4, 0, 2], 95 | [4, 1, 2], 96 | ), 97 | # 33 As: [Ar] 3d10 4s2 4p3 98 | ( 99 | [1, 0, 2], 100 | [2, 0, 2], 101 | [2, 1, 6], 102 | [3, 0, 2], 103 | [3, 1, 6], 104 | [3, 2, 10], 105 | [4, 0, 2], 106 | [4, 1, 3], 107 | ), 108 | # 34 Se: [Ar] 3d10 4s2 4p4 109 | ( 110 | [1, 0, 2], 111 | [2, 0, 2], 112 | [2, 1, 6], 113 | [3, 0, 2], 114 | [3, 1, 6], 115 | [3, 2, 10], 116 | [4, 0, 2], 117 | [4, 1, 4], 118 | ), 119 | # 35 Br: [Ar] 3d10 4s2 4p5 120 | ( 121 | [1, 0, 2], 122 | [2, 0, 2], 123 | [2, 1, 6], 124 | [3, 0, 2], 125 | [3, 1, 6], 126 | [3, 2, 10], 127 | [4, 0, 2], 128 | [4, 1, 5], 129 | ), 130 | # 36 Kr: [Ar] 3d10 4s2 4p6 131 | ( 132 | [1, 0, 2], 133 | [2, 0, 2], 134 | [2, 1, 6], 135 | [3, 0, 2], 136 | [3, 1, 6], 137 | [3, 2, 10], 138 | [4, 0, 2], 139 | [4, 1, 6], 140 | ), 141 | # 37 Rb: [Kr] 5s1 142 | ( 143 | [1, 0, 2], 144 | [2, 0, 2], 145 | [2, 1, 6], 146 | [3, 0, 2], 147 | [3, 1, 6], 148 | [3, 2, 10], 149 | [4, 0, 2], 150 | [4, 1, 6], 151 | [5, 0, 1], 152 | ), 153 | # 38 Sr: [Kr] 5s2 154 | ( 155 | [1, 0, 2], 156 | [2, 0, 2], 157 | [2, 1, 6], 158 | [3, 0, 2], 159 | [3, 1, 6], 160 | [3, 2, 10], 161 | [4, 0, 2], 162 | [4, 1, 6], 163 | [5, 0, 2], 164 | ), 165 | # 39 Y: [Kr] 4d1 5s2 166 | ( 167 | [1, 0, 2], 168 | [2, 0, 2], 169 | [2, 1, 6], 170 | [3, 0, 2], 171 | [3, 1, 6], 172 | [3, 2, 10], 173 | [4, 0, 2], 174 | [4, 1, 6], 175 | [4, 2, 1], 176 | [5, 0, 2], 177 | ), 178 | # 40 Zr: [Kr] 4d2 5s2 179 | ( 180 | [1, 0, 2], 181 | [2, 0, 2], 182 | [2, 1, 6], 183 | [3, 0, 2], 184 | [3, 1, 6], 185 | [3, 2, 10], 186 | [4, 0, 2], 187 | [4, 1, 6], 188 | [4, 2, 2], 189 | [5, 0, 2], 190 | ), 191 | # 41 Nb: [Kr] 4d4 5s1 192 | ( 193 | [1, 0, 2], 194 | [2, 0, 2], 195 | [2, 1, 6], 196 | [3, 0, 2], 197 | [3, 1, 6], 198 | [3, 2, 10], 199 | [4, 0, 2], 200 | [4, 1, 6], 201 | [4, 2, 4], 202 | [5, 0, 1], 203 | ), 204 | # 42 Mo: [Kr] 4d5 5s1 205 | ( 206 | [1, 0, 2], 207 | [2, 0, 2], 208 | [2, 1, 6], 209 | [3, 0, 2], 210 | [3, 1, 6], 211 | [3, 2, 10], 212 | [4, 0, 2], 213 | [4, 1, 6], 214 | [4, 2, 5], 215 | [5, 0, 1], 216 | ), 217 | # 43 Tc: [Kr] 4d5 5s2 218 | ( 219 | [1, 0, 2], 220 | [2, 0, 2], 221 | [2, 1, 6], 222 | [3, 0, 2], 223 | [3, 1, 6], 224 | [3, 2, 10], 225 | [4, 0, 2], 226 | [4, 1, 6], 227 | [4, 2, 5], 228 | [5, 0, 2], 229 | ), 230 | # 44 Ru: [Kr] 4d7 5s1 231 | ( 232 | [1, 0, 2], 233 | [2, 0, 2], 234 | [2, 1, 6], 235 | [3, 0, 2], 236 | [3, 1, 6], 237 | [3, 2, 10], 238 | [4, 0, 2], 239 | [4, 1, 6], 240 | [4, 2, 7], 241 | [5, 0, 1], 242 | ), 243 | # 45 Rh: [Kr] 4d8 5s1 244 | ( 245 | [1, 0, 2], 246 | [2, 0, 2], 247 | [2, 1, 6], 248 | [3, 0, 2], 249 | [3, 1, 6], 250 | [3, 2, 10], 251 | [4, 0, 2], 252 | [4, 1, 6], 253 | [4, 2, 8], 254 | [5, 0, 1], 255 | ), 256 | # 46 Pd: [Kr] 4d10 257 | ( 258 | [1, 0, 2], 259 | [2, 0, 2], 260 | [2, 1, 6], 261 | [3, 0, 2], 262 | [3, 1, 6], 263 | [3, 2, 10], 264 | [4, 0, 2], 265 | [4, 1, 6], 266 | [4, 2, 10], 267 | ), 268 | # 47 Ag: [Kr] 4d10 5s1 269 | ( 270 | [1, 0, 2], 271 | [2, 0, 2], 272 | [2, 1, 6], 273 | [3, 0, 2], 274 | [3, 1, 6], 275 | [3, 2, 10], 276 | [4, 0, 2], 277 | [4, 1, 6], 278 | [4, 2, 10], 279 | [5, 0, 1], 280 | ), 281 | # 48 Cd: [Kr] 4d10 5s2 282 | ( 283 | [1, 0, 2], 284 | [2, 0, 2], 285 | [2, 1, 6], 286 | [3, 0, 2], 287 | [3, 1, 6], 288 | [3, 2, 10], 289 | [4, 0, 2], 290 | [4, 1, 6], 291 | [4, 2, 10], 292 | [5, 0, 2], 293 | ), 294 | # 49 In: [Kr] 4d10 5s2 5p1 295 | ( 296 | [1, 0, 2], 297 | [2, 0, 2], 298 | [2, 1, 6], 299 | [3, 0, 2], 300 | [3, 1, 6], 301 | [3, 2, 10], 302 | [4, 0, 2], 303 | [4, 1, 6], 304 | [4, 2, 10], 305 | [5, 0, 2], 306 | [5, 1, 1], 307 | ), 308 | # 50 Sn: [Kr] 4d10 5s2 5p2 309 | ( 310 | [1, 0, 2], 311 | [2, 0, 2], 312 | [2, 1, 6], 313 | [3, 0, 2], 314 | [3, 1, 6], 315 | [3, 2, 10], 316 | [4, 0, 2], 317 | [4, 1, 6], 318 | [4, 2, 10], 319 | [5, 0, 2], 320 | [5, 1, 2], 321 | ), 322 | # 51 Sb: [Kr] 4d10 5s2 5p3 323 | ( 324 | [1, 0, 2], 325 | [2, 0, 2], 326 | [2, 1, 6], 327 | [3, 0, 2], 328 | [3, 1, 6], 329 | [3, 2, 10], 330 | [4, 0, 2], 331 | [4, 1, 6], 332 | [4, 2, 10], 333 | [5, 0, 2], 334 | [5, 1, 3], 335 | ), 336 | # 52 Te: [Kr] 4d10 5s2 5p4 337 | ( 338 | [1, 0, 2], 339 | [2, 0, 2], 340 | [2, 1, 6], 341 | [3, 0, 2], 342 | [3, 1, 6], 343 | [3, 2, 10], 344 | [4, 0, 2], 345 | [4, 1, 6], 346 | [4, 2, 10], 347 | [5, 0, 2], 348 | [5, 1, 4], 349 | ), 350 | # 53 I: [Kr] 4d10 5s2 5p5 351 | ( 352 | [1, 0, 2], 353 | [2, 0, 2], 354 | [2, 1, 6], 355 | [3, 0, 2], 356 | [3, 1, 6], 357 | [3, 2, 10], 358 | [4, 0, 2], 359 | [4, 1, 6], 360 | [4, 2, 10], 361 | [5, 0, 2], 362 | [5, 1, 5], 363 | ), 364 | # 54 Xe: [Kr] 4d10 5s2 5p6 365 | ( 366 | [1, 0, 2], 367 | [2, 0, 2], 368 | [2, 1, 6], 369 | [3, 0, 2], 370 | [3, 1, 6], 371 | [3, 2, 10], 372 | [4, 0, 2], 373 | [4, 1, 6], 374 | [4, 2, 10], 375 | [5, 0, 2], 376 | [5, 1, 6], 377 | ), 378 | # 55 Cs: [Xe] 6s1 379 | ( 380 | [1, 0, 2], 381 | [2, 0, 2], 382 | [2, 1, 6], 383 | [3, 0, 2], 384 | [3, 1, 6], 385 | [3, 2, 10], 386 | [4, 0, 2], 387 | [4, 1, 6], 388 | [4, 2, 10], 389 | [5, 0, 2], 390 | [5, 1, 6], 391 | [6, 0, 1], 392 | ), 393 | # 56 Ba: [Xe] 6s2 394 | ( 395 | [1, 0, 2], 396 | [2, 0, 2], 397 | [2, 1, 6], 398 | [3, 0, 2], 399 | [3, 1, 6], 400 | [3, 2, 10], 401 | [4, 0, 2], 402 | [4, 1, 6], 403 | [4, 2, 10], 404 | [5, 0, 2], 405 | [5, 1, 6], 406 | [6, 0, 2], 407 | ), 408 | # 57 La: [Xe] 5d1 6s2 409 | ( 410 | [1, 0, 2], 411 | [2, 0, 2], 412 | [2, 1, 6], 413 | [3, 0, 2], 414 | [3, 1, 6], 415 | [3, 2, 10], 416 | [4, 0, 2], 417 | [4, 1, 6], 418 | [4, 2, 10], 419 | [5, 0, 2], 420 | [5, 1, 6], 421 | [5, 2, 1], 422 | [6, 0, 2], 423 | ), 424 | # 58 Ce: [Xe] 4f1 5d1 6s2 425 | ( 426 | [1, 0, 2], 427 | [2, 0, 2], 428 | [2, 1, 6], 429 | [3, 0, 2], 430 | [3, 1, 6], 431 | [3, 2, 10], 432 | [4, 0, 2], 433 | [4, 1, 6], 434 | [4, 2, 10], 435 | [5, 0, 2], 436 | [5, 1, 6], 437 | [4, 3, 1], 438 | [5, 2, 1], 439 | [6, 0, 2], 440 | ), 441 | # 59 Pr: [Xe] 4f3 6s2 442 | ( 443 | [1, 0, 2], 444 | [2, 0, 2], 445 | [2, 1, 6], 446 | [3, 0, 2], 447 | [3, 1, 6], 448 | [3, 2, 10], 449 | [4, 0, 2], 450 | [4, 1, 6], 451 | [4, 2, 10], 452 | [5, 0, 2], 453 | [5, 1, 6], 454 | [4, 3, 3], 455 | [6, 0, 2], 456 | ), 457 | # 60 Nd: [Xe] 4f4 6s2 458 | ( 459 | [1, 0, 2], 460 | [2, 0, 2], 461 | [2, 1, 6], 462 | [3, 0, 2], 463 | [3, 1, 6], 464 | [3, 2, 10], 465 | [4, 0, 2], 466 | [4, 1, 6], 467 | [4, 2, 10], 468 | [5, 0, 2], 469 | [5, 1, 6], 470 | [4, 3, 4], 471 | [6, 0, 2], 472 | ), 473 | # 61 Pm: [Xe] 4f5 6s2 474 | ( 475 | [1, 0, 2], 476 | [2, 0, 2], 477 | [2, 1, 6], 478 | [3, 0, 2], 479 | [3, 1, 6], 480 | [3, 2, 10], 481 | [4, 0, 2], 482 | [4, 1, 6], 483 | [4, 2, 10], 484 | [5, 0, 2], 485 | [5, 1, 6], 486 | [4, 3, 5], 487 | [6, 0, 2], 488 | ), 489 | # 62 Sm: [Xe] 4f6 6s2 490 | ( 491 | [1, 0, 2], 492 | [2, 0, 2], 493 | [2, 1, 6], 494 | [3, 0, 2], 495 | [3, 1, 6], 496 | [3, 2, 10], 497 | [4, 0, 2], 498 | [4, 1, 6], 499 | [4, 2, 10], 500 | [5, 0, 2], 501 | [5, 1, 6], 502 | [4, 3, 6], 503 | [6, 0, 2], 504 | ), 505 | # 63 Eu: [Xe] 4f7 6s2 506 | ( 507 | [1, 0, 2], 508 | [2, 0, 2], 509 | [2, 1, 6], 510 | [3, 0, 2], 511 | [3, 1, 6], 512 | [3, 2, 10], 513 | [4, 0, 2], 514 | [4, 1, 6], 515 | [4, 2, 10], 516 | [5, 0, 2], 517 | [5, 1, 6], 518 | [4, 3, 7], 519 | [6, 0, 2], 520 | ), 521 | # 64 Gd: [Xe] 4f7 5d1 6s2 522 | ( 523 | [1, 0, 2], 524 | [2, 0, 2], 525 | [2, 1, 6], 526 | [3, 0, 2], 527 | [3, 1, 6], 528 | [3, 2, 10], 529 | [4, 0, 2], 530 | [4, 1, 6], 531 | [4, 2, 10], 532 | [5, 0, 2], 533 | [5, 1, 6], 534 | [4, 3, 7], 535 | [5, 2, 1], 536 | [6, 0, 2], 537 | ), 538 | # 65 Tb: [Xe] 4f9 6s2 539 | ( 540 | [1, 0, 2], 541 | [2, 0, 2], 542 | [2, 1, 6], 543 | [3, 0, 2], 544 | [3, 1, 6], 545 | [3, 2, 10], 546 | [4, 0, 2], 547 | [4, 1, 6], 548 | [4, 2, 10], 549 | [5, 0, 2], 550 | [5, 1, 6], 551 | [4, 3, 9], 552 | [6, 0, 2], 553 | ), 554 | # 66 Dy: [Xe] 4f10 6s2 555 | ( 556 | [1, 0, 2], 557 | [2, 0, 2], 558 | [2, 1, 6], 559 | [3, 0, 2], 560 | [3, 1, 6], 561 | [3, 2, 10], 562 | [4, 0, 2], 563 | [4, 1, 6], 564 | [4, 2, 10], 565 | [5, 0, 2], 566 | [5, 1, 6], 567 | [4, 3, 10], 568 | [6, 0, 2], 569 | ), 570 | # 67 Ho: [Xe] 4f11 6s2 571 | ( 572 | [1, 0, 2], 573 | [2, 0, 2], 574 | [2, 1, 6], 575 | [3, 0, 2], 576 | [3, 1, 6], 577 | [3, 2, 10], 578 | [4, 0, 2], 579 | [4, 1, 6], 580 | [4, 2, 10], 581 | [5, 0, 2], 582 | [5, 1, 6], 583 | [4, 3, 11], 584 | [6, 0, 2], 585 | ), 586 | # 68 Er: [Xe] 4f12 6s2 587 | ( 588 | [1, 0, 2], 589 | [2, 0, 2], 590 | [2, 1, 6], 591 | [3, 0, 2], 592 | [3, 1, 6], 593 | [3, 2, 10], 594 | [4, 0, 2], 595 | [4, 1, 6], 596 | [4, 2, 10], 597 | [5, 0, 2], 598 | [5, 1, 6], 599 | [4, 3, 12], 600 | [6, 0, 2], 601 | ), 602 | # 69 Tm: [Xe] 4f13 6s2 603 | ( 604 | [1, 0, 2], 605 | [2, 0, 2], 606 | [2, 1, 6], 607 | [3, 0, 2], 608 | [3, 1, 6], 609 | [3, 2, 10], 610 | [4, 0, 2], 611 | [4, 1, 6], 612 | [4, 2, 10], 613 | [5, 0, 2], 614 | [5, 1, 6], 615 | [4, 3, 13], 616 | [6, 0, 2], 617 | ), 618 | # 70 Yb: [Xe] 4f14 6s2 619 | ( 620 | [1, 0, 2], 621 | [2, 0, 2], 622 | [2, 1, 6], 623 | [3, 0, 2], 624 | [3, 1, 6], 625 | [3, 2, 10], 626 | [4, 0, 2], 627 | [4, 1, 6], 628 | [4, 2, 10], 629 | [5, 0, 2], 630 | [5, 1, 6], 631 | [4, 3, 14], 632 | [6, 0, 2], 633 | ), 634 | # 71 Lu: [Xe] 4f14 5d1 6s2 635 | ( 636 | [1, 0, 2], 637 | [2, 0, 2], 638 | [2, 1, 6], 639 | [3, 0, 2], 640 | [3, 1, 6], 641 | [3, 2, 10], 642 | [4, 0, 2], 643 | [4, 1, 6], 644 | [4, 2, 10], 645 | [5, 0, 2], 646 | [5, 1, 6], 647 | [4, 3, 14], 648 | [5, 2, 1], 649 | [6, 0, 2], 650 | ), 651 | # 72 Hf: [Xe] 4f14 5d2 6s2 652 | ( 653 | [1, 0, 2], 654 | [2, 0, 2], 655 | [2, 1, 6], 656 | [3, 0, 2], 657 | [3, 1, 6], 658 | [3, 2, 10], 659 | [4, 0, 2], 660 | [4, 1, 6], 661 | [4, 2, 10], 662 | [5, 0, 2], 663 | [5, 1, 6], 664 | [4, 3, 14], 665 | [5, 2, 2], 666 | [6, 0, 2], 667 | ), 668 | # 73 Ta: [Xe] 4f14 5d3 6s2 669 | ( 670 | [1, 0, 2], 671 | [2, 0, 2], 672 | [2, 1, 6], 673 | [3, 0, 2], 674 | [3, 1, 6], 675 | [3, 2, 10], 676 | [4, 0, 2], 677 | [4, 1, 6], 678 | [4, 2, 10], 679 | [5, 0, 2], 680 | [5, 1, 6], 681 | [4, 3, 14], 682 | [5, 2, 3], 683 | [6, 0, 2], 684 | ), 685 | # 74 W: [Xe] 4f14 5d4 6s2 686 | ( 687 | [1, 0, 2], 688 | [2, 0, 2], 689 | [2, 1, 6], 690 | [3, 0, 2], 691 | [3, 1, 6], 692 | [3, 2, 10], 693 | [4, 0, 2], 694 | [4, 1, 6], 695 | [4, 2, 10], 696 | [5, 0, 2], 697 | [5, 1, 6], 698 | [4, 3, 14], 699 | [5, 2, 4], 700 | [6, 0, 2], 701 | ), 702 | # 75 Re: [Xe] 4f14 5d5 6s2 703 | ( 704 | [1, 0, 2], 705 | [2, 0, 2], 706 | [2, 1, 6], 707 | [3, 0, 2], 708 | [3, 1, 6], 709 | [3, 2, 10], 710 | [4, 0, 2], 711 | [4, 1, 6], 712 | [4, 2, 10], 713 | [5, 0, 2], 714 | [5, 1, 6], 715 | [4, 3, 14], 716 | [5, 2, 5], 717 | [6, 0, 2], 718 | ), 719 | # 76 Os: [Xe] 4f14 5d6 6s2 720 | ( 721 | [1, 0, 2], 722 | [2, 0, 2], 723 | [2, 1, 6], 724 | [3, 0, 2], 725 | [3, 1, 6], 726 | [3, 2, 10], 727 | [4, 0, 2], 728 | [4, 1, 6], 729 | [4, 2, 10], 730 | [5, 0, 2], 731 | [5, 1, 6], 732 | [4, 3, 14], 733 | [5, 2, 6], 734 | [6, 0, 2], 735 | ), 736 | # 77 Ir: [Xe] 4f14 5d7 6s2 737 | ( 738 | [1, 0, 2], 739 | [2, 0, 2], 740 | [2, 1, 6], 741 | [3, 0, 2], 742 | [3, 1, 6], 743 | [3, 2, 10], 744 | [4, 0, 2], 745 | [4, 1, 6], 746 | [4, 2, 10], 747 | [5, 0, 2], 748 | [5, 1, 6], 749 | [4, 3, 14], 750 | [5, 2, 7], 751 | [6, 0, 2], 752 | ), 753 | # 78 Pt: [Xe] 4f14 5d9 6s1 754 | ( 755 | [1, 0, 2], 756 | [2, 0, 2], 757 | [2, 1, 6], 758 | [3, 0, 2], 759 | [3, 1, 6], 760 | [3, 2, 10], 761 | [4, 0, 2], 762 | [4, 1, 6], 763 | [4, 2, 10], 764 | [5, 0, 2], 765 | [5, 1, 6], 766 | [4, 3, 14], 767 | [5, 2, 9], 768 | [6, 0, 1], 769 | ), 770 | # 79 Au: [Xe] 4f14 5d10 6s1 771 | ( 772 | [1, 0, 2], 773 | [2, 0, 2], 774 | [2, 1, 6], 775 | [3, 0, 2], 776 | [3, 1, 6], 777 | [3, 2, 10], 778 | [4, 0, 2], 779 | [4, 1, 6], 780 | [4, 2, 10], 781 | [5, 0, 2], 782 | [5, 1, 6], 783 | [4, 3, 14], 784 | [5, 2, 10], 785 | [6, 0, 1], 786 | ), 787 | # 80 Hg: [Xe] 4f14 5d10 6s2 788 | ( 789 | [1, 0, 2], 790 | [2, 0, 2], 791 | [2, 1, 6], 792 | [3, 0, 2], 793 | [3, 1, 6], 794 | [3, 2, 10], 795 | [4, 0, 2], 796 | [4, 1, 6], 797 | [4, 2, 10], 798 | [5, 0, 2], 799 | [5, 1, 6], 800 | [4, 3, 14], 801 | [5, 2, 10], 802 | [6, 0, 2], 803 | ), 804 | # 81 Tl: [Xe] 4f14 5d10 6s2 6p1 805 | ( 806 | [1, 0, 2], 807 | [2, 0, 2], 808 | [2, 1, 6], 809 | [3, 0, 2], 810 | [3, 1, 6], 811 | [3, 2, 10], 812 | [4, 0, 2], 813 | [4, 1, 6], 814 | [4, 2, 10], 815 | [5, 0, 2], 816 | [5, 1, 6], 817 | [4, 3, 14], 818 | [5, 2, 10], 819 | [6, 0, 2], 820 | [6, 1, 1], 821 | ), 822 | # 82 Pb: [Xe] 4f14 5d10 6s2 6p2 823 | ( 824 | [1, 0, 2], 825 | [2, 0, 2], 826 | [2, 1, 6], 827 | [3, 0, 2], 828 | [3, 1, 6], 829 | [3, 2, 10], 830 | [4, 0, 2], 831 | [4, 1, 6], 832 | [4, 2, 10], 833 | [5, 0, 2], 834 | [5, 1, 6], 835 | [4, 3, 14], 836 | [5, 2, 10], 837 | [6, 0, 2], 838 | [6, 1, 2], 839 | ), 840 | # 83 Bi: [Xe] 4f14 5d10 6s2 6p3 841 | ( 842 | [1, 0, 2], 843 | [2, 0, 2], 844 | [2, 1, 6], 845 | [3, 0, 2], 846 | [3, 1, 6], 847 | [3, 2, 10], 848 | [4, 0, 2], 849 | [4, 1, 6], 850 | [4, 2, 10], 851 | [5, 0, 2], 852 | [5, 1, 6], 853 | [4, 3, 14], 854 | [5, 2, 10], 855 | [6, 0, 2], 856 | [6, 1, 3], 857 | ), 858 | # 84 Po: [Xe] 4f14 5d10 6s2 6p4 859 | ( 860 | [1, 0, 2], 861 | [2, 0, 2], 862 | [2, 1, 6], 863 | [3, 0, 2], 864 | [3, 1, 6], 865 | [3, 2, 10], 866 | [4, 0, 2], 867 | [4, 1, 6], 868 | [4, 2, 10], 869 | [5, 0, 2], 870 | [5, 1, 6], 871 | [4, 3, 14], 872 | [5, 2, 10], 873 | [6, 0, 2], 874 | [6, 1, 4], 875 | ), 876 | # 85 At: [Xe] 4f14 5d10 6s2 6p5 877 | ( 878 | [1, 0, 2], 879 | [2, 0, 2], 880 | [2, 1, 6], 881 | [3, 0, 2], 882 | [3, 1, 6], 883 | [3, 2, 10], 884 | [4, 0, 2], 885 | [4, 1, 6], 886 | [4, 2, 10], 887 | [5, 0, 2], 888 | [5, 1, 6], 889 | [4, 3, 14], 890 | [5, 2, 10], 891 | [6, 0, 2], 892 | [6, 1, 5], 893 | ), 894 | # 86 Rn: [Xe] 4f14 5d10 6s2 6p6 895 | ( 896 | [1, 0, 2], 897 | [2, 0, 2], 898 | [2, 1, 6], 899 | [3, 0, 2], 900 | [3, 1, 6], 901 | [3, 2, 10], 902 | [4, 0, 2], 903 | [4, 1, 6], 904 | [4, 2, 10], 905 | [5, 0, 2], 906 | [5, 1, 6], 907 | [4, 3, 14], 908 | [5, 2, 10], 909 | [6, 0, 2], 910 | [6, 1, 6], 911 | ), 912 | # 87 Fr: [Rn] 7s1 913 | ( 914 | [1, 0, 2], 915 | [2, 0, 2], 916 | [2, 1, 6], 917 | [3, 0, 2], 918 | [3, 1, 6], 919 | [3, 2, 10], 920 | [4, 0, 2], 921 | [4, 1, 6], 922 | [4, 2, 10], 923 | [5, 0, 2], 924 | [5, 1, 6], 925 | [4, 3, 14], 926 | [5, 2, 10], 927 | [6, 0, 2], 928 | [6, 1, 6], 929 | [7, 0, 1], 930 | ), 931 | # 88 Ra: [Rn] 7s2 932 | ( 933 | [1, 0, 2], 934 | [2, 0, 2], 935 | [2, 1, 6], 936 | [3, 0, 2], 937 | [3, 1, 6], 938 | [3, 2, 10], 939 | [4, 0, 2], 940 | [4, 1, 6], 941 | [4, 2, 10], 942 | [5, 0, 2], 943 | [5, 1, 6], 944 | [4, 3, 14], 945 | [5, 2, 10], 946 | [6, 0, 2], 947 | [6, 1, 6], 948 | [7, 0, 2], 949 | ), 950 | # 89 Ac: [Rn] 6d1 7s2 951 | ( 952 | [1, 0, 2], 953 | [2, 0, 2], 954 | [2, 1, 6], 955 | [3, 0, 2], 956 | [3, 1, 6], 957 | [3, 2, 10], 958 | [4, 0, 2], 959 | [4, 1, 6], 960 | [4, 2, 10], 961 | [5, 0, 2], 962 | [5, 1, 6], 963 | [4, 3, 14], 964 | [5, 2, 10], 965 | [6, 0, 2], 966 | [6, 1, 6], 967 | [6, 2, 1], 968 | [7, 0, 2], 969 | ), 970 | # 90 Th: [Rn] 6d2 7s2 971 | ( 972 | [1, 0, 2], 973 | [2, 0, 2], 974 | [2, 1, 6], 975 | [3, 0, 2], 976 | [3, 1, 6], 977 | [3, 2, 10], 978 | [4, 0, 2], 979 | [4, 1, 6], 980 | [4, 2, 10], 981 | [5, 0, 2], 982 | [5, 1, 6], 983 | [4, 3, 14], 984 | [5, 2, 10], 985 | [6, 0, 2], 986 | [6, 1, 6], 987 | [6, 2, 2], 988 | [7, 0, 2], 989 | ), 990 | ] 991 | 992 | atomic_configs_dict = { 993 | "H": ("", ["1s"], 1, "Hydrogen"), 994 | "He": ("", ["1s2"], 2, "Helium"), 995 | "Li": ("", ["1s2", "2s"], 3, "Lithium"), 996 | "Be": ("", ["1s2", "2s2"], 4, "Beryllium"), 997 | "B": ("", ["1s2", "2s2", "2p"], 5, "Boron"), 998 | "C": ("", ["1s2", "2s2", "2p2"], 6, "Carbon"), 999 | "N": ("", ["1s2", "2s2", "2p3"], 7, "Nitrogen"), 1000 | "O": ("", ["1s2", "2s2", "2p4"], 8, "Oxygen"), 1001 | "F": ("", ["1s2", "2s2", "2p5"], 9, "Fluorine"), 1002 | "Ne": ("", ["1s2", "2s2", "2p6"], 10, "Neon"), 1003 | "Na": ("Ne", ["3s"], 11, "Sodium"), 1004 | "Mg": ("Ne", ["3s2"], 12, "Magnesium"), 1005 | "Al": ("Ne", ["3s2", "3p"], 13, "Aluminum"), 1006 | "Si": ("Ne", ["3s2", "3p2"], 14, "Silicon"), 1007 | "P": ("Ne", ["3s2", "3p3"], 15, "Phosphorus"), 1008 | "S": ("Ne", ["3s2", "3p4"], 16, "Sulfur"), 1009 | "Cl": ("Ne", ["3s2", "3p5"], 17, "Chlorine"), 1010 | "Ar": ("Ne", ["3s2", "3p6"], 18, "Argon"), 1011 | "K": ("Ar", ["4s"], 19, "Potassium"), 1012 | "Ca": ("Ar", ["4s2"], 20, "Calcium"), 1013 | "Sc": ("Ar", ["3d", "4s2"], 21, "Scandium"), 1014 | "Ti": ("Ar", ["3d2", "4s2"], 22, "Titanium"), 1015 | "V": ("Ar", ["3d3", "4s2"], 23, "Vanadium"), 1016 | "Cr": ("Ar", ["3d5", "4s"], 24, "Chromium"), 1017 | "Mn": ("Ar", ["3d5", "4s2"], 25, "Manganese"), 1018 | "Fe": ("Ar", ["3d6", "4s2"], 26, "Iron"), 1019 | "Co": ("Ar", ["3d7", "4s2"], 27, "Cobalt"), 1020 | "Ni": ("Ar", ["3d8", "4s2"], 28, "Nickel"), 1021 | "Cu": ("Ar", ["3d10", "4s"], 29, "Copper"), 1022 | "Zn": ("Ar", ["3d10", "4s2"], 30, "Zinc"), 1023 | "Ga": ("Ar", ["3d10", "4s2", "4p"], 31, "Gallium"), 1024 | "Ge": ("Ar", ["3d10", "4s2", "4p2"], 32, "Germanium"), 1025 | "As": ("Ar", ["3d10", "4s2", "4p3"], 33, "Arsenic"), 1026 | "Se": ("Ar", ["3d10", "4s2", "4p4"], 34, "Selenium"), 1027 | "Br": ("Ar", ["3d10", "4s2", "4p5"], 35, "Bromine"), 1028 | "Kr": ("Ar", ["3d10", "4s2", "4p6"], 36, "Krypton"), 1029 | "Rb": ("Kr", ["5s"], 37, "Rubidium"), 1030 | "Sr": ("Kr", ["5s2"], 38, "Strontium"), 1031 | "Y": ("Kr", ["4d", "5s2"], 39, "Yttrium"), 1032 | "Zr": ("Kr", ["4d2", "5s2"], 40, "Zirconium"), 1033 | "Nb": ("Kr", ["4d4", "5s"], 41, "Niobium"), 1034 | "Mo": ("Kr", ["4d5", "5s"], 42, "Molybdenum"), 1035 | "Tc": ("Kr", ["4d5", "5s2"], 43, "Technetium"), 1036 | "Ru": ("Kr", ["4d7", "5s"], 44, "Ruthenium"), 1037 | "Rh": ("Kr", ["4d8", "5s"], 45, "Rhodium"), 1038 | "Pd": ("Kr", ["4d10"], 46, "Palladium"), 1039 | "Ag": ("Kr", ["4d10", "5s"], 47, "Silver"), 1040 | "Cd": ("Kr", ["4d10", "5s2"], 48, "Cadmium"), 1041 | "In": ("Kr", ["4d10", "5s2", "5p"], 49, "Indium"), 1042 | "Sn": ("Kr", ["4d10", "5s2", "5p2"], 50, "Tin"), 1043 | "Sb": ("Kr", ["4d10", "5s2", "5p3"], 51, "Antimony"), 1044 | "Te": ("Kr", ["4d10", "5s2", "5p4"], 52, "Tellurium"), 1045 | "I": ("Kr", ["4d10", "5s2", "5p5"], 53, "Iodine"), 1046 | "Xe": ("Kr", ["4d10", "5s2", "5p6"], 54, "Xenon"), 1047 | "Cs": ("Xe", ["6s"], 55, "Cesium"), 1048 | "Ba": ("Xe", ["6s2"], 56, "Barium"), 1049 | "La": ("Xe", ["5d", "6s2"], 57, "Lanthanum"), 1050 | "Ce": ("Xe", ["4f", "5d", "6s2"], 58, "Cerium"), 1051 | "Pr": ("Xe", ["4f3", "6s2"], 59, "Praseodymium"), 1052 | "Nd": ("Xe", ["4f4", "6s2"], 60, "Neodymium"), 1053 | "Pm": ("Xe", ["4f5", "6s2"], 61, "Promethium"), 1054 | "Sm": ("Xe", ["4f6", "6s2"], 62, "Samarium"), 1055 | "Eu": ("Xe", ["4f7", "6s2"], 63, "Europium"), 1056 | "Gd": ("Xe", ["4f7", "5d", "6s2"], 64, "Gadolinium"), 1057 | "Tb": ("Xe", ["4f9", "6s2"], 65, "Terbium"), 1058 | "Dy": ("Xe", ["4f10", "6s2"], 66, "Dysprosium"), 1059 | "Ho": ("Xe", ["4f11", "6s2"], 67, "Holmium"), 1060 | "Er": ("Xe", ["4f12", "6s2"], 68, "Erbium"), 1061 | "Tm": ("Xe", ["4f13", "6s2"], 69, "Thulium"), 1062 | "Yb": ("Xe", ["4f14", "6s2"], 70, "Ytterbium"), 1063 | "Lu": ("Xe", ["4f14", "5d", "6s2"], 71, "Lutetium"), 1064 | "Hf": ("Xe", ["4f14", "5d2", "6s2"], 72, "Hafnium"), 1065 | "Ta": ("Xe", ["4f14", "5d3", "6s2"], 73, "Tantalum"), 1066 | "W": ("Xe", ["4f14", "5d4", "6s2"], 74, "Tungsten"), 1067 | "Re": ("Xe", ["4f14", "5d5", "6s2"], 75, "Rhenium"), 1068 | "Os": ("Xe", ["4f14", "5d6", "6s2"], 76, "Osmium"), 1069 | "Ir": ("Xe", ["4f14", "5d7", "6s2"], 77, "Iridium"), 1070 | "Pt": ("Xe", ["4f14", "5d9", "6s"], 78, "Platinum"), 1071 | "Au": ("Xe", ["4f14", "5d10", "6s"], 79, "Gold"), 1072 | "Hg": ("Xe", ["4f14", "5d10", "6s2"], 80, "Mercury"), 1073 | "Tl": ("Xe", ["4f14", "5d10", "6s2", "6p"], 81, "Thallium"), 1074 | "Pb": ("Xe", ["4f14", "5d10", "6s2", "6p2"], 82, "Lead"), 1075 | "Bi": ("Xe", ["4f14", "5d10", "6s2", "6p3"], 83, "Bismuth"), 1076 | "Po": ("Xe", ["4f14", "5d10", "6s2", "6p4"], 84, "Polonium"), 1077 | "At": ("Xe", ["4f14", "5d10", "6s2", "6p5"], 85, "Astatine"), 1078 | "Rn": ("Xe", ["4f14", "5d10", "6s2", "6p6"], 86, "Radon"), 1079 | "Fr": ("Rn", ["7s"], 87, "Francium"), 1080 | "Ra": ("Rn", ["7s2"], 88, "Radium"), 1081 | "Ac": ("Rn", ["6d", "7s2"], 89, "Actinium"), 1082 | "Th": ("Rn", ["6d2", "7s2"], 90, "Thorium"), 1083 | } 1084 | 1085 | 1086 | ldict = {"s": 0, "p": 1, "d": 2, "f": 3} 1087 | 1088 | 1089 | def hundmagperchannel(channel): 1090 | """ 1091 | returns the magnetization according to Hund for a channel 1092 | in the form of e.g. '5d8' 1093 | """ 1094 | l = ldict[channel[1]] 1095 | if len(channel) == 2: 1096 | nelec = 1 1097 | else: 1098 | nelec = int(channel[2:]) 1099 | 1100 | nstates = 2 * l + 1 1101 | if nelec > nstates: 1102 | return 2 * nstates - nelec 1103 | else: 1104 | return nelec 1105 | 1106 | 1107 | def hundmag(s): 1108 | """ 1109 | returns the magnetization according to Hund 1110 | s can either be an atomic symbol or a list of valence states, 1111 | e.g. ['4f7', '5d', '6s2'] 1112 | """ 1113 | mag = 0 1114 | if hasattr(s, "upper"): 1115 | configs = atomic_configs_dict[s][1] 1116 | else: 1117 | configs = s 1118 | for c in configs: 1119 | mag += hundmagperchannel(c) 1120 | return mag 1121 | -------------------------------------------------------------------------------- /espresso/nebespresso.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Original work Copyright (C) 2013-2015 SUNCAT 5 | # Modified work Copyright 2015-2017 Lukasz Mentel 6 | # 7 | # This file is distributed under the terms of the 8 | # GNU General Public License. See the file 'COPYING' 9 | # in the root directory of the present distribution, 10 | # or http://www.gnu.org/copyleft/gpl.txt . 11 | # **************************************************************************** 12 | 13 | from __future__ import print_function, absolute_import 14 | 15 | import copy 16 | import threading 17 | 18 | from ase.neb import NEB 19 | 20 | from .siteconfig import SiteConfig 21 | 22 | 23 | __version__ = "0.3.4" 24 | 25 | 26 | def splitinto(l, n): 27 | """ 28 | Split a list into `n` sublists of roughly equal size 29 | 30 | Args: 31 | l (`list`) : 32 | list to be split 33 | n (int) : 34 | number of sublists 35 | """ 36 | 37 | q, r = divmod(len(l), n) 38 | indices = [q * i + min(i, r) for i in range(n + 1)] 39 | return [l[indices[i] : indices[i + 1]] for i in range(n)] 40 | 41 | 42 | class NEBEspresso(NEB): 43 | def __init__(self, images, site=None, outprefix="neb", **neb_kwargs): 44 | 45 | super().__init__(images, **neb_kwargs) 46 | 47 | self.site = site 48 | self.outprefix = outprefix 49 | self.jobs = [] 50 | self.initialize() 51 | 52 | @property 53 | def site(self): 54 | return self._site 55 | 56 | @site.setter 57 | def site(self, value): 58 | if value is None: 59 | self._site = SiteConfig.check_scheduler() 60 | if self._site.scheduler is None: 61 | raise NotImplementedError("Interactive NEB is not supported") 62 | else: 63 | self._site = value 64 | 65 | def wait_for_total_energies(self): 66 | """ 67 | Calculalte the energy for each thread in a separate theead and 68 | wait until all the calcualtions are finished. 69 | """ 70 | 71 | threads = [ 72 | threading.Thread( 73 | target=self.images[i]._calc.calculate, args=(self.images[i],) 74 | ) 75 | for i in range(1, self.nimages - 1) 76 | ] 77 | 78 | for t in threads: 79 | t.start() 80 | for t in threads: 81 | t.join() 82 | 83 | def get_forces(self): 84 | 85 | self.wait_for_total_energies() 86 | return super().get_forces() 87 | 88 | def initialize(self): 89 | "Create the calculator instances" 90 | 91 | imageprocs = splitinto(self.site.proclist, len(self.images) - 2) 92 | images = self.images[1 : self.nimages - 1] 93 | 94 | for i, (image, procs) in enumerate(zip(images, imageprocs)): 95 | 96 | site = copy.deepcopy(self.site) 97 | 98 | site.proclist = procs 99 | site.nprocs = len(site.proclist) 100 | site.usehostfile = True 101 | 102 | image._calc.set(outdir="{0:s}_{1:04d}".format(self.outprefix, i), site=site) 103 | -------------------------------------------------------------------------------- /espresso/siteconfig.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Copyright 2015-2017 Lukasz Mentel 5 | # 6 | # This file is distributed under the terms of the 7 | # GNU General Public License. See the file 'COPYING' 8 | # in the root directory of the present distribution, 9 | # or http://www.gnu.org/copyleft/gpl.txt . 10 | # **************************************************************************** 11 | 12 | from __future__ import division, print_function 13 | 14 | import contextlib 15 | import itertools as its 16 | import os 17 | import shlex 18 | import tempfile 19 | import functools 20 | from subprocess import call 21 | 22 | from six import with_metaclass 23 | import hostlist as hl 24 | from path import Path 25 | 26 | __version__ = "0.3.4" 27 | 28 | 29 | def preserve_cwd(function): 30 | @functools.wraps(function) 31 | def decorator(*args, **kwargs): 32 | cwd = os.getcwd() 33 | try: 34 | return function(*args, **kwargs) 35 | finally: 36 | os.chdir(cwd) 37 | 38 | return decorator 39 | 40 | 41 | @contextlib.contextmanager 42 | def working_directory(path): 43 | """ 44 | A context manager which changes the working directory to the given 45 | path, and then changes it back to its previous value on exit. 46 | """ 47 | 48 | old_cwd = os.getcwd() 49 | os.chdir(path) 50 | try: 51 | yield 52 | finally: 53 | os.chdir(old_cwd) 54 | 55 | 56 | class Singleton(type): 57 | 58 | _instances = {} 59 | 60 | def __call__(cls, *args, **kwargs): 61 | if cls not in Singleton._instances: 62 | Singleton._instances[cls] = type.__call__(cls, *args, **kwargs) 63 | return Singleton._instances[cls] 64 | 65 | def __erase(self): 66 | "Reset the internal state, mainly for testing purposes" 67 | 68 | Singleton._instances = {} 69 | 70 | 71 | class SiteConfig(with_metaclass(Singleton, object)): 72 | """ 73 | Site configuration holding details about the execution environment 74 | with methods for retrieving the details from systems variables and 75 | creating directories 76 | 77 | Args: 78 | scheduler (str) : 79 | Name of the scheduler, curretly supports only `SLURM` and 80 | `PBS`/`TORQUE` 81 | scratchenv (str) : 82 | Name of the envoronmental variable that defines the scratch path 83 | """ 84 | 85 | def __init__(self, scheduler=None, usehostfile=False, scratchenv="SCRATCH"): 86 | 87 | self.global_scratch = None 88 | self.scheduler = scheduler 89 | self.scratchenv = scratchenv 90 | self.localtmp = None 91 | self.submitdir = None 92 | self.usehostfile = usehostfile 93 | self.user_scratch = None 94 | 95 | # default values for the attributes that will be gathered 96 | self.batchmode = None 97 | self.hosts = None 98 | self.jobid = None 99 | self.nnodes = None 100 | self.nodelist = None 101 | self.nprocs = None 102 | self.proclist = None 103 | self.tpn = None 104 | 105 | self.set_variables() 106 | 107 | def set_variables(self): 108 | """ 109 | Resolve the site attributes based on the scheduler used 110 | """ 111 | 112 | if self.scheduler is None: 113 | self.set_interactive() 114 | elif self.scheduler.lower() == "slurm": 115 | self.set_slurm_env() 116 | elif self.scheduler.lower() in ["pbs", "torque"]: 117 | self.set_pbs_env() 118 | 119 | @classmethod 120 | def check_scheduler(cls): 121 | """ 122 | Check if either SLURM or PBS/TORQUE are running 123 | """ 124 | 125 | scheduler = None 126 | 127 | # check id SLURM is installed and running 128 | with open(os.devnull, "w") as devnull: 129 | exitcode = call("scontrol version", shell=True, stderr=devnull) 130 | if exitcode == 0: 131 | scheduler = "SLURM" 132 | 133 | # check if PBS/TORQUE is installed and running 134 | with open(os.devnull, "w") as devnull: 135 | exitcode = call( 136 | "ps aux | grep pbs | grep -v grep", shell=True, stderr=devnull 137 | ) 138 | if exitcode == 0: 139 | scheduler = "PBS" 140 | 141 | return cls(scheduler) 142 | 143 | def set_interactive(self): 144 | """ 145 | Set the attributes necessary for interactive runs 146 | 147 | - `batchmode` is False 148 | - `jobid` is set to the PID 149 | - `global_scratch` checks for scratch under `self.scratchenv` if it is 150 | not defined used current directory 151 | 152 | """ 153 | 154 | self.scheduler = None 155 | self.batchmode = False 156 | self.submitdir = Path(os.path.abspath(os.getcwd())) 157 | self.jobid = os.getpid() 158 | 159 | if os.getenv(self.scratchenv) is not None: 160 | self.global_scratch = Path(os.getenv(self.scratchenv)) 161 | else: 162 | self.global_scratch = self.submitdir 163 | 164 | def set_global_scratch(self): 165 | "Set the global scratch attribute" 166 | 167 | scratch = os.getenv(self.scratchenv) 168 | 169 | if scratch is None: 170 | raise OSError("SHELL variable {} is undefied".format(self.scratchenv)) 171 | else: 172 | if os.path.exists(scratch): 173 | self.global_scratch = Path(scratch) 174 | else: 175 | raise OSError( 176 | "scratch directory <{}> defined with {} does not exist".format( 177 | scratch, self.scratchenv 178 | ) 179 | ) 180 | 181 | def set_slurm_env(self): 182 | """ 183 | Set the attributes necessary to run the job based on the 184 | enviromental variables associated with SLURM scheduler 185 | """ 186 | 187 | self.scheduler = "slurm" 188 | self.batchmode = True 189 | 190 | self.set_global_scratch() 191 | 192 | self.jobid = os.getenv("SLURM_JOB_ID") 193 | self.submitdir = Path(os.getenv("SUBMITDIR")) 194 | 195 | self.nnodes = int(os.getenv("SLURM_JOB_NUM_NODES")) 196 | self.tpn = int(os.getenv("SLURM_TASKS_PER_NODE").split("(")[0]) 197 | self.nodelist = hl.expand_hostlist(os.getenv("SLURM_JOB_NODELIST")) 198 | 199 | self.proclist = list( 200 | its.chain.from_iterable(its.repeat(x, self.tpn) for x in self.nodelist) 201 | ) 202 | self.nprocs = len(self.proclist) 203 | 204 | def set_pbs_env(self): 205 | """ 206 | Set the attributes necessary to run the job based on the 207 | enviromental variables associated with PBS/TORQUE scheduler 208 | """ 209 | 210 | self.scheduler = "pbs" 211 | self.batchmode = True 212 | 213 | self.set_global_scratch() 214 | 215 | self.jobid = os.getenv("PBS_JOBID") 216 | self.submitdir = Path(os.getenv("PBS_O_WORKDIR")) 217 | 218 | nodefile = os.getenv("PBS_NODEFILE") 219 | with open(nodefile, "r") as nf: 220 | self.hosts = [x.strip() for x in nf.readlines()] 221 | 222 | self.nprocs = len(self.hosts) 223 | uniqnodes = sorted(set(self.hosts)) 224 | 225 | self.perHostMpiExec = [ 226 | "mpirun", 227 | "-host", 228 | ",".join(uniqnodes), 229 | "-np", 230 | "{0:d}".format(len(uniqnodes)), 231 | ] 232 | 233 | self.perProcMpiExec = ( 234 | "mpiexec -machinefile {nf:s} -np {np:s}".format( 235 | nf=nodefile, np=str(self.nprocs) 236 | ) 237 | + " -wdir {0:s} {1:s}" 238 | ) 239 | 240 | def make_localtmp(self, workdir): 241 | """ 242 | Create a temporary local directory for the job 243 | 244 | Args: 245 | workdir (str) : 246 | Name of the working directory for the run 247 | """ 248 | 249 | if workdir is None or len(workdir) == 0: 250 | self.localtmp = self.submitdir.joinpath("qe_" + str(self.jobid)) 251 | else: 252 | self.localtmp = self.submitdir.joinpath(workdir + "_" + str(self.jobid)) 253 | 254 | self.localtmp.makedirs_p() 255 | return self.localtmp.abspath() 256 | 257 | def make_scratch(self): 258 | """ 259 | Create a user scratch dir on each node (in the global scratch 260 | area) in batchmode or a single local scratch directory otherwise 261 | """ 262 | 263 | prefix = "_".join(["qe", str(os.getuid()), str(self.jobid)]) 264 | self.user_scratch = Path( 265 | tempfile.mkdtemp(prefix=prefix, suffix="_scratch", dir=self.global_scratch) 266 | ) 267 | 268 | with working_directory(str(self.localtmp)): 269 | if self.batchmode: 270 | cmd = self.get_host_mpi_command( 271 | "mkdir -p {}".format(str(self.user_scratch)) 272 | ) 273 | call(cmd) 274 | else: 275 | self.user_scratch.makedirs_p() 276 | 277 | return self.user_scratch.abspath() 278 | 279 | def get_hostfile(self): 280 | 281 | if self.localtmp is None: 282 | raise RuntimeError(" is not defined yet") 283 | else: 284 | return self.localtmp.joinpath("hostfile") 285 | 286 | def get_host_mpi_command(self, program, aslist=True): 287 | "Return a command as list to execute `program` through MPI per host" 288 | 289 | command = "mpirun -host {} ".format( 290 | ",".join(self.nodelist) 291 | ) + "-np {0:d} {1:s}".format(self.nnodes, program) 292 | 293 | if aslist: 294 | return shlex.split(command) 295 | else: 296 | return command 297 | 298 | def get_proc_mpi_command(self, workdir, program, aslist=True): 299 | "Return a command as list to execute `program` through MPI per proc" 300 | 301 | if self.usehostfile: 302 | command = ( 303 | "mpirun --hostfile {0:s} ".format(self.get_hostfile()) 304 | + "-np {0:d} ".format(self.nprocs) 305 | + "-wdir {0:s} {1:s}".format(workdir, program) 306 | ) 307 | # should be logged print('Using hostfile',self.get_hostfile()) 308 | else: 309 | command = "mpirun -wdir {0:s} {1:s}".format(workdir, program) 310 | # should be logged print('Not Using hostfile', self.get_hostfile()) 311 | 312 | if aslist: 313 | return shlex.split(command) 314 | else: 315 | return command 316 | 317 | def write_local_hostfile(self): 318 | "write the local hostfile" 319 | 320 | with open(self.get_hostfile(), "w") as fobj: 321 | for proc in self.proclist: 322 | print(proc, file=fobj) 323 | 324 | def __repr__(self): 325 | return "%s(\n%s)" % ( 326 | (self.__class__.__name__), 327 | " ".join( 328 | [ 329 | "\t%s=%r,\n" % (key, getattr(self, key)) 330 | for key in sorted(self.__dict__.keys()) 331 | if not key.startswith("_") 332 | ] 333 | ), 334 | ) 335 | -------------------------------------------------------------------------------- /espresso/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Original work Copyright (C) 2013-2015 SUNCAT 5 | # Modified work Copyright 2015-2017 Lukasz Mentel 6 | # 7 | # This file is distributed under the terms of the 8 | # GNU General Public License. See the file 'COPYING' 9 | # in the root directory of the present distribution, 10 | # or http://www.gnu.org/copyleft/gpl.txt . 11 | # **************************************************************************** 12 | 13 | from __future__ import unicode_literals 14 | 15 | from collections import namedtuple 16 | import numpy as np 17 | from ase import constraints 18 | 19 | 20 | __version__ = "0.3.4" 21 | 22 | 23 | speciestuple = namedtuple( 24 | "speciestuple", ["symbol", "mass", "magmom", "U", "J", "U_alpha"] 25 | ) 26 | 27 | 28 | def num2str(x): 29 | """ 30 | Add 'd00' to floating point number to avoid random trailing digits in 31 | Fortran input routines 32 | """ 33 | 34 | if "e" in str(x): 35 | return str(x) 36 | else: 37 | return str(x) + "d00" 38 | 39 | 40 | def bool2str(x): 41 | "Convert python to fortran logical" 42 | 43 | if x: 44 | return ".true." 45 | else: 46 | return ".false." 47 | 48 | 49 | def convert_constraints(atoms): 50 | """ 51 | Convert some of ase's constraints to pw.x constraints for pw.x internal 52 | relaxation returns constraints which are simply expressed as setting 53 | force components as first list and other contraints that are 54 | implemented in espresso as second list 55 | """ 56 | 57 | if atoms.constraints: 58 | n = len(atoms) 59 | if n == 0: 60 | return [], [] 61 | forcefilter = [] 62 | otherconstr = [] 63 | for c in atoms.constraints: 64 | if isinstance(c, constraints.FixAtoms): 65 | if len(forcefilter) == 0: 66 | forcefilter = np.ones((n, 3), np.int) 67 | forcefilter[c.index] = [0, 0, 0] 68 | elif isinstance(c, constraints.FixCartesian): 69 | if len(forcefilter) == 0: 70 | forcefilter = np.ones((n, 3), np.int) 71 | forcefilter[c.a] = c.mask 72 | elif isinstance(c, constraints.FixBondLengths): 73 | for d in c.constraints: 74 | otherconstr.append( 75 | "'distance' %d %d" % (d.indices[0] + 1, d.indices[1] + 1) 76 | ) 77 | elif isinstance(c, constraints.FixBondLength): 78 | otherconstr.append( 79 | "'distance' %d %d" % (c.indices[0] + 1, c.indices[1] + 1) 80 | ) 81 | elif isinstance(c, constraints.FixInternals): 82 | # we ignore the epsilon in FixInternals because there can only be one global 83 | # epsilon be defined in espresso for all constraints 84 | for d in c.constraints: 85 | if isinstance(d, constraints.FixInternals.FixBondLengthAlt): 86 | otherconstr.append( 87 | "'distance' %d %d %s" 88 | % (d.indices[0] + 1, d.indices[1] + 1, num2str(d.bond)) 89 | ) 90 | elif isinstance(d, constraints.FixInternals.FixAngle): 91 | otherconstr.append( 92 | "'planar_angle' %d %d %d %s" 93 | % ( 94 | d.indices[0] + 1, 95 | d.indices[1] + 1, 96 | d.indices[2] + 1, 97 | num2str(np.arccos(d.angle) * 180.0 / np.pi), 98 | ) 99 | ) 100 | elif isinstance(d, constraints.FixInternals.FixDihedral): 101 | otherconstr.append( 102 | "'torsional_angle' %d %d %d %d %s" 103 | % ( 104 | d.indices[0] + 1, 105 | d.indices[1] + 1, 106 | d.indices[2] + 1, 107 | d.indices[3] + 1, 108 | num2str(np.arccos(d.angle) * 180.0 / np.pi), 109 | ) 110 | ) 111 | else: 112 | raise NotImplementedError( 113 | "constraint {} from FixInternals not implemented\n" 114 | "consider ase-based relaxation with this constraint instead".format( 115 | d.__name__ 116 | ) 117 | ) 118 | else: 119 | raise NotImplementedError( 120 | "constraint {} not implemented\n" 121 | "consider ase-based relaxation with this constraint instead".format( 122 | c.__name__ 123 | ) 124 | ) 125 | return forcefilter, otherconstr 126 | else: 127 | return [], [] 128 | -------------------------------------------------------------------------------- /espresso/vibespresso.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Original work Copyright (C) 2013-2015 SUNCAT 5 | # Modified work Copyright 2015-2017 Lukasz Mentel 6 | # 7 | # This file is distributed under the terms of the 8 | # GNU General Public License. See the file 'COPYING' 9 | # in the root directory of the present distribution, 10 | # or http://www.gnu.org/copyleft/gpl.txt . 11 | # **************************************************************************** 12 | 13 | from __future__ import print_function, absolute_import 14 | 15 | from builtins import object 16 | 17 | import numpy as np 18 | 19 | from ase.calculators.calculator import FileIOCalculator 20 | from .espresso import Espresso 21 | 22 | __version__ = "0.3.4" 23 | 24 | 25 | class Vibespresso(FileIOCalculator, object): 26 | """ 27 | Special espresso calculator, which expects the first calculation to 28 | be performed for a structure without displacements. All subsequent 29 | calculations are then initialized with the Kohn-Sham potential of 30 | the first calculation to speed up vibrational calculations. 31 | """ 32 | 33 | def __init__(self, outdirprefix="out", **kwargs): 34 | """ 35 | In addition to the parameters of a standard espresso calculator, 36 | outdirprefix (default: 'out') can be specified, which will be the 37 | prefix of the output of the calculations for different displacements 38 | """ 39 | 40 | self.arg = kwargs.copy() 41 | self.outdirprefix = outdirprefix 42 | self.counter = 0 43 | self.equilibriumdensity = outdirprefix + "_equi.tgz" 44 | self.firststep = True 45 | self.ready = False 46 | 47 | self.atoms = None 48 | 49 | def update(self, atoms): 50 | if self.atoms is not None: 51 | x = atoms.positions - self.atoms.positions 52 | if np.max(x) > 1.0e-13 or np.min(x) < -1.0e-13: 53 | self.ready = False 54 | else: 55 | self.atoms = atoms.copy() 56 | self.runcalc(atoms) 57 | if atoms is not None: 58 | self.atoms = atoms.copy() 59 | 60 | def runcalc(self, atoms): 61 | if not self.ready: 62 | self.arg["outdir"] = self.outdirprefix + "_%04d" % self.counter 63 | self.counter += 1 64 | if self.firststep: 65 | self.esp = Espresso(**self.arg) 66 | self.esp.set_atoms(atoms) 67 | self.esp.get_potential_energy(atoms) 68 | self.esp.save_chg(self.equilibriumdensity) 69 | self.firststep = False 70 | else: 71 | self.arg["startingpot"] = "file" 72 | self.esp = Espresso(**self.arg) 73 | self.esp.set_atoms(atoms) 74 | self.esp.initialize(atoms) 75 | self.esp.load_chg(self.equilibriumdensity) 76 | self.esp.get_potential_energy(atoms) 77 | self.esp.stop() 78 | self.ready = True 79 | 80 | def get_potential_energy(self, atoms, force_consistent=False): 81 | self.update(atoms) 82 | if force_consistent: 83 | return self.esp.energy_free 84 | else: 85 | return self.esp.energy_zero 86 | 87 | def get_forces(self, atoms): 88 | self.update(atoms) 89 | return self.esp.forces 90 | 91 | def get_name(self): 92 | return "VibEspresso" 93 | 94 | def get_version(self): 95 | return __version__ 96 | -------------------------------------------------------------------------------- /espresso/worldstub.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # **************************************************************************** 4 | # Original work Copyright (C) 2013-2015 SUNCAT 5 | # Modified work Copyright 2015-2017 Lukasz Mentel 6 | # 7 | # This file is distributed under the terms of the 8 | # GNU General Public License. See the file 'COPYING' 9 | # in the root directory of the present distribution, 10 | # or http://www.gnu.org/copyleft/gpl.txt . 11 | # **************************************************************************** 12 | 13 | 14 | # mpi stub for object having number of nodes as "size" attribute 15 | class world: 16 | def __init__(self, size): 17 | self.size = size 18 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ase 2 | numpy 3 | pexpect 4 | future 5 | path.py 6 | python-hostlist 7 | -------------------------------------------------------------------------------- /scripts/pwlog2traj: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import argparse 4 | import numpy as np 5 | import os 6 | import sys 7 | 8 | from ase import units 9 | from ase.calculators.singlepoint import SinglePointCalculator 10 | from ase.io.espresso import make_atoms 11 | from ase.io.trajectory import TrajectoryWriter 12 | 13 | def parsepwlog(fileobj): 14 | ''' 15 | Parse Quantum Espresso PWSCF log file into a set of atoms objects 16 | corresponding to single point calculations. 17 | 18 | Args: 19 | fileobj : file or str 20 | Either file object or name of the file as string 21 | 22 | Returns: 23 | images : list of Atoms instances 24 | List of parsed Atoms instances corresponding to single point calculations 25 | ''' 26 | 27 | if isinstance(fileobj, str): 28 | fileobj = open(fileobj, 'rU') 29 | 30 | contents = fileobj.read() 31 | 32 | images = [] 33 | for singlelog in contents.split('Program PWSCF')[1:]: 34 | images.append(read_espresso_out(singlelog)) 35 | 36 | return images 37 | 38 | def read_espresso_out(logstring, index=-1): 39 | ''' 40 | Reads quantum espresso output text files. 41 | 42 | .. note: 43 | This is a modified version of the file form ase/io/espresso.py 44 | 45 | Args: 46 | logstring : str 47 | A string with a the output of a single point Quantum Espresso PWSCF 48 | calculation. 49 | ''' 50 | 51 | lines = logstring.split('\n') 52 | images = [] 53 | 54 | # Get unit cell info. 55 | bl_line = [line for line in lines if 'bravais-lattice index' in line] 56 | if len(bl_line) != 1: 57 | raise NotImplementedError('Unsupported: unit cell changing.') 58 | bl_line = bl_line[0].strip() 59 | brav_latt_index = bl_line.split('=')[1].strip() 60 | if brav_latt_index != '0': 61 | raise NotImplementedError('Supported only for Bravais-lattice ' 62 | 'index of 0 (free).') 63 | lp_line = [line for line in lines if 'lattice parameter (alat)' in 64 | line] 65 | if len(lp_line) != 1: 66 | raise NotImplementedError('Unsupported: unit cell changing.') 67 | lp_line = lp_line[0].strip().split('=')[1].strip().split()[0] 68 | lattice_parameter = float(lp_line) * units.Bohr 69 | ca_line_no = [number for (number, line) in enumerate(lines) if 70 | 'crystal axes: (cart. coord. in units of alat)' in line] 71 | if len(ca_line_no) != 1: 72 | raise NotImplementedError('Unsupported: unit cell changing.') 73 | ca_line_no = int(ca_line_no[0]) 74 | cell = np.zeros((3, 3)) 75 | for number, line in enumerate(lines[ca_line_no + 1: ca_line_no + 4]): 76 | line = line.split('=')[1].strip()[1:-1] 77 | values = [eval(value) for value in line.split()] 78 | cell[number, 0] = values[0] 79 | cell[number, 1] = values[1] 80 | cell[number, 2] = values[2] 81 | cell *= lattice_parameter 82 | 83 | # Find atomic positions and add to images. 84 | for number, line in enumerate(lines): 85 | key = 'Begin final coordinates' # these just reprint last posn. 86 | if key in line: 87 | break 88 | key = 'Cartesian axes' 89 | if key in line: 90 | atoms = make_atoms(number, lines, key, cell) 91 | images.append(atoms) 92 | key = 'ATOMIC_POSITIONS (crystal)' 93 | if key in line: 94 | atoms = make_atoms(number, lines, key, cell) 95 | images.append(atoms) 96 | return images[index] 97 | 98 | if __name__ == "__main__": 99 | 100 | parser = argparse.ArgumentParser() 101 | parser.add_argument('log', help='Quantum Espresso log file') 102 | parser.add_argument('-o', '--output', help='Output trajectory file') 103 | args = parser.parse_args() 104 | 105 | images = parsepwlog(args.log) 106 | 107 | if args.output: 108 | if os.path.splitext(args.output)[1].lower() != '.traj': 109 | trajname = args.output + '.traj' 110 | else: 111 | trajname = args.output 112 | else: 113 | trajname = os.path.splitext(args.log)[0] + '.traj' 114 | 115 | print 'Writing trajectory file to: {}'.format(trajname) 116 | traj = TrajectoryWriter(trajname, mode='a') 117 | for atoms in images: 118 | traj.write(atoms=atoms) 119 | 120 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | Setup file for the ase-espresso package. 6 | """ 7 | 8 | from setuptools import setup 9 | 10 | MAIN_PACKAGE = "aseqe" 11 | DESCRIPTION = "Python API for the Quantum Espresso software" 12 | LICENSE = "GPLv3" 13 | URL = "https://github.com/lmmentel/ase-espresso" 14 | AUTHOR = "Lukasz Mentel" 15 | EMAIL = "lmmentel@gmail.com" 16 | VERSION = '0.3.4' 17 | CLASSIFIERS = ['Development Status :: 3 - Alpha', 18 | 'Environment :: Console', 19 | 'Intended Audience :: Science/Research', 20 | 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 21 | 'Natural Language :: English', 22 | 'Programming Language :: Python', 23 | 'Programming Language :: Python :: 2', 24 | 'Programming Language :: Python :: 3', 25 | 'Topic :: Scientific/Engineering :: Chemistry', 26 | 'Topic :: Scientific/Engineering :: Physics'] 27 | DEPENDENCIES = ['ase', 28 | 'future', 29 | 'numpy', 30 | 'path.py', 31 | 'pexpect', 32 | 'python-hostlist', 33 | 'six'] 34 | KEYWORDS = 'chemistry physics quantum mechanics solid state' 35 | 36 | 37 | def readme(): 38 | 'Return the contents of the README.md file.' 39 | with open('README.rst') as freadme: 40 | return freadme.read() 41 | 42 | 43 | def setup_package(): 44 | 45 | setup(name=MAIN_PACKAGE, 46 | version=VERSION, 47 | url=URL, 48 | description=DESCRIPTION, 49 | author=AUTHOR, 50 | author_email=EMAIL, 51 | license=LICENSE, 52 | keywords=KEYWORDS, 53 | long_description=readme(), 54 | classifiers=CLASSIFIERS, 55 | packages=['espresso'], 56 | install_requires=DEPENDENCIES, 57 | ) 58 | 59 | 60 | if __name__ == "__main__": 61 | setup_package() 62 | -------------------------------------------------------------------------------- /site-files/espsite.py.example.PBSfifompich2: -------------------------------------------------------------------------------- 1 | # cluster-dependent definitions 2 | # espresso.py will make use of all "self" variables in config class 3 | # although not necessary for the installation at the suncat cluster, 4 | # we use a named pipe instead of stdio for sending coordinates back to pw.x 5 | # as an example how to set this up 6 | import os 7 | 8 | class config: 9 | def __init__(self): 10 | self.scratch = '/scratch' 11 | if not os.path.exists(self.scratch): 12 | self.scratch = '/tmp' 13 | self.submitdir = os.getenv('PBS_O_WORKDIR') 14 | self.batch = self.submitdir!=None 15 | #check for batch 16 | if self.batch: 17 | nodefile = os.getenv('PBS_NODEFILE') 18 | f = open(nodefile, 'r') 19 | procs = [x.strip() for x in f.readlines()] 20 | f.close() 21 | self.procs = procs 22 | self.jobid = os.getenv('PBS_JOBID') 23 | 24 | nprocs = len(procs) 25 | self.nprocs = nprocs 26 | 27 | uniqnodefile = self.scratch+'/uniqnodefile' 28 | os.system('uniq $PBS_NODEFILE >'+uniqnodefile) 29 | p = os.popen('wc -l <'+uniqnodefile, 'r') 30 | nnodes = p.readline().strip() 31 | p.close() 32 | 33 | self.perHostMpiExec = 'mpiexec -machinefile '+uniqnodefile+' -np '+nnodes 34 | self.perProcMpiExec = 'mpiexec -machinefile '+nodefile+' -np '+str(nprocs)+' -wdir %s %s' 35 | self.perSpecProcMpiExec = 'mpiexec -machinefile %s -np %d -wdir %s %s' 36 | 37 | #put mpi and pw.x in path if not already there 38 | p = os.environ['PATH'] 39 | os.environ['PATH']='/opt/dft/espresso/bin:/usr/local/mpich2/bin:'+p 40 | #boot mpd if not already done 41 | if not os.environ.has_key('QEASE_MPD_BOOTED'): 42 | os.system('mpdboot -f '+uniqnodefile+' -r ssh -n '+nnodes) 43 | os.system('mpdtrace -l -v') 44 | os.environ['QEASE_MPD_BOOTED'] = 'yes' 45 | 46 | self.mpdshutdown = 'mpdallexit' 47 | 48 | 49 | def do_perProcMpiExec(self, workdir, program): 50 | os.system(self.fifogen%workdir) 51 | o = os.popen(self.perProcMpiExec % (workdir, program), 'r') 52 | return open(workdir+'/ase3inpfifo', 'w+'), o 53 | 54 | def do_perProcMpiExec_outputonly(self, workdir, program): 55 | return os.popen(self.perProcMpiExec % (workdir, program), 'r') 56 | 57 | def runonly_perProcMpiExec(self, workdir, program): 58 | os.system(self.perProcMpiExec % (workdir, program)) 59 | 60 | def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program): 61 | os.system(self.fifogen%workdir) 62 | i,o,e = os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program)) 63 | return open(workdir+'/ase3inpfifo', 'w+'), o, e 64 | -------------------------------------------------------------------------------- /site-files/espsite.py.example.PBSstdinopenmpi: -------------------------------------------------------------------------------- 1 | # cluster-dependent definitions 2 | # espresso.py will make use of all "self" variables in config class 3 | # although not necessary for the installation at the suncat cluster, 4 | # we use a named pipe instead of stdio for sending coordinates back to pw.x 5 | # as an example how to set this up 6 | import os 7 | 8 | class config: 9 | def __init__(self): 10 | self.scratch = '/scratch' 11 | if not os.path.exists(self.scratch): 12 | self.scratch = '/tmp' 13 | self.submitdir = os.getenv('PBS_O_WORKDIR') 14 | self.batch = self.submitdir!=None 15 | #check for batch 16 | if self.batch: 17 | nodefile = os.getenv('PBS_NODEFILE') 18 | f = open(nodefile, 'r') 19 | procs = [x.strip() for x in f.readlines()] 20 | f.close() 21 | self.procs = procs 22 | self.jobid = os.getenv('PBS_JOBID') 23 | 24 | nprocs = len(procs) 25 | self.nprocs = nprocs 26 | 27 | uniqnodefile = self.scratch+'/uniqnodefile' 28 | os.system('uniq $PBS_NODEFILE >'+uniqnodefile) 29 | p = os.popen('wc -l <'+uniqnodefile, 'r') 30 | nnodes = p.readline().strip() 31 | p.close() 32 | 33 | self.perHostMpiExec = 'mpiexec -machinefile '+uniqnodefile+' -np '+nnodes 34 | self.perProcMpiExec = 'mpiexec -machinefile '+nodefile+' -np '+str(nprocs)+' -wdir %s %s' 35 | self.perSpecProcMpiExec = 'mpiexec -machinefile %s -np %d -wdir %s %s' 36 | 37 | 38 | def do_perProcMpiExec(self, workdir, program): 39 | return os.popen2(self.perProcMpiExec % (workdir, program)) 40 | 41 | def do_perProcMpiExec_outputonly(self, workdir, program): 42 | return os.popen(self.perProcMpiExec % (workdir, program), 'r') 43 | 44 | def runonly_perProcMpiExec(self, workdir, program): 45 | os.system(self.perProcMpiExec % (workdir, program)) 46 | 47 | def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program): 48 | return os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program)) 49 | -------------------------------------------------------------------------------- /site-files/espsite.py.example.SLURMsherlock: -------------------------------------------------------------------------------- 1 | # cluster-dependent definitions 2 | # espresso.py will make use of all "self" variables in config class 3 | import os 4 | 5 | class config: 6 | def __init__(self): 7 | self.scratch = '/local-scratch/'+os.getenv('USER') 8 | if not os.path.exists(self.scratch): 9 | self.scratch = '/tmp' 10 | self.submitdir = os.getenv('SLURM_SUBMIT_DIR') 11 | self.batch = self.submitdir!=None 12 | #we typically run batch jobs without openmp threads here 13 | if self.batch: 14 | os.putenv('OMP_NUM_THREADS','1') 15 | #check for batch 16 | if self.batch: 17 | self.jobid = os.getenv('SLURM_JOBID') 18 | nodefile = self.submitdir+'/nodefile.'+self.jobid 19 | uniqnodefile = self.submitdir+'/uniqnodefile.'+self.jobid 20 | os.system('scontrol show hostnames $SLURM_JOB_NODELIST >'+uniqnodefile) 21 | taskspernode = os.getenv('SLURM_TASKS_PER_NODE') 22 | xtaskspernode = taskspernode.find('(') 23 | if xtaskspernode > -1: 24 | taskspernode = taskspernode[:xtaskspernode] 25 | os.system("awk '{for(i=0;i<"+taskspernode+";i++)print}' "+uniqnodefile+" >"+nodefile) 26 | f = open(nodefile, 'r') 27 | procs = [x.strip() for x in f.readlines()] 28 | f.close() 29 | self.procs = procs 30 | 31 | nprocs = len(procs) 32 | self.nprocs = nprocs 33 | 34 | p = os.popen('wc -l <'+uniqnodefile, 'r') 35 | nnodes = p.readline().strip() 36 | p.close() 37 | 38 | self.perHostMpiExec = 'mpiexec -machinefile '+uniqnodefile+' -np '+nnodes 39 | self.perProcMpiExec = 'mpiexec -machinefile '+nodefile+' -np '+str(nprocs)+' -wdir %s %s' 40 | self.perSpecProcMpiExec = 'mpiexec -machinefile %s -np %d -wdir %s %s' 41 | 42 | 43 | def do_perProcMpiExec(self, workdir, program): 44 | return os.popen2(self.perProcMpiExec % (workdir, program)) 45 | 46 | def do_perProcMpiExec_outputonly(self, workdir, program): 47 | return os.popen(self.perProcMpiExec % (workdir, program), 'r') 48 | 49 | def runonly_perProcMpiExec(self, workdir, program): 50 | os.system(self.perProcMpiExec % (workdir, program)) 51 | 52 | def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program): 53 | return os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program)) 54 | -------------------------------------------------------------------------------- /site-files/espsite.py.example.abel: -------------------------------------------------------------------------------- 1 | # cluster-dependent definitions 2 | # espresso.py will make use of all "self" variables in config class 3 | # although not necessary for the installation at the suncat cluster, 4 | # we use a named pipe instead of stdio for sending coordinates back to pw.x 5 | # as an example how to set this up 6 | 7 | import os 8 | import subprocess as sp 9 | 10 | class config: 11 | def __init__(self): 12 | self.scratch = os.getenv('SCRATCH') 13 | #if not os.path.exists(self.scratch): 14 | # self.scratch = '/tmp' 15 | self.submitdir = os.getenv('SUBMITDIR') 16 | self.batch = self.submitdir != None 17 | #check for batch 18 | if self.batch: 19 | nnodes = int(os.getenv('SLURM_JOB_NUM_NODES')) 20 | 21 | self.jobid = os.getenv('SLURM_JOB_ID') 22 | 23 | #NB: line below only gives usable result for jobs with the same number of tasks/node for all nodes 24 | taskspernode = int(os.getenv('SLURM_TASKS_PER_NODE').split('(')[0]) 25 | nodeslist = sp.Popen('scontrol show hostnames $SLURM_JOB_NODELIST', 26 | shell=True, stdout=sp.PIPE).communicate()[0].split('\n')[:-1] 27 | self.procs = [nodeslist[i//taskspernode] for i in range(len(nodeslist)*taskspernode)] 28 | self.nprocs = len(self.procs) 29 | 30 | self.perHostMpiExec = 'mpirun -host '+','.join(nodeslist)+' -np %d' % nnodes 31 | self.perProcMpiExec = 'mpirun -wdir %s %s' #SLURM takes care of CPU allocation 32 | self.perSpecProcMpiExec = 'mpirun -machinefile %s -np %d -wdir %s %s' 33 | 34 | def do_perProcMpiExec(self, workdir, program): 35 | return os.popen2(self.perProcMpiExec % (workdir, program)) 36 | 37 | def do_perProcMpiExec_outputonly(self, workdir, program): 38 | return os.popen(self.perProcMpiExec % (workdir, program), 'r') 39 | 40 | def runonly_perProcMpiExec(self, workdir, program): 41 | os.system(self.perProcMpiExec % (workdir, program)) 42 | 43 | def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program): 44 | return os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program)) 45 | -------------------------------------------------------------------------------- /site-files/espsite.py.example.suncatfifo: -------------------------------------------------------------------------------- 1 | # cluster-dependent definitions 2 | # espresso.py will make use of all "self" variables in config class 3 | # although not necessary for the installation at the suncat cluster, 4 | # we use a named pipe instead of stdio for sending coordinates back to pw.x 5 | # as an example how to set this up 6 | import os 7 | 8 | class config: 9 | def __init__(self): 10 | self.scratch = '/scratch' 11 | if not os.path.exists(self.scratch): 12 | self.scratch = '/tmp' 13 | self.submitdir = os.getenv('LS_SUBCWD') 14 | self.batch = self.submitdir!=None 15 | #check for batch 16 | if self.batch: 17 | procs = os.getenv('LSB_HOSTS').split() 18 | self.procs = procs 19 | self.jobid = os.getenv('LSB_BATCH_JID') 20 | 21 | nprocs = len(procs) 22 | self.nprocs = nprocs 23 | d = {} 24 | for x in procs: 25 | d[x] = 1 26 | nodes = list(d.keys()) 27 | nnodes = len(nodes) 28 | 29 | fin,fout = os.popen4('mpirun --version') 30 | mpiversion=fout.readlines()[0] 31 | mpiversion=mpiversion.split()[3] 32 | rsh_agent='orte_rsh_agent' 33 | if mpiversion[:3]=='1.4': 34 | rsh_agent='plm_rsh_agent' 35 | 36 | self.perHostMpiExec = 'mpiexec --mca '+rsh_agent+' /afs/slac.stanford.edu/package/lsf/bin.slac/gmmpirun_lsgrun.sh -host '+','.join(nodes)+' -np '+str(nnodes) 37 | self.perProcMpiExec = 'pam -g /afs/slac/g/suncat/bin/suncat-tsmpirun -x LD_LIBRARY_PATH -wdir %s %s' 38 | self.perSpecProcMpiExec = 'mpiexec --mca '+rsh_agent+' /afs/slac.stanford.edu/package/lsf/bin.slac/gmmpirun_lsgrun.sh -machinefile %s -np %d -wdir %s %s' 39 | # hack for suncat to make sure RHEL5 nfs disks are automounted 40 | # must be done before changing directories, otherwise mpirun 41 | # appears to do "getpwd" and sends the "/a" form of the name 42 | # to the slave nodes - cpo 43 | siteInit=self.perHostMpiExec + ' ls '+self.submitdir+'>/dev/null' 44 | os.system(siteInit) 45 | 46 | #how to create fifo 47 | self.fifogen = 'cd %s; [ -e ase3inpfifo ] || mkfifo ase3inpfifo' 48 | self.fifo = True 49 | 50 | def do_perProcMpiExec(self, workdir, program): 51 | os.system(self.fifogen%workdir) 52 | o = os.popen(self.perProcMpiExec % (workdir, program), 'r') 53 | return open(workdir+'/ase3inpfifo', 'w+'), o 54 | 55 | def do_perProcMpiExec_outputonly(self, workdir, program): 56 | return os.popen(self.perProcMpiExec % (workdir, program), 'r') 57 | 58 | def runonly_perProcMpiExec(self, workdir, program): 59 | os.system(self.perProcMpiExec % (workdir, program)) 60 | 61 | def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program): 62 | os.system(self.fifogen%workdir) 63 | i,o,e = os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program)) 64 | return open(workdir+'/ase3inpfifo', 'w+'), o, e 65 | -------------------------------------------------------------------------------- /site-files/espsite.py.example.suncatstdin: -------------------------------------------------------------------------------- 1 | # cluster-dependent definitions 2 | # espresso.py will make use of all "self" variables in config class 3 | import os 4 | 5 | class config: 6 | def __init__(self): 7 | self.scratch = '/scratch' 8 | if not os.path.exists(self.scratch): 9 | self.scratch = '/tmp' 10 | self.submitdir = os.getenv('LS_SUBCWD') 11 | self.batch = self.submitdir!=None 12 | #check for batch 13 | if self.batch: 14 | procs = os.getenv('LSB_HOSTS').split() 15 | self.procs = procs 16 | self.jobid = os.getenv('LSB_BATCH_JID') 17 | 18 | nprocs = len(procs) 19 | self.nprocs = nprocs 20 | d = {} 21 | for x in procs: 22 | d[x] = 1 23 | nodes = list(d.keys()) 24 | nnodes = len(nodes) 25 | 26 | fin,fout = os.popen4('mpirun --version') 27 | mpiversion=fout.readlines()[0] 28 | mpiversion=mpiversion.split()[3] 29 | rsh_agent='orte_rsh_agent' 30 | if mpiversion[:3]=='1.4': 31 | rsh_agent='plm_rsh_agent' 32 | 33 | self.perHostMpiExec = 'mpiexec --mca '+rsh_agent+' /afs/slac.stanford.edu/package/lsf/bin.slac/gmmpirun_lsgrun.sh -host '+','.join(nodes)+' -np '+str(nnodes) 34 | self.perProcMpiExec = 'pam -g /afs/slac/g/suncat/bin/suncat-tsmpirun -x LD_LIBRARY_PATH -wdir %s %s' 35 | self.perSpecProcMpiExec = 'mpiexec --mca '+rsh_agent+' /afs/slac.stanford.edu/package/lsf/bin.slac/gmmpirun_lsgrun.sh -machinefile %s -np %d -wdir %s %s' 36 | # hack for suncat to make sure RHEL5 nfs disks are automounted 37 | # must be done before changing directories, otherwise mpirun 38 | # appears to do "getpwd" and sends the "/a" form of the name 39 | # to the slave nodes - cpo 40 | siteInit=self.perHostMpiExec + ' ls '+self.submitdir+'>/dev/null' 41 | os.system(siteInit) 42 | 43 | 44 | def do_perProcMpiExec(self, workdir, program): 45 | return os.popen2(self.perProcMpiExec % (workdir, program)) 46 | 47 | def do_perProcMpiExec_outputonly(self, workdir, program): 48 | return os.popen(self.perProcMpiExec % (workdir, program), 'r') 49 | 50 | def runonly_perProcMpiExec(self, workdir, program): 51 | os.system(self.perProcMpiExec % (workdir, program)) 52 | 53 | def do_perSpecProcMpiExec(self, machinefile, nproc, workdir, program): 54 | return os.popen3(self.perSpecProcMpiExec % (machinefile, nproc, workdir, program)) 55 | -------------------------------------------------------------------------------- /tests/test_nebespresso.py: -------------------------------------------------------------------------------- 1 | 2 | ''' 3 | test adapted from https://wiki.fysik.dtu.dk/ase/tutorials/neb/idpp.html#example-1-ethane 4 | ''' 5 | 6 | from __future__ import print_function 7 | 8 | from espresso import iEspresso, NEBEspresso 9 | from ase.build import molecule 10 | from ase.neb import NEBTools 11 | from ase.optimize.fire import FIRE as QuasiNewton 12 | from asetools import smart_cell 13 | 14 | 15 | def test_ethene_rotation(tmpdir): 16 | 17 | tmpdir.chdir() 18 | 19 | # Optimise molecule 20 | initial = molecule('C2H6') 21 | smart_cell(initial, vac=4.0, h=0.01) 22 | initial.set_calculator(iEspresso(pw=300, dw=4000, kpts='gamma')) 23 | qn = QuasiNewton(initial, 'initial.traj') 24 | qn.run(fmax=0.01) 25 | 26 | # Create final state 27 | final = initial.copy() 28 | final.positions[2:5] = initial.positions[[3, 4, 2]] 29 | final.set_calculator(iEspresso(pw=300, dw=4000, kpts='gamma')) 30 | final.get_potential_energy() 31 | 32 | # Generate blank images 33 | images = [initial] 34 | nimage = 7 35 | 36 | for i in range(nimage): 37 | image = initial.copy() 38 | image.set_calculator(iEspresso(pw=300, dw=4000, kpts='gamma')) 39 | images.append(image) 40 | images.append(final) 41 | 42 | # Run IDPP interpolation 43 | neb = NEBEspresso(images) 44 | neb.interpolate('idpp') 45 | 46 | # Run NEB calculation 47 | qn = QuasiNewton(neb, logfile='ethane_linear.log', trajectory='neb.traj') 48 | qn.run(fmax=0.05) 49 | 50 | nt = NEBTools(neb.images) 51 | print('fmax: ', nt.get_fmax()) 52 | print('Ef, dE: ', nt.get_barrier()) 53 | -------------------------------------------------------------------------------- /tests/test_relaxation.py: -------------------------------------------------------------------------------- 1 | 2 | # test adapted from Quantum Espresso PWSCF v.5.3.0 (svn rev. 11974) 3 | # : PW/examples/example02 4 | 5 | from __future__ import print_function 6 | 7 | import numpy as np 8 | 9 | from ase import Atoms 10 | from ase.units import Rydberg, Bohr 11 | from ase.optimize import BFGS 12 | from espresso import Espresso, iEspresso 13 | 14 | 15 | def test_relax_co_qe_bfgs(tmpdir): 16 | 17 | tmpdir.chdir() 18 | 19 | co = Atoms('CO', [[2.256 * Bohr, 0.0, 0.0], [0.0, 0.0, 0.0]]) 20 | co.set_cell(np.ones(3) * 12.0 * Bohr) 21 | 22 | calc = Espresso(pw=24.0 * Rydberg, 23 | dw=144.0 * Rydberg, 24 | kpts='gamma', 25 | xc='PBE', 26 | calculation='relax', 27 | ion_dynamics='bfgs', 28 | spinpol=False, 29 | outdir='qe_bfgs') 30 | 31 | co.set_calculator(calc) 32 | calc.calculate(co) 33 | 34 | print('qe bfgs:') 35 | print('energy: ', co.get_potential_energy()) 36 | print('positions: ', co.positions) 37 | print('forces: ', co.get_forces()) 38 | 39 | 40 | def test_relax_co_ase_bfgs(tmpdir): 41 | 42 | tmpdir.chdir() 43 | 44 | co = Atoms('CO', [[2.256 * Bohr, 0.0, 0.0], [0.0, 0.0, 0.0]]) 45 | co.set_cell(np.ones(3) * 12.0 * Bohr) 46 | 47 | calc = Espresso(pw=24.0 * Rydberg, 48 | dw=144.0 * Rydberg, 49 | kpts='gamma', 50 | xc='PBE', 51 | calculation='scf', 52 | ion_dynamics=None, 53 | spinpol=False, 54 | outdir='qe_ase_bfgs') 55 | 56 | co.set_calculator(calc) 57 | 58 | minimizer = BFGS(co, logfile='minimizer.log', trajectory='relaxed.traj') 59 | minimizer.run(fmax=0.01) 60 | 61 | print('ase(scf) bfgs:') 62 | print('energy: ', co.get_potential_energy()) 63 | print('positions: ', co.positions) 64 | print('forces: ', co.get_forces()) 65 | 66 | 67 | def test_relax_co_ase_interactive_bfgs(tmpdir): 68 | 69 | tmpdir.chdir() 70 | 71 | co = Atoms('CO', [[2.256 * Bohr, 0.0, 0.0], [0.0, 0.0, 0.0]]) 72 | co.set_cell(np.ones(3) * 12.0 * Bohr) 73 | 74 | calc = iEspresso(pw=24.0 * Rydberg, 75 | dw=144.0 * Rydberg, 76 | kpts='gamma', 77 | xc='PBE', 78 | calculation='relax', 79 | ion_dynamics='ase3', 80 | spinpol=False, 81 | outdir='qe_ase_interactive_bfgs') 82 | 83 | co.set_calculator(calc) 84 | 85 | minimizer = BFGS(co, logfile='minimizer.log', trajectory='relaxed.traj') 86 | minimizer.run(fmax=0.01) 87 | 88 | ref_ene = -616.9017404193379 89 | 90 | ref_pos = np.array([[1.19233393e+00, 0.0e+00, 0.00000000e+00], 91 | [1.48996586e-03, 0.00000000e+00, 0.00000000e+00]]) 92 | 93 | ref_for = np.array([[0.00162288, 0.0, 0.0], 94 | [-0.00162288, 0.0, 0.0]]) 95 | 96 | assert np.allclose(co.get_potential_energy(), ref_ene) 97 | #assert np.allclose(co.positions, ref_pos) 98 | #assert np.allclose(co.get_forces(), ref_for) 99 | 100 | print(co.positions) 101 | print(co.get_forces()) 102 | -------------------------------------------------------------------------------- /tests/test_scf_single_point.py: -------------------------------------------------------------------------------- 1 | 2 | # test adapted from Quantum Espresso PWSCF v.5.3.0 (svn rev. 11974) 3 | # : PW/examples/example01 4 | 5 | from __future__ import print_function 6 | 7 | import numpy as np 8 | 9 | from ase.build import bulk 10 | from ase.units import Rydberg, Bohr 11 | from espresso import Espresso 12 | 13 | 14 | def test_al_scf_david(tmpdir): 15 | 16 | tmpdir.chdir() 17 | 18 | al = bulk('Al', 'fcc', 7.5 * Bohr) 19 | kpts = np.asarray([[0.0625000, 0.0625000, 0.0625000, 1.00], 20 | [0.0625000, 0.0625000, 0.1875000, 3.00], 21 | [0.0625000, 0.0625000, 0.3125000, 3.00], 22 | [0.0625000, 0.0625000, 0.4375000, 3.00], 23 | [0.0625000, 0.0625000, 0.5625000, 3.00], 24 | [0.0625000, 0.0625000, 0.6875000, 3.00], 25 | [0.0625000, 0.0625000, 0.8125000, 3.00], 26 | [0.0625000, 0.0625000, 0.9375000, 3.00], 27 | [0.0625000, 0.1875000, 0.1875000, 3.00], 28 | [0.0625000, 0.1875000, 0.3125000, 6.00], 29 | [0.0625000, 0.1875000, 0.4375000, 6.00], 30 | [0.0625000, 0.1875000, 0.5625000, 6.00], 31 | [0.0625000, 0.1875000, 0.6875000, 6.00], 32 | [0.0625000, 0.1875000, 0.8125000, 6.00], 33 | [0.0625000, 0.1875000, 0.9375000, 6.00], 34 | [0.0625000, 0.3125000, 0.3125000, 3.00], 35 | [0.0625000, 0.3125000, 0.4375000, 6.00], 36 | [0.0625000, 0.3125000, 0.5625000, 6.00], 37 | [0.0625000, 0.3125000, 0.6875000, 6.00], 38 | [0.0625000, 0.3125000, 0.8125000, 6.00], 39 | [0.0625000, 0.3125000, 0.9375000, 6.00], 40 | [0.0625000, 0.4375000, 0.4375000, 3.00], 41 | [0.0625000, 0.4375000, 0.5625000, 6.00], 42 | [0.0625000, 0.4375000, 0.6875000, 6.00], 43 | [0.0625000, 0.4375000, 0.8125000, 6.00], 44 | [0.0625000, 0.4375000, 0.9375000, 6.00], 45 | [0.0625000, 0.5625000, 0.5625000, 3.00], 46 | [0.0625000, 0.5625000, 0.6875000, 6.00], 47 | [0.0625000, 0.5625000, 0.8125000, 6.00], 48 | [0.0625000, 0.6875000, 0.6875000, 3.00], 49 | [0.0625000, 0.6875000, 0.8125000, 6.00], 50 | [0.0625000, 0.8125000, 0.8125000, 3.00], 51 | [0.1875000, 0.1875000, 0.1875000, 1.00], 52 | [0.1875000, 0.1875000, 0.3125000, 3.00], 53 | [0.1875000, 0.1875000, 0.4375000, 3.00], 54 | [0.1875000, 0.1875000, 0.5625000, 3.00], 55 | [0.1875000, 0.1875000, 0.6875000, 3.00], 56 | [0.1875000, 0.1875000, 0.8125000, 3.00], 57 | [0.1875000, 0.3125000, 0.3125000, 3.00], 58 | [0.1875000, 0.3125000, 0.4375000, 6.00], 59 | [0.1875000, 0.3125000, 0.5625000, 6.00], 60 | [0.1875000, 0.3125000, 0.6875000, 6.00], 61 | [0.1875000, 0.3125000, 0.8125000, 6.00], 62 | [0.1875000, 0.4375000, 0.4375000, 3.00], 63 | [0.1875000, 0.4375000, 0.5625000, 6.00], 64 | [0.1875000, 0.4375000, 0.6875000, 6.00], 65 | [0.1875000, 0.4375000, 0.8125000, 6.00], 66 | [0.1875000, 0.5625000, 0.5625000, 3.00], 67 | [0.1875000, 0.5625000, 0.6875000, 6.00], 68 | [0.1875000, 0.6875000, 0.6875000, 3.00], 69 | [0.3125000, 0.3125000, 0.3125000, 1.00], 70 | [0.3125000, 0.3125000, 0.4375000, 3.00], 71 | [0.3125000, 0.3125000, 0.5625000, 3.00], 72 | [0.3125000, 0.3125000, 0.6875000, 3.00], 73 | [0.3125000, 0.4375000, 0.4375000, 3.00], 74 | [0.3125000, 0.4375000, 0.5625000, 6.00], 75 | [0.3125000, 0.4375000, 0.6875000, 6.00], 76 | [0.3125000, 0.5625000, 0.5625000, 3.00], 77 | [0.4375000, 0.4375000, 0.4375000, 1.00], 78 | [0.4375000, 0.4375000, 0.5625000, 3.00]]) 79 | 80 | calc = Espresso(pw=15.0 * Rydberg, calculation='scf', kpts=kpts, 81 | tprnfor=True, tstress=True, occupations='smearing', 82 | smearing='marzari-vanderbilt', degauss=0.05, 83 | outdir='al_scf') 84 | 85 | al.set_calculator(calc) 86 | 87 | calc.calculate(al) 88 | 89 | assert np.allclose(al.get_potential_energy(), -74.44991079398747) 90 | assert np.allclose(al.get_forces(), np.zeros(3)) 91 | assert np.allclose(al.get_stress(), np.array([-0.02784864, -0.02784864, 92 | -0.02784864, -0.0, -0.0, -0.0])) 93 | 94 | 95 | def test_si_scf_cg(tmpdir): 96 | 97 | tmpdir.chdir() 98 | 99 | si = bulk('Si', 'fcc', 10.2 * Bohr) 100 | 101 | kpts = np.asarray([[0.1250000, 0.1250000, 0.1250000, 1.00], 102 | [0.1250000, 0.1250000, 0.3750000, 3.00], 103 | [0.1250000, 0.1250000, 0.6250000, 3.00], 104 | [0.1250000, 0.1250000, 0.8750000, 3.00], 105 | [0.1250000, 0.3750000, 0.3750000, 3.00], 106 | [0.1250000, 0.3750000, 0.6250000, 6.00], 107 | [0.1250000, 0.3750000, 0.8750000, 6.00], 108 | [0.1250000, 0.6250000, 0.6250000, 3.00], 109 | [0.3750000, 0.3750000, 0.3750000, 1.00], 110 | [0.3750000, 0.3750000, 0.6250000, 3.00]]) 111 | 112 | calc = Espresso(pw=18.0 * Rydberg, calculation='scf', kpts=kpts, 113 | tprnfor=True, tstress=True, occupations='smearing', 114 | smearing='marzari-vanderbilt', degauss=0.05, 115 | convergence={'energy': 1e-6, 'mixing': 0.7, 116 | 'maxsteps': 100, 'diag': 'cg'}, 117 | outdir='si_scf') 118 | 119 | si.set_calculator(calc) 120 | 121 | calc.calculate(si) 122 | 123 | assert np.allclose(si.get_potential_energy(), -152.90087195020132) 124 | -------------------------------------------------------------------------------- /tests/test_siteconfig.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | import pytest 4 | 5 | from espresso.siteconfig import SiteConfig 6 | 7 | 8 | def test_pbs_exceptions(tmpdir): 9 | 'check if an exception is raised when `scratchenv` variable is undefined' 10 | 11 | tmpdir.chdir() 12 | pytest.raises(OSError, SiteConfig, 'PBS', scratchenv='MYSCRATCH0000') 13 | 14 | 15 | def test_slurm_exceptions(tmpdir): 16 | 'check if an exception is raised when `scratchenv` variable is undefined' 17 | 18 | tmpdir.chdir() 19 | pytest.raises(OSError, SiteConfig, 'SLURM', scratchenv='MYSCRATCH0000') 20 | 21 | 22 | def test_pbs_variables(tmpdir): 23 | 24 | tmpdir.chdir() 25 | 26 | os.environ['SCRATCH'] = str(tmpdir) 27 | os.environ['PBS_JOBID'] = '12345678' 28 | os.environ['PBS_O_WORKDIR'] = str(tmpdir) 29 | nodefile = tmpdir.join('nodefile') 30 | os.environ['PBS_NODEFILE'] = str(nodefile) 31 | 32 | # create nodefile for 2 nodes with 16 cpu each 33 | nodes = ['node-{0:d}'.format(i) for i in range(2) for _ in range(16)] 34 | with nodefile.open('w') as nf: 35 | for name in nodes: 36 | nf.write(name + '\n') 37 | 38 | site = SiteConfig('PBS') 39 | 40 | assert site.jobid == '12345678' 41 | assert site.submitdir == str(tmpdir) 42 | assert site.nprocs == 32 43 | assert site.hosts == nodes 44 | assert site.global_scratch == str(tmpdir) 45 | 46 | site.__class__._Singleton__erase() 47 | 48 | 49 | def test_slurm_variables(tmpdir): 50 | 51 | tmpdir.chdir() 52 | 53 | os.environ['SCRATCH'] = str(tmpdir) 54 | os.environ['SLURM_JOB_ID'] = '87654321' 55 | os.environ['SUBMITDIR'] = str(tmpdir) 56 | os.environ['SLURM_JOB_NUM_NODES'] = '2' 57 | os.environ['SLURM_TASKS_PER_NODE'] = '12' 58 | os.environ['SLURM_JOB_NODELIST'] = 'node-0,node-1' 59 | 60 | site = SiteConfig('SLURM') 61 | 62 | assert site.jobid == '87654321' 63 | assert site.submitdir == str(tmpdir) 64 | assert site.nprocs == 24 65 | assert site.global_scratch == str(tmpdir) 66 | 67 | site.__class__._Singleton__erase() 68 | -------------------------------------------------------------------------------- /tests/test_vibrations.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | from ase import Atoms 4 | from ase.units import Rydberg, Bohr 5 | from ase.vibrations import Vibrations 6 | from espresso import Espresso, Vibespresso 7 | 8 | 9 | REF_ENE = np.array([0.00000000+0.09469678j, 0.00000000+0.09468807j, 10 | 0.00000000+0.01367736j, 0.05181212+0.j, 11 | 0.05184354+0.j, 0.20154443+0.j]) 12 | 13 | 14 | def test_co_espresso_vibrations(tmpdir): 15 | 16 | tmpdir.chdir() 17 | 18 | co = Atoms('CO', positions=[[1.19382389081, 0.0, 0.0], [0.0, 0.0, 0.0]]) 19 | co.set_cell(np.ones(3) * 12.0 * Bohr) 20 | 21 | calc = Espresso(pw=34.0 * Rydberg, 22 | dw=144.0 * Rydberg, 23 | kpts='gamma', 24 | xc='PBE', 25 | calculation='scf', 26 | ion_dynamics='None', 27 | spinpol=False, 28 | outdir='vibs') 29 | 30 | co.set_calculator(calc) 31 | 32 | # calculate the vibrations 33 | vib = Vibrations(co, indices=range(len(co)), delta=0.01, nfree=2) 34 | vib.run() 35 | 36 | assert np.allclose(vib.get_energies(), REF_ENE) 37 | 38 | 39 | def test_co_vibespresso_vibrations(tmpdir): 40 | 41 | tmpdir.chdir() 42 | 43 | co = Atoms('CO', positions=[[1.19382389081, 0.0, 0.0], [0.0, 0.0, 0.0]]) 44 | co.set_cell(np.ones(3) * 12.0 * Bohr) 45 | 46 | calc = Vibespresso(pw=34.0 * Rydberg, 47 | dw=144.0 * Rydberg, 48 | kpts='gamma', 49 | xc='PBE', 50 | calculation='scf', 51 | ion_dynamics='None', 52 | spinpol=False, 53 | outdir='vibs') 54 | 55 | co.set_calculator(calc) 56 | 57 | # calculate the vibrations 58 | vib = Vibrations(co, indices=range(len(co)), delta=0.01, nfree=2) 59 | vib.run() 60 | 61 | assert np.allclose(vib.get_energies(), REF_ENE) 62 | --------------------------------------------------------------------------------