pax_global_header00006660000000000000000000000064131644137220014515gustar00rootroot0000000000000052 comment=82cebebc037510d876f90d9f8d533fd021f751f5 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/000077500000000000000000000000001316441372200201245ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/.flake8000066400000000000000000000000411316441372200212720ustar00rootroot00000000000000[flake8] ignore = E129,W293,W503 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/.gitignore000066400000000000000000000011151316441372200221120ustar00rootroot00000000000000*.pyc build/ /dist MANIFEST .DS_Store */.DS_Store # If you build the documentation in the source tree, you will create a # lot of files that we don't want to see with "git status": *.png *.gif *.pov *.jpg *.odg *.dat *.ini *.traj *.pdf *.csv *.txt *.log *.xyz *.db *.pckl *.gz N.LDA *.gpw *.npy theme.css *.svg *.json doc/setups/[A-Z]*.rst !doc/devel/gpaw-logo.svg # If you run the tests, these may write out files *.gpw # Stuff from LaTeX: *.aux *.bbl *.blg *.toc # Editor backup files: *~ \#* # Vim swap files: .*.sw? # Emacs lock files: .\#* # This one is OK: !requirements.txt gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/.gitlab-ci.yml000066400000000000000000000010171316441372200225570ustar00rootroot00000000000000master: script: - apt-get update -qy - apt-get install -qy python-dev python-numpy python-scipy libopenblas-dev liblapack-dev libxc-dev python-pip > apt-get.output - pip install flake8 - pip install git+https://gitlab.com/ase/ase.git@master > ase-install.output - python setup.py install --user > gpaw-install.output - export PATH=~/.local/bin:$PATH - gpaw install-data --register gpaw-datasets - gpaw info - ase build H2 -V1 | gpaw run -p mode=pw - python -m gpaw.test.pyflakes_check gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/CHANGELOG.rst000066400000000000000000000001541316441372200221450ustar00rootroot00000000000000Changelog ========= See what's new in GPAW here: https://wiki.fysik.dtu.dk/gpaw/releasenotes.html gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/CONTRIBUTING.rst000066400000000000000000000003341316441372200225650ustar00rootroot00000000000000Contributing ============ The source code for GPAW is handled the same way as the source code for the ASE project. Read here about how to get started: https://wiki.fysik.dtu.dk/ase/development/contribute.html gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/COPYING000066400000000000000000001045131316441372200211630ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/LICENSE000066400000000000000000000011141316441372200211260ustar00rootroot00000000000000GPAW is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GPAW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GPAW. If not, see . gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/MANIFEST.in000066400000000000000000000003061316441372200216610ustar00rootroot00000000000000include MANIFEST.in include COPYING LICENSE CONTRIBUTING.rst CHANGELOG.rst config.py customize.py include c/*.c include c/*.h include c/xc/*.h include c/xc/*.c include c/bmgs/*.h include c/bmgs/*.c gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/README.rst000066400000000000000000000051261316441372200216170ustar00rootroot00000000000000GPAW ==== GPAW is a density-functional theory (DFT) Python_ code based on the projector-augmented wave (PAW) method and the atomic simulation environment (ASE_). It uses plane-waves, atom-centered basis-functions or real-space uniform grids combined with multigrid methods. Webpage: http://wiki.fysik.dtu.dk/gpaw Requirements ------------ * Python_ 2.6-3.5 * ASE_ (atomic simulation environment) * NumPy_ (base N-dimensional array package) * LibXC * BLAS * LAPACK Optional: * MPI * ScaLAPACK * SciPy_ (library for scientific computing) Installation ------------ Do this:: $ python setup.py install --user and make sure you have ``~/.local/bin`` in your $PATH. For more details, please see: https://wiki.fysik.dtu.dk/gpaw/install.html Testing ------- Please run the tests:: $ gpaw test -j 4 # takes 1 hour! and send us the output if there are failing tests. Contact ------- * Mailing lists: gpaw-users_ and gpaw-developers_ * IRC_: #gpaw on freenode.net Please send us bug-reports, patches, code, ideas and questions. Example ------- Geometry optimization of hydrogen molecule: >>> from ase import Atoms >>> from ase.optimize import BFGS >>> from ase.io import write >>> from gpaw import GPAW, PW >>> h2 = Atoms('H2', positions=[[0, 0, 0], [0, 0, 0.7]]) >>> h2.center(vacuum=2.5) >>> h2.set_calculator(GPAW(xc='PBE', mode=PW(300), txt='h2.txt')) >>> opt = BFGS(h2, trajectory='h2.traj') >>> opt.run(fmax=0.02) BFGS: 0 09:08:09 -6.566505 2.2970 BFGS: 1 09:08:11 -6.629859 0.1871 BFGS: 2 09:08:12 -6.630410 0.0350 BFGS: 3 09:08:13 -6.630429 0.0003 >>> write('H2.xyz', h2) >>> h2.get_potential_energy() # ASE's units are eV and Å -6.6304292169392784 Getting started --------------- Once you have familiarized yourself with ASE_ and NumPy_, you should take a look at the GPAW exercises_ and tutorials_. .. _Python: http://www.python.org/ .. _ASE: http://wiki.fysik.dtu.dk/ase .. _NumPy: http://docs.scipy.org/doc/numpy/reference/ .. _SciPy: http://docs.scipy.org/doc/scipy/reference/ .. _Matplotlib: http://matplotlib.org/ .. _pygtk: http://www.pygtk.org/ .. _gpaw-users: https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users .. _gpaw-developers: https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-developers .. _IRC: http://webchat.freenode.net/?randomnick=0&channels=gpaw .. _exercises: https://wiki.fysik.dtu.dk/gpaw/exercises/exercises.html .. _tutorials: https://wiki.fysik.dtu.dk/gpaw/tutorials/tutorials.html gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/000077500000000000000000000000001316441372200203465ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/_gpaw.c000066400000000000000000000354101316441372200216120ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2007-2010 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #include #ifdef GPAW_HPM PyObject* ibm_hpm_start(PyObject *self, PyObject *args); PyObject* ibm_hpm_stop(PyObject *self, PyObject *args); PyObject* ibm_mpi_start(PyObject *self); PyObject* ibm_mpi_stop(PyObject *self); #endif #ifdef CRAYPAT #include PyObject* craypat_region_begin(PyObject *self, PyObject *args); PyObject* craypat_region_end(PyObject *self, PyObject *args); #endif PyObject* symmetrize(PyObject *self, PyObject *args); PyObject* symmetrize_ft(PyObject *self, PyObject *args); PyObject* symmetrize_wavefunction(PyObject *self, PyObject *args); PyObject* symmetrize_return_index(PyObject *self, PyObject *args); PyObject* symmetrize_with_index(PyObject *self, PyObject *args); PyObject* map_k_points(PyObject *self, PyObject *args); PyObject* scal(PyObject *self, PyObject *args); PyObject* mmm(PyObject *self, PyObject *args); PyObject* tetrahedron_weight(PyObject *self, PyObject *args); PyObject* gemm(PyObject *self, PyObject *args); PyObject* gemv(PyObject *self, PyObject *args); PyObject* axpy(PyObject *self, PyObject *args); PyObject* czher(PyObject *self, PyObject *args); PyObject* rk(PyObject *self, PyObject *args); PyObject* r2k(PyObject *self, PyObject *args); PyObject* dotc(PyObject *self, PyObject *args); PyObject* dotu(PyObject *self, PyObject *args); PyObject* multi_dotu(PyObject *self, PyObject *args); PyObject* multi_axpy(PyObject *self, PyObject *args); PyObject* diagonalize(PyObject *self, PyObject *args); PyObject* diagonalize_mr3(PyObject *self, PyObject *args); PyObject* general_diagonalize(PyObject *self, PyObject *args); PyObject* inverse_cholesky(PyObject *self, PyObject *args); PyObject* inverse_symmetric(PyObject *self, PyObject *args); PyObject* inverse_general(PyObject *self, PyObject *args); PyObject* linear_solve_band(PyObject *self, PyObject *args); PyObject* linear_solve_tridiag(PyObject *self, PyObject *args); PyObject* right_eigenvectors(PyObject *self, PyObject *args); PyObject* NewLocalizedFunctionsObject(PyObject *self, PyObject *args); PyObject* NewOperatorObject(PyObject *self, PyObject *args); PyObject* NewWOperatorObject(PyObject *self, PyObject *args); PyObject* NewSplineObject(PyObject *self, PyObject *args); PyObject* NewTransformerObject(PyObject *self, PyObject *args); PyObject* pc_potential(PyObject *self, PyObject *args); PyObject* heap_mallinfo(PyObject *self); PyObject* elementwise_multiply_add(PyObject *self, PyObject *args); PyObject* utilities_gaussian_wave(PyObject *self, PyObject *args); PyObject* utilities_vdot(PyObject *self, PyObject *args); PyObject* utilities_vdot_self(PyObject *self, PyObject *args); PyObject* errorfunction(PyObject *self, PyObject *args); PyObject* cerf(PyObject *self, PyObject *args); PyObject* pack(PyObject *self, PyObject *args); PyObject* unpack(PyObject *self, PyObject *args); PyObject* unpack_complex(PyObject *self, PyObject *args); PyObject* hartree(PyObject *self, PyObject *args); PyObject* localize(PyObject *self, PyObject *args); PyObject* NewXCFunctionalObject(PyObject *self, PyObject *args); PyObject* NewlxcXCFunctionalObject(PyObject *self, PyObject *args); PyObject* lxcXCFuncNum(PyObject *self, PyObject *args); PyObject* exterior_electron_density_region(PyObject *self, PyObject *args); PyObject* plane_wave_grid(PyObject *self, PyObject *args); PyObject* overlap(PyObject *self, PyObject *args); PyObject* vdw(PyObject *self, PyObject *args); PyObject* vdw2(PyObject *self, PyObject *args); PyObject* spherical_harmonics(PyObject *self, PyObject *args); PyObject* spline_to_grid(PyObject *self, PyObject *args); PyObject* NewLFCObject(PyObject *self, PyObject *args); #if defined(GPAW_WITH_SL) && defined(PARALLEL) PyObject* new_blacs_context(PyObject *self, PyObject *args); PyObject* get_blacs_gridinfo(PyObject* self, PyObject *args); PyObject* get_blacs_local_shape(PyObject* self, PyObject *args); PyObject* blacs_destroy(PyObject *self, PyObject *args); PyObject* scalapack_set(PyObject *self, PyObject *args); PyObject* scalapack_redist(PyObject *self, PyObject *args); PyObject* scalapack_diagonalize_dc(PyObject *self, PyObject *args); PyObject* scalapack_diagonalize_ex(PyObject *self, PyObject *args); #ifdef GPAW_MR3 PyObject* scalapack_diagonalize_mr3(PyObject *self, PyObject *args); #endif PyObject* scalapack_general_diagonalize_dc(PyObject *self, PyObject *args); PyObject* scalapack_general_diagonalize_ex(PyObject *self, PyObject *args); #ifdef GPAW_MR3 PyObject* scalapack_general_diagonalize_mr3(PyObject *self, PyObject *args); #endif PyObject* scalapack_inverse_cholesky(PyObject *self, PyObject *args); PyObject* scalapack_inverse(PyObject *self, PyObject *args); PyObject* scalapack_solve(PyObject *self, PyObject *args); PyObject* pblas_tran(PyObject *self, PyObject *args); PyObject* pblas_gemm(PyObject *self, PyObject *args); PyObject* pblas_hemm(PyObject *self, PyObject *args); PyObject* pblas_gemv(PyObject *self, PyObject *args); PyObject* pblas_r2k(PyObject *self, PyObject *args); PyObject* pblas_rk(PyObject *self, PyObject *args); #endif // GPAW_WITH_SL and PARALLEL #ifdef GPAW_PAPI PyObject* papi_mem_info(PyObject *self, PyObject *args); #endif #ifdef GPAW_WITH_LIBVDWXC PyObject* libvdwxc_create(PyObject *self, PyObject *args); PyObject* libvdwxc_has(PyObject* self, PyObject *args); PyObject* libvdwxc_init_serial(PyObject *self, PyObject *args); PyObject* libvdwxc_calculate(PyObject *self, PyObject *args); PyObject* libvdwxc_tostring(PyObject *self, PyObject *args); PyObject* libvdwxc_free(PyObject* self, PyObject* args); PyObject* libvdwxc_init_mpi(PyObject* self, PyObject* args); PyObject* libvdwxc_init_pfft(PyObject* self, PyObject* args); #endif // GPAW_WITH_LIBVDWXC // Moving least squares interpolation PyObject* mlsqr(PyObject *self, PyObject *args); static PyMethodDef functions[] = { {"symmetrize", symmetrize, METH_VARARGS, 0}, {"symmetrize_ft", symmetrize_ft, METH_VARARGS, 0}, {"symmetrize_wavefunction", symmetrize_wavefunction, METH_VARARGS, 0}, {"symmetrize_return_index", symmetrize_return_index, METH_VARARGS, 0}, {"symmetrize_with_index", symmetrize_with_index, METH_VARARGS, 0}, {"map_k_points", map_k_points, METH_VARARGS, 0}, {"scal", scal, METH_VARARGS, 0}, {"mmm", mmm, METH_VARARGS, 0}, {"tetrahedron_weight", tetrahedron_weight, METH_VARARGS, 0}, {"gemm", gemm, METH_VARARGS, 0}, {"gemv", gemv, METH_VARARGS, 0}, {"axpy", axpy, METH_VARARGS, 0}, {"czher", czher, METH_VARARGS, 0}, {"rk", rk, METH_VARARGS, 0}, {"r2k", r2k, METH_VARARGS, 0}, {"dotc", dotc, METH_VARARGS, 0}, {"dotu", dotu, METH_VARARGS, 0}, {"multi_dotu", multi_dotu, METH_VARARGS, 0}, {"multi_axpy", multi_axpy, METH_VARARGS, 0}, {"diagonalize", diagonalize, METH_VARARGS, 0}, {"diagonalize_mr3", diagonalize_mr3, METH_VARARGS, 0}, {"general_diagonalize", general_diagonalize, METH_VARARGS, 0}, {"inverse_cholesky", inverse_cholesky, METH_VARARGS, 0}, {"inverse_symmetric", inverse_symmetric, METH_VARARGS, 0}, {"inverse_general", inverse_general, METH_VARARGS, 0}, {"linear_solve_band", linear_solve_band, METH_VARARGS, 0}, {"linear_solve_tridiag", linear_solve_tridiag, METH_VARARGS, 0}, {"right_eigenvectors", right_eigenvectors, METH_VARARGS, 0}, {"LocalizedFunctions", NewLocalizedFunctionsObject, METH_VARARGS, 0}, {"Operator", NewOperatorObject, METH_VARARGS, 0}, {"WOperator", NewWOperatorObject, METH_VARARGS, 0}, {"Spline", NewSplineObject, METH_VARARGS, 0}, {"Transformer", NewTransformerObject, METH_VARARGS, 0}, {"heap_mallinfo", (PyCFunction) heap_mallinfo, METH_NOARGS, 0}, {"elementwise_multiply_add", elementwise_multiply_add, METH_VARARGS, 0}, {"utilities_gaussian_wave", utilities_gaussian_wave, METH_VARARGS, 0}, {"utilities_vdot", utilities_vdot, METH_VARARGS, 0}, {"utilities_vdot_self", utilities_vdot_self, METH_VARARGS, 0}, {"eed_region", exterior_electron_density_region, METH_VARARGS, 0}, {"plane_wave_grid", plane_wave_grid, METH_VARARGS, 0}, {"erf", errorfunction, METH_VARARGS, 0}, {"cerf", cerf, METH_VARARGS, 0}, {"pack", pack, METH_VARARGS, 0}, {"unpack", unpack, METH_VARARGS, 0}, {"unpack_complex", unpack_complex, METH_VARARGS, 0}, {"hartree", hartree, METH_VARARGS, 0}, {"localize", localize, METH_VARARGS, 0}, {"XCFunctional", NewXCFunctionalObject, METH_VARARGS, 0}, {"lxcXCFunctional", NewlxcXCFunctionalObject, METH_VARARGS, 0}, {"lxcXCFuncNum", lxcXCFuncNum, METH_VARARGS, 0}, {"overlap", overlap, METH_VARARGS, 0}, {"vdw", vdw, METH_VARARGS, 0}, {"vdw2", vdw2, METH_VARARGS, 0}, {"spherical_harmonics", spherical_harmonics, METH_VARARGS, 0}, {"pc_potential", pc_potential, METH_VARARGS, 0}, {"spline_to_grid", spline_to_grid, METH_VARARGS, 0}, {"LFC", NewLFCObject, METH_VARARGS, 0}, #if defined(GPAW_WITH_SL) && defined(PARALLEL) {"new_blacs_context", new_blacs_context, METH_VARARGS, NULL}, {"get_blacs_gridinfo", get_blacs_gridinfo, METH_VARARGS, NULL}, {"get_blacs_local_shape", get_blacs_local_shape, METH_VARARGS, NULL}, {"blacs_destroy", blacs_destroy, METH_VARARGS, 0}, {"scalapack_set", scalapack_set, METH_VARARGS, 0}, {"scalapack_redist", scalapack_redist, METH_VARARGS, 0}, {"scalapack_diagonalize_dc", scalapack_diagonalize_dc, METH_VARARGS, 0}, {"scalapack_diagonalize_ex", scalapack_diagonalize_ex, METH_VARARGS, 0}, #ifdef GPAW_MR3 {"scalapack_diagonalize_mr3", scalapack_diagonalize_mr3, METH_VARARGS, 0}, #endif // GPAW_MR3 {"scalapack_general_diagonalize_dc", scalapack_general_diagonalize_dc, METH_VARARGS, 0}, {"scalapack_general_diagonalize_ex", scalapack_general_diagonalize_ex, METH_VARARGS, 0}, #ifdef GPAW_MR3 {"scalapack_general_diagonalize_mr3", scalapack_general_diagonalize_mr3, METH_VARARGS, 0}, #endif // GPAW_MR3 {"scalapack_inverse_cholesky", scalapack_inverse_cholesky, METH_VARARGS, 0}, {"scalapack_inverse", scalapack_inverse, METH_VARARGS, 0}, {"scalapack_solve", scalapack_solve, METH_VARARGS, 0}, {"pblas_tran", pblas_tran, METH_VARARGS, 0}, {"pblas_gemm", pblas_gemm, METH_VARARGS, 0}, {"pblas_hemm", pblas_hemm, METH_VARARGS, 0}, {"pblas_gemv", pblas_gemv, METH_VARARGS, 0}, {"pblas_r2k", pblas_r2k, METH_VARARGS, 0}, {"pblas_rk", pblas_rk, METH_VARARGS, 0}, #endif // GPAW_WITH_SL && PARALLEL #ifdef GPAW_HPM {"hpm_start", ibm_hpm_start, METH_VARARGS, 0}, {"hpm_stop", ibm_hpm_stop, METH_VARARGS, 0}, {"mpi_start", (PyCFunction) ibm_mpi_start, METH_NOARGS, 0}, {"mpi_stop", (PyCFunction) ibm_mpi_stop, METH_NOARGS, 0}, #endif // GPAW_HPM #ifdef CRAYPAT {"craypat_region_begin", craypat_region_begin, METH_VARARGS, 0}, {"craypat_region_end", craypat_region_end, METH_VARARGS, 0}, #endif // CRAYPAT #ifdef GPAW_PAPI {"papi_mem_info", papi_mem_info, METH_VARARGS, 0}, #endif // GPAW_PAPI #ifdef GPAW_WITH_LIBVDWXC {"libvdwxc_create", libvdwxc_create, METH_VARARGS, 0}, {"libvdwxc_has", libvdwxc_has, METH_VARARGS, 0}, {"libvdwxc_init_serial", libvdwxc_init_serial, METH_VARARGS, 0}, {"libvdwxc_calculate", libvdwxc_calculate, METH_VARARGS, 0}, {"libvdwxc_tostring", libvdwxc_tostring, METH_VARARGS, 0}, {"libvdwxc_free", libvdwxc_free, METH_VARARGS, 0}, {"libvdwxc_init_mpi", libvdwxc_init_mpi, METH_VARARGS, 0}, {"libvdwxc_init_pfft", libvdwxc_init_pfft, METH_VARARGS, 0}, #endif // GPAW_WITH_LIBVDWXC {"mlsqr", mlsqr, METH_VARARGS, 0}, {0, 0, 0, 0} }; #ifdef PARALLEL extern PyTypeObject MPIType; extern PyTypeObject GPAW_MPI_Request_type; #endif extern PyTypeObject LFCType; extern PyTypeObject LocalizedFunctionsType; extern PyTypeObject OperatorType; extern PyTypeObject WOperatorType; extern PyTypeObject SplineType; extern PyTypeObject TransformerType; extern PyTypeObject XCFunctionalType; extern PyTypeObject lxcXCFunctionalType; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_gpaw", "C-extension for GPAW", -1, functions, NULL, NULL, NULL, NULL }; #endif static PyObject* moduleinit(void) { #ifdef PARALLEL if (PyType_Ready(&MPIType) < 0) return NULL; if (PyType_Ready(&GPAW_MPI_Request_type) < 0) return NULL; #endif if (PyType_Ready(&LFCType) < 0) return NULL; if (PyType_Ready(&LocalizedFunctionsType) < 0) return NULL; if (PyType_Ready(&OperatorType) < 0) return NULL; if (PyType_Ready(&WOperatorType) < 0) return NULL; if (PyType_Ready(&SplineType) < 0) return NULL; if (PyType_Ready(&TransformerType) < 0) return NULL; if (PyType_Ready(&XCFunctionalType) < 0) return NULL; if (PyType_Ready(&lxcXCFunctionalType) < 0) return NULL; #if PY_MAJOR_VERSION >= 3 PyObject* m = PyModule_Create(&moduledef); #else PyObject* m = Py_InitModule3("_gpaw", functions, "C-extension for GPAW\n\n...\n"); #endif if (m == NULL) return NULL; #ifdef PARALLEL Py_INCREF(&MPIType); Py_INCREF(&GPAW_MPI_Request_type); PyModule_AddObject(m, "Communicator", (PyObject *)&MPIType); #endif Py_INCREF(&LFCType); Py_INCREF(&LocalizedFunctionsType); Py_INCREF(&OperatorType); Py_INCREF(&WOperatorType); Py_INCREF(&SplineType); Py_INCREF(&TransformerType); Py_INCREF(&XCFunctionalType); Py_INCREF(&lxcXCFunctionalType); import_array1(NULL); return m; } #ifndef GPAW_INTERPRETER #if PY_MAJOR_VERSION >= 3 PyMODINIT_FUNC PyInit__gpaw(void) { return moduleinit(); } #else PyMODINIT_FUNC init_gpaw(void) { moduleinit(); } #endif #else // ifndef GPAW_INTERPRETER #if PY_MAJOR_VERSION >= 3 #define moduleinit0 moduleinit #else void moduleinit0(void) { moduleinit(); } #endif #include int main(int argc, char **argv) { #ifndef GPAW_OMP MPI_Init(&argc, &argv); #else int granted; MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &granted); if (granted != MPI_THREAD_MULTIPLE) exit(1); #endif // GPAW_OMP #if PY_MAJOR_VERSION >= 3 wchar_t* wargv[argc]; wchar_t* wargv2[argc]; for (int i = 0; i < argc; i++) { int n = 1 + mbstowcs(NULL, argv[i], 0); wargv[i] = (wchar_t*)malloc(n * sizeof(wchar_t)); wargv2[i] = wargv[i]; mbstowcs(wargv[i], argv[i], n); } #else char** wargv = argv; #endif Py_SetProgramName(wargv[0]); PyImport_AppendInittab("_gpaw", &moduleinit0); Py_Initialize(); int status = Py_Main(argc, wargv); Py_Finalize(); MPI_Finalize(); #if PY_MAJOR_VERSION >= 3 for (int i = 0; i < argc; i++) free(wargv2[i]); #endif return status; } #endif // GPAW_INTERPRETER gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bc.c000066400000000000000000000204321316441372200210770ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ // Copyright (C) 2003 CAMP // Please see the accompanying LICENSE file for further information. #include "extensions.h" #include "bc.h" #include #include #include #include boundary_conditions* bc_init(const long size1[3], const long padding[3][2], const long npadding[3][2], const long neighbors[3][2], MPI_Comm comm, bool real, bool cfd) { boundary_conditions* bc = GPAW_MALLOC(boundary_conditions, 1); for (int i = 0; i < 3; i++) { bc->size1[i] = size1[i]; bc->size2[i] = size1[i] + padding[i][0] + padding[i][1]; bc->padding[i] = padding[i][0]; } bc->comm = comm; bc->ndouble = (real ? 1 : 2); bc->cfd = cfd; int rank = 0; if (comm != MPI_COMM_NULL) MPI_Comm_rank(comm, &rank); int start[3]; int size[3]; for (int i = 0; i < 3; i++) { start[i] = padding[i][0]; size[i] = size1[i]; } for (int i = 0; i < 3; i++) { int n = bc->ndouble; for (int j = 0; j < 3; j++) if (j != i) n *= size[j]; for (int d = 0; d < 2; d++) { int ds = npadding[i][d]; int dr = padding[i][d]; for (int j = 0; j < 3; j++) { bc->sendstart[i][d][j] = start[j]; bc->sendsize[i][d][j] = size[j]; bc->recvstart[i][d][j] = start[j]; bc->recvsize[i][d][j] = size[j]; } if (d == 0) { bc->sendstart[i][d][i] = dr; bc->recvstart[i][d][i] = 0; } else { bc->sendstart[i][d][i] = padding[i][0] + size1[i] - ds; bc->recvstart[i][d][i] = padding[i][0] + size1[i]; } bc->sendsize[i][d][i] = ds; bc->recvsize[i][d][i] = dr; bc->sendproc[i][d] = DO_NOTHING; bc->recvproc[i][d] = DO_NOTHING; bc->nsend[i][d] = 0; bc->nrecv[i][d] = 0; int p = neighbors[i][d]; if (p == rank) { if (ds > 0) bc->sendproc[i][d] = COPY_DATA; if (dr > 0) bc->recvproc[i][d] = COPY_DATA; } else if (p >= 0) { // Communication required: if (ds > 0) { bc->sendproc[i][d] = p; bc->nsend[i][d] = n * ds; } if (dr > 0) { bc->recvproc[i][d] = p; bc->nrecv[i][d] = n * dr; } } } if (cfd == 0) { start[i] = 0; size[i] = bc->size2[i]; } // If the two neighboring processors along the // i'th axis are the same, then we join the two communications // into one: bc->rjoin[i] = ((bc->recvproc[i][0] == bc->recvproc[i][1]) && bc->recvproc[i][0] >= 0); bc->sjoin[i] = ((bc->sendproc[i][0] == bc->sendproc[i][1]) && bc->sendproc[i][0] >= 0); } bc->maxsend = 0; bc->maxrecv = 0; for (int i = 0; i < 3; i++) { int n = bc->nsend[i][0] + bc->nsend[i][1]; if (n > bc->maxsend) bc->maxsend = n; n = bc->nrecv[i][0] + bc->nrecv[i][1]; if (n > bc->maxrecv) bc->maxrecv = n; } return bc; } void bc_unpack1(const boundary_conditions* bc, const double* aa1, double* aa2, int i, MPI_Request recvreq[2], MPI_Request sendreq[2], double* rbuff, double* sbuff, const double_complex phases[2], int thd, int nin) { int ng = bc->ndouble * bc->size1[0] * bc->size1[1] * bc->size1[2]; int ng2 = bc->ndouble * bc->size2[0] * bc->size2[1] * bc->size2[2]; bool real = (bc->ndouble == 1); for (int m = 0; m < nin; m++) // Copy data: if (i == 0) { // Zero all of a2 array. We should only zero the bounaries // that are not periodic, but it's simpler to zero everything! // XXX memset(aa2 + m * ng2, 0, ng2 * sizeof(double)); // Copy data from a1 to central part of a2: if (real) bmgs_paste(aa1 + m * ng, bc->size1, aa2 + m * ng2, bc->size2, bc->sendstart[0][0]); else bmgs_pastez((const double_complex*)(aa1 + m * ng), bc->size1, (double_complex*)(aa2 + m * ng2), bc->size2, bc->sendstart[0][0]); } #ifdef PARALLEL // Start receiving. for (int d = 0; d < 2; d++) { int p = bc->recvproc[i][d]; if (p >= 0) { if (bc->rjoin[i]) { if (d == 0) MPI_Irecv(rbuff, (bc->nrecv[i][0] + bc->nrecv[i][1]) * nin, MPI_DOUBLE, p, 10 * thd + 1000 * i + 100000, bc->comm, &recvreq[0]); } else { MPI_Irecv(rbuff, bc->nrecv[i][d] * nin, MPI_DOUBLE, p, d + 10 * thd + 1000 * i, bc->comm, &recvreq[d]); rbuff += bc->nrecv[i][d] * nin; } } } // Prepare send-buffers and start sending: double* sbuf = sbuff; double* sbuf0 = sbuff; for (int d = 0; d < 2; d++) { sendreq[d] = 0; int p = bc->sendproc[i][d]; if (p >= 0) { const int* start = bc->sendstart[i][d]; const int* size = bc->sendsize[i][d]; for (int m = 0; m < nin; m++) if (real) bmgs_cut(aa2 + m * ng2, bc->size2, start, sbuf + m * bc->nsend[i][d], size); else bmgs_cutmz((const double_complex*)(aa2 + m * ng2), bc->size2, start, (double_complex*)(sbuf + m * bc->nsend[i][d]), size, phases[d]); if (bc->sjoin[i]) { if (d == 1) { MPI_Isend(sbuf0, (bc->nsend[i][0] + bc->nsend[i][1]) * nin, MPI_DOUBLE, p, 10 * thd + 1000 * i + 100000, bc->comm, &sendreq[0]); } } else { MPI_Isend(sbuf, bc->nsend[i][d] * nin, MPI_DOUBLE, p, 1 - d + 10 * thd + 1000 * i, bc->comm, &sendreq[d]); } sbuf += bc->nsend[i][d] * nin; } } #endif // Parallel for (int m = 0; m < nin; m++) { // Copy data for periodic boundary conditions: for (int d = 0; d < 2; d++) if (bc->sendproc[i][d] == COPY_DATA) { if (real) bmgs_translate(aa2 + m * ng2, bc->size2, bc->sendsize[i][d], bc->sendstart[i][d], bc->recvstart[i][1 - d]); else bmgs_translatemz((double_complex*)(aa2 + m * ng2), bc->size2, bc->sendsize[i][d], bc->sendstart[i][d], bc->recvstart[i][1 - d], phases[d]); } } } void bc_unpack2(const boundary_conditions* bc, double* a2, int i, MPI_Request recvreq[2], MPI_Request sendreq[2], double* rbuf, int nin) { #ifdef PARALLEL int ng2 = bc->ndouble * bc->size2[0] * bc->size2[1] * bc->size2[2]; // Store data from receive-buffer: bool real = (bc->ndouble == 1); double* rbuf0 = rbuf; for (int d = 0; d < 2; d++) if (bc->recvproc[i][d] >= 0) { if (bc->rjoin[i]) { if (d == 0) { MPI_Wait(&recvreq[0], MPI_STATUS_IGNORE); rbuf += bc->nrecv[i][1] * nin; } else rbuf = rbuf0; } else MPI_Wait(&recvreq[d], MPI_STATUS_IGNORE); for (int m = 0; m < nin; m++) if (real) bmgs_paste(rbuf + m * bc->nrecv[i][d], bc->recvsize[i][d], a2 + m * ng2, bc->size2, bc->recvstart[i][d]); else bmgs_pastez((const double_complex*)(rbuf + m * bc->nrecv[i][d]), bc->recvsize[i][d], (double_complex*)(a2 + m * ng2), bc->size2, bc->recvstart[i][d]); rbuf += bc->nrecv[i][d] * nin; } // This does not work on the ibm with gcc! We do a blocking send instead. for (int d = 0; d < 2; d++) if (sendreq[d] != 0) MPI_Wait(&sendreq[d], MPI_STATUS_IGNORE); #endif // PARALLEL } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bc.h000066400000000000000000000026531316441372200211110ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include "bmgs/bmgs.h" #ifdef PARALLEL #include #else typedef int* MPI_Request; // !!!!!!!??????????? typedef int* MPI_Comm; #define MPI_COMM_NULL 0 #define MPI_Comm_rank(comm, rank) *(rank) = 0 #endif typedef struct { int size1[3]; int size2[3]; int sendstart[3][2][3]; int sendsize[3][2][3]; int recvstart[3][2][3]; int recvsize[3][2][3]; int sendproc[3][2]; int recvproc[3][2]; int nsend[3][2]; int nrecv[3][2]; int maxsend; int maxrecv; int padding[3]; bool sjoin[3]; bool rjoin[3]; int ndouble; bool cfd; MPI_Comm comm; } boundary_conditions; static const int COPY_DATA = -2; static const int DO_NOTHING = -3; // ?????????? boundary_conditions* bc_init(const long size1[3], const long padding[3][2], const long npadding[3][2], const long neighbors[3][2], MPI_Comm comm, bool real, bool cfd); void bc_unpack1(const boundary_conditions* bc, const double* input, double* output, int i, MPI_Request recvreq[2], MPI_Request sendreq[2], double* rbuf, double* sbuf, const double_complex phases[2], int thd, int nin); void bc_unpack2(const boundary_conditions* bc, double* a2, int i, MPI_Request recvreq[2], MPI_Request sendreq[2], double* rbuf, int nin); gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/blacs.c000066400000000000000000001552331316441372200216070ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2010 Argonne National Laboratory * Please see the accompanying LICENSE file for further information. */ #ifdef PARALLEL #include #ifdef GPAW_WITH_SL #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include #include #include #include "extensions.h" #include "mympi.h" // BLACS #define BLOCK_CYCLIC_2D 1 #ifdef GPAW_NO_UNDERSCORE_CBLACS #define Cblacs_barrier_ Cblacs_barrier #define Cblacs_gridexit_ Cblacs_gridexit #define Cblacs_gridinfo_ Cblacs_gridinfo #define Cblacs_gridinit_ Cblacs_gridinit #define Cblacs_pinfo_ Cblacs_pinfo #define Csys2blacs_handle_ Csys2blacs_handle #endif void Cblacs_barrier_(int ConTxt, char *scope); void Cblacs_gridexit_(int ConTxt); void Cblacs_gridinfo_(int ConTxt, int* nprow, int* npcol, int* myrow, int* mycol); void Cblacs_gridinit_(int* ConTxt, char* order, int nprow, int npcol); void Cblacs_pinfo_(int* mypnum, int* nprocs); int Csys2blacs_handle_(MPI_Comm SysCtxt); // End of BLACS // ScaLAPACK #ifdef GPAW_NO_UNDERSCORE_SCALAPACK #define numroc_ numroc #define pdlamch_ pdlamch #define pdlaset_ pdlaset #define pzlaset_ pzlaset #define pdpotrf_ pdpotrf #define pzpotrf_ pzpotrf #define pzpotri_ pzpotri #define pdtrtri_ pdtrtri #define pztrtri_ pztrtri #define pzgesv_ pzgesv #define pdgesv_ pdgesv #define pdsyevd_ pdsyevd #define pzheevd_ pzheevd #define pdsyevx_ pdsyevx #define pzheevx_ pzheevx #define pdsygvx_ pdsygvx #define pzhegvx_ pzhegvx #define pdsyngst_ pdsyngst #define pzhengst_ pzhengst #ifdef GPAW_MR3 #define pdsyevr_ pdsyevr #define pzheevr_ pzheevr #endif // GPAW_MR3 #define pdtran_ pdtran #define pztranc_ pztranc #define pdgemm_ pdgemm #define pzgemm_ pzgemm #define pdgemv_ pdgemv #define pzgemv_ pzgemv #define pdsyr2k_ pdsyr2k #define pzher2k_ pzher2k #define pdsyrk_ pdsyrk #define pzherk_ pzherk #define pdtrsm_ pdtrsm #define pztrsm_ pztrsm #define pzhemm_ pzhemm #define pdsymm_ pdsymm #endif #ifdef GPAW_NO_UNDERSCORE_CSCALAPACK #define Cpdgemr2d_ Cpdgemr2d #define Cpzgemr2d_ Cpzgemr2d #define Cpdtrmr2d_ Cpdtrmr2d #define Cpztrmr2d_ Cpztrmr2d #endif // tools int numroc_(int* n, int* nb, int* iproc, int* isrcproc, int* nprocs); void Cpdgemr2d_(int m, int n, double* a, int ia, int ja, int* desca, double* b, int ib, int jb, int* descb, int gcontext); void Cpzgemr2d_(int m, int n, void* a, int ia, int ja, int* desca, void* b, int ib, int jb, int* descb, int gcontext); void Cpdtrmr2d_(char* uplo, char* diag, int m, int n, double* a, int ia, int ja, int* desca, double* b, int ib, int jb, int* descb, int gcontext); void Cpztrmr2d_(char* uplo, char* diag, int m, int n, void* a, int ia, int ja, int* desca, void* b, int ib, int jb, int* descb, int gcontext); double pdlamch_(int* ictxt, char* cmach); void pzpotri_(char* uplo, int* n, void* a, int *ia, int* ja, int* desca, int* info); void pzgetri_(int* n, void* a, int *ia, int* ja, int* desca, int* info); void pdlaset_(char* uplo, int* m, int* n, double* alpha, double* beta, double* a, int* ia, int* ja, int* desca); void pzlaset_(char* uplo, int* m, int* n, void* alpha, void* beta, void* a, int* ia, int* ja, int* desca); // cholesky void pdpotrf_(char* uplo, int* n, double* a, int* ia, int* ja, int* desca, int* info); void pzpotrf_(char* uplo, int* n, void* a, int* ia, int* ja, int* desca, int* info); void pzgesv_(int* n, int* nrhs, void* a, int* ia, int* ja, int* desca, int* ipiv, void* b, int* ib, int* jb, int* descb, int* info); void pdgesv_(int *n, int *nrhs, void *a, int *ia, int *ja, int* desca, int *ipiv, void* b, int* ib, int* jb, int* descb, int* info); void pdtrtri_(char* uplo, char* diag, int* n, double* a, int *ia, int* ja, int* desca, int* info); void pztrtri_(char* uplo, char* diag, int* n, void* a, int *ia, int* ja, int* desca, int* info); // diagonalization void pdsyevd_(char* jobz, char* uplo, int* n, double* a, int* ia, int* ja, int* desca, double* w, double* z, int* iz, int* jz, int* descz, double* work, int* lwork, int* iwork, int* liwork, int* info); void pzheevd_(char* jobz, char* uplo, int* n, void* a, int* ia, int* ja, int* desca, double* w, void* z, int* iz, int* jz, int* descz, void* work, int* lwork, double* rwork, int* lrwork, int* iwork, int* liwork, int* info); void pdsyevx_(char* jobz, char* range, char* uplo, int* n, double* a, int* ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int* iz, int* jz, int* descz, double* work, int* lwork, int* iwork, int* liwork, int* ifail, int* iclustr, double* gap, int* info); void pzheevx_(char* jobz, char* range, char* uplo, int* n, void* a, int* ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, void* z, int* iz, int* jz, int* descz, void* work, int* lwork, double* rwork, int* lrwork, int* iwork, int* liwork, int* ifail, int* iclustr, double* gap, int* info); void pdsygvx_(int* ibtype, char* jobz, char* range, char* uplo, int* n, double* a, int* ia, int* ja, int* desca, double* b, int *ib, int* jb, int* descb, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int* iz, int* jz, int* descz, double* work, int* lwork, int* iwork, int* liwork, int* ifail, int* iclustr, double* gap, int* info); void pzhegvx_(int* ibtype, char* jobz, char* range, char* uplo, int* n, void* a, int* ia, int* ja, int* desca, void* b, int *ib, int* jb, int* descb, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, void* z, int* iz, int* jz, int* descz, void* work, int* lwork, double* rwork, int* lrwork, int* iwork, int* liwork, int* ifail, int* iclustr, double* gap, int* info); void pdsyngst_(int* ibtype, char* uplo, int* n, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb, double* scale, double* work, int* lwork, int* info); void pzhengst_(int* ibtype, char* uplo, int* n, void* a, int* ia, int* ja, int* desca, void* b, int* ib, int* jb, int* descb, double* scale, void* work, int* lwork, int* info); #ifdef GPAW_MR3 void pdsyevr_(char* jobz, char* range, char* uplo, int* n, double* a, int* ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, int* m, int* nz, double* w, double* z, int* iz, int* jz, int* descz, double* work, int* lwork, int* iwork, int* liwork, int* info); void pzheevr_(char* jobz, char* range, char* uplo, int* n, void* a, int* ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, int* m, int* nz, double* w, void* z, int* iz, int* jz, int* descz, void* work, int* lwork, double* rwork, int* lrwork, int* iwork, int* liwork, int* info); #endif // GPAW_MR3 // pblas void pdtran_(int* m, int* n, double* alpha, double* a, int* ia, int* ja, int* desca, double* beta, double* c, int* ic, int* jc, int* descc); void pztranc_(int* m, int* n, void* alpha, void* a, int* ia, int* ja, int* desca, void* beta, void* c, int* ic, int* jc, int* descc); void pdgemm_(char* transa, char* transb, int* m, int* n, int* k, double* alpha, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb, double* beta, double* c, int* ic, int* jc, int* descc); void pzgemm_(char* transa, char* transb, int* m, int* n, int* k, void* alpha, void* a, int* ia, int* ja, int* desca, void* b, int* ib, int* jb, int* descb, void* beta, void* c, int* ic, int* jc, int* descc); void pzhemm_(char* side, char* uplo, int* m, int* n, void* alpha, void* a, int* ia, int* ja, int* desca, void* b, int* ib, int* jb, int* descb, void* beta, void* c, int* ic, int* jc, int* descc); void pdsymm_(char* side, char* uplo, int* m, int* n, void* alpha, void* a, int* ia, int* ja, int* desca, void* b, int* ib, int* jb, int* descb, void* beta, void* c, int* ic, int* jc, int* descc); void pdgemv_(char* transa, int* m, int* n, double* alpha, double* a, int* ia, int* ja, int* desca, double* x, int* ix, int* jx, int* descx, int* incx, double* beta, double* y, int* iy, int* jy, int* descy, int* incy); void pzgemv_(char* transa, int* m, int* n, void* alpha, void* a, int* ia, int* ja, int* desca, void* x, int* ix, int* jx, int* descx, int* incx, void* beta, void* y, int* iy, int* jy, int* descy, int* incy); void pdsyr2k_(char* uplo, char* trans, int* n, int* k, double* alpha, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb, double* beta, double* c, int* ic, int *jc, int* descc); void pzher2k_(char* uplo, char* trans, int* n, int* k, void* alpha, void* a, int* ia, int* ja, int* desca, void* b, int* ib, int* jb, int* descb, void* beta, void* c, int* ic, int* jc, int* descc); void pdsyrk_(char* uplo, char* trans, int* n, int* k, double* alpha, double* a, int* ia, int* ja, int* desca, double* beta, double* c, int* ic, int* jc, int* descc); void pzherk_(char* uplo, char* trans, int* n, int* k, void* alpha, void* a, int* ia, int* ja, int* desca, void* beta, void* c, int* ic, int* jc, int* descc); void pdtrsm_(char* side, char* uplo, char* trans, char* diag, int* m, int *n, double* alpha, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb); void pztrsm_(char* side, char* uplo, char* trans, char* diag, int* m, int *n, void* alpha, void* a, int* ia, int* ja, int* desca, void* b, int* ib, int* jb, int* descb); PyObject* pblas_tran(PyObject *self, PyObject *args) { int m, n; Py_complex alpha; Py_complex beta; PyArrayObject *a, *c; PyArrayObject *desca, *descc; if (!PyArg_ParseTuple(args, "iiDODOOO", &m, &n, &alpha, &a, &beta, &c, &desca, &descc)) return NULL; int one = 1; if (PyArray_DESCR(c)->type_num == NPY_DOUBLE) pdtran_(&m, &n, &(alpha.real), DOUBLEP(a), &one, &one, INTP(desca), &(beta.real), DOUBLEP(c), &one, &one, INTP(descc)); else pztranc_(&m, &n, &alpha, (void*)PyArray_DATA(a), &one, &one, INTP(desca), &beta, (void*)PyArray_DATA(c), &one, &one, INTP(descc)); Py_RETURN_NONE; } PyObject* pblas_gemm(PyObject *self, PyObject *args) { char* transa; char* transb; int m, n, k; Py_complex alpha; Py_complex beta; PyArrayObject *a, *b, *c; PyArrayObject *desca, *descb, *descc; int one = 1; if (!PyArg_ParseTuple(args, "iiiDOODOOOOss", &m, &n, &k, &alpha, &a, &b, &beta, &c, &desca, &descb, &descc, &transa, &transb)) { return NULL; } // cdesc // int c_ConTxt = INTP(descc)[1]; // If process not on BLACS grid, then return. // if (c_ConTxt == -1) Py_RETURN_NONE; if (PyArray_DESCR(c)->type_num == NPY_DOUBLE) pdgemm_(transa, transb, &m, &n, &k, &(alpha.real), DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(descb), &(beta.real), DOUBLEP(c), &one, &one, INTP(descc)); else pzgemm_(transa, transb, &m, &n, &k, &alpha, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(descb), &beta, (void*)COMPLEXP(c), &one, &one, INTP(descc)); Py_RETURN_NONE; } PyObject* pblas_hemm(PyObject *self, PyObject *args) { char* side; char* uplo; int m, n; Py_complex alpha; Py_complex beta; PyArrayObject *a, *b, *c; PyArrayObject *desca, *descb, *descc; int one = 1; if (!PyArg_ParseTuple(args, "ssiiDOOdOOOO", &side, &uplo, &n, &m, &alpha, &a, &b, &beta, &c, &desca, &descb, &descc)) { return NULL; } if (PyArray_DESCR(c)->type_num == NPY_DOUBLE) { pdsymm_(side, uplo, &n, &m, &alpha, (void*)DOUBLEP(a), &one, &one, INTP(desca), (void*)DOUBLEP(b), &one, &one, INTP(descb), &beta, (void*)DOUBLEP(c), &one, &one, INTP(descc)); } else { pzhemm_(side, uplo, &n, &m, &alpha, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(descb), &beta, (void*)COMPLEXP(c), &one, &one, INTP(descc)); } Py_RETURN_NONE; } PyObject* pblas_gemv(PyObject *self, PyObject *args) { char* transa; int m, n; Py_complex alpha; Py_complex beta; PyArrayObject *a, *x, *y; int incx = 1, incy = 1; // what should these be? PyArrayObject *desca, *descx, *descy; int one = 1; if (!PyArg_ParseTuple(args, "iiDOODOOOOs", &m, &n, &alpha, &a, &x, &beta, &y, &desca, &descx, &descy, &transa)) { return NULL; } // ydesc // int y_ConTxt = INTP(descy)[1]; // If process not on BLACS grid, then return. // if (y_ConTxt == -1) Py_RETURN_NONE; if (PyArray_DESCR(y)->type_num == NPY_DOUBLE) pdgemv_(transa, &m, &n, &(alpha.real), DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(x), &one, &one, INTP(descx), &incx, &(beta.real), DOUBLEP(y), &one, &one, INTP(descy), &incy); else pzgemv_(transa, &m, &n, &alpha, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(x), &one, &one, INTP(descx), &incx, &beta, (void*)COMPLEXP(y), &one, &one, INTP(descy), &incy); Py_RETURN_NONE; } PyObject* pblas_r2k(PyObject *self, PyObject *args) { char* uplo; int n, k; Py_complex alpha; Py_complex beta; PyArrayObject *a, *b, *c; PyArrayObject *desca, *descb, *descc; int one = 1; if (!PyArg_ParseTuple(args, "iiDOODOOOOs", &n, &k, &alpha, &a, &b, &beta, &c, &desca, &descb, &descc, &uplo)) { return NULL; } // cdesc // int c_ConTxt = INTP(descc)[1]; // If process not on BLACS grid, then return. // if (c_ConTxt == -1) Py_RETURN_NONE; if (PyArray_DESCR(c)->type_num == NPY_DOUBLE) pdsyr2k_(uplo, "T", &n, &k, &(alpha.real), DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(descb), &(beta.real), DOUBLEP(c), &one, &one, INTP(descc)); else pzher2k_(uplo, "C", &n, &k, &alpha, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(descb), &beta, (void*)COMPLEXP(c), &one, &one, INTP(descc)); Py_RETURN_NONE; } PyObject* pblas_rk(PyObject *self, PyObject *args) { char* uplo; int n, k; Py_complex alpha; Py_complex beta; PyArrayObject *a, *c; PyArrayObject *desca, *descc; int one = 1; if (!PyArg_ParseTuple(args, "iiDODOOOs", &n, &k, &alpha, &a, &beta, &c, &desca, &descc, &uplo)) { return NULL; } // cdesc // int c_ConTxt = INTP(descc)[1]; // If process not on BLACS grid, then return. // if (c_ConTxt == -1) Py_RETURN_NONE; if (PyArray_DESCR(c)->type_num == NPY_DOUBLE) pdsyrk_(uplo, "T", &n, &k, &(alpha.real), DOUBLEP(a), &one, &one, INTP(desca), &(beta.real), DOUBLEP(c), &one, &one, INTP(descc)); else pzherk_(uplo, "C", &n, &k, &alpha, (void*)COMPLEXP(a), &one, &one, INTP(desca), &beta, (void*)COMPLEXP(c), &one, &one, INTP(descc)); Py_RETURN_NONE; } PyObject* new_blacs_context(PyObject *self, PyObject *args) { PyObject* comm_obj; int nprow, npcol; int iam, nprocs; int ConTxt; char* order; if (!PyArg_ParseTuple(args, "Oiis", &comm_obj, &nprow, &npcol, &order)){ return NULL; } // Create blacs grid on this communicator MPI_Comm comm = ((MPIObject*)comm_obj)->comm; // Get my id and nprocs. This is for debugging purposes only Cblacs_pinfo_(&iam, &nprocs); MPI_Comm_size(comm, &nprocs); // Create blacs grid on this communicator continued ConTxt = Csys2blacs_handle_(comm); Cblacs_gridinit_(&ConTxt, order, nprow, npcol); PyObject* returnvalue = Py_BuildValue("i", ConTxt); return returnvalue; } PyObject* get_blacs_gridinfo(PyObject *self, PyObject *args) { int ConTxt, nprow, npcol; int myrow, mycol; if (!PyArg_ParseTuple(args, "iii", &ConTxt, &nprow, &npcol)) { return NULL; } Cblacs_gridinfo_(ConTxt, &nprow, &npcol, &myrow, &mycol); return Py_BuildValue("(ii)", myrow, mycol); } PyObject* get_blacs_local_shape(PyObject *self, PyObject *args) { int ConTxt; int m, n, mb, nb, rsrc, csrc; int nprow, npcol, myrow, mycol; int locM, locN; if (!PyArg_ParseTuple(args, "iiiiiii", &ConTxt, &m, &n, &mb, &nb, &rsrc, &csrc)){ return NULL; } Cblacs_gridinfo_(ConTxt, &nprow, &npcol, &myrow, &mycol); locM = numroc_(&m, &mb, &myrow, &rsrc, &nprow); locN = numroc_(&n, &nb, &mycol, &csrc, &npcol); return Py_BuildValue("(ii)", locM, locN); } PyObject* blacs_destroy(PyObject *self, PyObject *args) { int ConTxt; if (!PyArg_ParseTuple(args, "i", &ConTxt)) return NULL; Cblacs_gridexit_(ConTxt); Py_RETURN_NONE; } PyObject* scalapack_set(PyObject *self, PyObject *args) { PyArrayObject* a; // matrix; PyArrayObject* desca; // descriptor Py_complex alpha; Py_complex beta; int m, n; int ia, ja; char* uplo; if (!PyArg_ParseTuple(args, "OODDsiiii", &a, &desca, &alpha, &beta, &uplo, &m, &n, &ia, &ja)) return NULL; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) pdlaset_(uplo, &m, &n, &(alpha.real), &(beta.real), DOUBLEP(a), &ia, &ja, INTP(desca)); else pzlaset_(uplo, &m, &n, &alpha, &beta, (void*)COMPLEXP(a), &ia, &ja, INTP(desca)); Py_RETURN_NONE; } PyObject* scalapack_redist(PyObject *self, PyObject *args) { PyArrayObject* a; // source matrix PyArrayObject* b; // destination matrix PyArrayObject* desca; // source descriptor PyArrayObject* descb; // destination descriptor char* uplo; char diag='N'; // copy the diagonal int c_ConTxt; int m; int n; int ia, ja, ib, jb; if (!PyArg_ParseTuple(args, "OOOOiiiiiiis", &desca, &descb, &a, &b, &m, &n, &ia, &ja, &ib, &jb, &c_ConTxt, &uplo)) return NULL; if (*uplo == 'G') // General matrix { if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) Cpdgemr2d_(m, n, DOUBLEP(a), ia, ja, INTP(desca), DOUBLEP(b), ib, jb, INTP(descb), c_ConTxt); else Cpzgemr2d_(m, n, (void*)COMPLEXP(a), ia, ja, INTP(desca), (void*)COMPLEXP(b), ib, jb, INTP(descb), c_ConTxt); } else // Trapezoidal matrix { if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) Cpdtrmr2d_(uplo, &diag, m, n, DOUBLEP(a), ia, ja, INTP(desca), DOUBLEP(b), ib, jb, INTP(descb), c_ConTxt); else Cpztrmr2d_(uplo, &diag, m, n, (void*)COMPLEXP(a), ia, ja, INTP(desca), (void*)COMPLEXP(b), ib, jb, INTP(descb), c_ConTxt); } Py_RETURN_NONE; } PyObject* scalapack_diagonalize_dc(PyObject *self, PyObject *args) { // Standard driver for divide and conquer algorithm // Computes all eigenvalues and eigenvectors PyArrayObject* a; // symmetric matrix PyArrayObject* desca; // symmetric matrix description vector PyArrayObject* z; // eigenvector matrix PyArrayObject* w; // eigenvalue array int one = 1; char jobz = 'V'; // eigenvectors also char* uplo; if (!PyArg_ParseTuple(args, "OOsOO", &a, &desca, &uplo, &z, &w)) return NULL; // adesc // int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // zdesc = adesc; this can be relaxed a bit according to pdsyevd.f // Only square matrices assert (a_m == a_n); int n = a_n; // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; // Query part, need to find the optimal size of a number of work arrays int info; int querywork = -1; int* iwork; int liwork; int lwork; int lrwork; int i_work; double d_work; double_complex c_work; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyevd_(&jobz, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), &d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(d_work); } else { pzheevd_(&jobz, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)&c_work, &querywork, &d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(c_work); lrwork = (int)(d_work); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_diagonalize_dc error in query."); return NULL; } // Computation part liwork = i_work; iwork = GPAW_MALLOC(int, liwork); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyevd_(&jobz, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), work, &lwork, iwork, &liwork, &info); free(work); } else { double_complex *work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); pzheevd_(&jobz, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)work, &lwork, rwork, &lrwork, iwork, &liwork, &info); free(rwork); free(work); } free(iwork); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } PyObject* scalapack_diagonalize_ex(PyObject *self, PyObject *args) { // Standard driver for bisection and inverse iteration algorithm // Computes 'iu' eigenvalues and eigenvectors PyArrayObject* a; // Hamiltonian matrix PyArrayObject* desca; // Hamintonian matrix descriptor PyArrayObject* z; // eigenvector matrix PyArrayObject* w; // eigenvalue array int a_mycol = -1; int a_myrow = -1; int a_nprow, a_npcol; int il = 1; // not used when range = 'A' or 'V' int iu; int eigvalm, nz; int one = 1; double vl, vu; // not used when range = 'A' or 'I' char jobz = 'V'; // eigenvectors also char range = 'I'; // eigenvalues il-th through iu-th char* uplo; if (!PyArg_ParseTuple(args, "OOsiOO", &a, &desca, &uplo, &iu, &z, &w)) return NULL; // a desc int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; // zdesc = adesc = bdesc; required by pdsyevx.f // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; Cblacs_gridinfo_(a_ConTxt, &a_nprow, &a_npcol, &a_myrow, &a_mycol); // Convergence tolerance double abstol = 1.0e-8; // char cmach = 'U'; // most orthogonal eigenvectors // char cmach = 'S'; // most acccurate eigenvalues // double abstol = pdlamch_(&a_ConTxt, &cmach); // most orthogonal eigenvectors // double abstol = 2.0*pdlamch_(&a_ConTxt, &cmach); // most accurate eigenvalues double orfac = -1.0; // Query part, need to find the optimal size of a number of work arrays int info; int *ifail; ifail = GPAW_MALLOC(int, n); int *iclustr; iclustr = GPAW_MALLOC(int, 2*a_nprow*a_npcol); double *gap; gap = GPAW_MALLOC(double, a_nprow*a_npcol); int querywork = -1; int* iwork; int liwork; int lwork; // workspace size must be at least 3 int lrwork; // workspace size must be at least 3 int i_work; double d_work[3]; double_complex c_work; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyevx_(&jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, DOUBLEP(z), &one, &one, INTP(desca), d_work, &querywork, &i_work, &querywork, ifail, iclustr, gap, &info); lwork = MAX(3, (int)(d_work[0])); } else { pzheevx_(&jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)&c_work, &querywork, d_work, &querywork, &i_work, &querywork, ifail, iclustr, gap, &info); lwork = MAX(3, (int)(c_work)); lrwork = MAX(3, (int)(d_work[0])); } if (info != 0) { printf ("info = %d", info); PyErr_SetString(PyExc_RuntimeError, "scalapack_diagonalize_ex error in query."); return NULL; } // Computation part // lwork = lwork + (n-1)*n; // this is a ridiculous amount of workspace liwork = i_work; iwork = GPAW_MALLOC(int, liwork); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyevx_(&jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, DOUBLEP(z), &one, &one, INTP(desca), work, &lwork, iwork, &liwork, ifail, iclustr, gap, &info); free(work); } else { double_complex* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); pzheevx_(&jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)work, &lwork, rwork, &lrwork, iwork, &liwork, ifail, iclustr, gap, &info); free(rwork); free(work); } free(iwork); free(gap); free(iclustr); free(ifail); // If this fails, fewer eigenvalues than requested were computed. assert (eigvalm == iu); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } #ifdef GPAW_MR3 PyObject* scalapack_diagonalize_mr3(PyObject *self, PyObject *args) { // Standard driver for MRRR algorithm // Computes 'iu' eigenvalues and eigenvectors // http://icl.cs.utk.edu/lapack-forum/archives/scalapack/msg00159.html PyArrayObject* a; // Hamiltonian matrix PyArrayObject* desca; // Hamintonian matrix descriptor PyArrayObject* z; // eigenvector matrix PyArrayObject* w; // eigenvalue array int il = 1; // not used when range = 'A' or 'V' int iu; int eigvalm, nz; int one = 1; double vl, vu; // not used when range = 'A' or 'I' char jobz = 'V'; // eigenvectors also char range = 'I'; // eigenvalues il-th through iu-th char* uplo; if (!PyArg_ParseTuple(args, "OOsiOO", &a, &desca, &uplo, &iu, &z, &w)) return NULL; // a desc // int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; // zdesc = adesc = bdesc; required by pdsyevx.f // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; // Query part, need to find the optimal size of a number of work arrays int info; int querywork = -1; int* iwork; int liwork; int lwork; int lrwork; int i_work; double d_work[3]; double_complex c_work; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyevr_(&jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(d_work[0]); } else { pzheevr_(&jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)&c_work, &querywork, d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(c_work); lrwork = (int)(d_work[0]); } if (info != 0) { printf ("info = %d", info); PyErr_SetString(PyExc_RuntimeError, "scalapack_diagonalize_evr error in query."); return NULL; } // Computation part liwork = i_work; iwork = GPAW_MALLOC(int, liwork); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyevr_(&jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), work, &lwork, iwork, &liwork, &info); free(work); } else { double_complex* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); pzheevr_(&jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)work, &lwork, rwork, &lrwork, iwork, &liwork, &info); free(rwork); free(work); } free(iwork); // If this fails, fewer eigenvalues than requested were computed. assert (eigvalm == iu); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } #endif PyObject* scalapack_general_diagonalize_dc(PyObject *self, PyObject *args) { // General driver for divide and conquer algorithm // Computes *all* eigenvalues and eigenvectors PyArrayObject* a; // Hamiltonian matrix PyArrayObject* b; // overlap matrix PyArrayObject* desca; // Hamintonian matrix descriptor PyArrayObject* z; // eigenvector matrix PyArrayObject* w; // eigenvalue array int ibtype = 1; // Solve H*psi = lambda*S*psi int one = 1; char jobz = 'V'; // eigenvectors also char* uplo; double scale; if (!PyArg_ParseTuple(args, "OOsOOO", &a, &desca, &uplo, &b, &z, &w)) return NULL; // a desc // int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; // zdesc = adesc = bdesc can be relaxed a bit according to pdsyevd.f // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; // Cholesky Decomposition int info; if (PyArray_DESCR(b)->type_num == NPY_DOUBLE) pdpotrf_(uplo, &n, DOUBLEP(b), &one, &one, INTP(desca), &info); else pzpotrf_(uplo, &n, (void*)COMPLEXP(b), &one, &one, INTP(desca), &info); if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_dc error in Cholesky."); return NULL; } // Query variables int querywork = -1; int* iwork; int liwork; int lwork; int lrwork; int i_work; double d_work; double_complex c_work; // NGST Query if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyngst_(&ibtype, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(desca), &scale, &d_work, &querywork, &info); lwork = (int)(d_work); } else { pzhengst_(&ibtype, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(desca), &scale, (void*)&c_work, &querywork, &info); lwork = (int)(c_work); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_dc error in NGST query."); return NULL; } // NGST Compute if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyngst_(&ibtype, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(desca), &scale, work, &lwork, &info); free(work); } else { double_complex* work = GPAW_MALLOC(double_complex, lwork); pzhengst_(&ibtype, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(desca), &scale, (void*)work, &lwork, &info); free(work); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_dc error in NGST compute."); return NULL; } // NOTE: Scale is always equal to 1.0 above. In future version of ScaLAPACK, we // may need to rescale eigenvalues by scale. This can be accomplised by using // the BLAS1 d/zscal. See pdsygvx.f // EVD Query if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyevd_(&jobz, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), &d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(d_work); } else { pzheevd_(&jobz, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)&c_work, &querywork, &d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(c_work); lrwork = (int)(d_work); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_dc error in EVD query."); return NULL; } // EVD Computation liwork = i_work; iwork = GPAW_MALLOC(int, liwork); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyevd_(&jobz, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), work, &lwork, iwork, &liwork, &info); free(work); } else { double_complex *work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); pzheevd_(&jobz, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)work, &lwork, rwork, &lrwork, iwork, &liwork, &info); free(rwork); free(work); } free(iwork); // Backtransformation to the original problem char trans; double d_one = 1.0; double_complex c_one = 1.0; if (*uplo == 'U') trans = 'N'; else trans = 'T'; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) pdtrsm_("L", uplo, &trans, "N", &n, &n, &d_one, DOUBLEP(b), &one, &one, INTP(desca), DOUBLEP(z), &one, &one, INTP(desca)); else pztrsm_("L", uplo, &trans, "N", &n, &n, (void*)&c_one, (void*)COMPLEXP(b), &one, &one, INTP(desca), (void*)COMPLEXP(z), &one, &one, INTP(desca)); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } PyObject* scalapack_general_diagonalize_ex(PyObject *self, PyObject *args) { // General driver for bisection and inverse iteration algorithm // Computes 'iu' eigenvalues and eigenvectors PyArrayObject* a; // Hamiltonian matrix PyArrayObject* b; // overlap matrix PyArrayObject* desca; // Hamintonian matrix descriptor PyArrayObject* z; // eigenvector matrix PyArrayObject* w; // eigenvalue array int ibtype = 1; // Solve H*psi = lambda*S*psi int a_mycol = -1; int a_myrow = -1; int a_nprow, a_npcol; int il = 1; // not used when range = 'A' or 'V' int iu; // int eigvalm, nz; int one = 1; double vl, vu; // not used when range = 'A' or 'I' char jobz = 'V'; // eigenvectors also char range = 'I'; // eigenvalues il-th through iu-th char* uplo; if (!PyArg_ParseTuple(args, "OOsiOOO", &a, &desca, &uplo, &iu, &b, &z, &w)) return NULL; // a desc int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; // zdesc = adesc = bdesc; required by pdsygvx.f // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; Cblacs_gridinfo_(a_ConTxt, &a_nprow, &a_npcol, &a_myrow, &a_mycol); // Convergence tolerance double abstol = 1.0e-8; // char cmach = 'U'; // most orthogonal eigenvectors // char cmach = 'S'; // most acccurate eigenvalues // double abstol = pdlamch_(&a_ConTxt, &cmach); // most orthogonal eigenvectors // double abstol = 2.0*pdlamch_(&a_ConTxt, &cmach); // most accurate eigenvalues double orfac = -1.0; // Query part, need to find the optimal size of a number of work arrays int info; int *ifail; ifail = GPAW_MALLOC(int, n); int *iclustr; iclustr = GPAW_MALLOC(int, 2*a_nprow*a_npcol); double *gap; gap = GPAW_MALLOC(double, a_nprow*a_npcol); int querywork = -1; int* iwork; int liwork; int lwork; // workspace size must be at least 3 int lrwork; // workspace size must be at least 3 int i_work; double d_work[3]; double_complex c_work; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsygvx_(&ibtype, &jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, DOUBLEP(z), &one, &one, INTP(desca), d_work, &querywork, &i_work, &querywork, ifail, iclustr, gap, &info); lwork = MAX(3, (int)(d_work[0])); } else { pzhegvx_(&ibtype, &jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)&c_work, &querywork, d_work, &querywork, &i_work, &querywork, ifail, iclustr, gap, &info); lwork = MAX(3, (int)(c_work)); lrwork = MAX(3, (int)(d_work[0])); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_ex error in query."); return NULL; } // Computation part // lwork = lwork + (n-1)*n; // this is a ridiculous amount of workspace liwork = i_work; iwork = GPAW_MALLOC(int, liwork); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsygvx_(&ibtype, &jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, DOUBLEP(z), &one, &one, INTP(desca), work, &lwork, iwork, &liwork, ifail, iclustr, gap, &info); free(work); } else { double_complex* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); pzhegvx_(&ibtype, &jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &abstol, &eigvalm, &nz, DOUBLEP(w), &orfac, (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)work, &lwork, rwork, &lrwork, iwork, &liwork, ifail, iclustr, gap, &info); free(rwork); free(work); } free(iwork); free(gap); free(iclustr); free(ifail); // If this fails, fewer eigenvalues than requested were computed. assert (eigvalm == iu); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } #ifdef GPAW_MR3 PyObject* scalapack_general_diagonalize_mr3(PyObject *self, PyObject *args) { // General driver for MRRR algorithm // Computes 'iu' eigenvalues and eigenvectors // http://icl.cs.utk.edu/lapack-forum/archives/scalapack/msg00159.html PyArrayObject* a; // Hamiltonian matrix PyArrayObject* b; // overlap matrix PyArrayObject* desca; // Hamintonian matrix descriptor PyArrayObject* z; // eigenvector matrix PyArrayObject* w; // eigenvalue array int ibtype = 1; // Solve H*psi = lambda*S*psi int il = 1; // not used when range = 'A' or 'V' int iu; int eigvalm, nz; int one = 1; double vl, vu; // not used when range = 'A' or 'I' char jobz = 'V'; // eigenvectors also char range = 'I'; // eigenvalues il-th through iu-th char* uplo; double scale; if (!PyArg_ParseTuple(args, "OOsiOOO", &a, &desca, &uplo, &iu, &b, &z, &w)) return NULL; // a desc // int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; // zdesc = adesc = bdesc can be relaxed a bit according to pdsyevd.f // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; // Cholesky Decomposition int info; if (PyArray_DESCR(b)->type_num == NPY_DOUBLE) pdpotrf_(uplo, &n, DOUBLEP(b), &one, &one, INTP(desca), &info); else pzpotrf_(uplo, &n, (void*)COMPLEXP(b), &one, &one, INTP(desca), &info); if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_mr3 error in Cholesky."); return NULL; } // Query variables int querywork = -1; int* iwork; int liwork; int lwork; int lrwork; int i_work; double d_work[3]; double_complex c_work; // NGST Query if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyngst_(&ibtype, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(desca), &scale, d_work, &querywork, &info); lwork = (int)(d_work[0]); } else { pzhengst_(&ibtype, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(desca), &scale, (void*)&c_work, &querywork, &info); lwork = (int)(c_work); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_mr3 error in NGST query."); return NULL; } // NGST Compute if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyngst_(&ibtype, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), DOUBLEP(b), &one, &one, INTP(desca), &scale, work, &lwork, &info); free(work); } else { double_complex* work = GPAW_MALLOC(double_complex, lwork); pzhengst_(&ibtype, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), (void*)COMPLEXP(b), &one, &one, INTP(desca), &scale, (void*)work, &lwork, &info); free(work); } if (info != 0) { PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_mr3 error in NGST compute."); return NULL; } // NOTE: Scale is always equal to 1.0 above. In future version of ScaLAPACK, we // may need to rescale eigenvalues by scale. This can be accomplised by using // the BLAS1 d/zscal. See pdsygvx.f // EVR Query if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdsyevr_(&jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(d_work[0]); } else { pzheevr_(&jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)&c_work, &querywork, d_work, &querywork, &i_work, &querywork, &info); lwork = (int)(c_work); lrwork = (int)(d_work[0]); } if (info != 0) { printf ("info = %d", info); PyErr_SetString(PyExc_RuntimeError, "scalapack_general_diagonalize_evr error in query."); return NULL; } // EVR Computation liwork = i_work; iwork = GPAW_MALLOC(int, liwork); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); pdsyevr_(&jobz, &range, uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), DOUBLEP(z), &one, &one, INTP(desca), work, &lwork, iwork, &liwork, &info); free(work); } else { double_complex* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); pzheevr_(&jobz, &range, uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &vl, &vu, &il, &iu, &eigvalm, &nz, DOUBLEP(w), (void*)COMPLEXP(z), &one, &one, INTP(desca), (void*)work, &lwork, rwork, &lrwork, iwork, &liwork, &info); free(rwork); free(work); } free(iwork); // Backtransformation to the original problem char trans; double d_one = 1.0; double_complex c_one = 1.0; if (*uplo == 'U') trans = 'N'; else trans = 'T'; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) pdtrsm_("L", uplo, &trans, "N", &n, &n, &d_one, DOUBLEP(b), &one, &one, INTP(desca), DOUBLEP(z), &one, &one, INTP(desca)); else pztrsm_("L", uplo, &trans, "N", &n, &n, (void*)&c_one, (void*)COMPLEXP(b), &one, &one, INTP(desca), (void*)COMPLEXP(z), &one, &one, INTP(desca)); // If this fails, fewer eigenvalues than requested were computed. assert (eigvalm == iu); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } #endif PyObject* scalapack_inverse_cholesky(PyObject *self, PyObject *args) { // Cholesky plus inverse of triangular matrix PyArrayObject* a; // overlap matrix PyArrayObject* desca; // symmetric matrix description vector int info; double d_zero = 0.0; double_complex c_zero = 0.0; int one = 1; int two = 2; char diag = 'N'; // non-unit triangular char* uplo; if (!PyArg_ParseTuple(args, "OOs", &a, &desca, &uplo)) return NULL; // adesc // int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; int p = a_n - 1; // If process not on BLACS grid, then return. // if (a_ConTxt == -1) Py_RETURN_NONE; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdpotrf_(uplo, &n, DOUBLEP(a), &one, &one, INTP(desca), &info); if (info == 0) { pdtrtri_(uplo, &diag, &n, DOUBLEP(a), &one, &one, INTP(desca), &info); if (*uplo == 'L') pdlaset_("U", &p, &p, &d_zero, &d_zero, DOUBLEP(a), &one, &two, INTP(desca)); else pdlaset_("L", &p, &p, &d_zero, &d_zero, DOUBLEP(a), &two, &one, INTP(desca)); } } else { pzpotrf_(uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &info); if (info == 0) { pztrtri_(uplo, &diag, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &info); if (*uplo == 'L') pzlaset_("U", &p, &p, (void*)&c_zero, (void*)&c_zero, (void*)COMPLEXP(a), &one, &two, INTP(desca)); else pzlaset_("L", &p, &p, (void*)&c_zero, (void*)&c_zero, (void*)COMPLEXP(a), &two, &one, INTP(desca)); } } PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } PyObject* scalapack_inverse(PyObject *self, PyObject *args) { // Inverse of an hermitean matrix PyArrayObject* a; // Matrix PyArrayObject* desca; // Matrix description vector char* uplo; int info; int one = 1; if (!PyArg_ParseTuple(args, "OOs", &a, &desca, &uplo)) return NULL; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int n = a_n; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { assert(1==-1); // No double version implemented } else { pzpotrf_(uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &info); if (info == 0) { pzpotri_(uplo, &n, (void*)COMPLEXP(a), &one, &one, INTP(desca), &info); } } PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } /* PyObject* scalapack_solve(PyObject *self, PyObject *args) { // Solves equation Ax = B, where A is a general matrix PyArrayObject* a; // Matrix PyArrayObject* desca; // Matrix description vector PyArrayObject* b; // Matrix PyArrayObject* descb; // Matrix description vector char uplo; int info; int one = 1; if (!PyArg_ParseTuple(args, "OOOO", &a, &desca, &b, &descb)) return NULL; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; // Only square matrices assert (a_m == a_n); int b_m = INTP(descb)[2]; int b_n = INTP(descb)[3]; // Equation valid assert (a_n == b_m); int n = a_n; int nrhs = b_n; int* pivot = GPAW_MALLOC(int, a_m+2000); // TODO: How long should this exaclty be? if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { assert(1==-1); // No double version implemented } else { pzgesv_(&n, &nrhs,(void*)COMPLEXP(a), &one, &one, INTP(desca), pivot, (void*)COMPLEXP(b), &one, &one, INTP(descb), &info); } free(pivot); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } */ PyObject* scalapack_solve(PyObject *self, PyObject *args) { // Solves equation Ax = B, where A is a general matrix PyArrayObject* a; // Matrix PyArrayObject* desca; // Matrix description vector PyArrayObject* b; // Matrix PyArrayObject* descb; // Matrix description vector int info; int one = 1; if (!PyArg_ParseTuple(args, "OOOO", &a, &desca, &b, &descb)) return NULL; int a_ConTxt = INTP(desca)[1]; int a_m = INTP(desca)[2]; int a_n = INTP(desca)[3]; int a_mb = INTP(desca)[4]; // Only square matrices assert (a_m == a_n); int b_m = INTP(descb)[2]; int b_n = INTP(descb)[3]; // Equation valid assert (a_n == b_m); int n = a_n; int nrhs = b_n; int nprow, npcol, myrow, mycol, locM; Cblacs_gridinfo_(a_ConTxt, &nprow, &npcol, &myrow, &mycol); // LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A locM = (((a_m/a_mb) + 1)/nprow + 1) * a_mb; /* * IPIV (local output) INTEGER array, dimension ( LOCr(M_A)+MB_A ) * This array contains the pivoting information. * IPIV(i) -> The global row local row i was swapped with. * This array is tied to the distributed matrix A. * An upper bound for these quantities may be computed by: * LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A * M_A (global) DESCA( M_ ) The number of rows in the global * array A. * MB_A (global) DESCA( MB_ ) The blocking factor used to distribute * the rows of the array. * NPROW (global input) INTEGER * NPROW specifies the number of process rows in the grid * to be created. */ int* pivot = GPAW_MALLOC(int, locM + a_mb); //if (a->descr->type_num == PyArray_DOUBLE) if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { pdgesv_(&n, &nrhs,(double*)DOUBLEP(a), &one, &one, INTP(desca), pivot, (double*)DOUBLEP(b), &one, &one, INTP(descb), &info); } else { pzgesv_(&n, &nrhs,(void*)COMPLEXP(a), &one, &one, INTP(desca), pivot, (void*)COMPLEXP(b), &one, &one, INTP(descb), &info); } free(pivot); PyObject* returnvalue = Py_BuildValue("i", info); return returnvalue; } #endif #endif // PARALLEL gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/blas.c000066400000000000000000000322161316441372200214370ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2007 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" #ifdef GPAW_NO_UNDERSCORE_BLAS # define dscal_ dscal # define zscal_ zscal # define daxpy_ daxpy # define zaxpy_ zaxpy # define dsyrk_ dsyrk # define zher_ zher # define zherk_ zherk # define dsyr2k_ dsyr2k # define zher2k_ zher2k # define dgemm_ dgemm # define zgemm_ zgemm # define dgemv_ dgemv # define zgemv_ zgemv # define ddot_ ddot #endif void dscal_(int*n, double* alpha, double* x, int* incx); void zscal_(int*n, void* alpha, void* x, int* incx); void daxpy_(int* n, double* alpha, double* x, int *incx, double* y, int *incy); void zaxpy_(int* n, void* alpha, void* x, int *incx, void* y, int *incy); void dsyrk_(char *uplo, char *trans, int *n, int *k, double *alpha, double *a, int *lda, double *beta, double *c, int *ldc); void zher_(char *uplo, int *n, double *alpha, void *x, int *incx, void *a, int *lda); void zherk_(char *uplo, char *trans, int *n, int *k, double *alpha, void *a, int *lda, double *beta, void *c, int *ldc); void dsyr2k_(char *uplo, char *trans, int *n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc); void zher2k_(char *uplo, char *trans, int *n, int *k, void *alpha, void *a, int *lda, void *b, int *ldb, double *beta, void *c, int *ldc); void dgemm_(char *transa, char *transb, int *m, int * n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc); void zgemm_(char *transa, char *transb, int *m, int * n, int *k, void *alpha, void *a, int *lda, void *b, int *ldb, void *beta, void *c, int *ldc); void dgemv_(char *trans, int *m, int * n, double *alpha, double *a, int *lda, double *x, int *incx, double *beta, double *y, int *incy); void zgemv_(char *trans, int *m, int * n, void *alpha, void *a, int *lda, void *x, int *incx, void *beta, void *y, int *incy); double ddot_(int *n, void *dx, int *incx, void *dy, int *incy); PyObject* scal(PyObject *self, PyObject *args) { Py_complex alpha; PyArrayObject* x; if (!PyArg_ParseTuple(args, "DO", &alpha, &x)) return NULL; int n = PyArray_DIMS(x)[0]; for (int d = 1; d < PyArray_NDIM(x); d++) n *= PyArray_DIMS(x)[d]; int incx = 1; if (PyArray_DESCR(x)->type_num == NPY_DOUBLE) dscal_(&n, &(alpha.real), DOUBLEP(x), &incx); else zscal_(&n, &alpha, (void*)COMPLEXP(x), &incx); Py_RETURN_NONE; } PyObject* gemm(PyObject *self, PyObject *args) { Py_complex alpha; PyArrayObject* a; PyArrayObject* b; Py_complex beta; PyArrayObject* c; char t = 'n'; char* transa = &t; if (!PyArg_ParseTuple(args, "DOODO|s", &alpha, &a, &b, &beta, &c, &transa)) return NULL; int m, k, lda, ldb, ldc; if (*transa == 'n') { m = PyArray_DIMS(a)[1]; for (int i = 2; i < PyArray_NDIM(a); i++) m *= PyArray_DIMS(a)[i]; k = PyArray_DIMS(a)[0]; lda = MAX(1, PyArray_STRIDES(a)[0] / PyArray_STRIDES(a)[PyArray_NDIM(a) - 1]); ldb = MAX(1, PyArray_STRIDES(b)[0] / PyArray_STRIDES(b)[1]); ldc = MAX(1, PyArray_STRIDES(c)[0] / PyArray_STRIDES(c)[PyArray_NDIM(c) - 1]); } else { k = PyArray_DIMS(a)[1]; for (int i = 2; i < PyArray_NDIM(a); i++) k *= PyArray_DIMS(a)[i]; m = PyArray_DIMS(a)[0]; lda = MAX(1, k); ldb = MAX(1, PyArray_STRIDES(b)[0] / PyArray_STRIDES(b)[PyArray_NDIM(b) - 1]); ldc = MAX(1, PyArray_STRIDES(c)[0] / PyArray_STRIDES(c)[1]); } int n = PyArray_DIMS(b)[0]; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) dgemm_(transa, "n", &m, &n, &k, &(alpha.real), DOUBLEP(a), &lda, DOUBLEP(b), &ldb, &(beta.real), DOUBLEP(c), &ldc); else zgemm_(transa, "n", &m, &n, &k, &alpha, (void*)COMPLEXP(a), &lda, (void*)COMPLEXP(b), &ldb, &beta, (void*)COMPLEXP(c), &ldc); Py_RETURN_NONE; } PyObject* mmm(PyObject *self, PyObject *args) { Py_complex alpha; PyArrayObject* M1; char* trans1; PyArrayObject* M2; char* trans2; Py_complex beta; PyArrayObject* M3; if (!PyArg_ParseTuple(args, "DOsOsDO", &alpha, &M1, &trans1, &M2, &trans2, &beta, &M3)) return NULL; int m = PyArray_DIM(M3, 1); int n = PyArray_DIM(M3, 0); int k; int bytes = PyArray_ITEMSIZE(M3); int lda = MAX(1, PyArray_STRIDE(M2, 0) / bytes); int ldb = MAX(1, PyArray_STRIDE(M1, 0) / bytes); int ldc = MAX(1, PyArray_STRIDE(M3, 0) / bytes); void* a = PyArray_DATA(M2); void* b = PyArray_DATA(M1); void* c = PyArray_DATA(M3); if (*trans2 == 'n') k = PyArray_DIM(M2, 0); else k = PyArray_DIM(M2, 1); if (bytes == 8) dgemm_(trans2, trans1, &m, &n, &k, &(alpha.real), a, &lda, b, &ldb, &(beta.real), c, &ldc); else zgemm_(trans2, trans1, &m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc); Py_RETURN_NONE; } PyObject* gemv(PyObject *self, PyObject *args) { Py_complex alpha; PyArrayObject* a; PyArrayObject* x; Py_complex beta; PyArrayObject* y; char t = 't'; char* trans = &t; if (!PyArg_ParseTuple(args, "DOODO|s", &alpha, &a, &x, &beta, &y, &trans)) return NULL; int m, n, lda, itemsize, incx, incy; if (*trans == 'n') { m = PyArray_DIMS(a)[1]; for (int i = 2; i < PyArray_NDIM(a); i++) m *= PyArray_DIMS(a)[i]; n = PyArray_DIMS(a)[0]; lda = MAX(1, m); } else { n = PyArray_DIMS(a)[0]; for (int i = 1; i < PyArray_NDIM(a)-1; i++) n *= PyArray_DIMS(a)[i]; m = PyArray_DIMS(a)[PyArray_NDIM(a)-1]; lda = MAX(1, m); } if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) itemsize = sizeof(double); else itemsize = sizeof(double_complex); incx = PyArray_STRIDES(x)[0]/itemsize; incy = 1; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) dgemv_(trans, &m, &n, &(alpha.real), DOUBLEP(a), &lda, DOUBLEP(x), &incx, &(beta.real), DOUBLEP(y), &incy); else zgemv_(trans, &m, &n, &alpha, (void*)COMPLEXP(a), &lda, (void*)COMPLEXP(x), &incx, &beta, (void*)COMPLEXP(y), &incy); Py_RETURN_NONE; } PyObject* axpy(PyObject *self, PyObject *args) { Py_complex alpha; PyArrayObject* x; PyArrayObject* y; if (!PyArg_ParseTuple(args, "DOO", &alpha, &x, &y)) return NULL; int n = PyArray_DIMS(x)[0]; for (int d = 1; d < PyArray_NDIM(x); d++) n *= PyArray_DIMS(x)[d]; int incx = 1; int incy = 1; if (PyArray_DESCR(x)->type_num == NPY_DOUBLE) daxpy_(&n, &(alpha.real), DOUBLEP(x), &incx, DOUBLEP(y), &incy); else zaxpy_(&n, &alpha, (void*)COMPLEXP(x), &incx, (void*)COMPLEXP(y), &incy); Py_RETURN_NONE; } PyObject* czher(PyObject *self, PyObject *args) { double alpha; PyArrayObject* x; PyArrayObject* a; if (!PyArg_ParseTuple(args, "dOO", &alpha, &x, &a)) return NULL; int n = PyArray_DIMS(x)[0]; for (int d = 1; d < PyArray_NDIM(x); d++) n *= PyArray_DIMS(x)[d]; int incx = 1; int lda = MAX(1, n); zher_("l", &n, &(alpha), (void*)COMPLEXP(x), &incx, (void*)COMPLEXP(a), &lda); Py_RETURN_NONE; } PyObject* rk(PyObject *self, PyObject *args) { double alpha; PyArrayObject* a; double beta; PyArrayObject* c; char t = 'c'; char* trans = &t; if (!PyArg_ParseTuple(args, "dOdO|s", &alpha, &a, &beta, &c, &trans)) return NULL; int n = PyArray_DIMS(c)[0]; int k, lda; if (*trans == 'c') { k = PyArray_DIMS(a)[1]; for (int d = 2; d < PyArray_NDIM(a); d++) k *= PyArray_DIMS(a)[d]; lda = k; } else { k = PyArray_DIMS(a)[0]; lda = n; } int ldc = PyArray_STRIDES(c)[0] / PyArray_STRIDES(c)[1]; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) dsyrk_("u", trans, &n, &k, &alpha, DOUBLEP(a), &lda, &beta, DOUBLEP(c), &ldc); else zherk_("u", trans, &n, &k, &alpha, (void*)COMPLEXP(a), &lda, &beta, (void*)COMPLEXP(c), &ldc); Py_RETURN_NONE; } PyObject* r2k(PyObject *self, PyObject *args) { Py_complex alpha; PyArrayObject* a; PyArrayObject* b; double beta; PyArrayObject* c; if (!PyArg_ParseTuple(args, "DOOdO", &alpha, &a, &b, &beta, &c)) return NULL; int n = PyArray_DIMS(a)[0]; int k = PyArray_DIMS(a)[1]; for (int d = 2; d < PyArray_NDIM(a); d++) k *= PyArray_DIMS(a)[d]; int ldc = PyArray_STRIDES(c)[0] / PyArray_STRIDES(c)[1]; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) dsyr2k_("u", "t", &n, &k, (double*)(&alpha), DOUBLEP(a), &k, DOUBLEP(b), &k, &beta, DOUBLEP(c), &ldc); else zher2k_("u", "c", &n, &k, (void*)(&alpha), (void*)COMPLEXP(a), &k, (void*)COMPLEXP(b), &k, &beta, (void*)COMPLEXP(c), &ldc); Py_RETURN_NONE; } PyObject* dotc(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* b; if (!PyArg_ParseTuple(args, "OO", &a, &b)) return NULL; int n = PyArray_DIMS(a)[0]; for (int i = 1; i < PyArray_NDIM(a); i++) n *= PyArray_DIMS(a)[i]; int incx = 1; int incy = 1; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double result; result = ddot_(&n, (void*)DOUBLEP(a), &incx, (void*)DOUBLEP(b), &incy); return PyFloat_FromDouble(result); } else { double_complex* ap = COMPLEXP(a); double_complex* bp = COMPLEXP(b); double_complex z = 0.0; for (int i = 0; i < n; i++) z += conj(ap[i]) * bp[i]; return PyComplex_FromDoubles(creal(z), cimag(z)); } } PyObject* dotu(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* b; if (!PyArg_ParseTuple(args, "OO", &a, &b)) return NULL; int n = PyArray_DIMS(a)[0]; for (int i = 1; i < PyArray_NDIM(a); i++) n *= PyArray_DIMS(a)[i]; int incx = 1; int incy = 1; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double result; result = ddot_(&n, (void*)DOUBLEP(a), &incx, (void*)DOUBLEP(b), &incy); return PyFloat_FromDouble(result); } else { double_complex* ap = COMPLEXP(a); double_complex* bp = COMPLEXP(b); double_complex z = 0.0; for (int i = 0; i < n; i++) z += ap[i] * bp[i]; return PyComplex_FromDoubles(creal(z), cimag(z)); } } PyObject* multi_dotu(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* b; PyArrayObject* c; if (!PyArg_ParseTuple(args, "OOO", &a, &b, &c)) return NULL; int n0 = PyArray_DIMS(a)[0]; int n = PyArray_DIMS(a)[1]; for (int i = 2; i < PyArray_NDIM(a); i++) n *= PyArray_DIMS(a)[i]; int incx = 1; int incy = 1; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double *ap = DOUBLEP(a); double *bp = DOUBLEP(b); double *cp = DOUBLEP(c); for (int i = 0; i < n0; i++) { cp[i] = ddot_(&n, (void*)ap, &incx, (void*)bp, &incy); ap += n; bp += n; } } else { double_complex* ap = COMPLEXP(a); double_complex* bp = COMPLEXP(b); double_complex* cp = COMPLEXP(c); for (int i = 0; i < n0; i++) { cp[i] = 0.0; for (int j = 0; j < n; j++) cp[i] += ap[j] * bp[j]; ap += n; bp += n; } } Py_RETURN_NONE; } PyObject* multi_axpy(PyObject *self, PyObject *args) { PyArrayObject* alpha; PyArrayObject* x; PyArrayObject* y; if (!PyArg_ParseTuple(args, "OOO", &alpha, &x, &y)) return NULL; int n0 = PyArray_DIMS(x)[0]; int n = PyArray_DIMS(x)[1]; for (int d = 2; d < PyArray_NDIM(x); d++) n *= PyArray_DIMS(x)[d]; int incx = 1; int incy = 1; if (PyArray_DESCR(alpha)->type_num == NPY_DOUBLE) { if (PyArray_DESCR(x)->type_num == NPY_CDOUBLE) n *= 2; double *ap = DOUBLEP(alpha); double *xp = DOUBLEP(x); double *yp = DOUBLEP(y); for (int i = 0; i < n0; i++) { daxpy_(&n, &ap[i], (void*)xp, &incx, (void*)yp, &incy); xp += n; yp += n; } } else { double_complex *ap = COMPLEXP(alpha); double_complex *xp = COMPLEXP(x); double_complex *yp = COMPLEXP(y); for (int i = 0; i < n0; i++) { zaxpy_(&n, (void*)(&ap[i]), (void*)xp, &incx, (void*)yp, &incy); xp += n; yp += n; } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/000077500000000000000000000000001316441372200212765ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/bmgs.c000066400000000000000000000010631316441372200223720ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include "fd.c" #include "wfd.c" #include "relax.c" #include "wrelax.c" #include "cut.c" #include "zero.c" #include "paste.c" #include "spline.c" #include "stencils.c" #include "restrict.c" #include "translate.c" #include "interpolate.c" #define BMGSCOMPLEX #include "fd.c" #include "wfd.c" #include "cut.c" #include "zero.c" #include "paste.c" #include "restrict.c" #include "interpolate.c" gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/bmgs.h000066400000000000000000000115331316441372200224020ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #ifndef DOUBLECOMPLEXDEFINED # define DOUBLECOMPLEXDEFINED 1 # include typedef double complex double_complex; #endif #undef T #undef Z #ifndef BMGSCOMPLEX # define T double # define Z(f) f #else # define T double_complex # define Z(f) f ## z #endif #ifndef BMGS_H #define BMGS_H //#ifdef NO_C99_COMPLEX typedef int bool; #define true 1 #define false 0 //#else //#include //#endif typedef struct { int ncoefs; double* coefs; long* offsets; long n[3]; long j[3]; } bmgsstencil; typedef struct { int l; double dr; int nbins; double* data; } bmgsspline; bmgsstencil bmgs_stencil(int ncoefs, const double* coefs, const long* offsets, int range, const long size[3]); bmgsstencil bmgs_laplace(int k, double scale, const double h[3], const long n[3]); bmgsstencil bmgs_mslaplaceA(double scale, const double h[3], const long n[3]); bmgsstencil bmgs_mslaplaceB(const long n[3]); bmgsstencil bmgs_gradient(int k, int i, double h, const long n[3]); void bmgs_deletestencil(bmgsstencil* spline); bmgsspline bmgs_spline(int l, double dr, int nbins, double* f); double bmgs_splinevalue(const bmgsspline* spline, double r); void bmgs_get_value_and_derivative(const bmgsspline* spline, double r, double *f, double *dfdr); void bmgs_deletespline(bmgsspline* spline); void bmgs_radial1(const bmgsspline* spline, const int n[3], const double C[3], const double h[3], int* b, double* d); void bmgs_radial2(const bmgsspline* spline, const int n[3], const int* b, const double* d, double* f, double* g); void bmgs_radial3(const bmgsspline* spline, int m, const int n[3], const double C[3], const double h[3], const double* f, double* a); void bmgs_radiald3(const bmgsspline* spline, int m, int c, const int n[3], const double C[3], const double h[3], const double* f, const double* g, double* a); void bmgs_fd(const bmgsstencil* s, const double* a, double* b); void bmgs_wfd(int nweights, const bmgsstencil* stencils, const double** weights, const double* a, double* b); void bmgs_relax(const int relax_method, const bmgsstencil* s, double* a, double* b, const double* src, const double w); void bmgs_wrelax(const int relax_method, const int nweights, const bmgsstencil* stencils, const double** weights, double* a, double* b, const double* src, const double w); void bmgs_cut(const double* a, const int n[3], const int c[3], double* b, const int m[3]); void bmgs_zero(double* a, const int n[3], const int c[3], const int s[3]); void bmgs_paste(const double* a, const int n[3], double* b, const int m[3], const int c[3]); void bmgs_pastep(const double* a, const int n[3], double* b, const int m[3], const int c[3]); void bmgs_rotate(const double* a, const int size[3], double* b, double angle, int d, long c, double*, long*, long*, double*, long*, long*, int exact); void bmgs_translate(double* a, const int sizea[3], const int size[3], const int start1[3], const int start2[3]); void bmgs_restrict(int k, double* a, const int n[3], double* b, double* w); void bmgs_interpolate(int k, int skip[3][2], const double* a, const int n[3], double* b, double* w); // complex routines: void bmgs_fdz(const bmgsstencil* s, const double_complex* a, double_complex* b); void bmgs_wfdz(int nweights, const bmgsstencil* stencils, const double** weights, const double_complex* a, double_complex* b); void bmgs_cutz(const double_complex* a, const int n[3], const int c[3], double_complex* b, const int m[3]); void bmgs_cutmz(const double_complex* a, const int n[3], const int c[3], double_complex* b, const int m[3], double_complex phase); void bmgs_zeroz(double_complex* a, const int n[3], const int c[3], const int s[3]); void bmgs_pastez(const double_complex* a, const int n[3], double_complex* b, const int m[3], const int c[3]); void bmgs_pastepz(const double_complex* a, const int n[3], double_complex* b, const int m[3], const int c[3]); void bmgs_rotatez(const double_complex* a, const int size[3], double_complex* b, double angle, int d, long c, double*, long*, long*, double*, long*, long*, int exact); void bmgs_translatemz(double_complex* a, const int sizea[3], const int size[3], const int start1[3], const int start2[3], double_complex phase); void bmgs_restrictz(int k, double_complex* a, const int n[3], double_complex* b, double_complex* w); void bmgs_interpolatez(int k, int skip[3][2], const double_complex* a, const int n[3], double_complex* b, double_complex* w); #endif gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/cut.c000066400000000000000000000017531316441372200222430ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include #include "bmgs.h" void Z(bmgs_cut)(const T* a, const int n[3], const int c[3], T* b, const int m[3]) { a += c[2] + (c[1] + c[0] * n[1]) * n[2]; for (int i0 = 0; i0 < m[0]; i0++) { for (int i1 = 0; i1 < m[1]; i1++) { memcpy(b, a, m[2] * sizeof(T)); a += n[2]; b += m[2]; } a += n[2] * (n[1] - m[1]); } } #ifdef BMGSCOMPLEX void bmgs_cutmz(const double_complex* a, const int sizea[3], const int start[3], double_complex* b, const int sizeb[3], double_complex p) { a += start[2] + (start[1] + start[0] * sizea[1]) * sizea[2]; for (int i0 = 0; i0 < sizeb[0]; i0++) { for (int i1 = 0; i1 < sizeb[1]; i1++) { for (int i2 = 0; i2 < sizeb[2]; i2++) b[i2] = p * a[i2]; a += sizea[2]; b += sizeb[2]; } a += sizea[2] * (sizea[1] - sizeb[1]); } } #endif gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/fd.c000066400000000000000000000037111316441372200220350ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include "../extensions.h" #include "bmgs.h" #include struct Z(fds){ int thread_id; int nthds; const bmgsstencil* s; const T* a; T* b; }; void *Z(bmgs_fd_worker)(void *threadarg) { struct Z(fds) *args = (struct Z(fds) *) threadarg; const T* a = args->a; T* b = args->b; const bmgsstencil* s = args->s; int chunksize = s->n[0] / args->nthds + 1; int nstart = args->thread_id * chunksize; if (nstart >= s->n[0]) return NULL; int nend = nstart + chunksize; if (nend > s->n[0]) nend = s->n[0]; for (int i0 = nstart; i0 < nend; i0++) { const T* aa = a + i0 * (s->j[1] + s->n[1] * (s->j[2] + s->n[2])); T* bb = b + i0 * s->n[1] * s->n[2]; for (int i1 = 0; i1 < s->n[1]; i1++) { #pragma omp simd for (int i2 = 0; i2 < s->n[2]; i2++) { T x = 0.0; for (int c = 0; c < s->ncoefs; c++) x += aa[s->offsets[c]+i2] * s->coefs[c]; bb[i2] = x; } bb += s->n[2]; aa += s->j[2] + s->n[2]; } } return NULL; } void Z(bmgs_fd)(const bmgsstencil* s, const T* a, T* b) { a += (s->j[0] + s->j[1] + s->j[2]) / 2; int nthds = 1; #ifdef GPAW_OMP_MONLY if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct Z(fds) *wargs = GPAW_MALLOC(struct Z(fds), nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->s = s; (wargs+i)->a = a; (wargs+i)->b = b; } #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, Z(bmgs_fd_worker), (void*) (wargs+i)); #endif Z(bmgs_fd_worker)(wargs); #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/interpolate.c000066400000000000000000000101111316441372200237620ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include "bmgs.h" #include #include "../extensions.h" #ifdef K struct IP1DA{ int thread_id; int nthds; const T* a; int n; int m; T* b; int *skip; }; void *IP1DW(void *threadarg) { struct IP1DA *args = (struct IP1DA *) threadarg; int m = args->m; int chunksize = m / args->nthds + 1; int nstart = args->thread_id * chunksize; if (nstart >= m) return NULL; int nend = nstart + chunksize; if (nend > m) nend = m; for (int j = nstart; j < nend; j++) { const T* aa = args->a + j * (K - 1 - args->skip[1] + args->n); T* bb = args->b + j; for (int i = 0; i < args->n; i++) { if (i == 0 && args->skip[0]) bb -= m; else bb[0] = aa[0]; if (i == args->n - 1 && args->skip[1]) bb -= m; else { if (K == 2) bb[m] = 0.5 * (aa[0] + aa[1]); else if (K == 4) bb[m] = ( 0.5625 * (aa[ 0] + aa[1]) + -0.0625 * (aa[-1] + aa[2])); else if (K == 6) bb[m] = ( 0.58593750 * (aa[ 0] + aa[1]) + -0.09765625 * (aa[-1] + aa[2]) + 0.01171875 * (aa[-2] + aa[3])); else bb[m] = ( 0.59814453125 * (aa[ 0] + aa[1]) + -0.11962890625 * (aa[-1] + aa[2]) + 0.02392578125 * (aa[-2] + aa[3]) + -0.00244140625 * (aa[-3] + aa[4])); } aa++; bb += 2 * m; } } return NULL; } void IP1D(const T* a, int n, int m, T* b, int skip[2]) { a += K / 2 - 1; int nthds = 1; #ifdef GPAW_OMP_MONLY if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct IP1DA *wargs = GPAW_MALLOC(struct IP1DA, nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->a = a; (wargs+i)->n = n; (wargs+i)->m = m; (wargs+i)->b = b; (wargs+i)->skip = skip; } #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, IP1DW, (void*) (wargs+i)); #endif IP1DW(wargs); #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); } #else # define K 2 # define IP1D Z(bmgs_interpolate1D2) # define IP1DA Z(bmgs_interpolate1D2_args) # define IP1DW Z(bmgs_interpolate1D2_worker) # include "interpolate.c" # undef IP1D # undef IP1DA # undef IP1DW # undef K # define K 4 # define IP1D Z(bmgs_interpolate1D4) # define IP1DA Z(bmgs_interpolate1D4_args) # define IP1DW Z(bmgs_interpolate1D4_worker) # include "interpolate.c" # undef IP1D # undef IP1DA # undef IP1DW # undef K # define K 6 # define IP1D Z(bmgs_interpolate1D6) # define IP1DA Z(bmgs_interpolate1D6_args) # define IP1DW Z(bmgs_interpolate1D6_worker) # include "interpolate.c" # undef IP1D # undef IP1DA # undef IP1DW # undef K # define K 8 # define IP1D Z(bmgs_interpolate1D8) # define IP1DA Z(bmgs_interpolate1D8_args) # define IP1DW Z(bmgs_interpolate1D8_worker) # include "interpolate.c" # undef IP1D # undef IP1DA # undef IP1DW # undef K void Z(bmgs_interpolate)(int k, int skip[3][2], const T* a, const int size[3], T* b, T* w) { void (*ip)(const T*, int, int, T*, int[2]); if (k == 2) ip = Z(bmgs_interpolate1D2); else if (k == 4) ip = Z(bmgs_interpolate1D4); else if (k == 6) ip = Z(bmgs_interpolate1D6); else ip = Z(bmgs_interpolate1D8); int e = k - 1; ip(a, size[2] - e + skip[2][1], size[0] * size[1], b, skip[2]); ip(b, size[1] - e + skip[1][1], size[0] * ((size[2] - e) * 2 - skip[2][0] + skip[2][1]), w, skip[1]); ip(w, size[0] - e + skip[0][1], ((size[1] - e) * 2 - skip[1][0] + skip[1][1]) * ((size[2] - e) * 2 - skip[2][0] + skip[2][1]), b, skip[0]); } #endif gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/paste.c000066400000000000000000000016341316441372200225620ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include "bmgs.h" void Z(bmgs_paste)(const T* a, const int sizea[3], T* b, const int sizeb[3], const int startb[3]) { b += startb[2] + (startb[1] + startb[0] * sizeb[1]) * sizeb[2]; for (int i0 = 0; i0 < sizea[0]; i0++) { for (int i1 = 0; i1 < sizea[1]; i1++) { memcpy(b, a, sizea[2] * sizeof(T)); a += sizea[2]; b += sizeb[2]; } b += sizeb[2] * (sizeb[1] - sizea[1]); } } void Z(bmgs_pastep)(const T* a, const int sizea[3], T* b, const int sizeb[3], const int startb[3]) { b += startb[2] + (startb[1] + startb[0] * sizeb[1]) * sizeb[2]; for (int i0 = 0; i0 < sizea[0]; i0++) { for (int i1 = 0; i1 < sizea[1]; i1++) { for (int i2 = 0; i2 < sizea[2]; i2++) b[i2] += *a++; b += sizeb[2]; } b += sizeb[2] * (sizeb[1] - sizea[1]); } } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/relax.c000066400000000000000000000037011316441372200225560ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include "bmgs.h" void bmgs_relax(const int relax_method, const bmgsstencil* s, double* a, double* b, const double* src, const double w) { if (relax_method == 1) { /* Weighted Gauss-Seidel relaxation for the equation "operator" b = src a contains the temporary array holding also the boundary values. */ // Coefficient needed multiple times later const double coef = 1.0/s->coefs[0]; // The number of steps in each direction long nstep[3] = {s->n[0], s->n[1], s->n[2]}; a += (s->j[0] + s->j[1] + s->j[2]) / 2; for (int i0 = 0; i0 < nstep[0]; i0++) { for (int i1 = 0; i1 < nstep[1]; i1++) { #pragma omp simd for (int i2 = 0; i2 < nstep[2]; i2++) { double x = 0.0; for (int c = 1; c < s->ncoefs; c++) x += a[s->offsets[c] + i2] * s->coefs[c]; x = (src[i2] - x) * coef; b[i2] = x; a[i2] = x; } src += nstep[2]; b += nstep[2]; a += s->j[2] + nstep[2]; } a += s->j[1]; } } else { /* Weighted Jacobi relaxation for the equation "operator" b = src a contains the temporariry array holding also the boundary values. */ a += (s->j[0] + s->j[1] + s->j[2]) / 2; for (int i0 = 0; i0 < s->n[0]; i0++) { for (int i1 = 0; i1 < s->n[1]; i1++) { #pragma omp simd for (int i2 = 0; i2 < s->n[2]; i2++) { double x = 0.0; for (int c = 1; c < s->ncoefs; c++) x += a[s->offsets[c] + i2] * s->coefs[c]; b[i2] = (1.0 - w) * b[i2] + w * (src[i2] - x)/s->coefs[0]; } src += s->n[2]; b += s->n[2]; a += s->j[2] + s->n[2]; } a += s->j[1]; } } } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/restrict.c000066400000000000000000000070651316441372200233110ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include "bmgs.h" #include #include "../extensions.h" #ifdef K struct RST1DA{ int thread_id; int nthds; const T* a; int n; int m; T* b; }; void *RST1DW(void *threadarg) { struct RST1DA *args = (struct RST1DA *) threadarg; int m = args->m; int chunksize = m / args->nthds + 1; int nstart = args->thread_id * chunksize; if (nstart >= m) return NULL; int nend = nstart + chunksize; if (nend > m) nend = m; for (int j = 0; j < m; j++) { const T* aa = args->a + j * (args->n * 2 + K * 2 - 3); T* bb = args->b + j; for (int i = 0; i < args->n; i++) { if (K == 2) bb[0] = 0.5 * (aa[0] + 0.5 * (aa[1] + aa[-1])); else if (K == 4) bb[0] = 0.5 * (aa[0] + 0.5625 * (aa[1] + aa[-1]) + -0.0625 * (aa[3] + aa[-3])); else if (K == 6) bb[0] = 0.5 * (aa[0] + 0.58593750 * (aa[1] + aa[-1]) + -0.09765625 * (aa[3] + aa[-3]) + 0.01171875 * (aa[5] + aa[-5])); else bb[0] = 0.5 * (aa[0] + 0.59814453125 * (aa[1] + aa[-1]) + -0.11962890625 * (aa[3] + aa[-3]) + 0.02392578125 * (aa[5] + aa[-5]) + -0.00244140625 * (aa[7] + aa[-7])); aa += 2; bb += m; } } return NULL; } void RST1D(const T* a, int n, int m, T* b) { a += K - 1; int nthds = 1; #ifdef GPAW_OMP_MONLY if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct RST1DA *wargs = GPAW_MALLOC(struct RST1DA, nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->a = a; (wargs+i)->n = n; (wargs+i)->m = m; (wargs+i)->b = b; } #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, RST1DW, (void*) (wargs+i)); #endif RST1DW(wargs); #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); } #else # define K 2 # define RST1D Z(bmgs_restrict1D2) # define RST1DA Z(bmgs_restrict1D2_args) # define RST1DW Z(bmgs_restrict1D2_worker) # include "restrict.c" # undef RST1D # undef RST1DA # undef RST1DW # undef K # define K 4 # define RST1D Z(bmgs_restrict1D4) # define RST1DA Z(bmgs_restrict1D4_args) # define RST1DW Z(bmgs_restrict1D4_worker) # include "restrict.c" # undef RST1D # undef RST1DA # undef RST1DW # undef K # define K 6 # define RST1D Z(bmgs_restrict1D6) # define RST1DA Z(bmgs_restrict1D6_args) # define RST1DW Z(bmgs_restrict1D6_worker) # include "restrict.c" # undef RST1D # undef RST1DA # undef RST1DW # undef K # define K 8 # define RST1D Z(bmgs_restrict1D8) # define RST1DA Z(bmgs_restrict1D8_args) # define RST1DW Z(bmgs_restrict1D8_worker) # include "restrict.c" # undef RST1D # undef RST1DA # undef RST1DW # undef K void Z(bmgs_restrict)(int k, T* a, const int n[3], T* b, T* w) { void (*plg)(const T*, int, int, T*); if (k == 2) plg = Z(bmgs_restrict1D2); else if (k == 4) plg = Z(bmgs_restrict1D4); else if (k == 6) plg = Z(bmgs_restrict1D6); else plg = Z(bmgs_restrict1D8); int e = k * 2 - 3; plg(a, (n[2] - e) / 2, n[0] * n[1], w); plg(w, (n[1] - e) / 2, n[0] * (n[2] - e) / 2, a); plg(a, (n[0] - e) / 2, (n[1] - e) * (n[2] - e) / 4, b); } #endif gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/sharmonic.py000066400000000000000000000625361316441372200236470ustar00rootroot00000000000000import numpy as np from Numeric import pi, sqrt from tools import factorial from tools import Rational as Q """ This is a script designed for construction of the real solid spherical harmonics (RSSH) in cartesian form. These can be written as:: m |m| l |m| Y = Y = C r P (cos theta) Phi (phi) L l l l m where C_l^|m| is a normalization constant P_l^|m| is the associatied legendre polynomial and: / cos(m phi) , m > 0 Phi (phi) = | 1 , m = 0 m \ sin(-m phi), m < 0 The first few harmonics are listed below:: +----+---------------------+-__---------------------------------------+ | L | l | m | r^l * Y | \/ (r^l * Y) | +----+---s----+------------+------------------------------------------+ | 0 | 0 | 0 | 1 | (0, 0, 0) | +----+---p----+------------+------------------------------------------+ | 1 | 1 | -1 | y | (0, 1, 0) | | 2 | 1 | 0 | z | (0, 0, 1) | | 3 | 1 | 1 | x | (1, 0, 0) | +----+---d----+------------+------------------------------------------+ | 4 | 2 | -2 | xy | ( y, x, 0) | | 5 | 2 | -1 | yz | ( 0, z, y) | | 6 | 2 | 0 | 3z^2-r^2 | (-x, -y, 2z) | | 7 | 2 | 1 | xz | ( z, 0, x) | | 8 | 2 | 2 | x^2-y^2 | ( x, -y, 0) | +----+---f----+------------+------------------------------------------+ | 9 | 3 | -3 | 3x^2y-y^3 | ( 2xy, x^2-y^2, 0) | | 10 | 3 | -2 | xyz | ( yz, xz, xy) | | 11 | 3 | -1 | 5yz^2-yr^2 | ( -2xy, 4z^2-x^2-3y^2, 8yz) | | 12 | 3 | 0 | 5z^3-3zr^2 | ( -2xz, -2yz, 3z^2-r^2) | | 13 | 3 | 1 | 5xz^2-xr^2 | (4z^2-3x^2-y^2, -2xy, 8xz) | | 14 | 3 | 2 | x^2z-y^2z | ( 2xz, -2yz, x^2-y^2) | | 15 | 3 | 3 | x^3-3xy^2 | ( x^2-y^2, -2xy, 0) | +----+--------+----------+--------------------------------------------+ Y_lm is represented as a polynomial in x, y, and z The function consists of three parts: a normalization constant accessed by class 'Normalization(l, m)', a polynomial in z accessed with method 'legendre(l, m)', and a polynomial in x and y accessed with method 'Phi(l, m)' The normalization and the z-polynomial are both invariant of the sign of m The z-polynomial has powers l-|m|, l-|m|-2, l-|m|-4, l-..., i.e. it is strictly odd (even) if l-|m| is odd (even) The combined power of x and y is |m| in all terms of Phi """ Y_lp = [{}, {}] # Global list of dictionaries for storing calculated # Legendre polynomials, and Phi functions #--------------------------- RELEVANT USER METHODS --------------------------- def L_to_lm(L): """convert L index to (l, m) index""" l = int(sqrt(L)) m = L - l**2 - l return l, m def lm_to_L(l,m): """convert (l, m) index to L index""" return l**2 + l + m def Y_to_string(l, m, deriv=None, multiply=None, numeric=False): # for L in range(40): print L, Y_to_string(*L_to_lm(L)) """ l m If deriv is None, return string representation of r * Y (x, y, z) l If deriv == q, return string is the derivative of above with respect to x, y or z if q is 0, 1 or 2 respectively. multiply=q indicates that the entire expression should be multiplied by x, y or z if q is 0, 1 or 2 respectively. numeric=True/False indicates whether the normalization constant should be written as a numeric or an algebraic expression. """ assert deriv is None or deriv in range(3) assert multiply is None or multiply in range(3) if deriv is None: norm, xyzs = Y_collect(l, m) else: norm, xyzs = dYdq(l, m, deriv) if multiply is not None: xyzs = q_times_xyzs(xyzs, multiply) string = to_string(l, xyzs, deriv is not None, multiply is not None) if string == '0': return '0' else: return norm.tostring(numeric) + (' * ' + string) * (string != '1') def gauss_to_string(l, m, numeric=False): """Return string representation of the generalized gaussian:: _____ 2 m / 1 l! l+3/2 -a r l m g (x,y,z) = / ----- --------- (4 a) e r Y (x,y,z) l \/ 4 pi (2l + 1)! l numeric=True/False indicates whether the normalization constant should be written as a number or an algebraic expression. """ norm, xyzs = Y_collect(l, m) ng = Q(2**(2*l+3) * factorial(l), 2 * factorial(2 * l + 1)) norm.multiply(ng) string = to_string(l, xyzs) string = (' * ' + string) * (string != '1') if numeric: snorm = repr(eval(repr(norm.norm))) else: snorm = repr(norm.norm) string = 'sqrt(a**%s*%s)/pi'%(2*l+3, snorm) + string string += ' * exp(-a*r2)' return string def gauss_potential_to_string(l, m, numeric=False): """Return string representation of the potential of a generalized gaussian. The potential is determined by:: m m ^ _ m ^ v [g (r) Y (r) ](r) = v (r) Y (r) l l l l l l where:: 4 pi / -l-1 /r l+2 l /oo 1-l \ v (r) = ---- | r | dx x g (r) + r | dx x g (r) | l 2l+1 \ /0 l /r l / """ v_l = [[Q(4,1), 1], [Q(4,3), 1, 2], [Q(4,15), 3, 6, 4], [Q(4,105), 15, 30, 20, 8], [Q(4,945), 105, 210, 140, 56, 16], [Q(4,10395), 945, 1890, 1260, 504, 144, 32], ] norm, xyzs = Y_collect(l, m) norm.multiply(v_l[l][0]) string = txt_sqrt(norm.norm, numeric) + '*' + (l!=0)*'(' if numeric: string += repr(v_l[l][1] * sqrt(pi)) else: string += str(v_l[l][1]) + '*sqrt(pi)' string += '*erf(sqrt(a)*r)' if len(v_l[l]) > 2: string += '-(' for n, coeff in enumerate(v_l[l][2:]): if n == 0: string += str(coeff) else: string += '+' + str(coeff) + '*(sqrt(a)*r)**%d'%(2*n) string += ')*sqrt(a)*r*exp(-a*r2)' if l == 0: string += '/r' elif l == 1: string += ')/r/r2*' + to_string(l, xyzs) else: string += ')/r/r2**%d*'%l + to_string(l, xyzs) return string #----------------------------- TECHNICAL METHODS ----------------------------- def to_string(l, xyzs, deriv=False, multiply=False): """Return string representation of an xyz dictionary""" if xyzs == {}: return '0' out = '' for xyz, coef in xyzs.items(): x, y, z = xyz r = l - x - y - z - deriv + multiply one = abs(coef) != 1 or (x == 0 and y == 0 and z == 0 and r == 0) out += sign(coef) + str(abs(coef)) * one out += ('*x'*x + '*y'*y + '*z'*z + '*r2'*(r/2))[1 - one:] if out[0] == '+': out = out[1:] if len(xyzs) > 1: out = '(' + out + ')' return out def sign(x): """Return string representation of the sign of x""" if x >= 0: return '+' else: return '-' def txt_sqrt(norm, numeric=False): if numeric: return repr(sqrt(norm)) else: if sqrt(norm) % 1 == 0: return str(sqrt(norm)) else: return 'sqrt(' + str(norm.nom) + \ ('./' + str(norm.denom)) * (norm.denom != 1) + ')' class Normalization: """Determine normalization factor of spherical harmonic ______________ / / 2l+1 (l-m)! | / ---- * ------ , m != 0 | \/ 2 pi (l+m)! C = < _____ L | / 2l+1 | / ---- , m = 0 \ \/ 4 pi """ def __init__(self, l, m): m = abs(m) if m == 0: self.norm = Q(2 * l + 1, 4) else: self.norm = Q((2 * l + 1) * factorial(l - m), 2 * factorial(l + m)) def __str__(self): n = self.norm sn = sqrt(n) if int(sn) == sn: string = repr(sn) + '/sqrt(pi)' else: string = 'sqrt(' + repr(n.nom) + \ ('./' + repr(n.denom)) * (n.denom != 1) + '/pi)' return string def __repr__(self): return repr(self.__float__()) def __float__(self): return sqrt(self.norm / pi) def multiply(self, x): self.norm *= x**2 def tostring(self, numeric=False): if numeric: return self.__repr__() else: return self.__str__() def legendre(l, m): """Determine z dependence of spherical harmonic. Returns vector, where the p'th element is the coefficient of z^p r^(l-|m|-p). """ # Check if requested has already been calculated if (l, m) in Y_lp[0]: return Y_lp[0][(l, m)] m = abs(m) assert l >= 0 and 0 <= m <=l result = np.zeros(l - m + 1, 'O') if l == m == 0: """Use that 0 P (z) = 1 0 """ result[0] = Q(1) elif l == m: """Use the recursion relation m m-1 P (z) = (2m-1) P (z) m m-1 """ result[:] += (2 * m - 1) * legendre(l - 1, m - 1) elif l == m + 1: """Use the recursion relation l-1 l-1 P (z) = (2l-1)z P (z) l l-1 """ result[1:] += (2 * l - 1) * legendre(l-1, l-1) else: """Use the recursion relation m 2l-1 m l+m-1 2 m P (z)= ---- z P (z) - ----- r P (z) l l-m l-1 l-m l-2 """ result[1:] += np.multiply(legendre(l - 1, m), Q(2 * l - 1, l - m)) result[:(l - 2) - m + 1] -= np.multiply(legendre(l - 2, m), Q(l + m - 1, l - m)) # Store result in global dictionary Y_lp[0][(l, m)] = result return result def Phi(m): """Determine the x and y dependence of the spherical harmonics from |m| |m| / r sin (theta) cos(|m| phi), m >= 0 Phi (phi) = | m | |m| |m| \ r sin (theta) sin(|m| phi), m < 0 Returns dictionary of format {(i, j): c} where c is the coefficient of x^i y^j """ # Check if requested has already been calculated if m in Y_lp[1]: return Y_lp[1][m] if m == 0: xys = {(0, 0): 1} # use that Phi_0 = 1 elif m == 1: xys = {(1, 0): 1} # use that Phi_1 = x elif m == -1: xys = {(0, 1): 1} # use that Phi_-1 = y else: """Use the recurrence formula m > 0: Phi (x,y) = x Phi (x,y) - y Phi (x,y) |m| |m|-1 1-|m| m < 0: Phi (x,y) = y Phi (x,y) + x Phi (x,y) |m| |m|-1 1-|m| """ xys = {} phi1 = Phi(abs(m) - 1) phi2 = Phi(1 - abs(m)) for x, y in phi1: new = (x + (m > 0), y + (m < 0)) xys[new] = xys.get(new, 0) + phi1[(x, y)] for x,y in phi2: new = (x + (m < 0), y + (m > 0)) sign = 2 * (m < 0) - 1 xys[new] = xys.get(new, 0) + sign * phi2[(x, y)] # Store result in global dictionary Y_lp[1][m] = xys return xys def Y_collect(l, m): """Collect all necessary parts of spherical harmonic and return in simplified format. Return dictionary xyzs has format {(i, j, k): c} where c is the coefficient of x^i y^j z^k r^(l-|m|-k), or (since i+j = |m|) the coefficient of x^i y^j z^k r^(l-i-j-k), from which it is clear that all terms are of power l in x, y and z collectively. """ zs = legendre(l, m) xys = Phi(m) xyzs = {} for xy in xys: if xys[xy] != 0: for p in range(len(zs)): if zs[p] != 0: xyzs[xy + (p,)] = xys[xy] * zs[p] # get normalization constant and simplify norm = Normalization(l, m) norm.multiply(simplify(xyzs)) return norm, xyzs def Y_collect2(l, m): """Same as Y_collect, but collective power of x, y, and z are adjusted, such the it is always equal to l (thus avoiding multiplication by r) """ norm, p = Y_collect(l, m) done = False while not done: p2 = {} done = True for (nx, ny, nz), c in p.items(): n = nx + ny + nz if n < l: p2[(nx + 2, ny, nz)] = p2.get((nx + 2, ny, nz), 0) + c p2[(nx, ny + 2, nz)] = p2.get((nx, ny + 2, nz), 0) + c p2[(nx, ny, nz + 2)] = p2.get((nx, ny, nz + 2), 0) + c if n + 2 < l: done = False else: assert n == l p2[(nx, ny, nz)] = p2.get((nx, ny, nz), 0) + c p = p2 p2 = p.copy() for n, c in p.items(): if c == 0: del p2[n] return norm, p2 def dYdq(l, m, q): """Returns a normalization constant, and a dictionary describing the functional form of the derivative of r^l Y_l^m(x,y,z) with respect to x, y or z if q is either 0, 1 or 2 respectively. The format of the output dictionary is {(i, j, k): c}, where c is the coefficient of x^i y^j z^k r^(l-i-j-k-1). """ norm, xyzs = Y_collect(l, m) dxyzs = {} for xyz, coef in xyzs.items(): x, y, z = xyz r = l - x - y - z # chain rule: diff coordinate q only if xyz[q] != 0: dxyz = list(xyz) dxyz[q] -= 1 dxyz = tuple(dxyz) dxyzs[dxyz] = dxyzs.get(dxyz, 0) + xyz[q] * coef # chain rule: diff coordinate r only if r != 0: dxyz = list(xyz) dxyz[q] += 1 dxyz = tuple(dxyz) dxyzs[dxyz] = dxyzs.get(dxyz, 0) + r * coef # remove zeros from list for dxyz in dxyzs.keys(): if dxyzs[dxyz] == 0: dxyzs.pop(dxyz) # simplify if dxyzs != {}: norm.multiply(simplify(dxyzs)) return norm, dxyzs def simplify(xyzs): """Rescale coefficients to smallest integer value""" norm = Q(1) numxyz = np.array(xyzs.values()) # up-scale all 'xyz' coefficients to integers for xyz in numxyz: numxyz *= xyz.denom norm /= xyz.denom # determine least common divisor for 'xyz' coefficients dmax = 1 num_max = max(abs(np.floor(numxyz))) for d in range(2, num_max + 1): test = numxyz / d if np.alltrue(test == np.floor(test)): dmax = d # Update simplified dictionary norm *= dmax for i, xyz in enumerate(xyzs): xyzs[xyz] = numxyz[i] / dmax return norm def q_times_xyzs(xyzs, q): """multiply xyz dictionary by x, y, or z according to q = 0, 1, or 2""" qxyzs = {} for xyz, c in xyzs.items(): qxyz = list(xyz) qxyz[q] += 1 qxyz = tuple(qxyz) qxyzs[qxyz] = c return qxyzs #--------------------- TEST AND CODE CONSTRUCTING METHODS --------------------- def orthogonal(L1, L2): """Perform the integral 2pi pi / / I = | |sin(theta) d(theta) d(phi) Y (theta, phi) * Y (theta, phi) / / L1 L2 0 0 which should be a kronecker delta in L1 and L2 """ I = 0.0 N = 40 for theta in np.arange(0, pi, pi / N): for phi in np.arange(0, 2 * pi, 2 * pi / N): x = np.cos(phi) * np.sin(theta) y = np.sin(phi) * np.sin(theta) z = np.cos(theta) r2 = x*x + y*y + z*z Y1 = eval(Y_to_string(*L_to_lm(L1))) Y2 = eval(Y_to_string(*L_to_lm(L2))) I += np.sin(theta) * Y1 * Y2 I *= 2 * (pi / N)**2 return I def check_orthogonality(Lmax=10): """Check orthogonality for all combinations of the first few harmonics""" all_passed = True for L1 in range(Lmax+1): for L2 in range(L1, Lmax+1): I = orthogonal(L1, L2) passed = abs(I - (L1 == L2)) < 3e-3 all_passed *= passed print('L1 = %s, L2 = %s, passed = %s, I = %s' %(L1, L2, passed, I)) if all_passed: print('All tests passed') else: print('Some tests failed') def symmetry1(lmax, display=True): """Make dictionary of format diff = {(l1, m1, q1): (nrel, l2, m2, q2)} indicating that m1 m2 d Y d Y l1 l2 ------ = nrel * ------ d q1 d q2 """ diff = {} # diff[(l1, m1, q1)] = (nrel, l2, m2, q2) unique_L = [] # unique_L[L] = (l, m, q, norm, dxyzs) for L in range((lmax + 1)**2): l, m = L_to_lm(L) for q in range(3): identical = False name = (l, m, 'xyz'[q]) norm, dxyzs = dYdq(l, m, q) for unique in unique_L: if dxyzs == unique[4]: diff[name] = (norm.eval() / unique[3],) + unique[0:3] identical = True break if identical == False: unique_L.append(name + (norm.eval(), dxyzs)) if display: for key, value in diff.items(): print(str(key) + ' = ' + str(value[0]) + ' * ' + str(value[1:])) else: return diff def symmetry2(l, display=True): """Make dictionary of format diff = {(l1, m1, q1): (nrel, l2, m2, q2)} indicating that m1 m2 d Y d Y l1 l2 ------ = nrel * ------ d q1 d q2 and m1 m2 q1 * Y = nrel * q2 * Y l1 l2 """ diff = {} # diff[(l1, m1, q1)] = (nrel, l2, m2, q2) unique_L = [] # unique_L[L] = (l, m, q, dnorm, dxyzs, qnorm, qxyzs) for m in range(-l, l+1): for q in range(3): identical = False name = (l, m, q) qnorm, xyzs = Y_collect(l, m) qxyzs = q_times_xyzs(xyzs, q) dnorm, dxyzs = dYdq(l, m, q) for unique in unique_L: if dxyzs == unique[4] and qxyzs == unique[6]: dnrel = dnorm.eval() / unique[3] qnrel = qnorm.eval() / unique[5] print(dnrel == qnrel) if dnrel == qnrel: diff[name] = (dnrel,) + unique[0:3] identical = True break if identical == False: unique_L.append(name + (dnorm.eval(), dxyzs, qnorm.eval(), qxyzs)) if display: for key, value in diff.items(): print(str(key) + ' = ' + str(value[0]) + ' * ' + str(value[1:])) else: return diff def construct_spherical_harmonic_c_function(file, lmax, funcname, multiply=None, deriv=None): """Construct a macro for evaluating values of spherical harmonics, or the derivative of any spherical harmonic with respect to some axis. The deriv keyword corresponds to that of the Y_to_string function.""" w = file.write indent = 0 def wn(string=''): w(2 * indent * ' ') w(string) w('\\\n') wn('#define %s(l, f, x, y, z, r2, p) (' % funcname) indent = 2 wn('{') wn(' switch(l)') wn(' {') switchindent = 3 indent += switchindent for l in range(lmax + 1): wn('case %d:' % l) indent += 1 for M, m in enumerate(range(-l, l + 1)): Ystr = Y_to_string(l, m, numeric=True, deriv=deriv) wn('p[%d] = f * %s;' % (M, Ystr)) wn('break;') indent -= 1 wn('default:') wn(' assert(0 == 1);') indent -= switchindent wn(' }') wn('}') indent = 0 wn(')') w('\n') def construct_spherical_harmonic_c_code(filename='spherical_harmonics.h', lmax=4): """Construct macros for evaluating spherical harmonics as well as their derivatives.""" file = open(filename, 'w') construct = construct_spherical_harmonic_c_function construct(file, lmax, 'spherical_harmonics') for c in range(3): construct(file, lmax, 'spherical_harmonics_derivative_%s' % 'xyz'[c], multiply=c, deriv=c) file.close() def construct_c_code(file='temp.c', lmax=3): """Method for generating the code in c/spline.c""" txt = '//Computer generated code! Hands off!' start_func = """ // inserts values of f(r) r^l Y_lm(theta, phi) in elements of input array 'a' void bmgs_radial3(const bmgsspline* spline, int m, const int n[3], const double C[3], const double h[3], const double* f, double* a) { int l = spline->l; if (l == 0) for (int q = 0; q < n[0] * n[1] * n[2]; q++) a[q] = 0.28209479177387814 * f[q]; """ start_deriv = """ // insert values of // d( f(r) * r^l Y_l^m ) d( r^l Y_l^m ) // --------------------- = g(r) q r^l Y_l^m + f(r) -------------- // dq dq // where q={x, y, z} and g(r) = 1/r*(df/dr) void bmgs_radiald3(const bmgsspline* spline, int m, int c, const int n[3], const double C[3], const double h[3], const double* f, const double* g, double* a) { int l = spline->l; """ start_case = """ { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { """ end_case = """ z += h[2]; } y += h[1]; } x += h[0]; } } """ # insert code for evaluating the function txt += start_func for l in range(1, lmax + 1): txt += ' else if (l == %s)' %l txt += start_case case = '' for m in range(-l, l+1): if m == -l: case += ' ' * 18 + 'if (m == %s)\n' %m elif m == l: case += '\n' + ' ' * 18 +'else\n' else: case += '\n' + ' ' * 18 + 'else if (m == %s)\n' %m case += ' ' * 20 + 'a[q] = f[q] * ' case += Y_to_string(l,m, numeric=True) + ';' if 'r2' in case: txt += ' ' * 18 + 'double r2 = x*x+y*y+z*z;\n' txt += case txt += end_case txt += """ else assert(0 == 1); } """ # insert code for evaluating the derivative txt += start_deriv for q in range(3): txt += ' // ' + 'xyz'[q] + '\n' for l in range(0, lmax + 1): if l == 0 and q == 0: txt += ' if (c == 0 && l == 0)' else: txt += ' else if (c == %s && l == %s)' %(q, l) txt += start_case case = '' for m in range(-l, l+1): if m == -l: case += ' ' * 18 + 'if (m == %s)\n' %m elif m == l: case += '\n' + ' ' * 18 + 'else\n' else: case += '\n' + ' ' * 18 + 'else if (m == %s)\n' %m case += ' ' * 20 + 'a[q] = g[q] * ' case += Y_to_string(l, m, multiply=q, numeric=True) diff = Y_to_string(l, m, deriv=q, numeric=True) if diff != '0': case += ' + f[q] * ' + diff case += ';' if 'r2' in case: txt += ' ' * 18 + 'double r2 = x*x+y*y+z*z;\n' txt += case txt += end_case txt += """ else assert(0 == 1); } """ f = open(file, 'w') print(txt, file=f) f.close() def construct_gauss_code(lmax=2): """Method for generating the code in gpaw/utilities/gauss.py""" Lmax = (lmax + 1)**2 out= 'Y_L = [\n' for L in range(Lmax): l, m = L_to_lm(L) out+= ' \'' + Y_to_string(l, m, numeric=True) + '\',\n' out += ']' out += '\ngauss_L = [\n' for L in range(Lmax): l, m = L_to_lm(L) out += ' \'' + gauss_to_string(l, m, numeric=True) + '\',\n' out += ']' out += '\ngausspot_L = [\n' for L in range(Lmax): l, m = L_to_lm(L) out += ' \'' + gauss_potential_to_string(l, m, numeric=True) + '\',\n' out += ']' print(out) def construct_spherical_code(lmax=3): """Method for generating the code in gpaw/spherical_harmonics.py""" YL = [] norms = [] for L in range((lmax+1)**2): #norm, xyzs = Y_collect(*L_to_lm(L)) norm, xyzs = Y_collect2(*L_to_lm(L)) norms.append(str(norm)) YL.append(zip(xyzs.values(), xyzs.keys())) print('Y_L = [') for L, Y in enumerate(YL): l = sqrt(L) if l % 1 == 0: print(' #' + 'spdfghijklmn'[int(l)] + ':') print(' %s,' % Y) print(']') print('norms =', norms) if __name__ == '__main__': construct_spherical_harmonic_c_code() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/spherical_harmonics.h000066400000000000000000000152611316441372200254710ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #define spherical_harmonics(l, f, x, y, z, r2, p) (\ {\ switch(l)\ {\ case 0:\ p[0] = f * 0.28209479177387814;\ break;\ case 1:\ p[0] = f * 0.48860251190291992 * y;\ p[1] = f * 0.48860251190291992 * z;\ p[2] = f * 0.48860251190291992 * x;\ break;\ case 2:\ p[0] = f * 1.0925484305920792 * x*y;\ p[1] = f * 1.0925484305920792 * y*z;\ p[2] = f * 0.31539156525252005 * (-r2+3*z*z);\ p[3] = f * 1.0925484305920792 * x*z;\ p[4] = f * 0.54627421529603959 * (-y*y+x*x);\ break;\ case 3:\ p[0] = f * 0.59004358992664352 * (-y*y*y+3*x*x*y);\ p[1] = f * 2.8906114426405538 * x*y*z;\ p[2] = f * 0.45704579946446577 * (5*y*z*z-y*r2);\ p[3] = f * 0.3731763325901154 * (-3*z*r2+5*z*z*z);\ p[4] = f * 0.45704579946446577 * (-x*r2+5*x*z*z);\ p[5] = f * 1.4453057213202769 * (-y*y*z+x*x*z);\ p[6] = f * 0.59004358992664352 * (x*x*x-3*x*y*y);\ break;\ case 4:\ p[0] = f * 2.5033429417967046 * (x*x*x*y-x*y*y*y);\ p[1] = f * 1.7701307697799307 * (3*x*x*y*z-y*y*y*z);\ p[2] = f * 0.94617469575756008 * (-x*y*r2+7*x*y*z*z);\ p[3] = f * 0.66904654355728921 * (-3*y*z*r2+7*y*z*z*z);\ p[4] = f * 0.10578554691520431 * (3*r2*r2-30*z*z*r2+35*z*z*z*z);\ p[5] = f * 0.66904654355728921 * (7*x*z*z*z-3*x*z*r2);\ p[6] = f * 0.47308734787878004 * (y*y*r2+7*x*x*z*z-x*x*r2-7*y*y*z*z);\ p[7] = f * 1.7701307697799307 * (x*x*x*z-3*x*y*y*z);\ p[8] = f * 0.62583573544917614 * (-6*x*x*y*y+x*x*x*x+y*y*y*y);\ break;\ default:\ assert(0 == 1);\ }\ }\ )\ #define spherical_harmonics_derivative_x(l, f, x, y, z, r2, p) (\ {\ switch(l)\ {\ case 0:\ p[0] = f * 0;\ break;\ case 1:\ p[0] = f * 0;\ p[1] = f * 0;\ p[2] = f * 0.48860251190291992;\ break;\ case 2:\ p[0] = f * 1.0925484305920792 * y;\ p[1] = f * 0;\ p[2] = f * 0.63078313050504009 * -x;\ p[3] = f * 1.0925484305920792 * z;\ p[4] = f * 1.0925484305920792 * x;\ break;\ case 3:\ p[0] = f * 3.5402615395598613 * x*y;\ p[1] = f * 2.8906114426405538 * y*z;\ p[2] = f * 0.91409159892893155 * -x*y;\ p[3] = f * 2.2390579955406924 * -x*z;\ p[4] = f * 0.45704579946446577 * (-r2-2*x*x+5*z*z);\ p[5] = f * 2.8906114426405538 * x*z;\ p[6] = f * 1.7701307697799307 * (-y*y+x*x);\ break;\ case 4:\ p[0] = f * 2.5033429417967046 * (-y*y*y+3*x*x*y);\ p[1] = f * 10.620784618679583 * x*y*z;\ p[2] = f * 0.94617469575756008 * (7*y*z*z-y*r2-2*x*x*y);\ p[3] = f * 4.0142792613437353 * -x*y*z;\ p[4] = f * 1.2694265629824517 * (x*r2-5*x*z*z);\ p[5] = f * 0.66904654355728921 * (-3*z*r2-6*x*x*z+7*z*z*z);\ p[6] = f * 0.94617469575756008 * (-x*r2-x*x*x+x*y*y+7*x*z*z);\ p[7] = f * 5.3103923093397913 * (-y*y*z+x*x*z);\ p[8] = f * 2.5033429417967046 * (-3*x*y*y+x*x*x);\ break;\ default:\ assert(0 == 1);\ }\ }\ )\ #define spherical_harmonics_derivative_y(l, f, x, y, z, r2, p) (\ {\ switch(l)\ {\ case 0:\ p[0] = f * 0;\ break;\ case 1:\ p[0] = f * 0.48860251190291992;\ p[1] = f * 0;\ p[2] = f * 0;\ break;\ case 2:\ p[0] = f * 1.0925484305920792 * x;\ p[1] = f * 1.0925484305920792 * z;\ p[2] = f * 0.63078313050504009 * -y;\ p[3] = f * 0;\ p[4] = f * 1.0925484305920792 * -y;\ break;\ case 3:\ p[0] = f * 1.7701307697799307 * (-y*y+x*x);\ p[1] = f * 2.8906114426405538 * x*z;\ p[2] = f * 0.45704579946446577 * (-2*y*y-r2+5*z*z);\ p[3] = f * 2.2390579955406924 * -y*z;\ p[4] = f * 0.91409159892893155 * -x*y;\ p[5] = f * 2.8906114426405538 * -y*z;\ p[6] = f * 3.5402615395598613 * -x*y;\ break;\ case 4:\ p[0] = f * 2.5033429417967046 * (x*x*x-3*x*y*y);\ p[1] = f * 5.3103923093397913 * (-y*y*z+x*x*z);\ p[2] = f * 0.94617469575756008 * (-x*r2-2*x*y*y+7*x*z*z);\ p[3] = f * 0.66904654355728921 * (-6*y*y*z-3*z*r2+7*z*z*z);\ p[4] = f * 1.2694265629824517 * (-5*y*z*z+y*r2);\ p[5] = f * 4.0142792613437353 * -x*y*z;\ p[6] = f * 0.94617469575756008 * (y*y*y-7*y*z*z+y*r2-x*x*y);\ p[7] = f * 10.620784618679583 * -x*y*z;\ p[8] = f * 2.5033429417967046 * (y*y*y-3*x*x*y);\ break;\ default:\ assert(0 == 1);\ }\ }\ )\ #define spherical_harmonics_derivative_z(l, f, x, y, z, r2, p) (\ {\ switch(l)\ {\ case 0:\ p[0] = f * 0;\ break;\ case 1:\ p[0] = f * 0;\ p[1] = f * 0.48860251190291992;\ p[2] = f * 0;\ break;\ case 2:\ p[0] = f * 0;\ p[1] = f * 1.0925484305920792 * y;\ p[2] = f * 1.2615662610100802 * z;\ p[3] = f * 1.0925484305920792 * x;\ p[4] = f * 0;\ break;\ case 3:\ p[0] = f * 0;\ p[1] = f * 2.8906114426405538 * x*y;\ p[2] = f * 3.6563663957157262 * y*z;\ p[3] = f * 1.1195289977703462 * (-r2+3*z*z);\ p[4] = f * 3.6563663957157262 * x*z;\ p[5] = f * 1.4453057213202769 * (-y*y+x*x);\ p[6] = f * 0;\ break;\ case 4:\ p[0] = f * 0;\ p[1] = f * 1.7701307697799307 * (-y*y*y+3*x*x*y);\ p[2] = f * 11.354096349090721 * x*y*z;\ p[3] = f * 2.0071396306718676 * (5*y*z*z-y*r2);\ p[4] = f * 1.6925687506432689 * (-3*z*r2+5*z*z*z);\ p[5] = f * 2.0071396306718676 * (-x*r2+5*x*z*z);\ p[6] = f * 5.6770481745453605 * (-y*y*z+x*x*z);\ p[7] = f * 1.7701307697799307 * (x*x*x-3*x*y*y);\ p[8] = f * 0;\ break;\ default:\ assert(0 == 1);\ }\ }\ )\ gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/spline.c000066400000000000000000000600421316441372200227360ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Please see the accompanying LICENSE file for further information. */ #include #include #include #include "bmgs.h" bmgsspline bmgs_spline(int l, double dr, int nbins, double* f) { double c = 3.0 / (dr * dr); double* f2 = (double*)malloc((nbins + 1) * sizeof(double)); assert(f2 != NULL); double* u = (double*)malloc(nbins * sizeof(double)); assert(u != NULL); f2[0] = -0.5; u[0] = (f[1] - f[0]) * c; for (int b = 1; b < nbins; b++) { double p = 0.5 * f2[b - 1] + 2.0; f2[b] = -0.5 / p; u[b] = ((f[b + 1] - 2.0 * f[b] + f[b - 1]) * c - 0.5 * u[b - 1]) / p; } f2[nbins] = ((f[nbins - 1] * c - 0.5 * u[nbins - 1]) / (0.5 * f2[nbins - 1] + 1.0)); for (int b = nbins - 1; b >= 0; b--) f2[b] = f2[b] * f2[b + 1] + u[b]; double* data = (double*)malloc(4 * (nbins + 1) * sizeof(double)); assert(data != NULL); bmgsspline spline = {l, dr, nbins, data}; for (int b = 0; b < nbins; b++) { *data++ = f[b]; *data++ = (f[b + 1] - f[b]) / dr - (f2[b] / 3 + f2[b + 1] / 6) * dr; *data++ = 0.5 * f2[b]; *data++ = (f2[b + 1] - f2[b]) / (6 * dr); } data[0] = 0.0; data[1] = 0.0; data[2] = 0.0; data[3] = 0.0; free(u); free(f2); return spline; } double bmgs_splinevalue(const bmgsspline* spline, double r) { int b = r / spline->dr; if (b >= spline->nbins) return 0.0; double u = r - b * spline->dr; double* s = spline->data + 4 * b; return s[0] + u * (s[1] + u * (s[2] + u * s[3])); } void bmgs_get_value_and_derivative(const bmgsspline* spline, double r, double *f, double *dfdr) { int b = r / spline->dr; if (b >= spline->nbins) { *f = 0.0; *dfdr = 0.0; return; } double u = r - b * spline->dr; double* s = spline->data + 4 * b; *f = s[0] + u * (s[1] + u * (s[2] + u * s[3])); *dfdr = s[1] + u * (2.0 * s[2] + u * 3.0 * s[3]); } void bmgs_deletespline(bmgsspline* spline) { free(spline->data); } void bmgs_radial1(const bmgsspline* spline, const int n[3], const double C[3], const double h[3], int* b, double* d) { int nbins = spline->nbins; double dr = spline->dr; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double xx = x * x; double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double xxpyy = xx + y * y; double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++) { double r = sqrt(xxpyy + z * z); int j = r / dr; if (j < nbins) { *b++ = j; *d++ = r - j * dr; } else { *b++ = nbins; *d++ = 0.0; } z += h[2]; } y += h[1]; } x += h[0]; } } void bmgs_radial2(const bmgsspline* spline, const int n[3], const int* b, const double* d, double* f, double* g) { double dr = spline->dr; for (int q = 0; q < n[0] * n[1] * n[2]; q++) { int j = b[q]; const double* s = spline->data + 4 * j; double u = d[q]; f[q] = s[0] + u * (s[1] + u * (s[2] + u * s[3])); if (g != 0) { if (j == 0) g[q] = 2.0 * s[2] + u * 3.0 * s[3]; else g[q] = (s[1] + u * (2.0 * s[2] + u * 3.0 * s[3])) / (j * dr + u); } } } //Computer generated code! Hands off! // inserts values of f(r) r^l Y_lm(theta, phi) in elements of input array 'a' void bmgs_radial3(const bmgsspline* spline, int m, const int n[3], const double C[3], const double h[3], const double* f, double* a) { int l = spline->l; if (l == 0) for (int q = 0; q < n[0] * n[1] * n[2]; q++) a[q] = 0.28209479177387814 * f[q]; else if (l == 1) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == -1) a[q] = f[q] * 0.48860251190291992 * y; else if (m == 0) a[q] = f[q] * 0.48860251190291992 * z; else a[q] = f[q] * 0.48860251190291992 * x; z += h[2]; } y += h[1]; } x += h[0]; } } else if (l == 2) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -2) a[q] = f[q] * 1.0925484305920792 * x*y; else if (m == -1) a[q] = f[q] * 1.0925484305920792 * y*z; else if (m == 0) a[q] = f[q] * 0.31539156525252005 * (3*z*z-r2); else if (m == 1) a[q] = f[q] * 1.0925484305920792 * x*z; else a[q] = f[q] * 0.54627421529603959 * (x*x-y*y); z += h[2]; } y += h[1]; } x += h[0]; } } else if (l == 3) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -3) a[q] = f[q] * 0.59004358992664352 * (-y*y*y+3*x*x*y); else if (m == -2) a[q] = f[q] * 2.8906114426405538 * x*y*z; else if (m == -1) a[q] = f[q] * 0.45704579946446577 * (-y*r2+5*y*z*z); else if (m == 0) a[q] = f[q] * 0.3731763325901154 * (5*z*z*z-3*z*r2); else if (m == 1) a[q] = f[q] * 0.45704579946446577 * (5*x*z*z-x*r2); else if (m == 2) a[q] = f[q] * 1.4453057213202769 * (x*x*z-y*y*z); else a[q] = f[q] * 0.59004358992664352 * (x*x*x-3*x*y*y); z += h[2]; } y += h[1]; } x += h[0]; } } else if (l == 4) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -4) a[q] = f[q] * 2.5033429417967046 * (x*x*x*y-x*y*y*y); else if (m == -3) a[q] = f[q] * 1.7701307697799307 * (-y*y*y*z+3*x*x*y*z); else if (m == -2) a[q] = f[q] * 0.94617469575756008 * (-x*y*r2+7*x*y*z*z); else if (m == -1) a[q] = f[q] * 0.66904654355728921 * (-3*y*z*r2+7*y*z*z*z); else if (m == 0) a[q] = f[q] * 0.10578554691520431 * (-30*z*z*r2+3*r2*r2+35*z*z*z*z); else if (m == 1) a[q] = f[q] * 0.66904654355728921 * (7*x*z*z*z-3*x*z*r2); else if (m == 2) a[q] = f[q] * 0.47308734787878004 * (-x*x*r2+7*x*x*z*z+y*y*r2-7*y*y*z*z); else if (m == 3) a[q] = f[q] * 1.7701307697799307 * (x*x*x*z-3*x*y*y*z); else a[q] = f[q] * 0.62583573544917614 * (-6*x*x*y*y+x*x*x*x+y*y*y*y); z += h[2]; } y += h[1]; } x += h[0]; } } else assert(0 == 1); } // insert values of // d( f(r) * r^l Y_l^m ) d( r^l Y_l^m ) // --------------------- = g(r) q r^l Y_l^m + f(r) -------------- // dq dq // where q={x, y, z} and g(r) = 1/r*(df/dr) void bmgs_radiald3(const bmgsspline* spline, int m, int c, const int n[3], const double C[3], const double h[3], const double* f, const double* g, double* a) { int l = spline->l; // x if (c == 0 && l == 0) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == 0) a[q] = g[q] * 0.28209479177387814 * x; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 0 && l == 1) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == -1) a[q] = g[q] * 0.48860251190291992 * x*y; else if (m == 0) a[q] = g[q] * 0.48860251190291992 * x*z; else a[q] = g[q] * 0.48860251190291992 * x*x + f[q] * 0.48860251190291992; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 0 && l == 2) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -2) a[q] = g[q] * 1.0925484305920792 * x*x*y + f[q] * 1.0925484305920792 * y; else if (m == -1) a[q] = g[q] * 1.0925484305920792 * x*y*z; else if (m == 0) a[q] = g[q] * 0.31539156525252005 * (3*x*z*z-x*r2) + f[q] * 0.63078313050504009 * -x; else if (m == 1) a[q] = g[q] * 1.0925484305920792 * x*x*z + f[q] * 1.0925484305920792 * z; else a[q] = g[q] * 0.54627421529603959 * (x*x*x-x*y*y) + f[q] * 1.0925484305920792 * x; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 0 && l == 3) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -3) a[q] = g[q] * 0.59004358992664352 * (3*x*x*x*y-x*y*y*y) + f[q] * 3.5402615395598613 * x*y; else if (m == -2) a[q] = g[q] * 2.8906114426405538 * x*x*y*z + f[q] * 2.8906114426405538 * y*z; else if (m == -1) a[q] = g[q] * 0.45704579946446577 * (-x*y*r2+5*x*y*z*z) + f[q] * 0.91409159892893155 * -x*y; else if (m == 0) a[q] = g[q] * 0.3731763325901154 * (5*x*z*z*z-3*x*z*r2) + f[q] * 2.2390579955406924 * -x*z; else if (m == 1) a[q] = g[q] * 0.45704579946446577 * (-x*x*r2+5*x*x*z*z) + f[q] * 0.45704579946446577 * (5*z*z-r2-2*x*x); else if (m == 2) a[q] = g[q] * 1.4453057213202769 * (x*x*x*z-x*y*y*z) + f[q] * 2.8906114426405538 * x*z; else a[q] = g[q] * 0.59004358992664352 * (-3*x*x*y*y+x*x*x*x) + f[q] * 1.7701307697799307 * (x*x-y*y); z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 0 && l == 4) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -4) a[q] = g[q] * 2.5033429417967046 * (-x*x*y*y*y+x*x*x*x*y) + f[q] * 2.5033429417967046 * (-y*y*y+3*x*x*y); else if (m == -3) a[q] = g[q] * 1.7701307697799307 * (-x*y*y*y*z+3*x*x*x*y*z) + f[q] * 10.620784618679583 * x*y*z; else if (m == -2) a[q] = g[q] * 0.94617469575756008 * (7*x*x*y*z*z-x*x*y*r2) + f[q] * 0.94617469575756008 * (-y*r2+7*y*z*z-2*x*x*y); else if (m == -1) a[q] = g[q] * 0.66904654355728921 * (-3*x*y*z*r2+7*x*y*z*z*z) + f[q] * 4.0142792613437353 * -x*y*z; else if (m == 0) a[q] = g[q] * 0.10578554691520431 * (-30*x*z*z*r2+3*x*r2*r2+35*x*z*z*z*z) + f[q] * 1.2694265629824517 * (-5*x*z*z+x*r2); else if (m == 1) a[q] = g[q] * 0.66904654355728921 * (-3*x*x*z*r2+7*x*x*z*z*z) + f[q] * 0.66904654355728921 * (7*z*z*z-6*x*x*z-3*z*r2); else if (m == 2) a[q] = g[q] * 0.47308734787878004 * (-x*x*x*r2+x*y*y*r2+7*x*x*x*z*z-7*x*y*y*z*z) + f[q] * 0.94617469575756008 * (-x*x*x+7*x*z*z-x*r2+x*y*y); else if (m == 3) a[q] = g[q] * 1.7701307697799307 * (-3*x*x*y*y*z+x*x*x*x*z) + f[q] * 5.3103923093397913 * (x*x*z-y*y*z); else a[q] = g[q] * 0.62583573544917614 * (-6*x*x*x*y*y+x*y*y*y*y+x*x*x*x*x) + f[q] * 2.5033429417967046 * (-3*x*y*y+x*x*x); z += h[2]; } y += h[1]; } x += h[0]; } } // y else if (c == 1 && l == 0) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == 0) a[q] = g[q] * 0.28209479177387814 * y; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 1 && l == 1) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == -1) a[q] = g[q] * 0.48860251190291992 * y*y + f[q] * 0.48860251190291992; else if (m == 0) a[q] = g[q] * 0.48860251190291992 * y*z; else a[q] = g[q] * 0.48860251190291992 * x*y; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 1 && l == 2) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -2) a[q] = g[q] * 1.0925484305920792 * x*y*y + f[q] * 1.0925484305920792 * x; else if (m == -1) a[q] = g[q] * 1.0925484305920792 * y*y*z + f[q] * 1.0925484305920792 * z; else if (m == 0) a[q] = g[q] * 0.31539156525252005 * (-y*r2+3*y*z*z) + f[q] * 0.63078313050504009 * -y; else if (m == 1) a[q] = g[q] * 1.0925484305920792 * x*y*z; else a[q] = g[q] * 0.54627421529603959 * (-y*y*y+x*x*y) + f[q] * 1.0925484305920792 * -y; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 1 && l == 3) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -3) a[q] = g[q] * 0.59004358992664352 * (3*x*x*y*y-y*y*y*y) + f[q] * 1.7701307697799307 * (x*x-y*y); else if (m == -2) a[q] = g[q] * 2.8906114426405538 * x*y*y*z + f[q] * 2.8906114426405538 * x*z; else if (m == -1) a[q] = g[q] * 0.45704579946446577 * (-y*y*r2+5*y*y*z*z) + f[q] * 0.45704579946446577 * (5*z*z-r2-2*y*y); else if (m == 0) a[q] = g[q] * 0.3731763325901154 * (-3*y*z*r2+5*y*z*z*z) + f[q] * 2.2390579955406924 * -y*z; else if (m == 1) a[q] = g[q] * 0.45704579946446577 * (-x*y*r2+5*x*y*z*z) + f[q] * 0.91409159892893155 * -x*y; else if (m == 2) a[q] = g[q] * 1.4453057213202769 * (-y*y*y*z+x*x*y*z) + f[q] * 2.8906114426405538 * -y*z; else a[q] = g[q] * 0.59004358992664352 * (x*x*x*y-3*x*y*y*y) + f[q] * 3.5402615395598613 * -x*y; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 1 && l == 4) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -4) a[q] = g[q] * 2.5033429417967046 * (x*x*x*y*y-x*y*y*y*y) + f[q] * 2.5033429417967046 * (x*x*x-3*x*y*y); else if (m == -3) a[q] = g[q] * 1.7701307697799307 * (3*x*x*y*y*z-y*y*y*y*z) + f[q] * 5.3103923093397913 * (x*x*z-y*y*z); else if (m == -2) a[q] = g[q] * 0.94617469575756008 * (-x*y*y*r2+7*x*y*y*z*z) + f[q] * 0.94617469575756008 * (-2*x*y*y+7*x*z*z-x*r2); else if (m == -1) a[q] = g[q] * 0.66904654355728921 * (-3*y*y*z*r2+7*y*y*z*z*z) + f[q] * 0.66904654355728921 * (7*z*z*z-3*z*r2-6*y*y*z); else if (m == 0) a[q] = g[q] * 0.10578554691520431 * (3*y*r2*r2-30*y*z*z*r2+35*y*z*z*z*z) + f[q] * 1.2694265629824517 * (y*r2-5*y*z*z); else if (m == 1) a[q] = g[q] * 0.66904654355728921 * (-3*x*y*z*r2+7*x*y*z*z*z) + f[q] * 4.0142792613437353 * -x*y*z; else if (m == 2) a[q] = g[q] * 0.47308734787878004 * (-7*y*y*y*z*z+y*y*y*r2+7*x*x*y*z*z-x*x*y*r2) + f[q] * 0.94617469575756008 * (y*r2+y*y*y-7*y*z*z-x*x*y); else if (m == 3) a[q] = g[q] * 1.7701307697799307 * (x*x*x*y*z-3*x*y*y*y*z) + f[q] * 10.620784618679583 * -x*y*z; else a[q] = g[q] * 0.62583573544917614 * (x*x*x*x*y-6*x*x*y*y*y+y*y*y*y*y) + f[q] * 2.5033429417967046 * (y*y*y-3*x*x*y); z += h[2]; } y += h[1]; } x += h[0]; } } // z else if (c == 2 && l == 0) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == 0) a[q] = g[q] * 0.28209479177387814 * z; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 2 && l == 1) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { if (m == -1) a[q] = g[q] * 0.48860251190291992 * y*z; else if (m == 0) a[q] = g[q] * 0.48860251190291992 * z*z + f[q] * 0.48860251190291992; else a[q] = g[q] * 0.48860251190291992 * x*z; z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 2 && l == 2) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -2) a[q] = g[q] * 1.0925484305920792 * x*y*z; else if (m == -1) a[q] = g[q] * 1.0925484305920792 * y*z*z + f[q] * 1.0925484305920792 * y; else if (m == 0) a[q] = g[q] * 0.31539156525252005 * (3*z*z*z-z*r2) + f[q] * 1.2615662610100802 * z; else if (m == 1) a[q] = g[q] * 1.0925484305920792 * x*z*z + f[q] * 1.0925484305920792 * x; else a[q] = g[q] * 0.54627421529603959 * (x*x*z-y*y*z); z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 2 && l == 3) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -3) a[q] = g[q] * 0.59004358992664352 * (-y*y*y*z+3*x*x*y*z); else if (m == -2) a[q] = g[q] * 2.8906114426405538 * x*y*z*z + f[q] * 2.8906114426405538 * x*y; else if (m == -1) a[q] = g[q] * 0.45704579946446577 * (-y*z*r2+5*y*z*z*z) + f[q] * 3.6563663957157262 * y*z; else if (m == 0) a[q] = g[q] * 0.3731763325901154 * (-3*z*z*r2+5*z*z*z*z) + f[q] * 1.1195289977703462 * (3*z*z-r2); else if (m == 1) a[q] = g[q] * 0.45704579946446577 * (5*x*z*z*z-x*z*r2) + f[q] * 3.6563663957157262 * x*z; else if (m == 2) a[q] = g[q] * 1.4453057213202769 * (x*x*z*z-y*y*z*z) + f[q] * 1.4453057213202769 * (x*x-y*y); else a[q] = g[q] * 0.59004358992664352 * (x*x*x*z-3*x*y*y*z); z += h[2]; } y += h[1]; } x += h[0]; } } else if (c == 2 && l == 4) { int q = 0; double x = C[0]; for (int i0 = 0; i0 < n[0]; i0++) { double y = C[1]; for (int i1 = 0; i1 < n[1]; i1++) { double z = C[2]; for (int i2 = 0; i2 < n[2]; i2++, q++) { double r2 = x*x+y*y+z*z; if (m == -4) a[q] = g[q] * 2.5033429417967046 * (x*x*x*y*z-x*y*y*y*z); else if (m == -3) a[q] = g[q] * 1.7701307697799307 * (-y*y*y*z*z+3*x*x*y*z*z) + f[q] * 1.7701307697799307 * (-y*y*y+3*x*x*y); else if (m == -2) a[q] = g[q] * 0.94617469575756008 * (-x*y*z*r2+7*x*y*z*z*z) + f[q] * 11.354096349090721 * x*y*z; else if (m == -1) a[q] = g[q] * 0.66904654355728921 * (-3*y*z*z*r2+7*y*z*z*z*z) + f[q] * 2.0071396306718676 * (-y*r2+5*y*z*z); else if (m == 0) a[q] = g[q] * 0.10578554691520431 * (-30*z*z*z*r2+3*z*r2*r2+35*z*z*z*z*z) + f[q] * 1.6925687506432689 * (5*z*z*z-3*z*r2); else if (m == 1) a[q] = g[q] * 0.66904654355728921 * (-3*x*z*z*r2+7*x*z*z*z*z) + f[q] * 2.0071396306718676 * (5*x*z*z-x*r2); else if (m == 2) a[q] = g[q] * 0.47308734787878004 * (-x*x*z*r2+7*x*x*z*z*z+y*y*z*r2-7*y*y*z*z*z) + f[q] * 5.6770481745453605 * (x*x*z-y*y*z); else if (m == 3) a[q] = g[q] * 1.7701307697799307 * (x*x*x*z*z-3*x*y*y*z*z) + f[q] * 1.7701307697799307 * (x*x*x-3*x*y*y); else a[q] = g[q] * 0.62583573544917614 * (x*x*x*x*z-6*x*x*y*y*z+y*y*y*y*z); z += h[2]; } y += h[1]; } x += h[0]; } } else assert(0 == 1); } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/stencils.c000066400000000000000000000115551316441372200232750ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include #include "bmgs.h" // Expansion coefficients for finite difference Laplacian. The numbers are // from J. R. Chelikowsky et al., Phys. Rev. B 50, 11355 (1994): bmgsstencil bmgs_stencil(int ncoefs, const double* coefs, const long* offsets, int r, const long n[3]) { bmgsstencil stencil = {ncoefs, (double*)malloc(ncoefs * sizeof(double)), (long*)malloc(ncoefs * sizeof(long)), {n[0], n[1], n[2]}, {2 * r * (n[2] + 2 * r) * (n[1] + 2 * r), 2 * r * (n[2] + 2 * r), 2 * r}}; assert((stencil.coefs != NULL) && (stencil.offsets != NULL)); memcpy(stencil.coefs, coefs, ncoefs * sizeof(double)); memcpy(stencil.offsets, offsets, ncoefs * sizeof(long)); return stencil; } static const double laplace[4][5] = {{-2.0, 1.0, 0.0, 0.0, 0.0}, {-5.0/2.0, 4.0/3.0, -1.0/12.0, 0.0, 0.0}, {-49.0/18.0, 3.0/2.0, -3.0/20.0, 1.0/90.0, 0.0}, {-205.0/72.0, 8.0/5.0, -1.0/5.0, 8.0/315.0, -1.0/560.0}}; bmgsstencil bmgs_laplace(int k, double scale, const double h[3], const long n[3]) { int ncoefs = 3 * k - 2; double* coefs = (double*)malloc(ncoefs * sizeof(double)); long* offsets = (long*)malloc(ncoefs * sizeof(long)); assert((coefs != NULL) && (offsets != NULL)); double f1 = 1.0 / (h[0] * h[0]); double f2 = 1.0 / (h[1] * h[1]); double f3 = 1.0 / (h[2] * h[2]); int r = (k - 1) / 2; // range double s[3] = {(n[2] + 2 * r) * (n[1] + 2 * r), n[2] + 2 * r, 1}; int m = 0; for (int j = 1; j <= r; j++) { double c = scale * laplace[r - 1][j]; coefs[m] = c * f1; offsets[m++] = -j * s[0]; coefs[m] = c * f1; offsets[m++] = +j * s[0]; coefs[m] = c * f2; offsets[m++] = -j * s[1]; coefs[m] = c * f2; offsets[m++] = +j * s[1]; coefs[m] = c * f3; offsets[m++] = -j; coefs[m] = c * f3; offsets[m++] = +j; } double c = scale * laplace[r - 1][0]; coefs[m] = c * (f1 + f2 + f3); offsets[m] = 0; bmgsstencil stencil = {ncoefs, coefs, offsets, {n[0], n[1], n[2]}, {2 * r * (n[2] + 2 * r) * (n[1] + 2 * r), 2 * r * (n[2] + 2 * r), 2 * r}}; return stencil; } bmgsstencil bmgs_mslaplaceA(double scale, const double h[3], const long n[3]) { int ncoefs = 19; double* coefs = (double*)malloc(ncoefs * sizeof(double)); long* offsets = (long*)malloc(ncoefs * sizeof(long)); assert((coefs != NULL) && (offsets != NULL)); double e[3] = {-scale / (12.0 * h[0] * h[0]), -scale / (12.0 * h[1] * h[1]), -scale / (12.0 * h[2] * h[2])}; double f = -16.0 * (e[0] + e[1] + e[2]); double g[3] = {10.0 * e[0] + 0.125 * f, 10.0 * e[1] + 0.125 * f, 10.0 * e[2] + 0.125 * f}; double s[3] = {(n[2] + 2) * (n[1] + 2), n[2] + 2, 1}; int m = 0; coefs[m] = f; offsets[m++] = 0; for (int j = -1; j <= 1; j += 2) { coefs[m] = g[0]; offsets[m++] = j * s[0]; coefs[m] = g[1]; offsets[m++] = j * s[1]; coefs[m] = g[2]; offsets[m++] = j * s[2]; } for (int j = -1; j <= 1; j += 2) for (int k = -1; j <= 1; j += 2) { coefs[m] = e[1] + e[2]; offsets[m++] = -j * s[1] - k * s[2]; coefs[m] = e[0] + e[2]; offsets[m++] = -j * s[0] - k * s[2]; coefs[m] = e[0] + e[1]; offsets[m++] = -j * s[0] - k * s[1]; } bmgsstencil stencil = {ncoefs, coefs, offsets, {n[0], n[1], n[2]}, {2 * s[0], 2 * s[1], 2}}; return stencil; } bmgsstencil bmgs_mslaplaceB(const long n[3]) { int ncoefs = 7; double* coefs = (double*)malloc(ncoefs * sizeof(double)); long* offsets = (long*)malloc(ncoefs * sizeof(long)); assert((coefs != NULL) && (offsets != NULL)); double s[3] = {(n[2] + 2) * (n[1] + 2), n[2] + 2, 1}; int k = 0; coefs[k] = 0.5; offsets[k++] = 0; for (int j = -1; j <= 1; j += 2) { coefs[k] = 1.0 / 12.0; offsets[k++] = j * s[0]; coefs[k] = 1.0 / 12.0; offsets[k++] = j * s[1]; coefs[k] = 1.0 / 12.0; offsets[k++] = j * s[2]; } bmgsstencil stencil = {ncoefs, coefs, offsets, {n[0], n[1], n[2]}, {2 * s[0], 2 * s[1], 2}}; return stencil; } bmgsstencil bmgs_gradient(int k, int i, double h, const long n[3]) { int ncoefs = k - 1; double* coefs = (double*)malloc(ncoefs * sizeof(double)); long* offsets = (long*)malloc(ncoefs * sizeof(long)); assert((coefs != NULL) && (offsets != NULL)); int r = 1; double s[3] = {(n[2] + 2 * r) * (n[1] + 2 * r), n[2] + 2 * r, 1}; double c = 0.5 / h; coefs[0] = +c; offsets[0] = +s[i]; coefs[1] = -c; offsets[1] = -s[i]; bmgsstencil stencil = {ncoefs, coefs, offsets, {n[0], n[1], n[2]}, {2 * r * s[0], 2 * r * s[1], 2 * r}}; return stencil; } void bmgs_deletestencil(bmgsstencil* stencil) { free(stencil->coefs); free(stencil->offsets); } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/tools.py000066400000000000000000000075141316441372200230170ustar00rootroot00000000000000def factorial(x): """Return x!, where x is a non-negative integer""" if x < 2: return 1 else: return x * factorial(x - 1) def gcd(a, b): """Return greatest common divisor of a and b. Uses the euclidian algorithm """ if b == 0: return a else: return gcd(b, a % b) class Rational: """Class used to represent rational numbers as fractions, such that no precision is lost during calculation operations. Example usage with Numeric: import numpy as np from tools import Rational as Q n = np.zeros(4, 'O') array([0 , 0 , 0 , 0 ],'O') n[2:4] = [Q(35,12), Q(36,12)] array([0 , 0 , 35./12 , 3 ],'O') 24 * n array([0 , 0 , 70 , 72 ],'O') np.multiply(n, Q(3,9)) array([0 , 0 , 35./36 , 1 ],'O') """ def __init__(self, nom=0, denom=1): ## assert type(nom) == type(denom) == int # ensure that sign is in the nominator nom = cmp(denom, 0) * nom denom = abs(denom) # reduce fraction q = gcd(nom, denom) self.nom = nom / q self.denom = denom / q def __add__(self, x): if type(x) == float: return float(self) + x elif type(x) == int: x = Rational(x) nom = self.nom * x.denom + x.nom * self.denom denom = self.denom * x.denom return Rational(nom, denom) def __radd__(self, x): return self.__add__(x) def __mul__(self, x): if type(x) == float: return float(self) * x elif type(x) == int: x = Rational(x) return Rational(self.nom * x.nom, self.denom * x.denom) def __rmul__(self, x): return self.__mul__(x) def __neg__(self): return Rational(-self.nom, self.denom) def __pos__(self): return self.copy() def __sub__(self, x): return self.__add__(-x) def __rsub__(self, x): return -self.__sub__(x) def __div__(self, x): if type(x) == float: return float(self) / x elif type(x) == int: x = Rational(x) return self.__mul__(Rational(x.denom, x.nom)) def __rdiv__(self, x): if type(x) == float: return x / float(self) elif type(x) == int: x = Rational(x) return x.__mul__(Rational(self.denom, self.nom)) def __pow__(self, p): if p == 0: return Rational(1) if p >= 0 and type(p) == int: return Rational(self.nom**p, self.denom**p) else: return float(self)**p def __mod__(self, x): if type(x) == float: return float(self) % x return Rational(self.nom % (x * self.denom), self.denom) def __rmod__(self, x): if type(x) == int: x = Rational(x) i = self.__int__() return x.__mod__(i) def __abs__(self): return Rational(abs(self.nom), self.denom) def __nonzero__(self): return self.nom.__nonzero__() def __cmp__(self, x): return cmp(float(self), float(x)) def __str__(self): out = str(self.nom) if self.denom != 1: out += './' + str(self.denom) return out def __int__(self): assert self.denom == 1 return self.nom def __float__(self): return float(self.nom) / self.denom def __repr__(self): out = repr(self.nom) if self.denom != 1: out += './' + repr(self.denom) return out def __copy__(self): return Rational(self.nom, self.denom) def floor(self): return int(float(self)) def sqrt(self): return self**.5 def abs(self): return Rational(abs(self.nom), self.denom) def copy(self): return Rational(self.nom, self.denom) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/translate.c000066400000000000000000000026501316441372200234420ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include #include "bmgs.h" void bmgs_translate(double* a, const int sizea[3], const int size[3], const int start1[3], const int start2[3]) { const double* restrict s = a + start1[2] + (start1[1] + start1[0] * sizea[1]) * sizea[2]; double* restrict d = a + start2[2] + (start2[1] + start2[0] * sizea[1]) * sizea[2]; for (int i0 = 0; i0 < size[0]; i0++) { for (int i1 = 0; i1 < size[1]; i1++) { memcpy(d, s, size[2] * sizeof(double)); s += sizea[2]; d += sizea[2]; } s += sizea[2] * (sizea[1] - size[1]); d += sizea[2] * (sizea[1] - size[1]); } } void bmgs_translatemz(double_complex* a, const int sizea[3], const int size[3], const int start1[3], const int start2[3], double_complex phase) { const double_complex* restrict s = a + start1[2] + (start1[1] + start1[0] * sizea[1]) * sizea[2]; double_complex* restrict d = a + start2[2] + (start2[1] + start2[0] * sizea[1]) * sizea[2]; for (int i0 = 0; i0 < size[0]; i0++) { for (int i1 = 0; i1 < size[1]; i1++) { for (int i2 = 0; i2 < size[2]; i2++) d[i2] = phase * s[i2]; s += sizea[2]; d += sizea[2]; } s += sizea[2] * (sizea[1] - size[1]); d += sizea[2] * (sizea[1] - size[1]); } } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/wfd.c000066400000000000000000000055771316441372200222400ustar00rootroot00000000000000/* This file (wfd.c) is a modified copy of fd.c * with added support for nonlocal operator weights. * The original copyright note of fd.c follows: * Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include "bmgs.h" #include #include "../extensions.h" struct Z(wfds){ int thread_id; int nthds; int nweights; const bmgsstencil* s; const double** w; const T* a; T* b; }; void *Z(bmgs_wfd_worker)(void *threadarg) { struct Z(wfds) *args = (struct Z(wfds) *) threadarg; const T* a = args->a; T* b = args->b; const bmgsstencil* stencils = args->s; const int n0 = stencils[0].n[0]; const int n1 = stencils[0].n[1]; const int n2 = stencils[0].n[2]; const int j1 = stencils[0].j[1]; const int j2 = stencils[0].j[2]; const double** weights = (const double**) GPAW_MALLOC(double*, args->nweights); int chunksize = n0 / args->nthds + 1; int nstart = args->thread_id * chunksize; if (nstart >= n0) return NULL; int nend = nstart + chunksize; if (nend > n0) nend = n0; for (int i0 = nstart; i0 < nend; i0++) { const T* aa = a + i0 * (j1 + n1 * (j2 + n2)); T* bb = b + i0 * n1 * n2; for (int iw = 0; iw < args->nweights; iw++) weights[iw] = args->w[iw] + i0 * n1 * n2; for (int i1 = 0; i1 < n1; i1++) { for (int i2 = 0; i2 < n2; i2++) { T x = 0.0; for (int iw = 0; iw < args->nweights; iw++) { const bmgsstencil* s = &(stencils[iw]); T tmp = 0.0; for (int c = 0; c < s->ncoefs; c++) tmp += aa[s->offsets[c]] * s->coefs[c]; tmp *= weights[iw][0]; x += tmp; weights[iw]++; } *bb++ = x; aa++; } aa += j2; } } free(weights); return NULL; } void Z(bmgs_wfd)(int nweights, const bmgsstencil* stencils, const double** weights, const T* a, T* b) { a += (stencils[0].j[0] + stencils[0].j[1] + stencils[0].j[2]) / 2; int nthds = 1; #ifdef GPAW_OMP_MONLY if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct Z(wfds) *wargs = GPAW_MALLOC(struct Z(wfds), nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->nweights = nweights; (wargs+i)->s = stencils; (wargs+i)->w = weights; (wargs+i)->a = a; (wargs+i)->b = b; } #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, Z(bmgs_wfd_worker), (void*) (wargs+i)); #endif Z(bmgs_wfd_worker)(wargs); #ifdef GPAW_OMP_MONLY for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/wrelax.c000066400000000000000000000055351316441372200227540ustar00rootroot00000000000000/* This file (wrelax.c) is a modified copy of relax.c * with added support for nonlocal operator weights. * The original copyright note of relax.c follows: * Copyright (C) 2003-2007 CAMP * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include "bmgs.h" void bmgs_wrelax(const int relax_method, const int nweights, const bmgsstencil* stencils, const double** weights, double* a, double* b, const double* src, const double w) { const int n0 = stencils[0].n[0]; const int n1 = stencils[0].n[1]; const int n2 = stencils[0].n[2]; const int j0 = stencils[0].j[0]; const int j1 = stencils[0].j[1]; const int j2 = stencils[0].j[2]; a += (j0 + j1 + j2) / 2; if (relax_method == 1) { /* Weighted Gauss-Seidel relaxation for the equation "operator" b = src a contains the temporary array holding also the boundary values. */ for (int i0 = 0; i0 < n0; i0++) { for (int i1 = 0; i1 < n1; i1++) { for (int i2 = 0; i2 < n2; i2++) { double x = 0.0; double coef = 0.0; for (int iw = 0; iw < nweights; iw++) { double weight = weights[iw][0]; double tmp = 0.0; const bmgsstencil* s = &(stencils[iw]); for (int c = 1; c < s->ncoefs; c++) tmp += a[s->offsets[c]] * s->coefs[c]; tmp *= weight; x += tmp; coef += weight * s->coefs[0]; weights[iw]++; } x = (*src - x) / coef; *b++ = x; *a++ = x; src++; } a += j2; } a += j1; } } else { /* Weighted Jacobi relaxation for the equation "operator" b = src a contains the temporariry array holding also the boundary values. */ double temp; for (int i0 = 0; i0 < n0; i0++) { for (int i1 = 0; i1 < n1; i1++) { for (int i2 = 0; i2 < n2; i2++) { double x = 0.0; double coef = 0.0; for (int iw = 0; iw < nweights; iw++) { double weight = weights[iw][0]; double tmp = 0.0; const bmgsstencil* s = &(stencils[iw]); for (int c = 1; c < s->ncoefs; c++) tmp += a[s->offsets[c]] * s->coefs[c]; tmp *= weight; x += tmp; coef += weight * s->coefs[0]; weights[iw]++; } temp = (1.0 - w) * *b + w * (*src - x) / coef; *b++ = temp; a++; src++; } a += j2; } a += j1; } } } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/bmgs/zero.c000066400000000000000000000006761316441372200224320ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include #include "bmgs.h" void Z(bmgs_zero)(T* a, const int n[3], const int c[3], const int s[3]) { a += c[2] + (c[1] + c[0] * n[1]) * n[2]; for (int i0 = 0; i0 < s[0]; i0++) { for (int i1 = 0; i1 < s[1]; i1++) { memset(a, 0, s[2] * sizeof(T)); a += n[2]; } a += n[2] * (n[1] - s[1]); } } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/cerf.c000066400000000000000000000132011316441372200214260ustar00rootroot00000000000000#include #include "extensions.h" #include #include #define eps 1.e-15 double_complex itpp_erf(double_complex z); PyObject* cerf(PyObject *self, PyObject *args) { double complex z, res; if (!PyArg_ParseTuple(args, "D", &z)) return NULL; res = itpp_erf(z); return Py_BuildValue("D", &res); } /* taken from http://prdownloads.sourceforge.net/itpp/itpp-3.10.7.tar.bz2 and transformed to C */ /*! * \file * \brief Implementation of scalar functions * \author Tony Ottosson, Pal Frenger and Adam Piatyszek * * $Date: 2006-08-19 10:53:33 +0200 (sob, 19 sie 2006) $ * $Revision: 643 $ * * ------------------------------------------------------------------------- * * IT++ - C++ library of mathematical, signal processing, speech processing, * and communications classes and functions * * Copyright (C) 1995-2006 (see AUTHORS file for a list of contributors) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * ------------------------------------------------------------------------- */ double_complex itpp_cerf_series(double_complex z); double_complex itpp_cerfc_continued_fraction(double_complex z); double_complex itpp_cerf_continued_fraction(double_complex z); double_complex itpp_cerf_rybicki(double_complex z); double cabs(double_complex z) { return sqrt(creal(z) * creal(z) + cimag(z) * cimag(z)); } /* * This function calculates a well known error function erf(z) for * complex z. Three methods are implemented. Which one is used * depends on z. */ double_complex itpp_erf(double_complex z) { // Use the method appropriate to size of z - // there probably ought to be an extra option for NaN z, or infinite z if (cabs(z) < 2.0) return itpp_cerf_series(z); else { if (fabs(creal(z)) < 0.5) // XXX neither rybicki nor continued_fraction seem to work here // return itpp_cerf_rybicki(z); //return itpp_cerf_continued_fraction(z); return itpp_cerf_series(z); else return itpp_cerf_continued_fraction(z); } } /* * Abramawitz and Stegun: Eq. (7.1.5) gives a series for erf(z) good * for all z, but converges faster for smallish abs(z), say abs(z) < 2. */ double_complex itpp_cerf_series(double_complex z) { double_complex sum, term, z2, oldsum; double error; sum = 0.0; term = z; z2 = z * z; oldsum = 1.e32; for (int n = 0; 1; n++) { sum += term / (2. * n + 1); term *= -z2 / (1. * n + 1); error = cabs(sum / oldsum - 1.); if (error < eps) { return sum * (2.0 / sqrt(M_PI)); } oldsum = sum; } } /* * Abramowitz and Stegun: Eq. (7.1.14) gives this continued fraction * for erfc(z) * * erfc(z) = sqrt(pi).exp(-z^2). 1 1/2 1 3/2 2 5/2 * --- --- --- --- --- --- ... * z + z + z + z + z + z + * * This is evaluated using Lentz's method, as described in the * narative of Numerical Recipes in C. * * The continued fraction is true providing real(z) > 0. In practice * we like real(z) to be significantly greater than 0, say greater * than 0.5. */ double_complex itpp_cerfc_continued_fraction(double_complex z) { // first calculate z+ 1/2 1 // --- --- ... // z + z + double_complex f, C, D, delta; double a; // printf("itpp_cerfc_continued_fraction\n"); f = z; C = f; D = 0.0; a = 0.0; do { a += 0.5; D = z + a * D; C = z + a / C; if ((creal(D) == 0.0) && (cimag(D) == 0.0)) D = DBL_MIN; D = 1.0 / D; delta = C * D; f = f * delta; } while (cabs(1.0 - delta) > eps); // Do the first term of the continued fraction f = 1.0 / f; // and do the final scaling f = f * exp(-z * z) / sqrt(M_PI); return f; } double_complex itpp_cerf_continued_fraction(double_complex z) { if (creal(z) > 0) return 1.0 - itpp_cerfc_continued_fraction(z); else return -1.0 + itpp_cerfc_continued_fraction(-z); } /* * Numerical Recipes quotes a formula due to Rybicki for evaluating * Dawson's Integral: * * exp(-x^2) integral exp(t^2).dt = 1/sqrt(pi) lim sum exp(-(z-n.h)^2) / n * 0 to x h->0 n odd * * This can be adapted to erf(z). */ double_complex itpp_cerf_rybicki(double_complex z) { double h = 0.2; // numerical experiment suggests this is small enough printf("itpp_cerf_rybicki"); // choose an even n0, and then shift z->z-n0.h and n->n-h. // n0 is chosen so that real((z-n0.h)^2) is as small as possible. int n0 = 2 * ((int)(cimag(z) / (2 * h) + 0.5)); double_complex z0 = I * n0 * h; double_complex zp = z - z0; double_complex sum = 0.0; // limits of sum chosen so that the end sums of the sum are // fairly small. In this case exp(-(35.h)^2)=5e-22 for (int np = -35; np <= 35; np += 2) { double_complex t = creal(zp) + I * (cimag(zp) - np * h); double_complex b = (exp(t * t) / ((double)(np + n0))); sum += b; } sum *= 2.0 * exp(-z * z) / M_PI; sum = - cimag(sum) + creal(sum) * I; return sum; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/extensions.h000066400000000000000000000026741316441372200227270ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #ifndef H_EXTENSIONS #define H_EXTENSIONS #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include /* If strict ANSI, then some useful macros are not defined */ #if defined(__STRICT_ANSI__) && !defined(__DARWIN_UNIX03) # define M_PI 3.14159265358979323846 /* pi */ #endif #ifndef DOUBLECOMPLEXDEFINED # define DOUBLECOMPLEXDEFINED 1 # include typedef double complex double_complex; #endif #if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4 # define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None #endif #define INLINE inline static INLINE void* gpaw_malloc(size_t n) { void* p = malloc(n); assert(p != NULL); return p; } #ifdef GPAW_BGP #define GPAW_MALLOC(T, n) (gpaw_malloc((n) * sizeof(T))) #else #ifdef GPAW_AIX #define GPAW_MALLOC(T, n) (malloc((n) * sizeof(T))) #else #define GPAW_MALLOC(T, n) (gpaw_malloc((n) * sizeof(T))) #endif #endif #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define INTP(a) ((int*)PyArray_DATA(a)) #define LONGP(a) ((long*)PyArray_DATA(a)) #define DOUBLEP(a) ((double*)PyArray_DATA(a)) #define COMPLEXP(a) ((double_complex*)PyArray_DATA(a)) #endif //H_EXTENSIONS gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/f2c.h000066400000000000000000000004421316441372200211710ustar00rootroot00000000000000/* Definitions needed by code transferred with f2c */ #include #include typedef int integer; typedef double doublereal; typedef struct { doublereal r, i; } doublecomplex; #ifndef STATIC_NUMERIC inline double pow_dd(double *x, double *y) { return pow(*x,*y); } #endif gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/fftw.c000066400000000000000000000030251316441372200214600ustar00rootroot00000000000000#ifdef GPAW_WITH_FFTW #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include /* Create plan and return pointer to plan as a string */ PyObject * FFTWPlan(PyObject *self, PyObject *args) { PyArrayObject* in; PyArrayObject* out; int sign; unsigned int flags; if (!PyArg_ParseTuple(args, "OOiI", &in, &out, &sign, &flags)) return NULL; fftw_plan* plan = (fftw_plan*)malloc(sizeof(fftw_plan)); if (in->descr->type_num == PyArray_DOUBLE) *plan = fftw_plan_dft_r2c(in->nd, in->dimensions, (double*)in->data, (double (*)[2])out->data, flags); else if (out->descr->type_num == PyArray_DOUBLE) *plan = fftw_plan_dft_c2r(in->nd, out->dimensions, (double (*)[2])in->data, (double*)out->data, flags); else *plan = fftw_plan_dft(in->nd, out->dimensions, (double (*)[2])in->data, (double (*)[2])out->data, sign, flags); return Py_BuildValue("s#", plan, sizeof(fftw_plan*)); } PyObject * FFTWExecute(PyObject *self, PyObject *args) { fftw_plan* plan; int n; if (!PyArg_ParseTuple(args, "s#", &plan, &n)) return NULL; fftw_execute(*plan); Py_RETURN_NONE; } PyObject * FFTWDestroy(PyObject *self, PyObject *args) { fftw_plan* plan; int n; if (!PyArg_ParseTuple(args, "s#", &plan, &n)) return NULL; fftw_destroy_plan(*plan); free(plan); Py_RETURN_NONE; } #endif // GPAW_WITH_FFTW gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/lapack.c000066400000000000000000000411641316441372200217530ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2005-2007 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" #ifdef GPAW_NO_UNDERSCORE_LAPACK # define dlamch_ dlamch # define dsyev_ dsyev # define zheev_ zheev # define dsyevr_ dsyevr # define zheevr_ zheevr # define dsygv_ dsygv # define dsygvx_ dsygvx # define dhegv_ dhegv # define zhegv_ zhegv # define zhegvx_ zhegvx # define dgeev_ dgeev # define dpotrf_ dpotrf # define dpotri_ dpotri # define zpotrf_ zpotrf # define zpotri_ zpotri # define dtrtri_ dtrtri # define ztrtri_ ztrtri # define dsytrf_ dsytrf # define zsytrf_ zsytrf # define dgetrf_ dgetrf # define zgetrf_ zgetrf # define dsytri_ dsytri # define zsytri_ zsytri # define dgetri_ dgetri # define zgetri_ zgetri # define zgbsv_ zgbsv # define zgttrf_ zgttrf # define zgttrs_ zgttrs # define ilaenv_ ilaenv #endif double dlamch_(char* cmach); void dsyev_(char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *info); void zheev_(char *jobz, char *uplo, int *n, void *a, int *lda, double *w, void *work, int *lwork, double *rwork, int *lrwork, int *info); void dsyevr_(char *jobz, char *range, char *uplo, int *n, double *a, int *lda, double *vl, double *vu, int *il, int*iu, double *abstol, int *m, double *w, double *z, int *ldz, int *isuppz, double *work, int *lwork, int *iwork, int *liwork, int *info); void zheevr_(char *jobz, char *range, char *uplo, int *n, void *a, int *lda, double *vl, double *vu, int *il, int *iu, double *abstol, int *m, double *w, void *z, int *ldz, int *isuppz, void *work, int *lwork, double *rwork, int *lrwork, int *iwork, int *liwork, int *info); void dsygv_(int *itype, char *jobz, char *uplo, int * n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork, int *info); void dsygvx_(int *itype, char *jobz, char *range, char *uplo, int *n, void *a, int *lda, void *b, int *ldb, double *vl, double *vu, int *il, int *iu, double *abstol, int *m, double *w, void *z, int *ldz, void *work, int *lwork, int *iwork, int *ifail, int *info); void zhegv_(int *itype, char *jobz, char *uplo, int * n, void *a, int *lda, void *b, int *ldb, double *w, void *work, int *lwork, double *rwork, int *lrwork, int *info); void zhegvx_(int *itype, char *jobz, char *range, char *uplo, int *n, void *a, int *lda, void *b, int *ldb, double *vl, double *vu, int *il, int *iu, double *abstol, int *m, double *w, void *z, int *ldz, void *work, int *lwork, double *rwork, int *iwork, int *ifail, int *info); void dpotrf_(char *uplo, int *n, double *a, int * lda, int *info); void dpotri_(char *uplo, int *n, double *a, int * lda, int *info); void zpotrf_(char *uplo, int *n, void *a, int *lda, int *info); void zpotri_(char *uplo, int *n, void *a, int *lda, int *info); void dgeev_(char *jovl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wl, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info); void dtrtri_(char *uplo,char *diag, int *n, void *a, int *lda, int *info ); void ztrtri_(char *uplo,char *diag, int *n, void *a, int *lda, int *info ); void dsytrf_(char *uplo, int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info); void zsytrf_(char *uplo, int *n, void *a, int *lda, int *ipiv, void *work, int *lwork, int *info); void dgetrf_(int *n, int *m, double *a, int *lda, int *ipiv, int *info); void zgetrf_(int *n, int *m, void *a, int *lda, int *ipiv, int *info); void dsytri_(char *uplo, int *n, double *a, int *lda, int *ipiv, double *work, int *info); void zsytri_(char *uplo, int *n, void *a, int *lda, int *ipiv, void *work, int *info); void dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info); void zgetri_(int *n, void *a, int *lda, int *ipiv, void *work, int *lwork, int *info); void zgbsv_(int*n, int* kl, int* ku, int* nrhs, void* ab, int*ldab, int*ipiv, void* b, int*ldb, int*info); void zgttrf_(int* n, void* dl, void* d, void* du, void* du2, int* ipiv, int* info); void zgttrs_(char* tran, int* n, int* nrhs, void* dl, void* d, void* du, void* du2, int* ipiv, void* b, int* ldb, int* info); int ilaenv_(int* ispec, char* name, char* opts, int* n1, int* n2, int* n3, int* n4, short name_len, short opts_len); PyObject* diagonalize(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* w; if (!PyArg_ParseTuple(args, "OO", &a, &w)) return NULL; int n = PyArray_DIMS(a)[0]; int lda = n; int info = 0; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { int lwork = 3 * n + 1; double* work = GPAW_MALLOC(double, lwork); dsyev_("V", "U", &n, DOUBLEP(a), &lda, DOUBLEP(w), work, &lwork, &info); free(work); } else { int lwork = 2 * n + 1; int lrwork = 3 * n + 1; void* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); zheev_("V", "U", &n, (void*)COMPLEXP(a), &lda, DOUBLEP(w), work, &lwork, rwork, &lrwork, &info); free(work); free(rwork); } return Py_BuildValue("i", info); } PyObject* diagonalize_mr3(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* w; PyArrayObject* z; if (!PyArg_ParseTuple(args, "OOO", &a, &w, &z)) return NULL; char jobz = 'V'; char range = 'A'; char uplo = 'U'; int n = PyArray_DIMS(a)[0]; int lda = MAX(1, n); double vl, vu; int il, iu; double abstol = dlamch_("Safe minimum"); int m = n; /* assume we find all eigenvalues */ int ldz = lda; int info = 0; int* isuppz = GPAW_MALLOC(int, 2*m); if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { /* Minimum workspace plus a little extra */ int lwork = 26 * n + 1; int liwork = 10 * n + 1; double* work = GPAW_MALLOC(double, lwork); int* iwork = GPAW_MALLOC(int, liwork); dsyevr_(&jobz, &range, &uplo, &n, DOUBLEP(a), &lda, &vl, &vu, &il, &iu, &abstol, &m, DOUBLEP(w), DOUBLEP(z), &ldz, isuppz, work, &lwork, iwork, &liwork, &info); free(work); free(iwork); } else { /* Minimum workspace plus a little extra */ int lwork = 2 * n + 1; int lrwork = 24 * n + 1; int liwork = 10 * n + 1; void* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); int* iwork = GPAW_MALLOC(int, liwork); zheevr_(&jobz, &range, &uplo, &n, (void*)COMPLEXP(a), &lda, &vl, &vu, &il, &iu, &abstol, &m, DOUBLEP(w), (void*)COMPLEXP(z), &ldz, isuppz, work, &lwork, rwork, &lrwork, iwork, &liwork, &info); free(work); free(rwork); free(iwork); } free(isuppz); // If this fails, fewer eigenvalues than request were computed assert (m == n); return Py_BuildValue("i", info); } PyObject* general_diagonalize(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* w; PyArrayObject* b; PyArrayObject* z; int iu = -1; if (!PyArg_ParseTuple(args, "OOO|Oi", &a, &w, &b, &z, &iu)) return NULL; int itype = 1; char jobz = 'V'; char range = 'I'; char uplo = 'U'; int n = PyArray_DIMS(a)[0]; int lda = MAX(1, n); int ldb = lda; double vl, vu; int il = 1; double abstol = dlamch_("Safe minimum"); int m; int ldz = lda; int info = 0; int ispec = 1; int dummy = -1; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { // Optimal number of blocks for dsygv(x)_ int NB = ilaenv_(&ispec, "dsytrd", &uplo, &n, &dummy, &dummy, &dummy, 6, 1); if (iu == -1) { int lwork = MAX((NB + 2) * n, 3 * n + 1); double* work = GPAW_MALLOC(double, lwork); dsygv_(&itype, &jobz, &uplo, &n, DOUBLEP(a), &lda, DOUBLEP(b), &ldb, DOUBLEP(w), work, &lwork, &info); free(work); } else { int lwork = MAX((NB + 3) * n, 8 * n); int liwork = 5 * n; double* work = GPAW_MALLOC(double, lwork); int* iwork = GPAW_MALLOC(int, liwork); int* ifail = GPAW_MALLOC(int, n); dsygvx_(&itype, &jobz, &range, &uplo, &n, DOUBLEP(a), &lda, DOUBLEP(b), &ldb, &vl, &vu, &il, &iu, &abstol, &m, DOUBLEP(w), DOUBLEP(z), &ldz, work, &lwork, iwork, ifail, &info); free(iwork); free(work); free(ifail); assert (m == iu); } } else { // Optimal number of blocks for zhegv(x)_ int NB = ilaenv_(&ispec, "zhetrd", &uplo, &n, &dummy, &dummy, &dummy, 6, 1); if (iu == -1) { int lwork = MAX((NB + 1) * n, 2 * n + 1); int lrwork = MAX(1, 3 * n + 1); void* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); zhegv_(&itype, &jobz, &uplo, &n, (void*)COMPLEXP(a), &lda, (void*)COMPLEXP(b), &lda, DOUBLEP(w), work, &lwork, rwork, &lrwork, &info); free(work); free(rwork); } else { int lwork = MAX((NB + 1) * n, 2 * n); int lrwork = 7 * n; int liwork = 5 * n; void* work = GPAW_MALLOC(double_complex, lwork); double* rwork = GPAW_MALLOC(double, lrwork); int* iwork = GPAW_MALLOC(int, liwork); int* ifail = GPAW_MALLOC(int, n); zhegvx_(&itype, &jobz, &range, &uplo, &n, (void*)COMPLEXP(a), &lda, (void*)COMPLEXP(b), &ldb, &vl, &vu, &il, &iu, &abstol, &m, DOUBLEP(w), (void*)COMPLEXP(z), &ldz, work, &lwork, rwork, iwork, ifail, &info); free(work); free(rwork); free(iwork); free(ifail); assert (m == iu); } } return Py_BuildValue("i", info); } PyObject* inverse_cholesky(PyObject *self, PyObject *args) { PyArrayObject* a; if (!PyArg_ParseTuple(args, "O", &a)) return NULL; int n = PyArray_DIMS(a)[0]; int lda = MAX(1, n); int info = 0; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { dpotrf_("U", &n, (void*)DOUBLEP(a), &lda, &info); if (info == 0) { dtrtri_("U", "N", &n, (void*)DOUBLEP(a), &lda, &info); if (info == 0) { /* Make sure that the other diagonal is zero */ double* ap = DOUBLEP(a); ap++; for (int i = 0; i < n - 1; i++) { memset(ap, 0, (n-1-i) * sizeof(double)); ap += n + 1; } } } } else { zpotrf_("U", &n, (void*)COMPLEXP(a), &lda, &info); if (info == 0) { ztrtri_("U", "N", &n, (void*)DOUBLEP(a), &lda, &info); if (info == 0) { /* Make sure that lower diagonal is zero */ double_complex* ap = COMPLEXP(a); ap++; for (int i = 0; i < n - 1; i++) { memset(ap, 0, (n-1-i) * sizeof(double_complex)); ap += n + 1; } } } } return Py_BuildValue("i", info); } void swap(double *a, double *b) { double tmp=*b; *b = *a; *a = tmp; } void transpose(double *A, int n) { int i, j; int in=0; for(i=0;itype_num == NPY_DOUBLE) { int lwork = -1; double* work = GPAW_MALLOC(double, 1); double* wr = GPAW_MALLOC(double, n); double* wi = GPAW_MALLOC(double, n); int ldvl = 1; int ldvr = n; double* vl = 0; int i; /* get size of work needed */ dgeev_("No eigenvectors left", "Vectors right", &n, DOUBLEP(A), &lda, wr, wi, vl, &ldvl, DOUBLEP(v), &ldvr, work, &lwork, &info); lwork = (int) work[0]; free(work); work = GPAW_MALLOC(double, lwork); transpose(DOUBLEP(A),n); /* transform to Fortran form */ dgeev_("No eigenvectors left", "Vectors right", &n, DOUBLEP(A), &lda, wr, wi, vl, &ldvl, DOUBLEP(v), &ldvr, work, &lwork, &info); for(i=0;i dgeev i=%d,wi[i]=%g\n", i,wi[i]); DOUBLEP(w)[i]=wr[i]; } free(wr); free(wi); free(work); } return Py_BuildValue("i", info); } PyObject* inverse_general(PyObject *self, PyObject *args) { PyArrayObject* a; if (!PyArg_ParseTuple(args, "O", &a)) return NULL; int n = PyArray_DIMS(a)[0]; int m = n; int lda = n; int lwork = n; int* ipiv = GPAW_MALLOC(int, n); int info = 0; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); dgetrf_(&n, &m, DOUBLEP(a), &lda, ipiv, &info); dgetri_(&n, DOUBLEP(a), &lda, ipiv, work, &lwork, &info); free(work); } else { void *work = GPAW_MALLOC(double_complex, lwork); zgetrf_(&n, &m, (void*)COMPLEXP(a), &lda, ipiv, &info); zgetri_(&n, (void*)COMPLEXP(a), &lda, ipiv, work, &lwork, &info); free(work); } free(ipiv); return Py_BuildValue("i", info); } PyObject* inverse_symmetric(PyObject *self, PyObject *args) { PyArrayObject* a; if (!PyArg_ParseTuple(args, "O", &a)) return NULL; int n = PyArray_DIMS(a)[0]; int lda = n; int lwork =n; int* ipiv = GPAW_MALLOC(int, n); int info = 0; if (PyArray_DESCR(a)->type_num == NPY_DOUBLE) { double* work = GPAW_MALLOC(double, lwork); dsytrf_("U", &n, DOUBLEP(a), &lda, ipiv, work, &lwork, &info); dsytri_("U", &n, DOUBLEP(a), &lda, ipiv, work, &info); free(work); } else { void *work = GPAW_MALLOC(double_complex, lwork); zsytrf_("U", &n, (void*)COMPLEXP(a), &lda, ipiv, work, &lwork, &info); zsytri_("U", &n, (void*)COMPLEXP(a), &lda, ipiv, work, &info); free(work); } free(ipiv); return Py_BuildValue("i", info); } PyObject* linear_solve_band(PyObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* b; int kl, ku, info=0, *ipiv; if(!PyArg_ParseTuple(args,"OOii",&a, &b,&kl,&ku)) return NULL; int n=PyArray_DIMS(a)[0]; int ldab=PyArray_DIMS(a)[1]; int ldb=PyArray_DIMS(b)[0]; int nrhs=PyArray_DIMS(b)[1]; ipiv = GPAW_MALLOC(int, n); zgbsv_(&n, &kl,&ku, &nrhs, (void*)COMPLEXP(a), &ldab, ipiv, (void*)COMPLEXP(b), &ldb, &info); free(ipiv); return Py_BuildValue("i",info); } PyObject* linear_solve_tridiag(PyObject *self, PyObject *args) { PyArrayObject* A; PyArrayObject* du; PyArrayObject* du2; PyArrayObject* dl; PyArrayObject* phi; int dim=0, one=1, info=0; if(!PyArg_ParseTuple(args,"iOOOOO", &dim, &A, &du, &dl, &du2, &phi)) return NULL; int ldb = dim; int *ipiv = GPAW_MALLOC(int, dim); zgttrf_(&dim, (void*)COMPLEXP(dl), (void*)COMPLEXP(A), (void*)COMPLEXP(du), (void*)COMPLEXP(du2), ipiv, &info); zgttrs_("N", &dim, &one, (void*)COMPLEXP(dl), (void*)COMPLEXP(A), (void*)COMPLEXP(du), (void*)COMPLEXP(du2), ipiv, (void*)COMPLEXP(phi), &ldb, &info); free(ipiv); return Py_BuildValue("i",info); } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/lcao.c000066400000000000000000000132361316441372200214350ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #include "extensions.h" #include "localized_functions.h" #include "bmgs/bmgs.h" #include #ifdef GPAW_NO_UNDERSCORE_BLAS # define dgemv_ dgemv # define dgemm_ dgemm #endif int dgemv_(char *trans, int *m, int * n, double *alpha, double *a, int *lda, double *x, int *incx, double *beta, double *y, int *incy); int dgemm_(char *transa, char *transb, int *m, int * n, int *k, const double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc); // +-----------n // +----m +----m | +----c+m | // | | | | | | | | // | b | = | v | * | | a | | // | | | | | | | | // 0----+ 0----+ | c----+ | // | | // 0-----------+ void cut(const double* a, const int n[3], const int c[3], const double* v, double* b, const int m[3]) { a += c[2] + (c[1] + c[0] * n[1]) * n[2]; for (int i0 = 0; i0 < m[0]; i0++) { for (int i1 = 0; i1 < m[1]; i1++) { for (int i2 = 0; i2 < m[2]; i2++) b[i2] = v[i2] * a[i2]; a += n[2]; b += m[2]; v += m[2]; } a += n[2] * (n[1] - m[1]); } } PyObject * overlap(PyObject* self, PyObject *args) { PyObject* lfs_b_obj; PyArrayObject* m_b_obj; PyArrayObject* phase_bk_obj; PyArrayObject* vt_sG_obj; PyArrayObject* Vt_skmm_obj; if (!PyArg_ParseTuple(args, "OOOOO", &lfs_b_obj, &m_b_obj, &phase_bk_obj, &vt_sG_obj, &Vt_skmm_obj)) return NULL; int nk = PyArray_DIMS(phase_bk_obj)[1]; int nm = PyArray_DIMS(Vt_skmm_obj)[2]; int nspins = PyArray_DIMS(vt_sG_obj)[0]; const long *m_b = LONGP(m_b_obj); const double complex *phase_bk = COMPLEXP(phase_bk_obj); const double *vt_sG = DOUBLEP(vt_sG_obj); double *Vt_smm = 0; double complex *Vt_skmm = 0; if (nk == 0) Vt_smm = DOUBLEP(Vt_skmm_obj); else Vt_skmm = COMPLEXP(Vt_skmm_obj); int nb = PyList_Size(lfs_b_obj); int nmem = 0; double* a1 = 0; for (int b1 = 0; b1 < nb; b1++) { const LocalizedFunctionsObject* lf1 = (const LocalizedFunctionsObject*)PyList_GetItem(lfs_b_obj, b1); int m1 = m_b[b1]; int nao1 = lf1->nf; double* f1 = lf1->f; double* vt1 = GPAW_MALLOC(double, lf1->ng0 * nspins); for (int s = 0; s < nspins; s++) bmgs_cut(vt_sG + s * lf1->ng, lf1->size, lf1->start, vt1 + s * lf1->ng0, lf1->size0); for (int b2 = b1; b2 < nb; b2++) { const LocalizedFunctionsObject* lf2 = (const LocalizedFunctionsObject*)PyList_GetItem(lfs_b_obj, b2); int beg[3]; int end[3]; int size[3]; int beg1[3]; int beg2[3]; bool overlap = true; for (int c = 0; c < 3; c++) { beg[c] = MAX(lf1->start[c], lf2->start[c]); end[c] = MIN(lf1->start[c] + lf1->size0[c], lf2->start[c] + lf2->size0[c]); size[c] = end[c] - beg[c]; if (size[c] <= 0) { overlap = false; continue; } beg1[c] = beg[c] - lf1->start[c]; beg2[c] = beg[c] - lf2->start[c]; } int nao2 = lf2->nf; if (overlap) { int ng = size[0] * size[1] * size[2]; int n = ng * (nao1 + nao2) + nao1 * nao2; if (n > nmem) { if (nmem != 0) free(a1); nmem = n; a1 = GPAW_MALLOC(double, nmem); } double* a2 = a1 + ng * nao1; double* H = a2 + ng * nao2; double* f2 = lf2->f; double* vt2 = lf2->w; double dv = lf1->dv; int m2 = m_b[b2]; if (b2 > b1) for (int i = 0; i < nao2; i++) bmgs_cut(f2 + i * lf2->ng0, lf2->size0, beg2, a2 + i * ng, size); else a2 = f2; for (int s = 0; s < nspins; s++) { if (b2 > b1) { bmgs_cut(vt1 + s * lf1->ng0, lf1->size0, beg1, vt2, size); for (int i = 0; i < nao1; i++) cut(f1 + i * lf1->ng0, lf1->size0, beg1, vt2, a1 + i * ng, size); } else { for (int i1 = 0; i1 < nao1; i1++) for (int g = 0; g < ng; g++) a1[i1 * ng + g] = (vt1[g + s * lf1->ng0] * f1[i1 * ng + g]); } double zero = 0.0; dgemm_("t", "n", &nao2, &nao1, &ng, &dv, a2, &ng, a1, &ng, &zero, H, &nao2); if (nk == 0) { double* Vt_mm = (Vt_smm + s * nm * nm + m1 + m2 * nm); if (b2 == b1) for (int i1 = 0; i1 < nao1; i1++) for (int i2 = i1; i2 < nao2; i2++) Vt_mm[i1 + i2 * nm] += H[i2 + i1 * nao2]; else if (m1 == m2) for (int i1 = 0; i1 < nao1; i1++) for (int i2 = i1; i2 < nao2; i2++) Vt_mm[i1 + i2 * nm] += (H[i2 + i1 * nao2] + H[i1 + i2 * nao2]); else for (int ii = 0, i1 = 0; i1 < nao1; i1++) for (int i2 = 0; i2 < nao2; i2++, ii++) Vt_mm[i1 + i2 * nm] += H[ii]; } else for (int k = 0; k < nk; k++) { double complex* Vt_mm = (Vt_skmm + (s * nk + k) * nm * nm + m1 + m2 * nm); if (b2 == b1) for (int i1 = 0; i1 < nao1; i1++) for (int i2 = i1; i2 < nao2; i2++) Vt_mm[i1 + i2 * nm] += H[i2 + i1 * nao2]; else { double complex phase = \ (phase_bk[b1 * nk + k] * conj(phase_bk[b2 * nk + k])); if (m1 == m2) for (int i1 = 0; i1 < nao1; i1++) for (int i2 = i1; i2 < nao2; i2++) Vt_mm[i1 + i2 * nm] += \ (phase * H[i2 + i1 * nao2] + conj(phase) * H[i1 + i2 * nao2]); else for (int ii = 0, i1 = 0; i1 < nao1; i1++) for (int i2 = 0; i2 < nao2; i2++, ii++) Vt_mm[i1 + i2 * nm] += phase * H[ii]; } } } } } free(vt1); } if (nmem != 0) free(a1); Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/lfc.c000066400000000000000000001565021316441372200212670ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "spline.h" #include "lfc.h" #include "bmgs/spherical_harmonics.h" #include "bmgs/bmgs.h" #ifdef GPAW_NO_UNDERSCORE_BLAS # define zgemm_ zgemm #endif void zgemm_(char *transa, char *transb, int *m, int * n, int *k, void *alpha, void *a, int *lda, const void *b, int *ldb, void *beta, void *c, int *ldc); static void lfc_dealloc(LFCObject *self) { if (self->bloch_boundary_conditions) free(self->phase_i); free(self->volume_i); free(self->work_gm); free(self->ngm_W); free(self->i_W); free(self->volume_W); PyObject_DEL(self); } PyObject* calculate_potential_matrix(LFCObject *self, PyObject *args); PyObject* calculate_potential_matrices(LFCObject *self, PyObject *args); PyObject* lfcintegrate(LFCObject *self, PyObject *args); PyObject* derivative(LFCObject *self, PyObject *args); PyObject* normalized_derivative(LFCObject *self, PyObject *args); PyObject* construct_density(LFCObject *self, PyObject *args); PyObject* construct_density1(LFCObject *self, PyObject *args); PyObject* ae_valence_density_correction(LFCObject *self, PyObject *args); PyObject* ae_core_density_correction(LFCObject *self, PyObject *args); PyObject* lcao_to_grid(LFCObject *self, PyObject *args); PyObject* lcao_to_grid_k(LFCObject *self, PyObject *args); PyObject* add(LFCObject *self, PyObject *args); PyObject* calculate_potential_matrix_derivative(LFCObject *self, PyObject *args); PyObject* calculate_potential_matrix_force_contribution(LFCObject *self, PyObject *args); PyObject* second_derivative(LFCObject *self, PyObject *args); PyObject* add_derivative(LFCObject *self, PyObject *args); static PyMethodDef lfc_methods[] = { {"calculate_potential_matrix", (PyCFunction)calculate_potential_matrix, METH_VARARGS, 0}, {"calculate_potential_matrices", (PyCFunction)calculate_potential_matrices, METH_VARARGS, 0}, {"integrate", (PyCFunction)lfcintegrate, METH_VARARGS, 0}, {"derivative", (PyCFunction)derivative, METH_VARARGS, 0}, {"normalized_derivative", (PyCFunction)normalized_derivative, METH_VARARGS, 0}, {"construct_density", (PyCFunction)construct_density, METH_VARARGS, 0}, {"construct_density1", (PyCFunction)construct_density1, METH_VARARGS, 0}, {"ae_valence_density_correction", (PyCFunction)ae_valence_density_correction, METH_VARARGS, 0}, {"ae_core_density_correction", (PyCFunction)ae_core_density_correction, METH_VARARGS, 0}, {"lcao_to_grid", (PyCFunction)lcao_to_grid, METH_VARARGS, 0}, {"lcao_to_grid_k", (PyCFunction)lcao_to_grid_k, METH_VARARGS, 0}, {"add", (PyCFunction)add, METH_VARARGS, 0}, {"calculate_potential_matrix_derivative", (PyCFunction)calculate_potential_matrix_derivative, METH_VARARGS, 0}, {"calculate_potential_matrix_force_contribution", (PyCFunction)calculate_potential_matrix_force_contribution, METH_VARARGS, 0}, {"second_derivative", (PyCFunction)second_derivative, METH_VARARGS, 0}, {"add_derivative", (PyCFunction)add_derivative, METH_VARARGS, 0}, {NULL, NULL, 0, NULL} }; PyTypeObject LFCType = { PyVarObject_HEAD_INIT(NULL, 0) "LocalizedFunctionsCollection", sizeof(LFCObject), 0, (destructor)lfc_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "LFC object", 0, 0, 0, 0, 0, 0, lfc_methods }; PyObject * NewLFCObject(PyObject *obj, PyObject *args) { PyObject* A_Wgm_obj; PyArrayObject* M_W_obj; PyArrayObject* G_B_obj; PyArrayObject* W_B_obj; double dv; PyArrayObject* phase_kW_obj; if (!PyArg_ParseTuple(args, "OOOOdO", &A_Wgm_obj, &M_W_obj, &G_B_obj, &W_B_obj, &dv, &phase_kW_obj)) return NULL; LFCObject *self = PyObject_NEW(LFCObject, &LFCType); if (self == NULL) return NULL; self->dv = dv; const int* M_W = (const int*)PyArray_DATA(M_W_obj); self->G_B = (int*)PyArray_DATA(G_B_obj); self->W_B = (int*)PyArray_DATA(W_B_obj); if (PyArray_DIMS(phase_kW_obj)[0] > 0) { self->bloch_boundary_conditions = true; self->phase_kW = (double complex*)PyArray_DATA(phase_kW_obj); } else { self->bloch_boundary_conditions = false; } int nB = PyArray_DIMS(G_B_obj)[0]; int nW = PyList_Size(A_Wgm_obj); self->nW = nW; self->nB = nB; int nimax = 0; int ngmax = 0; int ni = 0; int Ga = 0; for (int B = 0; B < nB; B++) { int Gb = self->G_B[B]; int nG = Gb - Ga; if (ni > 0 && nG > ngmax) ngmax = nG; if (self->W_B[B] >= 0) ni += 1; else { if (ni > nimax) nimax = ni; ni--; } Ga = Gb; } assert(ni == 0); self->volume_W = GPAW_MALLOC(LFVolume, nW); self->i_W = GPAW_MALLOC(int, nW); self->ngm_W = GPAW_MALLOC(int, nW); int nmmax = 0; for (int W = 0; W < nW; W++) { PyArrayObject* A_gm_obj = (PyArrayObject*)PyList_GetItem(A_Wgm_obj, W); LFVolume* volume = &self->volume_W[W]; volume->A_gm = (const double*)PyArray_DATA(A_gm_obj); self->ngm_W[W] = PyArray_DIMS(A_gm_obj)[0] * PyArray_DIMS(A_gm_obj)[1]; volume->nm = PyArray_DIMS(A_gm_obj)[1]; volume->M = M_W[W]; volume->W = W; if (volume->nm > nmmax) nmmax = volume->nm; } self->work_gm = GPAW_MALLOC(double, ngmax * nmmax); self->volume_i = GPAW_MALLOC(LFVolume, nimax); if (self->bloch_boundary_conditions) self->phase_i = GPAW_MALLOC(complex double, nimax); return (PyObject*)self; } PyObject* calculate_potential_matrix(LFCObject *lfc, PyObject *args) { PyArrayObject* vt_G_obj; PyArrayObject* Vt_MM_obj; int k; int Mstart; int Mstop; if (!PyArg_ParseTuple(args, "OOiii", &vt_G_obj, &Vt_MM_obj, &k, &Mstart, &Mstop)) return NULL; const double* vt_G = (const double*)PyArray_DATA(vt_G_obj); int nM = PyArray_DIMS(Vt_MM_obj)[1]; double dv = lfc->dv; double* work_gm = lfc->work_gm; if (!lfc->bloch_boundary_conditions) { double* Vt_MM = (double*)PyArray_DATA(Vt_MM_obj); GRID_LOOP_START(lfc, -1) { // ORDINARY/GAMMA-POINT for (int i1 = 0; i1 < ni; i1++) { LFVolume* v1 = volume_i + i1; int M1 = v1->M; int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; int gm = M1p - M1; int gm1 = 0; const double* A1_gm = v1->A_gm; for (int G = Ga; G < Gb; G++, gm += nm1 - nm1p) { double vtdv = vt_G[G] * dv; for (int m1 = 0; m1 < nm1p; m1++, gm1++, gm++) work_gm[gm1] = vtdv * A1_gm[gm]; } for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int M2 = v2->M; if (M1 >= M2) { int nm2 = v2->nm; const double* A2_gm = v2->A_gm; double* Vt_mm = Vt_MM + (M1p - Mstart) * nM + M2; for (int g = 0; g < nG; g++){ int gnm1 = g * nm1p; int gnm2 = g * nm2; for (int m1 = 0; m1 < nm1p; m1++) { int m1nM = m1 * nM; for (int m2 = 0; m2 < nm2; m2++) Vt_mm[m2 + m1nM] += A2_gm[gnm2 + m2] * work_gm[gnm1 + m1]; } } } } } } GRID_LOOP_STOP(lfc, -1); } else { complex double* Vt_MM = (complex double*)PyArray_DATA(Vt_MM_obj); GRID_LOOP_START(lfc, k) { // KPOINT CALC POT MATRIX for (int i1 = 0; i1 < ni; i1++) { LFVolume* v1 = volume_i + i1; double complex conjphase1 = conj(phase_i[i1]); int M1 = v1->M; int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; int gm = M1p - M1; int gm1 = 0; const double* A1_gm = v1->A_gm; for (int G = Ga; G < Gb; G++, gm += nm1 - nm1p) { double vtdv = vt_G[G] * dv; for (int m1 = 0; m1 < nm1p; m1++, gm1++, gm++) work_gm[gm1] = vtdv * A1_gm[gm]; } for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; const double* A2_gm = v2->A_gm; int M2 = v2->M; if (M1 >= M2) { int nm2 = v2->nm; double complex phase = conjphase1 * phase_i[i2]; double complex* Vt_mm = Vt_MM + (M1p - Mstart) * nM + M2; for (int g = 0; g < nG; g++) { int gnm1 = g * nm1p; int gnm2 = g * nm2; int m1nM = 0; for (int m1 = 0; m1 < nm1p; m1++, m1nM += nM) { complex double wphase = work_gm[gnm1 + m1] * phase; for (int m2 = 0; m2 < nm2; m2++) { Vt_mm[m1nM + m2] += A2_gm[gnm2 + m2] * wphase; } } } } } } } GRID_LOOP_STOP(lfc, k); } Py_RETURN_NONE; } PyObject* calculate_potential_matrices(LFCObject *lfc, PyObject *args) { PyArrayObject* vt_G_obj; PyArrayObject* Vt_xMM_obj; PyArrayObject* x_W_obj; int Mstart; int Mstop; if (!PyArg_ParseTuple(args, "OOOii", &vt_G_obj, &Vt_xMM_obj, &x_W_obj, &Mstart, &Mstop)) return NULL; const double* vt_G = (const double*)PyArray_DATA(vt_G_obj); int nM = PyArray_DIMS(Vt_xMM_obj)[2]; double dv = lfc->dv; double* work_gm = lfc->work_gm; double* Vt_xMM = (double*)PyArray_DATA(Vt_xMM_obj); int* x_W = (int*)PyArray_DATA(x_W_obj); GRID_LOOP_START(lfc, -1) { for (int i1 = 0; i1 < ni; i1++) { LFVolume* v1 = volume_i + i1; int M1 = v1->M; int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; int x1 = x_W[v1->W]; int gm = M1p - M1; int gm1 = 0; const double* A1_gm = v1->A_gm; for (int G = Ga; G < Gb; G++, gm += nm1 - nm1p) { double vtdv = vt_G[G] * dv; for (int m1 = 0; m1 < nm1p; m1++, gm1++, gm++) work_gm[gm1] = vtdv * A1_gm[gm]; } for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int x = x_W[v2->W] - x1; if (x >= 0) { int M2 = v2->M; int nm2 = v2->nm; const double* A2_gm = v2->A_gm; double* Vt_mm = (Vt_xMM + (M1p - Mstart) * nM + M2 + x * (Mstop - Mstart) * nM); for (int g = 0; g < nG; g++) { int gnm1 = g * nm1p; int gnm2 = g * nm2; for (int m1 = 0; m1 < nm1p; m1++) { int m1nM = m1 * nM; for (int m2 = 0; m2 < nm2; m2++) Vt_mm[m2 + m1nM] += (A2_gm[gnm2 + m2] * work_gm[gnm1 + m1]); } } } } } } GRID_LOOP_STOP(lfc, -1); Py_RETURN_NONE; } PyObject* lfcintegrate(LFCObject *lfc, PyObject *args) { PyArrayObject* a_xG_obj; PyArrayObject* c_xM_obj; int q; if (!PyArg_ParseTuple(args, "OOi", &a_xG_obj, &c_xM_obj, &q)) return NULL; int nd = PyArray_NDIM(a_xG_obj); npy_intp* dims = PyArray_DIMS(a_xG_obj); int nx = PyArray_MultiplyList(dims, nd - 3); int nG = PyArray_MultiplyList(dims + nd - 3, 3); int nM = PyArray_DIMS(c_xM_obj)[PyArray_NDIM(c_xM_obj) - 1]; double dv = lfc->dv; if (!lfc->bloch_boundary_conditions) { const double* a_G = (const double*)PyArray_DATA(a_xG_obj); double* c_M = (double*)PyArray_DATA(c_xM_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, -1) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; const double* A_gm = v->A_gm; int nm = v->nm; double* c_M1 = c_M + v->M; for (int gm = 0, G = Ga; G < Gb; G++){ double av = a_G[G] * dv; for (int m = 0; m < nm; m++, gm++){ c_M1[m] += av * A_gm[gm]; } } } } GRID_LOOP_STOP(lfc, -1); c_M += nM; a_G += nG; } } else { const complex double* a_G = (const complex double*)PyArray_DATA(a_xG_obj); complex double* c_M = (complex double*)PyArray_DATA(c_xM_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, q) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; int nm = v->nm; complex double* c_M1 = c_M + v->M; const double* A_gm = v->A_gm; double complex vphase = phase_i[i] * dv; for (int gm = 0, G = Ga; G < Gb; G++){ double complex avphase = a_G[G] * vphase; for (int m = 0; m < nm; m++, gm++){ c_M1[m] += avphase * A_gm[gm]; } } } } GRID_LOOP_STOP(lfc, q); c_M += nM; a_G += nG; } } Py_RETURN_NONE; } PyObject* construct_density(LFCObject *lfc, PyObject *args) { PyArrayObject* rho_MM_obj; PyArrayObject* nt_G_obj; int k; int Mstart, Mstop; if (!PyArg_ParseTuple(args, "OOiii", &rho_MM_obj, &nt_G_obj, &k, &Mstart, &Mstop)) return NULL; double* nt_G = (double*)PyArray_DATA(nt_G_obj); int nM = PyArray_DIMS(rho_MM_obj)[1]; double* work_gm = lfc->work_gm; if (!lfc->bloch_boundary_conditions) { const double* rho_MM = (const double*)PyArray_DATA(rho_MM_obj); GRID_LOOP_START(lfc, -1) { for (int i1 = 0; i1 < ni; i1++) { LFVolume* v1 = volume_i + i1; int M1 = v1->M; int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; memset(work_gm, 0, nG * nm1 * sizeof(double)); double factor = 1.0; int m1end = MIN(nm1, Mstop - M1); int m1start = MAX(0, Mstart - M1); for (int i2 = i1; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int M2 = v2->M; int nm2 = v2->nm; const double* rho_mm = rho_MM + (M1p - Mstart) * nM + M2; //assert(M1 - Mstart + m1start >= 0); for (int g = 0; g < nG; g++) { for (int m1 = m1start, m1p = 0; m1 < m1end; m1++, m1p++) { for (int m2 = 0; m2 < nm2; m2++) { work_gm[g * nm1 + m1] += (v2->A_gm[g * nm2 + m2] * rho_mm[m1p * nM + m2] * factor); } } } factor = 2.0; } int gm1 = 0; for (int G = Ga; G < Gb; G++) { double nt = 0.0; for (int m1 = 0; m1 < nm1; m1++, gm1++) { nt += v1->A_gm[gm1] * work_gm[gm1]; } nt_G[G] += nt; } } } GRID_LOOP_STOP(lfc, -1); } else { const double complex* rho_MM = (const double complex*)PyArray_DATA(rho_MM_obj); GRID_LOOP_START(lfc, k) { for (int i1 = 0; i1 < ni; i1++) { LFVolume* v1 = volume_i + i1; int M1 = v1->M; int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; memset(work_gm, 0, nG * nm1 * sizeof(double)); double complex factor = 1.0; int m1end = MIN(nm1, Mstop - M1); int m1start = MAX(0, Mstart - M1); for (int i2 = i1; i2 < ni; i2++) { if (i2 > i1) factor = 2.0 * phase_i[i1] * conj(phase_i[i2]); double rfactor = creal(factor); double ifactor = cimag(factor); LFVolume* v2 = volume_i + i2; const double* A2_gm = v2->A_gm; int M2 = v2->M; int nm2 = v2->nm; const double complex* rho_mm = rho_MM + (M1p - Mstart) * nM + M2; double rrho, irho, rwork, iwork; complex double rho; for (int g = 0; g < nG; g++) { int gnm1 = g * nm1; int gnm2 = g * nm2; int m1pnM = 0; for (int m1 = m1start, m1p=0; m1 < m1end; m1++, m1p++) { m1pnM = m1p * nM; iwork = 0; rwork = 0; for (int m2 = 0; m2 < nm2; m2++) { rho = rho_mm[m1pnM + m2]; rrho = creal(rho); irho = cimag(rho); rwork += A2_gm[gnm2 + m2] * rrho; iwork += A2_gm[gnm2 + m2] * irho; // We could save one of those multiplications if the buffer // were twice as large //work += A2_gm[gnm2 + m2] * (rfactor * rrho - ifactor * irho); } //work_gm[m1 + gnm1] += work; work_gm[m1 + gnm1] += rwork * rfactor - iwork * ifactor; } } } int gm1 = 0; const double* A1_gm = v1->A_gm; for (int G = Ga; G < Gb; G++) { double nt = 0.0; for (int m1 = 0; m1 < nm1; m1++, gm1++) { nt += A1_gm[gm1] * work_gm[gm1]; } nt_G[G] += nt; } } } GRID_LOOP_STOP(lfc, k); } Py_RETURN_NONE; } PyObject* construct_density1(LFCObject *lfc, PyObject *args) { PyArrayObject* f_M_obj; PyArrayObject* nt_G_obj; if (!PyArg_ParseTuple(args, "OO", &f_M_obj, &nt_G_obj)) return NULL; const double* f_M = (const double*)PyArray_DATA(f_M_obj); double* nt_G = (double*)PyArray_DATA(nt_G_obj); GRID_LOOP_START(lfc, -1) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; for (int gm = 0, G = Ga; G < Gb; G++) { for (int m = 0; m < v->nm; m++, gm++) { nt_G[G] += v->A_gm[gm] * v->A_gm[gm] * f_M[v->M + m]; } } } } GRID_LOOP_STOP(lfc, -1); Py_RETURN_NONE; } PyObject* lcao_to_grid(LFCObject *lfc, PyObject *args) { PyArrayObject* c_M_obj; PyArrayObject* psit_G_obj; int k; if (!PyArg_ParseTuple(args, "OOi", &c_M_obj, &psit_G_obj, &k)) return NULL; if (!lfc->bloch_boundary_conditions) { if (PyArray_DESCR(c_M_obj)->type_num == NPY_DOUBLE) { const double* c_M = (const double*)PyArray_DATA(c_M_obj); double* psit_G = (double*)PyArray_DATA(psit_G_obj); GRID_LOOP_START(lfc, -1) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; for (int gm = 0, G = Ga; G < Gb; G++) { for (int m = 0; m < v->nm; m++, gm++) { psit_G[G] += v->A_gm[gm] * c_M[v->M + m]; } } } } GRID_LOOP_STOP(lfc, -1); } else { const double complex* c_M = (const double complex*)PyArray_DATA(c_M_obj); double complex* psit_G = (double complex*)PyArray_DATA(psit_G_obj); GRID_LOOP_START(lfc, -1) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; for (int gm = 0, G = Ga; G < Gb; G++) { for (int m = 0; m < v->nm; m++, gm++) { psit_G[G] += v->A_gm[gm] * c_M[v->M + m]; } } } } GRID_LOOP_STOP(lfc, -1); } } else { const double complex* c_M = (const double complex*)PyArray_DATA(c_M_obj); double complex* psit_G = (double complex*)PyArray_DATA(psit_G_obj); GRID_LOOP_START(lfc, k) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; double complex conjphase = conj(phase_i[i]); const double* A_gm = v->A_gm; const double complex* c_M1 = c_M + v->M; for (int gm = 0, G = Ga; G < Gb; G++) { double complex psit = 0.0; for (int m = 0; m < v->nm; m++, gm++) { psit += A_gm[gm] * c_M1[m]; } psit_G[G] += psit * conjphase; } } } GRID_LOOP_STOP(lfc, k); } Py_RETURN_NONE; } // Faster implementation of lcao_to_grid() function specialized // for k-points PyObject* lcao_to_grid_k(LFCObject *lfc, PyObject *args) { PyArrayObject* c_xM_obj; PyArrayObject* psit_xG_obj; int k; int Mblock; if (!PyArg_ParseTuple(args, "OOii", &c_xM_obj, &psit_xG_obj, &k, &Mblock)) return NULL; const double complex* c_xM = (const double complex*)PyArray_DATA(c_xM_obj); double complex* psit_xG = (double complex*)PyArray_DATA(psit_xG_obj); int nd = PyArray_NDIM(psit_xG_obj); npy_intp* dims = PyArray_DIMS(psit_xG_obj); int nx = PyArray_MultiplyList(dims, nd - 3); int Gmax = PyArray_MultiplyList(dims + nd - 3, 3); int Mmax = PyArray_DIMS(c_xM_obj)[PyArray_NDIM(c_xM_obj) - 1]; double complex* tmp_GM = 0; for (int Mstart = 0; Mstart < Mmax; Mstart += Mblock) { int Mstop = Mstart + Mblock; if (Mstop > Mmax) { Mstop = Mmax; Mblock = Mstop - Mstart; } if (tmp_GM == 0) tmp_GM = GPAW_MALLOC(double complex, Mblock * Gmax); for (int GM = 0; GM < Gmax * Mblock; GM++) tmp_GM[GM] = 0.0; GRID_LOOP_START(lfc, k) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; int M1 = v->M; if (M1 >= Mstop) continue; int nm = v->nm; int M2 = M1 + nm; if (M2 <= Mstart) continue; int M1p = MAX(M1, Mstart); int M2p = MIN(M2, Mstop); if (M1p == M2p) continue; double complex phase = phase_i[i]; const double* A_gm = v->A_gm; for (int G = Ga; G < Gb; G++) for (int M = M1p; M < M2p; M++) tmp_GM[G * Mblock + M - Mstart] += \ A_gm[(G - Ga) * nm + M - M1] * phase; } } GRID_LOOP_STOP(lfc, k); double complex one = 1.0; zgemm_("C", "N", &Gmax, &nx, &Mblock, &one, tmp_GM, &Mblock, c_xM + Mstart, &Mmax, &one, psit_xG, &Gmax); } free(tmp_GM); Py_RETURN_NONE; } PyObject* add(LFCObject *lfc, PyObject *args) { PyArrayObject* c_xM_obj; PyArrayObject* a_xG_obj; int q; if (!PyArg_ParseTuple(args, "OOi", &c_xM_obj, &a_xG_obj, &q)) return NULL; int nd = PyArray_NDIM(a_xG_obj); npy_intp* dims = PyArray_DIMS(a_xG_obj); int nx = PyArray_MultiplyList(dims, nd - 3); int nG = PyArray_MultiplyList(dims + nd - 3, 3); int nM = PyArray_DIMS(c_xM_obj)[PyArray_NDIM(c_xM_obj) - 1]; if (!lfc->bloch_boundary_conditions) { const double* c_M = (const double*)PyArray_DATA(c_xM_obj); double* a_G = (double*)PyArray_DATA(a_xG_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, -1) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; for (int gm = 0, G = Ga; G < Gb; G++) { for (int m = 0; m < v->nm; m++, gm++) { a_G[G] += v->A_gm[gm] * c_M[v->M + m]; } } } } GRID_LOOP_STOP(lfc, -1); c_M += nM; a_G += nG; } } else { const double complex* c_M = (const double complex*)PyArray_DATA(c_xM_obj); double complex* a_G = (double complex*)PyArray_DATA(a_xG_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, q) { for (int i = 0; i < ni; i++) { double complex conjphase = conj(phase_i[i]); LFVolume* v = volume_i + i; const double complex* c_M1 = c_M + v->M; const double* A_gm = v->A_gm; for (int gm = 0, G = Ga; G < Gb; G++) { double complex a = 0.0; for (int m = 0; m < v->nm; m++, gm++) { a += A_gm[gm] * c_M1[m]; } a_G[G] += a * conjphase; } } } GRID_LOOP_STOP(lfc, q); c_M += nM; a_G += nG; } } Py_RETURN_NONE; } PyObject* spline_to_grid(PyObject *self, PyObject *args) { SplineObject* spline_obj; PyArrayObject* beg_c_obj; PyArrayObject* end_c_obj; PyArrayObject* pos_v_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; PyArrayObject* gdcorner_c_obj; if (!PyArg_ParseTuple(args, "OOOOOOO", &spline_obj, &beg_c_obj, &end_c_obj, &pos_v_obj, &h_cv_obj, &n_c_obj, &gdcorner_c_obj)) return NULL; const bmgsspline* spline = (const bmgsspline*)(&(spline_obj->spline)); long* beg_c = LONGP(beg_c_obj); long* end_c = LONGP(end_c_obj); double* pos_v = DOUBLEP(pos_v_obj); double* h_cv = DOUBLEP(h_cv_obj); long* n_c = LONGP(n_c_obj); long* gdcorner_c = LONGP(gdcorner_c_obj); int l = spline_obj->spline.l; int nm = 2 * l + 1; double rcut = spline->dr * spline->nbins; int ngmax = ((end_c[0] - beg_c[0]) * (end_c[1] - beg_c[1]) * (end_c[2] - beg_c[2])); double* A_gm = GPAW_MALLOC(double, ngmax * nm); int nBmax = ((end_c[0] - beg_c[0]) * (end_c[1] - beg_c[1])); int* G_B = GPAW_MALLOC(int, 2 * nBmax); int nB = 0; int ngm = 0; int G = -gdcorner_c[2] + n_c[2] * (beg_c[1] - gdcorner_c[1] + n_c[1] * (beg_c[0] - gdcorner_c[0])); for (int g0 = beg_c[0]; g0 < end_c[0]; g0++) { for (int g1 = beg_c[1]; g1 < end_c[1]; g1++) { int g2_beg = -1; // function boundary coordinates int g2_end = -1; for (int g2 = beg_c[2]; g2 < end_c[2]; g2++) { double x = h_cv[0] * g0 + h_cv[3] * g1 + h_cv[6] * g2 - pos_v[0]; double y = h_cv[1] * g0 + h_cv[4] * g1 + h_cv[7] * g2 - pos_v[1]; double z = h_cv[2] * g0 + h_cv[5] * g1 + h_cv[8] * g2 - pos_v[2]; double r2 = x * x + y * y + z * z; double r = sqrt(r2); if (r < rcut) { if (g2_beg < 0) g2_beg = g2; // found boundary g2_end = g2; double A = bmgs_splinevalue(spline, r); double* p = A_gm + ngm; spherical_harmonics(l, A, x, y, z, r2, p); ngm += nm; } } if (g2_end >= 0) { g2_end++; G_B[nB++] = G + g2_beg; G_B[nB++] = G + g2_end; } G += n_c[2]; } G += n_c[2] * (n_c[1] - end_c[1] + beg_c[1]); } npy_intp gm_dims[2] = {ngm / (2 * l + 1), 2 * l + 1}; PyArrayObject* A_gm_obj = (PyArrayObject*)PyArray_SimpleNew(2, gm_dims, NPY_DOUBLE); memcpy(PyArray_DATA(A_gm_obj), A_gm, ngm * sizeof(double)); free(A_gm); npy_intp B_dims[1] = {nB}; PyArrayObject* G_B_obj = (PyArrayObject*)PyArray_SimpleNew(1, B_dims, NPY_INT); memcpy(PyArray_DATA(G_B_obj), G_B, nB * sizeof(int)); free(G_B); // PyObjects created in the C code will be initialized with a refcount // of 1, for which reason we'll have to decref them when done here PyObject* values = Py_BuildValue("(OO)", A_gm_obj, G_B_obj); Py_DECREF(A_gm_obj); Py_DECREF(G_B_obj); return values; } // Horrible copy-paste of calculate_potential_matrix // Surely it must be possible to find a way to actually reuse code // Maybe some kind of preprocessor thing PyObject* calculate_potential_matrix_derivative(LFCObject *lfc, PyObject *args) { PyArrayObject* vt_G_obj; PyArrayObject* DVt_MM_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; int k, c; PyArrayObject* spline_obj_M_obj; PyArrayObject* beg_c_obj; PyArrayObject* pos_Wc_obj; int Mstart, Mstop; if (!PyArg_ParseTuple(args, "OOOOiiOOOii", &vt_G_obj, &DVt_MM_obj, &h_cv_obj, &n_c_obj, &k, &c, &spline_obj_M_obj, &beg_c_obj, &pos_Wc_obj, &Mstart, &Mstop)) return NULL; const double* vt_G = (const double*)PyArray_DATA(vt_G_obj); const double* h_cv = (const double*)PyArray_DATA(h_cv_obj); const long* n_c = (const long*)PyArray_DATA(n_c_obj); const SplineObject** spline_obj_M = \ (const SplineObject**)PyArray_DATA(spline_obj_M_obj); const double (*pos_Wc)[3] = (const double (*)[3])PyArray_DATA(pos_Wc_obj); long* beg_c = LONGP(beg_c_obj); int nM = PyArray_DIMS(DVt_MM_obj)[1]; double* work_gm = lfc->work_gm; double dv = lfc->dv; if (!lfc->bloch_boundary_conditions) { double* DVt_MM = (double*)PyArray_DATA(DVt_MM_obj); { GRID_LOOP_START(lfc, -1) { // In one grid loop iteration, only z changes. int iza = Ga % n_c[2] + beg_c[2]; int iy = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int ix = Ga / (n_c[2] * n_c[1]) + beg_c[0]; int iz = iza; //assert(Ga == ((ix - beg_c[0]) * n_c[1] + (iy - beg_c[1])) // * n_c[2] + iza - beg_c[2]); for (int i1 = 0; i1 < ni; i1++) { iz = iza; LFVolume* v1 = volume_i + i1; int M1 = v1->M; const SplineObject* spline_obj = spline_obj_M[M1]; const bmgsspline* spline = \ (const bmgsspline*)(&(spline_obj->spline)); int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; double fdYdc_m[nm1]; double rlYdfdr_m[nm1]; double f, dfdr; int l = (nm1 - 1) / 2; const double* pos_c = pos_Wc[v1->W]; //assert(2 * l + 1 == nm1); //assert(spline_obj->spline.l == l); int gm1 = 0; for (int G = Ga; G < Gb; G++, iz++) { double x = h_cv[0] * ix + h_cv[3] * iy + h_cv[6] * iz - pos_c[0]; double y = h_cv[1] * ix + h_cv[4] * iy + h_cv[7] * iz - pos_c[1]; double z = h_cv[2] * ix + h_cv[5] * iy + h_cv[8] * iz - pos_c[2]; double vtdv = vt_G[G] * dv; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double Rcinvr = r > 1e-15 ? R_c[c] / r : 0.0; //assert(G == ((ix - beg_c[0]) * n_c[1] + // (iy - beg_c[1])) * n_c[2] + iz - beg_c[2]); bmgs_get_value_and_derivative(spline, r, &f, &dfdr); //assert (r <= spline->dr * spline->nbins); // important switch(c) { case 0: spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdYdc_m); break; case 1: spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdYdc_m); break; case 2: spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdYdc_m); break; } spherical_harmonics(l, dfdr * Rcinvr, x, y, z, r2, rlYdfdr_m); int m1start = M1 < Mstart ? nm1 - nm1p : 0; for (int m1 = 0; m1 < nm1p; m1++, gm1++) { work_gm[gm1] = vtdv * (fdYdc_m[m1 + m1start] + rlYdfdr_m[m1 + m1start]); } } // end loop over G for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int M2 = v2->M; const double* A2_start_gm = v2->A_gm; const double* A2_gm; int nm2 = v2->nm; double* DVt_start_mm = DVt_MM + (M1p - Mstart) * nM + M2; double* DVt_mm; double work; for (int g = 0; g < nG; g++) { A2_gm = A2_start_gm + g * nm2; for (int m1 = 0; m1 < nm1p; m1++) { work = work_gm[g * nm1p + m1]; DVt_mm = DVt_start_mm + m1 * nM; for (int m2 = 0; m2 < nm2; m2++) { DVt_mm[m2] += A2_gm[m2] * work; } } } } // i2 loop } // G loop } // i1 loop GRID_LOOP_STOP(lfc, -1); } // c loop } else { complex double* DVt_MM = (complex double*)PyArray_DATA(DVt_MM_obj); { GRID_LOOP_START(lfc, k) { // In one grid loop iteration, only z changes. int iza = Ga % n_c[2] + beg_c[2]; int iy = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int ix = Ga / (n_c[2] * n_c[1]) + beg_c[0]; int iz = iza; for (int i1 = 0; i1 < ni; i1++) { iz = iza; LFVolume* v1 = volume_i + i1; int M1 = v1->M; const SplineObject* spline_obj = spline_obj_M[M1]; const bmgsspline* spline = \ (const bmgsspline*)(&(spline_obj->spline)); int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; double fdYdc_m[nm1]; double rlYdfdr_m[nm1]; double f, dfdr; int l = (nm1 - 1) / 2; //assert(2 * l + 1 == nm1); //assert(spline_obj->spline.l == l); const double* pos_c = pos_Wc[v1->W]; int gm1 = 0; for (int G = Ga; G < Gb; G++, iz++) { double x = h_cv[0] * ix + h_cv[3] * iy + h_cv[6] * iz - pos_c[0]; double y = h_cv[1] * ix + h_cv[4] * iy + h_cv[7] * iz - pos_c[1]; double z = h_cv[2] * ix + h_cv[5] * iy + h_cv[8] * iz - pos_c[2]; double vtdv = vt_G[G] * dv; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double Rc_over_r = r > 1e-15 ? R_c[c] / r : 0.0; bmgs_get_value_and_derivative(spline, r, &f, &dfdr); //assert (r <= spline->dr * spline->nbins); switch(c) { case 0: spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdYdc_m); break; case 1: spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdYdc_m); break; case 2: spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdYdc_m); break; } spherical_harmonics(l, dfdr * Rc_over_r, x, y, z, r2, rlYdfdr_m); int m1start = M1 < Mstart ? nm1 - nm1p : 0; for (int m1 = 0; m1 < nm1p; m1++, gm1++) { work_gm[gm1] = vtdv * (fdYdc_m[m1 + m1start] + rlYdfdr_m[m1 + m1start]); } } // end loop over G for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int M2 = v2->M; const double* A2_start_gm = v2->A_gm; const double* A2_gm; double complex* DVt_start_mm = DVt_MM + (M1p - Mstart) * nM + M2; double complex* DVt_mm; double complex work; int nm2 = v2->nm; double complex phase = conj(phase_i[i1]) * phase_i[i2]; for (int g = 0; g < nG; g++) { A2_gm = A2_start_gm + g * nm2; for (int m1 = 0; m1 < nm1p; m1++) { work = work_gm[g * nm1p + m1] * phase; DVt_mm = DVt_start_mm + m1 * nM; for (int m2 = 0; m2 < nm2; m2++) { DVt_mm[m2] += A2_gm[m2] * work; } } } } // i2 loop } // G loop } // i1 loop GRID_LOOP_STOP(lfc, k); } // c loop } Py_RETURN_NONE; } // Horrible copy-paste of calculate_potential_matrix // Surely it must be possible to find a way to actually reuse code // Maybe some kind of preprocessor thing PyObject* calculate_potential_matrix_force_contribution(LFCObject *lfc, PyObject *args) { PyArrayObject* vt_G_obj; PyArrayObject* rho_MM_obj; PyArrayObject* F_M_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; int k, c; PyArrayObject* spline_obj_M_obj; PyArrayObject* beg_c_obj; PyArrayObject* pos_Wc_obj; int Mstart, Mstop; if (!PyArg_ParseTuple(args, "OOOOOiiOOOii", &vt_G_obj, &rho_MM_obj, &F_M_obj, &h_cv_obj, &n_c_obj, &k, &c, &spline_obj_M_obj, &beg_c_obj, &pos_Wc_obj, &Mstart, &Mstop)) return NULL; const double* vt_G = (const double*)PyArray_DATA(vt_G_obj); const double* h_cv = (const double*)PyArray_DATA(h_cv_obj); const long* n_c = (const long*)PyArray_DATA(n_c_obj); const SplineObject** spline_obj_M = \ (const SplineObject**)PyArray_DATA(spline_obj_M_obj); const double (*pos_Wc)[3] = (const double (*)[3])PyArray_DATA(pos_Wc_obj); double* F_M = (double*)PyArray_DATA(F_M_obj); long* beg_c = LONGP(beg_c_obj); int nM = PyArray_DIMS(rho_MM_obj)[1]; double* work_gm = lfc->work_gm; double dv = lfc->dv; if (!lfc->bloch_boundary_conditions) { double* rho_MM = (double*)PyArray_DATA(rho_MM_obj); { GRID_LOOP_START(lfc, -1) { // In one grid loop iteration, only z changes. int iza = Ga % n_c[2] + beg_c[2]; int iy = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int ix = Ga / (n_c[2] * n_c[1]) + beg_c[0]; int iz = iza; //assert(Ga == ((ix - beg_c[0]) * n_c[1] + (iy - beg_c[1])) // * n_c[2] + iza - beg_c[2]); for (int i1 = 0; i1 < ni; i1++) { iz = iza; LFVolume* v1 = volume_i + i1; int M1 = v1->M; const SplineObject* spline_obj = spline_obj_M[M1]; const bmgsspline* spline = \ (const bmgsspline*)(&(spline_obj->spline)); int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; int m1start = M1 < Mstart ? nm1 - nm1p : 0; double fdYdc_m[nm1]; double rlYdfdr_m[nm1]; double f, dfdr; int l = (nm1 - 1) / 2; const double* pos_c = pos_Wc[v1->W]; //assert(2 * l + 1 == nm1); //assert(spline_obj->spline.l == l); int gm1 = 0; for (int G = Ga; G < Gb; G++, iz++) { double x = h_cv[0] * ix + h_cv[3] * iy + h_cv[6] * iz - pos_c[0]; double y = h_cv[1] * ix + h_cv[4] * iy + h_cv[7] * iz - pos_c[1]; double z = h_cv[2] * ix + h_cv[5] * iy + h_cv[8] * iz - pos_c[2]; double vtdv = vt_G[G] * dv; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double Rcinvr = r > 1e-15 ? R_c[c] / r : 0.0; //assert(G == ((ix - beg_c[0]) * n_c[1] + // (iy - beg_c[1])) * n_c[2] + iz - beg_c[2]); bmgs_get_value_and_derivative(spline, r, &f, &dfdr); //assert (r <= spline->dr * spline->nbins); // important switch(c) { case 0: spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdYdc_m); break; case 1: spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdYdc_m); break; case 2: spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdYdc_m); break; } spherical_harmonics(l, dfdr * Rcinvr, x, y, z, r2, rlYdfdr_m); for (int m1 = 0; m1 < nm1p; m1++, gm1++) { work_gm[gm1] = vtdv * (fdYdc_m[m1 + m1start] + rlYdfdr_m[m1 + m1start]); } } // end loop over G for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int M2 = v2->M; const double* A2_start_gm = v2->A_gm; const double* A2_gm; int nm2 = v2->nm; double* rho_start_mm = rho_MM + (M1p - Mstart) * nM + M2; double* rho_mm; double work; for (int g = 0; g < nG; g++) { A2_gm = A2_start_gm + g * nm2; for (int m1 = 0; m1 < nm1p; m1++) { rho_mm = rho_start_mm + m1 * nM; work = 0.0; for (int m2 = 0; m2 < nm2; m2++) { work += A2_gm[m2] * rho_mm[m2]; } F_M[M1p - Mstart + m1] += work * work_gm[g * nm1p + m1]; } } } // i2 loop } // G loop } // i1 loop GRID_LOOP_STOP(lfc, -1); } // c loop } else { complex double* rho_MM = (complex double*)PyArray_DATA(rho_MM_obj); { GRID_LOOP_START(lfc, k) { // In one grid loop iteration, only z changes. int iza = Ga % n_c[2] + beg_c[2]; int iy = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int ix = Ga / (n_c[2] * n_c[1]) + beg_c[0]; int iz = iza; for (int i1 = 0; i1 < ni; i1++) { iz = iza; LFVolume* v1 = volume_i + i1; int M1 = v1->M; const SplineObject* spline_obj = spline_obj_M[M1]; const bmgsspline* spline = \ (const bmgsspline*)(&(spline_obj->spline)); int nm1 = v1->nm; int M1p = MAX(M1, Mstart); int nm1p = MIN(M1 + nm1, Mstop) - M1p; if (nm1p <= 0) continue; int m1start = M1 < Mstart ? nm1 - nm1p : 0; double fdYdc_m[nm1]; double rlYdfdr_m[nm1]; double f, dfdr; int l = (nm1 - 1) / 2; //assert(2 * l + 1 == nm1); //assert(spline_obj->spline.l == l); const double* pos_c = pos_Wc[v1->W]; int gm1 = 0; for (int G = Ga; G < Gb; G++, iz++) { double x = h_cv[0] * ix + h_cv[3] * iy + h_cv[6] * iz - pos_c[0]; double y = h_cv[1] * ix + h_cv[4] * iy + h_cv[7] * iz - pos_c[1]; double z = h_cv[2] * ix + h_cv[5] * iy + h_cv[8] * iz - pos_c[2]; double vtdv = vt_G[G] * dv; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double Rc_over_r = r > 1e-15 ? R_c[c] / r : 0.0; bmgs_get_value_and_derivative(spline, r, &f, &dfdr); //assert (r <= spline->dr * spline->nbins); switch(c) { case 0: spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdYdc_m); break; case 1: spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdYdc_m); break; case 2: spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdYdc_m); break; } spherical_harmonics(l, dfdr * Rc_over_r, x, y, z, r2, rlYdfdr_m); for (int m1 = 0; m1 < nm1p; m1++, gm1++) { work_gm[gm1] = vtdv * (fdYdc_m[m1 + m1start] + rlYdfdr_m[m1 + m1start]); } } // end loop over G for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int M2 = v2->M; const double* A2_start_gm = v2->A_gm; const double* A2_gm; int nm2 = v2->nm; double complex* rho_start_mm = rho_MM + (M1p - Mstart) * nM + M2; double complex* rho_mm; double complex phase = conj(phase_i[i1]) * phase_i[i2]; double complex work; for (int g = 0; g < nG; g++) { A2_gm = A2_start_gm + g * nm2; for (int m1 = 0; m1 < nm1p; m1++) { rho_mm = rho_start_mm + m1 * nM; work = 0.0; for (int m2 = 0; m2 < nm2; m2++) { work += A2_gm[m2] * rho_mm[m2]; } F_M[M1p - Mstart + m1] += creal(work * work_gm[g * nm1p + m1] * phase); } } } // i2 loop } // G loop } // i1 loop GRID_LOOP_STOP(lfc, k); } // c loop } Py_RETURN_NONE; } PyObject* derivative(LFCObject *lfc, PyObject *args) { PyArrayObject* a_xG_obj; PyArrayObject* c_xMv_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; PyObject* spline_M_obj; PyArrayObject* beg_c_obj; PyArrayObject* pos_Wc_obj; int q; if (!PyArg_ParseTuple(args, "OOOOOOOi", &a_xG_obj, &c_xMv_obj, &h_cv_obj, &n_c_obj, &spline_M_obj, &beg_c_obj, &pos_Wc_obj, &q)) return NULL; int nd = PyArray_NDIM(a_xG_obj); npy_intp* dims = PyArray_DIMS(a_xG_obj); int nx = PyArray_MultiplyList(dims, nd - 3); int nG = PyArray_MultiplyList(dims + nd - 3, 3); int nM = PyArray_DIMS(c_xMv_obj)[PyArray_NDIM(c_xMv_obj) - 2]; const double* h_cv = (const double*)PyArray_DATA(h_cv_obj); const long* n_c = (const long*)PyArray_DATA(n_c_obj); const double (*pos_Wc)[3] = (const double (*)[3])PyArray_DATA(pos_Wc_obj); long* beg_c = LONGP(beg_c_obj); if (!lfc->bloch_boundary_conditions) { const double* a_G = (const double*)PyArray_DATA(a_xG_obj); double* c_Mv = (double*)PyArray_DATA(c_xMv_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, -1) { // In one grid loop iteration, only i2 changes. int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; for (int G = Ga; G < Gb; G++) { for (int i = 0; i < ni; i++) { LFVolume* vol = volume_i + i; int M = vol->M; double* c_mv = c_Mv + 3 * M; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; int nm = vol->nm; int l = (nm - 1) / 2; double x = xG - pos_Wc[vol->W][0]; double y = yG - pos_Wc[vol->W][1]; double z = zG - pos_Wc[vol->W][2]; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double af; double dfdr; bmgs_get_value_and_derivative(spline, r, &af, &dfdr); af *= a_G[G] * lfc->dv; double afdrlYdx_m[nm]; // a * f * d(r^l * Y)/dx spherical_harmonics_derivative_x(l, af, x, y, z, r2, afdrlYdx_m); for (int m = 0; m < nm; m++) c_mv[3 * m] += afdrlYdx_m[m]; spherical_harmonics_derivative_y(l, af, x, y, z, r2, afdrlYdx_m); for (int m = 0; m < nm; m++) c_mv[3 * m + 1] += afdrlYdx_m[m]; spherical_harmonics_derivative_z(l, af, x, y, z, r2, afdrlYdx_m); for (int m = 0; m < nm; m++) c_mv[3 * m + 2] += afdrlYdx_m[m]; if (r > 1e-15) { double arlm1Ydfdr_m[nm]; // a * r^(l-1) * Y * df/dr double arm1dfdr = a_G[G] / r * dfdr * lfc->dv; spherical_harmonics(l, arm1dfdr, x, y, z, r2, arlm1Ydfdr_m); for (int m = 0; m < nm; m++) for (int v = 0; v < 3; v++) c_mv[m * 3 + v] += arlm1Ydfdr_m[m] * R_c[v]; } } xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, -1); c_Mv += 3 * nM; a_G += nG; } } else { const complex double* a_G = (const complex double*)PyArray_DATA(a_xG_obj); complex double* c_Mv = (complex double*)PyArray_DATA(c_xMv_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, q) { // In one grid loop iteration, only i2 changes. int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; for (int G = Ga; G < Gb; G++) { for (int i = 0; i < ni; i++) { LFVolume* vol = volume_i + i; int M = vol->M; complex double* c_mv = c_Mv + 3 * M; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; int nm = vol->nm; int l = (nm - 1) / 2; double x = xG - pos_Wc[vol->W][0]; double y = yG - pos_Wc[vol->W][1]; double z = zG - pos_Wc[vol->W][2]; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double f; double dfdr; bmgs_get_value_and_derivative(spline, r, &f, &dfdr); double fdrlYdx_m[nm]; // a * f * d(r^l * Y)/dx complex double ap = a_G[G] * phase_i[i] * lfc->dv; spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) c_mv[3 * m ] += ap * fdrlYdx_m[m]; spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) c_mv[3 * m + 1] += ap * fdrlYdx_m[m]; spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) c_mv[3 * m + 2] += ap * fdrlYdx_m[m]; if (r > 1e-15) { double rlm1Ydfdr_m[nm]; // r^(l-1) * Y * df/dr double rm1dfdr = dfdr / r; spherical_harmonics(l, rm1dfdr, x, y, z, r2, rlm1Ydfdr_m); for (int m = 0; m < nm; m++) for (int v = 0; v < 3; v++) c_mv[m * 3 + v] += ap * rlm1Ydfdr_m[m] * R_c[v]; } } xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, q); c_Mv += 3 * nM; a_G += nG; } } Py_RETURN_NONE; } PyObject* normalized_derivative(LFCObject *lfc, PyObject *args) { PyArrayObject* a_G_obj; PyArrayObject* c_Mv_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; PyObject* spline_M_obj; PyArrayObject* beg_c_obj; PyArrayObject* pos_Wc_obj; if (!PyArg_ParseTuple(args, "OOOOOOO", &a_G_obj, &c_Mv_obj, &h_cv_obj, &n_c_obj, &spline_M_obj, &beg_c_obj, &pos_Wc_obj)) return NULL; const double* h_cv = (const double*)PyArray_DATA(h_cv_obj); const long* n_c = (const long*)PyArray_DATA(n_c_obj); const double (*pos_Wc)[3] = (const double (*)[3])PyArray_DATA(pos_Wc_obj); long* beg_c = LONGP(beg_c_obj); const double* a_G = (const double*)PyArray_DATA(a_G_obj); double* c_Mv = (double*)PyArray_DATA(c_Mv_obj); GRID_LOOP_START(lfc, -1) { int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; for (int G = Ga; G < Gb; G++) { for (int i = 0; i < ni; i++) { LFVolume* vol = volume_i + i; int M = vol->M; double* c_mv = c_Mv + 7 * M; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; int nm = vol->nm; int l = (nm - 1) / 2; double x = xG - pos_Wc[vol->W][0]; double y = yG - pos_Wc[vol->W][1]; double z = zG - pos_Wc[vol->W][2]; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double f; double dfdr; bmgs_get_value_and_derivative(spline, r, &f, &dfdr); f *= lfc->dv; double a = a_G[G]; if (l == 0) c_mv[6] += 0.28209479177387814 * a * f; double fdrlYdx_m[nm]; // f * d(r^l * Y)/dx spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) { c_mv[7 * m ] += a * fdrlYdx_m[m]; c_mv[7 * m + 3] += fdrlYdx_m[m]; } spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) { c_mv[7 * m + 1] += a * fdrlYdx_m[m]; c_mv[7 * m + 4] += fdrlYdx_m[m]; } spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) { c_mv[7 * m + 2] += a * fdrlYdx_m[m]; c_mv[7 * m + 5] += fdrlYdx_m[m]; } if (r > 1e-15) { double rlm1Ydfdr_m[nm]; // r^(l-1) * Y * df/dr double rm1dfdr = dfdr * lfc->dv / r; spherical_harmonics(l, rm1dfdr, x, y, z, r2, rlm1Ydfdr_m); for (int m = 0; m < nm; m++) for (int v = 0; v < 3; v++) { c_mv[m * 7 + v] += a * rlm1Ydfdr_m[m] * R_c[v]; c_mv[m * 7 + v + 3] += rlm1Ydfdr_m[m] * R_c[v]; } } } xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, -1); Py_RETURN_NONE; } PyObject* ae_valence_density_correction(LFCObject *lfc, PyObject *args) { PyArrayObject* rho_MM_obj; PyArrayObject* n_G_obj; PyArrayObject* a_W_obj; PyArrayObject* I_a_obj; PyArrayObject* x_W_obj; if (!PyArg_ParseTuple(args, "OOOOO", &rho_MM_obj, &n_G_obj, &a_W_obj, &I_a_obj, &x_W_obj)) return NULL; double* n_G = (double*)PyArray_DATA(n_G_obj); int* a_W = (int*)PyArray_DATA(a_W_obj); double* I_a = (double*)PyArray_DATA(I_a_obj); const double* rho_MM = (const double*)PyArray_DATA(rho_MM_obj); int* x_W = (int*)PyArray_DATA(x_W_obj); int nM = PyArray_DIMS(rho_MM_obj)[0]; GRID_LOOP_START(lfc, -1) { for (int i1 = 0; i1 < ni; i1++) { LFVolume* v1 = volume_i + i1; int x1 = x_W[v1->W]; int a1 = a_W[v1->W]; int M1 = v1->M; int nm1 = v1->nm; double Ia = 0.0; for (int i2 = 0; i2 < ni; i2++) { LFVolume* v2 = volume_i + i2; int x2 = x_W[v2->W]; if (x1 != x2) continue; int a2 = a_W[v2->W]; if (a1 != a2) continue; int M2 = v2->M; int nm2 = v2->nm; const double* rho_mm = rho_MM + M1 * nM + M2; for (int g = 0; g < nG; g++) { double density = 0.0; for (int m2 = 0; m2 < nm2; m2++) for (int m1 = 0; m1 < nm1; m1++) density += (rho_mm[m2 + m1 * nM] * v1->A_gm[g * nm1 + m1] * v2->A_gm[g * nm2 + m2]); n_G[Ga + g] += density; Ia += density; } } I_a[a1] += Ia * lfc->dv; } } GRID_LOOP_STOP(lfc, -1); Py_RETURN_NONE; } PyObject* ae_core_density_correction(LFCObject *lfc, PyObject *args) { double scale; PyArrayObject* n_G_obj; PyArrayObject* a_W_obj; PyArrayObject* I_a_obj; if (!PyArg_ParseTuple(args, "dOOO", &scale, &n_G_obj, &a_W_obj, &I_a_obj)) return NULL; double* n_G = (double*)PyArray_DATA(n_G_obj); int* a_W = (int*)PyArray_DATA(a_W_obj); double* I_a = (double*)PyArray_DATA(I_a_obj); GRID_LOOP_START(lfc, -1) { for (int i = 0; i < ni; i++) { LFVolume* v = volume_i + i; double Ia = 0.0; for (int g = 0; g < nG; g++) { double density = scale * v->A_gm[g]; n_G[Ga + g] += density; Ia += density; } I_a[a_W[v->W]] += Ia * lfc->dv; } } GRID_LOOP_STOP(lfc, -1); Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/lfc.h000066400000000000000000000106101316441372200212610ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #ifndef LFC_H #define LFC_H #include typedef struct { const double* A_gm; // function values int nm; // number of functions (2*l+1) int M; // global number of first function int W; // volume number } LFVolume; typedef struct { PyObject_HEAD double dv; // volume per grid point int nW; // number of volumes int nB; // number of boundary points double* work_gm; // work space LFVolume* volume_W; // pointers to volumes LFVolume* volume_i; // pointers to volumes at current grid point int* G_B; // boundary grid points int* W_B; // volume numbers int* i_W; // mapping from all volumes to current volumes int* ngm_W; // number of grid points per volume bool bloch_boundary_conditions; // Gamma-point calculation? complex double* phase_kW; // phase factors: exp(ik.R) complex double* phase_i; // phase factors for current volumes } LFCObject; #define GRID_LOOP_START(lfc, k) \ { \ int* G_B = lfc->G_B; \ int* W_B = lfc->W_B; \ int* i_W = lfc->i_W; \ complex double* phase_i = lfc->phase_i; \ LFVolume* volume_i = lfc->volume_i; \ LFVolume* volume_W = lfc->volume_W; \ double complex* phase_W = lfc->phase_kW + k * lfc->nW; \ int Ga = 0; \ int ni = 0; \ for (int B = 0; B < lfc->nB; B++) \ { \ int Gb = G_B[B]; \ int nG = Gb - Ga; \ if (nG > 0) \ { #define GRID_LOOP_STOP(lfc, k) \ for (int i = 0; i < ni; i++) \ volume_i[i].A_gm += nG * volume_i[i].nm; \ } \ int Wnew = W_B[B]; \ if (Wnew >= 0) \ { \ /* Entering new sphere: */ \ volume_i[ni] = volume_W[Wnew]; \ if (k >= 0) \ phase_i[ni] = phase_W[Wnew]; \ i_W[Wnew] = ni; \ ni++; \ } \ else \ { \ /* Leaving sphere: */ \ int Wold = -1 - Wnew; \ int iold = i_W[Wold]; \ volume_W[Wold].A_gm = volume_i[iold].A_gm; \ ni--; \ volume_i[iold] = volume_i[ni]; \ if (k >= 0) \ phase_i[iold] = phase_i[ni]; \ int Wlast = volume_i[iold].W; \ i_W[Wlast] = iold; \ } \ Ga = Gb; \ } \ for (int W = 0; W < lfc->nW; W++) \ volume_W[W].A_gm -= lfc->ngm_W[W]; \ } #endif gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/lfc2.c000066400000000000000000000314351316441372200213460ustar00rootroot00000000000000/* Copyright (C) 2010 CAMd * Please see the accompanying LICENSE file for further information. */ #include "extensions.h" #include "spline.h" #include "lfc.h" #include "bmgs/spherical_harmonics.h" PyObject* second_derivative(LFCObject *lfc, PyObject *args) { PyArrayObject* a_G_obj; PyArrayObject* c_Mvv_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; PyObject* spline_M_obj; PyArrayObject* beg_c_obj; PyArrayObject* pos_Wc_obj; int q; if (!PyArg_ParseTuple(args, "OOOOOOOi", &a_G_obj, &c_Mvv_obj, &h_cv_obj, &n_c_obj, &spline_M_obj, &beg_c_obj, &pos_Wc_obj, &q)) return NULL; // Copied from derivative member function int nd = PyArray_NDIM(a_G_obj); npy_intp* dims = PyArray_DIMS(a_G_obj); int nx = PyArray_MultiplyList(dims, nd - 3); int nG = PyArray_MultiplyList(dims + nd - 3, 3); int nM = PyArray_DIM(c_Mvv_obj, PyArray_NDIM(c_Mvv_obj) - 2); // These were already present const double* h_cv = (const double*)PyArray_DATA(h_cv_obj); const long* n_c = (const long*)PyArray_DATA(n_c_obj); const double (*pos_Wc)[3] = (const double (*)[3])PyArray_DATA(pos_Wc_obj); long* beg_c = LONGP(beg_c_obj); /////////////////////////////////////////////// const double Y00dv = lfc->dv / sqrt(4.0 * M_PI); if (!lfc->bloch_boundary_conditions) { const double* a_G = (const double*)PyArray_DATA(a_G_obj); double* c_Mvv = (double*)PyArray_DATA(c_Mvv_obj); // Loop over number of x-dimension in a_xG (not relevant yet) for (int x = 0; x < nx; x++) { // JJs old stuff GRID_LOOP_START(lfc, -1) { // In one grid loop iteration, only i2 changes. int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; for (int G = Ga; G < Gb; G++) { for (int i = 0; i < ni; i++) { LFVolume* vol = volume_i + i; int M = vol->M; double* c_mvv = c_Mvv + 9 * M; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; double x = xG - pos_Wc[vol->W][0]; double y = yG - pos_Wc[vol->W][1]; double z = zG - pos_Wc[vol->W][2]; double r2 = x * x + y * y + z * z; double r = sqrt(r2); int bin = r / spline->dr; assert(bin <= spline->nbins); double* s = spline->data + 4 * bin; double u = r - bin * spline->dr; double dfdror; if (bin == 0) dfdror = 2.0 * s[2] + 3.0 * s[3] * r; else dfdror = (s[1] + u * (2.0 * s[2] + u * 3.0 * s[3])) / r; double a = a_G[G] * Y00dv; dfdror *= a; c_mvv[0] += dfdror; c_mvv[4] += dfdror; c_mvv[8] += dfdror; if (r > 1e-15) { double b = ((2.0 * s[2] + 6.0 * s[3] * u) * a - dfdror) / r2; c_mvv[0] += b * x * x; c_mvv[1] += b * x * y; c_mvv[2] += b * x * z; c_mvv[3] += b * y * x; c_mvv[4] += b * y * y; c_mvv[5] += b * y * z; c_mvv[6] += b * z * x; c_mvv[7] += b * z * y; c_mvv[8] += b * z * z; } } xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, -1); c_Mvv += 9 * nM; a_G += nG; } } else { const complex double* a_G = (const complex double*)PyArray_DATA(a_G_obj); complex double* c_Mvv = (complex double*)PyArray_DATA(c_Mvv_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, q) { // In one grid loop iteration, only i2 changes. int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; for (int G = Ga; G < Gb; G++) { for (int i = 0; i < ni; i++) { LFVolume* vol = volume_i + i; int M = vol->M; complex double* c_mvv = c_Mvv + 9 * M; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; double x = xG - pos_Wc[vol->W][0]; double y = yG - pos_Wc[vol->W][1]; double z = zG - pos_Wc[vol->W][2]; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double dfdror; // use bmgs_get_value_and_derivative instead ??!! int bin = r / spline->dr; assert(bin <= spline->nbins); double u = r - bin * spline->dr; double* s = spline->data + 4 * bin; if (bin == 0) dfdror = 2.0 * s[2] + 3.0 * s[3] * r; else dfdror = (s[1] + u * (2.0 * s[2] + u * 3.0 * s[3])) / r; // phase added here complex double a = a_G[G] * phase_i[i] * Y00dv; // dfdror *= a; c_mvv[0] += a * dfdror; c_mvv[4] += a * dfdror; c_mvv[8] += a * dfdror; if (r > 1e-15) { double b = (2.0 * s[2] + 6.0 * s[3] * u - dfdror) / r2; c_mvv[0] += a * b * x * x; c_mvv[1] += a * b * x * y; c_mvv[2] += a * b * x * z; c_mvv[3] += a * b * y * x; c_mvv[4] += a * b * y * y; c_mvv[5] += a * b * y * z; c_mvv[6] += a * b * z * x; c_mvv[7] += a * b * z * y; c_mvv[8] += a * b * z * z; } } xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, q); c_Mvv += 9 * nM; a_G += nG; } } Py_RETURN_NONE; } PyObject* add_derivative(LFCObject *lfc, PyObject *args) { // Coefficients for the lfc's PyArrayObject* c_xM_obj; // Array PyArrayObject* a_xG_obj; PyArrayObject* h_cv_obj; PyArrayObject* n_c_obj; PyObject* spline_M_obj; PyArrayObject* beg_c_obj; PyArrayObject* pos_Wc_obj; // Atom index int a; // Cartesian coordinate int v; // k-point index int q; if (!PyArg_ParseTuple(args, "OOOOOOOiii", &c_xM_obj, &a_xG_obj, &h_cv_obj, &n_c_obj, &spline_M_obj, &beg_c_obj, &pos_Wc_obj, &a, &v, &q)) return NULL; // Number of dimensions int nd = PyArray_NDIM(a_xG_obj); // Array with lengths of array dimensions npy_intp* dims = PyArray_DIMS(a_xG_obj); // Number of extra dimensions int nx = PyArray_MultiplyList(dims, nd - 3); // Number of grid points int nG = PyArray_MultiplyList(dims + nd - 3, 3); // Number of lfc's int nM = PyArray_DIM(c_xM_obj, PyArray_NDIM(c_xM_obj) - 1); const double* h_cv = (const double*)PyArray_DATA(h_cv_obj); const long* n_c = (const long*)PyArray_DATA(n_c_obj); const double (*pos_Wc)[3] = (const double (*)[3])PyArray_DATA(pos_Wc_obj); long* beg_c = LONGP(beg_c_obj); if (!lfc->bloch_boundary_conditions) { const double* c_M = (const double*)PyArray_DATA(c_xM_obj); double* a_G = (double*)PyArray_DATA(a_xG_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, -1) { // In one grid loop iteration, only i2 changes. int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; // Grid point position double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; // Loop over grid points in current stride for (int G = Ga; G < Gb; G++) { // Loop over volumes at current grid point for (int i = 0; i < ni; i++) { LFVolume* vol = volume_i + i; int M = vol->M; // Check that the volume belongs to the atom in consideration later int W = vol->W; int nm = vol->nm; int l = (nm - 1) / 2; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; double x = xG - pos_Wc[W][0]; double y = yG - pos_Wc[W][1]; double z = zG - pos_Wc[W][2]; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double f; double dfdr; bmgs_get_value_and_derivative(spline, r, &f, &dfdr); // First contribution: f * d(r^l * Y)/dv double fdrlYdx_m[nm]; if (v == 0) spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdrlYdx_m); else if (v == 1) spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdrlYdx_m); else spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) a_G[G] += fdrlYdx_m[m] * c_M[M + m]; // Second contribution: r^(l-1) * Y * df/dr * R_v if (r > 1e-15) { double rlm1Ydfdr_m[nm]; // r^(l-1) * Y * df/dr double rm1dfdr = 1. / r * dfdr; spherical_harmonics(l, rm1dfdr, x, y, z, r2, rlm1Ydfdr_m); for (int m = 0; m < nm; m++) a_G[G] += rlm1Ydfdr_m[m] * R_c[v] * c_M[M + m]; } } // Update coordinates of current grid point xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, -1); c_M += nM; a_G += nG; } } else { const double complex* c_M = (const double complex*)PyArray_DATA(c_xM_obj); double complex* a_G = (double complex*)PyArray_DATA(a_xG_obj); for (int x = 0; x < nx; x++) { GRID_LOOP_START(lfc, q) { // In one grid loop iteration, only i2 changes. int i2 = Ga % n_c[2] + beg_c[2]; int i1 = (Ga / n_c[2]) % n_c[1] + beg_c[1]; int i0 = Ga / (n_c[2] * n_c[1]) + beg_c[0]; // Grid point position double xG = h_cv[0] * i0 + h_cv[3] * i1 + h_cv[6] * i2; double yG = h_cv[1] * i0 + h_cv[4] * i1 + h_cv[7] * i2; double zG = h_cv[2] * i0 + h_cv[5] * i1 + h_cv[8] * i2; // Loop over grid points in current stride for (int G = Ga; G < Gb; G++) { // Loop over volumes at current grid point for (int i = 0; i < ni; i++) { // Phase of volume double complex conjphase = conj(phase_i[i]); LFVolume* vol = volume_i + i; int M = vol->M; // Check that the volume belongs to the atom in consideration later int W = vol->W; int nm = vol->nm; int l = (nm - 1) / 2; const bmgsspline* spline = (const bmgsspline*) \ &((const SplineObject*)PyList_GetItem(spline_M_obj, M))->spline; double x = xG - pos_Wc[W][0]; double y = yG - pos_Wc[W][1]; double z = zG - pos_Wc[W][2]; double R_c[] = {x, y, z}; double r2 = x * x + y * y + z * z; double r = sqrt(r2); double f; double dfdr; bmgs_get_value_and_derivative(spline, r, &f, &dfdr); // First contribution: f * d(r^l * Y)/dv double fdrlYdx_m[nm]; if (v == 0) spherical_harmonics_derivative_x(l, f, x, y, z, r2, fdrlYdx_m); else if (v == 1) spherical_harmonics_derivative_y(l, f, x, y, z, r2, fdrlYdx_m); else spherical_harmonics_derivative_z(l, f, x, y, z, r2, fdrlYdx_m); for (int m = 0; m < nm; m++) a_G[G] += fdrlYdx_m[m] * c_M[M + m] * conjphase; // Second contribution: r^(l-1) * Y * df/dr * R_v if (r > 1e-15) { double rlm1Ydfdr_m[nm]; // r^(l-1) * Y * df/dr double rm1dfdr = 1. / r * dfdr; spherical_harmonics(l, rm1dfdr, x, y, z, r2, rlm1Ydfdr_m); for (int m = 0; m < nm; m++) a_G[G] += rlm1Ydfdr_m[m] * R_c[v] * c_M[M + m] * conjphase; } } // Update coordinates of current grid point xG += h_cv[6]; yG += h_cv[7]; zG += h_cv[8]; } } GRID_LOOP_STOP(lfc, q); c_M += nM; a_G += nG; } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/localized_functions.c000066400000000000000000000346661316441372200245670ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2005-2008 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include "spline.h" #include #ifdef PARALLEL # include #else typedef int* MPI_Request; // !!!!!!!??????????? typedef int* MPI_Comm; # define MPI_COMM_NULL 0 # define MPI_Comm_rank(comm, rank) *(rank) = 0 # define MPI_Bcast(buff, count, datatype, root, comm) 0 #endif #include "mympi.h" #include "localized_functions.h" #ifdef GPAW_NO_UNDERSCORE_BLAS # define dgemm_ dgemm # define dgemv_ dgemv #endif int dgemm_(char *transa, char *transb, int *m, int * n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc); int dgemv_(char *trans, int *m, int * n, double *alpha, double *a, int *lda, double *x, int *incx, double *beta, double *y, int *incy); static void localized_functions_dealloc(LocalizedFunctionsObject *self) { free(self->f); free(self->w); PyObject_DEL(self); } static PyObject * localized_functions_integrate(LocalizedFunctionsObject *self, PyObject *args) { PyArrayObject* aa; PyArrayObject* bb; if (!PyArg_ParseTuple(args, "OO", &aa, &bb)) return NULL; const double* a = DOUBLEP(aa); double* b = DOUBLEP(bb); int na = 1; for (int d = 0; d < PyArray_NDIM(aa) - 3; d++) na *= PyArray_DIM(aa, d); int nf = self->nf; double* f = self->f; double* w = self->w; int ng = self->ng; int ng0 = self->ng0; if (PyArray_DESCR(aa)->type_num == NPY_DOUBLE) for (int n = 0; n < na; n++) { bmgs_cut(a, self->size, self->start, w, self->size0); double zero = 0.0; int inc = 1; dgemv_("t", &ng0, &nf, &self->dv, f, &ng0, w, &inc, &zero, b, &inc); a += ng; b += nf; } else for (int n = 0; n < na; n++) { bmgs_cutz((const double_complex*)a, self->size, self->start, (double_complex*)w, self->size0); double zero = 0.0; int inc = 2; dgemm_("n", "n", &inc, &nf, &ng0, &self->dv, w, &inc, f, &ng0, &zero, b, &inc); a += 2 * ng; b += 2 * nf; } Py_RETURN_NONE; } static PyObject * localized_functions_derivative( LocalizedFunctionsObject *self, PyObject *args) { PyArrayObject* aa; PyArrayObject* bb; if (!PyArg_ParseTuple(args, "OO", &aa, &bb)) return NULL; const double* a = DOUBLEP(aa); double* b = DOUBLEP(bb); int na = 1; for (int d = 0; d < PyArray_NDIM(aa) - 3; d++) na *= PyArray_DIM(aa, d); int nf = self->nfd; double* f = self->fd; double* w = self->w; int ng = self->ng; int ng0 = self->ng0; if (PyArray_DESCR(aa)->type_num == NPY_DOUBLE) for (int n = 0; n < na; n++) { bmgs_cut(a, self->size, self->start, w, self->size0); double zero = 0.0; int inc = 1; dgemv_("t", &ng0, &nf, &self->dv, f, &ng0, w, &inc, &zero, b, &inc); a += ng; b += nf; } else for (int n = 0; n < na; n++) { bmgs_cutz((const double_complex*)a, self->size, self->start, (double_complex*)w, self->size0); double zero = 0.0; int inc = 2; dgemm_("n", "n", &inc, &nf, &ng0, &self->dv, w, &inc, f, &ng0, &zero, b, &inc); a += 2 * ng; b += 2 * nf; } Py_RETURN_NONE; } static PyObject * localized_functions_add(LocalizedFunctionsObject *self, PyObject *args) { PyArrayObject* cc; PyArrayObject* aa; if (!PyArg_ParseTuple(args, "OO", &cc, &aa)) return NULL; double* c = DOUBLEP(cc); double* a = DOUBLEP(aa); int na = 1; for (int d = 0; d < PyArray_NDIM(aa) - 3; d++) na *= PyArray_DIM(aa, d); int ng = self->ng; int ng0 = self->ng0; int nf = self->nf; double* f = self->f; double* w = self->w; if (PyArray_DESCR(aa)->type_num == NPY_DOUBLE) for (int n = 0; n < na; n++) { double zero = 0.0; double one = 1.0; int inc = 1; dgemv_("n", &ng0, &nf, &one, f, &ng0, c, &inc, &zero, w, &inc); bmgs_pastep(w, self->size0, a, self->size, self->start); a += ng; c += nf; } else for (int n = 0; n < na; n++) { double zero = 0.0; double one = 1.0; int inc = 2; dgemm_("n", "t", &inc, &ng0, &nf, &one, c, &inc, f, &ng0, &zero, w, &inc); bmgs_pastepz((const double_complex*)w, self->size0, (double_complex*)a, self->size, self->start); a += 2 * ng; c += 2 * nf; } Py_RETURN_NONE; } static PyObject * localized_functions_add_density(LocalizedFunctionsObject* self, PyObject *args) { PyArrayObject* dd; PyArrayObject* oo; if (!PyArg_ParseTuple(args, "OO", &dd, &oo)) return NULL; const double* o = DOUBLEP(oo); double* d = DOUBLEP(dd); int nf = self->nf; int ng0 = self->ng0; const double* f = self->f; double* w = self->w; memset(w, 0, ng0 * sizeof(double)); for (int i = 0; i < nf; i++) for (int n = 0; n < ng0; n++) { double g = *f++; w[n] += o[i] * g * g; } bmgs_pastep(w, self->size0, d, self->size, self->start); Py_RETURN_NONE; } static PyObject * localized_functions_add_density2(LocalizedFunctionsObject* self, PyObject *args) { PyArrayObject* dd; // density array to be added to PyArrayObject* oo; // density matrix if (!PyArg_ParseTuple(args, "OO", &dd, &oo)) return NULL; const double* o = DOUBLEP(oo); double* d = DOUBLEP(dd); int nf = self->nf; int ng0 = self->ng0; const double* f = self->f; double* w = self->w; memset(w, 0, ng0 * sizeof(double)); int p = 0; // compressed ii index double F = 0.0; // integrated value for (int i = 0; i < nf; i++) { for (int j = i; j < nf; j++) { for (int n = 0; n < ng0; n++) { double tmp = o[p] * f[n + i * ng0] * f[n + j * ng0]; F += tmp; w[n] += tmp; } p++; } } bmgs_pastep(w, self->size0, d, self->size, self->start); //Py_RETURN_NONE; return Py_BuildValue("d", F * self->dv); } static PyObject * localized_functions_norm(LocalizedFunctionsObject* self, PyObject *args) { PyArrayObject* I_obj; if (!PyArg_ParseTuple(args, "O", &I_obj)) return NULL; double (*II)[4] = (double (*)[4])DOUBLEP(I_obj); const double* f = self->f; for (int i = 0; i < self->nf; i++) { double F = 0.0; for (int n = 0; n < self->ng0; n++) F += f[n]; II[i][0] += F * self->dv; f += self->ng0; } if (self->nfd > 0) { const double* fd = self->fd; for (int i = 0; i < self->nf; i++) for (int c = 0; c < 3; c++) { double F = 0.0; for (int n = 0; n < self->ng0; n++) F += fd[n]; II[i][c + 1] += F * self->dv; fd += self->ng0; } } Py_RETURN_NONE; } static PyObject * localized_functions_normalize(LocalizedFunctionsObject* self, PyObject *args) { double I0; PyArrayObject* I_obj; if (!PyArg_ParseTuple(args, "dO", &I0, &I_obj)) return NULL; double (*II)[4] = (double (*)[4])DOUBLEP(I_obj); double* f = self->f; double s = I0 / II[0][0]; // Scale spherically symmetric function so that the integral // becomes exactly I0: for (int n = 0; n < self->ng0; n++) f[n] *= s; // Adjust all other functions (l > 0) so that they integrate to zero: for (int i = 1; i < self->nf; i++) { double *g = f + i * self->ng0; double a = -II[i][0] / I0; for (int n = 0; n < self->ng0; n++) g[n] += a * f[n]; } if (self->nfd > 0) { // Adjust derivatives: double* fd = self->fd; for (int n = 0; n < 3 * self->ng0; n++) fd[n] *= s; for (int c = 0; c < 3; c++) { double sd = II[0][c + 1] / II[0][0]; for (int n = 0; n < self->ng0; n++) fd[n + c * self->ng0] -= f[n] * sd ; } for (int i = 1; i < self->nf; i++) { double *gd = fd + 3 * i * self->ng0; double a = -II[i][0] / I0; for (int n = 0; n < 3 * self->ng0; n++) gd[n] += a * fd[n]; for (int c = 0; c < 3; c++) { double sd = II[i][c + 1] / I0; for (int n = 0; n < self->ng0; n++) gd[n + c * self->ng0] -= f[n] * sd ; } } } Py_RETURN_NONE; } static PyObject * get_functions(LocalizedFunctionsObject* self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; npy_intp dims[4] = {self->nf, self->size0[0], self->size0[1], self->size0[2]}; PyArrayObject* functions = (PyArrayObject*)PyArray_SimpleNew(4, dims, NPY_DOUBLE); memcpy(PyArray_DATA(functions), self->f, self->nf * self->ng0 * sizeof(double)); return (PyObject*)functions; } static PyObject * set_corner(LocalizedFunctionsObject* self, PyObject *args) { PyArrayObject* start_c_obj; if (!PyArg_ParseTuple(args, "O", &start_c_obj)) return NULL; double *start_c = DOUBLEP(start_c_obj); for (int c = 0; c < 3; c++) self->start[c] = start_c[c]; Py_RETURN_NONE; } #ifdef PARALLEL static PyObject * localized_functions_broadcast(LocalizedFunctionsObject* self, PyObject *args) { PyObject* comm_obj; int root; if (!PyArg_ParseTuple(args, "Oi", &comm_obj, &root)) return NULL; MPI_Comm comm = ((MPIObject*)comm_obj)->comm; MPI_Bcast(self->f, self->ng0 * (self->nf + self->nfd), MPI_DOUBLE, root, comm); Py_RETURN_NONE; } #endif static PyMethodDef localized_functions_methods[] = { {"integrate", (PyCFunction)localized_functions_integrate, METH_VARARGS, 0}, {"derivative", (PyCFunction)localized_functions_derivative, METH_VARARGS, 0}, {"add", (PyCFunction)localized_functions_add, METH_VARARGS, 0}, {"add_density", (PyCFunction)localized_functions_add_density, METH_VARARGS, 0}, {"add_density2", (PyCFunction)localized_functions_add_density2, METH_VARARGS, 0}, {"norm", (PyCFunction)localized_functions_norm, METH_VARARGS, 0}, {"normalize", (PyCFunction)localized_functions_normalize, METH_VARARGS, 0}, {"get_functions", (PyCFunction)get_functions, METH_VARARGS, 0}, {"set_corner", (PyCFunction)set_corner, METH_VARARGS, 0}, #ifdef PARALLEL {"broadcast", (PyCFunction)localized_functions_broadcast, METH_VARARGS, 0}, #endif {NULL, NULL, 0, NULL} }; PyTypeObject LocalizedFunctionsType = { PyVarObject_HEAD_INIT(NULL, 0) "LocalizedFunctions", sizeof(LocalizedFunctionsObject), 0, (destructor)localized_functions_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "LF object", 0, 0, 0, 0, 0, 0, localized_functions_methods }; PyObject * NewLocalizedFunctionsObject(PyObject *obj, PyObject *args) { PyObject* radials; PyArrayObject* size0_array; PyArrayObject* size_array; PyArrayObject* start_array; PyArrayObject* h_array; PyArrayObject* C_array; int real; int forces; int compute; if (!PyArg_ParseTuple(args, "OOOOOOiii", &radials, &size0_array, &size_array, &start_array, &h_array, &C_array, &real, &forces, &compute)) return NULL; LocalizedFunctionsObject *self = PyObject_NEW(LocalizedFunctionsObject, &LocalizedFunctionsType); if (self == NULL) return NULL; const long* size0 = LONGP(size0_array); const long* size = LONGP(size_array); const long* start = LONGP(start_array); const double* h = DOUBLEP(h_array); const double* C = DOUBLEP(C_array); self->dv = h[0] * h[1] * h[2]; int ng = size[0] * size[1] * size[2]; int ng0 = size0[0] * size0[1] * size0[2]; self->ng = ng; self->ng0 = ng0; for (int i = 0; i < 3; i++) { self->size0[i] = size0[i]; self->size[i] = size[i]; self->start[i] = start[i]; } int nf = 0; int nfd = 0; int nbins = 0; double dr = 0.0; for (int j = 0; j < PyList_Size(radials); j++) { const bmgsspline* spline = &(((SplineObject*)PyList_GetItem(radials, j))->spline); int l = spline->l; assert(l <= 4); if (j == 0) { nbins = spline->nbins; dr = spline->dr; } else { assert(spline->nbins == nbins); assert(spline->dr == dr); } nf += (2 * l + 1); } if (forces) nfd = 3 * nf; self->nf = nf; self->nfd = nfd; self->f = GPAW_MALLOC(double, (nf + nfd) * ng0); if (forces) self->fd = self->f + nf * ng0; else self->fd = 0; int ndouble = (real ? 1 : 2); self->w = GPAW_MALLOC(double, ng0 * ndouble); if (compute) { int* bin = GPAW_MALLOC(int, ng0); double* d = GPAW_MALLOC(double, ng0); double* f0 = GPAW_MALLOC(double, ng0); double* fd0 = 0; if (forces) fd0 = GPAW_MALLOC(double, ng0); double* a = self->f; double* ad = self->fd; for (int j = 0; j < PyList_Size(radials); j++) { const bmgsspline* spline = &(((SplineObject*)PyList_GetItem(radials, j))->spline); if (j == 0) bmgs_radial1(spline, self->size0, C, h, bin, d); bmgs_radial2(spline, self->size0, bin, d, f0, fd0); int l = spline->l; for (int m = -l; m <= l; m++) { bmgs_radial3(spline, m, self->size0, C, h, f0, a); a += ng0; } if (forces) for (int m = -l; m <= l; m++) for (int c = 0; c < 3; c++) { bmgs_radiald3(spline, m, c, self->size0, C, h, f0, fd0, ad); ad += ng0; } } if (forces) free(fd0); free(f0); free(d); free(bin); } return (PyObject*)self; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/localized_functions.h000066400000000000000000000014701316441372200245570ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Please see the accompanying LICENSE file for further information. */ #include typedef struct { PyObject_HEAD double dv; // volume per grid point int size[3]; // dimensions of big box int start[3]; // corner of small box int size0[3]; // dimensions of small box int ng; // number of grid points in big box int ng0; // number of grid points in small box int nf; // number of localized functions int nfd; // number of derivatives: zero or 3*nf // pointers to size0 arrays: double* f; // localized functions double* fd; // xyz-derivatives of localized functions double* w; // work array for one double or double complex array } LocalizedFunctionsObject; gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/mlsqr.c000066400000000000000000000130331316441372200216500ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" #ifdef GPAW_NO_UNDERSCORE_LAPACK # define dgels_ dgels #endif // Predefine dgels function of lapack int dgels_(char* trans, int *m, int *n, int *nrhs, double* a, int *lda, double* b, int *ldb, double* work, int* lwork, int *info); int safemod(int x, int m) { return (x%m + m)%m; } // Perform a moving linear least squares interpolation to arrays // Input arguments: // order: order of polynomial used (1 or 2) // cutoff: the cutoff of weight (in grid points) // coords: scaled coords [0,1] for interpolation // N_c: number of grid points // beg_c: first grid point // data: the array used // target: the results are stored in this array PyObject* mlsqr(PyObject *self, PyObject *args) { // The order of interpolation unsigned char order = -1; // The cutoff for moving least squares double cutoff = -1; // The coordinates for interpolation: array of size (3, N) PyArrayObject* coords = 0; // Number of grid points PyArrayObject* N_c = 0; // Beginning of grid PyArrayObject* beg_c = 0; // The 3d-data to be interpolated: array of size (X, Y, Z) PyArrayObject* data; // The interpolation target: array of size (N,) PyArrayObject* target = 0; if (!PyArg_ParseTuple(args, "BdOOOOO", &order, &cutoff, &coords, &N_c, &beg_c, &data, &target)) { return NULL; } int coeffs = -1; if (order == 1) { coeffs = 4; } if (order == 2) { coeffs = 10; // 1 x y z xy yz zx xx yy zz } if (order == 3) { // 1 x y z xy yz zx xx yy zz // xxy xxz yyx yyz zzx zzy // xxx yyy zzz zyz coeffs = 20; } int points = PyArray_DIM(coords, 0); double* coord_nc = DOUBLEP(coords); double* grid_points = DOUBLEP(N_c); double* grid_start = DOUBLEP(beg_c); double* target_n = DOUBLEP(target); double* data_g = DOUBLEP(data); // TODO: Calculate fit const int sizex = (int) ceil(cutoff); const int sizey = (int) ceil(cutoff); const int sizez = (int) ceil(cutoff); // Allocate X-matrix and b-vector int source_points = (2*sizex+1)*(2*sizey+1)*(2*sizez+1); double* X = GPAW_MALLOC(double, coeffs*source_points); double* b = GPAW_MALLOC(double, source_points); double* work = GPAW_MALLOC(double, coeffs*source_points); // The multipliers for each dimension int ldx = PyArray_DIM(data, 1) * PyArray_DIM(data, 2); int ldy = PyArray_DIM(data, 2); int ldz = 1; // For each point to be interpolated for (int p=0; p< points; p++) { double x = (*coord_nc++)*grid_points[0] - grid_start[0]; double y = (*coord_nc++)*grid_points[1] - grid_start[1]; double z = (*coord_nc++)*grid_points[2] - grid_start[2]; // The grid center point int cx2 = (int) round(x); int cy2 = (int) round(y); int cz2 = (int) round(z); // Scaled to grid int cx = safemod(cx2, PyArray_DIM(data, 0)); int cy = safemod(cy2, PyArray_DIM(data, 1)); int cz = safemod(cz2, PyArray_DIM(data, 2)); double* i_X = X; double* i_b = b; // For each point to take into account for (int dx=-sizex;dx<=sizex;dx++) for (int dy=-sizey;dy<=sizey;dy++) for (int dz=-sizez;dz<=sizez;dz++) { // Coordinates centered on x,y,z double sx = (cx2 + dx) - x; double sy = (cy2 + dy) - y; double sz = (cz2 + dz) - z; // Normalized distance from center double d = sqrt(sx*sx+sy*sy+sz*sz) / cutoff; double w = 0.0; if (d < 1) { w = (1-d)*(1-d); w*=w; w*=(4*d+1); } //double w = exp(-d*d); *i_X++ = w*1.0; *i_X++ = w*sx; *i_X++ = w*sy; *i_X++ = w*sz; if (order > 1) { *i_X++ = w*sx*sy; *i_X++ = w*sy*sz; *i_X++ = w*sz*sx; *i_X++ = w*sx*sx; *i_X++ = w*sy*sy; *i_X++ = w*sz*sz; } if (order > 2) { *i_X++ = w*sx*sy*sz; // xyz *i_X++ = w*sx*sx*sx; // xxx *i_X++ = w*sy*sy*sy; // yyy *i_X++ = w*sz*sz*sz; // zzz *i_X++ = w*sx*sx*sy; // xxy *i_X++ = w*sx*sx*sz; // xxz *i_X++ = w*sy*sy*sx; // yyx *i_X++ = w*sy*sy*sz; // yyz *i_X++ = w*sz*sz*sx; // zzx *i_X++ = w*sz*sz*sy; // zzy } *i_b++ = w*data_g[ safemod(cx+dx, PyArray_DIM(data, 0)) * ldx + safemod(cy+dy, PyArray_DIM(data, 1)) * ldy + safemod(cz+dz, PyArray_DIM(data, 2)) * ldz ]; } int info = 0; int rhs = 1; int worksize = coeffs*source_points; int ldb = source_points; dgels_("T", &coeffs, // ...times 4. &source_points, // lhs is of size sourcepoints... &rhs, // one rhs. X, // provide lhs &coeffs, // Leading dimension of X b, // provide rhs &ldb, // Leading dimension of b work, // work array (and output) &worksize, // the size of work array &info); // info if (info != 0) printf("WARNING: dgels returned %d!", info); // Evaluate the polynomial // Due to centered coordinates, it's just the constant term double value = b[0]; *target_n++ = value; //Nearest neighbour //double value = data_g[ cx*data->dimensions[1]*data->dimensions[2] + cy*data->dimensions[2] + cz ]; //printf("%.5f" , value); } free(work); free(b); free(X); Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/mpi.c000066400000000000000000001142661316441372200213110ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Copyright (C) 2005-2009 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include #ifdef PARALLEL #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include #include "extensions.h" #include #include "mympi.h" #ifdef __bgp__ #include #endif // Check that array is well-behaved and contains data that can be sent. #define CHK_ARRAY(a) if ((a) == NULL || !PyArray_Check(a) \ || !PyArray_ISCARRAY(a) || !PyArray_ISNUMBER(a)) { \ PyErr_SetString(PyExc_TypeError, \ "Not a proper NumPy array for MPI communication."); \ return NULL; } // Check that two arrays have the same type, and the size of the // second is a given multiple of the size of the first #define CHK_ARRAYS(a,b,n) \ if ((PyArray_TYPE(a) != PyArray_TYPE(b)) \ || (PyArray_SIZE(b) != PyArray_SIZE(a) * n)) { \ PyErr_SetString(PyExc_ValueError, \ "Incompatible array types or sizes."); \ return NULL; } // Check that a processor number is valid #define CHK_PROC(n) if (n < 0 || n >= self->size) {\ PyErr_SetString(PyExc_ValueError, "Invalid processor number."); \ return NULL; } // Check that a processor number is valid or is -1 #define CHK_PROC_DEF(n) if (n < -1 || n >= self->size) {\ PyErr_SetString(PyExc_ValueError, "Invalid processor number."); \ return NULL; } // Check that a processor number is valid and is not this processor #define CHK_OTHER_PROC(n) if (n < 0 || n >= self->size || n == self->rank) { \ PyErr_SetString(PyExc_ValueError, "Invalid processor number."); \ return NULL; } // MPI request object, so we can store a reference to the buffer, // preventing its early deallocation. typedef struct { PyObject_HEAD MPI_Request rq; PyObject *buffer; int status; } GPAW_MPI_Request; static PyObject *mpi_request_wait(GPAW_MPI_Request *self, PyObject *noargs) { if (self->status == 0) { // Calling wait multiple times is allowed but meaningless (as in the MPI standard) Py_RETURN_NONE; } #ifndef GPAW_MPI_DEBUG MPI_Wait(&(self->rq), MPI_STATUS_IGNORE); #else int ret = MPI_Wait(&(self->rq), MPI_STATUS_IGNORE); if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Wait error occurred."); return NULL; } #endif Py_DECREF(self->buffer); self->status = 0; Py_RETURN_NONE; } static PyObject *mpi_request_test(GPAW_MPI_Request *self, PyObject *noargs) { if (self->status == 0) { Py_RETURN_TRUE; // Already completed } int flag; #ifndef GPAW_MPI_DEBUG MPI_Test(&(self->rq), &flag, MPI_STATUS_IGNORE); // Can this change the Python string? #else int ret = MPI_Test(&(self->rq), &flag, MPI_STATUS_IGNORE); // Can this change the Python string? if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Test error occurred."); return NULL; } #endif if (flag) { Py_DECREF(self->buffer); self->status = 0; Py_RETURN_TRUE; } else { Py_RETURN_FALSE; } } static void mpi_request_dealloc(GPAW_MPI_Request *self) { if (self->status) { PyObject *none = mpi_request_wait(self, NULL); Py_DECREF(none); } PyObject_Del(self); } static PyMemberDef mpi_request_members[] = { {"status", T_INT, offsetof(GPAW_MPI_Request, status), READONLY, "status of the request, non-zero if communication is pending."}, {NULL} }; static PyMethodDef mpi_request_methods[] = { {"wait", (PyCFunction) mpi_request_wait, METH_NOARGS, "Wait for the communication to complete." }, {"test", (PyCFunction) mpi_request_test, METH_NOARGS, "Test if the communication has completed." }, {NULL} }; PyTypeObject GPAW_MPI_Request_type = { PyVarObject_HEAD_INIT(NULL, 0) "MPI_Request", /*tp_name*/ sizeof(GPAW_MPI_Request), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)mpi_request_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "MPI request object", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ mpi_request_methods, /* tp_methods */ mpi_request_members, 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; static GPAW_MPI_Request *NewMPIRequest(void) { GPAW_MPI_Request *self; self = PyObject_NEW(GPAW_MPI_Request, &GPAW_MPI_Request_type); if (self == NULL) return NULL; memset(&(self->rq), 0, sizeof(MPI_Request)); self->buffer = NULL; self->status = 1; // Active return self; } static void mpi_dealloc(MPIObject *obj) { if (obj->comm == MPI_COMM_WORLD) { # ifndef GPAW_INTERPRETER MPI_Finalize(); # endif } else MPI_Comm_free(&(obj->comm)); Py_XDECREF(obj->parent); free(obj->members); PyObject_DEL(obj); } static PyObject * mpi_sendreceive(MPIObject *self, PyObject *args, PyObject *kwargs) { PyArrayObject* a; PyArrayObject* b; int dest, src; int sendtag = 123; int recvtag = 123; static char *kwlist[] = {"a", "dest", "b", "src", "sendtag", "recvtag", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiOi|ii:sendreceive", kwlist, &a, &dest, &b, &src, &sendtag, &recvtag)) return NULL; CHK_ARRAY(a); CHK_OTHER_PROC(dest); CHK_ARRAY(b); CHK_OTHER_PROC(src); int nsend = PyArray_DESCR(a)->elsize; for (int d = 0; d < PyArray_NDIM(a); d++) nsend *= PyArray_DIM(a,d); int nrecv = PyArray_DESCR(b)->elsize; for (int d = 0; d < PyArray_NDIM(b); d++) nrecv *= PyArray_DIM(b,d); #ifndef GPAW_MPI_DEBUG MPI_Sendrecv(PyArray_BYTES(a), nsend, MPI_BYTE, dest, sendtag, PyArray_BYTES(b), nrecv, MPI_BYTE, src, recvtag, self->comm, MPI_STATUS_IGNORE); #else int ret = MPI_Sendrecv(PyArray_BYTES(a), nsend, MPI_BYTE, dest, sendtag, PyArray_BYTES(b), nrecv, MPI_BYTE, src, recvtag, self->comm, MPI_STATUS_IGNORE); if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Sendrecv error occurred."); return NULL; } #endif Py_RETURN_NONE; } static PyObject * mpi_receive(MPIObject *self, PyObject *args, PyObject *kwargs) { PyArrayObject* a; int src; int tag = 123; int block = 1; static char *kwlist[] = {"a", "src", "tag", "block", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii:receive", kwlist, &a, &src, &tag, &block)) return NULL; CHK_ARRAY(a); CHK_OTHER_PROC(src); int n = PyArray_DESCR(a)->elsize; for (int d = 0; d < PyArray_NDIM(a); d++) n *= PyArray_DIM(a, d); if (block) { #ifndef GPAW_MPI_DEBUG MPI_Recv(PyArray_BYTES(a), n, MPI_BYTE, src, tag, self->comm, MPI_STATUS_IGNORE); #else int ret = MPI_Recv(PyArray_BYTES(a), n, MPI_BYTE, src, tag, self->comm, MPI_STATUS_IGNORE); if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Recv error occurred."); return NULL; } #endif Py_RETURN_NONE; } else { GPAW_MPI_Request *req = NewMPIRequest(); if (req == NULL) return NULL; req->buffer = (PyObject*)a; Py_INCREF(req->buffer); #ifndef GPAW_MPI_DEBUG MPI_Irecv(PyArray_BYTES(a), n, MPI_BYTE, src, tag, self->comm, &(req->rq)); #else int ret = MPI_Irecv(PyArray_BYTES(a), n, MPI_BYTE, src, tag, self->comm, &(req->rq)); if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Irecv error occurred."); return NULL; } #endif return (PyObject *) req; } } static PyObject * mpi_send(MPIObject *self, PyObject *args, PyObject *kwargs) { PyArrayObject* a; int dest; int tag = 123; int block = 1; static char *kwlist[] = {"a", "dest", "tag", "block", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii:send", kwlist, &a, &dest, &tag, &block)) return NULL; CHK_ARRAY(a); CHK_OTHER_PROC(dest); int n = PyArray_DESCR(a)->elsize; for (int d = 0; d < PyArray_NDIM(a); d++) n *= PyArray_DIM(a,d); if (block) { #ifndef GPAW_MPI_DEBUG MPI_Send(PyArray_BYTES(a), n, MPI_BYTE, dest, tag, self->comm); #else int ret = MPI_Send(PyArray_BYTES(a), n, MPI_BYTE, dest, tag, self->comm); if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Send error occurred."); return NULL; } #endif Py_RETURN_NONE; } else { GPAW_MPI_Request *req = NewMPIRequest(); req->buffer = (PyObject*)a; Py_INCREF(a); #ifndef GPAW_MPI_DEBUG MPI_Isend(PyArray_BYTES(a), n, MPI_BYTE, dest, tag, self->comm, &(req->rq)); #else int ret = MPI_Isend(PyArray_BYTES(a), n, MPI_BYTE, dest, tag, self->comm, &(req->rq)); if (ret != MPI_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "MPI_Isend error occurred."); return NULL; } #endif return (PyObject *)req; } } static PyObject * mpi_ssend(MPIObject *self, PyObject *args, PyObject *kwargs) { PyArrayObject* a; int dest; int tag = 123; static char *kwlist[] = {"a", "dest", "tag", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|i:send", kwlist, &a, &dest, &tag)) return NULL; CHK_ARRAY(a); CHK_OTHER_PROC(dest); int n = PyArray_DESCR(a)->elsize; for (int d = 0; d < PyArray_NDIM(a); d++) n *= PyArray_DIM(a,d); MPI_Ssend(PyArray_BYTES(a), n, MPI_BYTE, dest, tag, self->comm); Py_RETURN_NONE; } static PyObject * mpi_name(MPIObject *self, PyObject *noargs) { char name[MPI_MAX_PROCESSOR_NAME]; int resultlen; MPI_Get_processor_name(name, &resultlen); return Py_BuildValue("s#", name, resultlen); } static PyObject * mpi_abort(MPIObject *self, PyObject *args) { int errcode; if (!PyArg_ParseTuple(args, "i:abort", &errcode)) return NULL; MPI_Abort(self->comm, errcode); Py_RETURN_NONE; } static PyObject * mpi_barrier(MPIObject *self) { MPI_Barrier(self->comm); Py_RETURN_NONE; } static PyObject * mpi_test(MPIObject *self, PyObject *args) { GPAW_MPI_Request* s; if (!PyArg_ParseTuple(args, "O!:wait", &GPAW_MPI_Request_type, &s)) return NULL; return mpi_request_test(s, NULL); } static PyObject * mpi_testall(MPIObject *self, PyObject *requests) { int n; // Number of requests MPI_Request *rqs = NULL; int flag = 0; if (!PySequence_Check(requests)) { PyErr_SetString(PyExc_TypeError, "mpi.testall: argument must be a sequence"); return NULL; } // Extract the request objects n = PySequence_Size(requests); assert(n >= 0); // This cannot fail. rqs = GPAW_MALLOC(MPI_Request, n); assert(rqs != NULL); for (int i = 0; i < n; i++) { PyObject *o = PySequence_GetItem(requests, i); if (o == NULL) return NULL; if (Py_TYPE(o) != &GPAW_MPI_Request_type) { Py_DECREF(o); free(rqs); PyErr_SetString(PyExc_TypeError, "mpi.testall: argument must be a sequence of MPI requests"); return NULL; } GPAW_MPI_Request *s = (GPAW_MPI_Request *)o; rqs[i] = s->rq; Py_DECREF(o); } // Do the actual test. #ifndef GPAW_MPI_DEBUG MPI_Testall(n, rqs, &flag, MPI_STATUSES_IGNORE); #else int ret = MPI_Testall(n, rqs, &flag, MPI_STATUSES_IGNORE); if (ret != MPI_SUCCESS) { // We do not dare to release the buffers now! PyErr_SetString(PyExc_RuntimeError, "MPI_Testall error occurred."); return NULL; } #endif // Unlike MPI_Test, if flag outcome is non-zero, MPI_Testall will deallocate // all requests which were allocated by nonblocking communication calls, so // we must free these buffers. Otherwise, none of the requests are modified. if (flag != 0) { // Release the buffers used by the MPI communication for (int i = 0; i < n; i++) { GPAW_MPI_Request *o = (GPAW_MPI_Request *) PySequence_GetItem(requests, i); if (o->status) { assert(o->buffer != NULL); Py_DECREF(o->buffer); } o->status = 0; Py_DECREF(o); } } // Release internal data and return. free(rqs); return Py_BuildValue("i", flag); } static PyObject * mpi_wait(MPIObject *self, PyObject *args) { GPAW_MPI_Request* s; if (!PyArg_ParseTuple(args, "O!:wait", &GPAW_MPI_Request_type, &s)) return NULL; return mpi_request_wait(s, NULL); } static PyObject * mpi_waitall(MPIObject *self, PyObject *requests) { int n; // Number of requests MPI_Request *rqs = NULL; if (!PySequence_Check(requests)) { PyErr_SetString(PyExc_TypeError, "mpi.waitall: argument must be a sequence"); return NULL; } // Extract the request objects n = PySequence_Size(requests); assert(n >= 0); // This cannot fail. rqs = GPAW_MALLOC(MPI_Request, n); for (int i = 0; i < n; i++) { PyObject *o = PySequence_GetItem(requests, i); if (o == NULL) return NULL; if (Py_TYPE(o) != &GPAW_MPI_Request_type) { Py_DECREF(o); free(rqs); PyErr_SetString(PyExc_TypeError, "mpi.waitall: argument must be a sequence of MPI requests"); return NULL; } GPAW_MPI_Request *s = (GPAW_MPI_Request *)o; rqs[i] = s->rq; Py_DECREF(o); } // Do the actual wait. #ifndef GPAW_MPI_DEBUG MPI_Waitall(n, rqs, MPI_STATUSES_IGNORE); #else int ret = MPI_Waitall(n, rqs, MPI_STATUSES_IGNORE); if (ret != MPI_SUCCESS) { // We do not dare to release the buffers now! PyErr_SetString(PyExc_RuntimeError, "MPI_Waitall error occurred."); return NULL; } #endif // Release the buffers used by the MPI communication for (int i = 0; i < n; i++) { GPAW_MPI_Request *o = (GPAW_MPI_Request *) PySequence_GetItem(requests, i); if (o->status) { assert(o->buffer != NULL); Py_DECREF(o->buffer); } o->status = 0; Py_DECREF(o); } // Release internal data and return. free(rqs); Py_RETURN_NONE; } static MPI_Datatype get_mpi_datatype(PyArrayObject *a) { int n = PyArray_DESCR(a)->elsize; if (PyArray_ISCOMPLEX(a)) n = n / 2; switch(PyArray_TYPE(a)) { // Floating point numbers including complex numbers case NPY_DOUBLE: case NPY_CDOUBLE: assert(sizeof(double) == n); return MPI_DOUBLE; case NPY_FLOAT: case NPY_CFLOAT: assert(sizeof(float) == n); return MPI_FLOAT; case NPY_LONGDOUBLE: case NPY_CLONGDOUBLE: assert(sizeof(long double) == n); return MPI_LONG_DOUBLE; // Signed integer types case NPY_BYTE: assert(sizeof(char) == n); return MPI_CHAR; case NPY_SHORT: assert(sizeof(short) == n); return MPI_SHORT; case NPY_INT: assert(sizeof(int) == n); return MPI_INT; case NPY_LONG: assert(sizeof(long) == n); return MPI_LONG; // Unsigned integer types case NPY_BOOL: case NPY_UBYTE: assert(sizeof(unsigned char) == n); return MPI_UNSIGNED_CHAR; case NPY_USHORT: assert(sizeof(unsigned short) == n); return MPI_UNSIGNED_SHORT; case NPY_UINT: assert(sizeof(unsigned) == n); return MPI_UNSIGNED; case NPY_ULONG: assert(sizeof(unsigned long) == n); return MPI_UNSIGNED_LONG; } // If we reach this point none of the cases worked out. PyErr_SetString(PyExc_ValueError, "Cannot communicate data of this type."); return 0; } #if PY_MAJOR_VERSION >= 3 #define PyInt_FromLong PyLong_FromLong #define PyInt_Check PyLong_Check #define PyInt_AS_LONG PyLong_AS_LONG #endif static PyObject * mpi_reduce(MPIObject *self, PyObject *args, PyObject *kwargs, MPI_Op operation, int allowcomplex) { #ifdef GPAW_MPI_DEBUG MPI_Barrier(self->comm); #endif PyObject* obj; int root = -1; static char *kwlist[] = {"a", "root", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:reduce", kwlist, &obj, &root)) return NULL; CHK_PROC_DEF(root); if (PyFloat_Check(obj)) { double din = PyFloat_AS_DOUBLE(obj); double dout; if (root == -1) MPI_Allreduce(&din, &dout, 1, MPI_DOUBLE, operation, self->comm); else MPI_Reduce(&din, &dout, 1, MPI_DOUBLE, operation, root, self->comm); return PyFloat_FromDouble(dout); } if (PyInt_Check(obj)) { long din = PyInt_AS_LONG(obj); long dout; if (root == -1) MPI_Allreduce(&din, &dout, 1, MPI_LONG, operation, self->comm); else MPI_Reduce(&din, &dout, 1, MPI_LONG, operation, root, self->comm); return PyInt_FromLong(dout); } else if (PyComplex_Check(obj) && allowcomplex) { double din[2]; double dout[2]; din[0] = PyComplex_RealAsDouble(obj); din[1] = PyComplex_ImagAsDouble(obj); if (root == -1) MPI_Allreduce(&din, &dout, 2, MPI_DOUBLE, MPI_SUM, self->comm); else MPI_Reduce(&din, &dout, 2, MPI_DOUBLE, MPI_SUM, root, self->comm); return PyComplex_FromDoubles(dout[0], dout[1]); } else if (PyComplex_Check(obj)) { PyErr_SetString(PyExc_ValueError, "Operation not allowed on complex numbers"); return NULL; } else // It should be an array { int n; int elemsize; MPI_Datatype datatype; PyArrayObject* aobj = (PyArrayObject*)obj; CHK_ARRAY(aobj); datatype = get_mpi_datatype(aobj); if (datatype == 0) return NULL; n = PyArray_SIZE(aobj); elemsize = PyArray_DESCR(aobj)->elsize; if (PyArray_ISCOMPLEX(aobj)) { if (allowcomplex) { n *= 2; elemsize /= 2; } else { PyErr_SetString(PyExc_ValueError, "Operation not allowed on complex numbers"); return NULL; } } if (root == -1) { #ifdef GPAW_MPI2 MPI_Allreduce(MPI_IN_PLACE, PyArray_BYTES(aobj), n, datatype, operation, self->comm); #else char* b = GPAW_MALLOC(char, n * elemsize); MPI_Allreduce(PyArray_BYTES(aobj), b, n, datatype, operation, self->comm); assert(PyArray_NBYTES(aobj) == n * elemsize); memcpy(PyArray_BYTES(aobj), b, n * elemsize); free(b); #endif } else { int rank; MPI_Comm_rank(self->comm, &rank); char* b = 0; if (rank == root) { #ifdef GPAW_MPI2 MPI_Reduce(MPI_IN_PLACE, PyArray_BYTES(aobj), n, datatype, operation, root, self->comm); #else b = GPAW_MALLOC(char, n * elemsize); MPI_Reduce(PyArray_BYTES(aobj), b, n, datatype, operation, root, self->comm); assert(PyArray_NBYTES(aobj) == n * elemsize); memcpy(PyArray_BYTES(aobj), b, n * elemsize); free(b); #endif } else { MPI_Reduce(PyArray_BYTES(aobj), b, n, datatype, operation, root, self->comm); } } Py_RETURN_NONE; } } static PyObject * mpi_sum(MPIObject *self, PyObject *args, PyObject *kwargs) { return mpi_reduce(self, args, kwargs, MPI_SUM, 1); } static PyObject * mpi_product(MPIObject *self, PyObject *args, PyObject *kwargs) { // No complex numbers as that would give separate products of // real and imaginary parts. return mpi_reduce(self, args, kwargs, MPI_PROD, 0); } static PyObject * mpi_max(MPIObject *self, PyObject *args, PyObject *kwargs) { return mpi_reduce(self, args, kwargs, MPI_MAX, 0); } static PyObject * mpi_min(MPIObject *self, PyObject *args, PyObject *kwargs) { return mpi_reduce(self, args, kwargs, MPI_MIN, 0); } static PyObject * mpi_scatter(MPIObject *self, PyObject *args) { PyArrayObject* sendobj; PyArrayObject* recvobj; int root; if (!PyArg_ParseTuple(args, "OOi:scatter", &sendobj, &recvobj, &root)) return NULL; CHK_ARRAY(recvobj); CHK_PROC(root); char* source = 0; if (self->rank == root) { CHK_ARRAY(sendobj); CHK_ARRAYS(recvobj, sendobj, self->size); // size(send) = size(recv)*Ncpu source = PyArray_BYTES(sendobj); } int n = PyArray_DESCR(recvobj)->elsize; for (int d = 0; d < PyArray_NDIM(recvobj); d++) n *= PyArray_DIM(recvobj,d); MPI_Scatter(source, n, MPI_BYTE, PyArray_BYTES(recvobj), n, MPI_BYTE, root, self->comm); Py_RETURN_NONE; } static PyObject * mpi_allgather(MPIObject *self, PyObject *args) { PyArrayObject* a; PyArrayObject* b; if (!PyArg_ParseTuple(args, "OO:allgather", &a, &b)) return NULL; CHK_ARRAY(a); CHK_ARRAY(b); CHK_ARRAYS(a, b, self->size); int n = PyArray_DESCR(a)->elsize; for (int d = 0; d < PyArray_NDIM(a); d++) n *= PyArray_DIM(a,d); // What about endianness???? MPI_Allgather(PyArray_BYTES(a), n, MPI_BYTE, PyArray_BYTES(b), n, MPI_BYTE, self->comm); Py_RETURN_NONE; } static PyObject * mpi_gather(MPIObject *self, PyObject *args) { PyArrayObject* a; int root; PyArrayObject* b = 0; if (!PyArg_ParseTuple(args, "Oi|O", &a, &root, &b)) return NULL; CHK_ARRAY(a); CHK_PROC(root); if (root == self->rank) { CHK_ARRAY(b); CHK_ARRAYS(a, b, self->size); } else if ((PyObject*)b != Py_None && b != NULL) { fprintf(stderr, "******** Root=%d\n", root); PyErr_SetString(PyExc_ValueError, "mpi_gather: b array should not be given on non-root processors."); return NULL; } int n = PyArray_DESCR(a)->elsize; for (int d = 0; d < PyArray_NDIM(a); d++) n *= PyArray_DIM(a,d); if (root != self->rank) MPI_Gather(PyArray_BYTES(a), n, MPI_BYTE, 0, n, MPI_BYTE, root, self->comm); else MPI_Gather(PyArray_BYTES(a), n, MPI_BYTE, PyArray_BYTES(b), n, MPI_BYTE, root, self->comm); Py_RETURN_NONE; } static PyObject * mpi_broadcast(MPIObject *self, PyObject *args) { #ifdef GPAW_MPI_DEBUG MPI_Barrier(self->comm); #endif PyArrayObject* buf; int root; if (!PyArg_ParseTuple(args, "Oi:broadcast", &buf, &root)) return NULL; CHK_ARRAY(buf); CHK_PROC(root); int n = PyArray_DESCR(buf)->elsize; for (int d = 0; d < PyArray_NDIM(buf); d++) n *= PyArray_DIM(buf,d); MPI_Bcast(PyArray_BYTES(buf), n, MPI_BYTE, root, self->comm); Py_RETURN_NONE; } static PyObject *mpi_compare(MPIObject *self, PyObject *args) { MPIObject* other; int result; char* pyresult; if (!PyArg_ParseTuple(args, "O", &other)) return NULL; MPI_Comm_compare(self->comm, other->comm, &result); if(result == MPI_IDENT) pyresult = "ident"; else if (result == MPI_CONGRUENT) pyresult = "congruent"; else if (result == MPI_SIMILAR) pyresult = "similar"; else if (result == MPI_UNEQUAL) pyresult = "unequal"; else return NULL; return Py_BuildValue("s", pyresult); } static PyObject *mpi_translate_ranks(MPIObject *self, PyObject *args) { PyObject* myranks_anytype; // Conversion to numpy array below MPIObject* other; if (!PyArg_ParseTuple(args, "OO", &other, &myranks_anytype)) return NULL; // XXXXXX This uses NPY_LONG and NPY_INT. On some computers the // returned array is int32 while np.array(..., dtype=int) returns // int64. This should very probably be changed so it always // corresponds to the default int of numpy. // This handling of arrays of ranks is taken from the MPICommunicator // creation method. See that method for explanation of casting, datatypes // etc. PyArrayObject *myranks_long = (PyArrayObject*)PyArray_ContiguousFromAny( myranks_anytype, NPY_LONG, 1, 1); if(myranks_long == NULL) return NULL; int nranks = PyArray_DIM(myranks_long, 0); PyArrayObject *myranks; myranks = (PyArrayObject*)PyArray_Cast(myranks_long, NPY_INT); npy_intp rankshape[1]; rankshape[0] = PyArray_SIZE(myranks); PyArrayObject* other_ranks = (PyArrayObject*)PyArray_SimpleNew(1, rankshape, NPY_INT); MPI_Group mygroup, othergroup; MPI_Comm_group(self->comm, &mygroup); MPI_Comm_group(other->comm, &othergroup); int* rankdata = (int*)PyArray_BYTES(myranks); int* otherrankdata = (int*)PyArray_BYTES(other_ranks); MPI_Group_translate_ranks(mygroup, nranks, rankdata, othergroup, otherrankdata); // Return something with a definite value to Python. for(int i=0; i < nranks; i++) { if(otherrankdata[i] == MPI_UNDEFINED) { otherrankdata[i] = -1; } } PyObject* other_ranks_anytype = PyArray_Cast(other_ranks, PyArray_TYPE((PyArrayObject*)myranks_anytype)); Py_DECREF(myranks_long); Py_DECREF(myranks); Py_DECREF(other_ranks); return (PyObject*)other_ranks_anytype; } static PyObject * mpi_alltoallv(MPIObject *self, PyObject *args) { PyArrayObject* send_obj; PyArrayObject* send_cnts; PyArrayObject* send_displs; PyArrayObject* recv_obj; PyArrayObject* recv_cnts; PyArrayObject* recv_displs; if (!PyArg_ParseTuple(args, "OOOOOO:alltoallv", &send_obj, &send_cnts, &send_displs, &recv_obj, &recv_cnts, &recv_displs)) return NULL; CHK_ARRAY(send_obj); CHK_ARRAY(send_cnts); CHK_ARRAY(send_displs); CHK_ARRAY(recv_obj); CHK_ARRAY(recv_cnts); CHK_ARRAY(recv_displs); int *s_cnts = GPAW_MALLOC(int, self->size); int *s_displs = GPAW_MALLOC(int, self->size); int *r_cnts = GPAW_MALLOC(int, self->size); int *r_displs = GPAW_MALLOC(int, self->size); /* Create count and displacement arrays in units of bytes */ int elem_size = PyArray_ITEMSIZE(send_obj); long* tmp1 = PyArray_DATA(send_cnts); long* tmp2 = PyArray_DATA(send_displs); long* tmp3 = PyArray_DATA(recv_cnts); long* tmp4 = PyArray_DATA(recv_displs); for (int i=0; i < self->size; i++) { s_cnts[i] = tmp1[i] * elem_size; s_displs[i] = tmp2[i] * elem_size; r_cnts[i] = tmp3[i] * elem_size; r_displs[i] = tmp4[i] * elem_size; } MPI_Alltoallv(PyArray_BYTES(send_obj), s_cnts, s_displs, MPI_BYTE, PyArray_BYTES(recv_obj), r_cnts, r_displs, MPI_BYTE, self->comm); free(s_cnts); free(s_displs); free(r_cnts); free(r_displs); Py_RETURN_NONE; } static PyObject * get_members(MPIObject *self, PyObject *args) { PyArrayObject *ranks; npy_intp ranks_dims[1] = {self->size}; ranks = (PyArrayObject *) PyArray_SimpleNew(1, ranks_dims, NPY_INT); if (ranks == NULL) return NULL; memcpy(INTP(ranks), self->members, self->size*sizeof(int)); PyObject* values = Py_BuildValue("O", ranks); Py_DECREF(ranks); return values; } // See the documentation for corresponding function in debug wrapper // for the purpose of this function (gpaw/mpi/__init__.py) static PyObject * get_c_object(MPIObject *self, PyObject *args) { return Py_BuildValue("O", self); } // Forward declaration of MPI_Communicator because it needs MPIType // that needs MPI_getattr that needs MPI_Methods that need // MPI_Communicator that need ... static PyObject * MPICommunicator(MPIObject *self, PyObject *args); static PyMethodDef mpi_methods[] = { {"sendreceive", (PyCFunction)mpi_sendreceive, METH_VARARGS|METH_KEYWORDS, "sendreceive(a, dest, b, src, desttag=123, srctag=123) sends an array a to dest and receives an array b from src."}, {"receive", (PyCFunction)mpi_receive, METH_VARARGS|METH_KEYWORDS, "receive(a, src, tag=123, block=1) receives array a from src."}, {"send", (PyCFunction)mpi_send, METH_VARARGS|METH_KEYWORDS, "send(a, dest, tag=123, block=1) sends array a to dest."}, {"ssend", (PyCFunction)mpi_ssend, METH_VARARGS|METH_KEYWORDS, "ssend(a, dest, tag=123) synchronously sends array a to dest."}, {"abort", (PyCFunction)mpi_abort, METH_VARARGS, "abort(errcode) aborts all MPI tasks."}, {"name", (PyCFunction)mpi_name, METH_NOARGS, "name() returns the name of the processor node."}, {"barrier", (PyCFunction)mpi_barrier, METH_VARARGS, "barrier() synchronizes all MPI tasks"}, {"test", (PyCFunction)mpi_test, METH_VARARGS, "test(request) tests if a nonblocking communication is complete."}, {"testall", (PyCFunction)mpi_testall, METH_O, "testall(list_of_rqs) tests if multiple nonblocking communications are complete."}, {"wait", (PyCFunction)mpi_wait, METH_VARARGS, "wait(request) waits for a nonblocking communication to complete."}, {"waitall", (PyCFunction)mpi_waitall, METH_O, "waitall(list_of_rqs) waits for multiple nonblocking communications to complete."}, {"sum", (PyCFunction)mpi_sum, METH_VARARGS|METH_KEYWORDS, "sum(a, root=-1) sums arrays, result on all tasks unless root is given."}, {"product", (PyCFunction)mpi_product, METH_VARARGS|METH_KEYWORDS, "product(a, root=-1) multiplies arrays, result on all tasks unless root is given."}, {"max", (PyCFunction)mpi_max, METH_VARARGS|METH_KEYWORDS, "max(a, root=-1) maximum of arrays, result on all tasks unless root is given."}, {"min", (PyCFunction)mpi_min, METH_VARARGS|METH_KEYWORDS, "min(a, root=-1) minimum of arrays, result on all tasks unless root is given."}, {"scatter", (PyCFunction)mpi_scatter, METH_VARARGS, "scatter(src, target, root) distributes array from root task."}, {"gather", (PyCFunction)mpi_gather, METH_VARARGS, "gather(src, root, target=None) gathers data from all tasks on root task."}, {"all_gather", (PyCFunction)mpi_allgather, METH_VARARGS, "all_gather(src, target) gathers data from all tasks on all tasks."}, {"alltoallv", (PyCFunction)mpi_alltoallv, METH_VARARGS, "alltoallv(sbuf, scnt, sdispl, rbuf, ...) send data from all tasks to all tasks."}, {"broadcast", (PyCFunction)mpi_broadcast, METH_VARARGS, "broadcast(buffer, root) Broadcast data in-place from root task."}, {"compare", (PyCFunction)mpi_compare, METH_VARARGS, "compare two communicators for identity using MPI_Comm_compare."}, {"translate_ranks", (PyCFunction)mpi_translate_ranks, METH_VARARGS, "figure out correspondence between ranks on two communicators."}, {"get_members", (PyCFunction)get_members, METH_VARARGS, 0}, {"get_c_object", (PyCFunction)get_c_object, METH_VARARGS, 0}, {"new_communicator", (PyCFunction)MPICommunicator, METH_VARARGS, "new_communicator(ranks) creates a new communicator."}, {0, 0, 0, 0} }; static PyMemberDef mpi_members[] = { {"size", T_INT, offsetof(MPIObject, size), 0, "Number of processors"}, {"rank", T_INT, offsetof(MPIObject, rank), 0, "Number of this processor"}, {"parent", T_OBJECT_EX, offsetof(MPIObject, parent), 0, "Parent communicator"}, {0, 0, 0, 0, 0} /* Sentinel */ }; // __new__ static PyObject *NewMPIObject(PyTypeObject* type, PyObject *args, PyObject *kwds) { static char *kwlist[] = {NULL}; MPIObject* self; if (! PyArg_ParseTupleAndKeywords(args, kwds, "", kwlist)) return NULL; self = (MPIObject *) type->tp_alloc(type, 0); if (self == NULL) return NULL; # ifndef GPAW_INTERPRETER MPI_Init(NULL, NULL); # endif MPI_Comm_size(MPI_COMM_WORLD, &(self->size)); MPI_Comm_rank(MPI_COMM_WORLD, &(self->rank)); self->comm = MPI_COMM_WORLD; Py_INCREF(Py_None); self->parent = Py_None; self->members = (int*) malloc(self->size*sizeof(int)); if (self->members == NULL) return NULL; for (int i=0; isize; i++) self->members[i] = i; return (PyObject *) self; } // __init__ does nothing. static int InitMPIObject(MPIObject* self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {NULL}; if (! PyArg_ParseTupleAndKeywords(args, kwds, "", kwlist)) return -1; return 0; } PyTypeObject MPIType = { PyVarObject_HEAD_INIT(NULL, 0) "MPI", /*tp_name*/ sizeof(MPIObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)mpi_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "MPI object", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ mpi_methods, /*tp_methods*/ mpi_members, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ (initproc)InitMPIObject, /*tp_init*/ 0, /*tp_alloc*/ NewMPIObject, /*tp_new*/ }; static PyObject * MPICommunicator(MPIObject *self, PyObject *args) { PyObject* orig_ranks; if (!PyArg_ParseTuple(args, "O", &orig_ranks)) return NULL; // NB: int32 is NPY_LONG on 32-bit Linux and NPY_INT on 64-bit Linux! // First convert to NumPy array of NPY_LONG, then cast to NPY_INT, to // allow both 32 and 64 bit integers in the argument (except 64 on 32). PyArrayObject *ranks = (PyArrayObject*)PyArray_ContiguousFromAny( orig_ranks, NPY_LONG, 1, 1); if (ranks == NULL) return NULL; PyArrayObject *iranks; int n = PyArray_DIM(ranks, 0); iranks = (PyArrayObject*)PyArray_Cast((PyArrayObject*) ranks, NPY_INT); Py_DECREF(ranks); if (iranks == NULL) return NULL; // Check that all ranks make sense for (int i = 0; i < n; i++) { int *x = PyArray_GETPTR1(iranks, i); if (*x < 0 || *x >= self->size) { Py_DECREF(iranks); PyErr_SetString(PyExc_ValueError, "invalid rank"); return NULL; } for (int j = 0; j < i; j++) { int *y = PyArray_GETPTR1(iranks, j); if (*y == *x) { Py_DECREF(iranks); PyErr_SetString(PyExc_ValueError, "duplicate rank"); return NULL; } } } MPI_Group group; MPI_Comm_group(self->comm, &group); MPI_Group newgroup; MPI_Group_incl(group, n, (int *) PyArray_BYTES(iranks), &newgroup); MPI_Comm comm; MPI_Comm_create(self->comm, newgroup, &comm); // has a memory leak! #ifdef GPAW_MPI_DEBUG if (comm != MPI_COMM_NULL) { // Default Errhandler is MPI_ERRORS_ARE_FATAL MPI_Errhandler_set(comm, MPI_ERRORS_RETURN); #ifdef __bgp__ int result; int rank; MPI_Comm_rank(comm, &rank); MPIX_Get_property(comm, MPIDO_RECT_COMM, &result); if (rank == 0) { if(result) fprintf(stderr, "Get_property: comm is rectangular. \n"); } #endif } #endif // GPAW_MPI_DEBUG MPI_Group_free(&newgroup); MPI_Group_free(&group); if (comm == MPI_COMM_NULL) { Py_DECREF(iranks); Py_RETURN_NONE; } else { MPIObject *obj = PyObject_NEW(MPIObject, &MPIType); if (obj == NULL) return NULL; MPI_Comm_size(comm, &(obj->size)); MPI_Comm_rank(comm, &(obj->rank)); obj->comm = comm; if (obj->parent == Py_None) Py_DECREF(obj->parent); obj->members = (int*) malloc(obj->size*sizeof(int)); if (obj->members == NULL) return NULL; memcpy(obj->members, (int *) PyArray_BYTES(iranks), obj->size*sizeof(int)); Py_DECREF(iranks); // Make sure that MPI_COMM_WORLD is kept alive till the end (we // don't want MPI_Finalize to be called before MPI_Comm_free): Py_INCREF(self); obj->parent = (PyObject*)self; return (PyObject*)obj; } } #endif // PARALLEL gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/mympi.h000066400000000000000000000003501316441372200216500ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ typedef struct { PyObject_HEAD int size; int rank; MPI_Comm comm; PyObject* parent; int* members; } MPIObject; gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/operators.c000066400000000000000000000355211316441372200225360ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ //*** The apply operator and some associate structors are imple- ***// //*** mented in two version: a original version and a speciel ***// //*** OpenMP version. By default the original version will ***// //*** be used, but it's possible to use the OpenMP version ***// //*** by compiling gpaw with the macro GPAW_OMP defined and ***// //*** and the compile/link option "-fopenmp". ***// //*** Author of the optimized OpenMP code: ***// //*** Mads R. B. Kristensen - madsbk@diku.dk ***// #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include #include #include "extensions.h" #include "bc.h" #include "mympi.h" #ifdef GPAW_ASYNC #define GPAW_ASYNC3 3 #define GPAW_ASYNC2 2 #else #define GPAW_ASYNC3 1 #define GPAW_ASYNC2 1 #endif typedef struct { PyObject_HEAD bmgsstencil stencil; boundary_conditions* bc; MPI_Request recvreq[2]; MPI_Request sendreq[2]; } OperatorObject; static void Operator_dealloc(OperatorObject *self) { free(self->bc); PyObject_DEL(self); } static PyObject * Operator_relax(OperatorObject *self, PyObject *args) { int relax_method; PyArrayObject* func; PyArrayObject* source; int nrelax; double w = 1.0; if (!PyArg_ParseTuple(args, "iOOi|d", &relax_method, &func, &source, &nrelax, &w)) return NULL; const boundary_conditions* bc = self->bc; double* fun = DOUBLEP(func); const double* src = DOUBLEP(source); const double_complex* ph; const int* size2 = bc->size2; double* buf = GPAW_MALLOC(double, size2[0] * size2[1] * size2[2] * bc->ndouble); double* sendbuf = GPAW_MALLOC(double, bc->maxsend); double* recvbuf = GPAW_MALLOC(double, bc->maxrecv); ph = 0; for (int n = 0; n < nrelax; n++ ) { for (int i = 0; i < 3; i++) { bc_unpack1(bc, fun, buf, i, self->recvreq, self->sendreq, recvbuf, sendbuf, ph + 2 * i, 0, 1); bc_unpack2(bc, buf, i, self->recvreq, self->sendreq, recvbuf, 1); } bmgs_relax(relax_method, &self->stencil, buf, fun, src, w); } free(recvbuf); free(sendbuf); free(buf); Py_RETURN_NONE; } struct apply_args{ int thread_id; OperatorObject *self; int ng; int ng2; int nin; int nthds; int chunksize; int chunkinc; const double* in; double* out; int real; const double_complex* ph; }; //Plain worker void *apply_worker(void *threadarg) { struct apply_args *args = (struct apply_args *) threadarg; boundary_conditions* bc = args->self->bc; MPI_Request recvreq[2]; MPI_Request sendreq[2]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; if (chunksize > args->chunksize) chunksize = args->chunksize; double* sendbuf = GPAW_MALLOC(double, bc->maxsend * args->chunksize); double* recvbuf = GPAW_MALLOC(double, bc->maxrecv * args->chunksize); double* buf = GPAW_MALLOC(double, args->ng2 * args->chunksize); for (int n = nstart; n < nend; n += chunksize) { if (n + chunksize >= nend && chunksize > 1) chunksize = nend - n; const double* in = args->in + n * args->ng; double* out = args->out + n * args->ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf, i, recvreq, sendreq, recvbuf, sendbuf, args->ph + 2 * i, args->thread_id, chunksize); bc_unpack2(bc, buf, i, recvreq, sendreq, recvbuf, chunksize); } for (int m = 0; m < chunksize; m++) if (args->real) bmgs_fd(&args->self->stencil, buf + m * args->ng2, out + m * args->ng); else bmgs_fdz(&args->self->stencil, (const double_complex*) (buf + m * args->ng2), (double_complex*) (out + m * args->ng)); } free(buf); free(recvbuf); free(sendbuf); return NULL; } //Async worker void *apply_worker_cfd_async(void *threadarg) { struct apply_args *args = (struct apply_args *) threadarg; boundary_conditions* bc = args->self->bc; MPI_Request recvreq[2 * GPAW_ASYNC3]; MPI_Request sendreq[2 * GPAW_ASYNC3]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; if (chunksize > args->chunksize) chunksize = args->chunksize; double* sendbuf = GPAW_MALLOC(double, bc->maxsend * GPAW_ASYNC3 * args->chunksize); double* recvbuf = GPAW_MALLOC(double, bc->maxrecv * GPAW_ASYNC3 * args->chunksize); double* buf = GPAW_MALLOC(double, args->ng2 * args->chunksize); for (int n = nstart; n < nend; n += chunksize) { if (n + chunksize >= nend && chunksize > 1) chunksize = nend - n; const double* in = args->in + n * args->ng; double* out = args->out + n * args->ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf, i, recvreq + i * 2, sendreq + i * 2, recvbuf + i * bc->maxrecv * chunksize, sendbuf + i * bc->maxsend * chunksize, args->ph + 2 * i, args->thread_id, chunksize); } for (int i = 0; i < 3; i++) { bc_unpack2(bc, buf, i, recvreq + i * 2, sendreq + i * 2, recvbuf + i * bc->maxrecv * chunksize, chunksize); } for (int m = 0; m < chunksize; m++) if (args->real) bmgs_fd(&args->self->stencil, buf + m * args->ng2, out + m * args->ng); else bmgs_fdz(&args->self->stencil, (const double_complex*) (buf + m * args->ng2), (double_complex*) (out + m * args->ng)); } free(buf); free(recvbuf); free(sendbuf); return NULL; } //Double buffering async worker void *apply_worker_cfd(void *threadarg) { struct apply_args *args = (struct apply_args *) threadarg; boundary_conditions* bc = args->self->bc; MPI_Request recvreq[2 * GPAW_ASYNC3 * GPAW_ASYNC2]; MPI_Request sendreq[2 * GPAW_ASYNC3 * GPAW_ASYNC2]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; if (chunksize > args->chunksize) chunksize = args->chunksize; int chunk = args->chunkinc; if (chunk > chunksize) chunk = chunksize; double* sendbuf = GPAW_MALLOC(double, bc->maxsend * args->chunksize * GPAW_ASYNC3 * GPAW_ASYNC2); double* recvbuf = GPAW_MALLOC(double, bc->maxrecv * args->chunksize * GPAW_ASYNC3 * GPAW_ASYNC2); double* buf = GPAW_MALLOC(double, args->ng2 * args->chunksize * GPAW_ASYNC2); int odd = 0; const double* in = args->in + nstart * args->ng; double* out; for (int i = 0; i < 3; i++) bc_unpack1(bc, in, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, sendbuf + odd * bc->maxsend * chunksize + i * bc->maxsend * chunksize * GPAW_ASYNC2, args->ph + 2 * i, args->thread_id, chunk); odd = odd ^ 1; int last_chunk = chunk; for (int n = nstart+chunk; n < nend; n += chunk) { last_chunk += args->chunkinc; if (last_chunk > chunksize) last_chunk = chunksize; if (n + last_chunk >= nend && last_chunk > 1) last_chunk = nend - n; in = args->in + n * args->ng; out = args->out + (n-chunk) * args->ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, sendbuf + odd * bc->maxsend * chunksize + i * bc->maxsend * chunksize * GPAW_ASYNC2, args->ph + 2 * i, args->thread_id, last_chunk); } odd = odd ^ 1; for (int i = 0; i < 3; i++) { bc_unpack2(bc, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, chunk); } for (int m = 0; m < chunk; m++) if (args->real) bmgs_fd(&args->self->stencil, buf + m * args->ng2 + odd * args->ng2 * chunksize, out + m * args->ng); else bmgs_fdz(&args->self->stencil, (const double_complex*) (buf + m * args->ng2 + odd * args->ng2 * chunksize), (double_complex*) (out + m * args->ng)); chunk = last_chunk; } odd = odd ^ 1; out = args->out + (nend-last_chunk) * args->ng; for (int i = 0; i < 3; i++) { bc_unpack2(bc, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, last_chunk); } for (int m = 0; m < last_chunk; m++) if (args->real) bmgs_fd(&args->self->stencil, buf + m * args->ng2 + odd * args->ng2 * chunksize, out + m * args->ng); else bmgs_fdz(&args->self->stencil, (const double_complex*) (buf + m * args->ng2 + odd * args->ng2 * chunksize), (double_complex*) (out + m * args->ng)); free(buf); free(recvbuf); free(sendbuf); return NULL; } static PyObject * Operator_apply(OperatorObject *self, PyObject *args) { PyArrayObject* input; PyArrayObject* output; PyArrayObject* phases = 0; if (!PyArg_ParseTuple(args, "OO|O", &input, &output, &phases)) return NULL; int nin = 1; if (PyArray_NDIM(input) == 4) nin = PyArray_DIMS(input)[0]; boundary_conditions* bc = self->bc; const int* size1 = bc->size1; const int* size2 = bc->size2; int ng = bc->ndouble * size1[0] * size1[1] * size1[2]; int ng2 = bc->ndouble * size2[0] * size2[1] * size2[2]; const double* in = DOUBLEP(input); double* out = DOUBLEP(output); const double_complex* ph; bool real = (PyArray_DESCR(input)->type_num == NPY_DOUBLE); if (real) ph = 0; else ph = COMPLEXP(phases); int chunksize = 1; if (getenv("GPAW_CHUNK_SIZE") != NULL) chunksize = atoi(getenv("GPAW_CHUNK_SIZE")); int chunkinc = chunksize; if (getenv("GPAW_CHUNK_INC") != NULL) chunkinc = atoi(getenv("GPAW_CHUNK_INC")); int nthds = 1; #ifdef GPAW_OMP if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct apply_args *wargs = GPAW_MALLOC(struct apply_args, nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->chunksize = chunksize; (wargs+i)->chunkinc = chunkinc; (wargs+i)->self = self; (wargs+i)->ng = ng; (wargs+i)->ng2 = ng2; (wargs+i)->nin = nin; (wargs+i)->in = in; (wargs+i)->out = out; (wargs+i)->real = real; (wargs+i)->ph = ph; } #ifndef GPAW_ASYNC if (1) #else if (bc->cfd == 0) #endif { #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, apply_worker, (void*) (wargs+i)); #endif apply_worker(wargs); } else { #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, apply_worker_cfd, (void*) (wargs+i)); #endif apply_worker_cfd(wargs); } #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); Py_RETURN_NONE; } static PyObject * Operator_get_diagonal_element(OperatorObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; const bmgsstencil* s = &self->stencil; double d = 0.0; for (int n = 0; n < s->ncoefs; n++) if (s->offsets[n] == 0) d = s->coefs[n]; return Py_BuildValue("d", d); } static PyObject * Operator_get_async_sizes(OperatorObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; #ifdef GPAW_ASYNC return Py_BuildValue("(iii)", 1, GPAW_ASYNC2, GPAW_ASYNC3); #else return Py_BuildValue("(iii)", 0, GPAW_ASYNC2, GPAW_ASYNC3); #endif } static PyMethodDef Operator_Methods[] = { {"apply", (PyCFunction)Operator_apply, METH_VARARGS, NULL}, {"relax", (PyCFunction)Operator_relax, METH_VARARGS, NULL}, {"get_diagonal_element", (PyCFunction)Operator_get_diagonal_element, METH_VARARGS, NULL}, {"get_async_sizes", (PyCFunction)Operator_get_async_sizes, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; PyTypeObject OperatorType = { PyVarObject_HEAD_INIT(NULL, 0) "Operator", sizeof(OperatorObject), 0, (destructor)Operator_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "FD-operator object", 0, 0, 0, 0, 0, 0, Operator_Methods }; PyObject * NewOperatorObject(PyObject *obj, PyObject *args) { PyArrayObject* coefs; PyArrayObject* offsets; PyArrayObject* size; int range; PyArrayObject* neighbors; int real; PyObject* comm_obj; int cfd; if (!PyArg_ParseTuple(args, "OOOiOiOi", &coefs, &offsets, &size, &range, &neighbors, &real, &comm_obj, &cfd)) return NULL; OperatorObject *self = PyObject_NEW(OperatorObject, &OperatorType); if (self == NULL) return NULL; self->stencil = bmgs_stencil(PyArray_DIMS(coefs)[0], DOUBLEP(coefs), LONGP(offsets), range, LONGP(size)); const long (*nb)[2] = (const long (*)[2])LONGP(neighbors); const long padding[3][2] = {{range, range}, {range, range}, {range, range}}; MPI_Comm comm = MPI_COMM_NULL; if (comm_obj != Py_None) comm = ((MPIObject*)comm_obj)->comm; self->bc = bc_init(LONGP(size), padding, padding, nb, comm, real, cfd); return (PyObject*)self; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/plane_wave.c000066400000000000000000000020371316441372200226350ustar00rootroot00000000000000#include "extensions.h" #include PyObject *plane_wave_grid(PyObject *self, PyObject *args) { PyArrayObject* beg_c; PyArrayObject* end_c; PyArrayObject* h_c; PyArrayObject* k_c; PyArrayObject* r0_c; PyArrayObject* pw_g; if (!PyArg_ParseTuple(args, "OOOOOO", &beg_c, &end_c, &h_c, &k_c, &r0_c, &pw_g)) return NULL; long *beg = LONGP(beg_c); long *end = LONGP(end_c); double *h = DOUBLEP(h_c); double *vk = DOUBLEP(k_c); double *vr0 = DOUBLEP(r0_c); double_complex *pw = COMPLEXP(pw_g); double kr[3], kr0[3]; int n[3], ij; for (int c = 0; c < 3; c++) { n[c] = end[c] - beg[c]; kr0[c] = vk[c] * vr0[c]; } for (int i = 0; i < n[0]; i++) { kr[0] = vk[0] * h[0] * (beg[0] + i) - kr0[0]; for (int j = 0; j < n[1]; j++) { kr[1] = kr[0] + vk[1] * h[1] * (beg[1] + j) - kr0[1]; ij = (i*n[1] + j)*n[2]; for (int k = 0; k < n[2]; k++) { kr[2] = kr[1] + vk[2] * h[2] * (beg[2] + k) - kr0[2]; pw[ij + k] = cos(kr[2]) + I * sin(kr[2]); } } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/plt.c000066400000000000000000000060141316441372200213120ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" int write_plt_file(char *fname, int nx, int ny, int nz, double x0, double y0, double z0, double dx, double dy, double dz, double *grid); /* write grid to binary plt (gOpenMol) plot file */ PyObject* WritePLT(PyObject *self, PyObject *args) { char* fname; /* file name */ PyArrayObject* ho; /* grid spacings */ PyArrayObject* go; /* grid to write */ if (!PyArg_ParseTuple(args, "sOO", &fname, &ho, &go)) return NULL; /* must be 3D */ if(PyArray_NDIM(go) != 3) return NULL; double* g = DOUBLEP(go); double* h = DOUBLEP(ho); write_plt_file(fname, PyArray_DIM(go, 0), PyArray_DIM(go, 1), PyArray_DIM(go, 2), 0.,0.,0., h[0],h[1],h[2], g); Py_RETURN_NONE; } /* ----------------------------------------------------------------- * write grid to binary plt (gOpenMol) plot file * * x0, dx etc are assumed to be atomic units * the grid is assumed to be in the format: * grid(ix,iy,iz) = grid[ ix + ( iy + iz*ny )*nx ]; * where ix=0..nx-1 etc */ /* stolen from pltfile.c */ #define FWRITE(value , size) { \ Items = fwrite(&value, size , 1L , Output_p);\ if(Items < 1) {\ printf("?ERROR - in writing contour file (*)\n");\ return(1);}} int write_plt_file(char *fname, int nx, int ny, int nz, double x0, double y0, double z0, double dx, double dy, double dz, double *grid) { FILE *Output_p; static int Items; float scale,zmin,zmax,ymin,ymax,xmin,xmax,val; int rank,TypeOfSurface; int ix,iy,iz,indx; double norm,sum,dV; Output_p = fopen(fname,"wb"); /* see http://www.csc.fi/gopenmol/developers/plt_format.phtml */ #define au_A 0.52917725 scale = au_A; /* atomic length in Angstroem */ rank=3; /* always 3 */ FWRITE(rank , sizeof(int)); TypeOfSurface=4; /* arbitrary */ FWRITE(TypeOfSurface , sizeof(int)); FWRITE(nz , sizeof(int)); FWRITE(ny , sizeof(int)); FWRITE(nx , sizeof(int)); zmin= scale * ((float) z0); zmax= scale * ((float) z0+(nz-1)*dz); /* float zmax=(float) z0+nz*dz; */ FWRITE(zmin , sizeof(float)); FWRITE(zmax , sizeof(float)); ymin= scale * ((float) y0); ymax= scale * ((float) y0+(ny-1)*dy); /* float ymax=(float) y0+ny*dy; */ FWRITE(ymin , sizeof(float)); FWRITE(ymax , sizeof(float)); xmin= scale * ((float) x0); xmax= scale * ((float) x0+(nx-1)*dx); /* float xmax=(float) x0+nx*dx; */ FWRITE(xmin , sizeof(float)); FWRITE(xmax , sizeof(float)); indx=0; norm = 0; sum=0; dV=dx*dy*dz; for(iz=0;iz %s written (sum=%g,norm=%g)\n", fname,sum*dV,norm*dV); return 0; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/point_charges.c000066400000000000000000000130401316441372200233350ustar00rootroot00000000000000#include "extensions.h" //#include PyObject *pc_potential(PyObject *self, PyObject *args) { PyArrayObject* beg_v_obj; PyArrayObject* h_v_obj; PyArrayObject* q_p_obj; PyArrayObject* R_pv_obj; double rc; double rc2; double width; PyArrayObject* vext_G_obj; PyArrayObject* dcom_pv_obj; PyArrayObject* rhot_G_obj = 0; PyArrayObject* F_pv_obj = 0; if (!PyArg_ParseTuple(args, "OOOOdddOO|OO", &beg_v_obj, &h_v_obj, &q_p_obj, &R_pv_obj, &rc, &rc2, &width, &vext_G_obj, &dcom_pv_obj, &rhot_G_obj, &F_pv_obj)) return NULL; const long *beg_v = PyArray_DATA(beg_v_obj); const double *h_v = PyArray_DATA(h_v_obj); const double *q_p = PyArray_DATA(q_p_obj); const double *R_pv = PyArray_DATA(R_pv_obj); const double *dcom_pv = 0; if ((PyObject*)dcom_pv_obj != Py_None) dcom_pv = PyArray_DATA(dcom_pv_obj); double *vext_G = PyArray_DATA(vext_G_obj); int np = PyArray_DIM(R_pv_obj, 0); npy_intp* n = PyArray_DIMS(vext_G_obj); const double* rhot_G = 0; double* F_pv = 0; double dV = 0.0; if (F_pv_obj != 0) { // Handle the two extra arguments for the force calculation: rhot_G = PyArray_DATA(rhot_G_obj); F_pv = PyArray_DATA(F_pv_obj); dV = h_v[0] * h_v[1] * h_v[2]; } double rc12 = rc2 - width; for (int i = 0; i < n[0]; i++) { double x = (beg_v[0] + i) * h_v[0]; for (int j = 0; j < n[1]; j++) { double y = (beg_v[1] + j) * h_v[1]; int ij = (i * n[1] + j) * n[2]; for (int k = 0; k < n[2]; k++) { double z = (beg_v[2] + k) * h_v[2]; for (int p = 0; p < np; p++) { const double* R_v = R_pv + 3 * p; double dx = R_v[0] - x; double dy = R_v[1] - y; double dz = R_v[2] - z; double d = sqrt(dx * dx + dy * dy + dz * dz); double dc, dxc, dyc, dzc; if (dcom_pv == 0) { dc = d; dxc = dx; dyc = dy; dzc = dz; } else { const double* dcom_v = dcom_pv + 3 * p; dxc = dcom_v[0]; dyc = dcom_v[1]; dzc = dcom_v[2]; dc = sqrt(dxc * dxc + dyc * dyc + dzc * dzc); } int G = ij + k; if (F_pv == 0) { // Calculate potential: double v; if (rc < 0.0) v = (q_p[p] * (d * d * d * d - rc * rc * rc * rc) / (d * d * d * d * d + rc * rc * rc * rc * rc)); else if (dc > rc2) v = 0.0; else if (dc > rc12) { double x = (dc - rc12) / width; v = q_p[p] * (1 - x * x * (3 - 2 * x)) / d; } else if (d > rc) v = q_p[p] / d; else { double s = d / rc; double s2 = s * s; v = q_p[p] * (3.28125 + s2 * (-5.46875 + s2 * (4.59375 + s2 * -1.40625))) / rc; } vext_G[G] -= v; } else { // Calculate forces: double w; // -(dv/dr)/r double o = 0.0; if (rc < 0.0) { double x = (d * d * d * d * d + rc * rc * rc * rc * rc); w = ((d * d * d * d - rc * rc * rc * rc) / (x * x) * 5 * d * d * d - 4 * d * d / x); } else if (dc > rc2) w = 0.0; else if (dc > rc12) { double x = (dc - rc12) / width; w = (1 - x * x * (3 - 2 * x)) / (d * d * d); o = 6 * x * (1 - x) / (width * dc * d); } else if (d > rc) w = 1 / (d * d * d); else { double s = d / rc; double s2 = s * s; w = (-2 * (-5.46875 + s2 * (2 * 4.59375 + s2 * 3 * -1.40625)) / (rc * rc * rc)); } w *= q_p[p] * rhot_G[G] * dV; o *= q_p[p] * rhot_G[G] * dV; double* F_v = F_pv + 3 * p; F_v[0] -= w * dx + o * dxc; F_v[1] -= w * dy + o * dyc; F_v[2] -= w * dz + o * dzc; } } } } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/spline.c000066400000000000000000000075111316441372200220100ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Please see the accompanying LICENSE file for further information. */ #include "spline.h" static void spline_dealloc(SplineObject *xp) { bmgs_deletespline(&xp->spline); PyObject_DEL(xp); } static PyObject * spline_get_cutoff(SplineObject *self, PyObject *args) { return Py_BuildValue("d", self->spline.dr * self->spline.nbins); } static PyObject * spline_get_angular_momentum_number(SplineObject *self, PyObject *args) { return Py_BuildValue("i", self->spline.l); } static PyObject * spline_get_value_and_derivative(SplineObject *obj, PyObject *args, PyObject *kwargs) { double r; if (!PyArg_ParseTuple(args, "d", &r)) return NULL; double f; double dfdr; bmgs_get_value_and_derivative(&obj->spline, r, &f, &dfdr); return Py_BuildValue("(dd)", f, dfdr); } // Convert boundary point z-ranges to grid indices for the 2*l+1 boxes static PyObject * spline_get_indices_from_zranges(SplineObject *self, PyObject *args) { PyArrayObject* beg_c_obj; PyArrayObject* end_c_obj; PyArrayObject* G_b_obj; int nm = 2 * self->spline.l + 1; if (!PyArg_ParseTuple(args, "OOO", &beg_c_obj, &end_c_obj, &G_b_obj)) return NULL; long* beg_c = LONGP(beg_c_obj); long* end_c = LONGP(end_c_obj); int ngmax = ((end_c[0] - beg_c[0]) * (end_c[1] - beg_c[1]) * (end_c[2] - beg_c[2])); int* G_B = INTP(G_b_obj); int nB = PyArray_DIMS(G_b_obj)[0]; int ng = 0; for (int b = 0; b < nB; b+=2) ng += G_B[b+1]-G_B[b]; npy_intp gm_dims[2] = {ng, nm}; PyArrayObject* indices_gm_obj = (PyArrayObject*)PyArray_SimpleNew(2, gm_dims, NPY_INT); int* p = INTP(indices_gm_obj); for (int b = 0; b < nB; b += 2) { int Ga = G_B[b], Gb = G_B[b+1]; for (int G = Ga; G < Gb; G++) for (int m = 0; m < nm; m++) *p++ = m * ngmax + G; } // PyObjects created in the C code will be initialized with a refcount // of 1, for which reason we'll have to decref them when done here PyObject* values = Py_BuildValue("(Oii)", indices_gm_obj, ng, nm); Py_DECREF(indices_gm_obj); return values; } static PyMethodDef spline_methods[] = { {"get_cutoff", (PyCFunction)spline_get_cutoff, METH_VARARGS, 0}, {"get_angular_momentum_number", (PyCFunction)spline_get_angular_momentum_number, METH_VARARGS, 0}, {"get_value_and_derivative", (PyCFunction)spline_get_value_and_derivative, METH_VARARGS, 0}, {"get_indices_from_zranges", (PyCFunction)spline_get_indices_from_zranges, METH_VARARGS, 0}, {NULL, NULL, 0, NULL} }; static PyObject * spline_call(SplineObject *obj, PyObject *args, PyObject *kwargs) { double r; if (!PyArg_ParseTuple(args, "d", &r)) return NULL; return Py_BuildValue("d", bmgs_splinevalue(&obj->spline, r)); } PyTypeObject SplineType = { PyVarObject_HEAD_INIT(NULL, 0) "Spline", sizeof(SplineObject), 0, (destructor)spline_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, (ternaryfunc)spline_call, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "Spline object", 0, 0, 0, 0, 0, 0, spline_methods }; PyObject * NewSplineObject(PyObject *self, PyObject *args) { int l; double rcut; PyArrayObject* farray; if (!PyArg_ParseTuple(args, "idO", &l, &rcut, &farray)) return NULL; SplineObject *spline = PyObject_NEW(SplineObject, &SplineType); if (spline == NULL) return NULL; int nbins = PyArray_DIMS(farray)[0] - 1; double dr = rcut / nbins; spline->spline = bmgs_spline(l, dr, nbins, DOUBLEP(farray)); return (PyObject*)spline; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/spline.h000066400000000000000000000003431316441372200220110ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include "extensions.h" #include "bmgs/bmgs.h" typedef struct { PyObject_HEAD bmgsspline spline; } SplineObject; gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/symmetry.c000066400000000000000000000172051316441372200224100ustar00rootroot00000000000000/* Copyright (C) 2010-2011 CAMd * Please see the accompanying LICENSE file for further information. */ #include "extensions.h" // // Apply symmetry operation op_cc to a and add result to b: // // =T_ _ // b(U g) += a(g), // // where: // // = _T // U = op_cc[c1, c2] and g = (g0, g1, g2). // c1,c2 // PyObject* symmetrize(PyObject *self, PyObject *args) { PyArrayObject* a_g_obj; PyArrayObject* b_g_obj; PyArrayObject* op_cc_obj; if (!PyArg_ParseTuple(args, "OOO", &a_g_obj, &b_g_obj, &op_cc_obj)) return NULL; const long* C = (const long*)PyArray_DATA(op_cc_obj); int ng0 = PyArray_DIMS(a_g_obj)[0]; int ng1 = PyArray_DIMS(a_g_obj)[1]; int ng2 = PyArray_DIMS(a_g_obj)[2]; const double* a_g = (const double*)PyArray_DATA(a_g_obj); double* b_g = (double*)PyArray_DATA(b_g_obj); #pragma omp simd for (int g0 = 0; g0 < ng0; g0++) for (int g1 = 0; g1 < ng1; g1++) for (int g2 = 0; g2 < ng2; g2++) { int p0 = ((C[0] * g0 + C[3] * g1 + C[6] * g2) % ng0 + ng0) % ng0; int p1 = ((C[1] * g0 + C[4] * g1 + C[7] * g2) % ng1 + ng1) % ng1; int p2 = ((C[2] * g0 + C[5] * g1 + C[8] * g2) % ng2 + ng2) % ng2; b_g[(p0 * ng1 + p1) * ng2 + p2] += a_g[(g0 * ng1 + g1) * ng2 + g2]; } Py_RETURN_NONE; } PyObject* symmetrize_ft(PyObject *self, PyObject *args) { PyArrayObject* a_g_obj; PyArrayObject* b_g_obj; PyArrayObject* op_cc_obj; PyArrayObject* ft_c_obj; if (!PyArg_ParseTuple(args, "OOOO", &a_g_obj, &b_g_obj, &op_cc_obj, &ft_c_obj)) return NULL; const double* ft = (const double*)PyArray_DATA(ft_c_obj); const long* C = (const long*)PyArray_DATA(op_cc_obj); int ng0 = PyArray_DIMS(a_g_obj)[0]; int ng1 = PyArray_DIMS(a_g_obj)[1]; int ng2 = PyArray_DIMS(a_g_obj)[2]; int ft0 = (int)(ft[0]*ng0); int ft1 = (int)(ft[1]*ng1); int ft2 = (int)(ft[2]*ng2); const double* a_g = (const double*)PyArray_DATA(a_g_obj); double* b_g = (double*)PyArray_DATA(b_g_obj); for (int g0 = 0; g0 < ng0; g0++) for (int g1 = 0; g1 < ng1; g1++) for (int g2 = 0; g2 < ng2; g2++) { int p0 = ((C[0] * g0 + C[3] * g1 + C[6] * g2 - ft0) % ng0 + ng0) % ng0; int p1 = ((C[1] * g0 + C[4] * g1 + C[7] * g2 - ft1) % ng1 + ng1) % ng1; int p2 = ((C[2] * g0 + C[5] * g1 + C[8] * g2 - ft2) % ng2 + ng2) % ng2; b_g[(p0 * ng1 + p1) * ng2 + p2] += *a_g++; } Py_RETURN_NONE; } PyObject* symmetrize_wavefunction(PyObject *self, PyObject *args) { PyArrayObject* a_g_obj; PyArrayObject* b_g_obj; PyArrayObject* op_cc_obj; PyArrayObject* kpt0_obj; PyArrayObject* kpt1_obj; if (!PyArg_ParseTuple(args, "OOOOO", &a_g_obj, &b_g_obj, &op_cc_obj, &kpt0_obj, &kpt1_obj)) return NULL; const long* C = (const long*)PyArray_DATA(op_cc_obj); const double* kpt0 = (const double*) PyArray_DATA(kpt0_obj); const double* kpt1 = (const double*) PyArray_DATA(kpt1_obj); int ng0 = PyArray_DIMS(a_g_obj)[0]; int ng1 = PyArray_DIMS(a_g_obj)[1]; int ng2 = PyArray_DIMS(a_g_obj)[2]; const double complex* a_g = (const double complex*)PyArray_DATA(a_g_obj); double complex* b_g = (double complex*)PyArray_DATA(b_g_obj); for (int g0 = 0; g0 < ng0; g0++) for (int g1 = 0; g1 < ng1; g1++) for (int g2 = 0; g2 < ng2; g2++) { int p0 = ((C[0] * g0 + C[3] * g1 + C[6] * g2) % ng0 + ng0) % ng0; int p1 = ((C[1] * g0 + C[4] * g1 + C[7] * g2) % ng1 + ng1) % ng1; int p2 = ((C[2] * g0 + C[5] * g1 + C[8] * g2) % ng2 + ng2) % ng2; double complex phase = cexp(I * 2. * M_PI * (kpt1[0]/ng0*p0 + kpt1[1]/ng1*p1 + kpt1[2]/ng2*p2 - kpt0[0]/ng0*g0 - kpt0[1]/ng1*g1 - kpt0[2]/ng2*g2)); b_g[(p0 * ng1 + p1) * ng2 + p2] += (*a_g * phase); a_g++; } Py_RETURN_NONE; } PyObject* symmetrize_return_index(PyObject *self, PyObject *args) { PyArrayObject* a_g_obj; PyArrayObject* b_g_obj; PyArrayObject* op_cc_obj; PyArrayObject* kpt0_obj; PyArrayObject* kpt1_obj; if (!PyArg_ParseTuple(args, "OOOOO", &a_g_obj, &b_g_obj, &op_cc_obj, &kpt0_obj, &kpt1_obj)) return NULL; const long* C = (const long*)PyArray_DATA(op_cc_obj); const double* kpt0 = (const double*) PyArray_DATA(kpt0_obj); const double* kpt1 = (const double*) PyArray_DATA(kpt1_obj); int ng0 = PyArray_DIMS(a_g_obj)[0]; int ng1 = PyArray_DIMS(a_g_obj)[1]; int ng2 = PyArray_DIMS(a_g_obj)[2]; unsigned long* a_g = (unsigned long*)PyArray_DATA(a_g_obj); double complex* b_g = (double complex*)PyArray_DATA(b_g_obj); for (int g0 = 0; g0 < ng0; g0++) for (int g1 = 0; g1 < ng1; g1++) for (int g2 = 0; g2 < ng2; g2++) { int p0 = ((C[0] * g0 + C[3] * g1 + C[6] * g2) % ng0 + ng0) % ng0; int p1 = ((C[1] * g0 + C[4] * g1 + C[7] * g2) % ng1 + ng1) % ng1; int p2 = ((C[2] * g0 + C[5] * g1 + C[8] * g2) % ng2 + ng2) % ng2; double complex phase = cexp(I * 2. * M_PI * (kpt1[0]/ng0*p0 + kpt1[1]/ng1*p1 + kpt1[2]/ng2*p2 - kpt0[0]/ng0*g0 - kpt0[1]/ng1*g1 - kpt0[2]/ng2*g2)); *a_g++ = (p0 * ng1 + p1) * ng2 + p2; *b_g++ = phase; } Py_RETURN_NONE; } PyObject* symmetrize_with_index(PyObject *self, PyObject *args) { PyArrayObject* a_g_obj; PyArrayObject* b_g_obj; PyArrayObject* index_g_obj; PyArrayObject* phase_g_obj; if (!PyArg_ParseTuple(args, "OOOO", &a_g_obj, &b_g_obj, &index_g_obj, &phase_g_obj)) return NULL; int ng0 = PyArray_DIMS(a_g_obj)[0]; int ng1 = PyArray_DIMS(a_g_obj)[1]; int ng2 = PyArray_DIMS(a_g_obj)[2]; const unsigned long* index_g = (const unsigned long*)PyArray_DATA(index_g_obj); const double complex* phase_g = (const double complex*)PyArray_DATA(phase_g_obj); const double complex* a_g = (const double complex*)PyArray_DATA(a_g_obj); double complex* b_g = (double complex*)PyArray_DATA(b_g_obj); for (int g0 = 0; g0 < ng0; g0++) for (int g1 = 0; g1 < ng1; g1++) for (int g2 = 0; g2 < ng2; g2++) { b_g[*index_g] += (*a_g * *phase_g); a_g++; phase_g++; index_g++; } Py_RETURN_NONE; } PyObject* map_k_points(PyObject *self, PyObject *args) { PyArrayObject* bzk_kc_obj; PyArrayObject* U_scc_obj; double tol; PyArrayObject* bz2bz_ks_obj; int ka, kb; if (!PyArg_ParseTuple(args, "OOdOii", &bzk_kc_obj, &U_scc_obj, &tol, &bz2bz_ks_obj, &ka, &kb)) return NULL; const long* U_scc = (const long*)PyArray_DATA(U_scc_obj); const double* bzk_kc = (const double*)PyArray_DATA(bzk_kc_obj); long* bz2bz_ks = (long*)PyArray_DATA(bz2bz_ks_obj); int nbzkpts = PyArray_DIMS(bzk_kc_obj)[0]; int nsym = PyArray_DIMS(U_scc_obj)[0]; for (int k1 = ka; k1 < kb; k1++) { const double* q = bzk_kc + k1 * 3; for (int s = 0; s < nsym; s++) { const long* U = U_scc + s * 9; double q0 = U[0] * q[0] + U[1] * q[1] + U[2] * q[2]; double q1 = U[3] * q[0] + U[4] * q[1] + U[5] * q[2]; double q2 = U[6] * q[0] + U[7] * q[1] + U[8] * q[2]; for (int k2 = 0; k2 < nbzkpts; k2++) { double p0 = q0 - bzk_kc[k2 * 3]; if (fabs(p0 - round(p0)) > tol) continue; double p1 = q1 - bzk_kc[k2 * 3 + 1]; if (fabs(p1 - round(p1)) > tol) continue; double p2 = q2 - bzk_kc[k2 * 3 + 2]; if (fabs(p2 - round(p2)) > tol) continue; bz2bz_ks[k1 * nsym + s] = k2; break; } } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/tetra.c000066400000000000000000000074121316441372200216350ustar00rootroot00000000000000#include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" int compare_doubles (const void *a, const void *b) { const double *da = (const double *) a; const double *db = (const double *) b; return (*da > *db) - (*da < *db); } PyObject* tetrahedron_weight(PyObject *self, PyObject *args) { PyArrayObject* epsilon_k; int K; PyArrayObject* allsimplices_sk; PyArrayObject* simplices_s; PyArrayObject* Win_w; PyArrayObject* omega_w; PyArrayObject* vol_s; double f10, f20, f21, f30, f31, f32; double f01, f02, f12, f03, f13, f23; double omega; if (!PyArg_ParseTuple(args, "OOiOOOO", &epsilon_k, &allsimplices_sk, &K, &simplices_s, &Win_w, &omega_w, &vol_s)) return NULL; int nsimplex = PyArray_DIMS(simplices_s)[0]; int nw = PyArray_DIMS(omega_w)[0]; double* e_k = (double*)PyArray_DATA(epsilon_k); double* o_w = (double*)PyArray_DATA(omega_w); double* W_w = (double*)PyArray_DATA(Win_w); long* s_s = (long*)PyArray_DATA(simplices_s); int* alls_sk = (int*)PyArray_DATA(allsimplices_sk); double* v_s = (double*)PyArray_DATA(vol_s); double* et_k = GPAW_MALLOC(double, 4); double gw = 0; double Iw = 0; double delta = 0; int relk = 0; double ek = 0; for (int s = 0; s < nsimplex; s++) { relk = 0; for (int k = 0; k < 4; k++) { et_k[k] = e_k[alls_sk[s_s[s] * 4 + k]]; } ek = e_k[K]; for (int k = 0; k < 4; k++) { if (et_k[k] < ek) { relk += 1; } } qsort(et_k, 4, sizeof (double), compare_doubles); delta = et_k[3] - et_k[0]; for (int w = 0; w < nw; w++) { Iw = 0; gw = 0; omega = o_w[w]; f10 = (omega - et_k[0]) / (et_k[1] - et_k[0]); f20 = (omega - et_k[0]) / (et_k[2] - et_k[0]); f21 = (omega - et_k[1]) / (et_k[2] - et_k[1]); f30 = (omega - et_k[0]) / (et_k[3] - et_k[0]); f31 = (omega - et_k[1]) / (et_k[3] - et_k[1]); f32 = (omega - et_k[2]) / (et_k[3] - et_k[2]); f01 = 1 - f10; f02 = 1 - f20; f03 = 1 - f30; f12 = 1 - f21; f13 = 1 - f31; f23 = 1 - f32; if (et_k[1] != et_k[0] && et_k[0] <= omega && omega <= et_k[1]) { gw = 3 * f20 * f30 / (et_k[1] - et_k[0]); switch (relk) { case 0: Iw = (f01 + f02 + f03) / 3; break; case 1: Iw = f10 / 3; break; case 2: Iw = f20 / 3; break; case 3: Iw = f30 / 3; break; } } else if (et_k[1] != et_k[2] && et_k[1] < omega && omega < et_k[2]) { gw = 3 / delta * (f12 * f20 + f21 * f13); switch (relk) { case 0: Iw = f03 / 3 + f02 * f20 * f12 / (gw * delta); break; case 1: Iw = f12 / 3 + f13 * f13 * f21 / (gw * delta); break; case 2: Iw = f21 / 3 + f20 * f20 * f12 / (gw * delta); break; case 3: Iw = f30 / 3 + f31 * f13 * f21 / (gw * delta); break; } } else if (et_k[2] != et_k[3] && et_k[2] <= omega && omega <= et_k[3]) { gw = 3 * f03 * f13 / (et_k[3] - et_k[2]); switch (relk) { case 0: Iw = f03 / 3; break; case 1: Iw = f13 / 3; break; case 2: Iw = f23 / 3; break; case 3: Iw = (f30 + f31 + f32) / 3; break; } } else { continue; } W_w[w] += v_s[s] * Iw * gw; } } free(et_k); Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/transformers.c000066400000000000000000000156071316441372200232500ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Copyright (C) 2005-2009 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ #include #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" #include "bc.h" #include "mympi.h" #include "bmgs/bmgs.h" #ifdef GPAW_ASYNC #define GPAW_ASYNC_D 3 #else #define GPAW_ASYNC_D 1 #endif typedef struct { PyObject_HEAD boundary_conditions* bc; int p; int k; bool interpolate; MPI_Request recvreq[2]; MPI_Request sendreq[2]; int skip[3][2]; int size_out[3]; /* Size of the output grid */ } TransformerObject; static void Transformer_dealloc(TransformerObject *self) { free(self->bc); PyObject_DEL(self); } struct transapply_args{ int thread_id; TransformerObject *self; int ng; int ng2; int nin; int nthds; const double* in; double* out; int real; const double_complex* ph; }; void *transapply_worker(void *threadarg) { struct transapply_args *args = (struct transapply_args *) threadarg; boundary_conditions* bc = args->self->bc; TransformerObject *self = args->self; double* sendbuf = GPAW_MALLOC(double, bc->maxsend * GPAW_ASYNC_D); double* recvbuf = GPAW_MALLOC(double, bc->maxrecv * GPAW_ASYNC_D); double* buf = GPAW_MALLOC(double, args->ng2); int buf2size = args->ng2; if (self->interpolate) buf2size *= 16; else buf2size /= 2; double* buf2 = GPAW_MALLOC(double, buf2size); MPI_Request recvreq[2 * GPAW_ASYNC_D]; MPI_Request sendreq[2 * GPAW_ASYNC_D]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; int out_ng = bc->ndouble * self->size_out[0] * self->size_out[1] * self->size_out[2]; for (int n = nstart; n < nend; n++) { const double* in = args->in + n * args->ng; double* out = args->out + n * out_ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf, i, recvreq, sendreq, recvbuf, sendbuf, args->ph + 2 * i, args->thread_id, 1); bc_unpack2(bc, buf, i, recvreq, sendreq, recvbuf, 1); } if (args->real) { if (self->interpolate) bmgs_interpolate(self->k, self->skip, buf, bc->size2, out, buf2); else bmgs_restrict(self->k, buf, bc->size2, out, buf2); } else { if (self->interpolate) bmgs_interpolatez(self->k, self->skip, (double_complex*)buf, bc->size2, (double_complex*)out, (double_complex*) buf2); else bmgs_restrictz(self->k, (double_complex*) buf, bc->size2, (double_complex*)out, (double_complex*) buf2); } } free(buf2); free(buf); free(recvbuf); free(sendbuf); return NULL; } static PyObject* Transformer_apply(TransformerObject *self, PyObject *args) { PyArrayObject* input; PyArrayObject* output; PyArrayObject* phases = 0; if (!PyArg_ParseTuple(args, "OO|O", &input, &output, &phases)) return NULL; int nin = 1; if (PyArray_NDIM(input) == 4) nin = PyArray_DIMS(input)[0]; boundary_conditions* bc = self->bc; const int* size1 = bc->size1; const int* size2 = bc->size2; int ng = bc->ndouble * size1[0] * size1[1] * size1[2]; int ng2 = bc->ndouble * size2[0] * size2[1] * size2[2]; const double* in = DOUBLEP(input); double* out = DOUBLEP(output); bool real = (PyArray_DESCR(input)->type_num == NPY_DOUBLE); const double_complex* ph = (real ? 0 : COMPLEXP(phases)); int nthds = 1; #ifdef GPAW_OMP if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct transapply_args *wargs = GPAW_MALLOC(struct transapply_args, nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->self = self; (wargs+i)->ng = ng; (wargs+i)->ng2 = ng2; (wargs+i)->nin = nin; (wargs+i)->in = in; (wargs+i)->out = out; (wargs+i)->real = real; (wargs+i)->ph = ph; } #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, transapply_worker, (void*) (wargs+i)); #endif transapply_worker(wargs); #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); Py_RETURN_NONE; } static PyObject * Transformer_get_async_sizes(TransformerObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; #ifdef GPAW_ASYNC return Py_BuildValue("(ii)", 1, GPAW_ASYNC_D); #else return Py_BuildValue("(ii)", 0, GPAW_ASYNC_D); #endif } static PyMethodDef Transformer_Methods[] = { {"apply", (PyCFunction)Transformer_apply, METH_VARARGS, NULL}, {"get_async_sizes", (PyCFunction)Transformer_get_async_sizes, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; PyTypeObject TransformerType = { PyVarObject_HEAD_INIT(NULL, 0) "Transformer", sizeof(TransformerObject), 0, (destructor)Transformer_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "Transformer object", 0, 0, 0, 0, 0, 0, Transformer_Methods }; PyObject * NewTransformerObject(PyObject *obj, PyObject *args) { PyArrayObject* size_in; PyArrayObject* size_out; int k; PyArrayObject* paddings; PyArrayObject* npaddings; PyArrayObject* skip; PyArrayObject* neighbors; int real; PyObject* comm_obj; int interpolate; if (!PyArg_ParseTuple(args, "OOiOOOOiOi", &size_in, &size_out, &k, &paddings, &npaddings, &skip, &neighbors, &real, &comm_obj, &interpolate)) return NULL; TransformerObject* self = PyObject_NEW(TransformerObject, &TransformerType); if (self == NULL) return NULL; self->k = k; self->interpolate = interpolate; MPI_Comm comm = MPI_COMM_NULL; if (comm_obj != Py_None) comm = ((MPIObject*)comm_obj)->comm; const long (*nb)[2] = (const long (*)[2])LONGP(neighbors); const long (*pad)[2] = (const long (*)[2])LONGP(paddings); const long (*npad)[2] = (const long (*)[2])LONGP(npaddings); const long (*skp)[2] = (const long (*)[2])LONGP(skip); self->bc = bc_init(LONGP(size_in), pad, npad, nb, comm, real, 0); for (int c = 0; c < 3; c++) self->size_out[c] = LONGP(size_out)[c]; for (int c = 0; c < 3; c++) for (int d = 0; d < 2; d++) self->skip[c][d] = (int)skp[c][d]; return (PyObject*)self; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/utilities.c000066400000000000000000000540641316441372200225360ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Copyright (C) 2008-2010 CSC - IT Center for Science Ltd. * Copyright (C) 2011 Argonne National Laboratory * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "extensions.h" #include #include #ifdef __DARWIN_UNIX03 /* Allows for special MaxOS magic */ #include #endif #ifdef __linux__ /* stdlib.h does not define mallinfo (it should!) */ #include #endif #ifdef GPAW_HPM void HPM_Start(char *); void HPM_Stop(char *); void summary_start(void); void summary_stop(void); PyObject* ibm_hpm_start(PyObject *self, PyObject *args) { char* s; if (!PyArg_ParseTuple(args, "s", &s)) return NULL; HPM_Start(s); Py_RETURN_NONE; } PyObject* ibm_hpm_stop(PyObject *self, PyObject *args) { char* s; if (!PyArg_ParseTuple(args, "s", &s)) return NULL; HPM_Stop(s); Py_RETURN_NONE; } PyObject* ibm_mpi_start(PyObject *self) { summary_start(); Py_RETURN_NONE; } PyObject* ibm_mpi_stop(PyObject *self) { summary_stop(); Py_RETURN_NONE; } #endif #ifdef CRAYPAT #include PyObject* craypat_region_begin(PyObject *self, PyObject *args) { int n; char* s; if (!PyArg_ParseTuple(args, "is", &n, &s)) return NULL; PAT_region_begin(n, s); Py_RETURN_NONE; } PyObject* craypat_region_end(PyObject *self, PyObject *args) { int n; if (!PyArg_ParseTuple(args, "i", &n)) return NULL; PAT_region_end(n); Py_RETURN_NONE; } #endif #ifdef PARALLEL #include struct eval { double val; int rank; }; static void coll_print(FILE *fp, const char *label, double val, int print_aggregate, MPI_Comm Comm){ double sum; struct eval in; struct eval out; int rank, numranks; MPI_Comm_size(Comm, &numranks); MPI_Comm_rank(Comm, &rank); in.val=val; in.rank=rank; MPI_Reduce(&val, &sum, 1, MPI_DOUBLE, MPI_SUM, 0, Comm); if(rank==0) { if(print_aggregate) fprintf(fp,"#%19s %14.3f %10.3f ",label,sum,sum/numranks); else fprintf(fp,"#%19s %10.3f ",label,sum/numranks); } MPI_Reduce(&in, &out, 1, MPI_DOUBLE_INT, MPI_MINLOC, 0, Comm); if(rank==0){ fprintf(fp,"%4d %10.3f ", out.rank, out.val); } MPI_Reduce(&in, &out, 1, MPI_DOUBLE_INT, MPI_MAXLOC, 0, Comm); if(rank==0){ fprintf(fp,"%4d %10.3f\n",out.rank, out.val); } } // Utilities for performance measurement with PAPI #ifdef GPAW_PAPI #include #define NUM_PAPI_EV 1 static long_long papi_start_usec_p; static long_long papi_start_usec_r; // Returns PAPI_dmem_info structure in Python dictionary // Units used by PAPI are kB PyObject* papi_mem_info(PyObject *self, PyObject *args) { PAPI_dmem_info_t dmem; PyObject* py_dmem; PAPI_get_dmem_info(&dmem); py_dmem = PyDict_New(); PyDict_SetItemString(py_dmem, "peak", PyLong_FromLongLong(dmem.peak)); PyDict_SetItemString(py_dmem, "size", PyLong_FromLongLong(dmem.size)); PyDict_SetItemString(py_dmem, "resident", PyLong_FromLongLong(dmem.resident)); PyDict_SetItemString(py_dmem, "high_water_mark", PyLong_FromLongLong(dmem.high_water_mark)); PyDict_SetItemString(py_dmem, "shared", PyLong_FromLongLong(dmem.shared)); PyDict_SetItemString(py_dmem, "text", PyLong_FromLongLong(dmem.text)); PyDict_SetItemString(py_dmem, "library", PyLong_FromLongLong(dmem.library)); PyDict_SetItemString(py_dmem, "heap", PyLong_FromLongLong(dmem.heap)); PyDict_SetItemString(py_dmem, "stack", PyLong_FromLongLong(dmem.stack)); PyDict_SetItemString(py_dmem, "pagesize", PyLong_FromLongLong(dmem.pagesize)); PyDict_SetItemString(py_dmem, "pte", PyLong_FromLongLong(dmem.pte)); return py_dmem; } int gpaw_perf_init() { int events[NUM_PAPI_EV]; events[0] = PAPI_FP_OPS; // events[1] = PAPI_L1_DCM; // events[2] = PAPI_L1_DCH; // events[3] = PAPI_TOT_INS; PAPI_start_counters(events, NUM_PAPI_EV); papi_start_usec_r = PAPI_get_real_usec(); papi_start_usec_p = PAPI_get_virt_usec(); return 0; } void gpaw_perf_finalize() { long long papi_values[NUM_PAPI_EV]; double rtime,ptime; double avegflops; double gflop_opers; PAPI_dmem_info_t dmem; int error = 0; double l1hitratio; long_long papi_end_usec_p; long_long papi_end_usec_r; int rank, numranks; MPI_Comm Comm = MPI_COMM_WORLD; //get papi info, first time it intializes PAPI counters papi_end_usec_r = PAPI_get_real_usec(); papi_end_usec_p = PAPI_get_virt_usec(); MPI_Comm_size(Comm, &numranks); MPI_Comm_rank(Comm, &rank); FILE *fp; if (rank == 0) fp = fopen("gpaw_perf.log", "w"); else fp = NULL; if(PAPI_read_counters(papi_values, NUM_PAPI_EV) != PAPI_OK) error++; if(PAPI_get_dmem_info(&dmem) != PAPI_OK) error++; rtime=(double)(papi_end_usec_r - papi_start_usec_r)/1e6; ptime=(double)(papi_end_usec_p - papi_start_usec_p)/1e6; avegflops=(double)papi_values[0]/rtime/1e9; gflop_opers = (double)papi_values[0]/1e9; // l1hitratio=100.0*(double)papi_values[1]/(papi_values[0] + papi_values[1]); if (rank==0 ) { fprintf(fp,"######## GPAW PERFORMANCE REPORT (PAPI) ########\n"); fprintf(fp,"# MPI tasks %d\n", numranks); fprintf(fp,"# aggregated average min(rank/val) max(rank/val) \n"); } coll_print(fp, "Real time (s)", rtime, 1, Comm); coll_print(fp, "Process time (s)", ptime, 1, Comm); coll_print(fp, "Flops (GFlop/s)", avegflops, 1, Comm); coll_print(fp, "Flp-opers (10^9)", gflop_opers, 1, Comm); // coll_print(fp, "L1 hit ratio (%)", l1hitratio, 0, Comm); coll_print(fp, "Peak mem size (MB)", (double)dmem.peak/1.0e3, 0, Comm ); coll_print(fp, "Peak resident (MB)", (double)dmem.high_water_mark/1.0e3 , 0, Comm); if(rank==0) { fflush(fp); fclose(fp); } } #elif GPAW_HPM void HPM_Start(char *); int gpaw_perf_init() { HPM_Start("GPAW"); return 0; } void gpaw_perf_finalize() { HPM_Stop("GPAW"); } #else // Use just MPI_Wtime static double t0; int gpaw_perf_init(void) { t0 = MPI_Wtime(); return 0; } void gpaw_perf_finalize(void) { double rtime; int rank, numranks; MPI_Comm Comm = MPI_COMM_WORLD; MPI_Comm_size(Comm, &numranks); MPI_Comm_rank(Comm, &rank); double t1 = MPI_Wtime(); rtime = t1 - t0; FILE *fp; if (rank == 0) fp = fopen("gpaw_perf.log", "w"); else fp = NULL; if (rank==0 ) { fprintf(fp,"######## GPAW PERFORMANCE REPORT (MPI_Wtime) ########\n"); fprintf(fp,"# MPI tasks %d\n", numranks); fprintf(fp,"# aggregated average min(rank/val) max(rank/val) \n"); } coll_print(fp, "Real time (s)", rtime, 1, Comm); if(rank==0) { fflush(fp); fclose(fp); } } #endif #endif // returns the distance between two 3d double vectors double distance(double *a, double *b) { double sum = 0; double diff; for (int c = 0; c < 3; c++) { diff = a[c] - b[c]; sum += diff*diff; } return sqrt(sum); } /* get heap memory using mallinfo. There is a UNIX version and a Mac OS X version is not well tested but seems to give credible values in simple tests.*/ PyObject* heap_mallinfo(PyObject *self) { double heap; #ifdef __linux__ unsigned int mmap, arena, small; struct mallinfo mi; /* structure in bytes */ mi = mallinfo(); mmap = mi.hblkhd; arena = mi.uordblks; small = mi.usmblks; heap = ((double)(mmap + arena + small))/1024.0; /* convert to KB */ #elif defined(__DARWIN_UNIX03) /* Mac OS X specific hack */ struct malloc_statistics_t mi; /* structure in bytes */ malloc_zone_statistics(NULL, &mi); heap = ((double)(mi.size_in_use))/1024.0; /* convert to KB */ #else heap = -1; #endif return Py_BuildValue("d",heap); } /* elementwise multiply and add result to another vector * * c[i] += a[i] * b[i] , for i = every element in the vectors */ PyObject* elementwise_multiply_add(PyObject *self, PyObject *args) { PyArrayObject* aa; PyArrayObject* bb; PyArrayObject* cc; if (!PyArg_ParseTuple(args, "OOO", &aa, &bb, &cc)) return NULL; const double* const a = DOUBLEP(aa); const double* const b = DOUBLEP(bb); double* const c = DOUBLEP(cc); int n = 1; for (int d = 0; d < PyArray_NDIM(aa); d++) n *= PyArray_DIMS(aa)[d]; for (int i = 0; i < n; i++) { c[i] += a[i] * b[i]; } Py_RETURN_NONE; } PyObject* utilities_gaussian_wave(PyObject *self, PyObject *args) { Py_complex A_obj; PyArrayObject* r_cG_obj; PyArrayObject* r0_c_obj; Py_complex sigma_obj; // imaginary part ignored PyArrayObject* k_c_obj; PyArrayObject* gs_G_obj; if (!PyArg_ParseTuple(args, "DOODOO", &A_obj, &r_cG_obj, &r0_c_obj, &sigma_obj, &k_c_obj, &gs_G_obj)) return NULL; int C, G; C = PyArray_DIMS(r_cG_obj)[0]; G = PyArray_DIMS(r_cG_obj)[1]; for (int i = 2; i < PyArray_NDIM(r_cG_obj); i++) G *= PyArray_DIMS(r_cG_obj)[i]; double* r_cG = DOUBLEP(r_cG_obj); // XXX not ideally strided double* r0_c = DOUBLEP(r0_c_obj); double dr2, kr, alpha = -0.5/pow(sigma_obj.real, 2); int gammapoint = 1; double* k_c = DOUBLEP(k_c_obj); for (int c=0; ctype_num == NPY_DOUBLE) { double* gs_G = DOUBLEP(gs_G_obj); if(gammapoint) for(int g=0; g0) for(int g=0; g 1 ? } } else { double_complex* gs_G = COMPLEXP(gs_G_obj); double_complex A = A_obj.real+I*A_obj.imag; if(gammapoint) for(int g=0; g0) for(int g=0; g 1 ? } } Py_RETURN_NONE; } /* vdot * * If a and b are input vectors, * a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + ... * is returned. */ PyObject* utilities_vdot(PyObject *self, PyObject *args) { PyArrayObject* aa; PyArrayObject* bb; if (!PyArg_ParseTuple(args, "OO", &aa, &bb)) return NULL; const double* const a = DOUBLEP(aa); const double* const b = DOUBLEP(bb); double sum = 0.0; int n = 1; for (int d = 0; d < PyArray_NDIM(aa); d++) n *= PyArray_DIMS(aa)[d]; for (int i = 0; i < n; i++) { sum += a[i] * b[i]; } return PyFloat_FromDouble(sum); } /* vdot * * If a is the input vector, * a[0]*a[0] + a[1]*a[1] + a[2]*a[2] + ... * is returned. */ PyObject* utilities_vdot_self(PyObject *self, PyObject *args) { PyArrayObject* aa; if (!PyArg_ParseTuple(args, "O", &aa)) return NULL; const double* const a = DOUBLEP(aa); double sum = 0.0; int n = 1; for (int d = 0; d < PyArray_NDIM(aa); d++) n *= PyArray_DIMS(aa)[d]; for (int i = 0; i < n; i++) { sum += a[i] * a[i]; } return PyFloat_FromDouble(sum); } PyObject* errorfunction(PyObject *self, PyObject *args) { double x; if (!PyArg_ParseTuple(args, "d", &x)) return NULL; return Py_BuildValue("d", erf(x)); } PyObject* pack(PyObject *self, PyObject *args) { PyArrayObject* a_obj; if (!PyArg_ParseTuple(args, "O", &a_obj)) return NULL; a_obj = PyArray_GETCONTIGUOUS(a_obj); int n = PyArray_DIMS(a_obj)[0]; npy_intp dims[1] = {n * (n + 1) / 2}; int typenum = PyArray_DESCR(a_obj)->type_num; PyArrayObject* b_obj = (PyArrayObject*) PyArray_SimpleNew(1, dims, typenum); if (b_obj == NULL) return NULL; if (typenum == NPY_DOUBLE) { double* a = (double*)PyArray_DATA(a_obj); double* b = (double*)PyArray_DATA(b_obj); for (int r = 0; r < n; r++) { *b++ = a[r + n * r]; for (int c = r + 1; c < n; c++) *b++ = a[r + n * c] + a[c + n * r]; } } else { double complex* a = (double complex*)PyArray_DATA(a_obj); double complex* b = (double complex*)PyArray_DATA(b_obj); for (int r = 0; r < n; r++) { *b++ = a[r + n * r]; for (int c = r + 1; c < n; c++) *b++ = a[r + n * c] + a[c + n * r]; } } Py_DECREF(a_obj); PyObject* value = Py_BuildValue("O", b_obj); Py_DECREF(b_obj); return value; } PyObject* unpack(PyObject *self, PyObject *args) { PyArrayObject* ap; PyArrayObject* a; if (!PyArg_ParseTuple(args, "OO", &ap, &a)) return NULL; int n = PyArray_DIMS(a)[0]; double* datap = DOUBLEP(ap); double* data = DOUBLEP(a); for (int r = 0; r < n; r++) for (int c = r; c < n; c++) { double d = *datap++; data[c + r * n] = d; data[r + c * n] = d; } Py_RETURN_NONE; } PyObject* unpack_complex(PyObject *self, PyObject *args) { PyArrayObject* ap; PyArrayObject* a; if (!PyArg_ParseTuple(args, "OO", &ap, &a)) return NULL; int n = PyArray_DIMS(a)[0]; double_complex* datap = COMPLEXP(ap); double_complex* data = COMPLEXP(a); for (int r = 0; r < n; r++) for (int c = r; c < n; c++) { double_complex d = *datap++; data[c + r * n] = d; data[r + c * n] = conj(d); } Py_RETURN_NONE; } PyObject* hartree(PyObject *self, PyObject *args) { int l; PyArrayObject* nrdr_obj; PyArrayObject* r_obj; PyArrayObject* vr_obj; if (!PyArg_ParseTuple(args, "iOOO", &l, &nrdr_obj, &r_obj, &vr_obj)) return NULL; const int M = PyArray_DIM(nrdr_obj, 0); const double* nrdr = DOUBLEP(nrdr_obj); const double* r = DOUBLEP(r_obj); double* vr = DOUBLEP(vr_obj); double p = 0.0; double q = 0.0; for (int g = M - 1; g > 0; g--) { double R = r[g]; double rl = pow(R, l); double dp = nrdr[g] / rl; double rlp1 = rl * R; double dq = nrdr[g] * rlp1; vr[g] = (p + 0.5 * dp) * rlp1 - (q + 0.5 * dq) / rl; p += dp; q += dq; } vr[0] = 0.0; double f = 4.0 * M_PI / (2 * l + 1); for (int g = 1; g < M; g++) { double R = r[g]; vr[g] = f * (vr[g] + q / pow(R, l)); } Py_RETURN_NONE; } PyObject* localize(PyObject *self, PyObject *args) { PyArrayObject* Z_nnc; PyArrayObject* U_nn; if (!PyArg_ParseTuple(args, "OO", &Z_nnc, &U_nn)) return NULL; int n = PyArray_DIMS(U_nn)[0]; double complex (*Z)[n][3] = (double complex (*)[n][3])COMPLEXP(Z_nnc); double (*U)[n] = (double (*)[n])DOUBLEP(U_nn); double value = 0.0; for (int a = 0; a < n; a++) { for (int b = a + 1; b < n; b++) { double complex* Zaa = Z[a][a]; double complex* Zab = Z[a][b]; double complex* Zbb = Z[b][b]; double x = 0.0; double y = 0.0; for (int c = 0; c < 3; c++) { x += (0.25 * creal(Zbb[c] * conj(Zbb[c])) + 0.25 * creal(Zaa[c] * conj(Zaa[c])) - 0.5 * creal(Zaa[c] * conj(Zbb[c])) - creal(Zab[c] * conj(Zab[c]))); y += creal((Zaa[c] - Zbb[c]) * conj(Zab[c])); } double t = 0.25 * atan2(y, x); double C = cos(t); double S = sin(t); for (int i = 0; i < a; i++) for (int c = 0; c < 3; c++) { double complex Ziac = Z[i][a][c]; Z[i][a][c] = C * Ziac + S * Z[i][b][c]; Z[i][b][c] = C * Z[i][b][c] - S * Ziac; } for (int c = 0; c < 3; c++) { double complex Zaac = Zaa[c]; double complex Zabc = Zab[c]; double complex Zbbc = Zbb[c]; Zaa[c] = C * C * Zaac + 2 * C * S * Zabc + S * S * Zbbc; Zbb[c] = C * C * Zbbc - 2 * C * S * Zabc + S * S * Zaac; Zab[c] = S * C * (Zbbc - Zaac) + (C * C - S * S) * Zabc; } for (int i = a + 1; i < b; i++) for (int c = 0; c < 3; c++) { double complex Zaic = Z[a][i][c]; Z[a][i][c] = C * Zaic + S * Z[i][b][c]; Z[i][b][c] = C * Z[i][b][c] - S * Zaic; } for (int i = b + 1; i < n; i++) for (int c = 0; c < 3; c++) { double complex Zaic = Z[a][i][c]; Z[a][i][c] = C * Zaic + S * Z[b][i][c]; Z[b][i][c] = C * Z[b][i][c] - S * Zaic; } for (int i = 0; i < n; i++) { double Uia = U[i][a]; U[i][a] = C * Uia + S * U[i][b]; U[i][b] = C * U[i][b] - S * Uia; } } double complex* Zaa = Z[a][a]; for (int c = 0; c < 3; c++) value += creal(Zaa[c] * conj(Zaa[c])); } return Py_BuildValue("d", value); } PyObject* spherical_harmonics(PyObject *self, PyObject *args) { int l; PyArrayObject* R_obj_c; PyArrayObject* Y_obj_m; if (!PyArg_ParseTuple(args, "iOO", &l, &R_obj_c, &Y_obj_m)) return NULL; double* R_c = DOUBLEP(R_obj_c); double* Y_m = DOUBLEP(Y_obj_m); if (l == 0) Y_m[0] = 0.28209479177387814; else { double x = R_c[0]; double y = R_c[1]; double z = R_c[2]; if (l == 1) { Y_m[0] = 0.48860251190291992 * y; Y_m[1] = 0.48860251190291992 * z; Y_m[2] = 0.48860251190291992 * x; } else { double r2 = x*x+y*y+z*z; if (l == 2) { Y_m[0] = 1.0925484305920792 * x*y; Y_m[1] = 1.0925484305920792 * y*z; Y_m[2] = 0.31539156525252005 * (3*z*z-r2); Y_m[3] = 1.0925484305920792 * x*z; Y_m[4] = 0.54627421529603959 * (x*x-y*y); } else if (l == 3) { Y_m[0] = 0.59004358992664352 * (-y*y*y+3*x*x*y); Y_m[1] = 2.8906114426405538 * x*y*z; Y_m[2] = 0.45704579946446577 * (-y*r2+5*y*z*z); Y_m[3] = 0.3731763325901154 * (5*z*z*z-3*z*r2); Y_m[4] = 0.45704579946446577 * (5*x*z*z-x*r2); Y_m[5] = 1.4453057213202769 * (x*x*z-y*y*z); Y_m[6] = 0.59004358992664352 * (x*x*x-3*x*y*y); } else if (l == 4) { Y_m[0] = 2.5033429417967046 * (x*x*x*y-x*y*y*y); Y_m[1] = 1.7701307697799307 * (-y*y*y*z+3*x*x*y*z); Y_m[2] = 0.94617469575756008 * (-x*y*r2+7*x*y*z*z); Y_m[3] = 0.66904654355728921 * (-3*y*z*r2+7*y*z*z*z); Y_m[4] = 0.10578554691520431 * (-30*z*z*r2+3*r2*r2+35*z*z*z*z); Y_m[5] = 0.66904654355728921 * (7*x*z*z*z-3*x*z*r2); Y_m[6] = 0.47308734787878004 * (-x*x*r2+7*x*x*z*z+y*y*r2-7*y*y*z*z); Y_m[7] = 1.7701307697799307 * (x*x*x*z-3*x*y*y*z); Y_m[8] = 0.62583573544917614 * (-6*x*x*y*y+x*x*x*x+y*y*y*y); } else if (l == 5) { Y_m[0] = 0.65638205684017015 * (y*y*y*y*y+5*x*x*x*x*y-10*x*x*y*y*y); Y_m[1] = 8.3026492595241645 * (x*x*x*y*z-x*y*y*y*z); Y_m[2] = 0.48923829943525038 * (y*y*y*r2-9*y*y*y*z*z-3*x*x*y*r2+27*x*x*y*z*z); Y_m[3] = 4.7935367849733241 * (3*x*y*z*z*z-x*y*z*r2); Y_m[4] = 0.45294665119569694 * (-14*y*z*z*r2+y*r2*r2+21*y*z*z*z*z); Y_m[5] = 0.1169503224534236 * (63*z*z*z*z*z+15*z*r2*r2-70*z*z*z*r2); Y_m[6] = 0.45294665119569694 * (x*r2*r2-14*x*z*z*r2+21*x*z*z*z*z); Y_m[7] = 2.3967683924866621 * (-3*y*y*z*z*z+y*y*z*r2+3*x*x*z*z*z-x*x*z*r2); Y_m[8] = 0.48923829943525038 * (9*x*x*x*z*z-27*x*y*y*z*z-x*x*x*r2+3*x*y*y*r2); Y_m[9] = 2.0756623148810411 * (y*y*y*y*z-6*x*x*y*y*z+x*x*x*x*z); Y_m[10] = 0.65638205684017015 * (-10*x*x*x*y*y+5*x*y*y*y*y+x*x*x*x*x); } else if (l == 6) { Y_m[0] = 1.3663682103838286 * (-10*x*x*x*y*y*y+3*x*x*x*x*x*y+3*x*y*y*y*y*y); Y_m[1] = 2.3666191622317521 * (y*y*y*y*y*z-10*x*x*y*y*y*z+5*x*x*x*x*y*z); Y_m[2] = 2.0182596029148967 * (-x*x*x*y*r2+x*y*y*y*r2-11*x*y*y*y*z*z+11*x*x*x*y*z*z); Y_m[3] = 0.92120525951492349 * (-11*y*y*y*z*z*z-9*x*x*y*z*r2+33*x*x*y*z*z*z+3*y*y*y*z*r2); Y_m[4] =0.92120525951492349 * (x*y*r2*r2+33*x*y*z*z*z*z-18*x*y*z*z*r2); Y_m[5] = 0.58262136251873142 * (5*y*z*r2*r2+33*y*z*z*z*z*z-30*y*z*z*z*r2); Y_m[6] = 0.063569202267628425 * (231*z*z*z*z*z*z-5*r2*r2*r2+105*z*z*r2*r2-315*z*z*z*z*r2); Y_m[7] = 0.58262136251873142 * (-30*x*z*z*z*r2+33*x*z*z*z*z*z+5*x*z*r2*r2); Y_m[8] = 0.46060262975746175 * (33*x*x*z*z*z*z+x*x*r2*r2-y*y*r2*r2-18*x*x*z*z*r2+18*y*y*z*z*r2-33*y*y*z*z*z*z); Y_m[9] = 0.92120525951492349 * (-3*x*x*x*z*r2-33*x*y*y*z*z*z+9*x*y*y*z*r2+11*x*x*x*z*z*z); Y_m[10] = 0.50456490072872417 * (11*y*y*y*y*z*z-66*x*x*y*y*z*z-x*x*x*x*r2+6*x*x*y*y*r2+11*x*x*x*x*z*z-y*y*y*y*r2); Y_m[11] = 2.3666191622317521 * (5*x*y*y*y*y*z+x*x*x*x*x*z-10*x*x*x*y*y*z); Y_m[12] = 0.6831841051919143 * (x*x*x*x*x*x+15*x*x*y*y*y*y-15*x*x*x*x*y*y-y*y*y*y*y*y); } } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/wigner_seitz.c000066400000000000000000000030631316441372200232250ustar00rootroot00000000000000#include "extensions.h" #include double distance(double *a, double *b); // returns the squared distance between a 3d double vector // and a 3d int vector double distance3d2_di(double *a, int *b) { double sum = 0; double diff; for (int c = 0; c < 3; c++) { diff = a[c] - (double)b[c]; sum += diff*diff; } return sum; } PyObject *exterior_electron_density_region(PyObject *self, PyObject *args) { PyArrayObject* ai; PyArrayObject* aatom_c; PyArrayObject* beg_c; PyArrayObject* end_c; PyArrayObject* hh_c; PyArrayObject* vdWrad; if (!PyArg_ParseTuple(args, "OOOOOO", &ai, &aatom_c, &beg_c, &end_c, &hh_c, &vdWrad)) return NULL; long *aindex = LONGP(ai); int natoms = PyArray_DIM(aatom_c, 0); double *atom_c = DOUBLEP(aatom_c); long *beg = LONGP(beg_c); long *end = LONGP(end_c); double *h_c = DOUBLEP(hh_c); double *vdWradius = DOUBLEP(vdWrad); int n[3], ij; double pos[3]; for (int c = 0; c < 3; c++) { n[c] = end[c] - beg[c]; } // loop over all points for (int i = 0; i < n[0]; i++) { pos[0] = (beg[0] + i) * h_c[0]; for (int j = 0; j < n[1]; j++) { pos[1] = (beg[1] + j) * h_c[1]; ij = (i*n[1] + j)*n[2]; for (int k = 0; k < n[2]; k++) { pos[2] = (beg[2] + k) * h_c[2]; aindex[ij + k] = (long) 1; /* assume outside the structure */ // loop over all atoms for (int a=0; a < natoms; a++) { double d = distance(atom_c + a*3, pos); if (d < vdWradius[a]) { aindex[ij + k] = (long) 0; /* this is inside */ a = natoms; } } } } } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/woperators.c000066400000000000000000000445341316441372200227310ustar00rootroot00000000000000/* This file (woperators.c) is a modified copy of operators.c * with added support for nonlocal operator weights. * The original copyright note of operators.c follows: * Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Copyright (C) 2005 CSC - IT Center for Science Ltd. * Please see the accompanying LICENSE file for further information. */ //*** The apply operator and some associate structors are imple- ***// //*** mented in two version: a original version and a speciel ***// //*** OpenMP version. By default the original version will ***// //*** be used, but it's possible to use the OpenMP version ***// //*** by compiling gpaw with the macro GPAW_OMP defined and ***// //*** and the compile/link option "-fopenmp". ***// //*** Author of the optimized OpenMP code: ***// //*** Mads R. B. Kristensen - madsbk@diku.dk ***// #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include #include #include "extensions.h" #include "bc.h" #include "mympi.h" #ifdef GPAW_ASYNC #define GPAW_ASYNC3 3 #define GPAW_ASYNC2 2 #else #define GPAW_ASYNC3 1 #define GPAW_ASYNC2 1 #endif typedef struct { PyObject_HEAD int nweights; const double** weights; bmgsstencil* stencils; boundary_conditions* bc; MPI_Request recvreq[2]; MPI_Request sendreq[2]; } WOperatorObject; static void WOperator_dealloc(WOperatorObject *self) { free(self->bc); for (int i = 0; i < self->nweights; i++) { free(self->stencils[i].coefs); free(self->stencils[i].offsets); } free(self->stencils); free(self->weights); PyObject_DEL(self); } static PyObject * WOperator_relax(WOperatorObject *self, PyObject *args) { int relax_method; PyArrayObject* func; PyArrayObject* source; int nrelax; double w = 1.0; if (!PyArg_ParseTuple(args, "iOOi|d", &relax_method, &func, &source, &nrelax, &w)) return NULL; const boundary_conditions* bc = self->bc; double* fun = DOUBLEP(func); const double* src = DOUBLEP(source); const double_complex* ph; const int* size2 = bc->size2; double* buf = (double*) GPAW_MALLOC(double, size2[0] * size2[1] * size2[2] * bc->ndouble); double* sendbuf = (double*) GPAW_MALLOC(double, bc->maxsend); double* recvbuf = (double*) GPAW_MALLOC(double, bc->maxrecv); const double** weights = (const double**) GPAW_MALLOC(double*, self->nweights); ph = 0; for (int n = 0; n < nrelax; n++ ) { for (int i = 0; i < 3; i++) { bc_unpack1(bc, fun, buf, i, self->recvreq, self->sendreq, recvbuf, sendbuf, ph + 2 * i, 0, 1); bc_unpack2(bc, buf, i, self->recvreq, self->sendreq, recvbuf, 1); } for (int iw = 0; iw < self->nweights; iw++) weights[iw] = self->weights[iw]; bmgs_wrelax(relax_method, self->nweights, self->stencils, weights, buf, fun, src, w); } free(weights); free(recvbuf); free(sendbuf); free(buf); Py_RETURN_NONE; } struct wapply_args{ int thread_id; WOperatorObject *self; int ng; int ng2; int nin; int nthds; int chunksize; int chunkinc; const double* in; double* out; int real; const double_complex* ph; }; //Plain worker void *wapply_worker(void *threadarg) { struct wapply_args *args = (struct wapply_args *) threadarg; boundary_conditions* bc = args->self->bc; MPI_Request recvreq[2]; MPI_Request sendreq[2]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; if (chunksize > args->chunksize) chunksize = args->chunksize; double* sendbuf = (double*) GPAW_MALLOC(double, bc->maxsend * args->chunksize); double* recvbuf = (double*) GPAW_MALLOC(double, bc->maxrecv * args->chunksize); double* buf = (double*) GPAW_MALLOC(double, args->ng2 * args->chunksize); const double** weights = (const double**) GPAW_MALLOC(double*, args->self->nweights); for (int n = nstart; n < nend; n += chunksize) { if (n + chunksize >= nend && chunksize > 1) chunksize = nend - n; const double* in = args->in + n * args->ng; double* out = args->out + n * args->ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf, i, recvreq, sendreq, recvbuf, sendbuf, args->ph + 2 * i, args->thread_id, chunksize); bc_unpack2(bc, buf, i, recvreq, sendreq, recvbuf, chunksize); } for (int m = 0; m < chunksize; m++) { for (int iw = 0; iw < args->self->nweights; iw++) weights[iw] = args->self->weights[iw] + m * args->ng2; if (args->real) bmgs_wfd(args->self->nweights, args->self->stencils, weights, buf + m * args->ng2, out + m * args->ng); else bmgs_wfdz(args->self->nweights, args->self->stencils, weights, (const double_complex*) (buf + m * args->ng2), (double_complex*) (out + m * args->ng)); } } free(weights); free(buf); free(recvbuf); free(sendbuf); return NULL; } //Async worker void *wapply_worker_cfd_async(void *threadarg) { struct wapply_args *args = (struct wapply_args *) threadarg; boundary_conditions* bc = args->self->bc; MPI_Request recvreq[2 * GPAW_ASYNC3]; MPI_Request sendreq[2 * GPAW_ASYNC3]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; if (chunksize > args->chunksize) chunksize = args->chunksize; double* sendbuf = (double*) GPAW_MALLOC(double, bc->maxsend * GPAW_ASYNC3 * args->chunksize); double* recvbuf = (double*) GPAW_MALLOC(double, bc->maxrecv * GPAW_ASYNC3 * args->chunksize); double* buf = (double*) GPAW_MALLOC(double, args->ng2 * args->chunksize); const double** weights = (const double**) GPAW_MALLOC(double*, args->self->nweights); for (int n = nstart; n < nend; n += chunksize) { if (n + chunksize >= nend && chunksize > 1) chunksize = nend - n; const double* in = args->in + n * args->ng; double* out = args->out + n * args->ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf, i, recvreq + i * 2, sendreq + i * 2, recvbuf + i * bc->maxrecv * chunksize, sendbuf + i * bc->maxsend * chunksize, args->ph + 2 * i, args->thread_id, chunksize); } for (int i = 0; i < 3; i++) { bc_unpack2(bc, buf, i, recvreq + i * 2, sendreq + i * 2, recvbuf + i * bc->maxrecv * chunksize, chunksize); } for (int m = 0; m < chunksize; m++) { for (int iw = 0; iw < args->self->nweights; iw++) weights[iw] = args->self->weights[iw] + m * args->ng2; if (args->real) bmgs_wfd(args->self->nweights, args->self->stencils, weights, buf + m * args->ng2, out + m * args->ng); else bmgs_wfdz(args->self->nweights, args->self->stencils, weights, (const double_complex*) (buf + m * args->ng2), (double_complex*) (out + m * args->ng)); } } free(weights); free(buf); free(recvbuf); free(sendbuf); return NULL; } //Double buffering async worker void *wapply_worker_cfd(void *threadarg) { struct wapply_args *args = (struct wapply_args *) threadarg; boundary_conditions* bc = args->self->bc; MPI_Request recvreq[2 * GPAW_ASYNC3 * GPAW_ASYNC2]; MPI_Request sendreq[2 * GPAW_ASYNC3 * GPAW_ASYNC2]; int chunksize = args->nin / args->nthds; if (!chunksize) chunksize = 1; int nstart = args->thread_id * chunksize; if (nstart >= args->nin) return NULL; int nend = nstart + chunksize; if (nend > args->nin) nend = args->nin; if (chunksize > args->chunksize) chunksize = args->chunksize; int chunk = args->chunkinc; if (chunk > chunksize) chunk = chunksize; double* sendbuf = (double*) GPAW_MALLOC(double, bc->maxsend * args->chunksize * GPAW_ASYNC3 * GPAW_ASYNC2); double* recvbuf = (double*) GPAW_MALLOC(double, bc->maxrecv * args->chunksize * GPAW_ASYNC3 * GPAW_ASYNC2); double* buf = (double*) GPAW_MALLOC(double, args->ng2 * args->chunksize * GPAW_ASYNC2); const double** weights = (const double**) GPAW_MALLOC(double*, args->self->nweights); int odd = 0; const double* in = args->in + nstart * args->ng; double* out; for (int i = 0; i < 3; i++) bc_unpack1(bc, in, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, sendbuf + odd * bc->maxsend * chunksize + i * bc->maxsend * chunksize * GPAW_ASYNC2, args->ph + 2 * i, args->thread_id, chunk); odd = odd ^ 1; int last_chunk = chunk; for (int n = nstart+chunk; n < nend; n += chunk) { last_chunk += args->chunkinc; if (last_chunk > chunksize) last_chunk = chunksize; if (n + last_chunk >= nend && last_chunk > 1) last_chunk = nend - n; in = args->in + n * args->ng; out = args->out + (n-chunk) * args->ng; for (int i = 0; i < 3; i++) { bc_unpack1(bc, in, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, sendbuf + odd * bc->maxsend * chunksize + i * bc->maxsend * chunksize * GPAW_ASYNC2, args->ph + 2 * i, args->thread_id, last_chunk); } odd = odd ^ 1; for (int i = 0; i < 3; i++) { bc_unpack2(bc, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, chunk); } for (int m = 0; m < chunk; m++) { for (int iw = 0; iw < args->self->nweights; iw++) weights[iw] = args->self->weights[iw] + m * args->ng2 + odd * args->ng2 * chunksize; if (args->real) bmgs_wfd(args->self->nweights, args->self->stencils, weights, buf + m * args->ng2 + odd * args->ng2 * chunksize, out + m * args->ng); else bmgs_wfdz(args->self->nweights, args->self->stencils, weights, (const double_complex*) (buf + m * args->ng2 + odd * args->ng2 * chunksize), (double_complex*) (out + m * args->ng)); } chunk = last_chunk; } odd = odd ^ 1; out = args->out + (nend-last_chunk) * args->ng; for (int i = 0; i < 3; i++) { bc_unpack2(bc, buf + odd * args->ng2 * chunksize, i, recvreq + odd * 2 + i * 4, sendreq + odd * 2 + i * 4, recvbuf + odd * bc->maxrecv * chunksize + i * bc->maxrecv * chunksize * GPAW_ASYNC2, last_chunk); } for (int m = 0; m < last_chunk; m++) { for (int iw = 0; iw < args->self->nweights; iw++) weights[iw] = args->self->weights[iw] + m * args->ng2 + odd * args->ng2 * chunksize; if (args->real) bmgs_wfd(args->self->nweights, args->self->stencils, weights, buf + m * args->ng2 + odd * args->ng2 * chunksize, out + m * args->ng); else bmgs_wfdz(args->self->nweights, args->self->stencils, weights, (const double_complex*) (buf + m * args->ng2 + odd * args->ng2 * chunksize), (double_complex*) (out + m * args->ng)); } free(weights); free(buf); free(recvbuf); free(sendbuf); return NULL; } static PyObject * WOperator_apply(WOperatorObject *self, PyObject *args) { PyArrayObject* input; PyArrayObject* output; PyArrayObject* phases = 0; if (!PyArg_ParseTuple(args, "OO|O", &input, &output, &phases)) return NULL; int nin = 1; if (PyArray_NDIM(input) == 4) nin = PyArray_DIMS(input)[0]; boundary_conditions* bc = self->bc; const int* size1 = bc->size1; const int* size2 = bc->size2; int ng = bc->ndouble * size1[0] * size1[1] * size1[2]; int ng2 = bc->ndouble * size2[0] * size2[1] * size2[2]; const double* in = DOUBLEP(input); double* out = DOUBLEP(output); const double_complex* ph; bool real = (PyArray_DESCR(input)->type_num == NPY_DOUBLE); if (real) ph = 0; else ph = COMPLEXP(phases); int chunksize = 1; if (getenv("GPAW_CHUNK_SIZE") != NULL) chunksize = atoi(getenv("GPAW_CHUNK_SIZE")); int chunkinc = chunksize; if (getenv("GPAW_CHUNK_INC") != NULL) chunkinc = atoi(getenv("GPAW_CHUNK_INC")); int nthds = 1; #ifdef GPAW_OMP if (getenv("OMP_NUM_THREADS") != NULL) nthds = atoi(getenv("OMP_NUM_THREADS")); #endif struct wapply_args *wargs = GPAW_MALLOC(struct wapply_args, nthds); pthread_t *thds = GPAW_MALLOC(pthread_t, nthds); for(int i=0; i < nthds; i++) { (wargs+i)->thread_id = i; (wargs+i)->nthds = nthds; (wargs+i)->chunksize = chunksize; (wargs+i)->chunkinc = chunkinc; (wargs+i)->self = self; (wargs+i)->ng = ng; (wargs+i)->ng2 = ng2; (wargs+i)->nin = nin; (wargs+i)->in = in; (wargs+i)->out = out; (wargs+i)->real = real; (wargs+i)->ph = ph; } #ifndef GPAW_ASYNC if (1) #else if (bc->cfd == 0) #endif { #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, wapply_worker, (void*) (wargs+i)); #endif wapply_worker(wargs); } else { #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_create(thds + i, NULL, wapply_worker_cfd, (void*) (wargs+i)); #endif wapply_worker_cfd(wargs); } #ifdef GPAW_OMP for(int i=1; i < nthds; i++) pthread_join(*(thds+i), NULL); #endif free(wargs); free(thds); Py_RETURN_NONE; } static PyObject * WOperator_get_diagonal_element(WOperatorObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; const double** weights = (const double**) GPAW_MALLOC(double*, self->nweights); for (int iw = 0; iw < self->nweights; iw++) weights[iw] = self->weights[iw]; const int n0 = self->stencils[0].n[0]; const int n1 = self->stencils[0].n[1]; const int n2 = self->stencils[0].n[2]; double d = 0.0; for (int i0 = 0; i0 < n0; i0++) { for (int i1 = 0; i1 < n1; i1++) { for (int i2 = 0; i2 < n2; i2++) { double coef = 0.0; for (int iw = 0; iw < self->nweights; iw++) { coef += weights[iw][0] * self->stencils[iw].coefs[0]; weights[iw]++; } if (coef < 0) coef = -coef; if (coef > d) d = coef; } } } free(weights); return Py_BuildValue("d", d); } static PyObject * WOperator_get_async_sizes(WOperatorObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; #ifdef GPAW_ASYNC return Py_BuildValue("(iii)", 1, GPAW_ASYNC2, GPAW_ASYNC3); #else return Py_BuildValue("(iii)", 0, GPAW_ASYNC2, GPAW_ASYNC3); #endif } static PyMethodDef WOperator_Methods[] = { {"apply", (PyCFunction)WOperator_apply, METH_VARARGS, NULL}, {"relax", (PyCFunction)WOperator_relax, METH_VARARGS, NULL}, {"get_diagonal_element", (PyCFunction)WOperator_get_diagonal_element, METH_VARARGS, NULL}, {"get_async_sizes", (PyCFunction)WOperator_get_async_sizes, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; PyTypeObject WOperatorType = { PyVarObject_HEAD_INIT(NULL, 0) "WOperator", sizeof(WOperatorObject), 0, (destructor)WOperator_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "FDW-operator object", 0, 0, 0, 0, 0, 0, WOperator_Methods }; PyObject* NewWOperatorObject(PyObject *obj, PyObject *args) { PyObject* coefs_list; PyArrayObject* coefs; PyObject* offsets_list; PyArrayObject* offsets; PyObject* weights_list; PyArrayObject* weights; PyArrayObject* size; PyArrayObject* neighbors; int real; PyObject* comm_obj; int cfd; int range; int nweights; if (!PyArg_ParseTuple(args, "iO!O!O!OiOiOi", &nweights, &PyList_Type, &weights_list, &PyList_Type, &coefs_list, &PyList_Type, &offsets_list, &size, &range, &neighbors, &real, &comm_obj, &cfd)) return NULL; WOperatorObject *self = PyObject_NEW(WOperatorObject, &WOperatorType); if (self == NULL) return NULL; self->stencils = (bmgsstencil*) GPAW_MALLOC(bmgsstencil, nweights); self->weights = (const double**) GPAW_MALLOC(double*, nweights); self->nweights = nweights; for (int iw = 0; iw < nweights; iw++) { coefs = (PyArrayObject*) PyList_GetItem(coefs_list, iw); offsets = (PyArrayObject*) PyList_GetItem(offsets_list, iw); weights = (PyArrayObject*) PyList_GetItem(weights_list, iw); self->stencils[iw] = bmgs_stencil(PyArray_DIMS(coefs)[0], DOUBLEP(coefs), LONGP(offsets), range, LONGP(size)); self->weights[iw] = DOUBLEP(weights); } const long (*nb)[2] = (const long (*)[2])LONGP(neighbors); const long padding[3][2] = {{range, range}, {range, range}, {range, range}}; MPI_Comm comm = MPI_COMM_NULL; if (comm_obj != Py_None) comm = ((MPIObject*)comm_obj)->comm; self->bc = bc_init(LONGP(size), padding, padding, nb, comm, real, cfd); return (PyObject*) self; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/000077500000000000000000000000001316441372200207605ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/ensemble_gga.c000066400000000000000000000030411316441372200235320ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #include #include "xc_gpaw.h" double beefvdw_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2) { double e = C1 / rs; *dedrs = -e / rs; double c = C2 * rs / n; c *= c; double s2 = a2 * c; /* Legendre polynomial basis expansion */ int parlen = par->nparameters-1; double p = par->parameters[0]; double tmp = p + s2; double x = 2.0 * s2 / tmp - 1.0; double dxds2 = 2.0 * p / pow(tmp,2); double Fx = 0.0; double dFxds2 = 0.0; int max_order = par->parameters[parlen+1]; double L[max_order+1]; double dL[max_order+1]; double coef; int m; int order; /* initializing */ L[0] = 1.0; L[1] = x; dL[0] = 0.0; dL[1] = 1.0; /* recursively building polynomia and their derivatives */ for(int i = 2; i < max_order+1; i++) { L[i] = 2.0 * x * L[i-1] - L[i-2] - (x * L[i-1] - L[i-2])/i; dL[i] = i * L[i-1] + x * dL[i-1]; } /* building enhancement factor Fx and derivative dFxds2 */ m = 0; for(int i = 0; i < max_order+1; i++) { order = par->parameters[2+m]; if(order == i) { coef = par->parameters[2+parlen+m]; Fx += coef * L[i]; dFxds2 += coef * dL[i] * dxds2; m += 1; } } double ds2drs = 8.0 * c * a2 / rs; *dedrs = *dedrs * Fx + e * dFxds2 * ds2drs; *deda2 = e * dFxds2 * c; e *= Fx; return e; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/libvdwxc.c000066400000000000000000000155311316441372200227530ustar00rootroot00000000000000#ifdef GPAW_WITH_LIBVDWXC #include "../extensions.h" #ifdef PARALLEL #include #include "../mympi.h" #include #else #include #endif // Our heinous plan is to abuse a numpy array so that it will contain a pointer to the vdwxc_data. // This is because PyCapsules are not there until Python 3.1/2.7. // This function takes an array and returns the pointer it so outrageously contains. vdwxc_data* unpack_vdwxc_pointer(PyObject* vdwxc_obj) { vdwxc_data* vdw = (vdwxc_data *)PyArray_DATA((PyArrayObject *)vdwxc_obj); return vdw; } PyObject* libvdwxc_has(PyObject* self, PyObject* args) { char* name; if(!PyArg_ParseTuple(args, "s", &name)) { return NULL; } int val; if(strcmp("mpi", name) == 0) { val = vdwxc_has_mpi(); } else if(strcmp("pfft", name) == 0) { val = vdwxc_has_pfft(); } else { return NULL; } PyObject* pyval = val ? Py_True : Py_False; Py_INCREF(pyval); return pyval; } PyObject* libvdwxc_create(PyObject* self, PyObject* args, PyObject* kwargs) { PyObject* vdwxc_obj; int vdwxc_code; int nspins; int Nx, Ny, Nz; double C00, C10, C20, C01, C11, C21, C02, C12, C22; if(!PyArg_ParseTuple(args, "Oii(iii)(ddddddddd)", &vdwxc_obj, &vdwxc_code, // functional identifier &nspins, &Nx, &Ny, &Nz, // number of grid points &C00, &C10, &C20, // 3x3 cell &C01, &C11,&C21, &C02, &C12, &C22)) { return NULL; } vdwxc_data vdw; if(nspins == 1) { vdw = vdwxc_new(vdwxc_code); } else if(nspins == 2) { #ifdef VDWXC_HAS_SPIN vdw = vdwxc_new_spin(vdwxc_code); #else PyErr_SetString(PyExc_ImportError, "this version of libvdwxc has no spin support"); return NULL; #endif } else { PyErr_SetString(PyExc_ValueError, "nspins must be 1 or 2"); return NULL; } vdwxc_data* vdwxc_ptr = unpack_vdwxc_pointer(vdwxc_obj); vdwxc_ptr[0] = vdw; vdwxc_set_unit_cell(vdw, Nx, Ny, Nz, C00, C10, C20, C01, C11, C21, C02, C12, C22); Py_RETURN_NONE; } PyObject* libvdwxc_init_serial(PyObject* self, PyObject* args) { PyObject* vdwxc_obj; if(!PyArg_ParseTuple(args, "O", &vdwxc_obj)) { return NULL; } vdwxc_data* vdw = unpack_vdwxc_pointer(vdwxc_obj); vdwxc_init_serial(*vdw); Py_RETURN_NONE; } PyObject* libvdwxc_calculate(PyObject* self, PyObject* args) { PyObject *vdwxc_obj; PyArrayObject *rho_obj, *sigma_obj, *dedn_obj, *dedsigma_obj; if(!PyArg_ParseTuple(args, "OOOOO", &vdwxc_obj, &rho_obj, &sigma_obj, &dedn_obj, &dedsigma_obj)) { return NULL; } vdwxc_data* vdw = unpack_vdwxc_pointer(vdwxc_obj); int nspins = PyArray_DIM(rho_obj, 0); double energy; if (nspins == 1) { double* rho_g = (double*)PyArray_DATA(rho_obj); double* sigma_g = (double*)PyArray_DATA(sigma_obj); double* dedn_g = (double*)PyArray_DATA(dedn_obj); double* dedsigma_g = (double*)PyArray_DATA(dedsigma_obj); energy = vdwxc_calculate(*vdw, rho_g, sigma_g, dedn_g, dedsigma_g); } else if (nspins == 2) { // We actually only need two sigmas/dedsigmas. // The third one came along because that's what usually happens, // but we could save it entirely. assert(PyArray_DIM(sigma_obj, 0) == 3); assert(PyArray_DIM(dedn_obj, 0) == 2); assert(PyArray_DIM(dedsigma_obj, 0) == 3); #ifdef VDWXC_HAS_SPIN energy = vdwxc_calculate_spin(*vdw, (double*)PyArray_GETPTR1(rho_obj, 0), (double*)PyArray_GETPTR1(rho_obj, 1), (double*)PyArray_GETPTR1(sigma_obj, 0), (double*)PyArray_GETPTR1(sigma_obj, 2), (double*)PyArray_GETPTR1(dedn_obj, 0), (double*)PyArray_GETPTR1(dedn_obj, 1), (double*)PyArray_GETPTR1(dedsigma_obj, 0), (double*)PyArray_GETPTR1(dedsigma_obj, 2)); #else return NULL; #endif } else { PyErr_SetString(PyExc_ValueError, "Expected 1 or 2 spins"); return NULL; } return Py_BuildValue("d", energy); } PyObject* libvdwxc_tostring(PyObject* self, PyObject* args) { PyObject *vdwxc_obj; if(!PyArg_ParseTuple(args, "O", &vdwxc_obj)) { return NULL; } vdwxc_data* vdw = unpack_vdwxc_pointer(vdwxc_obj); int maxlen = 80 * 200; // up to a few hundred lines char str[maxlen]; vdwxc_tostring(*vdw, maxlen, str); return Py_BuildValue("s", str); } PyObject* libvdwxc_free(PyObject* self, PyObject* args) { PyObject* vdwxc_obj; if(!PyArg_ParseTuple(args, "O", &vdwxc_obj)) { return NULL; } vdwxc_data* vdw = unpack_vdwxc_pointer(vdwxc_obj); vdwxc_finalize(vdw); Py_RETURN_NONE; } #ifdef PARALLEL MPI_Comm unpack_gpaw_comm(PyObject* gpaw_mpi_obj) { MPIObject* gpaw_comm = (MPIObject *)gpaw_mpi_obj; return gpaw_comm->comm; } #endif PyObject* error_parallel_support(void) { // Not a true import error, but pretty close. #ifndef PARALLEL PyErr_SetString(PyExc_ImportError, "GPAW not compiled in parallel"); #endif #ifndef VDWXC_HAS_MPI PyErr_SetString(PyExc_ImportError, "libvdwxc not compiled in parallel. Recompile libvdwxc with --with-mpi"); #endif return NULL; } PyObject* libvdwxc_init_mpi(PyObject* self, PyObject* args) { PyObject* vdwxc_obj; PyObject* gpaw_comm_obj; if(!PyArg_ParseTuple(args, "OO", &vdwxc_obj, &gpaw_comm_obj)) { return NULL; } if(!vdwxc_has_mpi()) { PyErr_SetString(PyExc_ImportError, "libvdwxc not compiled with MPI."); return NULL; } #if defined(PARALLEL) && defined(VDWXC_HAS_MPI) vdwxc_data* vdw = unpack_vdwxc_pointer(vdwxc_obj); MPI_Comm comm = unpack_gpaw_comm(gpaw_comm_obj); vdwxc_init_mpi(*vdw, comm); Py_RETURN_NONE; #else return error_parallel_support(); #endif } PyObject* libvdwxc_init_pfft(PyObject* self, PyObject* args) { PyObject* vdwxc_obj; PyObject* gpaw_comm_obj; int nproc1, nproc2; if(!PyArg_ParseTuple(args, "OOii", &vdwxc_obj, &gpaw_comm_obj, &nproc1, &nproc2)) { return NULL; } if(!vdwxc_has_pfft()) { PyErr_SetString(PyExc_ImportError, "libvdwxc not compiled with PFFT."); return NULL; } #if defined(PARALLEL) vdwxc_data* vdw = unpack_vdwxc_pointer(vdwxc_obj); MPI_Comm comm = unpack_gpaw_comm(gpaw_comm_obj); vdwxc_init_pfft(*vdw, comm, nproc1, nproc2); Py_RETURN_NONE; #else return error_parallel_support(); #endif } #endif // gpaw_with_libvdwxc gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/libxc.c000066400000000000000000000733351316441372200222400ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2008 CAMd * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include #include #include "xc_gpaw.h" #include "../extensions.h" typedef struct { PyObject_HEAD /* exchange-correlation energy second derivatives */ void (*get_fxc)(XC(func_type) *func, double point[7], double der[5][5]); XC(func_type) xc_functional; XC(func_type) x_functional; XC(func_type) c_functional; XC(func_type) *functional[2]; /* store either x&c, or just xc */ int nspin; /* must be common to x and c, so declared redundantly here */ } lxcXCFunctionalObject; void XC(lda_fxc_fd)(const XC(func_type) *p, const double *rho, double *fxc); /* a general call for an LDA functional - finite difference */ void get_fxc_fd_lda(XC(func_type) *func, double point[7], double der[5][5]) { double v2rho2[3], v2rhosigma[6], v2sigma2[6]; for(int i=0; i<3; i++) v2rho2[i] = 0.0; for(int i=0; i<6; i++){ v2rhosigma[i] = 0.0; v2sigma2[i] = 0.0; } XC(lda_fxc_fd)(func, point, v2rho2); der[0][0] = v2rho2[0]; der[0][1] = der[1][0] = v2rho2[1]; der[1][1] = v2rho2[2]; der[0][2] = der[2][0] = v2rhosigma[0]; der[0][3] = der[3][0] = v2rhosigma[1]; der[0][4] = der[4][0] = v2rhosigma[2]; der[1][2] = der[2][1] = v2rhosigma[3]; der[1][3] = der[3][1] = v2rhosigma[4]; der[1][4] = der[4][1] = v2rhosigma[5]; der[2][2] = v2sigma2[0]; der[2][3] = der[3][2] = v2sigma2[1]; der[2][4] = der[4][2] = v2sigma2[2]; der[3][3] = v2sigma2[3]; der[3][4] = der[4][3] = v2sigma2[4]; der[4][4] = v2sigma2[5]; } // finite difference calculation of second functional derivative // stolen from libxc/testsuite/xc-consistency.c double get_point(XC(func_type) *func, double point[7], double *e, double der[5], int which) { const int np = 1; switch(func->info->family) { case XC_FAMILY_LDA: XC(lda_exc_vxc)(func, np, &(point[0]), e, &(der[0])); break; case XC_FAMILY_GGA: case XC_FAMILY_HYB_GGA: XC(gga_exc_vxc)(func, np, &(point[0]), &(point[2]), e, &(der[0]), &(der[2])); break; } if(which == 0) return (*e)*(point[0] + point[1]); else return der[which-1]; } void first_derivative(XC(func_type) *func, double point[7], double der[5], int which, int nspin) { int i; for(i=0; i<5; i++){ const double delta = 5e-10; double dd, p[5], v[5]; int j; if(nspin==1 && (i!=0 && i!=2)){ der[i] = 0.0; continue; } dd = point[i]*delta; if(dd < delta) dd = delta; for(j=0; j<5; j++) p[j] = point[j]; if(point[i]>=3.0*dd){ /* centered difference */ double e, em1, em2, ep1, ep2; p[i] = point[i] + dd; ep1 = get_point(func, p, &e, v, which); p[i] = point[i] + 2*dd; ep2 = get_point(func, p, &e, v, which); p[i] = point[i] - dd; /* backward point */ em1 = get_point(func, p, &e, v, which); p[i] = point[i] - 2*dd; /* backward point */ em2 = get_point(func, p, &e, v, which); der[i] = 1.0/2.0*(ep1 - em1); der[i] += 1.0/12.0*(em2 - 2*em1 + 2*ep1 - ep2); der[i] /= dd; }else{ /* we use a 5 point forward difference */ double e, e1, e2, e3, e4, e5; p[i] = point[i]; e1 = get_point(func, p, &e, v, which); p[i] = point[i] + dd; e2 = get_point(func, p, &e, v, which); p[i] = point[i] + 2.0*dd; e3 = get_point(func, p, &e, v, which); p[i] = point[i] + 3.0*dd; e4 = get_point(func, p, &e, v, which); p[i] = point[i] + 4.0*dd; e5 = get_point(func, p, &e, v, which); der[i] = (-e1 + e2); der[i] -= 1.0/2.0*( e1 - 2*e2 + e3); der[i] += 1.0/3.0*(-e1 + 3*e2 - 3*e3 + e4); der[i] -= 1.0/4.0*( e1 - 4*e2 + 6*e3 - 4*e4 + e5); der[i] /= dd; } } } void first_derivative_spinpaired(XC(func_type) *func, double point[7], double der[5], int which) { first_derivative(func, point, der, which, XC_UNPOLARIZED); } void first_derivative_spinpolarized(XC(func_type) *func, double point[7], double der[5], int which) { first_derivative(func, point, der, which, XC_POLARIZED); } void second_derivatives_spinpaired(XC(func_type) *func, double point[7], double der[5][5]) { int i; for(i=0; i<5; i++){ first_derivative_spinpaired(func, point, der[i], i+1); } } void second_derivatives_spinpolarized(XC(func_type) *func, double point[7], double der[5][5]) { int i; for(i=0; i<5; i++){ first_derivative_spinpolarized(func, point, der[i], i+1); } } /* a general call for a functional - finite difference */ void get_fxc_fd_spinpaired(XC(func_type) *func, double point[7], double der[5][5]) { second_derivatives_spinpaired(func, point, der); } /* a general call for a functional - finite difference */ void get_fxc_fd_spinpolarized(XC(func_type) *func, double point[7], double der[5][5]) { second_derivatives_spinpolarized(func, point, der); } static void lxcXCFunctional_dealloc(lxcXCFunctionalObject *self) { for (int i=0; i<2; i++) if (self->functional[i] != NULL) xc_func_end(self->functional[i]); PyObject_DEL(self); } static PyObject* lxcXCFunctional_is_gga(lxcXCFunctionalObject *self, PyObject *args) { int success = 0; /* assume functional is not GGA */ // check family of most-complex functional if (self->functional[0]->info->family == XC_FAMILY_GGA || self->functional[0]->info->family == XC_FAMILY_HYB_GGA) success = XC_FAMILY_GGA; return Py_BuildValue("i", success); } static PyObject* lxcXCFunctional_is_mgga(lxcXCFunctionalObject *self, PyObject *args) { int success = 0; /* assume functional is not MGGA */ // check family of most-complex functional if (self->functional[0]->info->family == XC_FAMILY_MGGA) success = XC_FAMILY_MGGA; return Py_BuildValue("i", success); } static PyObject* lxcXCFunctional_CalculateFXC_FD_SpinPaired(lxcXCFunctionalObject *self, PyObject *args) { PyArrayObject* n_array; /* rho */ PyArrayObject* v2rho2_array; /* d2E/drho2 */ PyArrayObject* a2_array = 0; /* |nabla rho|^2*/ PyArrayObject* v2rhosigma_array = 0; /* d2E/drhod|nabla rho|^2 */ PyArrayObject* v2sigma2_array = 0; /* d2E/drhod|nabla rho|^2 */ if (!PyArg_ParseTuple(args, "OO|OOO", &n_array, &v2rho2_array, /* object | optional objects*/ &a2_array, &v2rhosigma_array, &v2sigma2_array)) return NULL; /* find nspin */ int nspin = self->nspin; assert(nspin == XC_UNPOLARIZED); /* we are spinpaired */ assert (self->functional[0]->info->family != XC_FAMILY_MGGA); int ng = PyArray_DIMS(n_array)[0]; /* number of grid points */ const double* n_g = DOUBLEP(n_array); /* density on the grid */ double* v2rho2_g = DOUBLEP(v2rho2_array); /* v on the grid */ const double* a2_g = 0; /* a2 on the grid */ double* v2rhosigma_g = 0; /* d2Ednda2 on the grid */ double* v2sigma2_g = 0; /* d2Eda2da2 on the grid */ if ((self->functional[0]->info->family == XC_FAMILY_GGA) || (self->functional[0]->info->family == XC_FAMILY_HYB_GGA)) { a2_g = DOUBLEP(a2_array); v2rhosigma_g = DOUBLEP(v2rhosigma_array); v2sigma2_g = DOUBLEP(v2sigma2_array); } self->get_fxc = get_fxc_fd_spinpaired; /* ################################################################ */ for (int g = 0; g < ng; g++) { double n = n_g[g]; if (n < NMIN) n = NMIN; double a2 = 0.0; /* initialize for lda */ if ((self->functional[0]->info->family == XC_FAMILY_GGA) || (self->functional[0]->info->family == XC_FAMILY_HYB_GGA)) { a2 = a2_g[g]; } double point[7]; /* generalized point */ // from http://www.tddft.org/programs/octopus/wiki/index.php/Libxc:manual // rhoa rhob sigmaaa sigmaab sigmabb taua taub // \sigma[0] = \nabla n_\uparrow \cdot \nabla n_\uparrow \qquad // \sigma[1] = \nabla n_\uparrow \cdot \nabla n_\downarrow \qquad // \sigma[2] = \nabla n_\downarrow \cdot \nabla n_\downarrow \qquad double derivative[5][5]; /* generalized derivative */ double v2rho2[3]; double v2rhosigma[6]; double v2sigma2[6]; // one that uses this: please add description of spin derivative order notation // (see c/libxc/src/gga_perdew.c) MDTMP for(int i=0; i<3; i++) v2rho2[i] = 0.0; for(int i=0; i<6; i++){ v2rhosigma[i] = 0.0; v2sigma2[i] = 0.0; } for(int j=0; j<7; j++) { point[j] = 0.0; } for(int i=0; i<5; i++) { for(int j=0; j<5; j++) { derivative[i][j] = 0.0; } } point[0] = n; /* -> rho */ point[2] = a2; /* -> sigma */ for (int i=0; i<2; i++) { XC(func_type) *func = self->functional[i]; if (func == NULL) continue; self->get_fxc(func, point, derivative); v2rho2[0] = derivative[0][0]; v2rho2[1] = derivative[0][1]; // XC_POLARIZED v2rho2[2] = derivative[1][1]; // XC_POLARIZED v2rhosigma[0] = derivative[0][2]; v2rhosigma[1] = derivative[0][3]; // XC_POLARIZED v2rhosigma[2] = derivative[0][4]; // XC_POLARIZED v2rhosigma[3] = derivative[1][2]; // XC_POLARIZED v2rhosigma[4] = derivative[1][3]; // XC_POLARIZED v2rhosigma[5] = derivative[1][4]; // XC_POLARIZED v2sigma2[0] = derivative[2][2]; /* aa_aa */ v2sigma2[1] = derivative[2][3]; // XC_POLARIZED /* aa_ab */ v2sigma2[2] = derivative[2][4]; // XC_POLARIZED /* aa_bb */ v2sigma2[3] = derivative[3][3]; // XC_POLARIZED /* ab_ab */ v2sigma2[4] = derivative[3][4]; // XC_POLARIZED /* ab_bb */ v2sigma2[5] = derivative[4][4]; // XC_POLARIZED /* bb_bb */ switch(func->info->family) { case XC_FAMILY_HYB_GGA: case XC_FAMILY_GGA: v2rhosigma_g[g] += v2rhosigma[0]; v2sigma2_g[g] += v2sigma2[0]; // don't break here since we need LDA values as well case XC_FAMILY_LDA: v2rho2_g[g] += v2rho2[0]; } } } Py_RETURN_NONE; } // Below are changes made by cpo@slac.stanford.edu for libxc 1.2.0 // which allows passing of arrays of points to libxc routines. // The fundamental design idea (to try to minimize code-duplication) is that // all libxc routines have input/output arrays that get processed in // common ways with three special exceptions: n_sg, e_g, dedn_sg. The // struct "xcptrlist" is used to keep track of these pointers. // Two libxc features prevent us from using a straightforward // interface: // 1) libxc calls memset(0) on output arrays, preventing us // from adding x/c contributions "in place" without scratch arrays // 2) for spin-polarized calculations libxc wants spin indices to be // dense in memory, whereas GPAW probably loops over grid indices // more often, so we want to keep those dense in memory. // I asked Miguel Marques to remove the memset, and to add a "stride" // argument to libxc routines to address the above. He says he will // consider it in the future. In the meantime we have to "block" // over gridpoints using some scratch memory. // What is supported: // - combined xc-functional mode // - separate x,c functionals. // - separate x,c can have differing complexities (e.g. one GGA, one LDA) // - "exc_vxc" style routines for LDA/GGA/MGGA both unpolarized/polarized // - "fxc" style routines for LDA/GGA both unpolarized/polarized // To support a libxc routine other than exc_vxc/fxc one needs to // copy a "Calculate" routine and change the pointer list setup, and // associated libxc function calls. // number of gridpoints we will "block" over when doing xc calculation #define BLOCKSIZE 1024 // this is the maximum number of BLOCKSIZE arrays that will be put // into scratch (depends on the "spinsize" values for the various // arrays. currently determined by fxc, which has input spinsizes // of 2+3 and output spinsizes of 3+6+6 (totalling 20). #define MAXARRAYS 20 #define LIBXCSCRATCHSIZE (BLOCKSIZE*MAXARRAYS) static double *scratch=NULL; // we don't use lapl, but libxc needs space for them. static double *scratch_lapl=NULL; static double *scratch_vlapl=NULL; // special cases for array behaviors: // flag to indicate we need to add to existing values for dedn_sg #define DEDN_SG 1 // flag to indicate we need to apply NMIN cutoff to n_sg #define N_SG 2 // flag to indicate we need to multiply by density for e_g #define E_G 4 typedef struct xcptr { double *p; int special; int spinsize; } xcptr; #define MAXPTR 10 typedef struct xcptrlist { int num; xcptr p[MAXPTR]; } xcptrlist; typedef struct xcinfo { int nspin; bool spinpolarized; int ng; } xcinfo; // these 3 functions make the spin index closest in memory ("gather") or the // farthest apart in memory ("scatter"). "scatteradd" adds to previous results. static void gather(const double* src, double* dst, int np, int stride, int nspins) { const double *dstend = dst+np*nspins; const double *srcend = src+nspins*stride; do { const double *s = src; do { *dst++ = *s; s+=stride; } while (snum; i++) { inblocklist[i] = next; next+=blocksize*inlist->p[i].spinsize; } for (int i=0; inum; i++) { outblocklist[i] = next; next+=blocksize*outlist->p[i].spinsize; } // check that we fit in the scratch space // if we don't, then we need to increase MAXARRAY assert((next - scratch) <= LIBXCSCRATCHSIZE); } // copy a piece of the full data into the block for processing by libxc static void data2block(const xcinfo *info, const xcptrlist *inlist, double *inblocklist[], int blocksize) { // copy data into the block, taking into account special cases for (int i=0; inum; i++) { double *ptr = inlist->p[i].p; double* block = inblocklist[i]; if (info->spinpolarized) { gather(ptr,block,blocksize,info->ng,inlist->p[i].spinsize); if (inlist->p[i].special&N_SG) for (int i=0; ip[i].special&N_SG) for (int i=0; inum; i++) { double *ptr = outlist->p[i].p; double* block = outblocklist[i]; if (outlist->p[i].special&E_G) { if (info->spinpolarized) { for (int i=0; ip[i].special&DEDN_SG) { if (info->spinpolarized) { scatteradd(block,ptr,blocksize,info->ng,outlist->p[i].spinsize); // need to add to pre-existing values } else { for (int i=0; ispinpolarized) { scatter(block,ptr,blocksize,info->ng,outlist->p[i].spinsize); } else { memcpy(ptr,block,blocksize*sizeof(double)); } } } } // copy the data from the block back into its final resting place, but add to previous results static void block2dataadd(const xcinfo *info, double *outblocklist[], const xcptrlist *outlist, const double *n_sg, int blocksize, int noutcopy) { for (int i=0; ip[i].p; double* block = outblocklist[i]; if (outlist->p[i].special&E_G) { if (info->spinpolarized) { for (int i=0; ispinpolarized) { scatteradd(block,ptr,blocksize,info->ng,outlist->p[i].spinsize); } else { for (int i=0; inspin; info.spinpolarized = (info.nspin==2); info.ng = PyArray_DIMS(py_e_g)[0]; xcptrlist inlist,outlist; inlist.num=0; outlist.num=0; int blocksize = BLOCKSIZE; int remaining = info.ng; // setup pointers using most complex functional switch(self->functional[0]->info->family) { case XC_FAMILY_MGGA: inlist.p[2].p = DOUBLEP(py_tau_sg); inlist.p[2].special = 0; inlist.p[2].spinsize = 2; inlist.num++; outlist.p[3].p = DOUBLEP(py_dedtau_sg); outlist.p[3].special = 0; outlist.p[3].spinsize = 2; outlist.num++; // don't break here since MGGA also needs GGA ptrs case XC_FAMILY_HYB_GGA: case XC_FAMILY_GGA: inlist.p[1].p = DOUBLEP(py_sigma_xg); inlist.p[1].special = 0; inlist.p[1].spinsize = 3; inlist.num++; outlist.p[2].p = DOUBLEP(py_dedsigma_xg); outlist.p[2].special = 0; outlist.p[2].spinsize = 3; outlist.num++; // don't break here since GGA also needs LDA ptrs case XC_FAMILY_LDA: inlist.p[0].p = DOUBLEP(py_n_sg); inlist.p[0].special = N_SG; inlist.p[0].spinsize = 2; inlist.num += 1; outlist.p[0].p = DOUBLEP(py_e_g); outlist.p[0].special = E_G; outlist.p[0].spinsize = 1; outlist.p[1].p = DOUBLEP(py_dedn_sg); outlist.p[1].special = DEDN_SG; outlist.p[1].spinsize = 2; outlist.num += 2; } assert(inlist.num < MAXPTR); assert(outlist.num < MAXPTR); double *inblock[MAXPTR]; double *outblock[MAXPTR]; setupblockptrs(&info, &inlist, &outlist, &inblock[0], &outblock[0], blocksize); do { blocksize = blocksizefunctional[i] == NULL) continue; XC(func_type) *func = self->functional[i]; int noutcopy=0; switch(func->info->family) { case XC_FAMILY_LDA: xc_lda_exc_vxc(func, blocksize, n_sg, e_g, dedn_sg); noutcopy = 2; // potentially decrease the size for block2dataadd if second functional less complex. break; case XC_FAMILY_HYB_GGA: case XC_FAMILY_GGA: xc_gga_exc_vxc(func, blocksize, n_sg, sigma_xg, e_g, dedn_sg, dedsigma_xg); noutcopy = 3; // potentially decrease the size for block2dataadd if second functional less complex. break; case XC_FAMILY_MGGA: xc_mgga_exc_vxc(func, blocksize, n_sg, sigma_xg, scratch_lapl, tau_sg, e_g, dedn_sg, dedsigma_xg, scratch_vlapl, dedtau_sg); noutcopy = 4; // potentially decrease the size for block2dataadd if second functional less complex. break; } // if we have more than 1 functional, add results // canonical example: adding "x" results to "c" if (i==0) block2data(&info, &outblock[0], &outlist, n_sg, blocksize); else block2dataadd(&info, &outblock[0], &outlist, n_sg, blocksize, noutcopy); } for (int i=0; i0); Py_RETURN_NONE; } static PyObject* lxcXCFunctional_CalculateFXC(lxcXCFunctionalObject *self, PyObject *args) { PyArrayObject* py_n_sg=NULL; PyArrayObject* py_v2rho2_xg=NULL; PyArrayObject* py_sigma_xg=NULL; PyArrayObject* py_v2rhosigma_yg=NULL; PyArrayObject* py_v2sigma2_yg=NULL; if (!PyArg_ParseTuple(args, "OO|OOO", &py_n_sg, &py_v2rho2_xg, &py_sigma_xg, &py_v2rhosigma_yg, &py_v2sigma2_yg)) return NULL; xcinfo info; info.nspin = self->nspin; info.spinpolarized = (info.nspin==2); info.ng = (info.spinpolarized) ? PyArray_DIMS(py_n_sg)[0]/2 : PyArray_DIMS(py_n_sg)[0]; xcptrlist inlist,outlist; inlist.num=0; outlist.num=0; int blocksize = BLOCKSIZE; int remaining = info.ng; // setup pointers using most complex functional switch(self->functional[0]->info->family) { case XC_FAMILY_MGGA: // not supported assert(self->functional[0]->info->family != XC_FAMILY_MGGA); // don't break here since MGGA also needs GGA ptrs case XC_FAMILY_HYB_GGA: case XC_FAMILY_GGA: inlist.p[1].p = DOUBLEP(py_sigma_xg); inlist.p[1].special = 0; inlist.p[1].spinsize = 3; inlist.num++; outlist.p[1].p = DOUBLEP(py_v2rhosigma_yg); outlist.p[1].special = 0; outlist.p[1].spinsize = 6; outlist.p[2].p = DOUBLEP(py_v2sigma2_yg); outlist.p[2].special = 0; outlist.p[2].spinsize = 6; outlist.num+=2; // don't break here since GGA also needs LDA ptrs case XC_FAMILY_LDA: inlist.p[0].p = DOUBLEP(py_n_sg); inlist.p[0].special = N_SG; inlist.p[0].spinsize = 2; inlist.num += 1; outlist.p[0].p = DOUBLEP(py_v2rho2_xg); outlist.p[0].special = 0; outlist.p[0].spinsize = 3; outlist.num++; } assert(inlist.num < MAXPTR); assert(outlist.num < MAXPTR); double *inblock[MAXPTR]; double *outblock[MAXPTR]; setupblockptrs(&info, &inlist, &outlist, &inblock[0], &outblock[0], blocksize); do { blocksize = blocksizefunctional[i] == NULL) continue; XC(func_type) *func = self->functional[i]; int noutcopy=0; switch(func->info->family) { case XC_FAMILY_LDA: xc_lda_fxc(func, blocksize, n_sg, v2rho2); noutcopy = 1; // potentially decrease the size for block2dataadd if second functional less complex. break; case XC_FAMILY_HYB_GGA: case XC_FAMILY_GGA: xc_gga_fxc(func, blocksize, n_sg, sigma_xg, v2rho2, v2rhosigma, v2sigma2); noutcopy = 3; // potentially decrease the size for block2dataadd if second functional less complex. break; case XC_FAMILY_MGGA: // not supported by GPAW yet, so crash assert (func->info->family!=XC_FAMILY_MGGA); break; } // if we have more than 1 functional, add results // canonical example: adding "x" results to "c" if (i==0) block2data(&info, &outblock[0], &outlist, n_sg, blocksize); else block2dataadd(&info, &outblock[0], &outlist, n_sg, blocksize, noutcopy); } for (int i=0; i0); Py_RETURN_NONE; } static PyObject* lxcXCFunctional_tb09(lxcXCFunctionalObject *self, PyObject *args) { double c; PyArrayObject* n_g; PyArrayObject* sigma_g; PyArrayObject* lapl_g; PyArrayObject* tau_g; PyArrayObject* v_g; PyArrayObject* vx_g; // for vsigma, vtau, vlapl if (!PyArg_ParseTuple(args, "dOOOOOO", &c, &n_g, &sigma_g, &lapl_g, &tau_g, &v_g, &vx_g)) return NULL; xc_mgga_x_tb09_set_params(self->functional[0], c); xc_mgga_vxc(self->functional[0], PyArray_DIM(n_g, 0), PyArray_DATA(n_g), PyArray_DATA(sigma_g), PyArray_DATA(lapl_g), PyArray_DATA(tau_g), PyArray_DATA(v_g), PyArray_DATA(vx_g), PyArray_DATA(vx_g), PyArray_DATA(vx_g)); Py_RETURN_NONE; } static PyMethodDef lxcXCFunctional_Methods[] = { {"is_gga", (PyCFunction)lxcXCFunctional_is_gga, METH_VARARGS, 0}, {"is_mgga", (PyCFunction)lxcXCFunctional_is_mgga, METH_VARARGS, 0}, {"calculate_fxc_fd_spinpaired", (PyCFunction)lxcXCFunctional_CalculateFXC_FD_SpinPaired, METH_VARARGS, 0}, {"calculate", (PyCFunction)lxcXCFunctional_Calculate, METH_VARARGS, 0}, {"calculate_fxc_spinpaired", (PyCFunction)lxcXCFunctional_CalculateFXC, METH_VARARGS, 0}, {"tb09", (PyCFunction)lxcXCFunctional_tb09, METH_VARARGS, 0}, {NULL, NULL, 0, NULL} }; PyTypeObject lxcXCFunctionalType = { PyVarObject_HEAD_INIT(NULL, 0) "lxcXCFunctional", sizeof(lxcXCFunctionalObject), 0, (destructor)lxcXCFunctional_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "LibXCFunctional object", 0, 0, 0, 0, 0, 0, lxcXCFunctional_Methods }; PyObject * NewlxcXCFunctionalObject(PyObject *obj, PyObject *args) { int xc, x, c; /* functionals identifier number */ int nspin; /* XC_UNPOLARIZED or XC_POLARIZED */ if (!scratch) { scratch = (double*)malloc(LIBXCSCRATCHSIZE*sizeof(double)); const int laplsize = BLOCKSIZE*sizeof(double)*2; scratch_lapl = (double*)malloc(laplsize); memset(scratch_lapl,0,laplsize); scratch_vlapl = (double*)malloc(laplsize); } if (!PyArg_ParseTuple(args, "iiii", &xc, &x, &c, &nspin)) { return NULL; } /* checking if the numbers xc x c are valid is done at python level */ lxcXCFunctionalObject *self = PyObject_NEW(lxcXCFunctionalObject, &lxcXCFunctionalType); if (self == NULL){ return NULL; } assert(nspin==XC_UNPOLARIZED || nspin==XC_POLARIZED); self->nspin = nspin; /* must be common to x and c, so declared redundantly */ int number,family,familyx,familyc; if (xc != -1) { xc_family_from_id(xc,&family,&number); assert (family != XC_FAMILY_UNKNOWN); XC(func_init)(&self->xc_functional, xc, nspin); self->functional[0]=&self->xc_functional; self->functional[1]=NULL; } else { assert (x!=-1 || c!=-1); if (x!=-1) { xc_family_from_id(x,&familyx,&number); assert (familyx != XC_FAMILY_UNKNOWN); XC(func_init)(&self->x_functional, x, nspin); } if (c!=-1) { xc_family_from_id(c,&familyc,&number); assert (familyc != XC_FAMILY_UNKNOWN); XC(func_init)(&self->c_functional, c, nspin); } if (x!=-1 && c!=-1) { /* put most complex functional first */ /* important for later loops over functionals */ if (familyx == XC_FAMILY_MGGA) { self->functional[0]=&self->x_functional; self->functional[1]=&self->c_functional; } else if (familyc == XC_FAMILY_MGGA) { self->functional[0]=&self->c_functional; self->functional[1]=&self->x_functional; } else if (familyx == XC_FAMILY_GGA || familyx == XC_FAMILY_HYB_GGA) { self->functional[0]=&self->x_functional; self->functional[1]=&self->c_functional; } else { // either c is GGA, or both are LDA (so don't care) self->functional[0]=&self->c_functional; self->functional[1]=&self->x_functional; } } else if (x!=-1) { self->functional[0]=&self->x_functional; self->functional[1]=NULL; } else if (c!=-1) { self->functional[0]=&self->c_functional; self->functional[1]=NULL; } } return (PyObject*)self; } PyObject * lxcXCFuncNum(PyObject *obj, PyObject *args) { char *funcname; if (!PyArg_ParseTuple(args, "s", &funcname)) { return NULL; } int num = XC(functional_get_number)(funcname); if (num != -1) return Py_BuildValue("i",num); else Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/m06l.c000066400000000000000000000563631316441372200217170ustar00rootroot00000000000000/************************************************************************ Implements Zhao, Truhlar Meta-gga M06-Local Correlation part ************************************************************************/ #include #include #include #include "xc_mgga.h" typedef struct m06l_params { common_params common; // needs to be at the beginning of every functional_params XC(func_type) *c_aux; XC(func_type) *x_aux; } m06l_params; /* derivatives of x and z with respect to rho, grho and tau*/ static void c_m06l_zx(double x, double z, double rho, double tau, double *dxdd, double *dxdgd, double *dzdd, double *dzdtau) { *dxdd = -8./3. * x * 1/rho; *dxdgd = 1./pow(rho,8./3.); *dzdd = -5./3. * 2 * tau/pow(rho, 8./3.); *dzdtau = 2./pow(rho, 5./3.); } /* Get g for Eq. (13)*/ static void c_m06_13(double *x, double *rho, double *g_ab, double *dg_abdd, double *dg_abdgd) { /*define the C_ab,i */ static double c_ab0= 0.6042374, c_ab1= 177.6783, c_ab2= -251.3252, c_ab3=76.35173, c_ab4=-12.55699; double gammaCab = 0.0031 ; double x_ab, a; double dg_abdx, dxdd_a, dxdgd_a, dzdd_a, dzdtau_a; double dxdd_b, dxdgd_b, dzdd_b, dzdtau_b; /*x = x_ba^2 = x_a^2+x_b^2*/ x_ab = x[0] + x[1]; a= (gammaCab*x_ab/(1+gammaCab*x_ab)); *g_ab = c_ab0*pow(a,0)+ c_ab1*pow(a,1)+ c_ab2*pow(a,2)+c_ab3*pow(a,3)+c_ab4*pow(a,4); double dadx = gammaCab/pow(1+gammaCab*x_ab, 2.); dg_abdx = (0.0*c_ab0*pow(a,-1)+ 1.*c_ab1*pow(a,0)+ 2.*c_ab2*pow(a,1)+3.*c_ab3*pow(a,2)+4.*c_ab4*pow(a,3))*dadx; c_m06l_zx(x[0], 0.0, rho[0], 0.0, &dxdd_a, &dxdgd_a, &dzdd_a, &dzdtau_a); c_m06l_zx(x[1], 0.0, rho[1], 0.0, &dxdd_b, &dxdgd_b, &dzdd_b, &dzdtau_b); dg_abdd[0] = dg_abdx*dxdd_a; dg_abdd[1] = dg_abdx*dxdd_b; dg_abdgd[0] = dg_abdx*dxdgd_a; dg_abdgd[1] = 0.0; dg_abdgd[2] = dg_abdx*dxdgd_b; } /* Get g for Eq. (15)*/ static void c_m06_15(double x, double rho, double *g_ss, double *dg_ssdd, double *dg_ssdgd) { /*define the C_ss,i */ static double c_ss0=0.5349466, c_ss1=0.5396620, c_ss2=-31.61217, c_ss3= 51.49592, c_ss4=-29.19613; double gammaCss = 0.06 ; double a; double dg_ssdx, dxdd, dxdgd, dzdd, dzdtau; /*x = x_a^2 */ a= (gammaCss*x/(1+gammaCss*x)); *g_ss = c_ss0*pow(a,0)+ c_ss1*pow(a,1)+ c_ss2*pow(a,2)+c_ss3*pow(a,3)+c_ss4*pow(a,4); double dadx = gammaCss/pow(1+gammaCss*x, 2.); dg_ssdx = (0.0*c_ss0*pow(a,-1)+ 1.*c_ss1*pow(a,0)+ 2.*c_ss2*pow(a,1)+3.*c_ss3*pow(a,2)+4.*c_ss4*pow(a,3))*dadx; c_m06l_zx(x, 0.0, rho, 0.0, &dxdd, &dxdgd, &dzdd, &dzdtau); *dg_ssdd = dg_ssdx*dxdd; *dg_ssdgd = dg_ssdx*dxdgd; /*printf("g_ss %19.12f\n", *g_ss);*/ } /* Get h_ab for Eq. (12)*/ static void c_m06l_hab(double *x, double *z, double *rho, double *tau, double *h_ab, double *dh_abdd, double *dh_abdgd, double *dh_abdtau) { /* define the d_ab,i for Eq. (12)*/ static double d_ab0= 0.3957626, d_ab1= -0.5614546, d_ab2= 0.01403963, d_ab3= 0.0009831442, d_ab4= -0.003577176; double alpha_ab = 0.00304966; double hab1, dhabdd1[2], dhabdgd1[3], dhabdtau1[2]; double x_ab, z_ab, gamma, xgamma, zgamma; double dgammadx, dgammadz; double dgammadd_a, dgammadgd_a, dgammadtau_a; double dgammadd_b, dgammadgd_b, dgammadtau_b; double dxdd_a, dxdgd_a, dzdd_a, dzdtau_a; double dxdd_b, dxdgd_b, dzdd_b, dzdtau_b; x_ab = x[0] + x[1]; z_ab = z[0] + z[1]; gamma = 1 + alpha_ab*(x_ab + z_ab); { /* derivatives of gamma with respect to x and z*/ dgammadx = alpha_ab; dgammadz = alpha_ab; } c_m06l_zx(x[0], z[0], rho[0], tau[0], &dxdd_a, &dxdgd_a, &dzdd_a, &dzdtau_a); c_m06l_zx(x[1], z[1], rho[1], tau[1], &dxdd_b, &dxdgd_b, &dzdd_b, &dzdtau_b); { /*derivatives of gamma with respect to density, gradient and kietic energy*/ dgammadd_a = dgammadx * dxdd_a + dgammadz * dzdd_a; dgammadd_b = dgammadx * dxdd_b + dgammadz * dzdd_b; dgammadgd_a = dgammadx * dxdgd_a; dgammadgd_b = dgammadx * dxdgd_b; dgammadtau_a = dgammadz * dzdtau_a; dgammadtau_b = dgammadz * dzdtau_b; } xgamma = x_ab/gamma; zgamma = z_ab/gamma; /* we initialize h and collect the terms*/ hab1 = 0.0; dhabdd1[0] = dhabdd1[1] = 0.0; dhabdgd1[0] = dhabdgd1[1] = dhabdgd1[2] = 0.0; dhabdtau1[0] = dhabdtau1[1] = 0.0; { /* first term */ double g2=pow(gamma,2.); hab1 += d_ab0/gamma; dhabdd1[0] += -d_ab0*dgammadd_a/g2; dhabdd1[1] += -d_ab0*dgammadd_b/g2; dhabdgd1[0] += -d_ab0*dgammadgd_a/g2; dhabdgd1[1] += 0.0; dhabdgd1[2] += -d_ab0*dgammadgd_b/g2; dhabdtau1[0] += -d_ab0*dgammadtau_a/g2 ; dhabdtau1[1] += -d_ab0*dgammadtau_b/g2 ; } { /* second term */ double g3=pow(gamma,3.); hab1 += (d_ab1*xgamma + d_ab2*zgamma)/gamma; dhabdd1[0] += (gamma*(d_ab1*dxdd_a+d_ab2*dzdd_a)-2*dgammadd_a*(d_ab1*x_ab+d_ab2*z_ab))/g3; dhabdd1[1] += (gamma*(d_ab1*dxdd_b+d_ab2*dzdd_b)-2*dgammadd_b*(d_ab1*x_ab+d_ab2*z_ab))/g3; dhabdgd1[0] += (d_ab1*dxdgd_a*gamma -2*(d_ab1*x_ab+d_ab2*z_ab)*dgammadgd_a)/g3; dhabdgd1[1] += 0.0; dhabdgd1[2] += (d_ab1*dxdgd_b*gamma -2*(d_ab1*x_ab+d_ab2*z_ab)*dgammadgd_b)/g3; dhabdtau1[0] += (d_ab2*dzdtau_a*gamma -2*(d_ab1*x_ab+d_ab2*z_ab)*dgammadtau_a)/g3; dhabdtau1[1] += (d_ab2*dzdtau_b*gamma -2*(d_ab1*x_ab+d_ab2*z_ab)*dgammadtau_b)/g3; } { /* third term */ double g4= pow(gamma,4); hab1 += (d_ab3*xgamma*xgamma+d_ab4*xgamma*zgamma)/gamma; dhabdd1[0] += (-3*dgammadd_a*(d_ab3*pow(x_ab,2.)+d_ab4*x_ab*z_ab)+dxdd_a*gamma*(2*d_ab3*x_ab+d_ab4*z_ab)+d_ab4*x_ab*dzdd_a*gamma)/g4; dhabdd1[1] += (-3*dgammadd_b*(d_ab3*pow(x_ab,2.)+d_ab4*x_ab*z_ab)+dxdd_b*gamma*(2*d_ab3*x_ab+d_ab4*z_ab)+d_ab4*x_ab*dzdd_b*gamma)/g4; dhabdgd1[0] += (-3*x_ab*(d_ab3*x_ab+d_ab4*z_ab)*dgammadgd_a+gamma*(2*d_ab3*x_ab+d_ab4*z_ab)*dxdgd_a)/g4; dhabdgd1[1] += 0.0; dhabdgd1[2] += (-3*x_ab*(d_ab3*x_ab+d_ab4*z_ab)*dgammadgd_b+gamma*(2*d_ab3*x_ab+d_ab4*z_ab)*dxdgd_b)/g4; dhabdtau1[0] += (d_ab4*x_ab*dzdtau_a*gamma-3*x_ab*(d_ab3*x_ab+d_ab4*z_ab)*dgammadtau_a)/g4; dhabdtau1[1] += (d_ab4*x_ab*dzdtau_b*gamma-3*x_ab*(d_ab3*x_ab+d_ab4*z_ab)*dgammadtau_b)/g4; } *h_ab = hab1; //derivatives dh_abdd[0] = dhabdd1[0]; dh_abdd[1] = dhabdd1[1]; dh_abdgd[0] = dhabdgd1[0]; dh_abdgd[1] = dhabdgd1[1]; dh_abdgd[2] = dhabdgd1[2]; dh_abdtau[0] = dhabdtau1[0]; dh_abdtau[1] = dhabdtau1[1]; } /* Get h_ss for Eq. (14)*/ static void c_m06l_hss(double x, double z, double rho, double tau, double *h_ss, double *dh_ssdd, double *dh_ssdgd, double *dh_ssdtau) { /* define the d_ab,i for Eq. (12)*/ static double d_ss0= 0.4650534, d_ss1= 0.1617589, d_ss2= 0.1833657, d_ss3= 0.0004692100, d_ss4= -0.004990573; double alpha_ss = 0.00515088; double hss1, dhssdd1, dhssdgd1, dhssdtau1; double gamma, xgamma, zgamma; double dgammadx, dgammadz; double dgammadd, dgammadgd, dgammadtau; double dxdd, dxdgd, dzdd, dzdtau; gamma = 1 + alpha_ss*(x + z); { /* derivatives of gamma with respect to x and z*/ dgammadx = alpha_ss; dgammadz = alpha_ss; } c_m06l_zx(x, z, rho, tau, &dxdd, &dxdgd, &dzdd, &dzdtau); { /* derivatives of gamma with respect to density, gradient and kinetic energy */ dgammadd = dgammadx * dxdd + dgammadz * dzdd; dgammadgd = dgammadx * dxdgd; dgammadtau = dgammadz * dzdtau; } xgamma = x/gamma; zgamma = z/gamma; /* we initialize h and collect the terms*/ hss1 = 0.0; dhssdd1 = 0.0; dhssdgd1 = 0.0; dhssdtau1 = 0.0; { /* first term */ double g2=pow(gamma,2.); hss1 += d_ss0/gamma; dhssdd1 += -d_ss0*dgammadd/g2; dhssdgd1 += -d_ss0*dgammadgd/g2; dhssdtau1 += -d_ss0*dgammadtau/g2 ; } { /* second term */ double g3=pow(gamma,3.); hss1 += (d_ss1*xgamma + d_ss2*zgamma)/gamma; dhssdd1 += (gamma*(d_ss1*dxdd+d_ss2*dzdd)-2*dgammadd*(d_ss1*x+d_ss2*z))/g3; dhssdgd1 += (d_ss1*dxdgd*gamma -2*(d_ss1*x+d_ss2*z)*dgammadgd)/g3; dhssdtau1 += (d_ss2*dzdtau*gamma -2*(d_ss1*x+d_ss2*z)*dgammadtau)/g3; } { /* third term */ double g4= pow(gamma,4); hss1 += (d_ss3*xgamma*xgamma+d_ss4*xgamma*zgamma)/gamma; dhssdd1 += (-3*dgammadd*(d_ss3*pow(x,2.)+d_ss4*x*z)+dxdd*gamma*(2*d_ss3*x+d_ss4*z)+d_ss4*x*dzdd*gamma)/g4; dhssdgd1 += (-3*x*(d_ss3*x+d_ss4*z)*dgammadgd+gamma*(2*d_ss3*x+d_ss4*z)*dxdgd)/g4; dhssdtau1 += (d_ss4*x*dzdtau*gamma-3*x*(d_ss3*x+d_ss4*z)*dgammadtau)/g4; } *h_ss = hss1; //derivatives *dh_ssdd = dhssdd1; *dh_ssdgd = dhssdgd1; *dh_ssdtau = dhssdtau1; } static void c_m06l_para(m06l_params *p, const double *rho, const double *sigmatmp, const double *tautmp, double *energy, double *dedd, double *vsigma, double *dedtau) { double rho2[2], rho2s[2], x[2], z[2], zc_ss[2]; double tau2[2], tauw[2], dens, dens1, sigma[3]; double g_ss[2], h_ss[2], Ec_ss[2], D_ss[2]; double g_ab=0.0, h_ab=0.0, Ec_ab=0.0; double exunif_ss[2], vxunif_up[2], vxunif_dn[2], vxunif_ss[2]; double exunif =0.0, exunif_ab=0.0, vxunif[2]; //derivatives double dh_ssdd[2], dh_ssdgd[3], dh_ssdtau[2]; double dg_ssdd[2], dg_ssdgd[3] ; double dh_abdd[2], dh_abdgd[3], dh_abdtau[2]; double dg_abdd[2], dg_abdgd[3]; double dEc_ssdd[2], dEc_ssdgd[3], dEc_ssdtau[2]; double dEc_abdd[2], dEc_abdgd[3], dEc_abdtau[2]; double dD_ssdd[2], dD_ssdgd[3], dD_ssdtau[2], dD_ssdx[2], dD_ssdz[2]; double dxdd[2], dxdgd[2], dzdd[2], dzdtau[2]; const double Cfermi= (3./5.)*pow(6*M_PI*M_PI,2./3.); /* put in by cpo for const reasons */ double sigma_[3],tau[2]; sigma_[0] = sigmatmp[0]; sigma_[1] = sigmatmp[1]; sigma_[2] = sigmatmp[2]; tau[0] = tautmp[0]; tau[1] = tautmp[1]; /*calculate |nabla rho|^2 */ sigma_[0] = max(MIN_GRAD*MIN_GRAD, sigma_[0]); tauw[0] = max(sigma_[0]/(8.0*rho[0]), 1.0e-12); tau[0] = max(tauw[0], tau[0]); dens1 = rho[0]+rho[1]; if(p->common.nspin== XC_UNPOLARIZED) { tau[1] = 0.0; rho2[0] = rho[0]/2.; rho2[1] = rho[0]/2.; sigma[0] = sigma_[0]/4.; sigma[1] = sigma_[0]/4.; sigma[2] = sigma_[0]/4.; dens = rho[0]; tau2[0] = tau[0]/2.; tau2[1] = tau[0]/2.; }else{ sigma_[2] = max(MIN_GRAD*MIN_GRAD, sigma_[2]); tauw[1] = max(sigma_[2]/(8.0*rho[1]), 1.0e-12); tau[1] = max(tauw[1], tau[1]); rho2[0]=rho[0]; rho2[1]=rho[1]; sigma[0] = sigma_[0]; sigma[1] = sigma_[1]; sigma[2] = sigma_[2]; dens = rho[0]+rho[1]; tau2[0] =tau[0]; tau2[1] =tau[1]; } //get the e_LDA(rho_a,b) const int np = 1; XC(lda_exc_vxc)(p->c_aux, np, rho2, &exunif, vxunif); exunif = exunif*dens; /*==============get the E_sigma part================*/ /*============ spin up =============*/ rho2s[0]=rho2[0]; rho2s[1]=0.; //get the e_LDA(rho_up,0) XC(lda_exc_vxc)(p->c_aux, np, rho2s, &(exunif_ss[0]), vxunif_up); exunif_ss[0] = exunif_ss[0] * rho2s[0]; vxunif_ss[0] = vxunif_up[0]; /*define variables for rho_up and zc in order to avoid x/0 -> D_ss = -inf */ x[0] = sigma[0]/(pow(rho2s[0], 8./3.)); z[0] = 2*tau2[0]/pow(rho2s[0],5./3.) - Cfermi; zc_ss[0] = 2*tau2[0]/pow(rho2s[0],5./3.); /*D_ss = 1 -x/4*(z + Cf), z+Cf = 2*tau2/pow(rho2s[0],5./3.) = zc */ D_ss[0] = 1 - x[0]/(4. * zc_ss[0]); //derivatives for D_up dD_ssdx[0] = -1/(4 * zc_ss[0]); dD_ssdz[0] = 4 * x[0]/pow(4.*zc_ss[0],2.); c_m06l_zx(x[0], z[0], rho2s[0], tau2[0], &(dxdd[0]), &(dxdgd[0]), &(dzdd[0]), &(dzdtau[0])); dD_ssdd[0] = dD_ssdx[0] * dxdd[0] + dD_ssdz[0] * dzdd[0]; dD_ssdgd[0] = dD_ssdx[0] * dxdgd[0]; dD_ssdtau[0] = dD_ssdz[0] * dzdtau[0]; /*build up Eq. (14): Ec_sigmasigma*/ c_m06_15(x[0], rho2s[0], &(g_ss[0]), &(dg_ssdd[0]), &(dg_ssdgd[0])); c_m06l_hss(x[0], z[0], rho2s[0], tau2[0], &(h_ss[0]), &(dh_ssdd[0]), &(dh_ssdgd[0]), &(dh_ssdtau[0])); Ec_ss[0] = (exunif_ss[0] * (g_ss[0]+h_ss[0]) * D_ss[0]); //printf("Ec_up %.9e\n", Ec_ss[0]); /*============== spin down =============*/ rho2s[0]=rho2[1]; rho2s[1]=0.; //get the e_LDA(0,rho_dn) XC(lda_exc_vxc)(p->c_aux, np, rho2s, &(exunif_ss[1]), vxunif_dn); exunif_ss[1] = exunif_ss[1] * rho2s[0]; vxunif_ss[1] = vxunif_dn[0]; /*define variables for rho_beta*/ x[1] = sigma[2]/(pow(rho2s[0], 8./3.)); z[1] = 2*tau2[1]/pow(rho2s[0],5./3.) - Cfermi; zc_ss[1] = 2*tau2[1]/pow(rho2s[0],5./3.); //printf("x1 %.9e, zc_ss%.9e\n", x[1], zc_ss[1]); D_ss[1] = 1 - x[1]/(4.*zc_ss[1]); //derivatives for D_dn dD_ssdx[1] = - 1/(4*zc_ss[1]); dD_ssdz[1] = 4*x[1]/pow(4.*zc_ss[1],2.); c_m06l_zx(x[1], z[1], rho2s[0], tau2[1], &(dxdd[1]), &(dxdgd[1]), &(dzdd[1]), &(dzdtau[1])); dD_ssdd[1] = dD_ssdx[1] * dxdd[1] + dD_ssdz[1] * dzdd[1]; dD_ssdgd[2] = dD_ssdx[1] * dxdgd[1]; dD_ssdtau[1] = dD_ssdz[1] * dzdtau[1]; c_m06_15(x[1], rho2s[0], &(g_ss[1]), &(dg_ssdd[1]), &(dg_ssdgd[2])); c_m06l_hss(x[1], z[1], rho2s[0], tau2[1], &(h_ss[1]), &(dh_ssdd[1]), &(dh_ssdgd[2]), &(dh_ssdtau[1])); //printf("exunif_ss %.9e, (g_ss[1]+h_ss[1])%.9e, D_ss %.9e\n", exunif_ss[1],(g_ss[1]+h_ss[1]),D_ss[1]); Ec_ss[1] = (exunif_ss[1] * (g_ss[1]+h_ss[1]) * D_ss[1]); //printf("Ec_dn %.9e\n", Ec_ss[1]); // Derivatives for Ec_up and Ec_dn with respect to density and kinetic energy int i; for(i=0; i<2; i++){ dEc_ssdd[i] = exunif_ss[i] * dh_ssdd[i] * D_ss[i] + vxunif_ss[i] * h_ss[i] * D_ss[i] + exunif_ss[i] * h_ss[i] * dD_ssdd[i] + exunif_ss[i] * dg_ssdd[i] * D_ss[i] + vxunif_ss[i] * g_ss[i] * D_ss[i] + exunif_ss[i] * g_ss[i] * dD_ssdd[i]; dEc_ssdtau[i] = exunif_ss[i] * dh_ssdtau[i] * D_ss[i] + exunif_ss[i] * h_ss[i] * dD_ssdtau[i] + exunif_ss[i] * g_ss[i] * dD_ssdtau[i]; } // Derivatives for Ec_up and Ec_dn with respect to gradient dEc_ssdgd[0] = exunif_ss[0] * dh_ssdgd[0] * D_ss[0] + exunif_ss[0] * h_ss[0] * dD_ssdgd[0] + exunif_ss[0] * dg_ssdgd[0] * D_ss[0] + exunif_ss[0] * g_ss[0] * dD_ssdgd[0]; dEc_ssdgd[2] = exunif_ss[1] * dh_ssdgd[2] * D_ss[1] + exunif_ss[1] * h_ss[1] * dD_ssdgd[2] + exunif_ss[1] * dg_ssdgd[2] * D_ss[1] + exunif_ss[1] * g_ss[1] * dD_ssdgd[2]; /*==============get the E_ab part========================*/ exunif_ab = exunif - exunif_ss[0] - exunif_ss[1]; //x_ab = sigmatot[0] /(pow(rho2[0], 8./3.)) + sigmatot[2] /(pow(rho2[1], 8./3.)); //z_ab = 2*tau2[0]/pow(rho2[0],5./3.) + 2*tau2[1]/pow(rho2[1],5./3.) - 2*Cfermi; /*build up Eq. (12): Ec_alphabeta*/ c_m06_13(x, rho2, &g_ab, dg_abdd, dg_abdgd); c_m06l_hab(x, z, rho2, tau2, &h_ab, dh_abdd, dh_abdgd, dh_abdtau); Ec_ab = exunif_ab * (g_ab+h_ab); // Derivatives for Ec_ab with respect to density and kinetic energy for(i=0; i<2; i++){ dEc_abdd[i] = exunif_ab * (dh_abdd[i]+ dg_abdd[i]) + (vxunif[i]- vxunif_ss[i]) * (g_ab+h_ab); dEc_abdtau[i] = exunif_ab * dh_abdtau[i]; } // Derivatives for Ec_ab with respect to gradient for(i=0; i<3; i++){ dEc_abdgd[i] = exunif_ab * (dh_abdgd[i] + dg_abdgd[i]); } /*==============get the total energy E_c= E_up + E_dn + E_ab========================*/ /*==============================and derivatives=====================================*/ *energy = (Ec_ss[0] + Ec_ss[1] + Ec_ab)/dens1; //printf("Ec_ss %.9e, Ec_ss %.9e, Ec_ab %.9e\n", Ec_ss[0], Ec_ss[1], Ec_ab); //derivative for the total correlation energy if(p->common.nspin== XC_UNPOLARIZED) { dedd[0]=dEc_ssdd[0] + dEc_abdd[0]; dedd[1]=0.0; vsigma[0]= (dEc_ssdgd[0] + dEc_abdgd[0])/2.; vsigma[1]= 0.0; vsigma[2]= 0.0; dedtau[0]= dEc_ssdtau[0] + dEc_abdtau[0]; dedtau[1]= 0.0; }else{ dedd[0]=dEc_ssdd[0] + dEc_abdd[0]; dedd[1]=dEc_ssdd[1] + dEc_abdd[1]; vsigma[0]= dEc_ssdgd[0] + dEc_abdgd[0]; vsigma[1]= 0.0; vsigma[2]= dEc_ssdgd[2] + dEc_abdgd[2]; dedtau[0]= dEc_ssdtau[0] + dEc_abdtau[0]; dedtau[1]= dEc_ssdtau[1] + dEc_abdtau[1]; } } static void XC(mgga_c_m06l)(void *p, const double *rho, const double *sigma, const double *tau, double *e, double *dedd, double *vsigma, double *dedtau) { c_m06l_para(p, rho, sigma, tau, e, dedd, vsigma, dedtau); } /* derivatives of x and z with respect to rho, grho and tau: Eq.(1) and Eq.(3)*/ static void x_m06l_zx(double x, double z, double rho, double tau, double *dxdd, double *dxdgd, double *dzdd, double *dzdtau) { *dxdd = -8./3. * x * 1/rho; *dxdgd = 1./pow(rho,8./3.); *dzdd = -5./3. * 2* tau/pow(rho, 8./3.); *dzdtau = 2./pow(rho, 5./3.); } /* Build gamma and its derivatives with respect to rho, grho and tau: Eq. (4)*/ static void x_m06l_gamma(double x, double z, double rho, double tau, double *gamma, double *dgammadd, double *dgammadgd, double *dgammadtau) { static double alpha = 0.00186726; /*set alpha of Eq. (4)*/ double dgammadx, dgammadz; double dxdd, dxdgd, dzdd, dzdtau; *gamma = 1 + alpha*(x + z); /*printf("gamma %19.12f\n", *gamma);*/ { /* derivatives */ dgammadx = alpha; dgammadz = alpha; } x_m06l_zx(x, z, rho, tau, &dxdd, &dxdgd, &dzdd, &dzdtau); { *dgammadd = dgammadx*dxdd + dgammadz*dzdd; *dgammadgd = dgammadx*dxdgd; *dgammadtau = dgammadz*dzdtau; } } /************************************************************************ Implements Zhao, Truhlar Meta-gga M06-Local Correlation part ************************************************************************/ /* calculate h and h derivatives with respect to rho, grho and tau: Equation (5) */ static void x_m06l_h(double x, double z, double rho, double tau, double *h, double *dhdd, double *dhdgd, double *dhdtau) { /* parameters for h(x_sigma,z_sigma) of Eq. (5)*/ static double d0=0.6012244, d1=0.004748822, d2=-0.008635108, d3=-0.000009308062, d4=0.00004482811; double h1, dhdd1, dhdgd1, dhdtau1; double gamma, dgammadd, dgammadgd, dgammadtau; double xgamma, zgamma; double dxdd, dxdgd, dzdd, dzdtau; x_m06l_gamma(x, z, rho, tau, &gamma, &dgammadd, &dgammadgd, &dgammadtau); xgamma = x/gamma; zgamma = z/gamma; /* we initialize h and its derivatives and collect the terms*/ h1 = 0.0; dhdd1 = 0.0; dhdgd1 = 0.0; dhdtau1 = 0.0; { /* first term */ double g2=pow(gamma,2.); h1 += d0/gamma; dhdd1 += -d0*dgammadd/g2; dhdgd1 += -d0*dgammadgd/g2; dhdtau1 += -d0*dgammadtau/g2 ; } x_m06l_zx(x, z, rho, tau, &dxdd, &dxdgd, &dzdd, &dzdtau); { /* second term */ double g3=pow(gamma,3.); h1 += (d1*xgamma + d2*zgamma)/gamma; dhdd1 += (gamma*(d1*dxdd+d2*dzdd)-2*dgammadd*(d1*x+d2*z))/g3; dhdgd1 += (d1*dxdgd*gamma -2*(d1*x+d2*z)*dgammadgd)/g3; dhdtau1 += (d2*dzdtau*gamma -2*(d1*x+d2*z)*dgammadtau)/g3; } { /* third term */ double g4= pow(gamma,4); h1 += (d3*xgamma*xgamma+d4*xgamma*zgamma)/gamma; dhdd1 += (-3*dgammadd*(d3*pow(x,2.)+d4*x*z)+dxdd*gamma*(2*d3*x+d4*z)+d4*x*dzdd*gamma)/g4; dhdgd1 += (-3*x*(d3*x+d4*z)*dgammadgd+gamma*(2*d3*x+d4*z)*dxdgd)/g4; dhdtau1 += (d4*x*dzdtau*gamma-3*x*(d3*x+d4*z)*dgammadtau)/g4; } *h = h1; /*printf(" h %19.12f\n", *h);*/ *dhdd = dhdd1; *dhdgd =dhdgd1; *dhdtau = dhdtau1; } /* f(w) and its derivatives with respect to rho and tau*/ static void x_m06l_fw(double rho, double tau, double *fw, double *dfwdd, double *dfwdtau) { /*define the parameters for fw of Eq. (8) as in the reference paper*/ static double a0= 0.3987756, a1= 0.2548219, a2= 0.3923994, a3= -2.103655, a4= -6.302147, a5= 10.97615, a6= 30.97273, a7=-23.18489, a8=-56.73480, a9=21.60364, a10= 34.21814, a11= -9.049762; double tau_lsda, t, w; double dtdd, dtdtau; double dfwdw, dwdt, dtau_lsdadd; double aux = (3./10.) * pow((6*M_PI*M_PI),2./3.); /*3->6 for nspin=2 */ tau_lsda = aux * pow(rho,5./3.); t = tau_lsda/tau; dtdtau = -t/tau; w = (t - 1)/(t + 1); *fw = a0*pow(w,0.)+a1*pow(w,1.)+a2*pow(w,2.)+a3*pow(w,3.)+a4*pow(w,4.)+ + a5*pow(w,5.)+a6*pow(w,6.)+a7*pow(w,7.)+a8*pow(w,8.)+a9*pow(w,9.)+a10*pow(w,10.)+a11*pow(w,11.); dfwdw = 0.0*a0*pow(w,-1)+1.0*a1*pow(w,0.)+2.0*a2*pow(w,1.)+3.0*a3*pow(w,2.)+4.0*a4*pow(w,3.)+ + 5.0*a5*pow(w,4.)+6.0*a6*pow(w,5.)+7.0*a7*pow(w,6.)+8.0*a8*pow(w,7.)+9.0*a9*pow(w,8.)+ + 10*a10*pow(w,9.)+11*a11*pow(w,10.); dwdt = 2/pow((t + 1),2.); dtau_lsdadd = aux * 5./3.* pow(rho,2./3.); dtdd = dtau_lsdadd/tau; *dfwdd = dfwdw * dwdt * dtdd; *dfwdtau = dfwdw * dwdt * dtdtau; } static void x_m06l_para(m06l_params *pt, double rho, double sigma, double tau, double *energy, double *dedd, double *vsigma, double *dedtau) { /*Build Eq. (6) collecting the terms Fx_PBE, fw, e_lsda and h*/ double grad, tauw, tau2, x, z; double rho2[2],sigmatot[3]; double F_PBE, de_PBEdd[2], de_PBEdgd[3]; double h, dhdd, dhdgd, dhdtau; double fw, dfwdd, dfwdtau; double epsx_lsda, depsx_lsdadd; const double Cfermi = (3./5.) * pow(6*M_PI*M_PI,2./3.); /* calculate |nabla rho|^2 */ grad = sigma; grad = max(MIN_GRAD*MIN_GRAD, grad); tauw = max(grad/(8.0*rho),1.0e-12); /* tau^W = |nabla rho|^2/ 8rho */ tau = max(tau, tauw); rho2[0]=rho/2.; rho2[1]=0.0; sigmatot[0] = grad/4.; sigmatot[1] = 0.0; sigmatot[2] = 0.0; tau2 =tau/2.; /* get the uniform gas energy and potential a MINUS was missing in the paper*/ epsx_lsda = -(3./2.)*pow(3./(4*M_PI),1./3.)*pow(rho2[0],4./3.); depsx_lsdadd = -2*pow(3./(4*M_PI),1./3.)*pow(rho2[0],1./3.); /*get Fx for PBE*/ const int np = 1; XC(gga_exc_vxc)(pt->x_aux, np, rho2, sigmatot, &F_PBE, de_PBEdd, de_PBEdgd); /* define x and z from Eq. (1) and Eq. (3) NOTE: we build directly x^2 */ x = grad/(4*pow(rho2[0], 8./3.)); z = 2*tau2/pow(rho2[0],5./3.) - Cfermi; /*THERE IS A 2 IN FRONT AS IN THEOR. CHEM. ACCOUNT 120 215 (2008)*/ /*get h and fw*/ x_m06l_h(x, z, rho2[0], tau2, &h, &dhdd, &dhdgd, &dhdtau); x_m06l_fw(rho2[0], tau2, &fw, &dfwdd, &dfwdtau); { /* Eq. (6) E_x = Int F_PBE*fw + exunif*h, the factor 2 accounts for spin. */ *energy = 2*(F_PBE*rho2[0] *fw + epsx_lsda *h); *dedd = (de_PBEdd[0] *fw + F_PBE*rho2[0] * dfwdd+ depsx_lsdadd *h + epsx_lsda * dhdd); *dedtau = (F_PBE * dfwdtau *rho2[0] + epsx_lsda * dhdtau); *vsigma = (de_PBEdgd[0] *fw + epsx_lsda*dhdgd)/2.; } } void XC(mgga_x_m06l)(void *p, const double *rho, const double *sigma, const double *tau, double *e, double *dedd, double *vsigma, double *dedtau) { m06l_params *par = (m06l_params*)p; if(par->common.nspin == XC_UNPOLARIZED){ double en; x_m06l_para(p, rho[0], sigma[0], tau[0], &en, dedd, vsigma, dedtau); *e = en/(rho[0]+rho[1]); }else{ *e = 0.0; double e2na, e2nb, rhoa[2], rhob[2]; double vsigmapart[3]; rhoa[0]=2*rho[0]; rhoa[1]=0.0; rhob[0]=2*rho[1]; rhob[1]=0.0; x_m06l_para(p, rhoa[0], 4*sigma[0], 2.0*tau[0], &e2na, &(dedd[0]), &(vsigmapart[0]), &(dedtau[0])); x_m06l_para(p, rhob[0], 4*sigma[2], 2.0*tau[1], &e2nb, &(dedd[1]), &(vsigmapart[2]), &(dedtau[1])); *e = (e2na + e2nb )/(2.*(rho[0]+rho[1])); vsigma[0] = 2*vsigmapart[0]; vsigma[2] = 2*vsigmapart[2]; } } static void m06l_init(void *p) { m06l_params *par = (m06l_params*)p; par->c_aux = (XC(func_type) *) malloc(sizeof(XC(func_type))); XC(func_init)(par->c_aux, XC_LDA_C_PW, XC_POLARIZED); par->x_aux = (XC(func_type) *) malloc(sizeof(XC(func_type))); XC(func_init)(par->x_aux, XC_GGA_X_PBE, XC_POLARIZED); } static void m06l_end(void *p) { m06l_params *par = (m06l_params*)p; XC(func_end)(par->c_aux); free(par->c_aux); XC(func_end)(par->x_aux); free(par->x_aux); } const mgga_func_info m06l_info = { sizeof(m06l_params), &m06l_init, &m06l_end, &XC(mgga_x_m06l), &XC(mgga_c_m06l), }; gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/pbe.c000066400000000000000000000116421316441372200216760ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include #include "xc_gpaw.h" double pbe_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2) { double e = C1 / rs; *dedrs = -e / rs; if (par->gga) { double c = C2 * rs / n; c *= c; double s2 = a2 * c; double x = 1.0 + MU * s2 / par->kappa; double Fx = 1.0 + par->kappa - par->kappa / x; double dFxds2 = MU / (x * x); double ds2drs = 8.0 * c * a2 / rs; //double ds2drs = 8.0 * s2 / rs; *dedrs = *dedrs * Fx + e * dFxds2 * ds2drs; *deda2 = e * dFxds2 * c; e *= Fx; } return e; } /* inline */ double G(double rtrs, double A, double alpha1, double beta1, double beta2, double beta3, double beta4, double* dGdrs) { double Q0 = -2.0 * A * (1.0 + alpha1 * rtrs * rtrs); double Q1 = 2.0 * A * rtrs * (beta1 + rtrs * (beta2 + rtrs * (beta3 + rtrs * beta4))); double G1 = Q0 * log(1.0 + 1.0 / Q1); double dQ1drs = A * (beta1 / rtrs + 2.0 * beta2 + rtrs * (3.0 * beta3 + 4.0 * beta4 * rtrs)); *dGdrs = -2.0 * A * alpha1 * G1 / Q0 - Q0 * dQ1drs / (Q1 * (Q1 + 1.0)); return G1; } /* * In[1]:= H=g Log[1+b/g t^2(1+a t^2)/(1+a t^2 + a^2 t^4)] * * 2 2 * b t (1 + a t ) * Out[1]= g Log[1 + --------------------] * 2 2 4 * g (1 + a t + a t ) * * In[4]:= Simplify[D[H,t]] * * 2 * 2 b g t (1 + 2 a t ) * Out[4]= --------------------------------------------------------- * 2 2 4 2 2 4 2 4 * (1 + a t + a t ) (g + b t + a g t + a b t + a g t ) * */ double pbe_correlation(double n, double rs, double zeta, double a2, bool gga, bool spinpol, double* dedrs, double* dedzeta, double* deda2) { double rtrs = sqrt(rs); double de0drs; double e0 = G(rtrs, GAMMA, 0.21370, 7.5957, 3.5876, 1.6382, 0.49294, &de0drs); double e; double xp = 117.0; double xm = 117.0; if (spinpol) { double de1drs; double e1 = G(rtrs, 0.015545, 0.20548, 14.1189, 6.1977, 3.3662, 0.62517, &de1drs); double dalphadrs; double alpha = -G(rtrs, 0.016887, 0.11125, 10.357, 3.6231, 0.88026, 0.49671, &dalphadrs); dalphadrs = -dalphadrs; double zp = 1.0 + zeta; double zm = 1.0 - zeta; xp = pow(zp, THIRD); xm = pow(zm, THIRD); double f = CC1 * (zp * xp + zm * xm - 2.0); double f1 = CC2 * (xp - xm); double zeta2 = zeta * zeta; double zeta3 = zeta2 * zeta; double zeta4 = zeta2 * zeta2; double x = 1.0 - zeta4; *dedrs = (de0drs * (1.0 - f * zeta4) + de1drs * f * zeta4 + dalphadrs * f * x * IF2); *dedzeta = (4.0 * zeta3 * f * (e1 - e0 - alpha * IF2) + f1 * (zeta4 * e1 - zeta4 * e0 + x * alpha * IF2)); e = e0 + alpha * IF2 * f * x + (e1 - e0) * f * zeta4; } else { *dedrs = de0drs; e = e0; } if (gga) { double n2 = n * n; double t2; double y; double phi = 117.0; double phi2 = 117.0; double phi3 = 117.0; if (spinpol) { phi = 0.5 * (xp * xp + xm * xm); phi2 = phi * phi; phi3 = phi * phi2; t2 = C3 * a2 * rs / (n2 * phi2); y = -e / (GAMMA * phi3); } else { t2 = C3 * a2 * rs / n2; y = -e / GAMMA; } double x = exp(y); double A; if (x != 1.0) A = BETA / (GAMMA * (x - 1.0)); else A = BETA / (GAMMA * y); double At2 = A * t2; double nom = 1.0 + At2; double denom = nom + At2 * At2; double H = GAMMA * log( 1.0 + BETA * t2 * nom / (denom * GAMMA)); double tmp = (GAMMA * BETA / (denom * (BETA * t2 * nom + GAMMA * denom))); double tmp2 = A * A * x / BETA; double dAdrs = tmp2 * *dedrs; if (spinpol) { H *= phi3; tmp *= phi3; dAdrs /= phi3; } double dHdt2 = (1.0 + 2.0 * At2) * tmp; double dHdA = -At2 * t2 * t2 * (2.0 + At2) * tmp; *dedrs += dHdt2 * 7 * t2 / rs + dHdA * dAdrs; *deda2 = dHdt2 * C3 * rs / n2; if (spinpol) { double dphidzeta = (1.0 / xp - 1.0 / xm) / 3.0; double dAdzeta = tmp2 * (*dedzeta - 3.0 * e * dphidzeta / phi) / phi3; *dedzeta += ((3.0 * H / phi - dHdt2 * 2.0 * t2 / phi ) * dphidzeta + dHdA * dAdzeta); *deda2 /= phi2; } e += H; } return e; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/pw91.c000066400000000000000000000122451316441372200217300ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include #include "xc_gpaw.h" double G(double rtrs, double A, double alpha1, double beta1, double beta2, double beta3, double beta4, double* dGdrs); double pw91_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2) { double e = C1 / rs; *dedrs = -e / rs; if (par->gga) { double c = C2 * rs / n; c *= c; double s2 = a2 * c; double s = sqrt(s2); double f1 = 7.7956 * s; double f2 = 0.19645 * asinh(f1); double f3 = 0.1508 * exp(-100.0 * s2); double f4 = 0.004 * s2 * s2; double f5 = 1.0 + s * f2; double f6 = f5 + f4; double f7 = 0.2743 - f3; double f8 = f5 + f7 * s2; double Fx = f8 / f6; double f9 = 0.5 * 7.7956 * 0.19645 / sqrt(1.0 + f1 * f1); if (s < 0.00001) f9 += 0.5 * 7.7956 * 0.19645; else f9 += 0.5 * f2 / s; double dFxds2 = ((f9 + f7 + 100.0 * f3 * s2) * f6 - f8 * (f9 + 0.008 * s2)) / (f6 * f6); double ds2drs = 8.0 * s2 / rs; *dedrs = *dedrs * Fx + e * dFxds2 * ds2drs; *deda2 = e * dFxds2 * c; e *= Fx; } return e; } double pw91_correlation(double n, double rs, double zeta, double a2, bool gga, bool spinpol, double* dedrs, double* dedzeta, double* deda2) { double rtrs = sqrt(rs); double de0drs; double e0 = G(rtrs, GAMMA, 0.21370, 7.5957, 3.5876, 1.6382, 0.49294, &de0drs); double e; double xp = 117.0; double xm = 117.0; if (spinpol) { double de1drs; double e1 = G(rtrs, 0.015545, 0.20548, 14.1189, 6.1977, 3.3662, 0.62517, &de1drs); double dalphadrs; double alpha = -G(rtrs, 0.016887, 0.11125, 10.357, 3.6231, 0.88026, 0.49671, &dalphadrs); dalphadrs = -dalphadrs; double zp = 1.0 + zeta; double zm = 1.0 - zeta; xp = pow(zp, THIRD); xm = pow(zm, THIRD); double f = CC1 * (zp * xp + zm * xm - 2.0); double f1 = CC2 * (xp - xm); double zeta2 = zeta * zeta; double zeta3 = zeta2 * zeta; double zeta4 = zeta2 * zeta2; double x = 1.0 - zeta4; *dedrs = (de0drs * (1.0 - f * zeta4) + de1drs * f * zeta4 + dalphadrs * f * x * IF2); *dedzeta = (4.0 * zeta3 * f * (e1 - e0 - alpha * IF2) + f1 * (zeta4 * e1 - zeta4 * e0 + x * alpha * IF2)); e = e0 + alpha * IF2 * f * x + (e1 - e0) * f * zeta4; } else { *dedrs = de0drs; e = e0; } if (gga) { double n2 = n * n; double t2; double y; double phi; double phi2; double phi3; double phi4; double GAMMAPW91 = BETA * BETA / 0.18; if (spinpol) { phi = 0.5 * (xp * xp + xm * xm); phi2 = phi * phi; phi3 = phi * phi2; phi4 = phi * phi3; } else { phi = 1.0; phi2 = 1.0; phi3 = 1.0; phi4 = 1.0; } t2 = C3 * a2 * rs / (n2 * phi2); y = -e / (GAMMAPW91 * phi3); double x = exp(y); double A = BETA / (GAMMAPW91 * (x - 1.0)); double At2 = A * t2; double nom = 1.0 + At2; double denom = nom + At2 * At2; double H0 = (phi3 * GAMMAPW91 * log(1.0 + BETA * t2 * nom / (denom * GAMMAPW91))); double tmp = (phi3 * GAMMAPW91 * BETA / (denom * (BETA * t2 * nom + GAMMAPW91 * denom))); double tmp2 = A * A * x / BETA; double dAdrs = tmp2 * *dedrs / phi3; const double KK = 66.343643960645011; // 100*4/pi*(4/pi/9)**(1/3.) const double XNU = 15.75592; const double Cc0 = 0.004235; const double Cx = -0.001667212; const double K1 = 0.002568; const double K2 = 0.023266; const double K3 = 7.389e-6; const double K4 = 8.723; const double K5 = 0.472; const double K6 = 7.389e-2; double f0 = XNU * exp(-KK * rs * phi4 * t2); double rs2 = rs * rs; double f1 = K1 + K2 * rs + K3 * rs2; double f2 = 1.0 + K4 * rs + K5 * rs2 + K6 * rs2 * rs; double f3 = -10.0 * Cx / 7.0 - Cc0 + f1 / f2; double H1 = f0 * phi3 * f3 * t2; double dH1drs = (-KK * phi4 * t2 * H1 + f0 * phi3 * t2 * ((K2 + 2.0 * K3 * rs) * f2 - (K4 + 2.0 * K5 * rs + 3.0 * K6 * rs2) * f1) / (f2 * f2)); double dH1dt2 = -KK * rs * phi4 * H1 + f0 * phi3 * f3; double dH1dphi = (-4.0 * KK * rs * phi3 * H1 + 3.0 * f0 * phi2 * f3) * t2; double dH0dt2 = (1.0 + 2.0 * At2) * tmp; double dH0dA = -At2 * t2 * t2 * (2.0 + At2) * tmp; *dedrs += (dH0dt2 + dH1dt2) * 7 * t2 / rs + dH0dA * dAdrs + dH1drs; *deda2 = (dH0dt2 + dH1dt2) * C3 * rs / n2; if (spinpol) { double dphidzeta = (1.0 / xp - 1.0 / xm) / 3.0; double dAdzeta = tmp2 * (*dedzeta - 3.0 * e * dphidzeta / phi) / phi3; *dedzeta += ((3.0 * H0 / phi - dH0dt2 * 2.0 * t2 / phi ) * dphidzeta + dH0dA * dAdzeta); *dedzeta += (dH1dphi - dH1dt2 * 2.0 * t2 / phi ) * dphidzeta; *deda2 /= phi2; } e += H0 + H1; } return e; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/revtpss.c000066400000000000000000000402261316441372200226360ustar00rootroot00000000000000 #include #include #include #include #include "xc_mgga.h" typedef struct revtpss_params { common_params common; // needs to be at the beginning of every functional_params XC(func_type) *x_aux; XC(func_type) c_aux1; XC(func_type) c_aux2; } revtpss_params; void gga_c_pbe_revtpss(XC(func_type) *p, const double *rho, const double *sigma, double *e, double *vrho, double *vsigma, double *v2rho2, double *v2rhosigma, double *v2sigma2); /************************************************************************ Implements John P. Perdew, Adrienn Ruzsinszky, Gabor I. Csonka, Lucian A. Constantin, and Jianwei Sun meta-Generalized Gradient Approximation. Correlation part ************************************************************************/ /* some parameters */ static double d = 2.8; /* Equation (14) */ static void c_revtpss_14(double csi, double zeta, double *C, double *dCdcsi, double *dCdzeta) { double fz, C0, dC0dz, dfzdz; double z2 = zeta*zeta; /* Equation (13) */ C0 = 0.59 + z2*(0.9269 + z2*(0.6225 + z2*2.1540)); dC0dz = zeta*(2.0*0.9269 + z2*(4.0*0.6225 + z2*6.0*2.1540)); /*OK*/ fz = 0.5*(pow(1.0 + zeta, -4.0/3.0) + pow(1.0 - zeta, -4.0/3.0)); dfzdz = 0.5*(-4.0/3.0)*(pow(1.0 + zeta, -7.0/3.0) - pow(1.0 - zeta, -7.0/3.0)); /*OK*/ { /* Equation (14) */ double csi2 = csi*csi; double a = 1.0 + csi2*fz, a4 = pow(a, 4); *C = C0 / a4; *dCdcsi = -8.0*C0*csi*fz/(a*a4); /*added C OK*/ *dCdzeta = (dC0dz*a - C0*4.0*csi2*dfzdz)/(a*a4); /*OK*/ } } /* Equation (12) */ static void c_revtpss_12(revtpss_params *p, const double *rho, const double *sigma, double dens, double zeta, double z, double *e_PKZB, double *de_PKZBdd, double *de_PKZBdsigma, double *de_PKZBdz) { /*some incoming variables: dens = rho[0] + rho[1] z = tau_w/tau zeta = (rho[0] - rho[1])/dens*/ double e_PBE, e_PBEup, e_PBEdn; double de_PBEdd[2], de_PBEdsigma[3], de_PBEddup[2], de_PBEdsigmaup[3], de_PBEdddn[2], de_PBEdsigmadn[3] ; double aux, zsq; double dzetadd[2], dcsidd[2], dcsidsigma[3]; double C, dCdcsi, dCdzeta; double densp[2], densp2[2], sigmatot[3], sigmaup[3], sigmadn[3]; int i; /*initialize dCdcsi and dCdzeta and the energy*/ dCdcsi = dCdzeta = 0.0; e_PBE = 0.0; e_PBEup = 0.0; e_PBEdn = 0.0; /* get the PBE stuff */ if(p->common.nspin== XC_UNPOLARIZED) { densp[0]=rho[0]/2.; densp[1]=rho[0]/2.; sigmatot[0] = sigma[0]/4.; sigmatot[1] = sigma[0]/4.; sigmatot[2] = sigma[0]/4.; }else{ densp[0] = rho[0]; densp[1] = rho[1]; sigmatot[0] = sigma[0]; sigmatot[1] = sigma[1]; sigmatot[2] = sigma[2]; } /* e_PBE */ XC(func_type) *aux2 = (p->common.nspin == XC_UNPOLARIZED) ? &p->c_aux2 : &p->c_aux1; gga_c_pbe_revtpss(aux2, densp, sigmatot, &e_PBE, de_PBEdd, de_PBEdsigma, NULL, NULL, NULL); densp2[0]=densp[0]; densp2[1]=0.0; if(p->common.nspin== XC_UNPOLARIZED) { sigmaup[0] = sigma[0]/4.; sigmaup[1] = 0.; sigmaup[2] = 0.; }else{ sigmaup[0] = sigma[0]; sigmaup[1] = 0.; sigmaup[2] = 0.; } /* e_PBE spin up */ gga_c_pbe_revtpss(aux2, densp2, sigmaup, &e_PBEup, de_PBEddup, de_PBEdsigmaup, NULL, NULL, NULL); densp2[0]=densp[1]; densp2[1]=0.0; if(p->common.nspin== XC_UNPOLARIZED) { sigmadn[0] = sigma[0]/4.; sigmadn[1] = 0.; sigmadn[2] = 0.; }else{ sigmadn[0] = sigma[2]; sigmadn[1] = 0.; sigmadn[2] = 0.; } /* e_PBE spin down */ gga_c_pbe_revtpss(aux2, densp2, sigmadn, &e_PBEdn, de_PBEdddn, de_PBEdsigmadn, NULL, NULL, NULL); /*get Eq. (13) and (14) for the polarized case*/ if(p->common.nspin == XC_UNPOLARIZED){ C = 0.59; dzetadd[0] = 0.0; dcsidd [0] = 0.0; dzetadd[1] = 0.0; dcsidd [1] = 0.0; for(i=0; i<3; i++) dcsidsigma[i] = 0.0; }else{ // initialize derivatives for(i=0; i<2; i++){ dzetadd[i] = 0.0; dcsidd [i] = 0.0;} for(i=0; i<3; i++) dcsidsigma[i] = 0.0; double num, gzeta, csi, a; /*numerator of csi: derive as grho all components and then square the 3 parts [2 (grho_a[0]n_b - grho_b[0]n_a) +2 (grho_a[1]n_b - grho_b[1]n_a) + 2 (grho_a[2]n_b - grho_b[2]n_a)]/(n_a+n_b)^2 -> 4 (sigma_aa n_b^2 - 2 sigma_ab n_a n_b + sigma_bb n_b^2)/(n_a+n_b)^2 */ num = sigma[0] * pow(rho[1],2) - 2.* sigma[1]*rho[0]*rho[1]+ sigma[2]*pow(rho[0],2); num = max(num, 1e-20); gzeta = sqrt(4*(num))/(dens*dens); gzeta = max(gzeta, MIN_GRAD); /*denominator of csi*/ a = 2*pow(3.0*M_PI*M_PI*dens, 1.0/3.0); csi = gzeta/a; c_revtpss_14(csi, zeta, &C, &dCdcsi, &dCdzeta); dzetadd[0] = (1.0 - zeta)/dens; /*OK*/ dzetadd[1] = -(1.0 + zeta)/dens; /*OK*/ dcsidd [0] = 0.5*csi*(-2*sigma[1]*rho[1]+2*sigma[2]*rho[0])/num - 7./3.*csi/dens; /*OK*/ dcsidd [1] = 0.5*csi*(-2*sigma[1]*rho[0]+2*sigma[0]*rho[1])/num - 7./3.*csi/dens; /*OK*/ dcsidsigma[0]= csi*pow(rho[1],2)/(2*num); /*OK*/ dcsidsigma[1]= -csi*rho[0]*rho[1]/num; /*OK*/ dcsidsigma[2]= csi*pow(rho[0],2)/(2*num); /*OK*/ } aux = (densp[0] * max(e_PBEup, e_PBE) + densp[1] * max(e_PBEdn, e_PBE)) / dens; double dauxdd[2], dauxdsigma[3]; if(e_PBEup > e_PBE) { //case densp[0] * e_PBEup dauxdd[0] = de_PBEddup[0]; dauxdd[1] = 0.0; dauxdsigma[0] = de_PBEdsigmaup[0]; dauxdsigma[1] = 0.0; dauxdsigma[2] = 0.0; }else{ //case densp[0] * e_PBE dauxdd[0] = densp[0] / dens * (de_PBEdd[0] - e_PBE) + e_PBE; dauxdd[1] = densp[0] / dens * (de_PBEdd[1] - e_PBE); dauxdsigma[0] = densp[0] / dens * de_PBEdsigma[0]; dauxdsigma[1] = densp[0] / dens * de_PBEdsigma[1]; dauxdsigma[2] = densp[0] / dens * de_PBEdsigma[2]; } if(e_PBEdn > e_PBE) {//case densp[1] * e_PBEdn dauxdd[0] += 0.0; dauxdd[1] += de_PBEdddn[0]; dauxdsigma[0] += 0.0; dauxdsigma[1] += 0.0; dauxdsigma[2] += de_PBEdsigmadn[0]; }else{//case densp[1] * e_PBE dauxdd[0] += densp[1] / dens * (de_PBEdd[0] - e_PBE); dauxdd[1] += densp[1] / dens * (de_PBEdd[1] - e_PBE) + e_PBE; dauxdsigma[0] += densp[1] / dens * de_PBEdsigma[0]; dauxdsigma[1] += densp[1] / dens * de_PBEdsigma[1]; dauxdsigma[2] += densp[1] / dens * de_PBEdsigma[2]; } zsq=z*z; *e_PKZB = (e_PBE*(1.0 + C * zsq) - (1.0 + C) * zsq * aux); *de_PKZBdz = dens * e_PBE * C * 2*z - dens * (1.0 + C) * 2*z * aux; /*? think ok*/ double dCdd[2]; dCdd[0] = dCdzeta*dzetadd[0] + dCdcsi*dcsidd[0]; /*OK*/ dCdd[1] = dCdzeta*dzetadd[1] + dCdcsi*dcsidd[1]; /*OK*/ /* partial derivatives*/ de_PKZBdd[0] = de_PBEdd[0] * (1.0 + C*zsq) + dens * e_PBE * dCdd[0] * zsq - zsq * (dens*dCdd[0] * aux + (1.0 + C) * dauxdd[0]); de_PKZBdd[1] = de_PBEdd[1] * (1.0 + C*zsq) + dens * e_PBE * dCdd[1] * zsq - zsq * (dens*dCdd[1] * aux + (1.0 + C) * dauxdd[1]); int nder = (p->common.nspin==XC_UNPOLARIZED) ? 1 : 3; for(i=0; icommon.nspin==XC_UNPOLARIZED) dauxdsigma[i] /= 2.; double dCdsigma[i]; dCdsigma[i]= dCdcsi*dcsidsigma[i]; /* partial derivatives*/ de_PKZBdsigma[i] = de_PBEdsigma[i] * (1.0 + C * zsq) + dens * e_PBE * dCdsigma[i] * zsq - zsq * (dens * dCdsigma[i] * aux + (1.0 + C) * dauxdsigma[i]); } } static void XC(mgga_c_revtpss)(void *par, const double *rho, const double *sigmatmp, const double *tau, double *energy, double *dedd, double *vsigma, double *dedtau) { double sigma[3]; revtpss_params *p = (revtpss_params*)par; double dens, zeta, grad; double tautr, taut, tauw, z; double e_PKZB, de_PKZBdd[2], de_PKZBdsigma[3], de_PKZBdz; int i, is; sigma[0] = sigmatmp[0]; sigma[1] = 0.0; sigma[2] = 0.0; zeta = (rho[0]-rho[1])/(rho[0]+rho[1]); dens = rho[0]; tautr = tau[0]; grad = sigma[0]; if(p->common.nspin == XC_POLARIZED) { dens += rho[1]; tautr += tau[1]; sigma[1] = sigmatmp[1]; sigma[2] = sigmatmp[2]; grad += (2*sigma[1] + sigma[2]); } grad = max(MIN_GRAD*MIN_GRAD, grad); tauw = max(grad/(8.0*dens), 1.0e-12); taut = max(tautr, tauw); z = tauw/taut; sigma[0] = max(MIN_GRAD*MIN_GRAD, sigma[0]); if(p->common.nspin == XC_POLARIZED) { //sigma[1] = max(MIN_GRAD*MIN_GRAD, sigma[1]); sigma[2] = max(MIN_GRAD*MIN_GRAD, sigma[2]); } /* Equation (12) */ c_revtpss_12(p, rho, sigma, dens, zeta, z, &e_PKZB, de_PKZBdd, de_PKZBdsigma, &de_PKZBdz); /* Equation (11) */ { double z2 = z*z, z3 = z2*z; double dedz; double dzdd[2], dzdsigma[3], dzdtau; if(tauw >= tautr || fabs(tauw- tautr)< 1.0e-10){ dzdtau = 0.0; dzdd[0] = 0.0; dzdd[1] = 0.0; dzdsigma[0] = 0.0; dzdsigma[1] = 0.0; dzdsigma[2] = 0.0; }else{ dzdtau = -z/taut; dzdd[0] = - z/dens; dzdd[1] = 0.0; if (p->common.nspin == XC_POLARIZED) dzdd[1] = - z/dens; dzdsigma[0] = 1.0/(8*dens*taut); dzdsigma[1] = 0.0; dzdsigma[2] = 0.0; if (p->common.nspin == XC_POLARIZED) { dzdsigma[1] = 2.0/(8*dens*taut); dzdsigma[2] = 1.0/(8*dens*taut); } } *energy = e_PKZB * (1.0 + d*e_PKZB*z3); /* due to the definition of na and nb in libxc.c we need to divide by (na+nb) to recover the * same energy for polarized and unpolarized calculation with the same total density */ if(p->common.nspin == XC_UNPOLARIZED) *energy *= dens/(rho[0]+rho[1]); dedz = de_PKZBdz*(1.0 + 2.0*d*e_PKZB*z3) + dens*e_PKZB * e_PKZB * d * 3.0*z2; for(is=0; iscommon.nspin; is++){ dedd[is] = de_PKZBdd[is] * (1.0 + 2.0*d*e_PKZB*z3) + dedz*dzdd[is] - e_PKZB*e_PKZB * d * z3; /*OK*/ dedtau[is] = dedz * dzdtau; /*OK*/ } int nder = (p->common.nspin==XC_UNPOLARIZED) ? 1 : 3; for(i=0; ix_aux, np, rho, &exunif, &vxunif); /* calculate |nabla rho|^2 */ gdms = max(MIN_GRAD*MIN_GRAD, sigma); /* Eq. (4) */ p = gdms/(4.0*pow(3*M_PI*M_PI, 2.0/3.0)*pow(rho[0], 8.0/3.0)); dpdd = -(8.0/3.0)*p/rho[0]; dpdsigma= 1/(4.0*pow(3*M_PI*M_PI, 2.0/3.0)*pow(rho[0], 8.0/3.0)); /* von Weisaecker kinetic energy density */ tauw = max(gdms/(8.0*rho[0]), 1.0e-12); tau = max(tau_, tauw); tau_lsda = aux * pow(rho[0],5./3.); dtau_lsdadd = aux * 5./3.* pow(rho[0],2./3.); alpha = (tau - tauw)/tau_lsda; if(fabs(tauw-tau_)< 1.0e-10){ dalphadsigma = 0.0; dalphadtau = 0.0; dalphadd = 0.0; }else{ dalphadtau = 1./tau_lsda; dalphadsigma = -1./(tau_lsda*8.0*rho[0]); dalphadd = (tauw/rho[0]* tau_lsda - (tau - tauw) * dtau_lsdadd)/ pow(tau_lsda,2.); } /* get Eq. (10) */ x_revtpss_10(p, alpha, &x, &dxdp, &dxdalpha); { /* Eq. (5) */ double a = kappa/(kappa + x); Fx = 1.0 + kappa*(1.0 - a); dFxdx = a*a; } { /* Eq. (3) */ *energy = exunif*Fx*rho[0]; //printf("Ex %.9e\n", *energy); /* exunif is en per particle already so we multiply by n the terms with exunif*/ *dedd = vxunif*Fx + exunif*dFxdx*rho[0]*(dxdp*dpdd + dxdalpha*dalphadd); *vsigma = exunif*dFxdx*rho[0]*(dxdp*dpdsigma + dxdalpha*dalphadsigma); *dedtau = exunif*dFxdx*rho[0]*(dxdalpha*dalphadtau); } } void XC(mgga_x_revtpss)(void *par, const double *rho, const double *sigma, const double *tau, double *e, double *dedd, double *vsigma, double *dedtau) { revtpss_params *p = (revtpss_params*)par; if(p->common.nspin == XC_UNPOLARIZED){ double en; x_revtpss_para(p, rho, sigma[0], tau[0], &en, dedd, vsigma, dedtau); *e = en/(rho[0]+rho[1]); }else{ /* The spin polarized version is handle using the exact spin scaling Ex[n1, n2] = (Ex[2*n1] + Ex[2*n2])/2 */ *e = 0.0; double e2na, e2nb, rhoa[2], rhob[2]; double vsigmapart[3]; rhoa[0]=2*rho[0]; rhoa[1]=0.0; rhob[0]=2*rho[1]; rhob[1]=0.0; x_revtpss_para(p, rhoa, 4*sigma[0], 2.0*tau[0], &e2na, &(dedd[0]), &(vsigmapart[0]), &(dedtau[0])); x_revtpss_para(p, rhob, 4*sigma[2], 2.0*tau[1], &e2nb, &(dedd[1]), &(vsigmapart[2]), &(dedtau[1])); *e = (e2na + e2nb )/(2.*(rho[0]+rho[1])); vsigma[0] = 2*vsigmapart[0]; vsigma[2] = 2*vsigmapart[2]; } } static void revtpss_init(void *p) { revtpss_params *par = (revtpss_params*)p; par->x_aux = (XC(func_type) *) malloc(sizeof(XC(func_type))); XC(func_init)(par->x_aux, XC_LDA_X, XC_UNPOLARIZED); XC(func_init)(&par->c_aux1, XC_LDA_C_PW_MOD, par->common.nspin); XC(func_init)(&par->c_aux2, XC_LDA_C_PW_MOD, XC_POLARIZED); } static void revtpss_end(void *p) { revtpss_params *par = (revtpss_params*)p; XC(func_end)(par->x_aux); free(par->x_aux); XC(func_end)(&par->c_aux1); XC(func_end)(&par->c_aux2); } const mgga_func_info revtpss_info = { sizeof(revtpss_params), &revtpss_init, &revtpss_end, &XC(mgga_x_revtpss), &XC(mgga_c_revtpss) }; gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/revtpss_c_pbe.c000066400000000000000000000340631316441372200237700ustar00rootroot00000000000000 #include #include #include #include #include #include "xc_mgga.h" /************************************************************************ Implements Perdew, Burke & Ernzerhof Generalized Gradient Approximation correlation functional. I based this implementation on a routine from L.C. Balbas and J.M. Soler ************************************************************************/ // from old libxc util.h #define RS(x) (pow((3.0/(4*M_PI*x)), 1.0/3.0)) typedef struct XC(perdew_t) { int nspin; double dens, zeta, gdmt; double ecunif, vcunif[2], fcunif[3]; double rs, kf, ks, phi, t; double drs, dkf, dks, dphi, dt, decunif; double d2rs2, d2rskf, d2rsks, d2rsphi, d2rst, d2rsecunif; double d2kf2, d2kfks, d2kfphi, d2kft, d2kfecunif; double d2ks2, d2ksphi, d2kst, d2ksecunif; double d2phi2, d2phit, d2phiecunif; double d2t2, d2tecunif; double d2ecunif2; } XC(perdew_t); // from old libxc util.c /* this function converts the spin-density into total density and relative magnetization */ inline void XC(rho2dzeta)(int nspin, const double *rho, double *d, double *zeta) { assert(nspin==XC_UNPOLARIZED || nspin==XC_POLARIZED); if(nspin==XC_UNPOLARIZED){ *d = max(MIN_DENS, rho[0]); *zeta = 0.0; }else{ *d = max(MIN_DENS, rho[0]+rho[1]); *zeta = (*d > MIN_DENS) ? (rho[0]-rho[1])/(*d) : 0.0; } } // from old libxc gga_perdew.c static void XC(perdew_params)(const XC(func_type) *gga_p, const double *rho, const double *sigma, int order, XC(perdew_t) *pt) { pt->nspin = gga_p->nspin; XC(rho2dzeta)(pt->nspin, rho, &(pt->dens), &(pt->zeta)); const int np = 1; switch (order){ case 0: XC(lda_exc) (gga_p, np, rho, &(pt->ecunif)); break; case 1: XC(lda_exc_vxc)(gga_p, np, rho, &(pt->ecunif), pt->vcunif); break; case 2: XC(lda)(gga_p, np, rho, &(pt->ecunif), pt->vcunif, pt->fcunif, NULL); break; } pt->rs = RS(pt->dens); pt->kf = pow(3.0*M_PI*M_PI*pt->dens, 1.0/3.0); pt->ks = sqrt(4.0*pt->kf/M_PI); /* phi is bounded between 2^(-1/3) and 1 */ pt->phi = 0.5*(pow(1.0 + pt->zeta, 2.0/3.0) + pow(1.0 - pt->zeta, 2.0/3.0)); /* get gdmt = |nabla n| */ pt->gdmt = sigma[0]; if(pt->nspin == XC_POLARIZED) pt->gdmt += 2.0*sigma[1] + sigma[2]; if(pt->gdmt < MIN_GRAD*MIN_GRAD) pt->gdmt = MIN_GRAD*MIN_GRAD; pt->gdmt = sqrt(pt->gdmt); pt->t = pt->gdmt/(2.0 * pt->phi * pt->ks * pt->dens); if(order > 0) pt->drs = pt->dkf = pt->dks = pt->dphi = pt->dt = pt->decunif = 0.0; if(order > 1){ pt->d2rs2 = pt->d2rskf = pt->d2rsks = pt->d2rsphi = pt->d2rst = pt->d2rsecunif = 0.0; pt->d2kf2 = pt->d2kfks = pt->d2kfphi = pt->d2kft = pt->d2kfecunif = 0.0; pt->d2ks2 = pt->d2ksphi = pt->d2kst = pt->d2ksecunif = 0.0; pt->d2phi2 = pt->d2phit = pt->d2phiecunif = 0.0; pt->d2t2 = pt->d2tecunif = 0.0; pt->d2ecunif2 = 0.0; } } static void XC(perdew_potentials)(XC(perdew_t) *pt, const double *rho, double e_gga, int order, double *vrho, double *vsigma, double *v2rho2, double *v2rhosigma, double *v2sigma2) { /* alpha = {0->rs, 1->kf, 2->ks, 3->phi, 4->t, 5->ec */ double dalphadd[6][2], dFdalpha[6]; double d2alphadd2[6][3], d2Fdalpha2[6][6]; double dzdd[2], dpdz, d2zdd2[3], d2pdz2; double dtdsig, d2tdsig2; int is, js, ks, ns; if(order < 1) return; if(pt->nspin == XC_POLARIZED){ dpdz = 0.0; if(fabs(1.0 + pt->zeta) >= MIN_DENS) dpdz += 1.0/(3.0*pow(1.0 + pt->zeta, 1.0/3.0)); if(fabs(1.0 - pt->zeta) >= MIN_DENS) dpdz -= 1.0/(3.0*pow(1.0 - pt->zeta, 1.0/3.0)); dzdd[0] = (1.0 - pt->zeta)/pt->dens; dzdd[1] = -(1.0 + pt->zeta)/pt->dens; }else{ dpdz = 0.0; dzdd[0] = 0.0; } dFdalpha[0] = pt->drs; dFdalpha[1] = pt->dkf; dFdalpha[2] = pt->dks; dFdalpha[3] = pt->dphi; dFdalpha[4] = pt->dt; dFdalpha[5] = pt->decunif; for(is=0; isnspin; is++){ dalphadd[0][is] = -pt->rs/(3.0*pt->dens); dalphadd[1][is] = pt->kf/(3.0*pt->dens); dalphadd[2][is] = pt->ks*dalphadd[1][is]/(2.0*pt->kf); dalphadd[3][is] = dpdz*dzdd[is]; dalphadd[4][is] = -pt->t*(1.0/pt->dens + dalphadd[2][is]/pt->ks + dalphadd[3][is]/pt->phi);; dalphadd[5][is] = (pt->vcunif[is] - pt->ecunif)/pt->dens; } /* calculate vrho */ if(vrho != NULL) for(is=0; isnspin; is++){ if(rho[is] > MIN_DENS){ int k; vrho[is] = e_gga; for(k=0; k<6; k++) vrho[is] += pt->dens * dFdalpha[k]*dalphadd[k][is]; }else{ vrho[is] = 0.0; } } dtdsig = pt->t/(2.0*pt->gdmt*pt->gdmt); if(vrho != NULL){ /* calculate now vsigma */ vsigma[0] = pt->dens*pt->dt*dtdsig; if(pt->nspin == XC_POLARIZED){ vsigma[1] = 2.0*vsigma[0]; vsigma[2] = vsigma[0]; } } if(order < 2) return; /* first let us sort d2Fdalpha2 in a matrix format */ d2Fdalpha2[0][0] = pt->d2rs2; d2Fdalpha2[0][1] = pt->d2rskf; d2Fdalpha2[0][2] = pt->d2rsks; d2Fdalpha2[0][3] = pt->d2rst; d2Fdalpha2[0][4] = pt->d2rsphi; d2Fdalpha2[0][5] = pt->d2rsecunif; d2Fdalpha2[1][0] = d2Fdalpha2[0][1]; d2Fdalpha2[1][1] = pt->d2kf2; d2Fdalpha2[1][2] = pt->d2kfks; d2Fdalpha2[1][3] = pt->d2kft; d2Fdalpha2[1][4] = pt->d2kfphi; d2Fdalpha2[1][5] = pt->d2kfecunif; d2Fdalpha2[2][0] = d2Fdalpha2[0][2]; d2Fdalpha2[2][1] = d2Fdalpha2[1][2]; d2Fdalpha2[2][2] = pt->d2ks2; d2Fdalpha2[2][3] = pt->d2kst; d2Fdalpha2[2][4] = pt->d2ksphi; d2Fdalpha2[2][5] = pt->d2ksecunif; d2Fdalpha2[3][0] = d2Fdalpha2[0][3]; d2Fdalpha2[3][1] = d2Fdalpha2[1][3]; d2Fdalpha2[3][2] = d2Fdalpha2[2][3]; d2Fdalpha2[3][3] = pt->d2phi2; d2Fdalpha2[3][4] = pt->d2phit; d2Fdalpha2[3][5] = pt->d2phiecunif; d2Fdalpha2[4][0] = d2Fdalpha2[0][4]; d2Fdalpha2[4][1] = d2Fdalpha2[1][4]; d2Fdalpha2[4][2] = d2Fdalpha2[2][4]; d2Fdalpha2[4][3] = d2Fdalpha2[3][4]; d2Fdalpha2[4][4] = pt->d2t2; d2Fdalpha2[4][5] = pt->d2tecunif; d2Fdalpha2[5][0] = d2Fdalpha2[0][5]; d2Fdalpha2[5][1] = d2Fdalpha2[1][5]; d2Fdalpha2[5][2] = d2Fdalpha2[2][5]; d2Fdalpha2[5][3] = d2Fdalpha2[3][5]; d2Fdalpha2[5][4] = d2Fdalpha2[4][5]; d2Fdalpha2[5][5] = pt->d2ecunif2; /* now we sort d2alphadd2 */ if(pt->nspin == XC_POLARIZED){ d2pdz2 = 0.0; if(fabs(1.0 + pt->zeta) >= MIN_DENS) d2pdz2 += -(1.0/9.0)*pow(1.0 + pt->zeta, -4.0/3.0); if(fabs(1.0 - pt->zeta) >= MIN_DENS) d2pdz2 += -(1.0/9.0)*pow(1.0 - pt->zeta, -4.0/3.0); d2zdd2[0] = -2.0*dzdd[0]/pt->dens; d2zdd2[1] = 2.0*pt->zeta/(pt->dens*pt->dens); d2zdd2[2] = -2.0*dzdd[1]/pt->dens; }else{ d2pdz2 = 0.0; d2zdd2[0] = 0.0; } ns = (pt->nspin == XC_UNPOLARIZED) ? 0 : 2; for(ks=0; ks<=ns; ks++){ is = (ks == 0 || ks == 1) ? 0 : 1; js = (ks == 0 ) ? 0 : 1; d2alphadd2[0][ks] = 4.0/9.0*pt->rs/(pt->dens*pt->dens); d2alphadd2[1][ks] = -2.0/9.0*pt->kf/(pt->dens*pt->dens); d2alphadd2[2][ks] = pt->ks/(2.0*pt->kf)* (d2alphadd2[1][ks] - dalphadd[1][is]*dalphadd[1][js]/(2.0*pt->kf)); d2alphadd2[3][ks] = d2pdz2*dzdd[is]*dzdd[js] + dpdz*d2zdd2[ks]; d2alphadd2[4][ks] = pt->t * (+2.0/(pt->dens*pt->dens) +2.0/(pt->ks*pt->ks) *(dalphadd[2][is] * dalphadd[2][js]) +2.0/(pt->phi*pt->phi) *(dalphadd[3][is] * dalphadd[3][js]) +1.0/(pt->dens*pt->ks) *(dalphadd[2][is] + dalphadd[2][js]) +1.0/(pt->dens*pt->phi)*(dalphadd[3][is] + dalphadd[3][js]) +1.0/(pt->ks*pt->phi) *(dalphadd[2][is]*dalphadd[3][js] + dalphadd[2][js]*dalphadd[3][is]) -1.0/(pt->ks)*d2alphadd2[2][ks] -1.0/(pt->phi)*d2alphadd2[3][ks]); d2alphadd2[5][ks] = pt->fcunif[ks]/pt->dens - (pt->vcunif[is] + pt->vcunif[js] - 2.0*pt->ecunif)/(pt->dens*pt->dens); } for(ks=0; ks<=ns; ks++){ int j, k; is = (ks == 0 || ks == 1) ? 0 : 1; js = (ks == 0 ) ? 0 : 1; v2rho2[ks] = 0.0; for(j=0; j<6; j++){ v2rho2[ks] += dFdalpha[j]*(dalphadd[j][is] + dalphadd[j][js]); v2rho2[ks] += pt->dens * dFdalpha[j]*d2alphadd2[j][ks]; for(k=0; k<6; k++) v2rho2[ks] += pt->dens * d2Fdalpha2[j][k]*dalphadd[j][is]*dalphadd[k][js]; } } /* now we handle v2rhosigma */ for(is=0; isnspin; is++){ int j; ks = (is == 0) ? 0 : 5; v2rhosigma[ks] = dFdalpha[4]*dtdsig; for(j=0; j<6; j++) v2rhosigma[ks] += pt->dens * d2Fdalpha2[4][j]*dalphadd[j][is]*dtdsig; v2rhosigma[ks] += pt->dens * dFdalpha[4]*dalphadd[4][is]/(2.0*pt->gdmt*pt->gdmt); } if(pt->nspin == XC_POLARIZED){ v2rhosigma[1] = 2.0*v2rhosigma[0]; v2rhosigma[2] = v2rhosigma[0]; v2rhosigma[3] = v2rhosigma[5]; v2rhosigma[4] = 2.0*v2rhosigma[5]; } /* now wwe take care of v2sigma2 */ d2tdsig2 = -dtdsig/(2.0*pt->gdmt*pt->gdmt); v2sigma2[0] = pt->dens*(pt->d2t2*dtdsig*dtdsig + pt->dt*d2tdsig2); if(pt->nspin == XC_POLARIZED){ v2sigma2[1] = 2.0*v2sigma2[0]; /* aa_ab */ v2sigma2[2] = v2sigma2[0]; /* aa_bb */ v2sigma2[3] = 4.0*v2sigma2[0]; /* ab_ab */ v2sigma2[4] = 2.0*v2sigma2[0]; /* ab_bb */ v2sigma2[5] = v2sigma2[0]; /* bb_bb */ } } // from old libxc gga_c_pbe.c static const double beta[4] = { 0.06672455060314922, /* original PBE */ 0.046, /* PBE sol */ 0.089809, 0.06672455060314922 /* PBE for revTPSS */ }; static double gamm[4]; static inline void pbe_eq8(int func, int order, double rs, double ecunif, double phi, double *A, double *dec, double *dphi, double *drs, double *dec2, double *decphi, double *dphi2) { double phi3, f1, df1dphi, d2f1dphi2, f2, f3, dx, d2x; phi3 = pow(phi, 3); f1 = ecunif/(gamm[func]*phi3); f2 = exp(-f1); f3 = f2 - 1.0; *A = beta[func]/(gamm[func]*f3); if(func == 3) *A *= (1. + 0.1*rs)/(1. + 0.1778*rs); if(order < 1) return; df1dphi = -3.0*f1/phi; dx = (*A)*f2/f3; *dec = dx/(gamm[func]*phi3); *dphi = dx*df1dphi; *drs = 0.0; if(func == 3) *drs = beta[func]*((0.1-0.1778)/pow(1+0.1778*rs,2))/(gamm[func]*f3); if(func ==3) return; if(order < 2) return; d2f1dphi2 = -4.0*df1dphi/phi; d2x = dx*(2.0*f2 - f3)/f3; *dphi2 = d2x*df1dphi*df1dphi + dx*d2f1dphi2; *decphi = (d2x*df1dphi*f1 + dx*df1dphi)/ecunif; *dec2 = d2x/(gamm[func]*gamm[func]*phi3*phi3); } static void pbe_eq7(int func, int order, double rs, double phi, double t, double A, double *H, double *dphi, double *drs, double *dt, double *dA, double *d2phi, double *d2phit, double *d2phiA, double *d2t2, double *d2tA, double *d2A2) { double t2, phi3, f1, f2, f3; double df1dt, df2drs, df2dt, df1dA, df2dA; double d2f1dt2, d2f2dt2, d2f2dA2, d2f1dtA, d2f2dtA; t2 = t*t; phi3 = pow(phi, 3); f1 = t2 + A*t2*t2; f3 = 1.0 + A*f1; f2 = beta[func]*f1/(gamm[func]*f3); if(func == 3) f2 *= (1. + 0.1*rs)/(1. + 0.1778*rs); *H = gamm[func]*phi3*log(1.0 + f2); if(order < 1) return; *dphi = 3.0*(*H)/phi; df1dt = t*(2.0 + 4.0*A*t2); df2dt = beta[func]/(gamm[func]*f3*f3) * df1dt; if(func == 3) df2dt*=(1. + 0.1*rs)/(1. + 0.1778*rs); *dt = gamm[func]*phi3*df2dt/(1.0 + f2); df1dA = t2*t2; df2dA = beta[func]/(gamm[func]*f3*f3) * (df1dA - f1*f1); if(func == 3) df2dA *= (1. + 0.1*rs)/(1. + 0.1778*rs); *dA = gamm[func]*phi3*df2dA/(1.0 + f2); df2drs = 0.0; *drs = 0.0; if(func == 3){ df2drs = beta[func]*((0.1-0.1778)/pow(1+0.1778*rs,2))*f1/(gamm[func]*f3); *drs = gamm[func]*phi3*df2drs/(1.0 + f2); } if(func ==3) return; if(order < 2) return; *d2phi = 2.0*(*dphi)/phi; *d2phit = 3.0*(*dt)/phi; *d2phiA = 3.0*(*dA)/phi; d2f1dt2 = 2.0 + 4.0*3.0*A*t2; d2f2dt2 = beta[func]/(gamm[func]*f3*f3) * (d2f1dt2 - 2.0*A/f3*df1dt*df1dt); *d2t2 = gamm[func]*phi3*(d2f2dt2*(1.0 + f2) - df2dt*df2dt)/((1.0 + f2)*(1.0 + f2)); d2f1dtA = 4.0*t*t2; d2f2dtA = beta[func]/(gamm[func]*f3*f3) * (d2f1dtA - 2.0*df1dt*(f1 + A*df1dA)/f3); *d2tA = gamm[func]*phi3*(d2f2dtA*(1.0 + f2) - df2dt*df2dA)/((1.0 + f2)*(1.0 + f2)); d2f2dA2 = beta[func]/(gamm[func]*f3*f3*f3) *(-2.0)*(2.0*f1*df1dA - f1*f1*f1 + A*df1dA*df1dA); *d2A2 = gamm[func]*phi3*(d2f2dA2*(1.0 + f2) - df2dA*df2dA)/((1.0 + f2)*(1.0 + f2)); } void gga_c_pbe_revtpss(XC(func_type) *p, const double *rho, const double *sigma, double *e, double *vrho, double *vsigma, double *v2rho2, double *v2rhosigma, double *v2sigma2) { gamm[0] = gamm[1] = gamm[3] = (1.0 - log(2.0))/(M_PI*M_PI); XC(perdew_t) pt; int func, order; double me; double A, dAdec, dAdphi, dAdrs, d2Adec2, d2Adecphi, d2Adphi2; double H, dHdphi, dHdrs, dHdt, dHdA, d2Hdphi2, d2Hdphit, d2HdphiA, d2Hdt2, d2HdtA, d2HdA2; d2HdphiA = 0.0; d2Hdphi2 = 0.0; d2Adphi2 = 0.0; d2HdA2 = 0.0; d2HdtA = 0.0; d2Hdphit = 0.0; d2Adecphi = 0.0; d2Hdt2 = 0.0; d2Adec2 = 0.0; dAdrs = 0.0; dAdphi = 0.0; dAdec = 0.0; dHdA = 0.0; dHdt = 0.0; dHdrs = 0.0; dHdphi = 0.0; func = 3; // for revTPSS order = 0; if(vrho != NULL) order = 1; if(v2rho2 != NULL) order = 2; XC(perdew_params)(p, rho, sigma, order, &pt); pbe_eq8(func, order, pt.rs, pt.ecunif, pt.phi, &A, &dAdec, &dAdphi, &dAdrs, &d2Adec2, &d2Adecphi, &d2Adphi2); pbe_eq7(func, order, pt.rs, pt.phi, pt.t, A, &H, &dHdphi, &dHdrs, &dHdt, &dHdA, &d2Hdphi2, &d2Hdphit, &d2HdphiA, &d2Hdt2, &d2HdtA, &d2HdA2); me = pt.ecunif + H; if(e != NULL) *e = me; if(order >= 1){ pt.dphi = dHdphi + dHdA*dAdphi; pt.drs = dHdrs + dHdA*dAdrs; pt.dt = dHdt; pt.decunif = 1.0 + dHdA*dAdec; } if(order >= 2){ pt.d2phi2 = d2Hdphi2 + 2.0*d2HdphiA*dAdphi + dHdA*d2Adphi2 + d2HdA2*dAdphi*dAdphi; pt.d2phit = d2Hdphit + d2HdtA*dAdphi; pt.d2phiecunif = d2HdphiA*dAdec + d2HdA2*dAdphi*dAdec + dHdA*d2Adecphi; pt.d2t2 = d2Hdt2; pt.d2tecunif = d2HdtA*dAdec; pt.d2ecunif2 = d2HdA2*dAdec*dAdec + dHdA*d2Adec2; } XC(perdew_potentials)(&pt, rho, me, order, vrho, vsigma, v2rho2, v2rhosigma, v2sigma2); } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/rpbe.c000066400000000000000000000013141316441372200220530ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Please see the accompanying LICENSE file for further information. */ #include #include "xc_gpaw.h" double rpbe_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2) { double e = C1 / rs; *dedrs = -e / rs; if (par->gga) // not really needed? XXX { double c = C2 * rs / n; c *= c; double s2 = a2 * c; double x = exp(-MU * s2 / 0.804); double Fx = 1.0 + 0.804 * (1 - x); double dFxds2 = MU * x; double ds2drs = 8.0 * c * a2 / rs; *dedrs = *dedrs * Fx + e * dFxds2 * ds2drs; *deda2 = e * dFxds2 * c; e *= Fx; } return e; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/tpss.c000066400000000000000000000372361316441372200221300ustar00rootroot00000000000000/************************************************************************ Implements Perdew, Tao, Staroverov & Scuseria meta-Generalized Gradient Approximation. Exchange part ************************************************************************/ #include #include #include #include "xc_mgga.h" typedef struct tpss_params { common_params common; // needs to be at the beginning of every functional_params XC(func_type) *x_aux; XC(func_type) *c_aux1; XC(func_type) *c_aux2; } tpss_params; /* some parameters */ static double b=0.40, c=1.59096, e=1.537, kappa=0.804, mu=0.21951; /* This is Equation (7) from the paper and its derivatives */ static void x_tpss_7(double p, double alpha, double *qb, double *dqbdp, double *dqbdalpha) { /* Eq. (7) */ double a = sqrt(1.0 + b*alpha*(alpha-1.0)), h = 9.0/20.0; *qb = h*(alpha - 1.0)/a + 2.0*p/3.0; *dqbdp = 2.0/3.0; *dqbdalpha = h*(1.0 + 0.5*b*(alpha-1.0))/pow(a, 3); } /* Equation (10) in all it's glory */ static void x_tpss_10(double p, double alpha, double *x, double *dxdp, double *dxdalpha) { double x1, dxdp1, dxdalpha1; double aux1, ap, apsr, p2; double qb, dqbdp, dqbdalpha; /* Equation 7 */ x_tpss_7(p, alpha, &qb, &dqbdp, &dqbdalpha); p2 = p*p; aux1 = 10.0/81.0; ap = (3*alpha + 5*p)*(3*alpha + 5*p); apsr = (3*alpha + 5*p); /* first we handle the numerator */ x1 = 0.0; dxdp1 = 0.0; dxdalpha1 = 0.0; { /* first term */ double a = (9*alpha*alpha+30*alpha*p+50*p2), a2 = a*a; x1 += aux1*p + 25*c*p2*p*ap/a2; dxdp1 += aux1 + ((3*225*c*p2*alpha*alpha+ 4*750*c*p*p2*alpha + 5*625*c*p2*p2)*a2 - 25*c*p2*p*ap*2*a*(30*alpha+50*2*p))/(a2*a2); dxdalpha1 += ((225*c*p*p2*2*alpha + 750*c*p2*p2)*a2 - 25*c*p2*p*ap*2*a*(9*2*alpha+30*p))/(a2*a2); } { /* second term */ double a = 146.0/2025.0*qb; x1 += a*qb; dxdp1 += 2.0*a*dqbdp; dxdalpha1 += 2.0*a*dqbdalpha; } { /* third term */ double h = 73.0/(405*sqrt(2.0)); x1 += -h*qb*p/apsr * sqrt(ap+9); dxdp1 += -h * qb *((3*alpha)/ap * sqrt(ap+9) + p/apsr * 1./2. * pow(ap+9,-1./2.)* 2*apsr*5) - h*p/apsr*sqrt(ap+9)*dqbdp; dxdalpha1 += -h*qb*( (-1)*p*3/ap * sqrt(ap+9) + p/apsr * 1./2. * pow(ap+9,-1./2.)* 2*apsr*3) - h*p/apsr*sqrt(ap+9)*dqbdalpha; } { /* forth term */ double a = aux1*aux1/kappa; x1 += a*p2; dxdp1 += a*2.0*p; dxdalpha1 += 0.0; } { /* fifth term */ x1 += 20*sqrt(e)*p2/(9*ap); dxdp1 += 20*sqrt(e)/9*(2*p*ap-p2*2*(3*alpha + 5*p)*5)/(ap*ap); dxdalpha1 +=-20*2*sqrt(e)/3*p2/(ap*(3*alpha + 5*p)); } { /* sixth term */ double a = e*mu; x1 += a*p*p2; dxdp1 += a*3.0*p2; dxdalpha1 += 0.0; } /* and now the denominator */ { double a = 1.0+sqrt(e)*p, a2 = a*a; *x = x1/a2; *dxdp = (dxdp1*a - 2.0*sqrt(e)*x1)/(a2*a); *dxdalpha = dxdalpha1/a2; } } static void x_tpss_para(XC(func_type) *lda_aux, const double *rho, const double sigma, const double tau_, double *energy, double *dedd, double *vsigma, double *dedtau) { double gdms, p, tau, tauw; double x, dxdp, dxdalpha, Fx, dFxdx; double tau_lsda, exunif, vxunif, dtau_lsdadd; double dpdd, dpdsigma; double alpha, dalphadd, dalphadsigma, dalphadtau; double aux = (3./10.) * pow((3*M_PI*M_PI),2./3.); /* get the uniform gas energy and potential */ const int np = 1; XC(lda_exc_vxc)(lda_aux, np, rho, &exunif, &vxunif); /* calculate |nabla rho|^2 */ gdms = max(MIN_GRAD*MIN_GRAD, sigma); /* Eq. (4) */ p = gdms/(4.0*pow(3*M_PI*M_PI, 2.0/3.0)*pow(rho[0], 8.0/3.0)); dpdd = -(8.0/3.0)*p/rho[0]; dpdsigma= 1/(4.0*pow(3*M_PI*M_PI, 2.0/3.0)*pow(rho[0], 8.0/3.0)); /* von Weisaecker kinetic energy density */ tauw = max(gdms/(8.0*rho[0]), 1.0e-12); tau = max(tau_, tauw); tau_lsda = aux * pow(rho[0],5./3.); dtau_lsdadd = aux * 5./3.* pow(rho[0],2./3.); alpha = (tau - tauw)/tau_lsda; if(fabs(tauw-tau_)< 1.0e-10){ dalphadsigma = 0.0; dalphadtau = 0.0; dalphadd = 0.0; }else{ dalphadtau = 1./tau_lsda; dalphadsigma = -1./(tau_lsda*8.0*rho[0]); dalphadd = (tauw/rho[0]* tau_lsda - (tau - tauw) * dtau_lsdadd)/ pow(tau_lsda,2.); } /* get Eq. (10) */ x_tpss_10(p, alpha, &x, &dxdp, &dxdalpha); { /* Eq. (5) */ double a = kappa/(kappa + x); Fx = 1.0 + kappa*(1.0 - a); dFxdx = a*a; } { /* Eq. (3) */ *energy = exunif*Fx*rho[0]; /* exunif is en per particle already so we multiply by n the terms with exunif*/ *dedd = vxunif*Fx + exunif*dFxdx*rho[0]*(dxdp*dpdd + dxdalpha*dalphadd); *vsigma = exunif*dFxdx*rho[0]*(dxdp*dpdsigma + dxdalpha*dalphadsigma); *dedtau = exunif*dFxdx*rho[0]*(dxdalpha*dalphadtau); } } static void XC(mgga_x_tpss)(void *p, const double *rho, const double *sigma, const double *tau, double *e, double *dedd, double *vsigma, double *dedtau) { tpss_params *par = (tpss_params*)p; if(par->common.nspin == XC_UNPOLARIZED){ double en; x_tpss_para(par->x_aux, rho, sigma[0], tau[0], &en, dedd, vsigma, dedtau); *e = en/(rho[0]+rho[1]); }else{ /* The spin polarized version is handle using the exact spin scaling Ex[n1, n2] = (Ex[2*n1] + Ex[2*n2])/2 */ *e = 0.0; double e2na, e2nb, rhoa[2], rhob[2]; double vsigmapart[3]; rhoa[0]=2*rho[0]; rhoa[1]=0.0; rhob[0]=2*rho[1]; rhob[1]=0.0; x_tpss_para(par->x_aux, rhoa, 4*sigma[0], 2.0*tau[0], &e2na, &(dedd[0]), &(vsigmapart[0]), &(dedtau[0])); x_tpss_para(par->x_aux, rhob, 4*sigma[2], 2.0*tau[1], &e2nb, &(dedd[1]), &(vsigmapart[2]), &(dedtau[1])); *e = (e2na + e2nb )/(2.*(rho[0]+rho[1])); vsigma[0] = 2*vsigmapart[0]; vsigma[2] = 2*vsigmapart[2]; } } /************************************************************************ Implements Perdew, Tao, Staroverov & Scuseria meta-Generalized Gradient Approximation. J. Chem. Phys. 120, 6898 (2004) http://dx.doi.org/10.1063/1.1665298 Correlation part ************************************************************************/ /* some parameters */ static double d = 2.8; /* Equation (14) */ static void c_tpss_14(double csi, double zeta, double *C, double *dCdcsi, double *dCdzeta) { double fz, C0, dC0dz, dfzdz; double z2 = zeta*zeta; /* Equation (13) */ C0 = 0.53 + z2*(0.87 + z2*(0.50 + z2*2.26)); dC0dz = zeta*(2.0*0.87 + z2*(4.0*0.5 + z2*6.0*2.26)); /*OK*/ fz = 0.5*(pow(1.0 + zeta, -4.0/3.0) + pow(1.0 - zeta, -4.0/3.0)); dfzdz = 0.5*(-4.0/3.0)*(pow(1.0 + zeta, -7.0/3.0) - pow(1.0 - zeta, -7.0/3.0)); /*OK*/ { /* Equation (14) */ double csi2 = csi*csi; double a = 1.0 + csi2*fz, a4 = pow(a, 4); *C = C0 / a4; *dCdcsi = -8.0*C0*csi*fz/(a*a4); /*added C OK*/ *dCdzeta = (dC0dz*a - C0*4.0*csi2*dfzdz)/(a*a4); /*OK*/ } } /* Equation (12) */ static void c_tpss_12(XC(func_type) *aux1, XC(func_type) *aux2, int nspin, const double *rho, const double *sigma, double dens, double zeta, double z, double *e_PKZB, double *de_PKZBdd, double *de_PKZBdsigma, double *de_PKZBdz) { /*some incoming variables: dens = rho[0] + rho[1] z = tau_w/tau zeta = (rho[0] - rho[1])/dens*/ double e_PBE, e_PBEup, e_PBEdn; double de_PBEdd[2], de_PBEdsigma[3], de_PBEddup[2], de_PBEdsigmaup[3], de_PBEdddn[2], de_PBEdsigmadn[3] ; double aux, zsq; double dzetadd[2], dcsidd[2], dcsidsigma[3]; double C, dCdcsi, dCdzeta; double densp[2], densp2[2], sigmatot[3], sigmaup[3], sigmadn[3]; int i; /*initialize dCdcsi and dCdzeta and the energy*/ dCdcsi = dCdzeta = 0.0; e_PBE = 0.0; e_PBEup = 0.0; e_PBEdn = 0.0; /* get the PBE stuff */ if(nspin== XC_UNPOLARIZED) { densp[0]=rho[0]/2.; densp[1]=rho[0]/2.; sigmatot[0] = sigma[0]/4.; sigmatot[1] = sigma[0]/4.; sigmatot[2] = sigma[0]/4.; }else{ densp[0] = rho[0]; densp[1] = rho[1]; sigmatot[0] = sigma[0]; sigmatot[1] = sigma[1]; sigmatot[2] = sigma[2]; } /* e_PBE */ XC(func_type) *auxfunc = (nspin == XC_UNPOLARIZED) ? aux2 : aux1; const int np = 1; XC(gga_exc_vxc)(auxfunc, np, densp, sigmatot, &e_PBE, de_PBEdd, de_PBEdsigma); densp2[0]=densp[0]; densp2[1]=0.0; if(nspin== XC_UNPOLARIZED) { sigmaup[0] = sigma[0]/4.; sigmaup[1] = 0.; sigmaup[2] = 0.; }else{ sigmaup[0] = sigma[0]; sigmaup[1] = 0.; sigmaup[2] = 0.; } /* e_PBE spin up */ XC(gga_exc_vxc)(auxfunc, np, densp2, sigmaup, &e_PBEup, de_PBEddup, de_PBEdsigmaup); densp2[0]=densp[1]; densp2[1]=0.0; if(nspin== XC_UNPOLARIZED) { sigmadn[0] = sigma[0]/4.; sigmadn[1] = 0.; sigmadn[2] = 0.; }else{ sigmadn[0] = sigma[2]; sigmadn[1] = 0.; sigmadn[2] = 0.; } /* e_PBE spin down */ XC(gga_exc_vxc)(auxfunc, np, densp2, sigmadn, &e_PBEdn, de_PBEdddn, de_PBEdsigmadn); /*get Eq. (13) and (14) for the polarized case*/ if(nspin == XC_UNPOLARIZED){ C = 0.53; dzetadd[0] = 0.0; dcsidd [0] = 0.0; dzetadd[1] = 0.0; dcsidd [1] = 0.0; for(i=0; i<3; i++) dcsidsigma[i] = 0.0; }else{ // initialize derivatives for(i=0; i<2; i++){ dzetadd[i] = 0.0; dcsidd [i] = 0.0;} for(i=0; i<3; i++) dcsidsigma[i] = 0.0; double num, gzeta, csi, a; /*numerator of csi: derive as grho all components and then square the 3 parts [2 (grho_a[0]n_b - grho_b[0]n_a) +2 (grho_a[1]n_b - grho_b[1]n_a) + 2 (grho_a[2]n_b - grho_b[2]n_a)]/(n_a+n_b)^2 -> 4 (sigma_aa n_b^2 - 2 sigma_ab n_a n_b + sigma_bb n_b^2)/(n_a+n_b)^2 */ num = sigma[0] * pow(rho[1],2) - 2.* sigma[1]*rho[0]*rho[1]+ sigma[2]*pow(rho[0],2); num = max(num, 1e-20); gzeta = sqrt(4*(num))/(dens*dens); gzeta = max(gzeta, MIN_GRAD); /*denominator of csi*/ a = 2*pow(3.0*M_PI*M_PI*dens, 1.0/3.0); csi = gzeta/a; c_tpss_14(csi, zeta, &C, &dCdcsi, &dCdzeta); dzetadd[0] = (1.0 - zeta)/dens; /*OK*/ dzetadd[1] = -(1.0 + zeta)/dens; /*OK*/ dcsidd [0] = 0.5*csi*(-2*sigma[1]*rho[1]+2*sigma[2]*rho[0])/num - 7./3.*csi/dens; /*OK*/ dcsidd [1] = 0.5*csi*(-2*sigma[1]*rho[0]+2*sigma[0]*rho[1])/num - 7./3.*csi/dens; /*OK*/ dcsidsigma[0]= csi*pow(rho[1],2)/(2*num); /*OK*/ dcsidsigma[1]= -csi*rho[0]*rho[1]/num; /*OK*/ dcsidsigma[2]= csi*pow(rho[0],2)/(2*num); /*OK*/ } aux = (densp[0] * max(e_PBEup, e_PBE) + densp[1] * max(e_PBEdn, e_PBE)) / dens; double dauxdd[2], dauxdsigma[3]; if(e_PBEup > e_PBE) { //case densp[0] * e_PBEup dauxdd[0] = de_PBEddup[0]; dauxdd[1] = 0.0; dauxdsigma[0] = de_PBEdsigmaup[0]; dauxdsigma[1] = 0.0; dauxdsigma[2] = 0.0; }else{ //case densp[0] * e_PBE dauxdd[0] = densp[0] / dens * (de_PBEdd[0] - e_PBE) + e_PBE; dauxdd[1] = densp[0] / dens * (de_PBEdd[1] - e_PBE); dauxdsigma[0] = densp[0] / dens * de_PBEdsigma[0]; dauxdsigma[1] = densp[0] / dens * de_PBEdsigma[1]; dauxdsigma[2] = densp[0] / dens * de_PBEdsigma[2]; } if(e_PBEdn > e_PBE) {//case densp[1] * e_PBEdn dauxdd[0] += 0.0; dauxdd[1] += de_PBEdddn[0]; dauxdsigma[0] += 0.0; dauxdsigma[1] += 0.0; dauxdsigma[2] += de_PBEdsigmadn[0]; }else{//case densp[1] * e_PBE dauxdd[0] += densp[1] / dens * (de_PBEdd[0] - e_PBE); dauxdd[1] += densp[1] / dens * (de_PBEdd[1] - e_PBE) + e_PBE; dauxdsigma[0] += densp[1] / dens * de_PBEdsigma[0]; dauxdsigma[1] += densp[1] / dens * de_PBEdsigma[1]; dauxdsigma[2] += densp[1] / dens * de_PBEdsigma[2]; } zsq=z*z; *e_PKZB = (e_PBE*(1.0 + C * zsq) - (1.0 + C) * zsq * aux); *de_PKZBdz = dens * e_PBE * C * 2*z - dens * (1.0 + C) * 2*z * aux; /*? think ok*/ double dCdd[2]; dCdd[0] = dCdzeta*dzetadd[0] + dCdcsi*dcsidd[0]; /*OK*/ dCdd[1] = dCdzeta*dzetadd[1] + dCdcsi*dcsidd[1]; /*OK*/ /* partial derivatives*/ de_PKZBdd[0] = de_PBEdd[0] * (1.0 + C*zsq) + dens * e_PBE * dCdd[0] * zsq - zsq * (dens*dCdd[0] * aux + (1.0 + C) * dauxdd[0]); de_PKZBdd[1] = de_PBEdd[1] * (1.0 + C*zsq) + dens * e_PBE * dCdd[1] * zsq - zsq * (dens*dCdd[1] * aux + (1.0 + C) * dauxdd[1]); int nder = (nspin==XC_UNPOLARIZED) ? 1 : 3; for(i=0; icommon.nspin; dens = rho[0]; tautr = tau[0]; grad = sigma[0]; if(nspin == XC_POLARIZED) { zeta = (rho[0]-rho[1])/(rho[0]+rho[1]); dens += rho[1]; tautr += tau[1]; grad += (2*sigma[1] + sigma[2]); } else zeta = 0.0; grad = max(MIN_GRAD*MIN_GRAD, grad); tauw = max(grad/(8.0*dens), 1.0e-12); taut = max(tautr, tauw); z = tauw/taut; double sigmatmp[3]; sigmatmp[0] = max(MIN_GRAD*MIN_GRAD, sigma[0]); sigmatmp[1] = 0.0; sigmatmp[2] = 0.0; if(nspin == XC_POLARIZED) { //sigma[1] = max(MIN_GRAD*MIN_GRAD, sigma[1]); sigmatmp[1] = sigma[1]; sigmatmp[2] = max(MIN_GRAD*MIN_GRAD, sigma[2]); } /* Equation (12) */ c_tpss_12(par->c_aux1, par->c_aux2, nspin, rho, sigmatmp, dens, zeta, z, &e_PKZB, de_PKZBdd, de_PKZBdsigma, &de_PKZBdz); /* Equation (11) */ { double z2 = z*z, z3 = z2*z; double dedz; double dzdd[2], dzdsigma[3], dzdtau; if(tauw >= tautr || fabs(tauw- tautr)< 1.0e-10){ dzdtau = 0.0; dzdd[0] = 0.0; dzdd[1] = 0.0; dzdsigma[0] = 0.0; dzdsigma[1] = 0.0; dzdsigma[2] = 0.0; }else{ dzdtau = -z/taut; dzdd[0] = - z/dens; dzdd[1] = 0.0; if (nspin == XC_POLARIZED) dzdd[1] = - z/dens; dzdsigma[0] = 1.0/(8*dens*taut); dzdsigma[1] = 0.0; dzdsigma[2] = 0.0; if (nspin == XC_POLARIZED) { dzdsigma[1] = 2.0/(8*dens*taut); dzdsigma[2] = 1.0/(8*dens*taut); } } *energy = e_PKZB * (1.0 + d*e_PKZB*z3); /* due to the definition of na and nb in libxc.c we need to divide by (na+nb) to recover the * same energy for polarized and unpolarized calculation with the same total density */ if(nspin == XC_UNPOLARIZED) *energy *= dens/(rho[0]+rho[1]); dedz = de_PKZBdz*(1.0 + 2.0*d*e_PKZB*z3) + dens*e_PKZB * e_PKZB * d * 3.0*z2; for(is=0; isx_aux = (XC(func_type) *) malloc(sizeof(XC(func_type))); XC(func_init)(par->x_aux, XC_LDA_X, XC_UNPOLARIZED); par->c_aux1 = (XC(func_type) *) malloc(sizeof(XC(func_type))); par->c_aux2 = (XC(func_type) *) malloc(sizeof(XC(func_type))); XC(func_init)(par->c_aux1, XC_GGA_C_PBE, par->common.nspin); XC(func_init)(par->c_aux2, XC_GGA_C_PBE, XC_POLARIZED); } static void tpss_end(void *p) { tpss_params *par = (tpss_params*)p; XC(func_end)(par->x_aux); free(par->x_aux); XC(func_end)(par->c_aux1); XC(func_end)(par->c_aux2); free(par->c_aux1); free(par->c_aux2); } const mgga_func_info tpss_info = { sizeof(tpss_params), &tpss_init, &tpss_end, &XC(mgga_x_tpss), &XC(mgga_c_tpss) }; gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/vdw.c000066400000000000000000000143161316441372200217310ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #include "../extensions.h" double vdwkernel(double D, double d1, double d2, int nD, int ndelta, double dD, double ddelta, const double (*phi)[nD]) { if (D < 1e-10) return phi[0][0]; double y = D / dD; int j = (int)y; double e12; if (j >= nD - 1) { double d12 = d1 * d1; double d22 = d2 * d2; const double C = -1024.0 / 243.0 * M_PI * M_PI * M_PI * M_PI; e12 = C / (d12 * d22 * (d12 + d22)); } else { double x = fabs(0.5 * (d1 - d2) / D) / ddelta; int i = (int)x; if (i >= ndelta - 1) { i = ndelta - 2; x = 1.0; } else x -= i; y -= j; e12 = ((x * y * phi[i + 1][j + 1] + x * (1.0 - y) * phi[i + 1][j ] + (1.0 - x) * y * phi[i ][j + 1] + (1.0 - x) * (1.0 - y) * phi[i ][j ])); } return e12; } PyObject * vdw(PyObject* self, PyObject *args) { PyArrayObject* n_obj; PyArrayObject* q0_obj; PyArrayObject* R_obj; PyArrayObject* cell_obj; PyArrayObject* pbc_obj; PyArrayObject* repeat_obj; PyArrayObject* phi_obj; double ddelta; double dD; int iA; int iB; PyArrayObject* rhistogram_obj; double drhist; PyArrayObject* Dhistogram_obj; double dDhist; if (!PyArg_ParseTuple(args, "OOOOOOOddiiOdOd", &n_obj, &q0_obj, &R_obj, &cell_obj, &pbc_obj, &repeat_obj, &phi_obj, &ddelta, &dD, &iA, &iB, &rhistogram_obj, &drhist, &Dhistogram_obj, &dDhist)) return NULL; int ndelta = PyArray_DIMS(phi_obj)[0]; int nD = PyArray_DIMS(phi_obj)[1]; const double* n = (const double*)DOUBLEP(n_obj); const int ni = PyArray_SIZE(n_obj); const double* q0 = (const double*)DOUBLEP(q0_obj); const double (*R)[3] = (const double (*)[3])DOUBLEP(R_obj); const double* cell = (const double*)DOUBLEP(cell_obj); const char* pbc = (const char*)(PyArray_DATA(pbc_obj)); const long* repeat = (const long*)(PyArray_DATA(repeat_obj)); const double (*phi)[nD] = (const double (*)[nD])DOUBLEP(phi_obj); double* rhistogram = (double*)DOUBLEP(rhistogram_obj); double* Dhistogram = (double*)DOUBLEP(Dhistogram_obj); int nbinsr = PyArray_DIMS(rhistogram_obj)[0]; int nbinsD = PyArray_DIMS(Dhistogram_obj)[0]; double energy = 0.0; if (repeat[0] == 0 && repeat[1] == 0 && repeat[2] == 0) for (int i1 = iA; i1 < iB; i1++) { const double* R1 = R[i1]; double q01 = q0[i1]; for (int i2 = 0; i2 <= i1; i2++) { double rr = 0.0; for (int c = 0; c < 3; c++) { double f = R[i2][c] - R1[c]; if (pbc[c]) f = fmod(f + 1.5 * cell[c], cell[c]) - 0.5 * cell[c]; rr += f * f; } double r = sqrt(rr); double d1 = r * q01; double d2 = r * q0[i2]; double D = 0.5 * (d1 + d2); double e12 = (vdwkernel(D, d1, d2, nD, ndelta, dD, ddelta, phi) * n[i1] * n[i2]); if (i1 == i2) e12 /= 2.0; int bin = (int)(r / drhist); if (bin < nbinsr) rhistogram[bin] += e12; bin = (int)(D / dDhist); if (bin < nbinsD) Dhistogram[bin] += e12; energy += e12; } } else for (int i1 = iA; i1 < iB; i1++) { const double* R1 = R[i1]; double q01 = q0[i1]; for (int a1 = -repeat[0]; a1 <= repeat[0]; a1++) for (int a2 = -repeat[1]; a2 <= repeat[1]; a2++) for (int a3 = -repeat[2]; a3 <= repeat[2]; a3++) { double x = 0.5; int i2max = ni-1; if (a1 == 0 && a2 == 0 && a3 == 0) { i2max = i1; x = 1.0; } double R1a[3] = {R1[0] + a1 * cell[0], R1[1] + a2 * cell[1], R1[2] + a3 * cell[2]}; for (int i2 = 0; i2 <= i2max; i2++) { double rr = 0.0; for (int c = 0; c < 3; c++) { double f = R[i2][c] - R1a[c]; rr += f * f; } double r = sqrt(rr); double d1 = r * q01; double d2 = r * q0[i2]; double D = 0.5 * (d1 + d2); double e12 = (vdwkernel(D, d1, d2, nD, ndelta, dD, ddelta, phi) * n[i1] * n[i2] * x); int bin = (int)(r / drhist); if (bin < nbinsr) rhistogram[bin] += e12; bin = (int)(D / dDhist); if (bin < nbinsD) Dhistogram[bin] += e12; energy += e12; } } } return PyFloat_FromDouble(energy); } PyObject * vdw2(PyObject* self, PyObject *args) { PyArrayObject* phi_jp_obj; PyArrayObject* j_k_obj; PyArrayObject* dk_k_obj; PyArrayObject* theta_k_obj; PyArrayObject* F_k_obj; if (!PyArg_ParseTuple(args, "OOOOO", &phi_jp_obj, &j_k_obj, &dk_k_obj, &theta_k_obj, &F_k_obj)) return NULL; const double* phi_jp = (const double*)PyArray_DATA(phi_jp_obj); const long* j_k = (const long*)PyArray_DATA(j_k_obj); const double* dk_k = (const double*)PyArray_DATA(dk_k_obj); const complex double* theta_k = (const complex double*)PyArray_DATA(theta_k_obj); complex double* F_k = (complex double*)PyArray_DATA(F_k_obj); int nk = PyArray_SIZE(j_k_obj); for (int k = 0; k < nk; k++) { const double* phi_p = phi_jp + 4 * j_k[k]; double a = phi_p[0]; double b = phi_p[1]; double c = phi_p[2]; double d = phi_p[3]; double x = dk_k[k]; F_k[k] += theta_k[k] * (a + x * (b + x * (c + x * d))); } Py_RETURN_NONE; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/xc.c000066400000000000000000000213501316441372200215370ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #include #define PY_ARRAY_UNIQUE_SYMBOL GPAW_ARRAY_API #define NO_IMPORT_ARRAY #include #include "xc_gpaw.h" #include "../extensions.h" // // __ 2 // a2 = |\/n| // // dE // dedrs = --- // dr // s // // dE // deda2 = --------- // __ 2 // d(|\/n| ) // void init_mgga(void** params, int code, int nspin); void calc_mgga(void** params, int nspin, int ng, const double* n_g, const double* sigma_g, const double* tau_g, double *e_g, double *v_g, double *dedsigma_g, double *dedtau_g); double pbe_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2); double pbe_correlation(double n, double rs, double zeta, double a2, bool gga, bool spinpol, double* dedrs, double* dedzeta, double* deda2); double pw91_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2); double pw91_correlation(double n, double rs, double zeta, double a2, bool gga, bool spinpol, double* dedrs, double* dedzeta, double* deda2); double rpbe_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2); double beefvdw_exchange(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2); // typedef struct { PyObject_HEAD double (*exchange)(const xc_parameters* par, double n, double rs, double a2, double* dedrs, double* deda2); double (*correlation)(double n, double rs, double zeta, double a2, bool gga, bool spinpol, double* dedrs, double* dedzeta, double* deda2); xc_parameters par; // below added by cpo for mgga functionals outside of libxc (TPSS, M06L, etc.) void* mgga; } XCFunctionalObject; static void XCFunctional_dealloc(XCFunctionalObject *self) { PyObject_DEL(self); } static PyObject* XCFunctional_calculate(XCFunctionalObject *self, PyObject *args) { PyArrayObject* e_array; PyArrayObject* n_array; PyArrayObject* v_array; PyArrayObject* sigma_array = 0; PyArrayObject* dedsigma_array = 0; PyArrayObject* tau_array = 0; PyArrayObject* dedtau_array = 0; if (!PyArg_ParseTuple(args, "OOO|OOOO", &e_array, &n_array, &v_array, &sigma_array, &dedsigma_array, &tau_array, &dedtau_array)) return NULL; int ng = 1; for (int d = 0; d < PyArray_NDIM(e_array); d++) ng *= PyArray_DIM(e_array, d); xc_parameters* par = &self->par; double* e_g = DOUBLEP(e_array); const double* n_g = DOUBLEP(n_array); double* v_g = DOUBLEP(v_array); const double* sigma_g = 0; double* dedsigma_g = 0; if (par->gga) { sigma_g = DOUBLEP(sigma_array); dedsigma_g = DOUBLEP(dedsigma_array); } const double* tau_g = 0; double* dedtau_g = 0; if (self->mgga) { tau_g = DOUBLEP(tau_array); dedtau_g = DOUBLEP(dedtau_array); } if (self->mgga) { int nspin = PyArray_DIM(n_array, 0) == 1 ? 1 : 2; calc_mgga(&self->mgga, nspin, ng, n_g, sigma_g, tau_g, e_g, v_g, dedsigma_g, dedtau_g); Py_RETURN_NONE; } if (PyArray_DIM(n_array, 0) == 1) for (int g = 0; g < ng; g++) { double n = n_g[g]; if (n < NMIN) n = NMIN; double rs = pow(C0I / n, THIRD); double dexdrs; double dexda2; double ex; double decdrs; double decda2; double ec; if (par->gga) { double a2 = sigma_g[g]; ex = self->exchange(par, n, rs, a2, &dexdrs, &dexda2); ec = self->correlation(n, rs, 0.0, a2, 1, 0, &decdrs, 0, &decda2); dedsigma_g[g] = n * (dexda2 + decda2); } else { ex = self->exchange(par, n, rs, 0.0, &dexdrs, 0); ec = self->correlation(n, rs, 0.0, 0.0, 0, 0, &decdrs, 0, 0); } e_g[g] = n * (ex + ec); v_g[g] += ex + ec - rs * (dexdrs + decdrs) / 3.0; } else { const double* na_g = n_g; double* va_g = v_g; const double* nb_g = na_g + ng; double* vb_g = va_g + ng; const double* sigma0_g = 0; const double* sigma1_g = 0; const double* sigma2_g = 0; double* dedsigma0_g = 0; double* dedsigma1_g = 0; double* dedsigma2_g = 0; const xc_parameters* par = &self->par; if (par->gga) { sigma0_g = sigma_g; sigma1_g = sigma0_g + ng; sigma2_g = sigma1_g + ng; dedsigma0_g = dedsigma_g; dedsigma1_g = dedsigma0_g + ng; dedsigma2_g = dedsigma1_g + ng; } for (int g = 0; g < ng; g++) { double na = 2.0 * na_g[g]; if (na < NMIN) na = NMIN; double rsa = pow(C0I / na, THIRD); double nb = 2.0 * nb_g[g]; if (nb < NMIN) nb = NMIN; double rsb = pow(C0I / nb, THIRD); double n = 0.5 * (na + nb); double rs = pow(C0I / n, THIRD); double zeta = 0.5 * (na - nb) / n; double dexadrs; double dexada2; double exa; double dexbdrs; double dexbda2; double exb; double decdrs; double decdzeta; double decda2; double ec; if (par->gga) { exa = self->exchange(par, na, rsa, 4.0 * sigma0_g[g], &dexadrs, &dexada2); exb = self->exchange(par, nb, rsb, 4.0 * sigma2_g[g], &dexbdrs, &dexbda2); double a2 = sigma0_g[g] + 2 * sigma1_g[g] + sigma2_g[g]; ec = self->correlation(n, rs, zeta, a2, 1, 1, &decdrs, &decdzeta, &decda2); dedsigma0_g[g] = 2 * na * dexada2 + n * decda2; dedsigma1_g[g] = 2 * n * decda2; dedsigma2_g[g] = 2 * nb * dexbda2 + n * decda2; } else { exa = self->exchange(par, na, rsa, 0.0, &dexadrs, 0); exb = self->exchange(par, nb, rsb, 0.0, &dexbdrs, 0); ec = self->correlation(n, rs, zeta, 0.0, 0, 1, &decdrs, &decdzeta, 0); } e_g[g] = 0.5 * (na * exa + nb * exb) + n * ec; va_g[g] += (exa + ec - (rsa * dexadrs + rs * decdrs) / 3.0 - (zeta - 1.0) * decdzeta); vb_g[g] += (exb + ec - (rsb * dexbdrs + rs * decdrs) / 3.0 - (zeta + 1.0) * decdzeta); } } Py_RETURN_NONE; } static PyMethodDef XCFunctional_Methods[] = { {"calculate", (PyCFunction)XCFunctional_calculate, METH_VARARGS, 0}, {NULL, NULL, 0, NULL} }; PyTypeObject XCFunctionalType = { PyVarObject_HEAD_INIT(NULL, 0) "XCFunctional", sizeof(XCFunctionalObject), 0, (destructor)XCFunctional_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, "XC object", 0, 0, 0, 0, 0, 0, XCFunctional_Methods }; PyObject * NewXCFunctionalObject(PyObject *obj, PyObject *args) { int code; PyArrayObject* parameters = 0; if (!PyArg_ParseTuple(args, "i|O", &code, ¶meters)) return NULL; XCFunctionalObject *self = PyObject_NEW(XCFunctionalObject, &XCFunctionalType); if (self == NULL) return NULL; self->mgga = NULL; self->par.gga = 1; self->correlation = pbe_correlation; self->exchange = pbe_exchange; if (code == -1) { // LDA self->par.gga = 0; } else if (code == 0) { // PBE self->par.kappa = 0.804; } else if (code == 1) { // revPBE self->par.kappa = 1.245; } else if (code == 2) { // RPBE self->exchange = rpbe_exchange; } else if (code == 14) { // PW91 self->exchange = pw91_exchange; } else if (code == 20 || code == 21 || code == 22) { // MGGA const int nspin = 1; // a guess, perhaps corrected later in calc_mgga init_mgga(&self->mgga,code,nspin); } else { assert (code == 17); // BEEF-vdW self->exchange = beefvdw_exchange; int n = PyArray_DIM(parameters, 0); assert(n <= 110); double* p = (double*)PyArray_BYTES(parameters); for (int i = 0; i < n; i++) self->par.parameters[i] = p[i]; self->par.nparameters = n / 2; } return (PyObject*)self; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/xc_gpaw.h000066400000000000000000000017601316441372200225650ustar00rootroot00000000000000/* Copyright (C) 2003-2007 CAMP * Copyright (C) 2007-2009 CAMd * Please see the accompanying LICENSE file for further information. */ #ifndef _XC_GPAW_H #define _XC_GPAW_H /* BETA = 0.066725 MU = BETA * pi * pi / 3 C2 = (1 / (18 * pi)**(1 / 3)) C0I = 3 / (4 * pi) C1 = -9 / (8 * pi) * (2 * pi / 3)**(1 / 3) CC1 = 1 / (2**(4 / 3) - 2) CC2 = 4 * CC1 / 3 IF2 = 3 / (2 * CC2); C3 = pi * (4 / (9 * pi))**(1 / 3) / 16 C0 = 4 * pi / 3 */ #define BETA 0.066725 #define GAMMA 0.031091 #define MU 0.2195164512208958 #define C2 0.26053088059892404 #define C0I 0.238732414637843 #define C1 -0.45816529328314287 #define CC1 1.9236610509315362 #define CC2 2.5648814012420482 #define IF2 0.58482236226346462 #define C3 0.10231023756535741 #define C0 4.1887902047863905 #define THIRD 0.33333333333333333 #define NMIN 1.0E-10 typedef int bool; typedef struct { bool gga; double kappa; int nparameters; double parameters[110]; } xc_parameters; #endif /* _XC_GPAW_H */ gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/xc_mgga.c000066400000000000000000000074241316441372200225400ustar00rootroot00000000000000 #include #include #include #include "xc_mgga.h" #include "xc_gpaw.h" extern const mgga_func_info m06l_info; extern const mgga_func_info tpss_info; extern const mgga_func_info revtpss_info; static void init_common(common_params* params, int code, int nspin, const mgga_func_info *finfo) { params->code = code; params->nspin = nspin; params->funcinfo = finfo; } void init_mgga(void** params, int code, int nspin) { const mgga_func_info *finfo; if (code==20) { finfo = &tpss_info; } else if (code==21) { finfo = &m06l_info; } else if (code==22) { finfo = &revtpss_info; } else { // this should never happen. forces a crash. assert(code>=20 && code <=22); finfo = NULL; } *params = malloc(finfo->size); init_common(*params, code, nspin, finfo); finfo->init(*params); } void end_mgga(common_params *common) { common->funcinfo->end(common); free(common); } void calc_mgga(void** params, int nspin, int ng, const double* n_g, const double* sigma_g, const double* tau_g, double *e_g, double *v_g, double *dedsigma_g, double *dedtau_g) { common_params *common = (common_params*)*params; // check for a changed spin (similar to a line in gpaw/libxc.py) if (nspin!=common->nspin) { int code = common->code; // save this, since we're about to destroy common end_mgga(common); init_mgga(params, code, nspin); common = (common_params*)*params; // init_mgga changes this } if (nspin == 1) { for (int g = 0; g < ng; g++) { // kludge n[1] because of the way TPSS was written (requires n[1]=0.0 even for unpolarized) double n[2]; n[0] = n_g[g]; n[1] = 0.0; if (n[0] < NMIN) n[0] = NMIN; // m06l is assuming that there is space for spinpolarized calculation output // even for non-spin-polarized. double etmp, vtmp[2], dedsigmatmp[3], dedtautmp[2]; common->funcinfo->exch(*params, n, sigma_g+g, tau_g+g, &etmp, vtmp, dedsigmatmp, dedtautmp); e_g[g] = etmp; v_g[g] += vtmp[0]; dedsigma_g[g] = dedsigmatmp[0]; dedtau_g[g] = dedtautmp[0]; common->funcinfo->corr(*params, n, sigma_g+g, tau_g+g, &etmp, vtmp, dedsigmatmp, dedtautmp); e_g[g] += etmp; e_g[g] *= n[0]; v_g[g] += vtmp[0]; dedsigma_g[g] += dedsigmatmp[0]; dedtau_g[g] += dedtautmp[0]; } } else { double etmp, ntmp[2], vtmp[2], sigmatmp[3], dedsigmatmp[3], tautmp[2], dedtautmp[2]; for (int g = 0; g < ng; g++) { ntmp[0] = n_g[g]; if (ntmp[0] < NMIN) ntmp[0] = NMIN; ntmp[1] = n_g[g+ng]; if (ntmp[1] < NMIN) ntmp[1] = NMIN; sigmatmp[0] = sigma_g[g]; sigmatmp[1] = sigma_g[g+ng]; sigmatmp[2] = sigma_g[g+ng+ng]; tautmp[0] = tau_g[g]; tautmp[1] = tau_g[g+ng]; // kludge: mgga_x_tpss requires dedsigma[1] set to 0, since it doesn't calculate it. dedsigmatmp[1]=0.0; common->funcinfo->exch(*params, ntmp, sigmatmp, tautmp, &etmp, vtmp, dedsigmatmp, dedtautmp); e_g[g] = etmp; v_g[g] += vtmp[0]; v_g[g+ng] += vtmp[1]; dedsigma_g[g] = dedsigmatmp[0]; dedsigma_g[g+ng] = dedsigmatmp[1]; dedsigma_g[g+ng+ng] = dedsigmatmp[2]; dedtau_g[g] = dedtautmp[0]; dedtau_g[g+ng] = dedtautmp[1]; common->funcinfo->corr(*params, ntmp, sigmatmp, tautmp, &etmp, vtmp, dedsigmatmp, dedtautmp); e_g[g] += etmp; e_g[g] *= ntmp[0]+ntmp[1]; v_g[g] += vtmp[0]; v_g[g+ng] += vtmp[1]; dedsigma_g[g] += dedsigmatmp[0]; dedsigma_g[g+ng] += dedsigmatmp[1]; dedsigma_g[g+ng+ng] += dedsigmatmp[2]; dedtau_g[g] += dedtautmp[0]; dedtau_g[g+ng] += dedtautmp[1]; } } } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/c/xc/xc_mgga.h000066400000000000000000000021311316441372200225330ustar00rootroot00000000000000 #ifndef GPAW_XC_MGGA_H #define GPAW_XC_MGGA_H #define M_PI 3.14159265358979323846 #define MIN_DENS 1.0e-20 #define MIN_GRAD 1.0e-20 #define max(x,y) ((x 0: extra_compile_args += ['-xarch=%s' % arch[-1]] # We need the -Bstatic before the -lsunperf and -lfsu: # http://forum.java.sun.com/thread.jspa?threadID=5072537&messageID=9265782 extra_link_args += ['-Bstatic', '-lsunperf', '-lfsu', '-Bdynamic'] cc_version = os.popen3('cc -V')[2].readline().split()[3] if LooseVersion(cc_version) > '5.6': libraries.append('mtsk') else: extra_link_args.append('-lmtsk') # define_macros.append(('NO_C99_COMPLEX', '1')) elif sys.platform.startswith('win'): # We compile with mingw coming from pythonyx (32-bit) # on the msys command line, e.g.: # LIBRARY_PATH=/c/libxc/lib:/c/OpenBLAS/lib \ # C_INCLUDE_PATH=/c/libxc/include python setup.py build if 'LIBRARY_PATH' in os.environ: library_dirs += os.environ['LIBRARY_PATH'].split(os.path.pathsep) extra_compile_args += ['-Wall', '-std=c99'] lib = '' for ld in library_dirs: # OpenBLAS (includes Lapack) if os.path.exists(join(ld, 'libopenblas.a')): lib = 'openblas' directory = ld break if lib == 'openblas': libraries += [lib, 'gfortran'] elif sys.platform in ['aix5', 'aix6']: # # o|_ _ _ # ||_)| | | # extra_compile_args += ['-qlanglvl=stdc99'] # setting memory limit is necessary on aix5 if sys.platform == 'aix5': extra_link_args += ['-bmaxdata:0x80000000', '-bmaxstack:0x80000000'] libraries += ['f', 'lapack', 'essl'] define_macros.append(('GPAW_AIX', '1')) elif sys.platform == 'darwin': extra_compile_args += ['-Wall', '-Wno-unknown-pragmas', '-std=c99'] include_dirs += ['/usr/include/malloc'] library_dirs += ['/usr/local/lib'] # libxc installed with Homebrew extra_link_args += ['-framework', 'Accelerate'] # BLAS # We should probably add something to allow for user-installed BLAS? elif machine in ['x86_64', 'ppc64', 'ppc64le', 'aarch64', 's390x']: # _ # \/|_||_ |_ |_| # /\|_||_| _ |_| | # extra_compile_args += ['-Wall', '-Wno-unknown-pragmas', '-std=c99'] # Look for ACML libraries: acml = glob('/opt/acml*/g*64/lib') if len(acml) > 0: library_dirs += [acml[-1]] libraries += ['acml'] if acml[-1].find('gfortran') != -1: libraries.append('gfortran') if acml[-1].find('gnu') != -1: libraries.append('g2c') extra_link_args += ['-Wl,-rpath=' + acml[-1]] else: atlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib64/atlas']: if glob(join(dir, 'libatlas.so')) != []: atlas = True libdir = dir break satlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib64/atlas']: if glob(join(dir, 'libsatlas.so')) != []: satlas = True libdir = dir break openblas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib64']: if glob(join(dir, 'libopenblas.so')) != []: openblas = True libdir = dir break if openblas: # prefer openblas libraries += ['openblas'] library_dirs += [libdir] else: if atlas: # then atlas # http://math-atlas.sourceforge.net/errata.html#LINK # atlas does not respect OMP_NUM_THREADS - build # single-thread # http://math-atlas.sourceforge.net/faq.html#tsafe libraries += ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs += [libdir] elif satlas: # then atlas >= 3.10 Fedora/RHEL libraries += ['satlas'] library_dirs += [libdir] else: libraries += ['blas', 'lapack'] elif machine == 'ia64': # _ _ # |_ | o # _||_|| # extra_compile_args += ['-Wall', '-std=c99'] libraries += ['mkl', 'mkl_lapack64'] elif platform.machine().startswith('arm'): extra_compile_args += ['-Wall', '-Wno-unknown-pragmas', '-std=c99'] atlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib/atlas']: if glob(join(dir, 'libatlas.so')) != []: atlas = True libdir = dir break satlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib/atlas']: if glob(join(dir, 'libsatlas.so')) != []: satlas = True libdir = dir break openblas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libopenblas.so')) != []: openblas = True libdir = dir break if openblas: # prefer openblas libraries += ['openblas'] library_dirs += [libdir] else: if atlas: # then atlas # http://math-atlas.sourceforge.net/errata.html#LINK # atlas does not respect OMP_NUM_THREADS - build single-thread # http://math-atlas.sourceforge.net/faq.html#tsafe libraries += ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs += [libdir] elif satlas: # then atlas >= 3.10 Fedora/RHEL libraries += ['satlas'] library_dirs += [libdir] else: libraries += ['blas', 'lapack'] elif machine == 'i686': # _ # o|_ |_||_ # ||_||_||_| # extra_compile_args += ['-Wall', '-Wno-unknown-pragmas', '-std=c99'] if 'MKL_ROOT' in os.environ: mklbasedir = [os.environ['MKL_ROOT']] else: mklbasedir = glob('/opt/intel/mkl*') libs = ['libmkl_ia32.a'] if mklbasedir != []: os.path.walk(mklbasedir[0], find_file, libs) libs.pop(0) if libs != []: libs.sort() libraries += ['mkl_lapack', 'mkl_ia32', 'guide', 'pthread', 'mkl'] library_dirs += libs # extra_link_args += ['-Wl,-rpath=' + library_dirs[-1]] else: atlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib/atlas']: if glob(join(dir, 'libatlas.so')) != []: atlas = True libdir = dir break satlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib/atlas']: if glob(join(dir, 'libsatlas.so')) != []: satlas = True libdir = dir break openblas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libopenblas.so')) != []: openblas = True libdir = dir break if openblas: # prefer openblas libraries += ['openblas'] library_dirs += [libdir] else: if atlas: # then atlas # http://math-atlas.sourceforge.net/errata.html#LINK # atlas does not respect OMP_NUM_THREADS - build # single-thread # http://math-atlas.sourceforge.net/faq.html#tsafe libraries += ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs += [libdir] elif satlas: # then atlas >= 3.10 Fedora/RHEL libraries += ['satlas'] library_dirs += [libdir] else: libraries += ['blas', 'lapack'] # add libg2c if available g2c = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libg2c.so')) != []: g2c = True break if glob(join(dir, 'libg2c.a')) != []: g2c = True break if g2c: libraries += ['g2c'] else: extra_compile_args += ['-Wall', '-Wno-unknown-pragmas', '-std=c99'] atlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib/atlas']: if glob(join(dir, 'libatlas.so')) != []: atlas = True libdir = dir break satlas = False for dir in ['/usr/lib', '/usr/local/lib', '/usr/lib/atlas']: if glob(join(dir, 'libsatlas.so')) != []: satlas = True libdir = dir break openblas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libopenblas.so')) != []: openblas = True libdir = dir break if openblas: # prefer openblas libraries += ['openblas'] library_dirs += [libdir] else: if atlas: # then atlas # http://math-atlas.sourceforge.net/errata.html#LINK # atlas does not respect OMP_NUM_THREADS - build single-thread # http://math-atlas.sourceforge.net/faq.html#tsafe libraries += ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs += [libdir] elif satlas: # then atlas >= 3.10 Fedora/RHEL libraries += ['satlas'] library_dirs += [libdir] else: libraries += ['blas', 'lapack'] # https://listserv.fysik.dtu.dk/pipermail/gpaw-users/2012-May/001473.html p = platform.dist() if p[0].lower() in ['redhat', 'centos'] and p[1].startswith('6.'): define_macros.append(('_GNU_SOURCE', '1')) def get_parallel_config(mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): globals = {} exec(open('gpaw/mpi/config.py').read(), globals) mpi = globals['get_mpi_implementation']() if mpi == '': mpicompiler = None elif mpi == 'sun': mpi_include_dirs += ['/opt/SUNWhpc/include'] mpi_libraries += ['mpi'] mpi_library_dirs += ['/opt/SUNWhpc/lib'] mpi_runtime_library_dirs += ['/opt/SUNWhpc/lib'] mpicompiler = get_config_var('CC') elif mpi == 'poe': mpicompiler = 'mpcc_r' else: # Try to use mpicc mpicompiler = 'mpicc' return mpicompiler def mtime(path, name, mtimes): """Return modification time. The modification time of a source file is returned. If one of its dependencies is newer, the mtime of that file is returned. This function fails if two include files with the same name are present in different directories.""" include = re.compile('^#\s*include "(\S+)"', re.MULTILINE) if name in mtimes: return mtimes[name] t = os.stat(os.path.join(path, name))[ST_MTIME] for name2 in include.findall(open(os.path.join(path, name)).read()): path2, name22 = os.path.split(name2) if name22 != name: t = max(t, mtime(os.path.join(path, path2), name22, mtimes)) mtimes[name] = t return t def check_dependencies(sources): # Distutils does not do deep dependencies correctly. We take care of # that here so that "python setup.py build_ext" always does the right # thing! mtimes = {} # modification times # Remove object files if any dependencies have changed: plat = distutils.util.get_platform() + '-' + sys.version[0:3] remove = False for source in sources: path, name = os.path.split(source) t = mtime(path + '/', name, mtimes) o = 'build/temp.%s/%s.o' % (plat, source[:-2]) # object file if os.path.exists(o) and t > os.stat(o)[ST_MTIME]: print('removing', o) os.remove(o) remove = True so = 'build/lib.%s/_gpaw.so' % plat if os.path.exists(so) and remove: # Remove shared object C-extension: # print 'removing', so os.remove(so) def test_configuration(): raise NotImplementedError def write_configuration(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, mpicompiler, mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): # Write the compilation configuration into a file try: out = open('configuration.log', 'w') except IOError as x: print(x) return print("Current configuration", file=out) print("libraries", libraries, file=out) print("library_dirs", library_dirs, file=out) print("include_dirs", include_dirs, file=out) print("define_macros", define_macros, file=out) print("extra_link_args", extra_link_args, file=out) print("extra_compile_args", extra_compile_args, file=out) print("runtime_library_dirs", runtime_library_dirs, file=out) print("extra_objects", extra_objects, file=out) if mpicompiler is not None: print(file=out) print("Parallel configuration", file=out) print("mpicompiler", mpicompiler, file=out) print("mpi_libraries", mpi_libraries, file=out) print("mpi_library_dirs", mpi_library_dirs, file=out) print("mpi_include_dirs", mpi_include_dirs, file=out) print("mpi_define_macros", mpi_define_macros, file=out) print("mpi_runtime_library_dirs", mpi_runtime_library_dirs, file=out) out.close() def build_interpreter(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, mpicompiler, mpilinker, mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): # Build custom interpreter which is used for parallel calculations cfgDict = get_config_vars() plat = distutils.util.get_platform() + '-' + sys.version[0:3] cfiles = glob('c/[a-zA-Z_]*.c') + ['c/bmgs/bmgs.c'] cfiles += glob('c/xc/*.c') # Make build process deterministic (for "reproducible build" in debian) # XXX some of this is duplicated in setup.py! Why do the same thing twice? cfiles.sort() sources = ['c/bc.c', 'c/localized_functions.c', 'c/mpi.c', 'c/_gpaw.c', 'c/operators.c', 'c/woperators.c', 'c/transformers.c', 'c/blacs.c', 'c/utilities.c', 'c/xc/libvdwxc.c'] objects = ' '.join(['build/temp.%s/' % plat + x[:-1] + 'o' for x in cfiles]) if not os.path.isdir('build/bin.%s/' % plat): os.makedirs('build/bin.%s/' % plat) exefile = 'build/bin.%s/' % plat + '/gpaw-python' libraries += mpi_libraries library_dirs += mpi_library_dirs define_macros += mpi_define_macros include_dirs += mpi_include_dirs runtime_library_dirs += mpi_runtime_library_dirs define_macros.append(('PARALLEL', '1')) define_macros.append(('GPAW_INTERPRETER', '1')) macros = ' '.join(['-D%s=%s' % x for x in define_macros if x[0].strip()]) include_dirs.append(cfgDict['INCLUDEPY']) include_dirs.append(cfgDict['CONFINCLUDEPY']) includes = ' '.join(['-I' + incdir for incdir in include_dirs]) library_dirs.append(cfgDict['LIBPL']) lib_dirs = ' '.join(['-L' + lib for lib in library_dirs]) libs = ' '.join(['-l' + lib for lib in libraries if lib.strip()]) # See if there is "scalable" libpython available libpl = cfgDict['LIBPL'] if glob(libpl + '/libpython*mpi*'): libs += ' -lpython%s_mpi' % cfgDict['VERSION'] else: libs += ' ' + cfgDict.get('BLDLIBRARY', '-lpython%s' % cfgDict['VERSION']) libs = ' '.join([libs, cfgDict['LIBS'], cfgDict['LIBM']]) # Hack taken from distutils to determine option for runtime_libary_dirs if sys.platform[:6] == 'darwin': # MacOSX's linker doesn't understand the -R flag at all runtime_lib_option = '-L' elif sys.platform[:5] == 'hp-ux': runtime_lib_option = '+s -L' elif os.popen('mpicc --showme 2> /dev/null', 'r').read()[:3] == 'gcc': runtime_lib_option = '-Wl,-R' elif os.popen('mpicc -show 2> /dev/null', 'r').read()[:3] == 'gcc': runtime_lib_option = '-Wl,-R' else: runtime_lib_option = '-R' runtime_libs = ' '.join([runtime_lib_option + lib for lib in runtime_library_dirs]) extra_link_args.append(cfgDict['LDFLAGS']) if sys.platform in ['aix5', 'aix6']: extra_link_args.append(cfgDict['LINKFORSHARED'].replace( 'Modules', cfgDict['LIBPL'])) elif sys.platform == 'darwin': # On a Mac, it is important to preserve the original compile args. # This should probably always be done ?!? extra_compile_args.append(cfgDict['CFLAGS']) extra_link_args.append(cfgDict['LINKFORSHARED']) else: extra_link_args.append(cfgDict['LINKFORSHARED']) extra_compile_args.append('-fPIC') # Compile the parallel sources for src in sources: obj = 'build/temp.%s/' % plat + src[:-1] + 'o' cmd = ('%s %s %s %s -o %s -c %s ') % \ (mpicompiler, macros, ' '.join(extra_compile_args), includes, obj, src) print(cmd) error = os.system(cmd) if error != 0: return error # Link the custom interpreter cmd = ('%s -o %s %s %s %s %s %s %s') % \ (mpilinker, exefile, objects, ' '.join(extra_objects), lib_dirs, libs, runtime_libs, ' '.join(extra_link_args)) print(cmd) error = os.system(cmd) return error gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/customize.py000066400000000000000000000041711316441372200225230ustar00rootroot00000000000000"""User provided customizations. Here one changes the default arguments for compiling _gpaw.so (serial) and gpaw-python (parallel). Here are all the lists that can be modified: * libraries * library_dirs * include_dirs * extra_link_args * extra_compile_args * runtime_library_dirs * extra_objects * define_macros * mpi_libraries * mpi_library_dirs * mpi_include_dirs * mpi_runtime_library_dirs * mpi_define_macros To override use the form: libraries = ['somelib', 'otherlib'] To append use the form libraries += ['somelib', 'otherlib'] """ # compiler = 'gcc' # mpicompiler = 'mpicc' # use None if you don't want to build a gpaw-python # mpilinker = 'mpicc' # platform_id = '' # scalapack = False # Use ScaLAPACK: # Warning! At least scalapack 2.0.1 is required! # See https://trac.fysik.dtu.dk/projects/gpaw/ticket/230 if scalapack: libraries += ['scalapack-openmpi', 'blacsCinit-openmpi', 'blacs-openmpi'] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] # LibXC: # In order to link libxc installed in a non-standard location # (e.g.: configure --prefix=/home/user/libxc-2.0.1-1), use: # - static linking: if 0: include_dirs += ['/home/user/libxc-2.0.1-1/include'] extra_link_args += ['/home/user/libxc-2.0.1-1/lib/libxc.a'] if 'xc' in libraries: libraries.remove('xc') # - dynamic linking (requires rpath or setting LD_LIBRARY_PATH at runtime): if 0: include_dirs += ['/home/user/libxc-2.0.1-1/include'] library_dirs += ['/home/user/libxc-2.0.1-1/lib'] # You can use rpath to avoid changing LD_LIBRARY_PATH: # extra_link_args += ['-Wl,-rpath=/home/user/libxc-2.0.1-1/lib'] if 'xc' not in libraries: libraries.append('xc') # libvdwxc: if 0: libvdwxc = True path = '/home/user/libvdwxc' extra_link_args += ['-Wl,-rpath=%s/lib' % path] library_dirs += ['%s/lib' % path] include_dirs += ['%s/include' % path] libraries += ['vdwxc'] # Build MPI-interface into _gpaw.so: if 0: compiler = 'mpicc' define_macros += [('PARALLEL', '1')] mpicompiler = None gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/000077500000000000000000000000001316441372200206715ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/GPAW.bib000066400000000000000000000146671316441372200221230ustar00rootroot00000000000000@article{ISI:000257284000004, Author = {Walter, Michael and H{\"a}kkinen, Hannu and Lehtovaara, Lauri and Puska, Martti and Enkovaara, Jussi and Rostgaard, Carsten and Mortensen, Jens Jorgen}, Title = {Time-dependent density-functional theory in the projector augmented-wave method}, JournalFull = {JOURNAL OF CHEMICAL PHYSICS}, Year = {2008}, Volume = {128}, Number = {24}, Pages = {244101}, Month = {JUN 28}, Abstract = {We present the implementation of the time-dependent density-functional theory both in linear-response and in time-propagation formalisms using the projector augmented-wave method in real-space grids. The two technically very different methods are compared in the linear-response regime where we found perfect agreement in the calculated photoabsorption spectra. We discuss the strengths and weaknesses of the two methods as well as their convergence properties. We demonstrate different applications of the methods by calculating excitation energies and excited state Born-Oppenheimer potential surfaces for a set of atoms and molecules with the linear-response method and by calculating nonlinear emission spectra using the time-propagation method. (C) 2008 American Institute of Physics.}, Publisher = {AMER INST PHYSICS}, Address = {CIRCULATION \& FULFILLMENT DIV, 2 HUNTINGTON QUADRANGLE, STE 1 N O 1, MELVILLE, NY 11747-4501 USA}, Language = {English}, DOI = {10.1063/1.2943138}, Article-Number = {244101}, ISSN = {0021-9606}, Keywords-Plus = {ELECTRONIC EXCITATIONS; RESPONSE THEORY; REAL-TIME; APPROXIMATION; CLUSTERS; SPECTRA; EQUATIONS; EXCHANGE; ATOMS}, Subject-Category = {Physics, Atomic, Molecular \& Chemical}, Number-of-Cited-References = {46}, Journal-ISO = {J. Chem. Phys.}, Journal = {J. Chem. Phys.}, Unique-ID = {ISI:000257284000004}, } @article{ISI:000226735900040, Author = {J. J. Mortensen and L. B. Hansen and K. W. Jacobsen}, Title = {Real-space grid implementation of the projector augmented wave method}, JournalFull = {PHYSICAL REVIEW B}, Year = {2005}, Volume = {71}, Number = {3}, Pages = {035109}, Month = {JAN}, Abstract = {A grid-based real-space implementation of the projector augmented wave (PAW) method of Blochl {[}Phys. Rev. B 50, 17953 (1994)] for density functional theory (DFT) calculations is presented. The use of uniform three-dimensional (3D) real-space grids for representing wave functions, densities, and potentials allows for flexible boundary conditions, efficient multigrid algorithms for solving Poisson and Kohn-Sham equations, and efficient parallelization using simple real-space domain-decomposition. We use the PAW method to perform all-electron calculations in the frozen core approximation, with smooth valence wave functions that can be represented on relatively coarse grids. We demonstrate the accuracy of the method by calculating the atomization energies of 20 small molecules, and the bulk modulus and lattice constants of bulk aluminum. We show that the approach in terms of computational efficiency is comparable to standard plane-wave methods, but the memory requirements are higher.}, Publisher = {AMERICAN PHYSICAL SOC}, Address = {ONE PHYSICS ELLIPSE, COLLEGE PK, MD 20740-3844 USA}, Language = {English}, DOI = {10.1103/PhysRevB.71.035109}, Article-Number = {035109}, ISSN = {1098-0121}, Keywords-Plus = {ELECTRONIC-STRUCTURE CALCULATIONS; DENSITY-FUNCTIONAL-THEORY; TOTAL-ENERGY CALCULATIONS; GENERALIZED GRADIENT APPROXIMATION; INITIO MOLECULAR-DYNAMICS; FREE DFT IMPLEMENTATION; AB-INITIO; FINITE-DIFFERENCE; ULTRASOFT PSEUDOPOTENTIALS; MULTIGRID METHODS}, Subject-Category = {Physics, Condensed Matter}, Number-of-Cited-References = {53}, Journal-ISO = {Phys. Rev. B}, Journal = {Phys. Rev. B}, Unique-ID = {ISI:000226735900040}, } @Article{PhysRevB.80.195112, title = {Localized atomic basis set in the projector augmented wave method}, author = {Larsen, A. H. and Vanin, M. and Mortensen, J. J. and Thygesen, K. S. and Jacobsen, K. W.}, journal = {Phys. Rev. B}, volume = {80}, number = {19}, pages = {195112}, numpages = {10}, year = {2009}, month = {Nov}, doi = {10.1103/PhysRevB.80.195112}, publisher = {American Physical Society} Abstract = {We present an implementation of localized atomic-orbital basis sets in the projector augmented wave (PAW) formalism within the density-functional theory. The implementation in the real-space GPAW code provides a complementary basis set to the accurate but computationally more demanding grid representation. The possibility to switch seamlessly between the two representations implies that simulations employing the local basis can be fine tuned at the end of the calculation by switching to the grid, thereby combining the strength of the two representations for optimal performance. The implementation is tested by calculating atomization energies and equilibrium bulk properties of a variety of molecules and solids, comparing to the grid results. Finally, it is demonstrated how a grid-quality structure optimization can be performed with significantly reduced computational effort by switching between the grid and basis representations.} } @Article{PhysRevB.83.245122, title = {Linear density response function in the projector augmented wave method: Applications to solids, surfaces, and interfaces}, author = {Yan, Jun and Mortensen, Jens. J. and Jacobsen, Karsten W. and Thygesen, Kristian S.}, journal = {Phys. Rev. B}, volume = {83}, number = {24}, pages = {245122}, numpages = {10}, year = {2011}, month = {Jun}, doi = {10.1103/PhysRevB.83.245122}, publisher = {American Physical Society} } @article{PhysRevB.87.235132, title = {Quasiparticle GW calculations for solids, molecules, and two-dimensional materials}, author = {H\"user, Falco and Olsen, Thomas and Thygesen, Kristian S.}, journal = {Phys. Rev. B}, volume = {87}, issue = {23}, pages = {235132}, numpages = {14}, year = {2013}, month = {Jun}, publisher = {American Physical Society}, doi = {10.1103/PhysRevB.87.235132}, url = {http://link.aps.org/doi/10.1103/PhysRevB.87.235132} } @article{JChemPhys.141.174108, author = {Held, Alexander and Walter, Michael}, title = {Simplified continuum solvent model with a smooth cavity based on volumetric data}, journal = {J. Chem. Phys.}, year = {2014}, volume = {141}, number = {17}, pages = {174108}, url = {http://scitation.aip.org/content/aip/journal/jcp/141/17/10.1063/1.4900838}, doi = {10.1063/1.4900838} } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/Makefile000066400000000000000000000032401316441372200223300ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = -n SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(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/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html linkcheck browse html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." help: @echo "Use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " linkcheck to check all external links for integrity" @echo " clean to clean up" @echo " browse to open browser" clean: rm -rf $(BUILDDIR)/* python -m ase.utils.sphinx clean linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." browse: firefox build/html/index.html gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/algorithms.rst000066400000000000000000000143111316441372200235740ustar00rootroot00000000000000.. _features and algorithms: ======================= Features and algorithms ======================= Quick links to all features: .. list-table:: * - :ref:`Plane-waves ` - :ref:`Finite-difference ` - :ref:`LCAO ` * - :ref:`XC-functionals ` - :ref:`DFT+U ` - :ref:`GLLB-SC ` * - :ref:`DOS ` - :ref:`STM ` - :ref:`Wannier functions ` * - :ref:`delta-SCF ` - :ref:`XAS ` - :ref:`Jellium ` * - :ref:`TDDFT ` - :ref:`LRTDDFT (molecules) ` - :ref:`LRTDDFT (extended systems) ` * - :ref:`RPA-correlation ` - :ref:`GW ` - :ref:`BSE ` * - :ref:`Parallelization ` - :ref:`Continuum Solvent Model ` - This Page gives a quick overview of the algorithms used. We have written some :ref:`papers ` about the implementation, where *all* the details can be found. Introduction ============ Using the projector-augmented wave (PAW) method [Blo94]_, [Blo03]_ allows us to get rid of the core electrons and work with soft pseudo valence wave functions. The pseudo wave functions don't need to be normalized - this is important for the efficiency of calculations involving 2. row elements (such as oxygen) and transition metals. A further advantage of the PAW method is that it is an all-electron method (frozen core approximation) and there is a one to one transformation between the pseudo and all-electron quantities. Description of the wave functions ================================= Pseudo wave functions can be described in three ways: Finite-difference (FD): Uniform real-space orthorhombic grids. Two kinds of grids are involved in the calculations: A coarse grid used for the wave functions and a fine grid (`2^3=8` times higher grid point density) used for densities and potentials. The pseudo electron density is first calculated on the coarse grid from the wave functions, and then interpolated to the fine grid, where compensation charges are added for achieving normalization. The effective potential is evaluated on the fine grid (solve the Poisson equation and calculate the exchange-correlation potential) and then restricted to the coarse grid where it needs to act on the wave functions (also on the coarse grid). Plane-waves (PW): Expansion in plane-waves. There is one cutoff used for the wave-functions and a higher cutoff for electron densities and potentials. Linear combination of atomic orbitals (LCAO): Expansion in atom-centered basis functions. Multi-grid techniques for FD-mode ================================= The Poisson equation is solved using a standard multi-grid solver. Solving the Kohn-Sham equation is done via iterative multi-grid eigensolvers starting from a good guess for the wave functions obtained by diagonalizing a Hamiltonian for a subspace of atomic orbitals. We use the multi-grid preconditioner described by Briggs *et al.* [Bri96]_ for the residuals, and standard Pulay mixing is used to update the density. Compensation charges ==================== Compensation charges are expanded to give correct multipole moments up to angular momentum number `\ell=2`. Boundary conditions =================== In each of the three directions, the boundary conditions can be either periodic or open. Mask function technique ======================= Due to the discreticed nature of space in finite difference methods, the energy of an atom will depend on its position relative to the grid points. The problem comes from the calculation of the integral of a wave function times an atom centered localized function (radial functions times a spherical harmonic). To reduce this dependence, we use the technique of [Taf06]_, where the radial functions (projector functions) are smoothened as follows: * Divide function by a mask function that goes smoothly to zero at approximately twice the cutoff radius. * Fourier transform. * Cut off short wavelength components. * Inverse Fourier transform. * Multiply by mask function. Exchange-correlation functionals ================================ All the functionals from the :ref:`libxc ` library can be used. Calculating the XC-energy and potential for the extended pseudo density is simple. For GGA functionals, a nearest neighbor finite difference stencil is used for the gradient operator. In the PAW method, there is a correction to the XC-energy inside the augmentation spheres. The integration is done on a non-linear radial grid - very dense close to the nuclei and less dense away from the nuclei. Parallelization =============== Parallelization is done by distributing **k**-points, spins, and bands over all processors and on top of that domain-decomposition is used. ASE interface ============= The code has been designed to work together with the atomic simulation environment (`ASE `). ASE provides: * Structure optimization. * Molecular dynamics. * Nudged elastic band calculations. * Maximally localized Wannier functions. * Scanning tunneling microscopy images. Open Software ============= GPAW is released under the `GNU Public License `_ version 3 or any later version. See the file :git:`COPYING` which accompanies the downloaded files, or see the license at GNU's web server at http://www.gnu.org/licenses/. Everybody is invited to participate in using and :ref:`developing the code `. .. figure:: carlsberg.png :width: 12cm September 2003 - August 2005: Sponsored by The `Carlsberg Foundation`_ (artwork by P. Erhart) .. _Carlsberg Foundation: http://www.carlsbergfondet.dk .. [Blo94] P. E. Blöchl, Phys. Rev. B 50, 17953 (1994) .. [Blo03] P. E. Blöchl, C. J. Först and J. Schimpl, Bull. Mater. Sci, 26, 33 (2003) .. [Bri96] E. L. Briggs, D. J. Sullivan and J. Bernholc, Phys. Rev. B 54, 14362 (1996) .. [Taf06] *A general and efficient pseudopotential Fourier filtering scheme for real space methods using mask functions*, Maxim Tafipolsky, Rochus Schmid, J Chem Phys. 2006 May 7;124:174102 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/bugs.rst000066400000000000000000000023141316441372200223630ustar00rootroot00000000000000.. _bugs: Bugs! ===== If you find a bug in the GPAW software, please report it to the developers so it can be fixed. We need that feedback from the community to maintain the quality of the code. Bug report ---------- * If you are unsure if it is a real bug, or a usage problem, it is probably best to report the problem on the ``gpaw-users`` mailing list (see :ref:`contact`). Please provide the failing script as well as the information about your environment (processor architecture, versions of Python and NumPy). Then we (or other users) can help you to find out if it is a bug. Another advantage of reporting bugs on the mailing list: often other users will tell you how to work around the bug (until it is solved). * If you think it is a bug, you can also report it directly on our `issue tracker`_. The advantage of reporting bugs here is that it is not forgotten (which may be a risk on the mailing list). We do not guarantee to fix all bugs, but we will do our best. Known bugs ---------- * `A list of known bugs`_. * `Very old bugs`_. .. _A list of known bugs: .. _issue tracker: https://gitlab.com/gpaw/gpaw/issues .. _Very old bugs: http://trac.fysik.dtu.dk/projects/gpaw/report/1 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/check_images.py000066400000000000000000000006061316441372200236470ustar00rootroot00000000000000"""This script will print a list of files generated by the AGTS scripts that run every weekend. Just do:: $ python check_images """ import os from gpaw.test.big.agts import AGTSQueue queue = AGTSQueue() queue.collect() for job in queue.jobs: if not job.creates: continue for name in job.creates: path = os.path.join(job.dir, name) print(path) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/conf.py000066400000000000000000000026011316441372200221670ustar00rootroot00000000000000import sys import sphinx_rtd_theme from gpaw import __version__ sys.path.append('.') extensions = ['images', 'ext', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.mathjax', 'sphinx.ext.intersphinx'] templates_path = ['templates'] source_suffix = '.rst' master_doc = 'index' project = 'GPAW' copyright = '2017, GPAW developers' exclude_patterns = ['build'] default_role = 'math' pygments_style = 'sphinx' autoclass_content = 'both' modindex_common_prefix = ['gpaw.'] intersphinx_mapping = { 'ase': ('http://wiki.fysik.dtu.dk/ase', None), 'numpy': ('http://docs.scipy.org/doc/numpy', None), 'mayavi': ('http://docs.enthought.com/mayavi/mayavi', None)} html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_style = 'gpaw.css' html_title = 'GPAW' html_favicon = 'static/gpaw_favicon.ico' html_static_path = ['static'] html_last_updated_fmt = '%a, %d %b %Y %H:%M:%S' dev_version = '1.3.1b1' # This line auto-edited by newrelease script stable_version = '1.3.0' # This line auto-edited by newrelease script html_context = { 'current_version': __version__, 'versions': [('{} (development)'.format(dev_version), 'https://wiki.fysik.dtu.dk/gpaw/dev'), ('{} (latest stable)'.format(stable_version), 'https://wiki.fysik.dtu.dk/gpaw')]} gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/contact.rst000066400000000000000000000036651316441372200230700ustar00rootroot00000000000000.. _contact: ======= Contact ======= .. _mail list: Mail List ========= There is a mailing list for getting help and for discussing GPAW: * gpaw-users_ You should consider also subscribing to the ASE :ref:`ase:mail list`. Note that you can search the mailing list archives: click on the mailing list above, then choose the archive, and search from that page. .. _irc: Internet Relay Chat =================== We have the IRC channel ``#gpaw`` on FreeNode. Please join us if you have any questions. For easy access, you can use this webclient_. Note: While IRC is much more interactive than e-mail, there are not as many people as on the mailing list, and those present are not continually reading it. Therefore if you don't receive an answer quickly you can either send an e-mail instead, or simply stay online till the day after. This is particularly true if you ask your question at 04:00 at night (in Europe) and/or during the weekend. Finally, to save time, state your complete question immediately instead of asking whether someone might be able to answer a question related to some topic. Logs from the IRC channel: * irc-logs_ GitLab ====== Feel free to create Merge Requests and Issues on our GitLab page: https://gitlab.com/gpaw/gpaw Old mail lists ============== These lists are inactive and serve as an archives only: * gpaw-developers_ (deactivated Jun 20 2016) * gridpaw-developer_ (deactivated Oct 20 2009) .. _webclient: http://webchat.freenode.net/?randomnick=0&channels=gpaw .. _irc-logs: http://dcwww.fys.dtu.dk/~jensj/gpaw-stuff .. _gpaw-developers: https://listserv.fysik.dtu.dk/mailman/listinfo/ gpaw-developers .. _gpaw-svncheckins: https://listserv.fysik.dtu.dk/mailman/listinfo/ gpaw-svncheckins .. _gpaw-users: https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users .. _gridpaw-developer: http://listserv.fysik.dtu.dk/mailman/listinfo/ gridpaw-developer gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/000077500000000000000000000000001316441372200217705ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/256H2O/000077500000000000000000000000001316441372200226155ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/256H2O/akka.sh000077500000000000000000000007771316441372200240760ustar00rootroot00000000000000#!/bin/bash ### SNAC project number, enter if applicable. ### NOTE! No spaces or slashes allowed #PBS -A HPC2N-2008-005 ### Requesting 4 nodes with 8 VP:s on each node #PBS -l nodes=4:ppn=8 ### Requesting time - 20 minutes #PBS -l walltime=00:20:00 # Change to Working Directory cd $PBS_O_WORKDIR module add openmpi/1.2.6/gcc gpawhome=${HOME}/gpaw export PYTHONPATH=${gpawhome}:${PYTHONPATH} mpiexec ${gpawhome}/build/bin.linux-x86_64-2.4/gpaw-python ../b256H2O.py --sl_diagonalize=4,4,64 --gpaw=usenewlfc=1 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/256H2O/b256H2O.py000066400000000000000000000070721316441372200241640ustar00rootroot00000000000000#!/usr/bin/env python from ase import Atoms from gpaw import GPAW from gpaw import ConvergenceError from gpaw.mpi import rank from gpaw.eigensolvers.rmm_diis_old import RMM_DIIS from gpaw import setup_paths # Use setups from the $PWD and $PWD/.. first setup_paths.insert(0, '.') setup_paths.insert(0, '../') positions=[ (-0.069, 0.824,-1.295), ( 0.786, 0.943,-0.752), (-0.414,-0.001,-0.865), (-0.282,-0.674,-3.822), ( 0.018,-0.147,-4.624), (-0.113,-0.080,-3.034), ( 2.253, 1.261, 0.151), ( 2.606, 0.638,-0.539), ( 2.455, 0.790, 1.019), ( 3.106,-0.276,-1.795), ( 2.914, 0.459,-2.386), ( 2.447,-1.053,-1.919), ( 6.257,-0.625,-0.626), ( 7.107,-1.002,-0.317), ( 5.526,-1.129,-0.131), ( 5.451,-1.261,-2.937), ( 4.585,-0.957,-2.503), ( 6.079,-0.919,-2.200), (-0.515, 3.689, 0.482), (-0.218, 3.020,-0.189), ( 0.046, 3.568, 1.382), (-0.205, 2.640,-3.337), (-1.083, 2.576,-3.771), (-0.213, 1.885,-2.680), ( 0.132, 6.301,-0.278), ( 1.104, 6.366,-0.068), (-0.148, 5.363,-0.112), (-0.505, 6.680,-3.285), (-0.674, 7.677,-3.447), (-0.965, 6.278,-2.517), ( 4.063, 3.342,-0.474), ( 4.950, 2.912,-0.663), ( 3.484, 2.619,-0.125), ( 2.575, 2.404,-3.170), ( 1.694, 2.841,-3.296), ( 3.049, 2.956,-2.503), ( 6.666, 2.030,-0.815), ( 7.476, 2.277,-0.316), ( 6.473, 1.064,-0.651), ( 6.860, 2.591,-3.584), ( 6.928, 3.530,-3.176), ( 6.978, 2.097,-2.754), ( 2.931, 6.022,-0.243), ( 3.732, 6.562,-0.004), ( 3.226, 5.115,-0.404), ( 2.291, 7.140,-2.455), ( 1.317, 6.937,-2.532), ( 2.586, 6.574,-1.669), ( 6.843, 5.460, 1.065), ( 7.803, 5.290, 0.852), ( 6.727, 5.424, 2.062), ( 6.896, 4.784,-2.130), ( 6.191, 5.238,-2.702), ( 6.463, 4.665,-1.259), ( 0.398, 0.691, 4.098), ( 0.047, 1.567, 3.807), ( 1.268, 0.490, 3.632), ( 2.687, 0.272, 2.641), ( 3.078, 1.126, 3.027), ( 3.376,-0.501, 2.793), ( 6.002,-0.525, 4.002), ( 6.152, 0.405, 3.660), ( 5.987,-0.447, 4.980), ( 0.649, 3.541, 2.897), ( 0.245, 4.301, 3.459), ( 1.638, 3.457, 3.084), (-0.075, 5.662, 4.233), (-0.182, 6.512, 3.776), (-0.241, 5.961, 5.212), ( 3.243, 2.585, 3.878), ( 3.110, 2.343, 4.817), ( 4.262, 2.718, 3.780), ( 5.942, 2.582, 3.712), ( 6.250, 3.500, 3.566), ( 6.379, 2.564, 4.636), ( 2.686, 5.638, 5.164), ( 1.781, 5.472, 4.698), ( 2.454, 6.286, 5.887), ( 6.744, 5.276, 3.826), ( 6.238, 5.608, 4.632), ( 7.707, 5.258, 4.110), ( 8.573, 8.472, 0.407), ( 9.069, 7.656, 0.067), ( 8.472, 8.425, 1.397), ( 8.758, 8.245, 2.989), ( 9.294, 9.091, 3.172), ( 7.906, 8.527, 3.373), ( 4.006, 7.734, 3.021), ( 4.685, 8.238, 3.547), ( 3.468, 7.158, 3.624), ( 5.281, 6.089, 6.035), ( 5.131, 7.033, 6.378), ( 4.428, 5.704, 5.720), ( 5.067, 7.323, 0.662), ( 5.785, 6.667, 0.703), ( 4.718, 7.252, 1.585)] prefix = 'b256H2O' L = 9.8553729 atoms = Atoms('32(OH2)', positions=positions) atoms.set_cell((L,L,L),scale_atoms=False) atoms.set_pbc(1) r = [2, 2, 2] atoms = atoms.repeat(r) n = [56 * ri for ri in r] # nbands (>=128) is the number of bands per 32 water molecules nbands = 2*6*11 # 132 for ri in r: nbands = nbands*ri # the next line decreases memory usage es = RMM_DIIS(keep_htpsit=False) calc = GPAW(nbands=nbands, # uncomment next two lines to use lcao/sz #mode='lcao', #basis='sz', gpts=tuple(n), maxiter=5, width = 0.01, eigensolver = es, txt=prefix + '.txt', ) atoms.set_calculator(calc) from gpaw.mpi import rank try: pot = atoms.get_potential_energy() except ConvergenceError: pass gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/256H2O/prepare.sh000077500000000000000000000014471316441372200246200ustar00rootroot00000000000000#!/bin/bash FORMAT=1 setFORMAT () { # function setFORMAT takes integer as the argument $1 # and returns integer in the format %05d or %d (printf' like format) # depending on the FORMAT variable (1 or 0) if [ ${FORMAT} -eq "1" ]; then integer_formatted=`echo $1 | awk '{if ($1<10) printf("0000%.0f", $1); else if ($1<100) printf("000%.0f", $1); else if ($1<1000) printf("00%.0f", $1); else if ($1<10000) printf("0%.0f", $1); else printf("%.0f", $1)}'` else integer_formatted=$1 fi echo $integer_formatted } if test -z $PATTERN; then echo "Error: no directory pattern provided" exit fi for p in 16 32 64 128 do proc=`setFORMAT $p` dir="${PATTERN}_${proc}_" if [ ! -d "${dir}" ]; then mkdir ${dir} echo "${dir} created" fi done gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/256H2O/scaling.py000066400000000000000000000206461316441372200246170ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # Emacs: treat this as -*- python -*- from __future__ import print_function from optparse import OptionParser parser = OptionParser(usage='%prog [options] output_prefix.\nExample of call:\n'+ 'python %prog --dir=. --pattern="b256H2O_120_04x04m64.grid_*_" b256H2O\n', version='%prog 0.1') parser.add_option('--dir', dest="dir", default='.', help='results directory.') parser.add_option('--iter', dest="iter", default=5, help='number of SCF steps.') parser.add_option('--pattern', dest="pattern", default='', help='pattern for directories to search.') parser.add_option('-v', '--verbose', action='store_true', default=False, help='verbose mode.') opt, args = parser.parse_args() import os def T(s): """Return time in seconds from hh:mm:ss""" t = 0 for x in s.split(':'): t = t * 60 + int(x) return t def analyse_benchmark(dir, pattern, output_prefix, iter, verbose=False): from os.path import abspath, exists, join output = output_prefix+'.txt' root_abspath = abspath(dir) # length of directory name rootlen = len(root_abspath) + 1 assert exists(root_abspath) from glob import glob f_list = sorted(glob(join(root_abspath, pattern, output))) assert not f_list == [], 'Error: list of output files is empty' import re time = {} processes = [] for f in f_list: # extract the number of processes p d = f.split('/')[-2] p = d.split('_')[-2] p = int(p) processes.append(p) # time[p] = { 'start': 0.0, 'fixdensity_start_estimate': 0.0, 'fixdensity_end': 0.0, 'SCF_start': 0.0, 'SCF_end': 0.0, 'forces_start': 0.0, 'forces_end': 0.0, 'total': 0.0, } # lines = open(f).readlines() # extract gpaw version for n, l in enumerate(lines): if l.startswith(' |__ | _|___|_____|'): gpaw_version = lines[n + 0].strip().split()[3].split('.')[-1] break if gpaw_version[-1] == 'M': gpaw_version = gpaw_version[:-1] if gpaw_version.rfind(':') != -1: gpaw_version = gpaw_version[:gpaw_version.rfind(':')] gpaw_version = int(gpaw_version) # assume old version (< 3172) start_iter = 0 # old style # # Atomic orbitals used for initialization: 1536 # log10-error: Total Iterations: # Time WFS Density Energy Fermi Poisson #iter: 0 12:10:09 -3568.07860 0 11 # log10-error: Total Iterations: # Time WFS Density Energy Fermi Poisson #iter: 0 12:13:29 +0.2 -3663.00195 0 1 #iter: 1 12:15:18 -0.8 -4417.57264 0 1 #iter: 2 12:17:07 -1.3 -4469.68829 0 1 #iter: 3 12:18:57 -0.9 -0.8 -4091.42827 0 7 #iter: 4 12:20:48 -1.1 -1.0 -4055.26110 0 7 #iter: 5 12:22:40 -1.4 -1.3 -4106.38102 0 7 # # new style # log10-error: Total Iterations: # Time WFS Density Energy Fermi Poisson #iter: 1 16:16:59 +0.4 -3663.00195 0 1 #iter: 2 16:19:11 -0.8 -4417.57264 0 1 #iter: 3 16:21:21 -1.3 -4469.68829 0 1 #iter: 4 16:23:34 -0.9 -0.8 -4091.42827 0 7 #iter: 5 16:25:49 -1.1 -1.0 -4055.26110 1 7 # if len(str(gpaw_version)) == 1: # stable release found # assume new version - this is wrong but nothing else can be done start_iter = 1 if len(str(gpaw_version)) > 4: # more then 4 digits in svnversion found # assume new version (can't compare strings here) start_iter = 1 else: if gpaw_version >= 3172: # new version start_iter = 1 # extract start time for n, l in enumerate(lines): if l.startswith('Date: '): #print l, n, f t = T(lines[n + 0].split()[4]) break time[p]['start'] = t # extract SCF beginning time estimate and end time (constant potential steps (fixdensity)) for n, l in enumerate(lines): if l.startswith('iter: 1'): #print l, n, f if start_iter == 0: fixdensity_start = n-1 else: fixdensity_start = n+0 t1 = T(lines[fixdensity_start + 0].split()[2]) t2 = T(lines[fixdensity_start + 1].split()[2]) t3 = T(lines[fixdensity_start + 2].split()[2]) break # estimate the beginning of fixdensity based on 3 fixdensity steps time[p]['fixdensity_start_estimate'] = t1-(t3-t1)/2.0 time[p]['fixdensity_end'] = t3 # extract SCF beginning and end time time[p]['SCF_start'] = time[p]['fixdensity_end'] for n, l in enumerate(lines): if l.startswith('iter: '+"%3s" % iter): #print l, n, f t = T(lines[n + 0].split()[2]) break time[p]['SCF_end'] = t for n, l in enumerate(lines): if l.startswith('Total:') and (l.find('MB') == -1) and (l.find('GB') == -1): #print l, n, f t = l.split()[1] break time[p]['total'] = t # # results # speedup = {} efficiency = {} # if verbose: print("# p - processes, p0 - reference processes, t - time [sec], s - speedup, e - efficiency") print("# GPAW version "+str(gpaw_version)+": stages: 1 - initialization, 2 - fixdensity, 3 - SCF, 4 - forces, 5 - total") print("# p "+" p/p0 "+" t1 "+" s1 "+" e1 "+" t2 "+" s2 "+" e2 "+" t3 "+" s3 "+" e3 "+" t4 "+" s4 "+" e4 "+" t5 "+" s5 "+" e5") for p in processes: time[p]['init'] = time[p]['fixdensity_start_estimate'] - time[p]['start'] time[p]['fixdensity'] = time[p]['fixdensity_end'] - time[p]['fixdensity_start_estimate'] time[p]['SCF'] = time[p]['SCF_end'] - time[p]['SCF_start'] time[p]['forces'] = time[p]['forces_end'] - time[p]['forces_start'] tot = max(time[p]['fixdensity_end'], time[p]['SCF_end'], time[p]['forces_end'])-time[p]['start'] sum_of_entries = time[p]['init'] + time[p]['fixdensity']+ time[p]['SCF'] + time[p]['forces'] #print time[p]['init'], time[p]['fixdensity'], time[p]['SCF'], time[p]['forces'] if verbose: if abs(float(tot)-float(time[p]['total'])) > 5.0: print('Warning: Sum of time entries: '+str(tot)+' does not match total time in the output: '+str(time[p]['total'])) time[p]['total'] = sum_of_entries # calculate speedup[p] = {} efficiency[p] = {} for stage in ['init', 'fixdensity', 'SCF', 'forces', 'total']: if time[p][stage] > 0.0: speedup[p][stage] = float(time[processes[0]][stage])/float(time[p][stage])*processes[0] else: speedup[p][stage] = 0.0 efficiency[p][stage] = speedup[p][stage]/p # print results print(' %5d %6.2f %7.1f %7.1f %5.2f %7.1f %7.1f %5.2f %7.1f %7.1f %5.2f %7.1f %7.1f %5.2f %7.1f %7.1f %5.2f' %( p, float(p)/processes[0], float(time[p]['init']), speedup[p]['init'], efficiency[p]['init'], float(time[p]['fixdensity']), speedup[p]['fixdensity'], efficiency[p]['fixdensity'], float(time[p]['SCF']), speedup[p]['SCF'], efficiency[p]['SCF'], float(time[p]['forces']), speedup[p]['forces'], efficiency[p]['forces'], float(time[p]['total']), speedup[p]['total'], efficiency[p]['total'], )) if __name__ == '__main__': from os import environ assert len(args) == 1, 'Error: Only one argument allowed: output prefix' output_prefix = args[0] analyse_benchmark(opt.dir, opt.pattern, output_prefix, opt.iter, opt.verbose) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/256H2O/surveyor.sh000077500000000000000000000014571316441372200250610ustar00rootroot00000000000000type=b256H2O cwd=`pwd` acct=Gpaw queue=default time=60 nodes=64 mode=smp mapping=ZYXT # mapfile=BGMAP_128_4x4x4x8 # mapping=$mapfile job=${type}_${nodes}_${mode}_${mapping} input=${type}.py # pos=Au102_revised.xyz scratch=/pvfs-surveyor/${USER} install=/soft/apps rm -rf $scratch/$job mkdir $scratch/$job cp $input $scratch/$job # cp $mapfile $scratch/$job # cp $pos $scratch/$job cd $scratch/$job qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$GPAW_SETUP_PATH:PYTHONPATH=${install}/gpaw-r6000:${install}/ase-r1428:$PYTHONPATH:LD_LIBRARY_PATH=$CN_LD_LIBRARY_PATH ${install}/gpaw-r6000/build/bin.linux-ppc64-2.6/gpaw-python ${type}.py --domain-decomposition=4,4,4 --state-parallelization=1 --sl_diagonalize=4,4,64 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/000077500000000000000000000000001316441372200240765ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/Au102_revised.xyz000066400000000000000000001135331316441372200271710ustar00rootroot00000000000000 762 co O 4.643068 55.35863 1.914528 C 5.530358 54.68889 1.117290 O 6.008219 55.21918 8.3859563E-02 C 5.952099 53.31332 1.484933 C 5.489089 52.76123 2.641151 C 5.882139 51.47557 3.007024 C 6.783984 52.64256 0.6299170 C 7.210886 51.35863 0.9500570 C 6.720107 50.79259 2.134859 S 7.281971 49.15729 2.568976 O 23.82684 45.53658 14.03025 C 23.14090 46.14394 14.88940 O 23.70600 47.10936 15.67683 C 21.68042 45.89135 14.98117 C 21.12938 44.84304 14.29801 C 19.76040 44.58648 14.39198 C 20.93243 46.67555 15.81903 C 19.54736 46.51208 15.87013 C 18.99044 45.43933 15.18126 S 17.20737 45.24619 15.20520 O 14.00951 48.13890 21.24887 C 14.41894 48.22198 20.06439 O 14.95781 49.38449 19.58521 C 14.21943 47.08743 19.12726 C 13.73244 45.90531 19.58925 C 13.53139 44.83315 18.72923 C 14.58544 47.25032 17.80919 C 14.40450 46.20317 16.90701 C 13.83438 45.02512 17.37114 S 13.53933 43.67895 16.23707 O 6.634805 43.12247 20.88744 C 6.364436 44.25287 20.16598 O 5.194173 44.70269 20.09063 C 7.455374 44.92797 19.41810 C 8.740571 44.49224 19.58603 C 9.786382 45.12344 18.91717 C 7.148305 45.95941 18.57416 C 8.167450 46.61039 17.87421 C 9.466511 46.13103 18.00820 S 10.79936 46.98213 17.16426 O 10.04447 54.06574 20.86317 C 10.15460 52.81568 20.81059 O 9.592354 51.99842 21.75259 C 10.91649 52.19519 19.69715 C 11.34933 52.98172 18.67313 C 12.02130 52.40578 17.59624 C 11.12052 50.84320 19.72609 C 11.83240 50.23237 18.70208 C 12.31142 51.04565 17.67127 S 13.26335 50.29810 16.37928 O 14.16082 59.70705 14.48564 C 13.78335 58.86912 13.47232 O 13.10441 59.30626 12.51030 C 14.20429 57.44548 13.50803 C 14.94624 57.01441 14.57421 C 15.33352 55.68627 14.66496 C 13.85516 56.61068 12.48615 C 14.23940 55.26741 12.52295 C 14.94042 54.82528 13.63594 S 15.56634 53.16148 13.67095 O -6.5146446E-02 51.59646 8.508490 C 0.2945593 51.48835 7.193063 O -0.1726409 52.26707 6.325387 C 1.273334 50.44762 6.787957 C 1.736292 49.56859 7.728009 C 2.668320 48.59532 7.373927 C 1.679030 50.40224 5.483103 C 2.578065 49.42257 5.072924 C 3.083218 48.55518 6.037987 S 4.253213 47.30558 5.539199 O 13.36074 37.85122 18.10799 C 13.70326 37.44828 16.96875 O 13.33343 36.20832 16.52474 C 14.41043 38.37921 16.05306 C 14.83851 39.58693 16.51898 C 15.50635 40.47409 15.67826 C 14.68518 37.95802 14.77715 C 15.35148 38.80738 13.90391 C 15.72939 40.06745 14.36304 S 16.38135 41.24491 13.19003 O 6.287794 37.49395 14.85789 C 6.221934 38.31190 15.95244 O 5.575912 37.97471 16.97543 C 6.901430 39.63230 15.94516 C 7.596233 40.01393 14.83218 C 8.270264 41.23211 14.81896 C 6.821406 40.41824 17.06029 C 7.470425 41.65039 17.09102 C 8.168453 42.04016 15.94409 S 8.884541 43.67139 15.89800 O 2.993605 50.10533 18.38090 C 3.362277 50.93982 17.51762 O 2.463053 51.79006 16.93460 C 4.789406 50.96944 17.10817 C 5.683452 50.19223 17.79096 C 7.030296 50.20619 17.44403 C 5.169454 51.78331 16.07700 C 6.504401 51.83043 15.69505 C 7.398354 50.98341 16.34212 S 9.112476 51.02820 15.86298 O -0.7125636 41.38853 4.938404 C 0.5016739 40.81726 4.672509 O 0.5938559 39.80952 3.928522 C 1.726058 41.36243 5.311957 C 1.610145 42.40201 6.188053 C 2.747090 42.96806 6.755086 C 2.939030 40.84001 4.961090 C 4.110150 41.36243 5.514902 C 3.977959 42.38340 6.453168 S 5.411166 42.88195 7.382144 O 5.181141 57.59570 5.192425 C 6.043667 57.00060 5.884848 O 7.145545 57.67281 6.338097 C 5.853166 55.55480 6.165186 C 4.731126 54.94861 5.664968 C 4.500156 53.59954 5.897926 C 6.752260 54.87473 6.928018 C 6.570124 53.51169 7.180985 C 5.440186 52.89737 6.655042 S 5.193209 51.14455 6.880855 O 8.619753 36.96050 18.18099 C 8.896887 36.76692 16.97133 O 8.472108 35.63259 16.33549 C 9.757255 37.75208 16.26816 C 10.14839 38.87603 16.94024 C 10.95255 39.82021 16.32104 C 10.15226 37.50484 14.98403 C 10.92341 38.44786 14.30623 C 11.30838 39.59216 14.98796 S 12.41032 40.75740 14.21226 O 3.950984 42.53683 17.42722 C 3.593360 43.73258 17.56802 O 2.648002 44.07249 18.49655 C 4.262546 44.80813 16.79303 C 5.179490 44.48700 15.83618 C 5.789275 45.49751 15.08800 C 3.867588 46.10311 17.01098 C 4.442561 47.14037 16.29496 C 5.425463 46.81110 15.35097 S 6.394397 48.13923 14.67604 O 10.90868 57.20771 18.95900 C 9.856514 56.68837 18.25569 O 8.690457 56.78666 18.71196 C 10.09432 55.97482 16.97525 C 11.36536 55.92363 16.46324 C 11.61937 55.23135 15.28523 C 9.045316 55.38842 16.33426 C 9.249225 54.68624 15.14410 C 10.55137 54.58560 14.65924 S 10.81635 53.85376 13.04497 O 14.46961 58.72963 3.168493 C 15.48247 58.07812 3.817401 O 16.63726 58.05564 3.323952 C 15.20906 57.34775 5.081142 C 13.93824 57.34659 5.589935 C 13.66512 56.71481 6.802964 C 16.23412 56.70666 5.721064 C 16.00425 56.02834 6.920157 C 14.71023 56.04347 7.436096 S 14.34314 55.02773 8.854929 O 2.909500 57.09191 9.359017 C 3.161310 56.88253 10.57157 O 2.635657 57.69863 11.53547 C 4.021297 55.73863 10.96799 C 4.511193 54.91545 9.992210 C 5.335227 53.85260 10.33593 C 4.296136 55.54142 12.28928 C 5.143184 54.50532 12.68124 C 5.603067 53.64433 11.68723 S 6.580122 52.23243 12.15315 O 1.032707 44.42430 15.61067 C 0.5422949 44.43387 14.33363 O -0.6313003 44.05661 14.09304 C 1.410306 44.91750 13.23005 C 2.691346 45.28924 13.52196 C 3.543456 45.72148 12.50795 C 0.9062620 44.98847 11.96021 C 1.733203 45.38057 10.90404 C 3.021432 45.79943 11.21596 S 4.057307 46.44110 9.916105 O 22.75822 39.18289 9.874498 C 22.89954 40.29198 9.086229 O 24.01403 40.86176 8.982292 C 21.74029 40.84001 8.337203 C 20.49323 40.31702 8.539077 C 19.39811 40.83303 7.854136 C 21.94326 41.89996 7.495051 C 20.89111 42.40899 6.742937 C 19.61829 41.87902 6.960889 S 18.25931 42.50324 5.994040 O 9.011614 33.61625 9.421977 C 8.129450 34.37983 9.887013 O 6.836926 33.95716 10.03587 C 8.492226 35.77122 10.25804 C 9.813372 36.11678 10.29806 C 10.17720 37.41583 10.63320 C 7.495189 36.66014 10.54602 C 7.813386 37.96326 10.91297 C 9.160071 38.31929 10.92726 S 9.604399 39.98542 11.36709 O 0.9573877 54.59730 14.58288 C 0.9672970 54.34949 13.23755 O 0.2956332 55.06332 12.45215 C 1.747404 53.20453 12.70303 C 2.412290 52.38950 13.56913 C 3.181167 51.33537 13.08713 C 1.806357 53.02477 11.34994 C 2.516148 51.94969 10.82114 C 3.167299 51.10266 11.71224 S 4.059295 49.70123 11.06911 O 20.01571 38.10331 11.14981 C 19.02769 37.34936 11.33123 O 19.17522 36.16042 11.99159 C 17.66317 37.80910 10.96799 C 17.47810 39.09127 10.53423 C 16.20024 39.52700 10.18194 C 16.63242 36.91204 11.02194 C 15.33730 37.30879 10.70716 C 15.14433 38.62296 10.28627 S 13.47739 39.19424 10.01793 Au 13.36135 47.11128 13.18503 Au 11.59717 47.14328 7.552933 Au 11.04726 49.57150 6.145892 Au 8.888288 47.78029 6.795103 Au 9.831093 45.10308 6.503190 Au 12.56709 45.23106 5.678902 Au 10.75526 48.00834 12.45793 Au 12.03021 49.58139 8.932105 Au 9.839216 47.88617 9.609901 Au 10.68738 45.16416 9.337996 Au 8.927027 49.25561 4.342963 Au 16.05950 46.27938 13.24899 Au 10.36721 44.46024 3.893125 Au 11.12430 46.39515 14.76822 Au 11.87624 49.30913 3.400053 Au 9.318151 50.37664 8.226083 Au 7.964193 45.91229 8.665918 Au 12.47246 43.04543 10.38988 Au 8.855413 45.98035 11.49394 Au 10.26713 50.40456 11.04124 Au 14.17730 51.86127 14.98010 Au 5.831200 48.34226 4.208976 Au 7.378880 43.28511 3.695181 Au 11.21425 43.60914 15.96803 Au 9.943442 48.94263 16.35427 Au 12.48026 52.04626 10.25304 Au 7.200296 48.65815 8.971051 Au 8.879115 43.23915 8.456898 Au 9.713131 43.26242 11.09912 Au 8.079171 48.71342 11.62221 Au 9.379185 51.75248 5.867913 Au 7.168023 49.91240 6.456027 Au 6.151152 47.02809 6.960175 Au 7.154222 44.30841 6.434946 Au 9.482951 42.41190 5.822179 Au 11.57444 42.65391 13.09213 Au 9.285130 44.40323 13.66917 Au 8.568218 47.30442 13.99610 Au 9.401384 50.22131 13.62594 Au 12.16019 51.73677 4.843896 Au 14.29926 52.74146 8.191068 Au 7.562135 51.11256 10.23303 Au 6.284110 46.77154 10.81614 Au 7.049255 44.05127 10.47921 Au 10.58616 41.18441 9.325134 Au 12.03021 54.76245 8.932105 Au 4.966249 50.45867 9.058946 Au 7.715278 41.25422 11.46893 Au 15.29596 52.95030 5.429151 Au 4.866278 44.71214 8.685212 Au 11.15109 40.06105 5.812889 Au 5.425331 48.82046 12.74019 O 19.34446 55.30380 16.01567 C 18.52981 54.68889 16.74763 O 18.00934 55.26647 17.87322 C 18.10807 53.31332 16.37999 C 18.57108 52.76123 15.22377 C 18.17803 51.47557 14.85790 C 17.27618 52.64256 17.23501 C 16.84928 51.35863 16.91487 C 17.34006 50.79259 15.73007 S 16.77820 49.15729 15.29595 O 0.1721660 45.48243 3.911289 C 0.9192697 46.14394 2.975526 O 0.4004371 47.03033 2.252563 C 2.379749 45.89135 2.883756 C 2.930790 44.84304 3.566911 C 4.299766 44.58648 3.472941 C 3.127734 46.67555 2.045891 C 4.512810 46.51208 1.994798 C 5.069727 45.43933 2.683669 S 6.852795 45.24619 2.659730 O 10.05066 48.13890 -3.383943 C 9.641226 48.22198 -2.199461 O 9.102354 49.38449 -1.720275 C 9.840737 47.08743 -1.262336 C 10.32773 45.90531 -1.724323 C 10.52878 44.83315 -0.8643050 C 9.474732 47.25032 5.5739000E-02 C 9.655665 46.20317 0.9579170 C 10.22579 45.02512 0.4937870 S 10.52084 43.67895 1.627852 O 17.42536 43.12247 -3.022517 C 17.69574 44.25287 -2.301048 O 18.86600 44.70270 -2.225700 C 16.60480 44.92797 -1.553177 C 15.31960 44.49224 -1.721107 C 14.27379 45.12344 -1.052244 C 16.91186 45.95941 -0.7092380 C 15.89272 46.61039 -9.2900004E-03 C 14.59366 46.13103 -0.1432770 S 13.26081 46.98213 0.7006620 O 14.02552 54.17721 -3.002937 C 13.90557 52.81568 -2.945663 O 14.42178 52.06533 -3.810549 C 13.14368 52.19519 -1.832227 C 12.71084 52.98172 -0.8082090 C 12.03887 52.40578 0.2686880 C 12.93965 50.84320 -1.861168 C 12.22777 50.23237 -0.8371500 C 11.74875 51.04565 0.1936560 S 10.79682 50.29810 1.485647 O 9.930249 59.63845 3.462245 C 10.27682 58.86912 4.392601 O 11.01631 59.34524 5.440407 C 9.855880 57.44548 4.356898 C 9.113933 57.01441 3.290719 C 8.726646 55.68627 3.199965 C 10.20501 56.61068 5.378772 C 9.820773 55.26741 5.341970 C 9.119745 54.82528 4.228985 S 8.493828 53.16148 4.193970 O 24.12531 51.59646 9.356437 C 23.76561 51.48835 10.67186 O 24.23281 52.26707 11.53954 C 22.78683 50.44762 11.07697 C 22.32388 49.56859 10.13692 C 21.39185 48.59532 10.49100 C 22.38114 50.40224 12.38182 C 21.48210 49.42257 12.79200 C 20.97695 48.55518 11.82694 S 19.80696 47.30558 12.32573 O 10.69943 37.85122 -0.2430668 C 10.35692 37.44828 0.8961694 O 10.72673 36.20831 1.340191 C 9.649743 38.37921 1.811861 C 9.221658 39.58693 1.345943 C 8.553819 40.47409 2.186667 C 9.374989 37.95802 3.087774 C 8.708688 38.80738 3.961011 C 8.330782 40.06745 3.501883 S 7.678825 41.24491 4.674894 O 17.77238 37.49394 3.007031 C 17.83823 38.31190 1.912485 O 18.48426 37.97472 0.8895011 C 17.15874 39.63230 1.919765 C 16.46394 40.01393 3.032750 C 15.78990 41.23211 3.045970 C 17.23876 40.41824 0.8046360 C 16.58974 41.65039 0.7739090 C 15.89172 42.04016 1.920837 S 15.17563 43.67139 1.966928 O 21.09944 50.03093 -0.5929538 C 20.69789 50.93982 0.3473062 O 21.52350 51.72045 0.8825867 C 19.27076 50.96944 0.7567580 C 18.37672 50.19223 7.3960997E-02 C 17.02987 50.20619 0.4208980 C 18.89071 51.78331 1.787922 C 17.55577 51.83043 2.169874 C 16.66182 50.98341 1.522806 S 14.94769 51.02820 2.001944 O 24.67332 41.34176 12.94829 C 23.55849 40.81726 13.19242 O 23.45810 39.71967 14.00275 C 22.33411 41.36243 12.55297 C 22.45002 42.40201 11.67687 C 21.31308 42.96806 11.10984 C 21.12114 40.84001 12.90384 C 19.95002 41.36243 12.35002 C 20.08221 42.38340 11.41176 S 18.64900 42.88195 10.48278 O 18.87903 57.59570 12.67250 C 18.01650 57.00060 11.98008 O 16.91463 57.67281 11.52683 C 18.20700 55.55480 11.69974 C 19.32904 54.94861 12.19996 C 19.56001 53.59954 11.96700 C 17.30791 54.87473 10.93691 C 17.49005 53.51169 10.68394 C 18.61998 52.89737 11.20988 S 18.86696 51.14455 10.98407 O 15.46512 36.97776 -0.4239281 C 15.16328 36.76692 0.8935930 O 15.55328 35.72546 1.477371 C 14.30291 37.75208 1.596767 C 13.91178 38.87603 0.9246890 C 13.10762 39.82021 1.543887 C 13.90791 37.50484 2.880898 C 13.13676 38.44786 3.558693 C 12.75179 39.59216 2.876968 S 11.64985 40.75740 3.652663 O 20.07730 42.43021 0.4502607 C 20.46681 43.73258 0.2969047 O 21.33477 44.04466 -0.5556093 C 19.79762 44.80813 1.071896 C 18.88068 44.48700 2.028741 C 18.27090 45.49751 2.776924 C 20.19258 46.10311 0.8539430 C 19.61761 47.14037 1.569970 C 18.63471 46.81110 2.513952 S 17.66577 48.13923 3.188889 O 13.23763 57.16519 -1.036496 C 14.20365 56.68837 -0.3907657 O 15.47369 56.79543 -0.8877281 C 13.96585 55.97482 0.8896730 C 12.69481 55.92363 1.401682 C 12.44079 55.23135 2.579695 C 15.01485 55.38842 1.530667 C 14.81094 54.68624 2.720828 C 13.50880 54.58560 3.205682 S 13.24382 53.85376 4.819957 O 9.507632 58.67628 14.64330 C 8.577701 58.07812 14.04752 O 7.319938 58.05363 14.58498 C 8.851114 57.34775 12.78378 C 10.12193 57.34659 12.27499 C 10.39505 56.71481 11.06196 C 7.826046 56.70666 12.14386 C 8.055922 56.02834 10.94477 C 9.349940 56.04347 10.42883 S 9.717032 55.02773 9.009996 O 21.17312 57.11058 8.614030 C 20.89886 56.88253 7.293349 O 21.38148 57.63181 6.408372 C 20.03887 55.73863 6.896933 C 19.54898 54.91545 7.872715 C 18.72494 53.85260 7.528994 C 19.76403 55.54142 5.575643 C 18.91698 54.50532 5.183687 C 18.45710 53.64433 6.177691 S 17.48005 52.23243 5.711774 O 23.02747 44.42430 2.254256 C 23.51787 44.43387 3.531297 O 24.69147 44.05661 3.771881 C 22.64986 44.91750 4.634876 C 21.36882 45.28924 4.342963 C 20.51671 45.72148 5.356976 C 23.15391 44.98847 5.904715 C 22.32697 45.38057 6.960889 C 21.03874 45.79943 6.648968 S 20.00286 46.44110 7.948820 O 1.301953 39.18289 7.990426 C 1.160635 40.29198 8.778694 O 4.6143651E-02 40.86176 8.882634 C 2.319879 40.84001 9.527722 C 3.566937 40.31702 9.325848 C 4.662059 40.83303 10.01079 C 2.116911 41.89996 10.36987 C 3.169056 42.40899 11.12199 C 4.441880 41.87902 10.90404 S 5.800859 42.50324 11.87089 O 15.04855 33.61625 8.442947 C 15.93072 34.37983 7.977912 O 17.22324 33.95717 7.829062 C 15.56794 35.77122 7.606885 C 14.24680 36.11678 7.566868 C 13.88297 37.41583 7.231722 C 16.56498 36.66014 7.318903 C 16.24678 37.96326 6.951957 C 14.90010 38.31929 6.937665 S 14.45577 39.98542 6.497831 O 23.10197 54.57701 3.392183 C 23.09287 54.34950 4.627372 O 23.82443 55.12697 5.482812 C 22.31277 53.20453 5.161892 C 21.64788 52.38950 4.295800 C 20.87900 51.33537 4.777796 C 22.25381 53.02477 6.514981 C 21.54402 51.94969 7.043783 C 20.89287 51.10266 6.152680 S 20.00087 49.70123 6.795818 O 3.956360 38.17054 6.731294 C 5.032481 37.34936 6.533691 O 4.897030 36.25776 5.927394 C 6.397002 37.80910 6.896933 C 6.582071 39.09127 7.330693 C 7.859930 39.52700 7.682990 C 7.427752 36.91204 6.842981 C 8.722870 37.30879 7.157761 C 8.915844 38.62296 7.578659 S 10.58278 39.19424 7.846990 Au 10.69882 47.11128 4.679896 Au 12.46300 47.14328 10.31199 Au 13.01291 49.57150 11.71903 Au 15.17188 47.78029 11.06982 Au 14.22908 45.10308 11.36174 Au 11.49308 45.23106 12.18602 Au 13.30491 48.00834 5.406998 Au 14.22095 47.88617 8.255025 Au 13.37279 45.16416 8.526929 Au 15.13314 49.25561 13.52196 Au 8.000666 46.27938 4.615939 Au 13.69296 44.46024 13.97180 Au 12.93587 46.39515 3.096706 Au 12.18393 49.30913 14.46487 Au 14.74202 50.37664 9.638842 Au 16.09598 45.91229 9.199007 Au 11.58771 43.04543 7.475042 Au 15.20476 45.98035 6.370990 Au 13.79304 50.40456 6.823687 Au 9.882868 51.86127 2.884828 Au 18.22897 48.34226 13.65595 Au 16.68129 43.28511 14.16974 Au 12.84592 43.60914 1.896898 Au 14.11673 48.94263 1.510658 Au 11.57991 52.04626 7.611887 Au 16.85987 48.65815 8.893874 Au 15.18106 43.23915 9.408027 Au 14.34704 43.26242 6.765805 Au 15.98100 48.71342 6.242719 Au 14.68098 51.75248 11.99701 Au 16.89215 49.91240 11.40890 Au 17.90902 47.02809 10.90475 Au 16.90595 44.30841 11.42998 Au 14.57722 42.41190 12.04275 Au 12.48573 42.65391 4.772793 Au 14.77504 44.40323 4.195756 Au 15.49195 47.30442 3.868828 Au 14.65879 50.22131 4.238989 Au 11.89998 51.73677 13.02103 Au 9.760904 52.74146 9.673857 Au 16.49803 51.11256 7.631896 Au 17.77606 46.77154 7.048785 Au 17.01091 44.05127 7.385717 Au 13.47401 41.18441 8.539792 Au 19.09392 50.45867 8.805979 Au 16.34489 41.25422 6.396001 Au 8.764208 52.95030 12.43577 Au 19.19389 44.71214 9.179713 Au 12.90908 40.06105 12.05204 Au 18.63484 48.82046 5.124732 H 4.807415 53.32843 3.283519 H 5.544020 51.02180 3.944466 H 7.111856 53.11485 -0.3019980 H 7.903290 50.81113 0.3021078 H 21.76348 44.20308 13.67560 H 19.30601 43.74244 13.86271 H 21.41991 47.42860 16.44698 H 18.91790 47.20725 16.43541 H 13.49565 45.79691 20.65283 H 13.15094 43.87420 19.09626 H 15.01673 48.19849 17.47157 H 14.70433 46.30693 15.85898 H 8.947954 43.64500 20.24800 H 10.82748 44.83728 19.09949 H 6.107174 46.27406 18.44740 H 7.949561 47.47427 17.23761 H 11.17027 54.06174 18.69563 H 12.31038 53.00069 16.72357 H 10.72426 50.24492 20.55317 H 12.01201 49.15220 18.70222 H 15.23519 57.72142 15.35885 H 15.92588 55.32470 15.51196 H 13.27532 56.99253 11.63940 H 13.99537 54.58651 11.70086 H 1.374198 49.62978 8.759595 H 3.061117 47.88890 8.112648 H 1.297843 51.13419 4.763409 H 2.878999 49.33641 4.023620 H 14.65571 39.86174 17.56305 H 15.84313 41.45267 16.03601 H 14.38110 36.95850 14.44924 H 15.57469 38.49433 12.87863 H 7.622866 39.36280 13.95220 H 8.860794 41.54272 13.95073 H 6.247428 40.07960 17.92913 H 7.435246 42.28933 17.97958 H 5.338098 49.55697 18.61328 H 7.771235 49.63237 18.01039 H 4.425679 52.39452 15.55522 H 6.842557 52.51338 14.90876 H 0.6196718 42.79161 6.445351 H 2.679022 43.84003 7.413918 H 2.992915 40.01233 4.246199 H 5.095037 40.98361 5.222463 H 4.012844 55.53096 5.078485 H 3.609277 53.10203 5.500629 H 7.620262 55.39634 7.344577 H 7.295382 52.94595 7.775090 H 9.824409 39.03170 17.97456 H 11.29646 40.71163 16.85593 H 9.864709 36.57100 14.48978 H 11.21722 38.28912 13.26340 H 5.437677 43.43853 15.65431 H 6.531059 45.26052 14.31818 H 3.093570 46.31846 17.75499 H 4.140304 48.17976 16.46029 H 12.18390 56.43048 16.98489 H 12.62786 55.19342 14.86033 H 8.037093 55.46783 16.75403 H 8.410931 54.22874 14.60840 H 13.13171 57.84440 5.041563 H 12.66309 56.74504 7.243469 H 17.24083 56.72539 5.290689 H 16.81367 55.50248 7.437193 H 4.254252 55.09414 8.942888 H 5.761630 53.19800 9.568656 H 3.850711 56.19806 13.04390 H 5.435155 54.37375 13.72836 H 3.049904 45.24752 14.55575 H 4.584222 45.99009 12.71695 H -0.1430433 44.73855 11.77174 H 1.379107 45.35863 9.868101 H 20.35615 39.48905 9.242426 H 18.39274 40.42902 8.012383 H 22.93876 42.34871 7.413601 H 21.05530 43.19987 6.003627 H 10.58303 35.37299 10.06692 H 11.22911 37.71835 10.66483 H 6.447533 36.34698 10.48798 H 7.033407 38.68354 11.18102 H 2.341136 52.56484 14.64765 H 3.775532 50.71114 13.76248 H 1.295664 53.72580 10.68154 H 2.560265 51.77689 9.740764 H 18.33030 39.77518 10.46323 H 16.03148 40.55112 9.833043 H 16.82802 35.87520 11.31474 H 14.49689 36.61145 10.78742 H 19.25275 53.32843 14.58141 H 18.51615 51.02180 13.92046 H 16.94831 53.11485 18.16692 H 16.15688 50.81113 17.56282 H 2.296693 44.20308 4.189324 H 4.754158 43.74244 4.002218 H 2.640261 47.42860 1.417947 H 5.142265 47.20725 1.429515 H 10.56452 45.79691 -2.787904 H 10.90923 43.87420 -1.231333 H 9.043443 48.19849 0.3933618 H 9.355838 46.30693 2.005945 H 15.11222 43.64500 -2.383070 H 13.23269 44.83727 -1.234568 H 17.95299 46.27406 -0.5824742 H 16.11061 47.47427 0.6273158 H 12.88990 54.06174 -0.8307063 H 11.74979 53.00069 1.141355 H 13.33591 50.24492 -2.688242 H 12.04816 49.15220 -0.8372912 H 8.824980 57.72142 2.506080 H 8.134295 55.32470 2.352964 H 10.78485 56.99253 6.225528 H 10.06480 54.58651 6.164064 H 22.68597 49.62978 9.105330 H 20.99905 47.88890 9.752278 H 22.76233 51.13419 13.10152 H 21.18117 49.33641 13.84130 H 9.404456 39.86174 0.3018713 H 8.217037 41.45267 1.828918 H 9.679070 36.95850 3.415682 H 8.485483 38.49433 4.986292 H 16.43731 39.36281 3.912726 H 15.19937 41.54272 3.914199 H 17.81274 40.07960 -6.4209402E-02 H 16.62492 42.28933 -0.1146565 H 18.72207 49.55698 -0.7483597 H 16.28893 49.63236 -0.1454588 H 19.63449 52.39452 2.309703 H 17.21761 52.51338 2.956168 H 23.44050 42.79161 11.41957 H 21.38115 43.84003 10.45101 H 21.06726 40.01233 13.61873 H 18.96513 40.98361 12.64246 H 20.04733 55.53096 12.78644 H 20.45089 53.10203 12.36430 H 16.43991 55.39634 10.52035 H 16.76479 52.94595 10.08984 H 14.23576 39.03170 -0.1096368 H 12.76371 40.71163 1.008989 H 14.19546 36.57100 3.375142 H 12.84295 38.28912 4.601525 H 18.62249 43.43853 2.210609 H 17.52911 45.26052 3.546743 H 20.96660 46.31846 0.1099375 H 19.91986 48.17976 1.404641 H 11.87626 56.43048 0.8800398 H 11.43231 55.19342 3.004598 H 16.02308 55.46783 1.110897 H 15.64924 54.22874 3.256528 H 10.92846 57.84440 12.82336 H 11.39708 56.74504 10.62146 H 6.819343 56.72539 12.57424 H 7.246497 55.50248 10.42773 H 19.80592 55.09414 8.922037 H 18.29854 53.19800 8.296268 H 20.20946 56.19806 4.821026 H 18.62501 54.37375 4.136564 H 21.01026 45.24752 3.309174 H 19.47595 45.99009 5.147980 H 24.20321 44.73855 6.093186 H 22.68106 45.35863 7.996823 H 3.704020 39.48905 8.622498 H 5.667424 40.42902 9.852545 H 1.121410 42.34871 10.45133 H 3.004869 43.19987 11.86130 H 13.47714 35.37299 7.798008 H 12.83106 37.71835 7.200102 H 17.61264 36.34698 7.376952 H 17.02676 38.68354 6.683907 H 21.71903 52.56484 3.217275 H 20.28464 50.71114 4.102443 H 22.76451 53.72580 7.183387 H 21.49990 51.77689 8.124163 H 5.729867 39.77518 7.401697 H 8.028692 40.55112 8.031885 H 7.232148 35.87520 6.550187 H 9.563281 36.61145 7.077501 H 4.499304 56.23379 1.504695 H 24.65897 47.12344 15.46193 H 14.99654 49.99681 20.34553 H 5.794437 42.83582 21.29505 H 9.144341 52.59243 22.38581 H 13.78954 60.58594 14.27533 H -0.7067649 52.33116 8.563978 H 12.87919 35.76204 17.26571 H 5.780760 36.68412 15.06190 H 1.590175 51.61205 17.33576 H -1.379933 40.88758 4.430267 H 7.083802 58.60372 6.048079 H 7.928782 35.11981 16.96508 H 2.340572 43.23471 18.89421 H 10.54478 57.62843 19.76219 H 14.85138 59.13754 2.367003 H 2.107297 58.37844 11.07371 H 0.3163746 44.07811 16.17772 H 23.62733 38.98650 10.27527 H 6.807898 33.02697 9.738495 H 0.3912354 55.38048 14.72651 H 20.13347 36.04847 12.14573 H 18.40709 56.15669 17.93504 H -0.7494243 45.79179 3.813842 H 9.063624 49.99681 -2.480599 H 18.26573 42.83582 -3.430121 H 14.55518 54.38012 -3.798434 H 11.18572 60.29335 5.276391 H 24.76693 52.33115 9.300949 H 11.18097 35.76204 0.5992205 H 18.27941 36.68411 2.803026 H 22.05827 50.17164 -0.7169890 H 24.36220 39.52133 14.31545 H 16.97637 58.60372 11.81685 H 16.02653 36.22573 -0.6955962 H 20.62875 41.88702 -0.1458736 H 15.41490 57.29078 -1.727784 H 7.351008 58.58350 15.40522 H 21.74837 57.89884 8.661409 H 23.74380 44.07811 1.687206 H 0.4328496 38.98650 7.589652 H 17.25227 33.02698 8.126433 H 24.25922 55.81340 4.940309 H 3.162973 37.69257 6.420479 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/Au_cluster.py000066400000000000000000000025171316441372200265630ustar00rootroot00000000000000#!/usr/bin/env python from ase import Atoms from ase.io.xyz import read_xyz from gpaw import GPAW from gpaw.mixer import Mixer from gpaw import ConvergenceError from gpaw.mpi import rank from gpaw.eigensolvers.rmm_diis_old import RMM_DIIS from gpaw import setup_paths # Use setups from the $PWD and $PWD/.. first setup_paths.insert(0, '.') setup_paths.insert(0, '../') atoms = read_xyz('../Au102_revised.xyz') prefix = 'Au_cluster' L = 32.0 atoms.set_cell((L,L,L),scale_atoms=False) atoms.center() atoms.set_pbc(1) r = [1, 1, 1] atoms = atoms.repeat(r) n = [240 * ri for ri in r] # nbands (>=1683) is the number of bands per cluster nbands = 3*6*6*16 # 1728 for ri in r: nbands = nbands*ri mixer = Mixer(beta=0.1, nmaxold=5, weight=100.0) # the next three lines decrease memory usage es = RMM_DIIS(keep_htpsit=False) from gpaw.hs_operators import MatrixOperator MatrixOperator.nblocks = 16 calc = GPAW(nbands=nbands, # uncomment next two lines to use lcao/sz #mode='lcao', #basis='sz', gpts=tuple(n), maxiter=5, width = 0.1, xc='LDA', mixer=mixer, eigensolver = es, txt=prefix + '.txt', ) atoms.set_calculator(calc) from gpaw.mpi import rank try: pot = atoms.get_potential_energy() except ConvergenceError: pass Au_cluster.txt_band_4x8x16x8000066400000000000000000001270511316441372200312020ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster ___ ___ ___ _ _ _ | | |_ | | | | | | | | | . | | | | |__ | _|___|_____| 0.7 |___|_| User: ???@ion-R33-9 Date: Tue Apr 6 17:48:27 2010 Arch: BGP Pid: 100 Dir: /gpaw/lib/python2.6/site-packages/gpaw ase: /gpaw/lib/python2.6/site-packages/ase version: 3.3.1 numpy: /gpaw/lib/python2.6/site-packages/numpy units: Angstrom and eV Extra parameters: {'blacs': 1} **NOTE**: please start using occupations=FermiDirac(width). Memory estimate --------------- Calculator 485.91 MiB Initial overhead 379.02 MiB Density 19.48 MiB Arrays 5.36 MiB Localized functions 6.17 MiB Mixer 2.06 MiB Interpolator 5.90 MiB Hamiltonian 24.84 MiB Arrays 3.50 MiB Restrictor 3.67 MiB XC 3D grid 1.65 MiB Poisson 15.55 MiB vbar 0.47 MiB Wavefunctions 62.57 MiB Arrays psit_nG 44.49 MiB Eigensolver 1.04 MiB Projectors 0.90 MiB Overlap op 15.75 MiB Kinetic operator 0.38 MiB Positions: 0 O 8.9496 24.5522 8.6269 1 C 9.8369 23.8824 7.8297 2 O 10.3147 24.4127 6.7962 3 C 10.2586 22.5069 8.1973 4 C 9.7956 21.9548 9.3535 5 C 10.1886 20.6691 9.7194 6 C 11.0905 21.8361 7.3423 7 C 11.5174 20.5522 7.6624 8 C 11.0266 19.9861 8.8472 9 S 11.5885 18.3508 9.2813 10 O 28.1333 14.7301 20.7426 11 C 27.4474 15.3375 21.6018 12 O 28.0125 16.3029 22.3892 13 C 25.9869 15.0849 21.6935 14 C 25.4359 14.0366 21.0104 15 C 24.0669 13.7800 21.1043 16 C 25.2389 15.8691 22.5314 17 C 23.8539 15.7056 22.5825 18 C 23.2969 14.6329 21.8936 19 S 21.5139 14.4397 21.9176 20 O 18.3160 17.3324 27.9612 21 C 18.7254 17.4155 26.7768 22 O 19.2643 18.5780 26.2976 23 C 18.5259 16.2810 25.8396 24 C 18.0389 15.0989 26.3016 25 C 17.8379 14.0267 25.4416 26 C 18.8919 16.4439 24.5216 27 C 18.7110 15.3967 23.6194 28 C 18.1409 14.2187 24.0835 29 S 17.8458 12.8725 22.9494 30 O 10.9413 12.3160 27.5998 31 C 10.6709 13.4464 26.8783 32 O 9.5007 13.8962 26.8030 33 C 11.7619 14.1215 26.1305 34 C 13.0471 13.6858 26.2984 35 C 14.0929 14.3170 25.6295 36 C 11.4548 15.1530 25.2865 37 C 12.4740 15.8039 24.5866 38 C 13.7730 15.3246 24.7206 39 S 15.1059 16.1757 23.8766 40 O 14.3510 23.2593 27.5755 41 C 14.4611 22.0092 27.5230 42 O 13.8989 21.1920 28.4650 43 C 15.2230 21.3887 26.4095 44 C 15.6558 22.1753 25.3855 45 C 16.3278 21.5993 24.3086 46 C 15.4270 20.0367 26.4385 47 C 16.1389 19.4259 25.4144 48 C 16.6179 20.2392 24.3836 49 S 17.5699 19.4916 23.0916 50 O 18.4673 28.9006 21.1980 51 C 18.0899 28.0627 20.1847 52 O 17.4109 28.4998 19.2227 53 C 18.5108 26.6390 20.2204 54 C 19.2527 26.2080 21.2866 55 C 19.6400 24.8798 21.3773 56 C 18.1617 25.8042 19.1985 57 C 18.5459 24.4610 19.2353 58 C 19.2469 24.0188 20.3483 59 S 19.8728 22.3550 20.3833 60 O 4.2414 20.7900 15.2209 61 C 4.6011 20.6819 13.9054 62 O 4.1339 21.4606 13.0378 63 C 5.5798 19.6412 13.5003 64 C 6.0428 18.7621 14.4404 65 C 6.9748 17.7889 14.0863 66 C 5.9855 19.5958 12.1955 67 C 6.8846 18.6161 11.7853 68 C 7.3897 17.7487 12.7504 69 S 8.5597 16.4991 12.2516 70 O 17.6672 7.0448 24.8204 71 C 18.0098 6.6418 23.6811 72 O 17.6399 5.4019 23.2371 73 C 18.7169 7.5728 22.7654 74 C 19.1450 8.7805 23.2313 75 C 19.8129 9.6676 22.3906 76 C 18.9917 7.1516 21.4895 77 C 19.6580 8.0009 20.6163 78 C 20.0359 9.2610 21.0754 79 S 20.6879 10.4385 19.9024 80 O 10.5943 6.6875 21.5703 81 C 10.5284 7.5054 22.6648 82 O 9.8824 7.1683 23.6878 83 C 11.2079 8.8258 22.6575 84 C 11.9027 9.2075 21.5445 85 C 12.5768 10.4257 21.5313 86 C 11.1279 9.6118 23.7727 87 C 11.7769 10.8439 23.8034 88 C 12.4750 11.2337 22.6565 89 S 13.1910 12.8649 22.6104 90 O 7.3001 19.2989 25.0933 91 C 7.6688 20.1334 24.2300 92 O 6.7696 20.9836 23.6470 93 C 9.0959 20.1630 23.8205 94 C 9.9900 19.3858 24.5033 95 C 11.3368 19.3997 24.1564 96 C 9.4760 20.9769 22.7894 97 C 10.8109 21.0240 22.4074 98 C 11.7049 20.1770 23.0545 99 S 13.4190 20.2217 22.5753 100 O 3.5939 10.5821 11.6508 101 C 4.8082 10.0108 11.3849 102 O 4.9004 9.0031 10.6409 103 C 6.0326 10.5560 12.0243 104 C 5.9166 11.5956 12.9004 105 C 7.0536 12.1616 13.4675 106 C 7.2455 10.0336 11.6735 107 C 8.4167 10.5560 12.2273 108 C 8.2845 11.5769 13.1655 109 S 9.7177 12.0755 14.0945 110 O 9.4876 26.7892 11.9048 111 C 10.3502 26.1941 12.5972 112 O 11.4520 26.8664 13.0505 113 C 10.1597 24.7483 12.8776 114 C 9.0376 24.1422 12.3773 115 C 8.8067 22.7931 12.6103 116 C 11.0588 24.0683 13.6404 117 C 10.8766 22.7052 13.8934 118 C 9.7467 22.0909 13.3674 119 S 9.4997 20.3381 13.5932 120 O 12.9263 6.1540 24.8934 121 C 13.2034 5.9605 23.6837 122 O 12.7786 4.8261 23.0479 123 C 14.0638 6.9456 22.9805 124 C 14.4549 8.0696 23.6526 125 C 15.2591 9.0138 23.0334 126 C 14.4588 6.6984 21.6964 127 C 15.2299 7.6414 21.0186 128 C 15.6149 8.7857 21.7003 129 S 16.7168 9.9509 20.9246 130 O 8.2575 11.7304 24.1396 131 C 7.8999 12.9261 24.2804 132 O 6.9545 13.2660 25.2089 133 C 8.5690 14.0017 23.5054 134 C 9.4860 13.6805 22.5485 135 C 10.0958 14.6911 21.8004 136 C 8.1741 15.2967 23.7233 137 C 8.7491 16.3339 23.0073 138 C 9.7320 16.0046 22.0633 139 S 10.7009 17.3328 21.3884 140 O 15.2152 26.4013 25.6714 141 C 14.1630 25.8819 24.9681 142 O 12.9970 25.9802 25.4243 143 C 14.4008 25.1684 23.6876 144 C 15.6719 25.1172 23.1756 145 C 15.9259 24.4249 21.9976 146 C 13.3518 24.5820 23.0466 147 C 13.5557 23.8798 21.8565 148 C 14.8579 23.7791 21.3716 149 S 15.1229 23.0473 19.7573 150 O 18.7761 27.9232 9.8809 151 C 19.7890 27.2717 10.5298 152 O 20.9438 27.2492 10.0363 153 C 19.5156 26.5413 11.7935 154 C 18.2447 26.5401 12.3023 155 C 17.9716 25.9084 13.5153 156 C 20.5406 25.9002 12.4334 157 C 20.3108 25.2219 13.6325 158 C 19.0167 25.2370 14.1485 159 S 18.6496 24.2213 15.5673 160 O 7.2160 26.2855 16.0714 161 C 7.4678 26.0761 17.2839 162 O 6.9422 26.8922 18.2478 163 C 8.3278 24.9322 17.6804 164 C 8.8177 24.1090 16.7046 165 C 9.6417 23.0461 17.0483 166 C 8.6026 24.7350 19.0016 167 C 9.4497 23.6989 19.3936 168 C 9.9096 22.8379 18.3996 169 S 10.8866 21.4260 18.8655 170 O 5.3392 13.6178 22.3230 171 C 4.8488 13.6274 21.0460 172 O 3.6752 13.2502 20.8054 173 C 5.7168 14.1110 19.9424 174 C 6.9978 14.4828 20.2343 175 C 7.8500 14.9150 19.2203 176 C 5.2128 14.1820 18.6726 177 C 6.0397 14.5741 17.6164 178 C 7.3279 14.9930 17.9283 179 S 8.3638 15.6346 16.6285 180 O 27.0647 8.3764 16.5869 181 C 27.2060 9.4855 15.7986 182 O 28.3205 10.0553 15.6947 183 C 26.0468 10.0336 15.0496 184 C 24.7997 9.5106 15.2514 185 C 23.7046 10.0266 14.5665 186 C 26.2498 11.0935 14.2074 187 C 25.1976 11.6025 13.4553 188 C 23.9248 11.0726 13.6733 189 S 22.5658 11.6968 12.7064 190 O 13.3181 2.8098 16.1343 191 C 12.4360 3.5734 16.5994 192 O 11.1434 3.1507 16.7482 193 C 12.7987 4.9648 16.9704 194 C 14.1199 5.3103 17.0104 195 C 14.4837 6.6094 17.3456 196 C 11.8017 5.8537 17.2584 197 C 12.1199 7.1568 17.6253 198 C 13.4666 7.5128 17.6396 199 S 13.9109 9.1790 18.0795 200 O 5.2639 23.7908 21.2952 201 C 5.2738 23.5430 19.9499 202 O 4.6021 24.2569 19.1645 203 C 6.0539 22.3981 19.4154 204 C 6.7188 21.5830 20.2815 205 C 7.4877 20.5289 19.7995 206 C 6.1129 22.2183 18.0623 207 C 6.8226 21.1432 17.5335 208 C 7.4738 20.2962 18.4246 209 S 8.3658 18.8948 17.7815 210 O 24.3222 7.2969 17.8622 211 C 23.3342 6.5429 18.0436 212 O 23.4817 5.3540 18.7040 213 C 21.9697 7.0026 17.6804 214 C 21.7846 8.2848 17.2466 215 C 20.5067 8.7205 16.8943 216 C 20.9389 6.1056 17.7343 217 C 19.6438 6.5023 17.4195 218 C 19.4508 7.8165 16.9986 219 S 17.7839 8.3878 16.7303 220 Au 17.6679 16.3048 19.8974 221 Au 15.9037 16.3368 14.2653 222 Au 15.3538 18.7650 12.8583 223 Au 13.1948 16.9738 13.5075 224 Au 14.1376 14.2966 13.2156 225 Au 16.8736 14.4246 12.3913 226 Au 15.0618 17.2019 19.1703 227 Au 16.3367 18.7749 15.6445 228 Au 14.1457 17.0797 16.3223 229 Au 14.9939 14.3577 16.0504 230 Au 13.2335 18.4492 11.0553 231 Au 20.3660 15.4729 19.9614 232 Au 14.6737 13.6538 10.6055 233 Au 15.4308 15.5887 21.4806 234 Au 16.1827 18.5027 10.1124 235 Au 13.6247 19.5702 14.9385 236 Au 12.2707 15.1058 15.3783 237 Au 16.7790 12.2390 17.1022 238 Au 13.1619 15.1739 18.2063 239 Au 14.5736 19.5981 17.7536 240 Au 18.4838 21.0548 21.6925 241 Au 10.1377 17.5358 10.9213 242 Au 11.6854 12.4787 10.4076 243 Au 15.5208 12.8027 22.6804 244 Au 14.2499 18.1362 23.0666 245 Au 16.7868 21.2398 16.9654 246 Au 11.5068 17.8517 15.6834 247 Au 13.1856 12.4327 15.1693 248 Au 14.0196 12.4560 17.8115 249 Au 12.3857 17.9070 18.3346 250 Au 13.6857 20.9460 12.5803 251 Au 11.4745 19.1059 13.1684 252 Au 10.4577 16.2216 13.6725 253 Au 11.4607 13.5020 13.1473 254 Au 13.7895 11.6054 12.5345 255 Au 15.8809 11.8475 19.8045 256 Au 13.5916 13.5968 20.3815 257 Au 12.8747 16.4980 20.7085 258 Au 13.7079 19.4149 20.3383 259 Au 16.4667 20.9303 11.5563 260 Au 18.6058 21.9350 14.9034 261 Au 11.8686 20.3061 16.9454 262 Au 10.5906 15.9651 17.5285 263 Au 11.3558 13.2448 17.1916 264 Au 14.8927 10.3780 16.0375 265 Au 16.3367 23.9560 15.6445 266 Au 9.2728 19.6522 15.7713 267 Au 12.0218 10.4478 18.1813 268 Au 19.6025 22.1438 12.1415 269 Au 9.1728 13.9057 15.3976 270 Au 15.4576 9.2546 12.5253 271 Au 9.7318 18.0140 19.4526 272 O 23.6510 24.4973 22.7280 273 C 22.8363 23.8824 23.4600 274 O 22.3158 24.4600 24.5856 275 C 22.4146 22.5069 23.0924 276 C 22.8776 21.9548 21.9361 277 C 22.4845 20.6691 21.5703 278 C 21.5827 21.8361 23.9474 279 C 21.1558 20.5522 23.6272 280 C 21.6466 19.9861 22.4424 281 S 21.0847 18.3508 22.0083 282 O 4.4787 14.6760 10.6237 283 C 5.2258 15.3375 9.6879 284 O 4.7069 16.2239 8.9649 285 C 6.6863 15.0849 9.5961 286 C 7.2373 14.0366 10.2793 287 C 8.6063 13.7800 10.1853 288 C 7.4342 15.8691 8.7583 289 C 8.8193 15.7056 8.7072 290 C 9.3762 14.6329 9.3960 291 S 11.1593 14.4397 9.3721 292 O 14.3572 17.3324 3.3284 293 C 13.9477 17.4155 4.5129 294 O 13.4089 18.5780 4.9921 295 C 14.1472 16.2810 5.4500 296 C 14.6342 15.0989 4.9880 297 C 14.8353 14.0267 5.8481 298 C 13.7812 16.4439 6.7681 299 C 13.9622 15.3967 7.6703 300 C 14.5323 14.2187 7.2062 301 S 14.8273 12.8725 8.3402 302 O 21.7319 12.3160 3.6899 303 C 22.0022 13.4464 4.4113 304 O 23.1725 13.8962 4.4867 305 C 20.9113 14.1215 5.1592 306 C 19.6261 13.6858 4.9913 307 C 18.5803 14.3170 5.6601 308 C 21.2184 15.1530 6.0031 309 C 20.1992 15.8039 6.7031 310 C 18.9002 15.3246 6.5691 311 S 17.5673 16.1757 7.4130 312 O 18.3320 23.3708 3.7094 313 C 18.2121 22.0092 3.7667 314 O 18.7283 21.2589 2.9018 315 C 17.4502 21.3887 4.8801 316 C 17.0173 22.1753 5.9042 317 C 16.3454 21.5993 6.9811 318 C 17.2462 20.0367 4.8512 319 C 16.5343 19.4259 5.8752 320 C 16.0553 20.2392 6.9060 321 S 15.1033 19.4916 8.1980 322 O 14.2368 28.8320 10.1746 323 C 14.5833 28.0627 11.1050 324 O 15.3228 28.5388 12.1528 325 C 14.1624 26.6390 11.0693 326 C 13.4204 26.2080 10.0031 327 C 13.0331 24.8798 9.9123 328 C 14.5115 25.8042 12.0911 329 C 14.1273 24.4610 12.0543 330 C 13.4262 24.0188 10.9414 331 S 12.8003 22.3550 10.9063 332 O 28.4318 20.7900 16.0688 333 C 28.0721 20.6819 17.3842 334 O 28.5393 21.4606 18.2519 335 C 27.0933 19.6412 17.7893 336 C 26.6304 18.7621 16.8493 337 C 25.6984 17.7889 17.2034 338 C 26.6876 19.5958 19.0942 339 C 25.7886 18.6161 19.5044 340 C 25.2835 17.7487 18.5393 341 S 24.1135 16.4991 19.0381 342 O 15.0059 7.0448 6.4693 343 C 14.6634 6.6418 7.6085 344 O 15.0332 5.4019 8.0526 345 C 13.9562 7.5728 8.5242 346 C 13.5282 8.7805 8.0583 347 C 12.8603 9.6676 8.8990 348 C 13.6815 7.1516 9.8001 349 C 13.0152 8.0009 10.6734 350 C 12.6373 9.2610 10.2143 351 S 11.9853 10.4385 11.3873 352 O 22.0789 6.6875 9.7194 353 C 22.1447 7.5054 8.6249 354 O 22.7908 7.1683 7.6019 355 C 21.4652 8.8258 8.6321 356 C 20.7704 9.2075 9.7451 357 C 20.0964 10.4257 9.7583 358 C 21.5453 9.6118 7.5170 359 C 20.8962 10.8439 7.4863 360 C 20.1982 11.2337 8.6332 361 S 19.4821 12.8649 8.6793 362 O 25.4059 19.2245 6.1194 363 C 25.0044 20.1334 7.0597 364 O 25.8300 20.9140 7.5950 365 C 23.5773 20.1630 7.4691 366 C 22.6832 19.3858 6.7863 367 C 21.3364 19.3997 7.1333 368 C 23.1972 20.9769 8.5003 369 C 21.8623 21.0240 8.8822 370 C 20.9683 20.1770 8.2352 371 S 19.2542 20.2217 8.7143 372 O 28.9798 10.5353 19.6607 373 C 27.8650 10.0108 19.9048 374 O 27.7646 8.9132 20.7151 375 C 26.6406 10.5560 19.2653 376 C 26.7565 11.5956 18.3892 377 C 25.6196 12.1616 17.8222 378 C 25.4276 10.0336 19.6162 379 C 24.2565 10.5560 19.0624 380 C 24.3887 11.5769 18.1241 381 S 22.9555 12.0755 17.1951 382 O 23.1855 26.7892 19.3849 383 C 22.3230 26.1941 18.6924 384 O 21.2211 26.8664 18.2392 385 C 22.5135 24.7483 18.4121 386 C 23.6355 24.1422 18.9123 387 C 23.8665 22.7931 18.6794 388 C 21.6144 24.0683 17.6493 389 C 21.7966 22.7052 17.3963 390 C 22.9265 22.0909 17.9222 391 S 23.1735 20.3381 17.6964 392 O 19.7716 6.1713 6.2884 393 C 19.4698 5.9605 7.6060 394 O 19.8598 4.9190 8.1897 395 C 18.6094 6.9456 8.3091 396 C 18.2183 8.0696 7.6371 397 C 17.4141 9.0138 8.2563 398 C 18.2144 6.6984 9.5933 399 C 17.4433 7.6414 10.2711 400 C 17.0583 8.7857 9.5893 401 S 15.9564 9.9509 10.3650 402 O 24.3838 11.6238 7.1626 403 C 24.7733 12.9261 7.0093 404 O 25.6413 13.2382 6.1568 405 C 24.1041 14.0017 7.7843 406 C 23.1872 13.6805 8.7411 407 C 22.5774 14.6911 9.4893 408 C 24.4991 15.2967 7.5663 409 C 23.9241 16.3339 8.2823 410 C 22.9412 16.0046 9.2263 411 S 21.9723 17.3328 9.9013 412 O 17.5441 26.3587 5.6759 413 C 18.5102 25.8819 6.3216 414 O 19.7802 25.9890 5.8246 415 C 18.2724 25.1684 7.6020 416 C 17.0013 25.1172 8.1141 417 C 16.7473 24.4249 9.2921 418 C 19.3214 24.5820 8.2430 419 C 19.1174 23.8798 9.4332 420 C 17.8153 23.7791 9.9181 421 S 17.5503 23.0473 11.5323 422 O 13.8141 27.8698 21.3557 423 C 12.8842 27.2717 20.7599 424 O 11.6264 27.2472 21.2973 425 C 13.1576 26.5413 19.4961 426 C 14.4284 26.5401 18.9874 427 C 14.7016 25.9084 17.7743 428 C 12.1325 25.9002 18.8562 429 C 12.3624 25.2219 17.6571 430 C 13.6564 25.2370 17.1412 431 S 14.0235 24.2213 15.7224 432 O 25.4796 26.3041 15.3264 433 C 25.2054 26.0761 14.0057 434 O 25.6880 26.8254 13.1207 435 C 24.3454 24.9322 13.6093 436 C 23.8555 24.1090 14.5851 437 C 23.0314 23.0461 14.2414 438 C 24.0705 24.7350 12.2880 439 C 23.2235 23.6989 11.8961 440 C 22.7636 22.8379 12.8901 441 S 21.7866 21.4260 12.4241 442 O 27.3340 13.6178 8.9666 443 C 27.8244 13.6274 10.2437 444 O 28.9980 13.2502 10.4843 445 C 26.9564 14.1110 11.3472 446 C 25.6753 14.4828 11.0553 447 C 24.8232 14.9150 12.0693 448 C 27.4604 14.1820 12.6171 449 C 26.6335 14.5741 13.6733 450 C 25.3452 14.9930 13.3613 451 S 24.3094 15.6346 14.6612 452 O 5.6085 8.3764 14.7028 453 C 5.4671 9.4855 15.4911 454 O 4.3526 10.0553 15.5950 455 C 6.6264 10.0336 16.2401 456 C 7.8734 9.5106 16.0382 457 C 8.9686 10.0266 16.7232 458 C 6.4234 11.0935 17.0822 459 C 7.4756 11.6025 17.8344 460 C 8.7484 11.0726 17.6164 461 S 10.1074 11.6968 18.5833 462 O 19.3551 2.8098 15.1553 463 C 20.2372 3.5734 14.6903 464 O 21.5297 3.1507 14.5414 465 C 19.8744 4.9648 14.3193 466 C 18.5533 5.3103 14.2792 467 C 18.1895 6.6094 13.9441 468 C 20.8715 5.8537 14.0313 469 C 20.5533 7.1568 13.6643 470 C 19.2066 7.5128 13.6500 471 S 18.7623 9.1790 13.2102 472 O 27.4085 23.7706 10.1046 473 C 27.3994 23.5430 11.3397 474 O 28.1309 24.3205 12.1952 475 C 26.6193 22.3981 11.8743 476 C 25.9544 21.5830 11.0082 477 C 25.1855 20.5289 11.4902 478 C 26.5603 22.2183 13.2274 479 C 25.8505 21.1432 13.7562 480 C 25.1994 20.2962 12.8650 481 S 24.3074 18.8948 13.5082 482 O 8.2629 7.3641 13.4437 483 C 9.3390 6.5429 13.2461 484 O 9.2035 5.4513 12.6398 485 C 10.7035 7.0026 13.6093 486 C 10.8886 8.2848 14.0431 487 C 12.1664 8.7205 14.3954 488 C 11.7343 6.1056 13.5554 489 C 13.0294 6.5023 13.8701 490 C 13.2223 7.8165 14.2910 491 S 14.8893 8.3878 14.5594 492 Au 15.0053 16.3048 11.3923 493 Au 16.7695 16.3368 17.0244 494 Au 17.3194 18.7650 18.4314 495 Au 19.4784 16.9738 17.7822 496 Au 18.5356 14.2966 18.0741 497 Au 15.7996 14.4246 18.8984 498 Au 17.6114 17.2019 12.1194 499 Au 18.5275 17.0797 14.9674 500 Au 17.6793 14.3577 15.2393 501 Au 19.4396 18.4492 20.2343 502 Au 12.3072 15.4729 11.3283 503 Au 17.9995 13.6538 20.6842 504 Au 17.2424 15.5887 9.8091 505 Au 16.4904 18.5027 21.1772 506 Au 19.0485 19.5702 16.3512 507 Au 20.4025 15.1058 15.9114 508 Au 15.8942 12.2390 14.1874 509 Au 19.5113 15.1739 13.0834 510 Au 18.0995 19.5981 13.5361 511 Au 14.1894 21.0548 9.5972 512 Au 22.5355 17.5358 20.3683 513 Au 20.9878 12.4787 20.8821 514 Au 17.1524 12.8027 8.6093 515 Au 18.4232 18.1362 8.2230 516 Au 15.8864 21.2398 14.3243 517 Au 21.1664 17.8517 15.6062 518 Au 19.4876 12.4327 16.1204 519 Au 18.6535 12.4560 13.4782 520 Au 20.2875 17.9070 12.9551 521 Au 18.9875 20.9460 18.7094 522 Au 21.1987 19.1059 18.1213 523 Au 22.2155 16.2216 17.6171 524 Au 21.2125 13.5020 18.1423 525 Au 18.8837 11.6054 18.7551 526 Au 16.7922 11.8475 11.4852 527 Au 19.0815 13.5968 10.9081 528 Au 19.7985 16.4980 10.5812 529 Au 18.9653 19.4149 10.9514 530 Au 16.2065 20.9303 19.7334 531 Au 14.0674 21.9350 16.3862 532 Au 20.8045 20.3061 14.3443 533 Au 22.0826 15.9651 13.7612 534 Au 21.3174 13.2448 14.0981 535 Au 17.7805 10.3780 15.2522 536 Au 23.4004 19.6522 15.5183 537 Au 20.6514 10.4478 13.1084 538 Au 13.0707 22.1438 19.1481 539 Au 23.5004 13.9057 15.8921 540 Au 17.2156 9.2546 18.7644 541 Au 22.9413 18.0140 11.8371 542 H 9.1139 22.5220 9.9959 543 H 9.8505 20.2153 10.6568 544 H 11.4184 22.3084 6.4104 545 H 12.2098 20.0047 7.0145 546 H 26.0700 13.3966 20.3880 547 H 23.6125 12.9360 20.5751 548 H 25.7264 16.6221 23.1593 549 H 23.2244 16.4008 23.1478 550 H 17.8022 14.9905 27.3652 551 H 17.4574 13.0677 25.8086 552 H 19.3232 17.3920 24.1839 553 H 19.0108 15.5005 22.5713 554 H 13.2545 12.8385 26.9604 555 H 15.1340 14.0308 25.8119 556 H 10.4137 15.4676 25.1598 557 H 12.2561 16.6678 23.9500 558 H 15.4768 23.2553 25.4080 559 H 16.6169 22.1942 23.4359 560 H 15.0308 19.4385 27.2655 561 H 16.3185 18.3457 25.4146 562 H 19.5417 26.9150 22.0712 563 H 20.2324 24.5182 22.2243 564 H 17.5818 26.1861 18.3518 565 H 18.3019 23.7801 18.4132 566 H 5.6807 18.8233 15.4720 567 H 7.3676 17.0824 14.8250 568 H 5.6043 20.3277 11.4758 569 H 7.1855 18.5300 10.7360 570 H 18.9622 9.0553 24.2754 571 H 20.1496 10.6462 22.7484 572 H 18.6876 6.1520 21.1616 573 H 19.8812 7.6879 19.5910 574 H 11.9294 8.5563 20.6646 575 H 13.1673 10.7363 20.6631 576 H 10.5539 9.2731 24.6415 577 H 11.7417 11.4829 24.6919 578 H 9.6446 18.7505 25.3256 579 H 12.0777 18.8259 24.7228 580 H 8.7322 21.5881 22.2676 581 H 11.1491 21.7069 21.6211 582 H 4.9262 11.9852 13.1577 583 H 6.9855 13.0336 14.1263 584 H 7.2994 9.2059 10.9586 585 H 9.4015 10.1772 11.9348 586 H 8.3193 24.7245 11.7909 587 H 7.9158 22.2956 12.2130 588 H 11.9268 24.5899 14.0569 589 H 11.6019 22.1395 14.4875 590 H 14.1309 8.2252 24.6869 591 H 15.6030 9.9052 23.5683 592 H 14.1712 5.7645 21.2021 593 H 15.5237 7.4827 19.9758 594 H 9.7442 12.6321 22.3667 595 H 10.8376 14.4541 21.0305 596 H 7.4001 15.5120 24.4674 597 H 8.4468 17.3733 23.1727 598 H 16.4904 25.6240 23.6973 599 H 16.9344 24.3870 21.5727 600 H 12.3436 24.6614 23.4664 601 H 12.7174 23.4223 21.3208 602 H 17.4382 27.0379 11.7539 603 H 16.9696 25.9386 13.9558 604 H 21.5473 25.9189 12.0031 605 H 21.1202 24.6960 14.1496 606 H 8.5608 24.2877 15.6553 607 H 10.0681 22.3915 16.2810 608 H 8.1572 25.3916 19.7563 609 H 9.7417 23.5673 20.4407 610 H 7.3564 14.4411 21.2681 611 H 8.8907 15.1836 19.4293 612 H 4.1635 13.9321 18.4841 613 H 5.6856 14.5522 16.5805 614 H 24.6627 8.6826 15.9548 615 H 22.6992 9.6226 14.7248 616 H 27.2453 11.5423 14.1260 617 H 25.3618 12.3934 12.7160 618 H 14.8895 4.5665 16.7793 619 H 15.5356 6.9119 17.3772 620 H 10.7540 5.5405 17.2003 621 H 11.3399 7.8771 17.8934 622 H 6.6476 21.7584 21.3600 623 H 8.0820 19.9047 20.4748 624 H 5.6022 22.9193 17.3939 625 H 6.8668 20.9704 16.4531 626 H 22.6368 8.9687 17.1756 627 H 20.3380 9.7447 16.5454 628 H 21.1345 5.0687 18.0271 629 H 18.8034 5.8050 17.4998 630 H 23.5593 22.5220 21.2938 631 H 22.8227 20.2153 20.6328 632 H 21.2548 22.3084 24.8793 633 H 20.4634 20.0047 24.2752 634 H 6.6032 13.3966 10.9017 635 H 9.0607 12.9360 10.7146 636 H 6.9468 16.6221 8.1303 637 H 9.4488 16.4008 8.1419 638 H 14.8710 14.9905 3.9245 639 H 15.2157 13.0677 5.4810 640 H 13.3499 17.3920 7.1057 641 H 13.6623 15.5005 8.7183 642 H 19.4187 12.8385 4.3293 643 H 17.5392 14.0308 5.4778 644 H 22.2595 15.4676 6.1299 645 H 20.4171 16.6678 7.3397 646 H 17.1964 23.2553 5.8817 647 H 16.0563 22.1942 7.8537 648 H 17.6424 19.4385 4.0241 649 H 16.3547 18.3457 5.8751 650 H 13.1315 26.9150 9.2184 651 H 12.4408 24.5182 9.0653 652 H 15.0914 26.1861 12.9379 653 H 14.3713 23.7801 12.8764 654 H 26.9925 18.8233 15.8177 655 H 25.3056 17.0824 16.4646 656 H 27.0688 20.3277 19.8139 657 H 25.4877 18.5300 20.5537 658 H 13.7110 9.0553 7.0142 659 H 12.5235 10.6462 8.5413 660 H 13.9856 6.1520 10.1281 661 H 12.7920 7.6879 11.6987 662 H 20.7438 8.5564 10.6251 663 H 19.5059 10.7363 10.6266 664 H 22.1192 9.2731 6.6482 665 H 20.9314 11.4829 6.5977 666 H 23.0286 18.7505 5.9640 667 H 20.5954 18.8259 6.5669 668 H 23.9410 21.5881 9.0221 669 H 21.5241 21.7069 9.6685 670 H 27.7470 11.9852 18.1319 671 H 25.6877 13.0336 17.1634 672 H 25.3738 9.2059 20.3311 673 H 23.2716 10.1772 19.3548 674 H 24.3538 24.7245 19.4988 675 H 24.7574 22.2956 19.0767 676 H 20.7464 24.5899 17.2327 677 H 21.0713 22.1395 16.8022 678 H 18.5423 8.2252 6.6027 679 H 17.0702 9.9052 7.7214 680 H 18.5020 5.7645 10.0875 681 H 17.1495 7.4827 11.3139 682 H 22.9290 12.6321 8.9230 683 H 21.8356 14.4541 10.2591 684 H 25.2731 15.5120 6.8223 685 H 24.2264 17.3733 8.1170 686 H 16.1828 25.6240 7.5924 687 H 15.7388 24.3870 9.7170 688 H 20.3296 24.6614 7.8233 689 H 19.9557 23.4223 9.9689 690 H 15.2350 27.0379 19.5357 691 H 15.7036 25.9386 17.3338 692 H 11.1258 25.9189 19.2866 693 H 11.5530 24.6960 17.1401 694 H 24.1124 24.2877 15.6344 695 H 22.6050 22.3915 15.0086 696 H 24.5160 25.3916 11.5334 697 H 22.9315 23.5673 10.8489 698 H 25.3168 14.4411 10.0215 699 H 23.7825 15.1836 11.8603 700 H 28.5097 13.9321 12.8056 701 H 26.9876 14.5522 14.7092 702 H 8.0105 8.6826 15.3349 703 H 9.9739 9.6226 16.5649 704 H 5.4279 11.5423 17.1637 705 H 7.3114 12.3934 18.5737 706 H 17.7836 4.5665 14.5104 707 H 17.1376 6.9119 13.9125 708 H 21.9191 5.5405 14.0893 709 H 21.3333 7.8771 13.3963 710 H 26.0255 21.7584 9.9296 711 H 24.5911 19.9047 10.8148 712 H 27.0710 22.9193 13.8958 713 H 25.8064 20.9704 14.8365 714 H 10.0364 8.9687 14.1141 715 H 12.3352 9.7447 14.7443 716 H 11.5386 5.0687 13.2626 717 H 13.8698 5.8050 13.7899 718 H 8.8058 25.4273 8.2171 719 H 28.9655 16.3170 22.1743 720 H 19.3030 19.1904 27.0579 721 H 10.1009 12.0294 28.0074 722 H 13.4508 21.7860 29.0982 723 H 18.0960 29.7795 20.9877 724 H 3.5997 21.5247 15.2763 725 H 17.1857 4.9556 23.9781 726 H 10.0873 5.8777 21.7743 727 H 5.8967 20.8056 24.0481 728 H 2.9266 10.0811 11.1426 729 H 11.3903 27.7973 12.7604 730 H 12.2353 4.3134 23.6774 731 H 6.6471 12.4283 25.6066 732 H 14.8513 26.8220 26.4746 733 H 19.1579 28.3311 9.0794 734 H 6.4138 27.5720 17.7861 735 H 4.6229 13.2717 22.8901 736 H 27.9338 8.1800 16.9876 737 H 11.1144 2.2205 16.4509 738 H 4.6977 24.5740 21.4389 739 H 24.4400 5.2420 18.8581 740 H 22.7136 25.3502 24.6474 741 H 3.5571 14.9853 10.5262 742 H 13.3701 19.1904 4.2318 743 H 22.5722 12.0294 3.2822 744 H 18.8617 23.5737 2.9139 745 H 15.4922 29.4869 11.9888 746 H 29.0734 21.5247 16.0133 747 H 15.4875 4.9556 7.3116 748 H 22.5859 5.8777 9.5154 749 H 26.3648 19.3652 5.9954 750 H 28.6687 8.7149 21.0278 751 H 21.2829 27.7973 18.5292 752 H 20.3330 5.4193 6.0168 753 H 24.9353 11.0806 6.5665 754 H 19.7214 26.4843 4.9846 755 H 11.6575 27.7770 22.1176 756 H 26.0549 27.0924 15.3738 757 H 28.0503 13.2717 8.3996 758 H 4.7394 8.1800 14.3020 759 H 21.5588 2.2205 14.8388 760 H 28.5657 25.0069 11.6527 761 H 7.4695 6.8861 13.1328 .------------------------------------------------------------------------------. /| | / | | / | | / | | / | | / | | / | | / | | / | | / | H H | / | O O O | / | OC C | / | C H H | / | H C C OH H O | / | H C C O HOHH C | / | O H O C CHC C O | / | H O H C C C H CC H CHCH CHCC C | / | HO O O CC HC H C CH OC | / | H H HH CHCC C H C HCC SC HuC C C C H O | * | HO OC HHO C CSu HC S CO C H H | | | CCC C C S C C S HH C C | | | O CCH CCHS C Au C AuuH H H CC CC H OH H | | H O HC H C C SSAuH AuAu S AuS Cu C C CC H O | | | H CCHC AHCC H H O H C C O | | O C C O H CAC AuS CuuH Au AuH C S C CH O C | | | C OHHSC C C Au H C COHH Au C H H HC CO O H | | | CO C H Cu C AuC HOuu C H AuuC Au HC CCC | | H| C HC OAu CCH Au HCAuCCu S HAu C CHHAu HOCHHO H | | | C H HO S CCC AuC Au H COCu AHuC CC CC CHC C OH | | | HO CC H H Au H AH AuAuC H Auu AuAuSH C O CH C | | |H C CC Su AuAu Au S Au SHS C C | | | CCC AuH Au Au S Au AuAu C Hu Au CH C O | | | C C H C HC Au Au H S CAuC CC OC HO Au CHHC H | | O C| C H SSC C C HAu AuuHu C HC AuuAuC HC COC O | | H H H CAHCC O Au AuuAu H CCCHC CCHH C H | | H O| C C H C HAS H Auu SCS H C C | | H O H O CC C CH S SuC Au H C O | | O |CC OCCCHHCC OC HAuuH Cu C CCAH C C HH C C O | | H C .--HC--CH---CCH-SAH----HH-----O-C--O-------H----CC-----------------------------. | O/ H O H H C S HS HS OH HC HC OOHH / | / C S H Au CCH CCH C H / | / C C C H O C H C / | / H CC HH C CO O O / | / C H H C HC H / | / H H C HO C O / | / O HO H / | / H O O H / | / H / | / / | / / | / / | / / | / / | / / | / / | / / | / / |/ / *------------------------------------------------------------------------------* Unit Cell: Periodic X Y Z Points Spacing -------------------------------------------------------------------- 1. axis: yes 32.000000 0.000000 0.000000 240 0.1333 2. axis: yes 0.000000 32.000000 0.000000 240 0.1333 3. axis: yes 0.000000 0.000000 32.000000 240 0.1333 Grid-points per volume: 421.87 Effective grid-spacing: 0.1333 O-setup: name : Oxygen id : 5f3f27ba17355653aa2069308cb75aea Z : 8 valence: 6 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/O.LDA.gz cutoffs: 0.74(comp), 1.30(filt), 0.83(core), lmax=2 valence states: energy radius 2s(2) -23.752 0.741 2p(4) -9.195 0.741 *s 3.459 0.741 *p 18.016 0.741 *d 0.000 0.741 Using partial waves for O as LCAO basis S-setup: name : Sulfur id : 16df0b8f883bfd770ab5c435bc804428 Z : 16 valence: 6 core : 10 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/S.LDA.gz cutoffs: 0.85(comp), 1.49(filt), 1.66(core), lmax=2 valence states: energy radius 3s(2) -17.278 0.847 3p(4) -7.106 0.847 *s 9.933 0.847 *p 20.105 0.847 *d 0.000 0.847 Using partial waves for S as LCAO basis C-setup: name : Carbon id : d60576a1f549371a163e72552ca58787 Z : 6 valence: 4 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/C.LDA.gz cutoffs: 0.64(comp), 1.14(filt), 1.14(core), lmax=2 valence states: energy radius 2s(2) -13.639 0.635 2p(2) -5.414 0.635 *s 13.573 0.635 *p 21.797 0.635 *d 0.000 0.635 Using partial waves for C as LCAO basis H-setup: name : Hydrogen id : 4766778ce56282eaa64abeb28b7c1de3 Z : 1 valence: 1 core : 0 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/H.LDA.gz cutoffs: 0.48(comp), 0.85(filt), 0.53(core), lmax=2 valence states: energy radius 1s(1) -6.353 0.476 *s 20.858 0.476 *p 0.000 0.476 Using partial waves for H as LCAO basis Au-setup: name : Gold id : a44207148b704df7bec07bf25e8feca8 Z : 79 valence: 11 core : 68 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/Au.LDA.gz cutoffs: 1.32(comp), 2.33(filt), 2.81(core), lmax=2 valence states: energy radius 6s(1) -6.048 1.323 6p(0) -0.888 1.323 5d(10) -7.129 1.323 *s 21.163 1.323 *p 26.323 1.323 *d 20.082 1.323 Using partial waves for Au as LCAO basis Using the LDA Exchange-Correlation Functional. Spin-Paired Calculation Total Charge: 0.000000 Fermi Temperature: 0.100000 Mode: fd Eigen Solver: (3 nearest neighbors central finite-difference stencil) Diagonalizer: ScaLapack - grid: [nprow, npcol, nb] = [5, 5, 64] Inverse Cholesky: Lapack Poisson Solver: Jacobi (Mehrstellen finite-difference stencil) Interpolation: 6th Order Reference Energy: -53635200.580024 Gamma Point Calculation Total number of cores used: 4096 Using Domain Decomposition: 4 x 8 x 16 Parallelization Over bands on 8 Processors 1 k-point in the Irreducible Part of the Brillouin Zone (total: 1) Linear Mixing Parameter: 0.1 Pulay Mixing with 5 Old Densities Damping of Long Wave Oscillations: 100 Convergence Criteria: Total Energy Change per Atom: 0.001 eV / atom Integral of Absolute Density Change: 0.0001 electrons Integral of Absolute Eigenstate Change: 1e-09 Number of Bands in Calculation: 1728 Bands to Converge: Occupied States Only Number of Valence Electrons: 3366 log10-error: Total Iterations: Time WFS Density Energy Fermi Poisson iter: 1 17:54:54 +0.3 -4415.56673 3 105 iter: 2 17:56:44 -0.4 -5514.20755 5 iter: 3 17:58:34 -0.7 -5682.62208 4 iter: 4 18:01:07 +0.0 -0.9 -3933.90570 7 101 iter: 5 18:03:37 +0.0 -0.9 -3593.83801 15 93 iter: 6 18:06:07 +0.3 -1.0 -3028.82668 24 95 iter: 7 18:08:38 +0.4 -1.1 -2921.02831 26 94 iter: 8 18:11:05 +0.5 -1.1 -2940.70606 9 87 iter: 9 18:13:30 +0.4 -1.2 -3094.01547 12 80 iter: 10 18:15:54 +0.4 -1.3 -3432.21825 6 78 iter: 11 18:18:17 +0.3 -1.3 -3637.38850 3 75 iter: 12 18:20:38 +0.2 -1.3 -4192.08640 7 70 iter: 13 18:22:57 +0.2 -1.2 -4307.12409 5 64 iter: 14 18:25:14 +0.1 -1.2 -4761.82590 3 60 iter: 15 18:27:39 +0.1 -1.2 -4388.02667 7 82 iter: 16 18:30:04 -0.1 -1.1 -4787.18240 7 79 iter: 17 18:32:30 -0.1 -1.1 -4644.09637 8 82 iter: 18 18:34:58 -0.0 -1.1 -5683.63381 15 90 iter: 19 18:37:23 -0.0 -1.1 -5192.79717 4 79 iter: 20 18:39:53 -0.2 -1.0 -4643.90825 17 95 Memory usage: 1005.61 MB ============================================================ Timing: incl. excl. ============================================================ Initialization: 213.561 25.624 0.8% | Hamiltonian: 44.217 0.001 0.0% | Atomic: 0.000 0.000 0.0% | Communicate energies: 2.396 2.396 0.1% | Hartree integrate/restrict: 0.038 0.038 0.0% | Initialize Hamiltonian: 0.037 0.037 0.0% | Poisson: 40.831 40.831 1.3% || XC 3D grid: 0.907 0.907 0.0% | vbar: 0.006 0.006 0.0% | LCAO initialization: 143.720 8.160 0.3% | LCAO eigensolver: 19.933 0.013 0.0% | Atomic Hamiltonian: 0.000 0.000 0.0% | Blacs Orbital Layouts: 13.038 0.001 0.0% | General diagonalize: 12.918 12.918 0.4% | Redistribute coefs: 0.109 0.109 0.0% | Send coefs to domains: 0.010 0.010 0.0% | Calculate projections: 0.000 0.000 0.0% | Distribute overlap matrix: 6.873 1.005 0.0% | Distribute overlap matrix: 5.869 5.869 0.2% | Potential matrix: 0.008 0.008 0.0% | LCAO to grid: 0.038 0.038 0.0% | Set positions (LCAO WFS): 115.589 6.997 0.2% | Basic WFS set positions: 0.002 0.002 0.0% | Basis functions set positions: 0.134 0.134 0.0% | Distribute overlap matrix: 1.271 1.271 0.0% | TCI: Calculate S, T, P: 107.186 107.186 3.4% || SCF-cycle: 2911.908 5.082 0.2% | Density: 6.732 0.004 0.0% | Atomic density matrices: 0.002 0.002 0.0% | Mix: 1.219 1.219 0.0% | Multipole moments: 2.325 2.325 0.1% | Pseudo density: 3.183 3.183 0.1% | Hamiltonian: 643.258 0.010 0.0% | Atomic: 0.003 0.003 0.0% | Communicate energies: 43.163 43.163 1.4% || Hartree integrate/restrict: 0.688 0.688 0.0% | Poisson: 582.932 582.932 18.6% |------| XC 3D grid: 16.350 16.350 0.5% | vbar: 0.111 0.111 0.0% | Orthonormalize: 635.708 0.010 0.0% | Blacs Band Layouts: 7.387 0.002 0.0% | Inverse Cholesky: 7.385 7.385 0.2% | calc_matrix: 430.032 430.032 13.8% |-----| rotate_psi: 198.279 198.279 6.3% |--| RMM-DIIS: 1162.852 555.482 17.8% |------| precondition: 607.370 607.370 19.4% |-------| Subspace diag: 458.276 0.008 0.0% | Blacs Band Layouts: 73.776 0.004 0.0% | Diagonalize: 73.766 73.766 2.4% || Distribute results: 0.005 0.005 0.0% | calc_matrix: 196.672 196.672 6.3% |--| rotate_psi: 187.821 187.821 6.0% |-| Other: 0.301 0.301 0.0% | ============================================================ Total: 3125.770 100.0% ============================================================ date: Tue Apr 6 18:40:33 2010 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/Au_cluster.txt_band_8x8x8x4000066400000000000000000001270451316441372200312050ustar00rootroot00000000000000 ___ ___ ___ _ _ _ | | |_ | | | | | | | | | . | | | | |__ | _|___|_____| 0.7 |___|_| User: ???@ion-R46-1 Date: Wed Mar 31 10:30:34 2010 Arch: BGP Pid: 100 Dir: /gpaw/lib/python2.6/site-packages/gpaw ase: /gpaw/lib/python2.6/site-packages/ase version: 3.3.1 numpy: /gpaw/lib/python2.6/site-packages/numpy units: Angstrom and eV Extra parameters: {'blacs': 1} **NOTE**: please start using occupations=FermiDirac(width). Memory estimate --------------- Calculator 531.69 MiB Initial overhead 375.15 MiB Density 19.14 MiB Arrays 5.36 MiB Localized functions 6.17 MiB Mixer 2.06 MiB Interpolator 5.56 MiB Hamiltonian 24.61 MiB Arrays 3.50 MiB Restrictor 3.60 MiB XC 3D grid 1.65 MiB Poisson 15.40 MiB vbar 0.47 MiB Wavefunctions 112.79 MiB Arrays psit_nG 88.99 MiB Eigensolver 1.04 MiB Projectors 0.90 MiB Overlap op 21.50 MiB Kinetic operator 0.36 MiB Positions: 0 O 8.9496 24.5522 8.6269 1 C 9.8369 23.8824 7.8297 2 O 10.3147 24.4127 6.7962 3 C 10.2586 22.5069 8.1973 4 C 9.7956 21.9548 9.3535 5 C 10.1886 20.6691 9.7194 6 C 11.0905 21.8361 7.3423 7 C 11.5174 20.5522 7.6624 8 C 11.0266 19.9861 8.8472 9 S 11.5885 18.3508 9.2813 10 O 28.1333 14.7301 20.7426 11 C 27.4474 15.3375 21.6018 12 O 28.0125 16.3029 22.3892 13 C 25.9869 15.0849 21.6935 14 C 25.4359 14.0366 21.0104 15 C 24.0669 13.7800 21.1043 16 C 25.2389 15.8691 22.5314 17 C 23.8539 15.7056 22.5825 18 C 23.2969 14.6329 21.8936 19 S 21.5139 14.4397 21.9176 20 O 18.3160 17.3324 27.9612 21 C 18.7254 17.4155 26.7768 22 O 19.2643 18.5780 26.2976 23 C 18.5259 16.2810 25.8396 24 C 18.0389 15.0989 26.3016 25 C 17.8379 14.0267 25.4416 26 C 18.8919 16.4439 24.5216 27 C 18.7110 15.3967 23.6194 28 C 18.1409 14.2187 24.0835 29 S 17.8458 12.8725 22.9494 30 O 10.9413 12.3160 27.5998 31 C 10.6709 13.4464 26.8783 32 O 9.5007 13.8962 26.8030 33 C 11.7619 14.1215 26.1305 34 C 13.0471 13.6858 26.2984 35 C 14.0929 14.3170 25.6295 36 C 11.4548 15.1530 25.2865 37 C 12.4740 15.8039 24.5866 38 C 13.7730 15.3246 24.7206 39 S 15.1059 16.1757 23.8766 40 O 14.3510 23.2593 27.5755 41 C 14.4611 22.0092 27.5230 42 O 13.8989 21.1920 28.4650 43 C 15.2230 21.3887 26.4095 44 C 15.6558 22.1753 25.3855 45 C 16.3278 21.5993 24.3086 46 C 15.4270 20.0367 26.4385 47 C 16.1389 19.4259 25.4144 48 C 16.6179 20.2392 24.3836 49 S 17.5699 19.4916 23.0916 50 O 18.4673 28.9006 21.1980 51 C 18.0899 28.0627 20.1847 52 O 17.4109 28.4998 19.2227 53 C 18.5108 26.6390 20.2204 54 C 19.2527 26.2080 21.2866 55 C 19.6400 24.8798 21.3773 56 C 18.1617 25.8042 19.1985 57 C 18.5459 24.4610 19.2353 58 C 19.2469 24.0188 20.3483 59 S 19.8728 22.3550 20.3833 60 O 4.2414 20.7900 15.2209 61 C 4.6011 20.6819 13.9054 62 O 4.1339 21.4606 13.0378 63 C 5.5798 19.6412 13.5003 64 C 6.0428 18.7621 14.4404 65 C 6.9748 17.7889 14.0863 66 C 5.9855 19.5958 12.1955 67 C 6.8846 18.6161 11.7853 68 C 7.3897 17.7487 12.7504 69 S 8.5597 16.4991 12.2516 70 O 17.6672 7.0448 24.8204 71 C 18.0098 6.6418 23.6811 72 O 17.6399 5.4019 23.2371 73 C 18.7169 7.5728 22.7654 74 C 19.1450 8.7805 23.2313 75 C 19.8129 9.6676 22.3906 76 C 18.9917 7.1516 21.4895 77 C 19.6580 8.0009 20.6163 78 C 20.0359 9.2610 21.0754 79 S 20.6879 10.4385 19.9024 80 O 10.5943 6.6875 21.5703 81 C 10.5284 7.5054 22.6648 82 O 9.8824 7.1683 23.6878 83 C 11.2079 8.8258 22.6575 84 C 11.9027 9.2075 21.5445 85 C 12.5768 10.4257 21.5313 86 C 11.1279 9.6118 23.7727 87 C 11.7769 10.8439 23.8034 88 C 12.4750 11.2337 22.6565 89 S 13.1910 12.8649 22.6104 90 O 7.3001 19.2989 25.0933 91 C 7.6688 20.1334 24.2300 92 O 6.7696 20.9836 23.6470 93 C 9.0959 20.1630 23.8205 94 C 9.9900 19.3858 24.5033 95 C 11.3368 19.3997 24.1564 96 C 9.4760 20.9769 22.7894 97 C 10.8109 21.0240 22.4074 98 C 11.7049 20.1770 23.0545 99 S 13.4190 20.2217 22.5753 100 O 3.5939 10.5821 11.6508 101 C 4.8082 10.0108 11.3849 102 O 4.9004 9.0031 10.6409 103 C 6.0326 10.5560 12.0243 104 C 5.9166 11.5956 12.9004 105 C 7.0536 12.1616 13.4675 106 C 7.2455 10.0336 11.6735 107 C 8.4167 10.5560 12.2273 108 C 8.2845 11.5769 13.1655 109 S 9.7177 12.0755 14.0945 110 O 9.4876 26.7892 11.9048 111 C 10.3502 26.1941 12.5972 112 O 11.4520 26.8664 13.0505 113 C 10.1597 24.7483 12.8776 114 C 9.0376 24.1422 12.3773 115 C 8.8067 22.7931 12.6103 116 C 11.0588 24.0683 13.6404 117 C 10.8766 22.7052 13.8934 118 C 9.7467 22.0909 13.3674 119 S 9.4997 20.3381 13.5932 120 O 12.9263 6.1540 24.8934 121 C 13.2034 5.9605 23.6837 122 O 12.7786 4.8261 23.0479 123 C 14.0638 6.9456 22.9805 124 C 14.4549 8.0696 23.6526 125 C 15.2591 9.0138 23.0334 126 C 14.4588 6.6984 21.6964 127 C 15.2299 7.6414 21.0186 128 C 15.6149 8.7857 21.7003 129 S 16.7168 9.9509 20.9246 130 O 8.2575 11.7304 24.1396 131 C 7.8999 12.9261 24.2804 132 O 6.9545 13.2660 25.2089 133 C 8.5690 14.0017 23.5054 134 C 9.4860 13.6805 22.5485 135 C 10.0958 14.6911 21.8004 136 C 8.1741 15.2967 23.7233 137 C 8.7491 16.3339 23.0073 138 C 9.7320 16.0046 22.0633 139 S 10.7009 17.3328 21.3884 140 O 15.2152 26.4013 25.6714 141 C 14.1630 25.8819 24.9681 142 O 12.9970 25.9802 25.4243 143 C 14.4008 25.1684 23.6876 144 C 15.6719 25.1172 23.1756 145 C 15.9259 24.4249 21.9976 146 C 13.3518 24.5820 23.0466 147 C 13.5557 23.8798 21.8565 148 C 14.8579 23.7791 21.3716 149 S 15.1229 23.0473 19.7573 150 O 18.7761 27.9232 9.8809 151 C 19.7890 27.2717 10.5298 152 O 20.9438 27.2492 10.0363 153 C 19.5156 26.5413 11.7935 154 C 18.2447 26.5401 12.3023 155 C 17.9716 25.9084 13.5153 156 C 20.5406 25.9002 12.4334 157 C 20.3108 25.2219 13.6325 158 C 19.0167 25.2370 14.1485 159 S 18.6496 24.2213 15.5673 160 O 7.2160 26.2855 16.0714 161 C 7.4678 26.0761 17.2839 162 O 6.9422 26.8922 18.2478 163 C 8.3278 24.9322 17.6804 164 C 8.8177 24.1090 16.7046 165 C 9.6417 23.0461 17.0483 166 C 8.6026 24.7350 19.0016 167 C 9.4497 23.6989 19.3936 168 C 9.9096 22.8379 18.3996 169 S 10.8866 21.4260 18.8655 170 O 5.3392 13.6178 22.3230 171 C 4.8488 13.6274 21.0460 172 O 3.6752 13.2502 20.8054 173 C 5.7168 14.1110 19.9424 174 C 6.9978 14.4828 20.2343 175 C 7.8500 14.9150 19.2203 176 C 5.2128 14.1820 18.6726 177 C 6.0397 14.5741 17.6164 178 C 7.3279 14.9930 17.9283 179 S 8.3638 15.6346 16.6285 180 O 27.0647 8.3764 16.5869 181 C 27.2060 9.4855 15.7986 182 O 28.3205 10.0553 15.6947 183 C 26.0468 10.0336 15.0496 184 C 24.7997 9.5106 15.2514 185 C 23.7046 10.0266 14.5665 186 C 26.2498 11.0935 14.2074 187 C 25.1976 11.6025 13.4553 188 C 23.9248 11.0726 13.6733 189 S 22.5658 11.6968 12.7064 190 O 13.3181 2.8098 16.1343 191 C 12.4360 3.5734 16.5994 192 O 11.1434 3.1507 16.7482 193 C 12.7987 4.9648 16.9704 194 C 14.1199 5.3103 17.0104 195 C 14.4837 6.6094 17.3456 196 C 11.8017 5.8537 17.2584 197 C 12.1199 7.1568 17.6253 198 C 13.4666 7.5128 17.6396 199 S 13.9109 9.1790 18.0795 200 O 5.2639 23.7908 21.2952 201 C 5.2738 23.5430 19.9499 202 O 4.6021 24.2569 19.1645 203 C 6.0539 22.3981 19.4154 204 C 6.7188 21.5830 20.2815 205 C 7.4877 20.5289 19.7995 206 C 6.1129 22.2183 18.0623 207 C 6.8226 21.1432 17.5335 208 C 7.4738 20.2962 18.4246 209 S 8.3658 18.8948 17.7815 210 O 24.3222 7.2969 17.8622 211 C 23.3342 6.5429 18.0436 212 O 23.4817 5.3540 18.7040 213 C 21.9697 7.0026 17.6804 214 C 21.7846 8.2848 17.2466 215 C 20.5067 8.7205 16.8943 216 C 20.9389 6.1056 17.7343 217 C 19.6438 6.5023 17.4195 218 C 19.4508 7.8165 16.9986 219 S 17.7839 8.3878 16.7303 220 Au 17.6679 16.3048 19.8974 221 Au 15.9037 16.3368 14.2653 222 Au 15.3538 18.7650 12.8583 223 Au 13.1948 16.9738 13.5075 224 Au 14.1376 14.2966 13.2156 225 Au 16.8736 14.4246 12.3913 226 Au 15.0618 17.2019 19.1703 227 Au 16.3367 18.7749 15.6445 228 Au 14.1457 17.0797 16.3223 229 Au 14.9939 14.3577 16.0504 230 Au 13.2335 18.4492 11.0553 231 Au 20.3660 15.4729 19.9614 232 Au 14.6737 13.6538 10.6055 233 Au 15.4308 15.5887 21.4806 234 Au 16.1827 18.5027 10.1124 235 Au 13.6247 19.5702 14.9385 236 Au 12.2707 15.1058 15.3783 237 Au 16.7790 12.2390 17.1022 238 Au 13.1619 15.1739 18.2063 239 Au 14.5736 19.5981 17.7536 240 Au 18.4838 21.0548 21.6925 241 Au 10.1377 17.5358 10.9213 242 Au 11.6854 12.4787 10.4076 243 Au 15.5208 12.8027 22.6804 244 Au 14.2499 18.1362 23.0666 245 Au 16.7868 21.2398 16.9654 246 Au 11.5068 17.8517 15.6834 247 Au 13.1856 12.4327 15.1693 248 Au 14.0196 12.4560 17.8115 249 Au 12.3857 17.9070 18.3346 250 Au 13.6857 20.9460 12.5803 251 Au 11.4745 19.1059 13.1684 252 Au 10.4577 16.2216 13.6725 253 Au 11.4607 13.5020 13.1473 254 Au 13.7895 11.6054 12.5345 255 Au 15.8809 11.8475 19.8045 256 Au 13.5916 13.5968 20.3815 257 Au 12.8747 16.4980 20.7085 258 Au 13.7079 19.4149 20.3383 259 Au 16.4667 20.9303 11.5563 260 Au 18.6058 21.9350 14.9034 261 Au 11.8686 20.3061 16.9454 262 Au 10.5906 15.9651 17.5285 263 Au 11.3558 13.2448 17.1916 264 Au 14.8927 10.3780 16.0375 265 Au 16.3367 23.9560 15.6445 266 Au 9.2728 19.6522 15.7713 267 Au 12.0218 10.4478 18.1813 268 Au 19.6025 22.1438 12.1415 269 Au 9.1728 13.9057 15.3976 270 Au 15.4576 9.2546 12.5253 271 Au 9.7318 18.0140 19.4526 272 O 23.6510 24.4973 22.7280 273 C 22.8363 23.8824 23.4600 274 O 22.3158 24.4600 24.5856 275 C 22.4146 22.5069 23.0924 276 C 22.8776 21.9548 21.9361 277 C 22.4845 20.6691 21.5703 278 C 21.5827 21.8361 23.9474 279 C 21.1558 20.5522 23.6272 280 C 21.6466 19.9861 22.4424 281 S 21.0847 18.3508 22.0083 282 O 4.4787 14.6760 10.6237 283 C 5.2258 15.3375 9.6879 284 O 4.7069 16.2239 8.9649 285 C 6.6863 15.0849 9.5961 286 C 7.2373 14.0366 10.2793 287 C 8.6063 13.7800 10.1853 288 C 7.4342 15.8691 8.7583 289 C 8.8193 15.7056 8.7072 290 C 9.3762 14.6329 9.3960 291 S 11.1593 14.4397 9.3721 292 O 14.3572 17.3324 3.3284 293 C 13.9477 17.4155 4.5129 294 O 13.4089 18.5780 4.9921 295 C 14.1472 16.2810 5.4500 296 C 14.6342 15.0989 4.9880 297 C 14.8353 14.0267 5.8481 298 C 13.7812 16.4439 6.7681 299 C 13.9622 15.3967 7.6703 300 C 14.5323 14.2187 7.2062 301 S 14.8273 12.8725 8.3402 302 O 21.7319 12.3160 3.6899 303 C 22.0022 13.4464 4.4113 304 O 23.1725 13.8962 4.4867 305 C 20.9113 14.1215 5.1592 306 C 19.6261 13.6858 4.9913 307 C 18.5803 14.3170 5.6601 308 C 21.2184 15.1530 6.0031 309 C 20.1992 15.8039 6.7031 310 C 18.9002 15.3246 6.5691 311 S 17.5673 16.1757 7.4130 312 O 18.3320 23.3708 3.7094 313 C 18.2121 22.0092 3.7667 314 O 18.7283 21.2589 2.9018 315 C 17.4502 21.3887 4.8801 316 C 17.0173 22.1753 5.9042 317 C 16.3454 21.5993 6.9811 318 C 17.2462 20.0367 4.8512 319 C 16.5343 19.4259 5.8752 320 C 16.0553 20.2392 6.9060 321 S 15.1033 19.4916 8.1980 322 O 14.2368 28.8320 10.1746 323 C 14.5833 28.0627 11.1050 324 O 15.3228 28.5388 12.1528 325 C 14.1624 26.6390 11.0693 326 C 13.4204 26.2080 10.0031 327 C 13.0331 24.8798 9.9123 328 C 14.5115 25.8042 12.0911 329 C 14.1273 24.4610 12.0543 330 C 13.4262 24.0188 10.9414 331 S 12.8003 22.3550 10.9063 332 O 28.4318 20.7900 16.0688 333 C 28.0721 20.6819 17.3842 334 O 28.5393 21.4606 18.2519 335 C 27.0933 19.6412 17.7893 336 C 26.6304 18.7621 16.8493 337 C 25.6984 17.7889 17.2034 338 C 26.6876 19.5958 19.0942 339 C 25.7886 18.6161 19.5044 340 C 25.2835 17.7487 18.5393 341 S 24.1135 16.4991 19.0381 342 O 15.0059 7.0448 6.4693 343 C 14.6634 6.6418 7.6085 344 O 15.0332 5.4019 8.0526 345 C 13.9562 7.5728 8.5242 346 C 13.5282 8.7805 8.0583 347 C 12.8603 9.6676 8.8990 348 C 13.6815 7.1516 9.8001 349 C 13.0152 8.0009 10.6734 350 C 12.6373 9.2610 10.2143 351 S 11.9853 10.4385 11.3873 352 O 22.0789 6.6875 9.7194 353 C 22.1447 7.5054 8.6249 354 O 22.7908 7.1683 7.6019 355 C 21.4652 8.8258 8.6321 356 C 20.7704 9.2075 9.7451 357 C 20.0964 10.4257 9.7583 358 C 21.5453 9.6118 7.5170 359 C 20.8962 10.8439 7.4863 360 C 20.1982 11.2337 8.6332 361 S 19.4821 12.8649 8.6793 362 O 25.4059 19.2245 6.1194 363 C 25.0044 20.1334 7.0597 364 O 25.8300 20.9140 7.5950 365 C 23.5773 20.1630 7.4691 366 C 22.6832 19.3858 6.7863 367 C 21.3364 19.3997 7.1333 368 C 23.1972 20.9769 8.5003 369 C 21.8623 21.0240 8.8822 370 C 20.9683 20.1770 8.2352 371 S 19.2542 20.2217 8.7143 372 O 28.9798 10.5353 19.6607 373 C 27.8650 10.0108 19.9048 374 O 27.7646 8.9132 20.7151 375 C 26.6406 10.5560 19.2653 376 C 26.7565 11.5956 18.3892 377 C 25.6196 12.1616 17.8222 378 C 25.4276 10.0336 19.6162 379 C 24.2565 10.5560 19.0624 380 C 24.3887 11.5769 18.1241 381 S 22.9555 12.0755 17.1951 382 O 23.1855 26.7892 19.3849 383 C 22.3230 26.1941 18.6924 384 O 21.2211 26.8664 18.2392 385 C 22.5135 24.7483 18.4121 386 C 23.6355 24.1422 18.9123 387 C 23.8665 22.7931 18.6794 388 C 21.6144 24.0683 17.6493 389 C 21.7966 22.7052 17.3963 390 C 22.9265 22.0909 17.9222 391 S 23.1735 20.3381 17.6964 392 O 19.7716 6.1713 6.2884 393 C 19.4698 5.9605 7.6060 394 O 19.8598 4.9190 8.1897 395 C 18.6094 6.9456 8.3091 396 C 18.2183 8.0696 7.6371 397 C 17.4141 9.0138 8.2563 398 C 18.2144 6.6984 9.5933 399 C 17.4433 7.6414 10.2711 400 C 17.0583 8.7857 9.5893 401 S 15.9564 9.9509 10.3650 402 O 24.3838 11.6238 7.1626 403 C 24.7733 12.9261 7.0093 404 O 25.6413 13.2382 6.1568 405 C 24.1041 14.0017 7.7843 406 C 23.1872 13.6805 8.7411 407 C 22.5774 14.6911 9.4893 408 C 24.4991 15.2967 7.5663 409 C 23.9241 16.3339 8.2823 410 C 22.9412 16.0046 9.2263 411 S 21.9723 17.3328 9.9013 412 O 17.5441 26.3587 5.6759 413 C 18.5102 25.8819 6.3216 414 O 19.7802 25.9890 5.8246 415 C 18.2724 25.1684 7.6020 416 C 17.0013 25.1172 8.1141 417 C 16.7473 24.4249 9.2921 418 C 19.3214 24.5820 8.2430 419 C 19.1174 23.8798 9.4332 420 C 17.8153 23.7791 9.9181 421 S 17.5503 23.0473 11.5323 422 O 13.8141 27.8698 21.3557 423 C 12.8842 27.2717 20.7599 424 O 11.6264 27.2472 21.2973 425 C 13.1576 26.5413 19.4961 426 C 14.4284 26.5401 18.9874 427 C 14.7016 25.9084 17.7743 428 C 12.1325 25.9002 18.8562 429 C 12.3624 25.2219 17.6571 430 C 13.6564 25.2370 17.1412 431 S 14.0235 24.2213 15.7224 432 O 25.4796 26.3041 15.3264 433 C 25.2054 26.0761 14.0057 434 O 25.6880 26.8254 13.1207 435 C 24.3454 24.9322 13.6093 436 C 23.8555 24.1090 14.5851 437 C 23.0314 23.0461 14.2414 438 C 24.0705 24.7350 12.2880 439 C 23.2235 23.6989 11.8961 440 C 22.7636 22.8379 12.8901 441 S 21.7866 21.4260 12.4241 442 O 27.3340 13.6178 8.9666 443 C 27.8244 13.6274 10.2437 444 O 28.9980 13.2502 10.4843 445 C 26.9564 14.1110 11.3472 446 C 25.6753 14.4828 11.0553 447 C 24.8232 14.9150 12.0693 448 C 27.4604 14.1820 12.6171 449 C 26.6335 14.5741 13.6733 450 C 25.3452 14.9930 13.3613 451 S 24.3094 15.6346 14.6612 452 O 5.6085 8.3764 14.7028 453 C 5.4671 9.4855 15.4911 454 O 4.3526 10.0553 15.5950 455 C 6.6264 10.0336 16.2401 456 C 7.8734 9.5106 16.0382 457 C 8.9686 10.0266 16.7232 458 C 6.4234 11.0935 17.0822 459 C 7.4756 11.6025 17.8344 460 C 8.7484 11.0726 17.6164 461 S 10.1074 11.6968 18.5833 462 O 19.3551 2.8098 15.1553 463 C 20.2372 3.5734 14.6903 464 O 21.5297 3.1507 14.5414 465 C 19.8744 4.9648 14.3193 466 C 18.5533 5.3103 14.2792 467 C 18.1895 6.6094 13.9441 468 C 20.8715 5.8537 14.0313 469 C 20.5533 7.1568 13.6643 470 C 19.2066 7.5128 13.6500 471 S 18.7623 9.1790 13.2102 472 O 27.4085 23.7706 10.1046 473 C 27.3994 23.5430 11.3397 474 O 28.1309 24.3205 12.1952 475 C 26.6193 22.3981 11.8743 476 C 25.9544 21.5830 11.0082 477 C 25.1855 20.5289 11.4902 478 C 26.5603 22.2183 13.2274 479 C 25.8505 21.1432 13.7562 480 C 25.1994 20.2962 12.8650 481 S 24.3074 18.8948 13.5082 482 O 8.2629 7.3641 13.4437 483 C 9.3390 6.5429 13.2461 484 O 9.2035 5.4513 12.6398 485 C 10.7035 7.0026 13.6093 486 C 10.8886 8.2848 14.0431 487 C 12.1664 8.7205 14.3954 488 C 11.7343 6.1056 13.5554 489 C 13.0294 6.5023 13.8701 490 C 13.2223 7.8165 14.2910 491 S 14.8893 8.3878 14.5594 492 Au 15.0053 16.3048 11.3923 493 Au 16.7695 16.3368 17.0244 494 Au 17.3194 18.7650 18.4314 495 Au 19.4784 16.9738 17.7822 496 Au 18.5356 14.2966 18.0741 497 Au 15.7996 14.4246 18.8984 498 Au 17.6114 17.2019 12.1194 499 Au 18.5275 17.0797 14.9674 500 Au 17.6793 14.3577 15.2393 501 Au 19.4396 18.4492 20.2343 502 Au 12.3072 15.4729 11.3283 503 Au 17.9995 13.6538 20.6842 504 Au 17.2424 15.5887 9.8091 505 Au 16.4904 18.5027 21.1772 506 Au 19.0485 19.5702 16.3512 507 Au 20.4025 15.1058 15.9114 508 Au 15.8942 12.2390 14.1874 509 Au 19.5113 15.1739 13.0834 510 Au 18.0995 19.5981 13.5361 511 Au 14.1894 21.0548 9.5972 512 Au 22.5355 17.5358 20.3683 513 Au 20.9878 12.4787 20.8821 514 Au 17.1524 12.8027 8.6093 515 Au 18.4232 18.1362 8.2230 516 Au 15.8864 21.2398 14.3243 517 Au 21.1664 17.8517 15.6062 518 Au 19.4876 12.4327 16.1204 519 Au 18.6535 12.4560 13.4782 520 Au 20.2875 17.9070 12.9551 521 Au 18.9875 20.9460 18.7094 522 Au 21.1987 19.1059 18.1213 523 Au 22.2155 16.2216 17.6171 524 Au 21.2125 13.5020 18.1423 525 Au 18.8837 11.6054 18.7551 526 Au 16.7922 11.8475 11.4852 527 Au 19.0815 13.5968 10.9081 528 Au 19.7985 16.4980 10.5812 529 Au 18.9653 19.4149 10.9514 530 Au 16.2065 20.9303 19.7334 531 Au 14.0674 21.9350 16.3862 532 Au 20.8045 20.3061 14.3443 533 Au 22.0826 15.9651 13.7612 534 Au 21.3174 13.2448 14.0981 535 Au 17.7805 10.3780 15.2522 536 Au 23.4004 19.6522 15.5183 537 Au 20.6514 10.4478 13.1084 538 Au 13.0707 22.1438 19.1481 539 Au 23.5004 13.9057 15.8921 540 Au 17.2156 9.2546 18.7644 541 Au 22.9413 18.0140 11.8371 542 H 9.1139 22.5220 9.9959 543 H 9.8505 20.2153 10.6568 544 H 11.4184 22.3084 6.4104 545 H 12.2098 20.0047 7.0145 546 H 26.0700 13.3966 20.3880 547 H 23.6125 12.9360 20.5751 548 H 25.7264 16.6221 23.1593 549 H 23.2244 16.4008 23.1478 550 H 17.8022 14.9905 27.3652 551 H 17.4574 13.0677 25.8086 552 H 19.3232 17.3920 24.1839 553 H 19.0108 15.5005 22.5713 554 H 13.2545 12.8385 26.9604 555 H 15.1340 14.0308 25.8119 556 H 10.4137 15.4676 25.1598 557 H 12.2561 16.6678 23.9500 558 H 15.4768 23.2553 25.4080 559 H 16.6169 22.1942 23.4359 560 H 15.0308 19.4385 27.2655 561 H 16.3185 18.3457 25.4146 562 H 19.5417 26.9150 22.0712 563 H 20.2324 24.5182 22.2243 564 H 17.5818 26.1861 18.3518 565 H 18.3019 23.7801 18.4132 566 H 5.6807 18.8233 15.4720 567 H 7.3676 17.0824 14.8250 568 H 5.6043 20.3277 11.4758 569 H 7.1855 18.5300 10.7360 570 H 18.9622 9.0553 24.2754 571 H 20.1496 10.6462 22.7484 572 H 18.6876 6.1520 21.1616 573 H 19.8812 7.6879 19.5910 574 H 11.9294 8.5563 20.6646 575 H 13.1673 10.7363 20.6631 576 H 10.5539 9.2731 24.6415 577 H 11.7417 11.4829 24.6919 578 H 9.6446 18.7505 25.3256 579 H 12.0777 18.8259 24.7228 580 H 8.7322 21.5881 22.2676 581 H 11.1491 21.7069 21.6211 582 H 4.9262 11.9852 13.1577 583 H 6.9855 13.0336 14.1263 584 H 7.2994 9.2059 10.9586 585 H 9.4015 10.1772 11.9348 586 H 8.3193 24.7245 11.7909 587 H 7.9158 22.2956 12.2130 588 H 11.9268 24.5899 14.0569 589 H 11.6019 22.1395 14.4875 590 H 14.1309 8.2252 24.6869 591 H 15.6030 9.9052 23.5683 592 H 14.1712 5.7645 21.2021 593 H 15.5237 7.4827 19.9758 594 H 9.7442 12.6321 22.3667 595 H 10.8376 14.4541 21.0305 596 H 7.4001 15.5120 24.4674 597 H 8.4468 17.3733 23.1727 598 H 16.4904 25.6240 23.6973 599 H 16.9344 24.3870 21.5727 600 H 12.3436 24.6614 23.4664 601 H 12.7174 23.4223 21.3208 602 H 17.4382 27.0379 11.7539 603 H 16.9696 25.9386 13.9558 604 H 21.5473 25.9189 12.0031 605 H 21.1202 24.6960 14.1496 606 H 8.5608 24.2877 15.6553 607 H 10.0681 22.3915 16.2810 608 H 8.1572 25.3916 19.7563 609 H 9.7417 23.5673 20.4407 610 H 7.3564 14.4411 21.2681 611 H 8.8907 15.1836 19.4293 612 H 4.1635 13.9321 18.4841 613 H 5.6856 14.5522 16.5805 614 H 24.6627 8.6826 15.9548 615 H 22.6992 9.6226 14.7248 616 H 27.2453 11.5423 14.1260 617 H 25.3618 12.3934 12.7160 618 H 14.8895 4.5665 16.7793 619 H 15.5356 6.9119 17.3772 620 H 10.7540 5.5405 17.2003 621 H 11.3399 7.8771 17.8934 622 H 6.6476 21.7584 21.3600 623 H 8.0820 19.9047 20.4748 624 H 5.6022 22.9193 17.3939 625 H 6.8668 20.9704 16.4531 626 H 22.6368 8.9687 17.1756 627 H 20.3380 9.7447 16.5454 628 H 21.1345 5.0687 18.0271 629 H 18.8034 5.8050 17.4998 630 H 23.5593 22.5220 21.2938 631 H 22.8227 20.2153 20.6328 632 H 21.2548 22.3084 24.8793 633 H 20.4634 20.0047 24.2752 634 H 6.6032 13.3966 10.9017 635 H 9.0607 12.9360 10.7146 636 H 6.9468 16.6221 8.1303 637 H 9.4488 16.4008 8.1419 638 H 14.8710 14.9905 3.9245 639 H 15.2157 13.0677 5.4810 640 H 13.3499 17.3920 7.1057 641 H 13.6623 15.5005 8.7183 642 H 19.4187 12.8385 4.3293 643 H 17.5392 14.0308 5.4778 644 H 22.2595 15.4676 6.1299 645 H 20.4171 16.6678 7.3397 646 H 17.1964 23.2553 5.8817 647 H 16.0563 22.1942 7.8537 648 H 17.6424 19.4385 4.0241 649 H 16.3547 18.3457 5.8751 650 H 13.1315 26.9150 9.2184 651 H 12.4408 24.5182 9.0653 652 H 15.0914 26.1861 12.9379 653 H 14.3713 23.7801 12.8764 654 H 26.9925 18.8233 15.8177 655 H 25.3056 17.0824 16.4646 656 H 27.0688 20.3277 19.8139 657 H 25.4877 18.5300 20.5537 658 H 13.7110 9.0553 7.0142 659 H 12.5235 10.6462 8.5413 660 H 13.9856 6.1520 10.1281 661 H 12.7920 7.6879 11.6987 662 H 20.7438 8.5564 10.6251 663 H 19.5059 10.7363 10.6266 664 H 22.1192 9.2731 6.6482 665 H 20.9314 11.4829 6.5977 666 H 23.0286 18.7505 5.9640 667 H 20.5954 18.8259 6.5669 668 H 23.9410 21.5881 9.0221 669 H 21.5241 21.7069 9.6685 670 H 27.7470 11.9852 18.1319 671 H 25.6877 13.0336 17.1634 672 H 25.3738 9.2059 20.3311 673 H 23.2716 10.1772 19.3548 674 H 24.3538 24.7245 19.4988 675 H 24.7574 22.2956 19.0767 676 H 20.7464 24.5899 17.2327 677 H 21.0713 22.1395 16.8022 678 H 18.5423 8.2252 6.6027 679 H 17.0702 9.9052 7.7214 680 H 18.5020 5.7645 10.0875 681 H 17.1495 7.4827 11.3139 682 H 22.9290 12.6321 8.9230 683 H 21.8356 14.4541 10.2591 684 H 25.2731 15.5120 6.8223 685 H 24.2264 17.3733 8.1170 686 H 16.1828 25.6240 7.5924 687 H 15.7388 24.3870 9.7170 688 H 20.3296 24.6614 7.8233 689 H 19.9557 23.4223 9.9689 690 H 15.2350 27.0379 19.5357 691 H 15.7036 25.9386 17.3338 692 H 11.1258 25.9189 19.2866 693 H 11.5530 24.6960 17.1401 694 H 24.1124 24.2877 15.6344 695 H 22.6050 22.3915 15.0086 696 H 24.5160 25.3916 11.5334 697 H 22.9315 23.5673 10.8489 698 H 25.3168 14.4411 10.0215 699 H 23.7825 15.1836 11.8603 700 H 28.5097 13.9321 12.8056 701 H 26.9876 14.5522 14.7092 702 H 8.0105 8.6826 15.3349 703 H 9.9739 9.6226 16.5649 704 H 5.4279 11.5423 17.1637 705 H 7.3114 12.3934 18.5737 706 H 17.7836 4.5665 14.5104 707 H 17.1376 6.9119 13.9125 708 H 21.9191 5.5405 14.0893 709 H 21.3333 7.8771 13.3963 710 H 26.0255 21.7584 9.9296 711 H 24.5911 19.9047 10.8148 712 H 27.0710 22.9193 13.8958 713 H 25.8064 20.9704 14.8365 714 H 10.0364 8.9687 14.1141 715 H 12.3352 9.7447 14.7443 716 H 11.5386 5.0687 13.2626 717 H 13.8698 5.8050 13.7899 718 H 8.8058 25.4273 8.2171 719 H 28.9655 16.3170 22.1743 720 H 19.3030 19.1904 27.0579 721 H 10.1009 12.0294 28.0074 722 H 13.4508 21.7860 29.0982 723 H 18.0960 29.7795 20.9877 724 H 3.5997 21.5247 15.2763 725 H 17.1857 4.9556 23.9781 726 H 10.0873 5.8777 21.7743 727 H 5.8967 20.8056 24.0481 728 H 2.9266 10.0811 11.1426 729 H 11.3903 27.7973 12.7604 730 H 12.2353 4.3134 23.6774 731 H 6.6471 12.4283 25.6066 732 H 14.8513 26.8220 26.4746 733 H 19.1579 28.3311 9.0794 734 H 6.4138 27.5720 17.7861 735 H 4.6229 13.2717 22.8901 736 H 27.9338 8.1800 16.9876 737 H 11.1144 2.2205 16.4509 738 H 4.6977 24.5740 21.4389 739 H 24.4400 5.2420 18.8581 740 H 22.7136 25.3502 24.6474 741 H 3.5571 14.9853 10.5262 742 H 13.3701 19.1904 4.2318 743 H 22.5722 12.0294 3.2822 744 H 18.8617 23.5737 2.9139 745 H 15.4922 29.4869 11.9888 746 H 29.0734 21.5247 16.0133 747 H 15.4875 4.9556 7.3116 748 H 22.5859 5.8777 9.5154 749 H 26.3648 19.3652 5.9954 750 H 28.6687 8.7149 21.0278 751 H 21.2829 27.7973 18.5292 752 H 20.3330 5.4193 6.0168 753 H 24.9353 11.0806 6.5665 754 H 19.7214 26.4843 4.9846 755 H 11.6575 27.7770 22.1176 756 H 26.0549 27.0924 15.3738 757 H 28.0503 13.2717 8.3996 758 H 4.7394 8.1800 14.3020 759 H 21.5588 2.2205 14.8388 760 H 28.5657 25.0069 11.6527 761 H 7.4695 6.8861 13.1328 .------------------------------------------------------------------------------. /| | / | | / | | / | | / | | / | | / | | / | | / | | / | H H | / | O O O | / | OC C | / | C H H | / | H C C OH H O | / | H C C O HOHH C | / | O H O C CHC C O | / | H O H C C C H CC H CHCH CHCC C | / | HO O O CC HC H C CH OC | / | H H HH CHCC C H C HCC SC HuC C C C H O | * | HO OC HHO C CSu HC S CO C H H | | | CCC C C S C C S HH C C | | | O CCH CCHS C Au C AuuH H H CC CC H OH H | | H O HC H C C SSAuH AuAu S AuS Cu C C CC H O | | | H CCHC AHCC H H O H C C O | | O C C O H CAC AuS CuuH Au AuH C S C CH O C | | | C OHHSC C C Au H C COHH Au C H H HC CO O H | | | CO C H Cu C AuC HOuu C H AuuC Au HC CCC | | H| C HC OAu CCH Au HCAuCCu S HAu C CHHAu HOCHHO H | | | C H HO S CCC AuC Au H COCu AHuC CC CC CHC C OH | | | HO CC H H Au H AH AuAuC H Auu AuAuSH C O CH C | | |H C CC Su AuAu Au S Au SHS C C | | | CCC AuH Au Au S Au AuAu C Hu Au CH C O | | | C C H C HC Au Au H S CAuC CC OC HO Au CHHC H | | O C| C H SSC C C HAu AuuHu C HC AuuAuC HC COC O | | H H H CAHCC O Au AuuAu H CCCHC CCHH C H | | H O| C C H C HAS H Auu SCS H C C | | H O H O CC C CH S SuC Au H C O | | O |CC OCCCHHCC OC HAuuH Cu C CCAH C C HH C C O | | H C .--HC--CH---CCH-SAH----HH-----O-C--O-------H----CC-----------------------------. | O/ H O H H C S HS HS OH HC HC OOHH / | / C S H Au CCH CCH C H / | / C C C H O C H C / | / H CC HH C CO O O / | / C H H C HC H / | / H H C HO C O / | / O HO H / | / H O O H / | / H / | / / | / / | / / | / / | / / | / / | / / | / / | / / |/ / *------------------------------------------------------------------------------* Unit Cell: Periodic X Y Z Points Spacing -------------------------------------------------------------------- 1. axis: yes 32.000000 0.000000 0.000000 240 0.1333 2. axis: yes 0.000000 32.000000 0.000000 240 0.1333 3. axis: yes 0.000000 0.000000 32.000000 240 0.1333 Grid-points per volume: 421.87 Effective grid-spacing: 0.1333 O-setup: name : Oxygen id : 5f3f27ba17355653aa2069308cb75aea Z : 8 valence: 6 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/O.LDA.gz cutoffs: 0.74(comp), 1.30(filt), 0.83(core), lmax=2 valence states: energy radius 2s(2) -23.752 0.741 2p(4) -9.195 0.741 *s 3.459 0.741 *p 18.016 0.741 *d 0.000 0.741 Using partial waves for O as LCAO basis S-setup: name : Sulfur id : 16df0b8f883bfd770ab5c435bc804428 Z : 16 valence: 6 core : 10 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/S.LDA.gz cutoffs: 0.85(comp), 1.49(filt), 1.66(core), lmax=2 valence states: energy radius 3s(2) -17.278 0.847 3p(4) -7.106 0.847 *s 9.933 0.847 *p 20.105 0.847 *d 0.000 0.847 Using partial waves for S as LCAO basis C-setup: name : Carbon id : d60576a1f549371a163e72552ca58787 Z : 6 valence: 4 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/C.LDA.gz cutoffs: 0.64(comp), 1.14(filt), 1.14(core), lmax=2 valence states: energy radius 2s(2) -13.639 0.635 2p(2) -5.414 0.635 *s 13.573 0.635 *p 21.797 0.635 *d 0.000 0.635 Using partial waves for C as LCAO basis H-setup: name : Hydrogen id : 4766778ce56282eaa64abeb28b7c1de3 Z : 1 valence: 1 core : 0 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/H.LDA.gz cutoffs: 0.48(comp), 0.85(filt), 0.53(core), lmax=2 valence states: energy radius 1s(1) -6.353 0.476 *s 20.858 0.476 *p 0.000 0.476 Using partial waves for H as LCAO basis Au-setup: name : Gold id : a44207148b704df7bec07bf25e8feca8 Z : 79 valence: 11 core : 68 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/Au.LDA.gz cutoffs: 1.32(comp), 2.33(filt), 2.81(core), lmax=2 valence states: energy radius 6s(1) -6.048 1.323 6p(0) -0.888 1.323 5d(10) -7.129 1.323 *s 21.163 1.323 *p 26.323 1.323 *d 20.082 1.323 Using partial waves for Au as LCAO basis Using the LDA Exchange-Correlation Functional. Spin-Paired Calculation Total Charge: 0.000000 Fermi Temperature: 0.100000 Mode: fd Eigen Solver: (3 nearest neighbors central finite-difference stencil) Diagonalizer: ScaLapack - grid: [nprow, npcol, nb] = [5, 5, 64] Inverse Cholesky: Lapack Poisson Solver: Jacobi (Mehrstellen finite-difference stencil) Interpolation: 6th Order Reference Energy: -53635200.580024 Gamma Point Calculation Total number of cores used: 2048 Using Domain Decomposition: 8 x 8 x 8 Parallelization Over bands on 4 Processors 1 k-point in the Irreducible Part of the Brillouin Zone (total: 1) Linear Mixing Parameter: 0.1 Pulay Mixing with 5 Old Densities Damping of Long Wave Oscillations: 100 Convergence Criteria: Total Energy Change per Atom: 0.001 eV / atom Integral of Absolute Density Change: 0.0001 electrons Integral of Absolute Eigenstate Change: 1e-09 Number of Bands in Calculation: 1728 Bands to Converge: Occupied States Only Number of Valence Electrons: 3366 log10-error: Total Iterations: Time WFS Density Energy Fermi Poisson iter: 1 10:39:58 +0.3 -4415.56673 3 105 iter: 2 10:43:36 -0.4 -5514.20755 5 iter: 3 10:47:14 -0.7 -5682.62208 4 iter: 4 10:51:34 +0.0 -0.9 -3933.90570 7 101 iter: 5 10:55:52 +0.0 -0.9 -3593.83801 15 93 iter: 6 11:00:10 +0.3 -1.0 -3028.82668 24 95 iter: 7 11:04:28 +0.4 -1.1 -2921.02831 26 94 iter: 8 11:08:43 +0.5 -1.1 -2940.70606 9 87 iter: 9 11:12:56 +0.4 -1.2 -3094.01547 12 80 iter: 10 11:17:08 +0.4 -1.3 -3432.21824 6 78 iter: 11 11:21:18 +0.3 -1.3 -3637.38845 3 75 iter: 12 11:25:27 +0.2 -1.3 -4192.08658 7 70 iter: 13 11:29:34 +0.2 -1.2 -4307.12554 5 64 iter: 14 11:33:39 +0.1 -1.2 -4761.83105 3 60 iter: 15 11:37:52 +0.1 -1.2 -4388.01403 7 82 iter: 16 11:42:04 -0.1 -1.1 -4787.14716 7 79 iter: 17 11:46:18 -0.1 -1.1 -4643.95591 8 82 iter: 18 11:50:34 -0.0 -1.1 -5683.99034 15 90 iter: 19 11:54:46 -0.0 -1.1 -5193.98368 4 79 iter: 20 11:59:04 -0.2 -1.0 -4644.35219 17 95 Memory usage: 1.28 GB ============================================================ Timing: incl. excl. ============================================================ Initialization: 217.994 25.471 0.5% | Hamiltonian: 41.844 0.001 0.0% | Atomic: 0.000 0.000 0.0% | Communicate energies: 2.661 2.661 0.0% | Hartree integrate/restrict: 0.030 0.030 0.0% | Initialize Hamiltonian: 0.036 0.036 0.0% | Poisson: 38.204 38.204 0.7% | XC 3D grid: 0.907 0.907 0.0% | vbar: 0.006 0.006 0.0% | LCAO initialization: 150.678 9.376 0.2% | LCAO eigensolver: 22.300 0.015 0.0% | Atomic Hamiltonian: 0.000 0.000 0.0% | Blacs Orbital Layouts: 12.767 0.001 0.0% | General diagonalize: 12.658 12.658 0.2% | Redistribute coefs: 0.088 0.088 0.0% | Send coefs to domains: 0.020 0.020 0.0% | Calculate projections: 0.000 0.000 0.0% | Distribute overlap matrix: 9.503 2.039 0.0% | Distribute overlap matrix: 7.464 7.464 0.1% | Potential matrix: 0.015 0.015 0.0% | LCAO to grid: 0.076 0.076 0.0% | Set positions (LCAO WFS): 118.926 8.603 0.2% | Basic WFS set positions: 0.002 0.002 0.0% | Basis functions set positions: 0.134 0.134 0.0% | Distribute overlap matrix: 2.873 2.873 0.1% | TCI: Calculate S, T, P: 107.314 107.314 2.0% || SCF-cycle: 5130.082 4.613 0.1% | Density: 10.364 0.004 0.0% | Atomic density matrices: 0.002 0.002 0.0% | Mix: 1.231 1.231 0.0% | Multipole moments: 2.997 2.997 0.1% | Pseudo density: 6.130 6.130 0.1% | Hamiltonian: 612.315 0.010 0.0% | Atomic: 0.003 0.003 0.0% | Communicate energies: 47.966 47.966 0.9% | Hartree integrate/restrict: 0.551 0.551 0.0% | Poisson: 547.331 547.331 10.2% |---| XC 3D grid: 16.342 16.342 0.3% | vbar: 0.111 0.111 0.0% | Orthonormalize: 1258.718 0.009 0.0% | Blacs Band Layouts: 7.651 0.002 0.0% | Inverse Cholesky: 7.649 7.649 0.1% | calc_matrix: 911.827 911.827 17.0% |------| rotate_psi: 339.232 339.232 6.3% |--| RMM-DIIS: 2424.579 1163.140 21.7% |--------| precondition: 1261.440 1261.440 23.6% |--------| Subspace diag: 819.492 0.008 0.0% | Blacs Band Layouts: 73.433 0.004 0.0% | Diagonalize: 73.417 73.417 1.4% || Distribute results: 0.012 0.012 0.0% | calc_matrix: 423.220 423.220 7.9% |--| rotate_psi: 322.831 322.831 6.0% |-| Other: 0.297 0.297 0.0% | ============================================================ Total: 5348.372 100.0% ============================================================ date: Wed Mar 31 11:59:42 2010 Au_cluster.txt_domain_4x8x16x8000066400000000000000000001270441316441372200315470ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster ___ ___ ___ _ _ _ | | |_ | | | | | | | | | . | | | | |__ | _|___|_____| 0.7 |___|_| User: ???@ion-R42-1 Date: Tue Apr 6 17:48:41 2010 Arch: BGP Pid: 100 Dir: /gpaw/lib/python2.6/site-packages/gpaw ase: /gpaw/lib/python2.6/site-packages/ase version: 3.3.1 numpy: /gpaw/lib/python2.6/site-packages/numpy units: Angstrom and eV Extra parameters: {'blacs': 1} **NOTE**: please start using occupations=FermiDirac(width). Memory estimate --------------- Calculator 485.91 MiB Initial overhead 379.02 MiB Density 19.48 MiB Arrays 5.36 MiB Localized functions 6.17 MiB Mixer 2.06 MiB Interpolator 5.90 MiB Hamiltonian 24.84 MiB Arrays 3.50 MiB Restrictor 3.67 MiB XC 3D grid 1.65 MiB Poisson 15.55 MiB vbar 0.47 MiB Wavefunctions 62.57 MiB Arrays psit_nG 44.49 MiB Eigensolver 1.04 MiB Projectors 0.90 MiB Overlap op 15.75 MiB Kinetic operator 0.38 MiB Positions: 0 O 8.9496 24.5522 8.6269 1 C 9.8369 23.8824 7.8297 2 O 10.3147 24.4127 6.7962 3 C 10.2586 22.5069 8.1973 4 C 9.7956 21.9548 9.3535 5 C 10.1886 20.6691 9.7194 6 C 11.0905 21.8361 7.3423 7 C 11.5174 20.5522 7.6624 8 C 11.0266 19.9861 8.8472 9 S 11.5885 18.3508 9.2813 10 O 28.1333 14.7301 20.7426 11 C 27.4474 15.3375 21.6018 12 O 28.0125 16.3029 22.3892 13 C 25.9869 15.0849 21.6935 14 C 25.4359 14.0366 21.0104 15 C 24.0669 13.7800 21.1043 16 C 25.2389 15.8691 22.5314 17 C 23.8539 15.7056 22.5825 18 C 23.2969 14.6329 21.8936 19 S 21.5139 14.4397 21.9176 20 O 18.3160 17.3324 27.9612 21 C 18.7254 17.4155 26.7768 22 O 19.2643 18.5780 26.2976 23 C 18.5259 16.2810 25.8396 24 C 18.0389 15.0989 26.3016 25 C 17.8379 14.0267 25.4416 26 C 18.8919 16.4439 24.5216 27 C 18.7110 15.3967 23.6194 28 C 18.1409 14.2187 24.0835 29 S 17.8458 12.8725 22.9494 30 O 10.9413 12.3160 27.5998 31 C 10.6709 13.4464 26.8783 32 O 9.5007 13.8962 26.8030 33 C 11.7619 14.1215 26.1305 34 C 13.0471 13.6858 26.2984 35 C 14.0929 14.3170 25.6295 36 C 11.4548 15.1530 25.2865 37 C 12.4740 15.8039 24.5866 38 C 13.7730 15.3246 24.7206 39 S 15.1059 16.1757 23.8766 40 O 14.3510 23.2593 27.5755 41 C 14.4611 22.0092 27.5230 42 O 13.8989 21.1920 28.4650 43 C 15.2230 21.3887 26.4095 44 C 15.6558 22.1753 25.3855 45 C 16.3278 21.5993 24.3086 46 C 15.4270 20.0367 26.4385 47 C 16.1389 19.4259 25.4144 48 C 16.6179 20.2392 24.3836 49 S 17.5699 19.4916 23.0916 50 O 18.4673 28.9006 21.1980 51 C 18.0899 28.0627 20.1847 52 O 17.4109 28.4998 19.2227 53 C 18.5108 26.6390 20.2204 54 C 19.2527 26.2080 21.2866 55 C 19.6400 24.8798 21.3773 56 C 18.1617 25.8042 19.1985 57 C 18.5459 24.4610 19.2353 58 C 19.2469 24.0188 20.3483 59 S 19.8728 22.3550 20.3833 60 O 4.2414 20.7900 15.2209 61 C 4.6011 20.6819 13.9054 62 O 4.1339 21.4606 13.0378 63 C 5.5798 19.6412 13.5003 64 C 6.0428 18.7621 14.4404 65 C 6.9748 17.7889 14.0863 66 C 5.9855 19.5958 12.1955 67 C 6.8846 18.6161 11.7853 68 C 7.3897 17.7487 12.7504 69 S 8.5597 16.4991 12.2516 70 O 17.6672 7.0448 24.8204 71 C 18.0098 6.6418 23.6811 72 O 17.6399 5.4019 23.2371 73 C 18.7169 7.5728 22.7654 74 C 19.1450 8.7805 23.2313 75 C 19.8129 9.6676 22.3906 76 C 18.9917 7.1516 21.4895 77 C 19.6580 8.0009 20.6163 78 C 20.0359 9.2610 21.0754 79 S 20.6879 10.4385 19.9024 80 O 10.5943 6.6875 21.5703 81 C 10.5284 7.5054 22.6648 82 O 9.8824 7.1683 23.6878 83 C 11.2079 8.8258 22.6575 84 C 11.9027 9.2075 21.5445 85 C 12.5768 10.4257 21.5313 86 C 11.1279 9.6118 23.7727 87 C 11.7769 10.8439 23.8034 88 C 12.4750 11.2337 22.6565 89 S 13.1910 12.8649 22.6104 90 O 7.3001 19.2989 25.0933 91 C 7.6688 20.1334 24.2300 92 O 6.7696 20.9836 23.6470 93 C 9.0959 20.1630 23.8205 94 C 9.9900 19.3858 24.5033 95 C 11.3368 19.3997 24.1564 96 C 9.4760 20.9769 22.7894 97 C 10.8109 21.0240 22.4074 98 C 11.7049 20.1770 23.0545 99 S 13.4190 20.2217 22.5753 100 O 3.5939 10.5821 11.6508 101 C 4.8082 10.0108 11.3849 102 O 4.9004 9.0031 10.6409 103 C 6.0326 10.5560 12.0243 104 C 5.9166 11.5956 12.9004 105 C 7.0536 12.1616 13.4675 106 C 7.2455 10.0336 11.6735 107 C 8.4167 10.5560 12.2273 108 C 8.2845 11.5769 13.1655 109 S 9.7177 12.0755 14.0945 110 O 9.4876 26.7892 11.9048 111 C 10.3502 26.1941 12.5972 112 O 11.4520 26.8664 13.0505 113 C 10.1597 24.7483 12.8776 114 C 9.0376 24.1422 12.3773 115 C 8.8067 22.7931 12.6103 116 C 11.0588 24.0683 13.6404 117 C 10.8766 22.7052 13.8934 118 C 9.7467 22.0909 13.3674 119 S 9.4997 20.3381 13.5932 120 O 12.9263 6.1540 24.8934 121 C 13.2034 5.9605 23.6837 122 O 12.7786 4.8261 23.0479 123 C 14.0638 6.9456 22.9805 124 C 14.4549 8.0696 23.6526 125 C 15.2591 9.0138 23.0334 126 C 14.4588 6.6984 21.6964 127 C 15.2299 7.6414 21.0186 128 C 15.6149 8.7857 21.7003 129 S 16.7168 9.9509 20.9246 130 O 8.2575 11.7304 24.1396 131 C 7.8999 12.9261 24.2804 132 O 6.9545 13.2660 25.2089 133 C 8.5690 14.0017 23.5054 134 C 9.4860 13.6805 22.5485 135 C 10.0958 14.6911 21.8004 136 C 8.1741 15.2967 23.7233 137 C 8.7491 16.3339 23.0073 138 C 9.7320 16.0046 22.0633 139 S 10.7009 17.3328 21.3884 140 O 15.2152 26.4013 25.6714 141 C 14.1630 25.8819 24.9681 142 O 12.9970 25.9802 25.4243 143 C 14.4008 25.1684 23.6876 144 C 15.6719 25.1172 23.1756 145 C 15.9259 24.4249 21.9976 146 C 13.3518 24.5820 23.0466 147 C 13.5557 23.8798 21.8565 148 C 14.8579 23.7791 21.3716 149 S 15.1229 23.0473 19.7573 150 O 18.7761 27.9232 9.8809 151 C 19.7890 27.2717 10.5298 152 O 20.9438 27.2492 10.0363 153 C 19.5156 26.5413 11.7935 154 C 18.2447 26.5401 12.3023 155 C 17.9716 25.9084 13.5153 156 C 20.5406 25.9002 12.4334 157 C 20.3108 25.2219 13.6325 158 C 19.0167 25.2370 14.1485 159 S 18.6496 24.2213 15.5673 160 O 7.2160 26.2855 16.0714 161 C 7.4678 26.0761 17.2839 162 O 6.9422 26.8922 18.2478 163 C 8.3278 24.9322 17.6804 164 C 8.8177 24.1090 16.7046 165 C 9.6417 23.0461 17.0483 166 C 8.6026 24.7350 19.0016 167 C 9.4497 23.6989 19.3936 168 C 9.9096 22.8379 18.3996 169 S 10.8866 21.4260 18.8655 170 O 5.3392 13.6178 22.3230 171 C 4.8488 13.6274 21.0460 172 O 3.6752 13.2502 20.8054 173 C 5.7168 14.1110 19.9424 174 C 6.9978 14.4828 20.2343 175 C 7.8500 14.9150 19.2203 176 C 5.2128 14.1820 18.6726 177 C 6.0397 14.5741 17.6164 178 C 7.3279 14.9930 17.9283 179 S 8.3638 15.6346 16.6285 180 O 27.0647 8.3764 16.5869 181 C 27.2060 9.4855 15.7986 182 O 28.3205 10.0553 15.6947 183 C 26.0468 10.0336 15.0496 184 C 24.7997 9.5106 15.2514 185 C 23.7046 10.0266 14.5665 186 C 26.2498 11.0935 14.2074 187 C 25.1976 11.6025 13.4553 188 C 23.9248 11.0726 13.6733 189 S 22.5658 11.6968 12.7064 190 O 13.3181 2.8098 16.1343 191 C 12.4360 3.5734 16.5994 192 O 11.1434 3.1507 16.7482 193 C 12.7987 4.9648 16.9704 194 C 14.1199 5.3103 17.0104 195 C 14.4837 6.6094 17.3456 196 C 11.8017 5.8537 17.2584 197 C 12.1199 7.1568 17.6253 198 C 13.4666 7.5128 17.6396 199 S 13.9109 9.1790 18.0795 200 O 5.2639 23.7908 21.2952 201 C 5.2738 23.5430 19.9499 202 O 4.6021 24.2569 19.1645 203 C 6.0539 22.3981 19.4154 204 C 6.7188 21.5830 20.2815 205 C 7.4877 20.5289 19.7995 206 C 6.1129 22.2183 18.0623 207 C 6.8226 21.1432 17.5335 208 C 7.4738 20.2962 18.4246 209 S 8.3658 18.8948 17.7815 210 O 24.3222 7.2969 17.8622 211 C 23.3342 6.5429 18.0436 212 O 23.4817 5.3540 18.7040 213 C 21.9697 7.0026 17.6804 214 C 21.7846 8.2848 17.2466 215 C 20.5067 8.7205 16.8943 216 C 20.9389 6.1056 17.7343 217 C 19.6438 6.5023 17.4195 218 C 19.4508 7.8165 16.9986 219 S 17.7839 8.3878 16.7303 220 Au 17.6679 16.3048 19.8974 221 Au 15.9037 16.3368 14.2653 222 Au 15.3538 18.7650 12.8583 223 Au 13.1948 16.9738 13.5075 224 Au 14.1376 14.2966 13.2156 225 Au 16.8736 14.4246 12.3913 226 Au 15.0618 17.2019 19.1703 227 Au 16.3367 18.7749 15.6445 228 Au 14.1457 17.0797 16.3223 229 Au 14.9939 14.3577 16.0504 230 Au 13.2335 18.4492 11.0553 231 Au 20.3660 15.4729 19.9614 232 Au 14.6737 13.6538 10.6055 233 Au 15.4308 15.5887 21.4806 234 Au 16.1827 18.5027 10.1124 235 Au 13.6247 19.5702 14.9385 236 Au 12.2707 15.1058 15.3783 237 Au 16.7790 12.2390 17.1022 238 Au 13.1619 15.1739 18.2063 239 Au 14.5736 19.5981 17.7536 240 Au 18.4838 21.0548 21.6925 241 Au 10.1377 17.5358 10.9213 242 Au 11.6854 12.4787 10.4076 243 Au 15.5208 12.8027 22.6804 244 Au 14.2499 18.1362 23.0666 245 Au 16.7868 21.2398 16.9654 246 Au 11.5068 17.8517 15.6834 247 Au 13.1856 12.4327 15.1693 248 Au 14.0196 12.4560 17.8115 249 Au 12.3857 17.9070 18.3346 250 Au 13.6857 20.9460 12.5803 251 Au 11.4745 19.1059 13.1684 252 Au 10.4577 16.2216 13.6725 253 Au 11.4607 13.5020 13.1473 254 Au 13.7895 11.6054 12.5345 255 Au 15.8809 11.8475 19.8045 256 Au 13.5916 13.5968 20.3815 257 Au 12.8747 16.4980 20.7085 258 Au 13.7079 19.4149 20.3383 259 Au 16.4667 20.9303 11.5563 260 Au 18.6058 21.9350 14.9034 261 Au 11.8686 20.3061 16.9454 262 Au 10.5906 15.9651 17.5285 263 Au 11.3558 13.2448 17.1916 264 Au 14.8927 10.3780 16.0375 265 Au 16.3367 23.9560 15.6445 266 Au 9.2728 19.6522 15.7713 267 Au 12.0218 10.4478 18.1813 268 Au 19.6025 22.1438 12.1415 269 Au 9.1728 13.9057 15.3976 270 Au 15.4576 9.2546 12.5253 271 Au 9.7318 18.0140 19.4526 272 O 23.6510 24.4973 22.7280 273 C 22.8363 23.8824 23.4600 274 O 22.3158 24.4600 24.5856 275 C 22.4146 22.5069 23.0924 276 C 22.8776 21.9548 21.9361 277 C 22.4845 20.6691 21.5703 278 C 21.5827 21.8361 23.9474 279 C 21.1558 20.5522 23.6272 280 C 21.6466 19.9861 22.4424 281 S 21.0847 18.3508 22.0083 282 O 4.4787 14.6760 10.6237 283 C 5.2258 15.3375 9.6879 284 O 4.7069 16.2239 8.9649 285 C 6.6863 15.0849 9.5961 286 C 7.2373 14.0366 10.2793 287 C 8.6063 13.7800 10.1853 288 C 7.4342 15.8691 8.7583 289 C 8.8193 15.7056 8.7072 290 C 9.3762 14.6329 9.3960 291 S 11.1593 14.4397 9.3721 292 O 14.3572 17.3324 3.3284 293 C 13.9477 17.4155 4.5129 294 O 13.4089 18.5780 4.9921 295 C 14.1472 16.2810 5.4500 296 C 14.6342 15.0989 4.9880 297 C 14.8353 14.0267 5.8481 298 C 13.7812 16.4439 6.7681 299 C 13.9622 15.3967 7.6703 300 C 14.5323 14.2187 7.2062 301 S 14.8273 12.8725 8.3402 302 O 21.7319 12.3160 3.6899 303 C 22.0022 13.4464 4.4113 304 O 23.1725 13.8962 4.4867 305 C 20.9113 14.1215 5.1592 306 C 19.6261 13.6858 4.9913 307 C 18.5803 14.3170 5.6601 308 C 21.2184 15.1530 6.0031 309 C 20.1992 15.8039 6.7031 310 C 18.9002 15.3246 6.5691 311 S 17.5673 16.1757 7.4130 312 O 18.3320 23.3708 3.7094 313 C 18.2121 22.0092 3.7667 314 O 18.7283 21.2589 2.9018 315 C 17.4502 21.3887 4.8801 316 C 17.0173 22.1753 5.9042 317 C 16.3454 21.5993 6.9811 318 C 17.2462 20.0367 4.8512 319 C 16.5343 19.4259 5.8752 320 C 16.0553 20.2392 6.9060 321 S 15.1033 19.4916 8.1980 322 O 14.2368 28.8320 10.1746 323 C 14.5833 28.0627 11.1050 324 O 15.3228 28.5388 12.1528 325 C 14.1624 26.6390 11.0693 326 C 13.4204 26.2080 10.0031 327 C 13.0331 24.8798 9.9123 328 C 14.5115 25.8042 12.0911 329 C 14.1273 24.4610 12.0543 330 C 13.4262 24.0188 10.9414 331 S 12.8003 22.3550 10.9063 332 O 28.4318 20.7900 16.0688 333 C 28.0721 20.6819 17.3842 334 O 28.5393 21.4606 18.2519 335 C 27.0933 19.6412 17.7893 336 C 26.6304 18.7621 16.8493 337 C 25.6984 17.7889 17.2034 338 C 26.6876 19.5958 19.0942 339 C 25.7886 18.6161 19.5044 340 C 25.2835 17.7487 18.5393 341 S 24.1135 16.4991 19.0381 342 O 15.0059 7.0448 6.4693 343 C 14.6634 6.6418 7.6085 344 O 15.0332 5.4019 8.0526 345 C 13.9562 7.5728 8.5242 346 C 13.5282 8.7805 8.0583 347 C 12.8603 9.6676 8.8990 348 C 13.6815 7.1516 9.8001 349 C 13.0152 8.0009 10.6734 350 C 12.6373 9.2610 10.2143 351 S 11.9853 10.4385 11.3873 352 O 22.0789 6.6875 9.7194 353 C 22.1447 7.5054 8.6249 354 O 22.7908 7.1683 7.6019 355 C 21.4652 8.8258 8.6321 356 C 20.7704 9.2075 9.7451 357 C 20.0964 10.4257 9.7583 358 C 21.5453 9.6118 7.5170 359 C 20.8962 10.8439 7.4863 360 C 20.1982 11.2337 8.6332 361 S 19.4821 12.8649 8.6793 362 O 25.4059 19.2245 6.1194 363 C 25.0044 20.1334 7.0597 364 O 25.8300 20.9140 7.5950 365 C 23.5773 20.1630 7.4691 366 C 22.6832 19.3858 6.7863 367 C 21.3364 19.3997 7.1333 368 C 23.1972 20.9769 8.5003 369 C 21.8623 21.0240 8.8822 370 C 20.9683 20.1770 8.2352 371 S 19.2542 20.2217 8.7143 372 O 28.9798 10.5353 19.6607 373 C 27.8650 10.0108 19.9048 374 O 27.7646 8.9132 20.7151 375 C 26.6406 10.5560 19.2653 376 C 26.7565 11.5956 18.3892 377 C 25.6196 12.1616 17.8222 378 C 25.4276 10.0336 19.6162 379 C 24.2565 10.5560 19.0624 380 C 24.3887 11.5769 18.1241 381 S 22.9555 12.0755 17.1951 382 O 23.1855 26.7892 19.3849 383 C 22.3230 26.1941 18.6924 384 O 21.2211 26.8664 18.2392 385 C 22.5135 24.7483 18.4121 386 C 23.6355 24.1422 18.9123 387 C 23.8665 22.7931 18.6794 388 C 21.6144 24.0683 17.6493 389 C 21.7966 22.7052 17.3963 390 C 22.9265 22.0909 17.9222 391 S 23.1735 20.3381 17.6964 392 O 19.7716 6.1713 6.2884 393 C 19.4698 5.9605 7.6060 394 O 19.8598 4.9190 8.1897 395 C 18.6094 6.9456 8.3091 396 C 18.2183 8.0696 7.6371 397 C 17.4141 9.0138 8.2563 398 C 18.2144 6.6984 9.5933 399 C 17.4433 7.6414 10.2711 400 C 17.0583 8.7857 9.5893 401 S 15.9564 9.9509 10.3650 402 O 24.3838 11.6238 7.1626 403 C 24.7733 12.9261 7.0093 404 O 25.6413 13.2382 6.1568 405 C 24.1041 14.0017 7.7843 406 C 23.1872 13.6805 8.7411 407 C 22.5774 14.6911 9.4893 408 C 24.4991 15.2967 7.5663 409 C 23.9241 16.3339 8.2823 410 C 22.9412 16.0046 9.2263 411 S 21.9723 17.3328 9.9013 412 O 17.5441 26.3587 5.6759 413 C 18.5102 25.8819 6.3216 414 O 19.7802 25.9890 5.8246 415 C 18.2724 25.1684 7.6020 416 C 17.0013 25.1172 8.1141 417 C 16.7473 24.4249 9.2921 418 C 19.3214 24.5820 8.2430 419 C 19.1174 23.8798 9.4332 420 C 17.8153 23.7791 9.9181 421 S 17.5503 23.0473 11.5323 422 O 13.8141 27.8698 21.3557 423 C 12.8842 27.2717 20.7599 424 O 11.6264 27.2472 21.2973 425 C 13.1576 26.5413 19.4961 426 C 14.4284 26.5401 18.9874 427 C 14.7016 25.9084 17.7743 428 C 12.1325 25.9002 18.8562 429 C 12.3624 25.2219 17.6571 430 C 13.6564 25.2370 17.1412 431 S 14.0235 24.2213 15.7224 432 O 25.4796 26.3041 15.3264 433 C 25.2054 26.0761 14.0057 434 O 25.6880 26.8254 13.1207 435 C 24.3454 24.9322 13.6093 436 C 23.8555 24.1090 14.5851 437 C 23.0314 23.0461 14.2414 438 C 24.0705 24.7350 12.2880 439 C 23.2235 23.6989 11.8961 440 C 22.7636 22.8379 12.8901 441 S 21.7866 21.4260 12.4241 442 O 27.3340 13.6178 8.9666 443 C 27.8244 13.6274 10.2437 444 O 28.9980 13.2502 10.4843 445 C 26.9564 14.1110 11.3472 446 C 25.6753 14.4828 11.0553 447 C 24.8232 14.9150 12.0693 448 C 27.4604 14.1820 12.6171 449 C 26.6335 14.5741 13.6733 450 C 25.3452 14.9930 13.3613 451 S 24.3094 15.6346 14.6612 452 O 5.6085 8.3764 14.7028 453 C 5.4671 9.4855 15.4911 454 O 4.3526 10.0553 15.5950 455 C 6.6264 10.0336 16.2401 456 C 7.8734 9.5106 16.0382 457 C 8.9686 10.0266 16.7232 458 C 6.4234 11.0935 17.0822 459 C 7.4756 11.6025 17.8344 460 C 8.7484 11.0726 17.6164 461 S 10.1074 11.6968 18.5833 462 O 19.3551 2.8098 15.1553 463 C 20.2372 3.5734 14.6903 464 O 21.5297 3.1507 14.5414 465 C 19.8744 4.9648 14.3193 466 C 18.5533 5.3103 14.2792 467 C 18.1895 6.6094 13.9441 468 C 20.8715 5.8537 14.0313 469 C 20.5533 7.1568 13.6643 470 C 19.2066 7.5128 13.6500 471 S 18.7623 9.1790 13.2102 472 O 27.4085 23.7706 10.1046 473 C 27.3994 23.5430 11.3397 474 O 28.1309 24.3205 12.1952 475 C 26.6193 22.3981 11.8743 476 C 25.9544 21.5830 11.0082 477 C 25.1855 20.5289 11.4902 478 C 26.5603 22.2183 13.2274 479 C 25.8505 21.1432 13.7562 480 C 25.1994 20.2962 12.8650 481 S 24.3074 18.8948 13.5082 482 O 8.2629 7.3641 13.4437 483 C 9.3390 6.5429 13.2461 484 O 9.2035 5.4513 12.6398 485 C 10.7035 7.0026 13.6093 486 C 10.8886 8.2848 14.0431 487 C 12.1664 8.7205 14.3954 488 C 11.7343 6.1056 13.5554 489 C 13.0294 6.5023 13.8701 490 C 13.2223 7.8165 14.2910 491 S 14.8893 8.3878 14.5594 492 Au 15.0053 16.3048 11.3923 493 Au 16.7695 16.3368 17.0244 494 Au 17.3194 18.7650 18.4314 495 Au 19.4784 16.9738 17.7822 496 Au 18.5356 14.2966 18.0741 497 Au 15.7996 14.4246 18.8984 498 Au 17.6114 17.2019 12.1194 499 Au 18.5275 17.0797 14.9674 500 Au 17.6793 14.3577 15.2393 501 Au 19.4396 18.4492 20.2343 502 Au 12.3072 15.4729 11.3283 503 Au 17.9995 13.6538 20.6842 504 Au 17.2424 15.5887 9.8091 505 Au 16.4904 18.5027 21.1772 506 Au 19.0485 19.5702 16.3512 507 Au 20.4025 15.1058 15.9114 508 Au 15.8942 12.2390 14.1874 509 Au 19.5113 15.1739 13.0834 510 Au 18.0995 19.5981 13.5361 511 Au 14.1894 21.0548 9.5972 512 Au 22.5355 17.5358 20.3683 513 Au 20.9878 12.4787 20.8821 514 Au 17.1524 12.8027 8.6093 515 Au 18.4232 18.1362 8.2230 516 Au 15.8864 21.2398 14.3243 517 Au 21.1664 17.8517 15.6062 518 Au 19.4876 12.4327 16.1204 519 Au 18.6535 12.4560 13.4782 520 Au 20.2875 17.9070 12.9551 521 Au 18.9875 20.9460 18.7094 522 Au 21.1987 19.1059 18.1213 523 Au 22.2155 16.2216 17.6171 524 Au 21.2125 13.5020 18.1423 525 Au 18.8837 11.6054 18.7551 526 Au 16.7922 11.8475 11.4852 527 Au 19.0815 13.5968 10.9081 528 Au 19.7985 16.4980 10.5812 529 Au 18.9653 19.4149 10.9514 530 Au 16.2065 20.9303 19.7334 531 Au 14.0674 21.9350 16.3862 532 Au 20.8045 20.3061 14.3443 533 Au 22.0826 15.9651 13.7612 534 Au 21.3174 13.2448 14.0981 535 Au 17.7805 10.3780 15.2522 536 Au 23.4004 19.6522 15.5183 537 Au 20.6514 10.4478 13.1084 538 Au 13.0707 22.1438 19.1481 539 Au 23.5004 13.9057 15.8921 540 Au 17.2156 9.2546 18.7644 541 Au 22.9413 18.0140 11.8371 542 H 9.1139 22.5220 9.9959 543 H 9.8505 20.2153 10.6568 544 H 11.4184 22.3084 6.4104 545 H 12.2098 20.0047 7.0145 546 H 26.0700 13.3966 20.3880 547 H 23.6125 12.9360 20.5751 548 H 25.7264 16.6221 23.1593 549 H 23.2244 16.4008 23.1478 550 H 17.8022 14.9905 27.3652 551 H 17.4574 13.0677 25.8086 552 H 19.3232 17.3920 24.1839 553 H 19.0108 15.5005 22.5713 554 H 13.2545 12.8385 26.9604 555 H 15.1340 14.0308 25.8119 556 H 10.4137 15.4676 25.1598 557 H 12.2561 16.6678 23.9500 558 H 15.4768 23.2553 25.4080 559 H 16.6169 22.1942 23.4359 560 H 15.0308 19.4385 27.2655 561 H 16.3185 18.3457 25.4146 562 H 19.5417 26.9150 22.0712 563 H 20.2324 24.5182 22.2243 564 H 17.5818 26.1861 18.3518 565 H 18.3019 23.7801 18.4132 566 H 5.6807 18.8233 15.4720 567 H 7.3676 17.0824 14.8250 568 H 5.6043 20.3277 11.4758 569 H 7.1855 18.5300 10.7360 570 H 18.9622 9.0553 24.2754 571 H 20.1496 10.6462 22.7484 572 H 18.6876 6.1520 21.1616 573 H 19.8812 7.6879 19.5910 574 H 11.9294 8.5563 20.6646 575 H 13.1673 10.7363 20.6631 576 H 10.5539 9.2731 24.6415 577 H 11.7417 11.4829 24.6919 578 H 9.6446 18.7505 25.3256 579 H 12.0777 18.8259 24.7228 580 H 8.7322 21.5881 22.2676 581 H 11.1491 21.7069 21.6211 582 H 4.9262 11.9852 13.1577 583 H 6.9855 13.0336 14.1263 584 H 7.2994 9.2059 10.9586 585 H 9.4015 10.1772 11.9348 586 H 8.3193 24.7245 11.7909 587 H 7.9158 22.2956 12.2130 588 H 11.9268 24.5899 14.0569 589 H 11.6019 22.1395 14.4875 590 H 14.1309 8.2252 24.6869 591 H 15.6030 9.9052 23.5683 592 H 14.1712 5.7645 21.2021 593 H 15.5237 7.4827 19.9758 594 H 9.7442 12.6321 22.3667 595 H 10.8376 14.4541 21.0305 596 H 7.4001 15.5120 24.4674 597 H 8.4468 17.3733 23.1727 598 H 16.4904 25.6240 23.6973 599 H 16.9344 24.3870 21.5727 600 H 12.3436 24.6614 23.4664 601 H 12.7174 23.4223 21.3208 602 H 17.4382 27.0379 11.7539 603 H 16.9696 25.9386 13.9558 604 H 21.5473 25.9189 12.0031 605 H 21.1202 24.6960 14.1496 606 H 8.5608 24.2877 15.6553 607 H 10.0681 22.3915 16.2810 608 H 8.1572 25.3916 19.7563 609 H 9.7417 23.5673 20.4407 610 H 7.3564 14.4411 21.2681 611 H 8.8907 15.1836 19.4293 612 H 4.1635 13.9321 18.4841 613 H 5.6856 14.5522 16.5805 614 H 24.6627 8.6826 15.9548 615 H 22.6992 9.6226 14.7248 616 H 27.2453 11.5423 14.1260 617 H 25.3618 12.3934 12.7160 618 H 14.8895 4.5665 16.7793 619 H 15.5356 6.9119 17.3772 620 H 10.7540 5.5405 17.2003 621 H 11.3399 7.8771 17.8934 622 H 6.6476 21.7584 21.3600 623 H 8.0820 19.9047 20.4748 624 H 5.6022 22.9193 17.3939 625 H 6.8668 20.9704 16.4531 626 H 22.6368 8.9687 17.1756 627 H 20.3380 9.7447 16.5454 628 H 21.1345 5.0687 18.0271 629 H 18.8034 5.8050 17.4998 630 H 23.5593 22.5220 21.2938 631 H 22.8227 20.2153 20.6328 632 H 21.2548 22.3084 24.8793 633 H 20.4634 20.0047 24.2752 634 H 6.6032 13.3966 10.9017 635 H 9.0607 12.9360 10.7146 636 H 6.9468 16.6221 8.1303 637 H 9.4488 16.4008 8.1419 638 H 14.8710 14.9905 3.9245 639 H 15.2157 13.0677 5.4810 640 H 13.3499 17.3920 7.1057 641 H 13.6623 15.5005 8.7183 642 H 19.4187 12.8385 4.3293 643 H 17.5392 14.0308 5.4778 644 H 22.2595 15.4676 6.1299 645 H 20.4171 16.6678 7.3397 646 H 17.1964 23.2553 5.8817 647 H 16.0563 22.1942 7.8537 648 H 17.6424 19.4385 4.0241 649 H 16.3547 18.3457 5.8751 650 H 13.1315 26.9150 9.2184 651 H 12.4408 24.5182 9.0653 652 H 15.0914 26.1861 12.9379 653 H 14.3713 23.7801 12.8764 654 H 26.9925 18.8233 15.8177 655 H 25.3056 17.0824 16.4646 656 H 27.0688 20.3277 19.8139 657 H 25.4877 18.5300 20.5537 658 H 13.7110 9.0553 7.0142 659 H 12.5235 10.6462 8.5413 660 H 13.9856 6.1520 10.1281 661 H 12.7920 7.6879 11.6987 662 H 20.7438 8.5564 10.6251 663 H 19.5059 10.7363 10.6266 664 H 22.1192 9.2731 6.6482 665 H 20.9314 11.4829 6.5977 666 H 23.0286 18.7505 5.9640 667 H 20.5954 18.8259 6.5669 668 H 23.9410 21.5881 9.0221 669 H 21.5241 21.7069 9.6685 670 H 27.7470 11.9852 18.1319 671 H 25.6877 13.0336 17.1634 672 H 25.3738 9.2059 20.3311 673 H 23.2716 10.1772 19.3548 674 H 24.3538 24.7245 19.4988 675 H 24.7574 22.2956 19.0767 676 H 20.7464 24.5899 17.2327 677 H 21.0713 22.1395 16.8022 678 H 18.5423 8.2252 6.6027 679 H 17.0702 9.9052 7.7214 680 H 18.5020 5.7645 10.0875 681 H 17.1495 7.4827 11.3139 682 H 22.9290 12.6321 8.9230 683 H 21.8356 14.4541 10.2591 684 H 25.2731 15.5120 6.8223 685 H 24.2264 17.3733 8.1170 686 H 16.1828 25.6240 7.5924 687 H 15.7388 24.3870 9.7170 688 H 20.3296 24.6614 7.8233 689 H 19.9557 23.4223 9.9689 690 H 15.2350 27.0379 19.5357 691 H 15.7036 25.9386 17.3338 692 H 11.1258 25.9189 19.2866 693 H 11.5530 24.6960 17.1401 694 H 24.1124 24.2877 15.6344 695 H 22.6050 22.3915 15.0086 696 H 24.5160 25.3916 11.5334 697 H 22.9315 23.5673 10.8489 698 H 25.3168 14.4411 10.0215 699 H 23.7825 15.1836 11.8603 700 H 28.5097 13.9321 12.8056 701 H 26.9876 14.5522 14.7092 702 H 8.0105 8.6826 15.3349 703 H 9.9739 9.6226 16.5649 704 H 5.4279 11.5423 17.1637 705 H 7.3114 12.3934 18.5737 706 H 17.7836 4.5665 14.5104 707 H 17.1376 6.9119 13.9125 708 H 21.9191 5.5405 14.0893 709 H 21.3333 7.8771 13.3963 710 H 26.0255 21.7584 9.9296 711 H 24.5911 19.9047 10.8148 712 H 27.0710 22.9193 13.8958 713 H 25.8064 20.9704 14.8365 714 H 10.0364 8.9687 14.1141 715 H 12.3352 9.7447 14.7443 716 H 11.5386 5.0687 13.2626 717 H 13.8698 5.8050 13.7899 718 H 8.8058 25.4273 8.2171 719 H 28.9655 16.3170 22.1743 720 H 19.3030 19.1904 27.0579 721 H 10.1009 12.0294 28.0074 722 H 13.4508 21.7860 29.0982 723 H 18.0960 29.7795 20.9877 724 H 3.5997 21.5247 15.2763 725 H 17.1857 4.9556 23.9781 726 H 10.0873 5.8777 21.7743 727 H 5.8967 20.8056 24.0481 728 H 2.9266 10.0811 11.1426 729 H 11.3903 27.7973 12.7604 730 H 12.2353 4.3134 23.6774 731 H 6.6471 12.4283 25.6066 732 H 14.8513 26.8220 26.4746 733 H 19.1579 28.3311 9.0794 734 H 6.4138 27.5720 17.7861 735 H 4.6229 13.2717 22.8901 736 H 27.9338 8.1800 16.9876 737 H 11.1144 2.2205 16.4509 738 H 4.6977 24.5740 21.4389 739 H 24.4400 5.2420 18.8581 740 H 22.7136 25.3502 24.6474 741 H 3.5571 14.9853 10.5262 742 H 13.3701 19.1904 4.2318 743 H 22.5722 12.0294 3.2822 744 H 18.8617 23.5737 2.9139 745 H 15.4922 29.4869 11.9888 746 H 29.0734 21.5247 16.0133 747 H 15.4875 4.9556 7.3116 748 H 22.5859 5.8777 9.5154 749 H 26.3648 19.3652 5.9954 750 H 28.6687 8.7149 21.0278 751 H 21.2829 27.7973 18.5292 752 H 20.3330 5.4193 6.0168 753 H 24.9353 11.0806 6.5665 754 H 19.7214 26.4843 4.9846 755 H 11.6575 27.7770 22.1176 756 H 26.0549 27.0924 15.3738 757 H 28.0503 13.2717 8.3996 758 H 4.7394 8.1800 14.3020 759 H 21.5588 2.2205 14.8388 760 H 28.5657 25.0069 11.6527 761 H 7.4695 6.8861 13.1328 .------------------------------------------------------------------------------. /| | / | | / | | / | | / | | / | | / | | / | | / | | / | H H | / | O O O | / | OC C | / | C H H | / | H C C OH H O | / | H C C O HOHH C | / | O H O C CHC C O | / | H O H C C C H CC H CHCH CHCC C | / | HO O O CC HC H C CH OC | / | H H HH CHCC C H C HCC SC HuC C C C H O | * | HO OC HHO C CSu HC S CO C H H | | | CCC C C S C C S HH C C | | | O CCH CCHS C Au C AuuH H H CC CC H OH H | | H O HC H C C SSAuH AuAu S AuS Cu C C CC H O | | | H CCHC AHCC H H O H C C O | | O C C O H CAC AuS CuuH Au AuH C S C CH O C | | | C OHHSC C C Au H C COHH Au C H H HC CO O H | | | CO C H Cu C AuC HOuu C H AuuC Au HC CCC | | H| C HC OAu CCH Au HCAuCCu S HAu C CHHAu HOCHHO H | | | C H HO S CCC AuC Au H COCu AHuC CC CC CHC C OH | | | HO CC H H Au H AH AuAuC H Auu AuAuSH C O CH C | | |H C CC Su AuAu Au S Au SHS C C | | | CCC AuH Au Au S Au AuAu C Hu Au CH C O | | | C C H C HC Au Au H S CAuC CC OC HO Au CHHC H | | O C| C H SSC C C HAu AuuHu C HC AuuAuC HC COC O | | H H H CAHCC O Au AuuAu H CCCHC CCHH C H | | H O| C C H C HAS H Auu SCS H C C | | H O H O CC C CH S SuC Au H C O | | O |CC OCCCHHCC OC HAuuH Cu C CCAH C C HH C C O | | H C .--HC--CH---CCH-SAH----HH-----O-C--O-------H----CC-----------------------------. | O/ H O H H C S HS HS OH HC HC OOHH / | / C S H Au CCH CCH C H / | / C C C H O C H C / | / H CC HH C CO O O / | / C H H C HC H / | / H H C HO C O / | / O HO H / | / H O O H / | / H / | / / | / / | / / | / / | / / | / / | / / | / / | / / |/ / *------------------------------------------------------------------------------* Unit Cell: Periodic X Y Z Points Spacing -------------------------------------------------------------------- 1. axis: yes 32.000000 0.000000 0.000000 240 0.1333 2. axis: yes 0.000000 32.000000 0.000000 240 0.1333 3. axis: yes 0.000000 0.000000 32.000000 240 0.1333 Grid-points per volume: 421.87 Effective grid-spacing: 0.1333 O-setup: name : Oxygen id : 5f3f27ba17355653aa2069308cb75aea Z : 8 valence: 6 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/O.LDA.gz cutoffs: 0.74(comp), 1.30(filt), 0.83(core), lmax=2 valence states: energy radius 2s(2) -23.752 0.741 2p(4) -9.195 0.741 *s 3.459 0.741 *p 18.016 0.741 *d 0.000 0.741 Using partial waves for O as LCAO basis S-setup: name : Sulfur id : 16df0b8f883bfd770ab5c435bc804428 Z : 16 valence: 6 core : 10 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/S.LDA.gz cutoffs: 0.85(comp), 1.49(filt), 1.66(core), lmax=2 valence states: energy radius 3s(2) -17.278 0.847 3p(4) -7.106 0.847 *s 9.933 0.847 *p 20.105 0.847 *d 0.000 0.847 Using partial waves for S as LCAO basis C-setup: name : Carbon id : d60576a1f549371a163e72552ca58787 Z : 6 valence: 4 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/C.LDA.gz cutoffs: 0.64(comp), 1.14(filt), 1.14(core), lmax=2 valence states: energy radius 2s(2) -13.639 0.635 2p(2) -5.414 0.635 *s 13.573 0.635 *p 21.797 0.635 *d 0.000 0.635 Using partial waves for C as LCAO basis H-setup: name : Hydrogen id : 4766778ce56282eaa64abeb28b7c1de3 Z : 1 valence: 1 core : 0 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/H.LDA.gz cutoffs: 0.48(comp), 0.85(filt), 0.53(core), lmax=2 valence states: energy radius 1s(1) -6.353 0.476 *s 20.858 0.476 *p 0.000 0.476 Using partial waves for H as LCAO basis Au-setup: name : Gold id : a44207148b704df7bec07bf25e8feca8 Z : 79 valence: 11 core : 68 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/Au.LDA.gz cutoffs: 1.32(comp), 2.33(filt), 2.81(core), lmax=2 valence states: energy radius 6s(1) -6.048 1.323 6p(0) -0.888 1.323 5d(10) -7.129 1.323 *s 21.163 1.323 *p 26.323 1.323 *d 20.082 1.323 Using partial waves for Au as LCAO basis Using the LDA Exchange-Correlation Functional. Spin-Paired Calculation Total Charge: 0.000000 Fermi Temperature: 0.100000 Mode: fd Eigen Solver: (3 nearest neighbors central finite-difference stencil) Diagonalizer: ScaLapack - grid: [nprow, npcol, nb] = [5, 5, 64] Inverse Cholesky: Lapack Poisson Solver: Jacobi (Mehrstellen finite-difference stencil) Interpolation: 6th Order Reference Energy: -53635200.580024 Gamma Point Calculation Total number of cores used: 4096 Using Domain Decomposition: 4 x 8 x 16 Parallelization Over bands on 8 Processors 1 k-point in the Irreducible Part of the Brillouin Zone (total: 1) Linear Mixing Parameter: 0.1 Pulay Mixing with 5 Old Densities Damping of Long Wave Oscillations: 100 Convergence Criteria: Total Energy Change per Atom: 0.001 eV / atom Integral of Absolute Density Change: 0.0001 electrons Integral of Absolute Eigenstate Change: 1e-09 Number of Bands in Calculation: 1728 Bands to Converge: Occupied States Only Number of Valence Electrons: 3366 log10-error: Total Iterations: Time WFS Density Energy Fermi Poisson iter: 1 17:55:51 +0.3 -4415.56673 3 105 iter: 2 17:58:12 -0.4 -5514.20755 5 iter: 3 18:00:33 -0.7 -5682.62208 4 iter: 4 18:03:37 +0.0 -0.9 -3933.90570 7 101 iter: 5 18:06:41 +0.0 -0.9 -3593.83801 15 93 iter: 6 18:09:43 +0.3 -1.0 -3028.82668 24 95 iter: 7 18:12:46 +0.4 -1.1 -2921.02831 26 94 iter: 8 18:15:45 +0.5 -1.1 -2940.70606 9 87 iter: 9 18:18:40 +0.4 -1.2 -3094.01547 12 80 iter: 10 18:21:36 +0.4 -1.3 -3432.21825 6 78 iter: 11 18:24:30 +0.3 -1.3 -3637.38850 3 75 iter: 12 18:27:23 +0.2 -1.3 -4192.08640 7 70 iter: 13 18:30:15 +0.2 -1.2 -4307.12410 5 64 iter: 14 18:33:04 +0.1 -1.2 -4761.82594 3 60 iter: 15 18:36:00 +0.1 -1.2 -4388.02660 7 82 iter: 16 18:38:57 -0.1 -1.1 -4787.18221 7 79 iter: 17 18:41:53 -0.1 -1.1 -4644.09502 8 82 iter: 18 18:44:52 -0.0 -1.1 -5683.63590 15 90 iter: 19 18:47:47 -0.0 -1.1 -5192.80257 4 79 iter: 20 18:50:51 -0.2 -1.0 -4643.91388 17 95 Memory usage: 980.27 MB ============================================================ Timing: incl. excl. ============================================================ Initialization: 214.671 26.264 0.7% | Hamiltonian: 43.972 0.001 0.0% | Atomic: 0.000 0.000 0.0% | Communicate energies: 2.405 2.405 0.1% | Hartree integrate/restrict: 0.037 0.037 0.0% | Initialize Hamiltonian: 0.038 0.038 0.0% | Poisson: 40.576 40.576 1.1% | XC 3D grid: 0.910 0.910 0.0% | vbar: 0.006 0.006 0.0% | LCAO initialization: 144.435 8.211 0.2% | LCAO eigensolver: 20.053 0.014 0.0% | Atomic Hamiltonian: 0.000 0.000 0.0% | Blacs Orbital Layouts: 13.197 0.002 0.0% | General diagonalize: 13.060 13.060 0.3% | Redistribute coefs: 0.125 0.125 0.0% | Send coefs to domains: 0.010 0.010 0.0% | Calculate projections: 0.000 0.000 0.0% | Distribute overlap matrix: 6.834 1.064 0.0% | Distribute overlap matrix: 5.770 5.770 0.2% | Potential matrix: 0.008 0.008 0.0% | LCAO to grid: 0.038 0.038 0.0% | Set positions (LCAO WFS): 116.133 7.441 0.2% | Basic WFS set positions: 0.002 0.002 0.0% | Basis functions set positions: 0.134 0.134 0.0% | Distribute overlap matrix: 1.404 1.404 0.0% | TCI: Calculate S, T, P: 107.153 107.153 2.8% || SCF-cycle: 3553.883 214.291 5.7% |-| Density: 6.943 0.004 0.0% | Atomic density matrices: 0.002 0.002 0.0% | Mix: 1.268 1.268 0.0% | Multipole moments: 2.322 2.322 0.1% | Pseudo density: 3.347 3.347 0.1% | Hamiltonian: 639.934 0.010 0.0% | Atomic: 0.003 0.003 0.0% | Communicate energies: 43.344 43.344 1.2% | Hartree integrate/restrict: 0.661 0.661 0.0% | Poisson: 579.460 579.460 15.4% |-----| XC 3D grid: 16.346 16.346 0.4% | vbar: 0.111 0.111 0.0% | Orthonormalize: 704.260 0.010 0.0% | Blacs Band Layouts: 7.733 0.002 0.0% | Inverse Cholesky: 7.732 7.732 0.2% | calc_matrix: 466.524 466.524 12.4% |----| rotate_psi: 229.993 229.993 6.1% |-| RMM-DIIS: 1359.575 586.224 15.6% |-----| precondition: 773.351 773.351 20.5% |-------| Subspace diag: 628.880 0.008 0.0% | Blacs Band Layouts: 74.455 0.004 0.0% | Diagonalize: 74.443 74.443 2.0% || Distribute results: 0.008 0.008 0.0% | calc_matrix: 327.276 327.276 8.7% |--| rotate_psi: 227.141 227.141 6.0% |-| Other: 0.301 0.301 0.0% | ============================================================ Total: 3768.855 100.0% ============================================================ date: Tue Apr 6 18:51:30 2010 Au_cluster.txt_domain_8x8x8x4000066400000000000000000001270451316441372200314710ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster ___ ___ ___ _ _ _ | | |_ | | | | | | | | | . | | | | |__ | _|___|_____| 0.7 |___|_| User: ???@ion-R46-9 Date: Wed Mar 31 10:25:55 2010 Arch: BGP Pid: 100 Dir: /gpaw/lib/python2.6/site-packages/gpaw ase: /gpaw/lib/python2.6/site-packages/ase version: 3.3.1 numpy: /gpaw/lib/python2.6/site-packages/numpy units: Angstrom and eV Extra parameters: {'blacs': 1} **NOTE**: please start using occupations=FermiDirac(width). Memory estimate --------------- Calculator 531.69 MiB Initial overhead 375.15 MiB Density 19.14 MiB Arrays 5.36 MiB Localized functions 6.17 MiB Mixer 2.06 MiB Interpolator 5.56 MiB Hamiltonian 24.61 MiB Arrays 3.50 MiB Restrictor 3.60 MiB XC 3D grid 1.65 MiB Poisson 15.40 MiB vbar 0.47 MiB Wavefunctions 112.79 MiB Arrays psit_nG 88.99 MiB Eigensolver 1.04 MiB Projectors 0.90 MiB Overlap op 21.50 MiB Kinetic operator 0.36 MiB Positions: 0 O 8.9496 24.5522 8.6269 1 C 9.8369 23.8824 7.8297 2 O 10.3147 24.4127 6.7962 3 C 10.2586 22.5069 8.1973 4 C 9.7956 21.9548 9.3535 5 C 10.1886 20.6691 9.7194 6 C 11.0905 21.8361 7.3423 7 C 11.5174 20.5522 7.6624 8 C 11.0266 19.9861 8.8472 9 S 11.5885 18.3508 9.2813 10 O 28.1333 14.7301 20.7426 11 C 27.4474 15.3375 21.6018 12 O 28.0125 16.3029 22.3892 13 C 25.9869 15.0849 21.6935 14 C 25.4359 14.0366 21.0104 15 C 24.0669 13.7800 21.1043 16 C 25.2389 15.8691 22.5314 17 C 23.8539 15.7056 22.5825 18 C 23.2969 14.6329 21.8936 19 S 21.5139 14.4397 21.9176 20 O 18.3160 17.3324 27.9612 21 C 18.7254 17.4155 26.7768 22 O 19.2643 18.5780 26.2976 23 C 18.5259 16.2810 25.8396 24 C 18.0389 15.0989 26.3016 25 C 17.8379 14.0267 25.4416 26 C 18.8919 16.4439 24.5216 27 C 18.7110 15.3967 23.6194 28 C 18.1409 14.2187 24.0835 29 S 17.8458 12.8725 22.9494 30 O 10.9413 12.3160 27.5998 31 C 10.6709 13.4464 26.8783 32 O 9.5007 13.8962 26.8030 33 C 11.7619 14.1215 26.1305 34 C 13.0471 13.6858 26.2984 35 C 14.0929 14.3170 25.6295 36 C 11.4548 15.1530 25.2865 37 C 12.4740 15.8039 24.5866 38 C 13.7730 15.3246 24.7206 39 S 15.1059 16.1757 23.8766 40 O 14.3510 23.2593 27.5755 41 C 14.4611 22.0092 27.5230 42 O 13.8989 21.1920 28.4650 43 C 15.2230 21.3887 26.4095 44 C 15.6558 22.1753 25.3855 45 C 16.3278 21.5993 24.3086 46 C 15.4270 20.0367 26.4385 47 C 16.1389 19.4259 25.4144 48 C 16.6179 20.2392 24.3836 49 S 17.5699 19.4916 23.0916 50 O 18.4673 28.9006 21.1980 51 C 18.0899 28.0627 20.1847 52 O 17.4109 28.4998 19.2227 53 C 18.5108 26.6390 20.2204 54 C 19.2527 26.2080 21.2866 55 C 19.6400 24.8798 21.3773 56 C 18.1617 25.8042 19.1985 57 C 18.5459 24.4610 19.2353 58 C 19.2469 24.0188 20.3483 59 S 19.8728 22.3550 20.3833 60 O 4.2414 20.7900 15.2209 61 C 4.6011 20.6819 13.9054 62 O 4.1339 21.4606 13.0378 63 C 5.5798 19.6412 13.5003 64 C 6.0428 18.7621 14.4404 65 C 6.9748 17.7889 14.0863 66 C 5.9855 19.5958 12.1955 67 C 6.8846 18.6161 11.7853 68 C 7.3897 17.7487 12.7504 69 S 8.5597 16.4991 12.2516 70 O 17.6672 7.0448 24.8204 71 C 18.0098 6.6418 23.6811 72 O 17.6399 5.4019 23.2371 73 C 18.7169 7.5728 22.7654 74 C 19.1450 8.7805 23.2313 75 C 19.8129 9.6676 22.3906 76 C 18.9917 7.1516 21.4895 77 C 19.6580 8.0009 20.6163 78 C 20.0359 9.2610 21.0754 79 S 20.6879 10.4385 19.9024 80 O 10.5943 6.6875 21.5703 81 C 10.5284 7.5054 22.6648 82 O 9.8824 7.1683 23.6878 83 C 11.2079 8.8258 22.6575 84 C 11.9027 9.2075 21.5445 85 C 12.5768 10.4257 21.5313 86 C 11.1279 9.6118 23.7727 87 C 11.7769 10.8439 23.8034 88 C 12.4750 11.2337 22.6565 89 S 13.1910 12.8649 22.6104 90 O 7.3001 19.2989 25.0933 91 C 7.6688 20.1334 24.2300 92 O 6.7696 20.9836 23.6470 93 C 9.0959 20.1630 23.8205 94 C 9.9900 19.3858 24.5033 95 C 11.3368 19.3997 24.1564 96 C 9.4760 20.9769 22.7894 97 C 10.8109 21.0240 22.4074 98 C 11.7049 20.1770 23.0545 99 S 13.4190 20.2217 22.5753 100 O 3.5939 10.5821 11.6508 101 C 4.8082 10.0108 11.3849 102 O 4.9004 9.0031 10.6409 103 C 6.0326 10.5560 12.0243 104 C 5.9166 11.5956 12.9004 105 C 7.0536 12.1616 13.4675 106 C 7.2455 10.0336 11.6735 107 C 8.4167 10.5560 12.2273 108 C 8.2845 11.5769 13.1655 109 S 9.7177 12.0755 14.0945 110 O 9.4876 26.7892 11.9048 111 C 10.3502 26.1941 12.5972 112 O 11.4520 26.8664 13.0505 113 C 10.1597 24.7483 12.8776 114 C 9.0376 24.1422 12.3773 115 C 8.8067 22.7931 12.6103 116 C 11.0588 24.0683 13.6404 117 C 10.8766 22.7052 13.8934 118 C 9.7467 22.0909 13.3674 119 S 9.4997 20.3381 13.5932 120 O 12.9263 6.1540 24.8934 121 C 13.2034 5.9605 23.6837 122 O 12.7786 4.8261 23.0479 123 C 14.0638 6.9456 22.9805 124 C 14.4549 8.0696 23.6526 125 C 15.2591 9.0138 23.0334 126 C 14.4588 6.6984 21.6964 127 C 15.2299 7.6414 21.0186 128 C 15.6149 8.7857 21.7003 129 S 16.7168 9.9509 20.9246 130 O 8.2575 11.7304 24.1396 131 C 7.8999 12.9261 24.2804 132 O 6.9545 13.2660 25.2089 133 C 8.5690 14.0017 23.5054 134 C 9.4860 13.6805 22.5485 135 C 10.0958 14.6911 21.8004 136 C 8.1741 15.2967 23.7233 137 C 8.7491 16.3339 23.0073 138 C 9.7320 16.0046 22.0633 139 S 10.7009 17.3328 21.3884 140 O 15.2152 26.4013 25.6714 141 C 14.1630 25.8819 24.9681 142 O 12.9970 25.9802 25.4243 143 C 14.4008 25.1684 23.6876 144 C 15.6719 25.1172 23.1756 145 C 15.9259 24.4249 21.9976 146 C 13.3518 24.5820 23.0466 147 C 13.5557 23.8798 21.8565 148 C 14.8579 23.7791 21.3716 149 S 15.1229 23.0473 19.7573 150 O 18.7761 27.9232 9.8809 151 C 19.7890 27.2717 10.5298 152 O 20.9438 27.2492 10.0363 153 C 19.5156 26.5413 11.7935 154 C 18.2447 26.5401 12.3023 155 C 17.9716 25.9084 13.5153 156 C 20.5406 25.9002 12.4334 157 C 20.3108 25.2219 13.6325 158 C 19.0167 25.2370 14.1485 159 S 18.6496 24.2213 15.5673 160 O 7.2160 26.2855 16.0714 161 C 7.4678 26.0761 17.2839 162 O 6.9422 26.8922 18.2478 163 C 8.3278 24.9322 17.6804 164 C 8.8177 24.1090 16.7046 165 C 9.6417 23.0461 17.0483 166 C 8.6026 24.7350 19.0016 167 C 9.4497 23.6989 19.3936 168 C 9.9096 22.8379 18.3996 169 S 10.8866 21.4260 18.8655 170 O 5.3392 13.6178 22.3230 171 C 4.8488 13.6274 21.0460 172 O 3.6752 13.2502 20.8054 173 C 5.7168 14.1110 19.9424 174 C 6.9978 14.4828 20.2343 175 C 7.8500 14.9150 19.2203 176 C 5.2128 14.1820 18.6726 177 C 6.0397 14.5741 17.6164 178 C 7.3279 14.9930 17.9283 179 S 8.3638 15.6346 16.6285 180 O 27.0647 8.3764 16.5869 181 C 27.2060 9.4855 15.7986 182 O 28.3205 10.0553 15.6947 183 C 26.0468 10.0336 15.0496 184 C 24.7997 9.5106 15.2514 185 C 23.7046 10.0266 14.5665 186 C 26.2498 11.0935 14.2074 187 C 25.1976 11.6025 13.4553 188 C 23.9248 11.0726 13.6733 189 S 22.5658 11.6968 12.7064 190 O 13.3181 2.8098 16.1343 191 C 12.4360 3.5734 16.5994 192 O 11.1434 3.1507 16.7482 193 C 12.7987 4.9648 16.9704 194 C 14.1199 5.3103 17.0104 195 C 14.4837 6.6094 17.3456 196 C 11.8017 5.8537 17.2584 197 C 12.1199 7.1568 17.6253 198 C 13.4666 7.5128 17.6396 199 S 13.9109 9.1790 18.0795 200 O 5.2639 23.7908 21.2952 201 C 5.2738 23.5430 19.9499 202 O 4.6021 24.2569 19.1645 203 C 6.0539 22.3981 19.4154 204 C 6.7188 21.5830 20.2815 205 C 7.4877 20.5289 19.7995 206 C 6.1129 22.2183 18.0623 207 C 6.8226 21.1432 17.5335 208 C 7.4738 20.2962 18.4246 209 S 8.3658 18.8948 17.7815 210 O 24.3222 7.2969 17.8622 211 C 23.3342 6.5429 18.0436 212 O 23.4817 5.3540 18.7040 213 C 21.9697 7.0026 17.6804 214 C 21.7846 8.2848 17.2466 215 C 20.5067 8.7205 16.8943 216 C 20.9389 6.1056 17.7343 217 C 19.6438 6.5023 17.4195 218 C 19.4508 7.8165 16.9986 219 S 17.7839 8.3878 16.7303 220 Au 17.6679 16.3048 19.8974 221 Au 15.9037 16.3368 14.2653 222 Au 15.3538 18.7650 12.8583 223 Au 13.1948 16.9738 13.5075 224 Au 14.1376 14.2966 13.2156 225 Au 16.8736 14.4246 12.3913 226 Au 15.0618 17.2019 19.1703 227 Au 16.3367 18.7749 15.6445 228 Au 14.1457 17.0797 16.3223 229 Au 14.9939 14.3577 16.0504 230 Au 13.2335 18.4492 11.0553 231 Au 20.3660 15.4729 19.9614 232 Au 14.6737 13.6538 10.6055 233 Au 15.4308 15.5887 21.4806 234 Au 16.1827 18.5027 10.1124 235 Au 13.6247 19.5702 14.9385 236 Au 12.2707 15.1058 15.3783 237 Au 16.7790 12.2390 17.1022 238 Au 13.1619 15.1739 18.2063 239 Au 14.5736 19.5981 17.7536 240 Au 18.4838 21.0548 21.6925 241 Au 10.1377 17.5358 10.9213 242 Au 11.6854 12.4787 10.4076 243 Au 15.5208 12.8027 22.6804 244 Au 14.2499 18.1362 23.0666 245 Au 16.7868 21.2398 16.9654 246 Au 11.5068 17.8517 15.6834 247 Au 13.1856 12.4327 15.1693 248 Au 14.0196 12.4560 17.8115 249 Au 12.3857 17.9070 18.3346 250 Au 13.6857 20.9460 12.5803 251 Au 11.4745 19.1059 13.1684 252 Au 10.4577 16.2216 13.6725 253 Au 11.4607 13.5020 13.1473 254 Au 13.7895 11.6054 12.5345 255 Au 15.8809 11.8475 19.8045 256 Au 13.5916 13.5968 20.3815 257 Au 12.8747 16.4980 20.7085 258 Au 13.7079 19.4149 20.3383 259 Au 16.4667 20.9303 11.5563 260 Au 18.6058 21.9350 14.9034 261 Au 11.8686 20.3061 16.9454 262 Au 10.5906 15.9651 17.5285 263 Au 11.3558 13.2448 17.1916 264 Au 14.8927 10.3780 16.0375 265 Au 16.3367 23.9560 15.6445 266 Au 9.2728 19.6522 15.7713 267 Au 12.0218 10.4478 18.1813 268 Au 19.6025 22.1438 12.1415 269 Au 9.1728 13.9057 15.3976 270 Au 15.4576 9.2546 12.5253 271 Au 9.7318 18.0140 19.4526 272 O 23.6510 24.4973 22.7280 273 C 22.8363 23.8824 23.4600 274 O 22.3158 24.4600 24.5856 275 C 22.4146 22.5069 23.0924 276 C 22.8776 21.9548 21.9361 277 C 22.4845 20.6691 21.5703 278 C 21.5827 21.8361 23.9474 279 C 21.1558 20.5522 23.6272 280 C 21.6466 19.9861 22.4424 281 S 21.0847 18.3508 22.0083 282 O 4.4787 14.6760 10.6237 283 C 5.2258 15.3375 9.6879 284 O 4.7069 16.2239 8.9649 285 C 6.6863 15.0849 9.5961 286 C 7.2373 14.0366 10.2793 287 C 8.6063 13.7800 10.1853 288 C 7.4342 15.8691 8.7583 289 C 8.8193 15.7056 8.7072 290 C 9.3762 14.6329 9.3960 291 S 11.1593 14.4397 9.3721 292 O 14.3572 17.3324 3.3284 293 C 13.9477 17.4155 4.5129 294 O 13.4089 18.5780 4.9921 295 C 14.1472 16.2810 5.4500 296 C 14.6342 15.0989 4.9880 297 C 14.8353 14.0267 5.8481 298 C 13.7812 16.4439 6.7681 299 C 13.9622 15.3967 7.6703 300 C 14.5323 14.2187 7.2062 301 S 14.8273 12.8725 8.3402 302 O 21.7319 12.3160 3.6899 303 C 22.0022 13.4464 4.4113 304 O 23.1725 13.8962 4.4867 305 C 20.9113 14.1215 5.1592 306 C 19.6261 13.6858 4.9913 307 C 18.5803 14.3170 5.6601 308 C 21.2184 15.1530 6.0031 309 C 20.1992 15.8039 6.7031 310 C 18.9002 15.3246 6.5691 311 S 17.5673 16.1757 7.4130 312 O 18.3320 23.3708 3.7094 313 C 18.2121 22.0092 3.7667 314 O 18.7283 21.2589 2.9018 315 C 17.4502 21.3887 4.8801 316 C 17.0173 22.1753 5.9042 317 C 16.3454 21.5993 6.9811 318 C 17.2462 20.0367 4.8512 319 C 16.5343 19.4259 5.8752 320 C 16.0553 20.2392 6.9060 321 S 15.1033 19.4916 8.1980 322 O 14.2368 28.8320 10.1746 323 C 14.5833 28.0627 11.1050 324 O 15.3228 28.5388 12.1528 325 C 14.1624 26.6390 11.0693 326 C 13.4204 26.2080 10.0031 327 C 13.0331 24.8798 9.9123 328 C 14.5115 25.8042 12.0911 329 C 14.1273 24.4610 12.0543 330 C 13.4262 24.0188 10.9414 331 S 12.8003 22.3550 10.9063 332 O 28.4318 20.7900 16.0688 333 C 28.0721 20.6819 17.3842 334 O 28.5393 21.4606 18.2519 335 C 27.0933 19.6412 17.7893 336 C 26.6304 18.7621 16.8493 337 C 25.6984 17.7889 17.2034 338 C 26.6876 19.5958 19.0942 339 C 25.7886 18.6161 19.5044 340 C 25.2835 17.7487 18.5393 341 S 24.1135 16.4991 19.0381 342 O 15.0059 7.0448 6.4693 343 C 14.6634 6.6418 7.6085 344 O 15.0332 5.4019 8.0526 345 C 13.9562 7.5728 8.5242 346 C 13.5282 8.7805 8.0583 347 C 12.8603 9.6676 8.8990 348 C 13.6815 7.1516 9.8001 349 C 13.0152 8.0009 10.6734 350 C 12.6373 9.2610 10.2143 351 S 11.9853 10.4385 11.3873 352 O 22.0789 6.6875 9.7194 353 C 22.1447 7.5054 8.6249 354 O 22.7908 7.1683 7.6019 355 C 21.4652 8.8258 8.6321 356 C 20.7704 9.2075 9.7451 357 C 20.0964 10.4257 9.7583 358 C 21.5453 9.6118 7.5170 359 C 20.8962 10.8439 7.4863 360 C 20.1982 11.2337 8.6332 361 S 19.4821 12.8649 8.6793 362 O 25.4059 19.2245 6.1194 363 C 25.0044 20.1334 7.0597 364 O 25.8300 20.9140 7.5950 365 C 23.5773 20.1630 7.4691 366 C 22.6832 19.3858 6.7863 367 C 21.3364 19.3997 7.1333 368 C 23.1972 20.9769 8.5003 369 C 21.8623 21.0240 8.8822 370 C 20.9683 20.1770 8.2352 371 S 19.2542 20.2217 8.7143 372 O 28.9798 10.5353 19.6607 373 C 27.8650 10.0108 19.9048 374 O 27.7646 8.9132 20.7151 375 C 26.6406 10.5560 19.2653 376 C 26.7565 11.5956 18.3892 377 C 25.6196 12.1616 17.8222 378 C 25.4276 10.0336 19.6162 379 C 24.2565 10.5560 19.0624 380 C 24.3887 11.5769 18.1241 381 S 22.9555 12.0755 17.1951 382 O 23.1855 26.7892 19.3849 383 C 22.3230 26.1941 18.6924 384 O 21.2211 26.8664 18.2392 385 C 22.5135 24.7483 18.4121 386 C 23.6355 24.1422 18.9123 387 C 23.8665 22.7931 18.6794 388 C 21.6144 24.0683 17.6493 389 C 21.7966 22.7052 17.3963 390 C 22.9265 22.0909 17.9222 391 S 23.1735 20.3381 17.6964 392 O 19.7716 6.1713 6.2884 393 C 19.4698 5.9605 7.6060 394 O 19.8598 4.9190 8.1897 395 C 18.6094 6.9456 8.3091 396 C 18.2183 8.0696 7.6371 397 C 17.4141 9.0138 8.2563 398 C 18.2144 6.6984 9.5933 399 C 17.4433 7.6414 10.2711 400 C 17.0583 8.7857 9.5893 401 S 15.9564 9.9509 10.3650 402 O 24.3838 11.6238 7.1626 403 C 24.7733 12.9261 7.0093 404 O 25.6413 13.2382 6.1568 405 C 24.1041 14.0017 7.7843 406 C 23.1872 13.6805 8.7411 407 C 22.5774 14.6911 9.4893 408 C 24.4991 15.2967 7.5663 409 C 23.9241 16.3339 8.2823 410 C 22.9412 16.0046 9.2263 411 S 21.9723 17.3328 9.9013 412 O 17.5441 26.3587 5.6759 413 C 18.5102 25.8819 6.3216 414 O 19.7802 25.9890 5.8246 415 C 18.2724 25.1684 7.6020 416 C 17.0013 25.1172 8.1141 417 C 16.7473 24.4249 9.2921 418 C 19.3214 24.5820 8.2430 419 C 19.1174 23.8798 9.4332 420 C 17.8153 23.7791 9.9181 421 S 17.5503 23.0473 11.5323 422 O 13.8141 27.8698 21.3557 423 C 12.8842 27.2717 20.7599 424 O 11.6264 27.2472 21.2973 425 C 13.1576 26.5413 19.4961 426 C 14.4284 26.5401 18.9874 427 C 14.7016 25.9084 17.7743 428 C 12.1325 25.9002 18.8562 429 C 12.3624 25.2219 17.6571 430 C 13.6564 25.2370 17.1412 431 S 14.0235 24.2213 15.7224 432 O 25.4796 26.3041 15.3264 433 C 25.2054 26.0761 14.0057 434 O 25.6880 26.8254 13.1207 435 C 24.3454 24.9322 13.6093 436 C 23.8555 24.1090 14.5851 437 C 23.0314 23.0461 14.2414 438 C 24.0705 24.7350 12.2880 439 C 23.2235 23.6989 11.8961 440 C 22.7636 22.8379 12.8901 441 S 21.7866 21.4260 12.4241 442 O 27.3340 13.6178 8.9666 443 C 27.8244 13.6274 10.2437 444 O 28.9980 13.2502 10.4843 445 C 26.9564 14.1110 11.3472 446 C 25.6753 14.4828 11.0553 447 C 24.8232 14.9150 12.0693 448 C 27.4604 14.1820 12.6171 449 C 26.6335 14.5741 13.6733 450 C 25.3452 14.9930 13.3613 451 S 24.3094 15.6346 14.6612 452 O 5.6085 8.3764 14.7028 453 C 5.4671 9.4855 15.4911 454 O 4.3526 10.0553 15.5950 455 C 6.6264 10.0336 16.2401 456 C 7.8734 9.5106 16.0382 457 C 8.9686 10.0266 16.7232 458 C 6.4234 11.0935 17.0822 459 C 7.4756 11.6025 17.8344 460 C 8.7484 11.0726 17.6164 461 S 10.1074 11.6968 18.5833 462 O 19.3551 2.8098 15.1553 463 C 20.2372 3.5734 14.6903 464 O 21.5297 3.1507 14.5414 465 C 19.8744 4.9648 14.3193 466 C 18.5533 5.3103 14.2792 467 C 18.1895 6.6094 13.9441 468 C 20.8715 5.8537 14.0313 469 C 20.5533 7.1568 13.6643 470 C 19.2066 7.5128 13.6500 471 S 18.7623 9.1790 13.2102 472 O 27.4085 23.7706 10.1046 473 C 27.3994 23.5430 11.3397 474 O 28.1309 24.3205 12.1952 475 C 26.6193 22.3981 11.8743 476 C 25.9544 21.5830 11.0082 477 C 25.1855 20.5289 11.4902 478 C 26.5603 22.2183 13.2274 479 C 25.8505 21.1432 13.7562 480 C 25.1994 20.2962 12.8650 481 S 24.3074 18.8948 13.5082 482 O 8.2629 7.3641 13.4437 483 C 9.3390 6.5429 13.2461 484 O 9.2035 5.4513 12.6398 485 C 10.7035 7.0026 13.6093 486 C 10.8886 8.2848 14.0431 487 C 12.1664 8.7205 14.3954 488 C 11.7343 6.1056 13.5554 489 C 13.0294 6.5023 13.8701 490 C 13.2223 7.8165 14.2910 491 S 14.8893 8.3878 14.5594 492 Au 15.0053 16.3048 11.3923 493 Au 16.7695 16.3368 17.0244 494 Au 17.3194 18.7650 18.4314 495 Au 19.4784 16.9738 17.7822 496 Au 18.5356 14.2966 18.0741 497 Au 15.7996 14.4246 18.8984 498 Au 17.6114 17.2019 12.1194 499 Au 18.5275 17.0797 14.9674 500 Au 17.6793 14.3577 15.2393 501 Au 19.4396 18.4492 20.2343 502 Au 12.3072 15.4729 11.3283 503 Au 17.9995 13.6538 20.6842 504 Au 17.2424 15.5887 9.8091 505 Au 16.4904 18.5027 21.1772 506 Au 19.0485 19.5702 16.3512 507 Au 20.4025 15.1058 15.9114 508 Au 15.8942 12.2390 14.1874 509 Au 19.5113 15.1739 13.0834 510 Au 18.0995 19.5981 13.5361 511 Au 14.1894 21.0548 9.5972 512 Au 22.5355 17.5358 20.3683 513 Au 20.9878 12.4787 20.8821 514 Au 17.1524 12.8027 8.6093 515 Au 18.4232 18.1362 8.2230 516 Au 15.8864 21.2398 14.3243 517 Au 21.1664 17.8517 15.6062 518 Au 19.4876 12.4327 16.1204 519 Au 18.6535 12.4560 13.4782 520 Au 20.2875 17.9070 12.9551 521 Au 18.9875 20.9460 18.7094 522 Au 21.1987 19.1059 18.1213 523 Au 22.2155 16.2216 17.6171 524 Au 21.2125 13.5020 18.1423 525 Au 18.8837 11.6054 18.7551 526 Au 16.7922 11.8475 11.4852 527 Au 19.0815 13.5968 10.9081 528 Au 19.7985 16.4980 10.5812 529 Au 18.9653 19.4149 10.9514 530 Au 16.2065 20.9303 19.7334 531 Au 14.0674 21.9350 16.3862 532 Au 20.8045 20.3061 14.3443 533 Au 22.0826 15.9651 13.7612 534 Au 21.3174 13.2448 14.0981 535 Au 17.7805 10.3780 15.2522 536 Au 23.4004 19.6522 15.5183 537 Au 20.6514 10.4478 13.1084 538 Au 13.0707 22.1438 19.1481 539 Au 23.5004 13.9057 15.8921 540 Au 17.2156 9.2546 18.7644 541 Au 22.9413 18.0140 11.8371 542 H 9.1139 22.5220 9.9959 543 H 9.8505 20.2153 10.6568 544 H 11.4184 22.3084 6.4104 545 H 12.2098 20.0047 7.0145 546 H 26.0700 13.3966 20.3880 547 H 23.6125 12.9360 20.5751 548 H 25.7264 16.6221 23.1593 549 H 23.2244 16.4008 23.1478 550 H 17.8022 14.9905 27.3652 551 H 17.4574 13.0677 25.8086 552 H 19.3232 17.3920 24.1839 553 H 19.0108 15.5005 22.5713 554 H 13.2545 12.8385 26.9604 555 H 15.1340 14.0308 25.8119 556 H 10.4137 15.4676 25.1598 557 H 12.2561 16.6678 23.9500 558 H 15.4768 23.2553 25.4080 559 H 16.6169 22.1942 23.4359 560 H 15.0308 19.4385 27.2655 561 H 16.3185 18.3457 25.4146 562 H 19.5417 26.9150 22.0712 563 H 20.2324 24.5182 22.2243 564 H 17.5818 26.1861 18.3518 565 H 18.3019 23.7801 18.4132 566 H 5.6807 18.8233 15.4720 567 H 7.3676 17.0824 14.8250 568 H 5.6043 20.3277 11.4758 569 H 7.1855 18.5300 10.7360 570 H 18.9622 9.0553 24.2754 571 H 20.1496 10.6462 22.7484 572 H 18.6876 6.1520 21.1616 573 H 19.8812 7.6879 19.5910 574 H 11.9294 8.5563 20.6646 575 H 13.1673 10.7363 20.6631 576 H 10.5539 9.2731 24.6415 577 H 11.7417 11.4829 24.6919 578 H 9.6446 18.7505 25.3256 579 H 12.0777 18.8259 24.7228 580 H 8.7322 21.5881 22.2676 581 H 11.1491 21.7069 21.6211 582 H 4.9262 11.9852 13.1577 583 H 6.9855 13.0336 14.1263 584 H 7.2994 9.2059 10.9586 585 H 9.4015 10.1772 11.9348 586 H 8.3193 24.7245 11.7909 587 H 7.9158 22.2956 12.2130 588 H 11.9268 24.5899 14.0569 589 H 11.6019 22.1395 14.4875 590 H 14.1309 8.2252 24.6869 591 H 15.6030 9.9052 23.5683 592 H 14.1712 5.7645 21.2021 593 H 15.5237 7.4827 19.9758 594 H 9.7442 12.6321 22.3667 595 H 10.8376 14.4541 21.0305 596 H 7.4001 15.5120 24.4674 597 H 8.4468 17.3733 23.1727 598 H 16.4904 25.6240 23.6973 599 H 16.9344 24.3870 21.5727 600 H 12.3436 24.6614 23.4664 601 H 12.7174 23.4223 21.3208 602 H 17.4382 27.0379 11.7539 603 H 16.9696 25.9386 13.9558 604 H 21.5473 25.9189 12.0031 605 H 21.1202 24.6960 14.1496 606 H 8.5608 24.2877 15.6553 607 H 10.0681 22.3915 16.2810 608 H 8.1572 25.3916 19.7563 609 H 9.7417 23.5673 20.4407 610 H 7.3564 14.4411 21.2681 611 H 8.8907 15.1836 19.4293 612 H 4.1635 13.9321 18.4841 613 H 5.6856 14.5522 16.5805 614 H 24.6627 8.6826 15.9548 615 H 22.6992 9.6226 14.7248 616 H 27.2453 11.5423 14.1260 617 H 25.3618 12.3934 12.7160 618 H 14.8895 4.5665 16.7793 619 H 15.5356 6.9119 17.3772 620 H 10.7540 5.5405 17.2003 621 H 11.3399 7.8771 17.8934 622 H 6.6476 21.7584 21.3600 623 H 8.0820 19.9047 20.4748 624 H 5.6022 22.9193 17.3939 625 H 6.8668 20.9704 16.4531 626 H 22.6368 8.9687 17.1756 627 H 20.3380 9.7447 16.5454 628 H 21.1345 5.0687 18.0271 629 H 18.8034 5.8050 17.4998 630 H 23.5593 22.5220 21.2938 631 H 22.8227 20.2153 20.6328 632 H 21.2548 22.3084 24.8793 633 H 20.4634 20.0047 24.2752 634 H 6.6032 13.3966 10.9017 635 H 9.0607 12.9360 10.7146 636 H 6.9468 16.6221 8.1303 637 H 9.4488 16.4008 8.1419 638 H 14.8710 14.9905 3.9245 639 H 15.2157 13.0677 5.4810 640 H 13.3499 17.3920 7.1057 641 H 13.6623 15.5005 8.7183 642 H 19.4187 12.8385 4.3293 643 H 17.5392 14.0308 5.4778 644 H 22.2595 15.4676 6.1299 645 H 20.4171 16.6678 7.3397 646 H 17.1964 23.2553 5.8817 647 H 16.0563 22.1942 7.8537 648 H 17.6424 19.4385 4.0241 649 H 16.3547 18.3457 5.8751 650 H 13.1315 26.9150 9.2184 651 H 12.4408 24.5182 9.0653 652 H 15.0914 26.1861 12.9379 653 H 14.3713 23.7801 12.8764 654 H 26.9925 18.8233 15.8177 655 H 25.3056 17.0824 16.4646 656 H 27.0688 20.3277 19.8139 657 H 25.4877 18.5300 20.5537 658 H 13.7110 9.0553 7.0142 659 H 12.5235 10.6462 8.5413 660 H 13.9856 6.1520 10.1281 661 H 12.7920 7.6879 11.6987 662 H 20.7438 8.5564 10.6251 663 H 19.5059 10.7363 10.6266 664 H 22.1192 9.2731 6.6482 665 H 20.9314 11.4829 6.5977 666 H 23.0286 18.7505 5.9640 667 H 20.5954 18.8259 6.5669 668 H 23.9410 21.5881 9.0221 669 H 21.5241 21.7069 9.6685 670 H 27.7470 11.9852 18.1319 671 H 25.6877 13.0336 17.1634 672 H 25.3738 9.2059 20.3311 673 H 23.2716 10.1772 19.3548 674 H 24.3538 24.7245 19.4988 675 H 24.7574 22.2956 19.0767 676 H 20.7464 24.5899 17.2327 677 H 21.0713 22.1395 16.8022 678 H 18.5423 8.2252 6.6027 679 H 17.0702 9.9052 7.7214 680 H 18.5020 5.7645 10.0875 681 H 17.1495 7.4827 11.3139 682 H 22.9290 12.6321 8.9230 683 H 21.8356 14.4541 10.2591 684 H 25.2731 15.5120 6.8223 685 H 24.2264 17.3733 8.1170 686 H 16.1828 25.6240 7.5924 687 H 15.7388 24.3870 9.7170 688 H 20.3296 24.6614 7.8233 689 H 19.9557 23.4223 9.9689 690 H 15.2350 27.0379 19.5357 691 H 15.7036 25.9386 17.3338 692 H 11.1258 25.9189 19.2866 693 H 11.5530 24.6960 17.1401 694 H 24.1124 24.2877 15.6344 695 H 22.6050 22.3915 15.0086 696 H 24.5160 25.3916 11.5334 697 H 22.9315 23.5673 10.8489 698 H 25.3168 14.4411 10.0215 699 H 23.7825 15.1836 11.8603 700 H 28.5097 13.9321 12.8056 701 H 26.9876 14.5522 14.7092 702 H 8.0105 8.6826 15.3349 703 H 9.9739 9.6226 16.5649 704 H 5.4279 11.5423 17.1637 705 H 7.3114 12.3934 18.5737 706 H 17.7836 4.5665 14.5104 707 H 17.1376 6.9119 13.9125 708 H 21.9191 5.5405 14.0893 709 H 21.3333 7.8771 13.3963 710 H 26.0255 21.7584 9.9296 711 H 24.5911 19.9047 10.8148 712 H 27.0710 22.9193 13.8958 713 H 25.8064 20.9704 14.8365 714 H 10.0364 8.9687 14.1141 715 H 12.3352 9.7447 14.7443 716 H 11.5386 5.0687 13.2626 717 H 13.8698 5.8050 13.7899 718 H 8.8058 25.4273 8.2171 719 H 28.9655 16.3170 22.1743 720 H 19.3030 19.1904 27.0579 721 H 10.1009 12.0294 28.0074 722 H 13.4508 21.7860 29.0982 723 H 18.0960 29.7795 20.9877 724 H 3.5997 21.5247 15.2763 725 H 17.1857 4.9556 23.9781 726 H 10.0873 5.8777 21.7743 727 H 5.8967 20.8056 24.0481 728 H 2.9266 10.0811 11.1426 729 H 11.3903 27.7973 12.7604 730 H 12.2353 4.3134 23.6774 731 H 6.6471 12.4283 25.6066 732 H 14.8513 26.8220 26.4746 733 H 19.1579 28.3311 9.0794 734 H 6.4138 27.5720 17.7861 735 H 4.6229 13.2717 22.8901 736 H 27.9338 8.1800 16.9876 737 H 11.1144 2.2205 16.4509 738 H 4.6977 24.5740 21.4389 739 H 24.4400 5.2420 18.8581 740 H 22.7136 25.3502 24.6474 741 H 3.5571 14.9853 10.5262 742 H 13.3701 19.1904 4.2318 743 H 22.5722 12.0294 3.2822 744 H 18.8617 23.5737 2.9139 745 H 15.4922 29.4869 11.9888 746 H 29.0734 21.5247 16.0133 747 H 15.4875 4.9556 7.3116 748 H 22.5859 5.8777 9.5154 749 H 26.3648 19.3652 5.9954 750 H 28.6687 8.7149 21.0278 751 H 21.2829 27.7973 18.5292 752 H 20.3330 5.4193 6.0168 753 H 24.9353 11.0806 6.5665 754 H 19.7214 26.4843 4.9846 755 H 11.6575 27.7770 22.1176 756 H 26.0549 27.0924 15.3738 757 H 28.0503 13.2717 8.3996 758 H 4.7394 8.1800 14.3020 759 H 21.5588 2.2205 14.8388 760 H 28.5657 25.0069 11.6527 761 H 7.4695 6.8861 13.1328 .------------------------------------------------------------------------------. /| | / | | / | | / | | / | | / | | / | | / | | / | | / | H H | / | O O O | / | OC C | / | C H H | / | H C C OH H O | / | H C C O HOHH C | / | O H O C CHC C O | / | H O H C C C H CC H CHCH CHCC C | / | HO O O CC HC H C CH OC | / | H H HH CHCC C H C HCC SC HuC C C C H O | * | HO OC HHO C CSu HC S CO C H H | | | CCC C C S C C S HH C C | | | O CCH CCHS C Au C AuuH H H CC CC H OH H | | H O HC H C C SSAuH AuAu S AuS Cu C C CC H O | | | H CCHC AHCC H H O H C C O | | O C C O H CAC AuS CuuH Au AuH C S C CH O C | | | C OHHSC C C Au H C COHH Au C H H HC CO O H | | | CO C H Cu C AuC HOuu C H AuuC Au HC CCC | | H| C HC OAu CCH Au HCAuCCu S HAu C CHHAu HOCHHO H | | | C H HO S CCC AuC Au H COCu AHuC CC CC CHC C OH | | | HO CC H H Au H AH AuAuC H Auu AuAuSH C O CH C | | |H C CC Su AuAu Au S Au SHS C C | | | CCC AuH Au Au S Au AuAu C Hu Au CH C O | | | C C H C HC Au Au H S CAuC CC OC HO Au CHHC H | | O C| C H SSC C C HAu AuuHu C HC AuuAuC HC COC O | | H H H CAHCC O Au AuuAu H CCCHC CCHH C H | | H O| C C H C HAS H Auu SCS H C C | | H O H O CC C CH S SuC Au H C O | | O |CC OCCCHHCC OC HAuuH Cu C CCAH C C HH C C O | | H C .--HC--CH---CCH-SAH----HH-----O-C--O-------H----CC-----------------------------. | O/ H O H H C S HS HS OH HC HC OOHH / | / C S H Au CCH CCH C H / | / C C C H O C H C / | / H CC HH C CO O O / | / C H H C HC H / | / H H C HO C O / | / O HO H / | / H O O H / | / H / | / / | / / | / / | / / | / / | / / | / / | / / | / / |/ / *------------------------------------------------------------------------------* Unit Cell: Periodic X Y Z Points Spacing -------------------------------------------------------------------- 1. axis: yes 32.000000 0.000000 0.000000 240 0.1333 2. axis: yes 0.000000 32.000000 0.000000 240 0.1333 3. axis: yes 0.000000 0.000000 32.000000 240 0.1333 Grid-points per volume: 421.87 Effective grid-spacing: 0.1333 O-setup: name : Oxygen id : 5f3f27ba17355653aa2069308cb75aea Z : 8 valence: 6 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/O.LDA.gz cutoffs: 0.74(comp), 1.30(filt), 0.83(core), lmax=2 valence states: energy radius 2s(2) -23.752 0.741 2p(4) -9.195 0.741 *s 3.459 0.741 *p 18.016 0.741 *d 0.000 0.741 Using partial waves for O as LCAO basis S-setup: name : Sulfur id : 16df0b8f883bfd770ab5c435bc804428 Z : 16 valence: 6 core : 10 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/S.LDA.gz cutoffs: 0.85(comp), 1.49(filt), 1.66(core), lmax=2 valence states: energy radius 3s(2) -17.278 0.847 3p(4) -7.106 0.847 *s 9.933 0.847 *p 20.105 0.847 *d 0.000 0.847 Using partial waves for S as LCAO basis C-setup: name : Carbon id : d60576a1f549371a163e72552ca58787 Z : 6 valence: 4 core : 2 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/C.LDA.gz cutoffs: 0.64(comp), 1.14(filt), 1.14(core), lmax=2 valence states: energy radius 2s(2) -13.639 0.635 2p(2) -5.414 0.635 *s 13.573 0.635 *p 21.797 0.635 *d 0.000 0.635 Using partial waves for C as LCAO basis H-setup: name : Hydrogen id : 4766778ce56282eaa64abeb28b7c1de3 Z : 1 valence: 1 core : 0 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/H.LDA.gz cutoffs: 0.48(comp), 0.85(filt), 0.53(core), lmax=2 valence states: energy radius 1s(1) -6.353 0.476 *s 20.858 0.476 *p 0.000 0.476 Using partial waves for H as LCAO basis Au-setup: name : Gold id : a44207148b704df7bec07bf25e8feca8 Z : 79 valence: 11 core : 68 charge : 0.0 file : /soft/apps/gpaw-setups-0.5.3574/Au.LDA.gz cutoffs: 1.32(comp), 2.33(filt), 2.81(core), lmax=2 valence states: energy radius 6s(1) -6.048 1.323 6p(0) -0.888 1.323 5d(10) -7.129 1.323 *s 21.163 1.323 *p 26.323 1.323 *d 20.082 1.323 Using partial waves for Au as LCAO basis Using the LDA Exchange-Correlation Functional. Spin-Paired Calculation Total Charge: 0.000000 Fermi Temperature: 0.100000 Mode: fd Eigen Solver: (3 nearest neighbors central finite-difference stencil) Diagonalizer: ScaLapack - grid: [nprow, npcol, nb] = [5, 5, 64] Inverse Cholesky: Lapack Poisson Solver: Jacobi (Mehrstellen finite-difference stencil) Interpolation: 6th Order Reference Energy: -53635200.580024 Gamma Point Calculation Total number of cores used: 2048 Using Domain Decomposition: 8 x 8 x 8 Parallelization Over bands on 4 Processors 1 k-point in the Irreducible Part of the Brillouin Zone (total: 1) Linear Mixing Parameter: 0.1 Pulay Mixing with 5 Old Densities Damping of Long Wave Oscillations: 100 Convergence Criteria: Total Energy Change per Atom: 0.001 eV / atom Integral of Absolute Density Change: 0.0001 electrons Integral of Absolute Eigenstate Change: 1e-09 Number of Bands in Calculation: 1728 Bands to Converge: Occupied States Only Number of Valence Electrons: 3366 log10-error: Total Iterations: Time WFS Density Energy Fermi Poisson iter: 1 10:35:21 +0.3 -4415.56673 3 105 iter: 2 10:38:59 -0.4 -5514.20755 5 iter: 3 10:42:38 -0.7 -5682.62208 4 iter: 4 10:46:59 +0.0 -0.9 -3933.90570 7 101 iter: 5 10:51:18 +0.0 -0.9 -3593.83801 15 93 iter: 6 10:55:37 +0.3 -1.0 -3028.82668 24 95 iter: 7 10:59:55 +0.4 -1.1 -2921.02831 26 94 iter: 8 11:04:11 +0.5 -1.1 -2940.70606 9 87 iter: 9 11:08:25 +0.4 -1.2 -3094.01547 12 80 iter: 10 11:12:37 +0.4 -1.3 -3432.21824 6 78 iter: 11 11:16:49 +0.3 -1.3 -3637.38845 3 75 iter: 12 11:20:58 +0.2 -1.3 -4192.08659 7 70 iter: 13 11:25:06 +0.2 -1.2 -4307.12553 5 64 iter: 14 11:29:11 +0.1 -1.2 -4761.83104 3 60 iter: 15 11:33:25 +0.1 -1.2 -4388.01429 7 82 iter: 16 11:37:38 -0.1 -1.1 -4787.14776 7 79 iter: 17 11:41:52 -0.1 -1.1 -4643.96001 8 82 iter: 18 11:46:10 -0.0 -1.1 -5683.98847 15 90 iter: 19 11:50:23 -0.0 -1.1 -5193.97274 4 79 iter: 20 11:54:42 -0.2 -1.0 -4644.38145 17 95 Memory usage: 1.25 GB ============================================================ Timing: incl. excl. ============================================================ Initialization: 217.912 25.574 0.5% | Hamiltonian: 43.437 0.001 0.0% | Atomic: 0.000 0.000 0.0% | Communicate energies: 2.644 2.644 0.0% | Hartree integrate/restrict: 0.034 0.034 0.0% | Initialize Hamiltonian: 0.036 0.036 0.0% | Poisson: 39.808 39.808 0.7% | XC 3D grid: 0.907 0.907 0.0% | vbar: 0.006 0.006 0.0% | LCAO initialization: 148.901 8.141 0.2% | LCAO eigensolver: 22.379 0.015 0.0% | Atomic Hamiltonian: 0.000 0.000 0.0% | Blacs Orbital Layouts: 12.862 0.002 0.0% | General diagonalize: 12.755 12.755 0.2% | Redistribute coefs: 0.087 0.087 0.0% | Send coefs to domains: 0.019 0.019 0.0% | Calculate projections: 0.000 0.000 0.0% | Distribute overlap matrix: 9.486 2.067 0.0% | Distribute overlap matrix: 7.419 7.419 0.1% | Potential matrix: 0.015 0.015 0.0% | LCAO to grid: 0.077 0.077 0.0% | Set positions (LCAO WFS): 118.305 8.871 0.2% | Basic WFS set positions: 0.002 0.002 0.0% | Basis functions set positions: 0.133 0.133 0.0% | Distribute overlap matrix: 2.234 2.234 0.0% | TCI: Calculate S, T, P: 107.064 107.064 2.0% || SCF-cycle: 5147.785 6.595 0.1% | Density: 10.245 0.004 0.0% | Atomic density matrices: 0.002 0.002 0.0% | Mix: 1.195 1.195 0.0% | Multipole moments: 2.767 2.767 0.1% | Pseudo density: 6.278 6.278 0.1% | Hamiltonian: 633.099 0.010 0.0% | Atomic: 0.003 0.003 0.0% | Communicate energies: 47.612 47.612 0.9% | Hartree integrate/restrict: 0.623 0.623 0.0% | Poisson: 568.398 568.398 10.6% |---| XC 3D grid: 16.342 16.342 0.3% | vbar: 0.111 0.111 0.0% | Orthonormalize: 1257.023 0.010 0.0% | Blacs Band Layouts: 7.574 0.002 0.0% | Inverse Cholesky: 7.572 7.572 0.1% | calc_matrix: 910.340 910.340 17.0% |------| rotate_psi: 339.099 339.099 6.3% |--| RMM-DIIS: 2428.998 1165.985 21.7% |--------| precondition: 1263.013 1263.013 23.5% |--------| Subspace diag: 811.825 0.008 0.0% | Blacs Band Layouts: 75.024 0.004 0.0% | Diagonalize: 75.016 75.016 1.4% || Distribute results: 0.004 0.004 0.0% | calc_matrix: 413.991 413.991 7.7% |--| rotate_psi: 322.801 322.801 6.0% |-| Other: 0.301 0.301 0.0% | ============================================================ Total: 5365.997 100.0% ============================================================ date: Wed Mar 31 11:55:21 2010 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/BGMAP_band_4x8x16x8000066400000000000000000001030001316441372200271470ustar00rootroot000000000000000 0 0 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 7 0 0 0 8 0 0 0 9 0 0 0 10 0 0 0 11 0 0 0 12 0 0 0 13 0 0 0 14 0 0 0 15 0 0 1 0 0 0 1 1 0 0 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 0 0 1 8 0 0 1 9 0 0 1 10 0 0 1 11 0 0 1 12 0 0 1 13 0 0 1 14 0 0 1 15 0 0 2 0 0 0 2 1 0 0 2 2 0 0 2 3 0 0 2 4 0 0 2 5 0 0 2 6 0 0 2 7 0 0 2 8 0 0 2 9 0 0 2 10 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3 7 2 11 3 7 2 12 3 7 2 13 3 7 2 14 3 7 2 15 3 7 3 0 3 7 3 1 3 7 3 2 3 7 3 3 3 7 3 4 3 7 3 5 3 7 3 6 3 7 3 7 3 7 3 8 3 7 3 9 3 7 3 10 3 7 3 11 3 7 3 12 3 7 3 13 3 7 3 14 3 7 3 15 3 7 4 0 3 7 4 1 3 7 4 2 3 7 4 3 3 7 4 4 3 7 4 5 3 7 4 6 3 7 4 7 3 7 4 8 3 7 4 9 3 7 4 10 3 7 4 11 3 7 4 12 3 7 4 13 3 7 4 14 3 7 4 15 3 7 5 0 3 7 5 1 3 7 5 2 3 7 5 3 3 7 5 4 3 7 5 5 3 7 5 6 3 7 5 7 3 7 5 8 3 7 5 9 3 7 5 10 3 7 5 11 3 7 5 12 3 7 5 13 3 7 5 14 3 7 5 15 3 7 6 0 3 7 6 1 3 7 6 2 3 7 6 3 3 7 6 4 3 7 6 5 3 7 6 6 3 7 6 7 3 7 6 8 3 7 6 9 3 7 6 10 3 7 6 11 3 7 6 12 3 7 6 13 3 7 6 14 3 7 6 15 3 7 7 0 3 7 7 1 3 7 7 2 3 7 7 3 3 7 7 4 3 7 7 5 3 7 7 6 3 7 7 7 3 7 7 8 3 7 7 9 3 7 7 10 3 7 7 11 3 7 7 12 3 7 7 13 3 7 7 14 3 7 7 15 3 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/BGMAP_band_8x8x8x4000066400000000000000000000400001316441372200270700ustar00rootroot000000000000000 0 0 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 7 0 0 1 0 0 0 1 1 0 0 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 0 0 2 0 0 0 2 1 0 0 2 2 0 0 2 3 0 0 2 4 0 0 2 5 0 0 2 6 0 0 2 7 0 0 3 0 0 0 3 1 0 0 3 2 0 0 3 3 0 0 3 4 0 0 3 5 0 0 3 6 0 0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 12 3 0 1 13 0 0 1 13 1 0 1 13 2 0 1 13 3 0 1 14 0 0 1 14 1 0 1 14 2 0 1 14 3 0 1 15 0 0 1 15 1 0 1 15 2 0 1 15 3 0 2 12 0 0 2 12 1 0 2 12 2 0 2 12 3 0 2 13 0 0 2 13 1 0 2 13 2 0 2 13 3 0 2 14 0 0 2 14 1 0 2 14 2 0 2 14 3 0 2 15 0 0 2 15 1 0 2 15 2 0 2 15 3 0 3 12 0 0 3 12 1 0 3 12 2 0 3 12 3 0 3 13 0 0 3 13 1 0 3 13 2 0 3 13 3 0 3 14 0 0 3 14 1 0 3 14 2 0 3 14 3 0 3 15 0 0 3 15 1 0 3 15 2 0 3 15 3 0 4 12 0 0 4 12 1 0 4 12 2 0 4 12 3 0 4 13 0 0 4 13 1 0 4 13 2 0 4 13 3 0 4 14 0 0 4 14 1 0 4 14 2 0 4 14 3 0 4 15 0 0 4 15 1 0 4 15 2 0 4 15 3 0 5 12 0 0 5 12 1 0 5 12 2 0 5 12 3 0 5 13 0 0 5 13 1 0 5 13 2 0 5 13 3 0 5 14 0 0 5 14 1 0 5 14 2 0 5 14 3 0 5 15 0 0 5 15 1 0 5 15 2 0 5 15 3 0 6 12 0 0 6 12 1 0 6 12 2 0 6 12 3 0 6 13 0 0 6 13 1 0 6 13 2 0 6 13 3 0 6 14 0 0 6 14 1 0 6 14 2 0 6 14 3 0 6 15 0 0 6 15 1 0 6 15 2 0 6 15 3 0 7 12 0 0 7 12 1 0 7 12 2 0 7 12 3 0 7 13 0 0 7 13 1 0 7 13 2 0 7 13 3 0 7 14 0 0 7 14 1 0 7 14 2 0 7 14 3 0 7 15 0 0 7 15 1 0 7 15 2 0 7 15 3 1 0 12 0 1 0 12 1 1 0 12 2 1 0 12 3 1 0 13 0 1 0 13 1 1 0 13 2 1 0 13 3 1 0 14 0 1 0 14 1 1 0 14 2 1 0 14 3 1 0 15 0 1 0 15 1 1 0 15 2 1 0 15 3 1 1 12 0 1 1 12 1 1 1 12 2 1 1 12 3 1 1 13 0 1 1 13 1 1 1 13 2 1 1 13 3 1 1 14 0 1 1 14 1 1 1 14 2 1 1 14 3 1 1 15 0 1 1 15 1 1 1 15 2 1 1 15 3 1 2 12 0 1 2 12 1 1 2 12 2 1 2 12 3 1 2 13 0 1 2 13 1 1 2 13 2 1 2 13 3 1 2 14 0 1 2 14 1 1 2 14 2 1 2 14 3 1 2 15 0 1 2 15 1 1 2 15 2 1 2 15 3 1 3 12 0 1 3 12 1 1 3 12 2 1 3 12 3 1 3 13 0 1 3 13 1 1 3 13 2 1 3 13 3 1 3 14 0 1 3 14 1 1 3 14 2 1 3 14 3 1 3 15 0 1 3 15 1 1 3 15 2 1 3 15 3 1 4 12 0 1 4 12 1 1 4 12 2 1 4 12 3 1 4 13 0 1 4 13 1 1 4 13 2 1 4 13 3 1 4 14 0 1 4 14 1 1 4 14 2 1 4 14 3 1 4 15 0 1 4 15 1 1 4 15 2 1 4 15 3 1 5 12 0 1 5 12 1 1 5 12 2 1 5 12 3 1 5 13 0 1 5 13 1 1 5 13 2 1 5 13 3 1 5 14 0 1 5 14 1 1 5 14 2 1 5 14 3 1 5 15 0 1 5 15 1 1 5 15 2 1 5 15 3 1 6 12 0 1 6 12 1 1 6 12 2 1 6 12 3 1 6 13 0 1 6 13 1 1 6 13 2 1 6 13 3 1 6 14 0 1 6 14 1 1 6 14 2 1 6 14 3 1 6 15 0 1 6 15 1 1 6 15 2 1 6 15 3 1 7 12 0 1 7 12 1 1 7 12 2 1 7 12 3 1 7 13 0 1 7 13 1 1 7 13 2 1 7 13 3 1 7 14 0 1 7 14 1 1 7 14 2 1 7 14 3 1 7 15 0 1 7 15 1 1 7 15 2 1 7 15 3 2 0 12 0 2 0 12 1 2 0 12 2 2 0 12 3 2 0 13 0 2 0 13 1 2 0 13 2 2 0 13 3 2 0 14 0 2 0 14 1 2 0 14 2 2 0 14 3 2 0 15 0 2 0 15 1 2 0 15 2 2 0 15 3 2 1 12 0 2 1 12 1 2 1 12 2 2 1 12 3 2 1 13 0 2 1 13 1 2 1 13 2 2 1 13 3 2 1 14 0 2 1 14 1 2 1 14 2 2 1 14 3 2 1 15 0 2 1 15 1 2 1 15 2 2 1 15 3 2 2 12 0 2 2 12 1 2 2 12 2 2 2 12 3 2 2 13 0 2 2 13 1 2 2 13 2 2 2 13 3 2 2 14 0 2 2 14 1 2 2 14 2 2 2 14 3 2 2 15 0 2 2 15 1 2 2 15 2 2 2 15 3 2 3 12 0 2 3 12 1 2 3 12 2 2 3 12 3 2 3 13 0 2 3 13 1 2 3 13 2 2 3 13 3 2 3 14 0 2 3 14 1 2 3 14 2 2 3 14 3 2 3 15 0 2 3 15 1 2 3 15 2 2 3 15 3 2 4 12 0 2 4 12 1 2 4 12 2 2 4 12 3 2 4 13 0 2 4 13 1 2 4 13 2 2 4 13 3 2 4 14 0 2 4 14 1 2 4 14 2 2 4 14 3 2 4 15 0 2 4 15 1 2 4 15 2 2 4 15 3 2 5 12 0 2 5 12 1 2 5 12 2 2 5 12 3 2 5 13 0 2 5 13 1 2 5 13 2 2 5 13 3 2 5 14 0 2 5 14 1 2 5 14 2 2 5 14 3 2 5 15 0 2 5 15 1 2 5 15 2 2 5 15 3 2 6 12 0 2 6 12 1 2 6 12 2 2 6 12 3 2 6 13 0 2 6 13 1 2 6 13 2 2 6 13 3 2 6 14 0 2 6 14 1 2 6 14 2 2 6 14 3 2 6 15 0 2 6 15 1 2 6 15 2 2 6 15 3 2 7 12 0 2 7 12 1 2 7 12 2 2 7 12 3 2 7 13 0 2 7 13 1 2 7 13 2 2 7 13 3 2 7 14 0 2 7 14 1 2 7 14 2 2 7 14 3 2 7 15 0 2 7 15 1 2 7 15 2 2 7 15 3 3 0 12 0 3 0 12 1 3 0 12 2 3 0 12 3 3 0 13 0 3 0 13 1 3 0 13 2 3 0 13 3 3 0 14 0 3 0 14 1 3 0 14 2 3 0 14 3 3 0 15 0 3 0 15 1 3 0 15 2 3 0 15 3 3 1 12 0 3 1 12 1 3 1 12 2 3 1 12 3 3 1 13 0 3 1 13 1 3 1 13 2 3 1 13 3 3 1 14 0 3 1 14 1 3 1 14 2 3 1 14 3 3 1 15 0 3 1 15 1 3 1 15 2 3 1 15 3 3 2 12 0 3 2 12 1 3 2 12 2 3 2 12 3 3 2 13 0 3 2 13 1 3 2 13 2 3 2 13 3 3 2 14 0 3 2 14 1 3 2 14 2 3 2 14 3 3 2 15 0 3 2 15 1 3 2 15 2 3 2 15 3 3 3 12 0 3 3 12 1 3 3 12 2 3 3 12 3 3 3 13 0 3 3 13 1 3 3 13 2 3 3 13 3 3 3 14 0 3 3 14 1 3 3 14 2 3 3 14 3 3 3 15 0 3 3 15 1 3 3 15 2 3 3 15 3 3 4 12 0 3 4 12 1 3 4 12 2 3 4 12 3 3 4 13 0 3 4 13 1 3 4 13 2 3 4 13 3 3 4 14 0 3 4 14 1 3 4 14 2 3 4 14 3 3 4 15 0 3 4 15 1 3 4 15 2 3 4 15 3 3 5 12 0 3 5 12 1 3 5 12 2 3 5 12 3 3 5 13 0 3 5 13 1 3 5 13 2 3 5 13 3 3 5 14 0 3 5 14 1 3 5 14 2 3 5 14 3 3 5 15 0 3 5 15 1 3 5 15 2 3 5 15 3 3 6 12 0 3 6 12 1 3 6 12 2 3 6 12 3 3 6 13 0 3 6 13 1 3 6 13 2 3 6 13 3 3 6 14 0 3 6 14 1 3 6 14 2 3 6 14 3 3 6 15 0 3 6 15 1 3 6 15 2 3 6 15 3 3 7 12 0 3 7 12 1 3 7 12 2 3 7 12 3 3 7 13 0 3 7 13 1 3 7 13 2 3 7 13 3 3 7 14 0 3 7 14 1 3 7 14 2 3 7 14 3 3 7 15 0 3 7 15 1 3 7 15 2 3 7 15 3 4 0 15 0 4 0 15 1 4 0 15 2 4 0 15 3 4 0 14 0 4 0 14 1 4 0 14 2 4 0 14 3 4 0 13 0 4 0 13 1 4 0 13 2 4 0 13 3 4 0 12 0 4 0 12 1 4 0 12 2 4 0 12 3 4 1 15 0 4 1 15 1 4 1 15 2 4 1 15 3 4 1 14 0 4 1 14 1 4 1 14 2 4 1 14 3 4 1 13 0 4 1 13 1 4 1 13 2 4 1 13 3 4 1 12 0 4 1 12 1 4 1 12 2 4 1 12 3 4 2 15 0 4 2 15 1 4 2 15 2 4 2 15 3 4 2 14 0 4 2 14 1 4 2 14 2 4 2 14 3 4 2 13 0 4 2 13 1 4 2 13 2 4 2 13 3 4 2 12 0 4 2 12 1 4 2 12 2 4 2 12 3 4 3 15 0 4 3 15 1 4 3 15 2 4 3 15 3 4 3 14 0 4 3 14 1 4 3 14 2 4 3 14 3 4 3 13 0 4 3 13 1 4 3 13 2 4 3 13 3 4 3 12 0 4 3 12 1 4 3 12 2 4 3 12 3 4 4 15 0 4 4 15 1 4 4 15 2 4 4 15 3 4 4 14 0 4 4 14 1 4 4 14 2 4 4 14 3 4 4 13 0 4 4 13 1 4 4 13 2 4 4 13 3 4 4 12 0 4 4 12 1 4 4 12 2 4 4 12 3 4 5 15 0 4 5 15 1 4 5 15 2 4 5 15 3 4 5 14 0 4 5 14 1 4 5 14 2 4 5 14 3 4 5 13 0 4 5 13 1 4 5 13 2 4 5 13 3 4 5 12 0 4 5 12 1 4 5 12 2 4 5 12 3 4 6 15 0 4 6 15 1 4 6 15 2 4 6 15 3 4 6 14 0 4 6 14 1 4 6 14 2 4 6 14 3 4 6 13 0 4 6 13 1 4 6 13 2 4 6 13 3 4 6 12 0 4 6 12 1 4 6 12 2 4 6 12 3 4 7 15 0 4 7 15 1 4 7 15 2 4 7 15 3 4 7 14 0 4 7 14 1 4 7 14 2 4 7 14 3 4 7 13 0 4 7 13 1 4 7 13 2 4 7 13 3 4 7 12 0 4 7 12 1 4 7 12 2 4 7 12 3 5 0 15 0 5 0 15 1 5 0 15 2 5 0 15 3 5 0 14 0 5 0 14 1 5 0 14 2 5 0 14 3 5 0 13 0 5 0 13 1 5 0 13 2 5 0 13 3 5 0 12 0 5 0 12 1 5 0 12 2 5 0 12 3 5 1 15 0 5 1 15 1 5 1 15 2 5 1 15 3 5 1 14 0 5 1 14 1 5 1 14 2 5 1 14 3 5 1 13 0 5 1 13 1 5 1 13 2 5 1 13 3 5 1 12 0 5 1 12 1 5 1 12 2 5 1 12 3 5 2 15 0 5 2 15 1 5 2 15 2 5 2 15 3 5 2 14 0 5 2 14 1 5 2 14 2 5 2 14 3 5 2 13 0 5 2 13 1 5 2 13 2 5 2 13 3 5 2 12 0 5 2 12 1 5 2 12 2 5 2 12 3 5 3 15 0 5 3 15 1 5 3 15 2 5 3 15 3 5 3 14 0 5 3 14 1 5 3 14 2 5 3 14 3 5 3 13 0 5 3 13 1 5 3 13 2 5 3 13 3 5 3 12 0 5 3 12 1 5 3 12 2 5 3 12 3 5 4 15 0 5 4 15 1 5 4 15 2 5 4 15 3 5 4 14 0 5 4 14 1 5 4 14 2 5 4 14 3 5 4 13 0 5 4 13 1 5 4 13 2 5 4 13 3 5 4 12 0 5 4 12 1 5 4 12 2 5 4 12 3 5 5 15 0 5 5 15 1 5 5 15 2 5 5 15 3 5 5 14 0 5 5 14 1 5 5 14 2 5 5 14 3 5 5 13 0 5 5 13 1 5 5 13 2 5 5 13 3 5 5 12 0 5 5 12 1 5 5 12 2 5 5 12 3 5 6 15 0 5 6 15 1 5 6 15 2 5 6 15 3 5 6 14 0 5 6 14 1 5 6 14 2 5 6 14 3 5 6 13 0 5 6 13 1 5 6 13 2 5 6 13 3 5 6 12 0 5 6 12 1 5 6 12 2 5 6 12 3 5 7 15 0 5 7 15 1 5 7 15 2 5 7 15 3 5 7 14 0 5 7 14 1 5 7 14 2 5 7 14 3 5 7 13 0 5 7 13 1 5 7 13 2 5 7 13 3 5 7 12 0 5 7 12 1 5 7 12 2 5 7 12 3 6 0 15 0 6 0 15 1 6 0 15 2 6 0 15 3 6 0 14 0 6 0 14 1 6 0 14 2 6 0 14 3 6 0 13 0 6 0 13 1 6 0 13 2 6 0 13 3 6 0 12 0 6 0 12 1 6 0 12 2 6 0 12 3 6 1 15 0 6 1 15 1 6 1 15 2 6 1 15 3 6 1 14 0 6 1 14 1 6 1 14 2 6 1 14 3 6 1 13 0 6 1 13 1 6 1 13 2 6 1 13 3 6 1 12 0 6 1 12 1 6 1 12 2 6 1 12 3 6 2 15 0 6 2 15 1 6 2 15 2 6 2 15 3 6 2 14 0 6 2 14 1 6 2 14 2 6 2 14 3 6 2 13 0 6 2 13 1 6 2 13 2 6 2 13 3 6 2 12 0 6 2 12 1 6 2 12 2 6 2 12 3 6 3 15 0 6 3 15 1 6 3 15 2 6 3 15 3 6 3 14 0 6 3 14 1 6 3 14 2 6 3 14 3 6 3 13 0 6 3 13 1 6 3 13 2 6 3 13 3 6 3 12 0 6 3 12 1 6 3 12 2 6 3 12 3 6 4 15 0 6 4 15 1 6 4 15 2 6 4 15 3 6 4 14 0 6 4 14 1 6 4 14 2 6 4 14 3 6 4 13 0 6 4 13 1 6 4 13 2 6 4 13 3 6 4 12 0 6 4 12 1 6 4 12 2 6 4 12 3 6 5 15 0 6 5 15 1 6 5 15 2 6 5 15 3 6 5 14 0 6 5 14 1 6 5 14 2 6 5 14 3 6 5 13 0 6 5 13 1 6 5 13 2 6 5 13 3 6 5 12 0 6 5 12 1 6 5 12 2 6 5 12 3 6 6 15 0 6 6 15 1 6 6 15 2 6 6 15 3 6 6 14 0 6 6 14 1 6 6 14 2 6 6 14 3 6 6 13 0 6 6 13 1 6 6 13 2 6 6 13 3 6 6 12 0 6 6 12 1 6 6 12 2 6 6 12 3 6 7 15 0 6 7 15 1 6 7 15 2 6 7 15 3 6 7 14 0 6 7 14 1 6 7 14 2 6 7 14 3 6 7 13 0 6 7 13 1 6 7 13 2 6 7 13 3 6 7 12 0 6 7 12 1 6 7 12 2 6 7 12 3 7 0 15 0 7 0 15 1 7 0 15 2 7 0 15 3 7 0 14 0 7 0 14 1 7 0 14 2 7 0 14 3 7 0 13 0 7 0 13 1 7 0 13 2 7 0 13 3 7 0 12 0 7 0 12 1 7 0 12 2 7 0 12 3 7 1 15 0 7 1 15 1 7 1 15 2 7 1 15 3 7 1 14 0 7 1 14 1 7 1 14 2 7 1 14 3 7 1 13 0 7 1 13 1 7 1 13 2 7 1 13 3 7 1 12 0 7 1 12 1 7 1 12 2 7 1 12 3 7 2 15 0 7 2 15 1 7 2 15 2 7 2 15 3 7 2 14 0 7 2 14 1 7 2 14 2 7 2 14 3 7 2 13 0 7 2 13 1 7 2 13 2 7 2 13 3 7 2 12 0 7 2 12 1 7 2 12 2 7 2 12 3 7 3 15 0 7 3 15 1 7 3 15 2 7 3 15 3 7 3 14 0 7 3 14 1 7 3 14 2 7 3 14 3 7 3 13 0 7 3 13 1 7 3 13 2 7 3 13 3 7 3 12 0 7 3 12 1 7 3 12 2 7 3 12 3 7 4 15 0 7 4 15 1 7 4 15 2 7 4 15 3 7 4 14 0 7 4 14 1 7 4 14 2 7 4 14 3 7 4 13 0 7 4 13 1 7 4 13 2 7 4 13 3 7 4 12 0 7 4 12 1 7 4 12 2 7 4 12 3 7 5 15 0 7 5 15 1 7 5 15 2 7 5 15 3 7 5 14 0 7 5 14 1 7 5 14 2 7 5 14 3 7 5 13 0 7 5 13 1 7 5 13 2 7 5 13 3 7 5 12 0 7 5 12 1 7 5 12 2 7 5 12 3 7 6 15 0 7 6 15 1 7 6 15 2 7 6 15 3 7 6 14 0 7 6 14 1 7 6 14 2 7 6 14 3 7 6 13 0 7 6 13 1 7 6 13 2 7 6 13 3 7 6 12 0 7 6 12 1 7 6 12 2 7 6 12 3 7 7 15 0 7 7 15 1 7 7 15 2 7 7 15 3 7 7 14 0 7 7 14 1 7 7 14 2 7 7 14 3 7 7 13 0 7 7 13 1 7 7 13 2 7 7 13 3 7 7 12 0 7 7 12 1 7 7 12 2 7 7 12 3 4 0 11 0 4 0 11 1 4 0 11 2 4 0 11 3 4 0 10 0 4 0 10 1 4 0 10 2 4 0 10 3 4 0 9 0 4 0 9 1 4 0 9 2 4 0 9 3 4 0 8 0 4 0 8 1 4 0 8 2 4 0 8 3 4 1 11 0 4 1 11 1 4 1 11 2 4 1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316441372200247630ustar00rootroot00000000000000N. A. Romero naromero@alcf.anl.gov April 7, 2010 Summary ------- The benefits of appropriate mapping are demonstrated on Argonne National Laboratory's BlueGene/P Intrepid computer using the Au_cluster.py test case. Mapfile names reflect parallelization scheme. For example, BGMAP_band_XxYxZxB means that one should use --domain-decomposition=X,Y,Z, --state-parallelization=B Note that the value of Matrix.nblocks was change to keep the message size approximately constant between the calculations at 512 and 1024-nodes: Matrix.nblocks = 16 for state-parallelization=4 Matrix.nblocks = 8 for state-parallelization=8 At a 512-node partition (mid-plane), we see no difference between the two mapping types: band and domain. Note that band mode Mapfile is equivalent to use MAPPING=ZYXT for this case! At a 1024-node partition (1-rack), we see that there is a large difference. We need to be using band mode for ground-state DFT calculations. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/akka.sh000077500000000000000000000010041316441372200253370ustar00rootroot00000000000000#!/bin/bash ### SNAC project number, enter if applicable. ### NOTE! No spaces or slashes allowed #PBS -A HPC2N-2008-005 ### Requesting 64 nodes with 8 VP:s on each node #PBS -l nodes=64:ppn=8 ### Requesting time - 40 minutes #PBS -l walltime=00:40:00 # Change to Working Directory cd $PBS_O_WORKDIR module add openmpi/1.2.6/gcc gpawhome=${HOME}/gpaw export PYTHONPATH=${gpawhome}:${PYTHONPATH} mpiexec ${gpawhome}/build/bin.linux-x86_64-2.4/gpaw-python ../Au_cluster.py --sl_diagonalize=5,5,64 --gpaw=usenewlfc=1 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/intrepid.sh000077500000000000000000000014731316441372200262600ustar00rootroot00000000000000type=Au_cluster cwd=`pwd` acct=Gpaw queue=prod time=90 nodes=512 mode=vn mapping=ZYXT # mapfile=BGMAP_128_4x4x4x8 # mapping=$mapfile job=${type}_${nodes}_${mode}_${mapping} input=${type}.py pos=Au102_revised.xyz scratch=/intrepid-fs0/users/${USER}/persistent install=/soft/apps rm -rf $scratch/$job mkdir $scratch/$job cp $input $scratch/$job # cp $mapfile $scratch/$job cp $pos $scratch/$job cd $scratch/$job qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$GPAW_SETUP_PATH:PYTHONPATH=${install}/gpaw-r6000:${install}/ase-r1438:$PYTHONPATH:LD_LIBRARY_PATH=$CN_LD_LIBRARY_PATH ${install}/gpaw-r6000/build/bin.linux-ppc64-2.6/gpaw-python ${type}.py --domain-decomposition=8,8,8 --state-parallelization=4 --sl_diagonalize=5,5,64 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/Au_cluster/prepare.sh000077500000000000000000000014611316441372200260750ustar00rootroot00000000000000#!/bin/bash FORMAT=1 setFORMAT () { # function setFORMAT takes integer as the argument $1 # and returns integer in the format %05d or %d (printf' like format) # depending on the FORMAT variable (1 or 0) if [ ${FORMAT} -eq "1" ]; then integer_formatted=`echo $1 | awk '{if ($1<10) printf("0000%.0f", $1); else if ($1<100) printf("000%.0f", $1); else if ($1<1000) printf("00%.0f", $1); else if ($1<10000) printf("0%.0f", $1); else printf("%.0f", $1)}'` else integer_formatted=$1 fi echo $integer_formatted } if test -z $PATTERN; then echo "Error: no directory pattern provided" exit fi for p in 256 512 1024 2048 4096 do proc=`setFORMAT $p` dir="${PATTERN}_${proc}_" if [ ! -d "${dir}" ]; then mkdir ${dir} echo "${dir} created" fi done gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/000077500000000000000000000000001316441372200244605ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/C5H12.agts.py000066400000000000000000000003221316441372200265060ustar00rootroot00000000000000def agts(queue): queue.add('C5H12.agts.py', walltime=25, ncpus=8, creates=['C5H12-gpaw.csv']) if __name__ == "__main__": from ase.optimize.test.C5H12 import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/CO_Au111.agts.py000066400000000000000000000002441316441372200271400ustar00rootroot00000000000000def agts(queue): queue.add('CO_Au111.agts.py', creates=['CO_Au111.csv']) if __name__ == "__main__": from ase.optimize.test.CO_Au111 import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/Cu_bulk.agts.py000066400000000000000000000002411316441372200273500ustar00rootroot00000000000000def agts(queue): queue.add('Cu_bulk.agts.py', creates=['Cu_bulk.csv']) if __name__ == "__main__": from ase.optimize.test.Cu_bulk import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/H2.agts.py000066400000000000000000000003271316441372200262420ustar00rootroot00000000000000def agts(queue): queue.add('H2.agts.py', walltime=25, ncpus=8, creates=['H2-emt.csv', 'H2-gpaw.csv']) if __name__ == "__main__": from ase.optimize.test.H2 import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/N2Cu_relax.agts.py000066400000000000000000000002701316441372200277300ustar00rootroot00000000000000def agts(queue): queue.add('N2Cu_relax.agts.py', creates=['N2Cu-N2.csv', 'N2Cu-surf.csv']) if __name__ == "__main__": from ase.optimize.test.N2Cu_relax import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/ase_optimize.rst000066400000000000000000000047611316441372200277120ustar00rootroot00000000000000.. _optimizer_tests: =============== Optimizer tests =============== This page shows benchmarks of optimizations done with our different optimizers. Note that the iteration number (steps) is not the same as the number of force evaluations. This is because some of the optimizers uses internal line searches or similar. The most important performance characteristics of an optimizer is the total optimization time. Different optimizers may perform the same number of steps, but along a different path, so the time spent on calculation of energy/forces may be different due to different convergence of the self-consistent field. G2 == PBE relaxation of molecules from the G2 set. On the plots: the number of optimizer force calls (stats), the total run time, the systems with the largest number of optimizer force calls, and the number of systems for which optimization failed. In the corresponding tables: the most common value of the total energy ("relaxed energy"), and the differences (optimizer - "relaxed energy"). The dot sign denotes the above difference below a threshold (same as the printed precision of "relaxed energy" in eV), and "N/A" denotes an optimization failure. Only the systems that fail to converge or converge to a total energy above the threshold are given in the tables. Calculator used: GPAW mode='lcao' (see :git:`~doc/devel/ase_optimize/g2_dzp.py`) Limit of optimizer steps: 25 .. csv-table:: :file: g2_dzp.csv :header: optimizer, failed, time, steps N2Cu ==== Relaxation of Cu surface. Calculator used: EMT .. csv-table:: :file: N2Cu-surf.csv N2 adsorption on relaxed Ru surface Calculator used: EMT .. csv-table:: :file: N2Cu-N2.csv Cu_bulk ======= Bulk relaxation of Cu where atoms has been rattled. Calculator used: EMT .. csv-table:: :file: Cu_bulk.csv CO_Au111 ======== CO adsorption on Au Calculator used: EMT .. csv-table:: :file: CO_Au111.csv H2 == Geometry optimization of gas-phase molecule. Calculator used: EMT .. csv-table:: :file: H2-emt.csv Calculator used: GPAW .. csv-table:: :file: H2-gpaw.csv C5H12 ===== Geometry optimization of gas-phase molecule. Calculator used: GPAW (lcao) .. csv-table:: :file: C5H12-gpaw.csv nanoparticle ============ Adsorption of a NH on a Pd nanoparticle. Calculator used: GPAW (lcao) .. csv-table:: :file: nanoparticle.csv NEB ======= Diffusion of gold atom on Al(100) surface. Calculator used: EMT .. csv-table:: :file: neb-emt.csv Calculator used: GPAW (lcao) .. csv-table:: :file: neb-gpaw.csv gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/g2_dzp.agts.py000066400000000000000000000002651316441372200271570ustar00rootroot00000000000000def agts(queue): jobs = [queue.add('g2_dzp.py ' + str(i), ncpus=4, walltime=800) for i in range(10)] queue.add('g2_dzp_csv.py', deps=jobs, creates='g2_dzp.csv') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/g2_dzp.py000066400000000000000000000022321316441372200262160ustar00rootroot00000000000000import time import ase.db import ase.optimize from ase.collections import g2 from gpaw import GPAW, Mixer optimizers = ['BFGS', 'BFGSLineSearch', 'FIRE', 'GoodOldQuasiNewton', 'LBFGS', 'LBFGSLineSearch'] con = ase.db.connect('g2_dzp.db') for name, atoms in zip(g2.names, g2): if len(atoms) == 1: continue atoms.center(vacuum=3.5) for optimizer in optimizers: id = con.reserve(name=name, optimizer=optimizer) if id is None: continue mol = atoms.copy() mol.calc = GPAW(mode='lcao', basis='dzp', h=0.17, xc='PBE', mixer=Mixer(0.05, 2), txt='{0}-{1}.txt'.format(name, optimizer)) Optimizer = getattr(ase.optimize, optimizer) opt = Optimizer(mol) t = time.time() try: opt.run(fmax=0.05, steps=50) except Exception as ex: print(name, optimizer, ex) continue con.write(mol, name=name, optimizer=optimizer, steps=opt.nsteps, time=time.time() - t) del con[id] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/g2_dzp_csv.py000066400000000000000000000016751316441372200271030ustar00rootroot00000000000000from __future__ import print_function import numpy as np import ase.db con = ase.db.connect('g2_dzp.db') N = 6 # number of optimizers M = len(con) // N # number of molecules data = [] for row in con.select(): data.append((row.optimizer, row.name, row.get('time', 42), row.get('steps', 42), row.get('energy', 42), row.get('fmax', 42))) data.sort() optimizers = [x[0] for x in data[::M]] data = np.array([x[2:] for x in data]).reshape((N, M, 4)) e0 = data[:, :, 2].min(0) results = [] for opt, d in zip(optimizers, data): ok = (d[:, 3] < 0.05) & (d[:, 2] < e0 + 0.1) failed = M - sum(ok) time, niter = d[ok, :2].mean(0) results.append((failed, time, niter, opt)) with open('g2_dzp.csv', 'w') as f: for failed, time, niter, opt in sorted(results): print('{0}, {1}, {2:.1f}, {3:.1f}'.format(opt, failed, time, niter), file=f) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/nanoparticle.agts.py000066400000000000000000000003531316441372200304470ustar00rootroot00000000000000def agts(queue): queue.add('nanoparticle.agts.py', walltime=2 * 60 + 15, ncpus=8, creates=['nanoparticle.csv']) if __name__ == "__main__": from ase.optimize.test.nanoparticle import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/ase_optimize/neb.agts.py000066400000000000000000000003421316441372200265320ustar00rootroot00000000000000def agts(queue): queue.add('neb.agts.py', walltime=15 * 60, ncpus=12, creates=['neb-emt.csv', 'neb-gpaw.csv']) if __name__ == '__main__': from ase.optimize.test.neb import * gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/benchmarks.rst000066400000000000000000001132101316441372200246350ustar00rootroot00000000000000.. _benchmarks: ========== Benchmarks ========== .. _memory_bandwidth: Memory benchmark ================ Goal ---- It is known that GPAW puts a heavy load on the RAM memory subsystem. This benchmark will test system's `memory bandwidth `_. Prerequisites ------------- This benchmark requires approximately 1.5 GB of RAM memory per core. The amount of disk space required is minimal. The following packages are required (names given for RHEL 5 system): - python, python-devel - numpy - python-matplotlib - openmpi, openmpi-devel - bash - gpaw Please refer to :ref:`platforms and architectures` for hints on installing GPAW on different platforms. Results ------- Multiple instances of the GPAW code are executed in serial using OpenMPI in order to benchmark a number of processes that ranges from 1, through integer powers of 2 and up to the total number of CPU cores (NCORES - number of cores available on the test machine). The benchmark result is the average execution time in seconds when running 1, 2, up to NCORES processes, respectively, on the test machine. The scaling of the execution time with the number of processes is part of the benchmark result. On `Non-Uniform Memory Access `_ machines, in order to get reproducible results, it is important to find the (fastest) combination of processor/memory. See section :ref:`opteron_285` for an example of performance degradation depending on the numa policy. To see which CPU corresponds to which node examine ``/sys/devices/system/node/node*``. It is assumed the following mapping: - dual-socket dual-core machine:: numactl --membind=0 --physcpubind=0 numactl --membind=0 --physcpubind=1 numactl --membind=1 --physcpubind=2 numactl --membind=1 --physcpubind=3 - dual-socket quad-core machine:: numactl --membind=0 --physcpubind=0 numactl --membind=0 --physcpubind=1 numactl --membind=0 --physcpubind=2 numactl --membind=0 --physcpubind=3 numactl --membind=1 --physcpubind=4 numactl --membind=1 --physcpubind=5 numactl --membind=1 --physcpubind=6 numactl --membind=1 --physcpubind=7 **Note** that the mapping above assigns first all the cores belonging to the first memory node, what is **non**-optimal for runs with the number of processes larger than 1 and smaller than NCORES. See :ref:`opteron_285` section for example of this behaviour. For description of numa see `NUMACTL `_ and `NUMA support `_. Getting the results ------------------- Please perform the following steps: - make sure that no other resources consuming processes are running, - set (as root) ulimit's cpu time to 5 hours:: ulimit -t 18000 - use the following commands to setup the benchmark:: bash export NCORES=8 # default; set this variable to the number of cores in your machine export CORES_PER_SOCKET=4 # default; set this variable to the number of cores per socket export MACHINE=TEST # default; optional: set this to the name of you machine mkdir /tmp/benchmark.$$; cd /tmp/benchmark.* wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/H2Al110.py wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/prepare.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/taskit.BINDING.one.node wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/run.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/run_numactl.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/memory_bandwidth.py wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/memory_bandwidth/twiny.py chmod u+x taskit.BINDING.one.node sh prepare.sh - run with (it takes 6-10 hours with NCORES=8):: cd $MACHINE; nohup sh ../run.sh 2>&1 | tee $MACHINE.log& **Warning**: on numa-enabled machines use:: cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& - analyse the results:: python3 ../memory_bandwidth.py - to estimate performance run the benchmark on the maximal number the cores only:: export NCORES=8 export CORES_PER_SOCKET=4 export MACHINE=TEST export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& Benchmarked systems ------------------- .. _best_performance: Best performance ++++++++++++++++ The best performance estimate has been obtained on the following systems with the following configuration of GPAW tested on **production runs**: compiler:blas/lapack/(numpy:dotblas/lapack): - GPAW **0.7.6383** (28 SCF steps): - Xeon_X5570_: 329.0 s (11.8 s/step) - gcc43:goto2-1.13/acml-4.4.0/(numpy:default/acml-4.0.1), date: May 08 2010, kernel 2.6.18-128.7.1.el5, BIOS HP O33 02/04/2010. - opteron_285_: 659.9 s (23.6 s/step) - gcc43:goto-1.26/acml-4.4.0/(numpy:default/acml-4.0.1)*, date: May 08 2010, kernel 2.6.18-164.el5, BIOS IBM 1.35 07/18/2007. - GPAW **0.6.5147** (30 SCF steps): - Xeon_X5570_: 345.1 s (11.5 s/step) - gcc43:goto2-1.13/acml-4.4.0/(numpy:default/acml-4.0.1), date: May 08 2010, kernel 2.6.18-128.7.1.el5, BIOS HP O33 02/04/2010. - Xeon_X5667_: 509.8 s (17.0 s/step) - gcc43:acml-4.3.0/acml-4.3.0/(numpy:default/acml-4.0.1), date: May 08 2010, kernel 2.6.18-164.15.1.el5, BIOS HP 0.34 03/31/2010. - opteron_285_: 674.9 s (22.5 s/step) - gcc43:goto-1.26/acml-4.3.0/(numpy:default/acml-4.0.1)*, date: May 08 2010, kernel 2.6.18-164.el5, BIOS IBM 1.35 07/18/2007. See the above links for the detailed results. .. _opteron_285: Dual-socket dual Core AMD Opteron(tm) Processor 285/2.6 GHz/2 GB RAM per core EL5 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - memory bandwidth: - date: May 08 2010, kernel 2.6.18-164.el5, BIOS IBM 1.35 07/18/2007. Performed with gcc43/goto-1.26/acml-4.4.0, GPAW **0.7.6383** (28 SCF steps), numpy *1.3.0* compiled with gcc/default(no dotblas)/acml-4.0.1: - run with assumed numactl mapping for a dual-socket dual-core machine:: export NCORES=4 export CORES_PER_SOCKET=4 export MACHINE=gcc43.numactl export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 564.4, stddev 0.6, min 563.4, max 565.1 No. of processes 2: time [sec]: avg 658.0, stddev 3.6, min 653.0, max 662.9 No. of processes 4: time [sec]: avg 659.9, stddev 3.8, min 654.4, max 666.1 - date: May 08 2010, kernel 2.6.18-164.el5, BIOS IBM 1.35 07/18/2007. Performed with gcc43/goto-1.26/acml-4.3.0, GPAW **0.6.5147** (30 SCF steps), numpy *1.3.0* compiled with gcc/default(no dotblas)/acml-4.0.1: - run with assumed numactl mapping for a dual-socket dual-core machine:: export NCORES=4 export CORES_PER_SOCKET=4 export MACHINE=gcc43.numactl export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 586.6, stddev 0.7, min 585.7, max 587.7 No. of processes 2: time [sec]: avg 673.9, stddev 3.4, min 669.4, max 678.5 No. of processes 4: time [sec]: avg 674.9, stddev 3.2, min 671.1, max 681.9 - date: ??, kernel ??, BIOS IBM ??. Performed with gcc43/goto-1.26/acml-4.2.0, GPAW **0.6.3862** (35 SCF steps), numpy *1.3.0* compiled with gcc/blas-3.0-37/lapack-3.0-37: - run with default numa:: export NCORES=4 export CORES_PER_SOCKET=2 export MACHINE=gcc43 export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 716.1, stddev 3.7, min 710.8, max 719.6 No. of processes 2: time [sec]: avg 726.9, stddev 7.2, min 718.2, max 735.0 No. of processes 4: time [sec]: avg 898.6, stddev 7.5, min 890.5, max 914.1 - run with assumed numactl mapping for a dual-socket dual-core machine:: export NCORES=4 export CORES_PER_SOCKET=2 export MACHINE=gcc43.numactl export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 717.5, stddev 0.8, min 716.0, max 718.1 No. of processes 2: time [sec]: avg 884.7, stddev 7.7, min 873.4, max 897.1 No. of processes 4: time [sec]: avg 894.3, stddev 15.4, min 874.9, max 913.9 **Note** the performance degradation in the case of numactl for two cores, compared to a "default" run. The degradation of ~25% between 1 core and the maximal number of cores (4) is typical for this generation of AMD systems. - performance estimate (average time of the memory_bandwidth_ benchmark on the maximal number of cores): - GPAW **0.6.5147** (30 SCF steps) was used. Standard deviations are found below 15 sec. "**N/A**" denotes the fact that libraries are not available, "**-**" that tests were not performed. =================================================== ========= ========= ========= ============ blas/lapack/(numpy:dotblas/lapack): compiler gcc gcc43 icc 11.0 open64 4.2.3 =================================================== ========= ========= ========= ============ acml-4.4.0/acml-4.4.0/(default/acml-4.0.1)* N/A 716.4 -- 689.3 acml-4.4.0/acml-4.4.0/(blas-3.0-37/lapack-3.0-37) N/A -- -- 669.0 acml-4.3.0/acml-4.3.0/(default/acml-4.0.1)* N/A 713.5 -- -- acml-4.3.0/acml-4.3.0/(blas-3.0-37/lapack-3.0-37) N/A 699.7 -- -- acml-4.0.1/acml-4.0.1/(default/acml-4.0.1)* 715.4 N/A -- -- blas-3.0-37/lapack-3.0-37/(default/acml-4.0.1)* 1151.6 F 1146.3 F -- -- goto2-1.13/acml-4.4.0/(default/acml-4.0.1)* N/A 680.4 -- 652.9 goto2-1.13/acml-4.4.0/(blas-3.0-37/lapack-3.0-37) N/A 699.6 -- 669.0 goto-1.26/acml-4.4.0/(default/acml-4.0.1)* N/A 680.4 -- 651.1 goto-1.26/acml-4.3.0/(default/acml-4.0.1)* N/A 674.9 -- -- goto-1.26/acml-4.3.0/(blas-3.0-37/lapack-3.0-37) N/A 693.2 -- -- atlas-3.8.3/atlas-3.8.3/(default/acml-4.0.1)* -- FAIL -- -- =================================================== ========= ========= ========= ============ **Note**: the numpy version marked by \* (star) denotes that the ``_dotblas.so`` module was **NOT** built and the given lapack used. **Warning**: fields marked by **F** denote a failure in the GPAW's test suite. Fields marked by **FAIL** denote a failure in the memory_bandwidth_ benchmark. Errors were reported when using different blas/lapack in GPAW and NUMPY! ============================== ============================================= compiler options ============================== ============================================= gcc 4.1.2 20080704 -O3 -funroll-all-loops -std=c99 gcc43 4.3.2 20081007 -O3 -funroll-all-loops -std=c99 icc 11.0 083 -xHOST -O3 -ipo -no-prec-div -static -std=c99 open64 4.2.3 -O3 -std=c99 -fPIC ============================== ============================================= - GPAW **0.6.3862** (35 SCF steps) was used, numpy *1.3.0* compiled with gcc/goto-1.26/acml-4.0.1. Standard deviations are found below 15 sec. "**N/A**" denotes the fact that libraries are not available, "**-**" that tests were not performed. ============================= ======= ======= ======= ======= ======= ======= blas/lapack : compiler gcc gcc43 amd4.2 pathcc icc pgcc ============================= ======= ======= ======= ======= ======= ======= acml-4.2.0/acml-4.2.0 N/A 991.74 985.83 980.75 1020.66 1082.64 acml-4.1.0/acml-4.1.0 N/A -- -- 978.58 -- -- acml-4.0.1/acml-4.0.1 991.95 N/A N/A 984.23 -- -- blas-3.0-37/lapack-3.0-37 1494.63 1495.52 -- -- -- -- goto-1.26/acml-4.2.0 N/A 889.22 886.43 879.28 FAIL FAIL goto-1.26/acml-4.2.0 PGO -- 886.47 -- -- -- -- goto-1.26/acml-4.0.1 888.79 N/A N/A -- -- -- atlas-3.8.3/acml-4.2.0 -- 931.41 -- -- -- -- atlas-3.8.3/lapack-3.2.1 -- 927.71 -- -- -- -- mkl-10.1.2.024/mkl-10.1.2.024 -- 1012.64 -- 1030.06 -- -- ============================= ======= ======= ======= ======= ======= ======= **Note**: the PGO entry refers to Profile guided optimization driven using the benchmark. **Warning**: fields marked by **FAIL** denote a failure in the memory_bandwidth_ benchmark. Errors were reported when using different blas/lapack in GPAW and NUMPY! ============================== ============================================= compiler options ============================== ============================================= gcc 4.1.2 20080704 -O3 -funroll-all-loops -std=c99 gcc43 4.3.2 20081007 -O3 -funroll-all-loops -std=c99 gcc 4.2.0-amd-barcelona-rhel4 -O3 -funroll-all-loops -std=c99 pathcc Version 3.2 2008-06-16 -O3 -OPT:Ofast -ffast-math -std=c99 icc 11.0 083 -xHOST -O3 -ipo -no-prec-div -static -std=c99 pgcc 8.0-6 -fast -Mipa=fast,inline -Msmartalloc ============================== ============================================= **Note**: that using wrong numa policy (in some situations also the **default** numa policy) results in serious performance degradation, and non-reproducible results. Example below is given for gcc43/goto-1.26/acml-4.2.0 (**A**), and gcc43/mkl-10.1.2.024/mkl-10.1.2.024 (**B**). ===================== ====================================== ====================================== MP pairs (see below) A Runtime [sec] B Runtime [sec] ===================== ====================================== ====================================== 00 01 12 13 avg 889.22, stddev 7.61, max 902.53 avg 1012.64, stddev 11.65, max 1032.98 default (not set) avg 892.22, stddev 12.54, max 915.96 avg 1047.2, stddev 51.8, max 1171.5 00 11 02 13 avg 953.39, stddev 81.57, max 1069.16 avg 1081.78, stddev 92.67, max 1204.43 10 11 02 03 avg 1330.88, stddev 11.75, max 1351.37 avg 1504.35, stddev 8.89, max 1527.54 00 01 02 03 avg 1549.29, stddev 59.61, max 1645.92 avg 1736.57, stddev 77.87, max 1849.49 ===================== ====================================== ====================================== **Note**: "MP pairs" denote pairs of M and P used for `numactl --membind=M --physcpubind=P` for ranks 0, 1, 2, 3, respectively. In this case **A** the **default** numa policy does not result in performance degradation. .. _Xeon_X5570: Dual-socket quad Core 64-bit Intel Nehalem Xeon X5570 quad-core 2.93 GHz/3 GB RAM per core EL5 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - memory bandwidth: - date: May 08 2010, kernel 2.6.18-128.7.1.el5, BIOS HP O33 02/04/2010. Performed with gcc43/goto2-1.13/acml-4.4.0, GPAW **0.7.6383** (28 SCF steps), numpy *1.3.0* compiled with gcc/default(no dotblas)/acml-4.0.1: - run with assumed numactl mapping for a dual-socket quad-core machine:: export NCORES=8 export CORES_PER_SOCKET=4 export MACHINE=gcc43.numactl export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 297.4, stddev 0.3, min 296.8, max 297.7 No. of processes 2: time [sec]: avg 307.0, stddev 0.9, min 305.8, max 308.6 No. of processes 4: time [sec]: avg 327.9, stddev 0.9, min 326.5, max 329.6 No. of processes 6: time [sec]: avg 321.7, stddev 10.3, min 306.3, max 330.7 No. of processes 8: time [sec]: avg 329.0, stddev 1.5, min 326.9, max 332.5 - date: May 08 2010, kernel 2.6.18-128.7.1.el5, BIOS HP O33 02/04/2010. Performed with gcc43/goto2-1.13/acml-4.4.0, GPAW **0.6.5147** (30 SCF steps), numpy *1.3.0* compiled with gcc/default(no dotblas)/acml-4.0.1: - run with assumed numactl mapping for a dual-socket quad-core machine:: export NCORES=8 export CORES_PER_SOCKET=4 export MACHINE=gcc43.numactl export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 313.2, stddev 0.2, min 313.0, max 313.6 No. of processes 2: time [sec]: avg 322.9, stddev 1.2, min 321.5, max 324.9 No. of processes 4: time [sec]: avg 344.1, stddev 0.8, min 342.5, max 345.7 No. of processes 6: time [sec]: avg 337.5, stddev 10.1, min 322.8, max 347.8 No. of processes 8: time [sec]: avg 345.1, stddev 1.5, min 343.1, max 348.9 - performance estimate (average time of the memory_bandwidth_ benchmark on the maximal number of cores): - GPAW **0.6.5147** (30 SCF steps) was used. Standard deviations are found below 15 sec. "**N/A**" denotes the fact that libraries are not available, "**-**" that tests were not performed. ============================================================= ========= ========= ========= ========= ============ blas/lapack/(numpy:dotblas/lapack): compiler gcc gcc43 icc 11.0 icc 11.1 open64 4.2.3 ============================================================= ========= ========= ========= ========= ============ acml-4.4.0/acml-4.4.0/(default/acml-4.0.1)* N/A 436.6 399.2 F 400.0 F 418.5 acml-4.4.0/acml-4.4.0/(blas-3.0-37/lapack-3.0-37) N/A 355.5 326.7 F 326.0 F 347.4 acml-4.3.0/acml-4.3.0/(default/acml-4.0.1)* N/A 435.9 -- -- -- acml-4.3.0/acml-4.3.0/(blas-3.0-37/lapack-3.0-37) N/A 364.8 -- -- -- acml-4.3.0/acml-4.3.0/(mkl-10.1.3.027/mkl-10.1.3.027) N/A 363.4 -- -- -- acml-4.0.1/acml-4.0.1/(default/acml-4.0.1)* 443.5 N/A -- -- -- blas-3.0-37/lapack-3.0-37/(default/acml-4.0.1)* 529.7 F 531.2 F -- -- -- goto2-1.13/acml-4.4.0/(default/acml-4.0.1)* N/A 345.1 -- -- 326.6 goto2-1.13/acml-4.4.0/(blas-3.0-37/lapack-3.0-37) N/A 351.1 -- -- 333.3 goto-1.26/acml-4.3.0/(default/acml-4.0.1)* N/A N/A N/A N/A N/A atlas-3.8.3/atlas-3.8.3/(default/acml-4.0.1)* -- 380.0 F -- -- -- mkl-10.1.3.027/mkl-10.1.3.027/(default/acml-4.0.1)* -- 352.3 318.4 F -- -- mkl-10.1.3.027/mkl-10.1.3.027/(mkl-10.1.3.027/mkl-10.1.3.027) -- 382.9 332.4 F -- -- mkl-10.1.3.027/mkl-10.1.3.027/(blas-3.0-37/lapack-3.0-37) -- 358.0 326.5 F -- -- ============================================================= ========= ========= ========= ========= ============ **Note**: the numpy version marked by \* (star) denotes that the ``_dotblas.so`` module was **NOT** built and the given lapack used. **Warning**: fields marked by **F** denote a failure in the GPAW's test suite. Fields marked by **FAIL** denote a failure in the memory_bandwidth_ benchmark. Errors were reported when using different blas/lapack in GPAW and NUMPY! ============================== ============================================= compiler options ============================== ============================================= gcc 4.1.2 20080704 -O3 -funroll-all-loops -std=c99 gcc43 4.3.2 20081007 -O3 -funroll-all-loops -std=c99 icc 11.0 083 -xHOST -O3 -ipo -no-prec-div -static -std=c99 icc 11.1 072 -xHOST -O3 -ipo -no-prec-div -static -std=c99 open64 4.2.3 -O3 -std=c99 -fPIC ============================== ============================================= .. _Xeon_X5667: Dual-socket quad Core 64-bit Intel Westmere Xeon X5667 quad-core 3.07 GHz/3 GB RAM per core EL5 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ **Note**: the benchmark was performred with a pre-release system of CPU and beta-version of BIOS. The performance numbers may not reflect the future production systems. - memory bandwidth: - date: May 08 2010, kernel 2.6.18-164.15.1.el5, BIOS HP 0.34 03/31/2010. Performed with gcc43/acml-4.3.0/acml-4.3.0, GPAW **0.6.5147** (30 SCF steps), numpy *1.3.0* compiled with gcc/default(no dotblas)/acml-4.0.1: - run with assumed numactl mapping for a dual-socket quad-core machine:: export NCORES=8 export CORES_PER_SOCKET=4 export MACHINE=gcc43.numactl export STARTCORES=${NCORES} cd $MACHINE; nohup sh ../run_numactl.sh 2>&1 | tee $MACHINE.log& results in:: No. of processes 1: time [sec]: avg 423.3, stddev 0.9, min 422.2, max 424.8 No. of processes 2: time [sec]: avg 452.7, stddev 0.5, min 451.9, max 453.5 No. of processes 4: time [sec]: avg 481.0, stddev 1.7, min 479.0, max 484.5 No. of processes 6: time [sec]: avg 483.1, stddev 13.6, min 462.3, max 497.3 No. of processes 8: time [sec]: avg 509.8, stddev 2.5, min 506.7, max 517.1 - performance estimate (average time of the memory_bandwidth_ benchmark on the maximal number of cores): - GPAW **0.6.5147** (30 SCF steps) was used. Standard deviations are found below 15 sec. "**N/A**" denotes the fact that libraries are not available, "**-**" that tests were not performed. ============================================================= ========= ========= ========= ========= ========= blas/lapack/(numpy:dotblas/lapack): compiler gcc gcc43 gcc44 icc 11.0 icc 11.1 ============================================================= ========= ========= ========= ========= ========= acml-4.4.0/acml-4.4.0/(default/acml-4.0.1)* N/A -- 511.0 469.4 F 469.8 F acml-4.4.0/acml-4.4.0/(blas-3.0-37/lapack-3.0-37) N/A 454.2 -- 418.6 F 419.0 F acml-4.3.0/acml-4.3.0/(default/acml-4.0.1)* N/A 509.8 510.8 -- -- acml-4.3.0/acml-4.3.0/(blas-3.0-37/lapack-3.0-37) N/A 454.3 453.3 -- -- acml-4.3.0/acml-4.3.0/(mkl-10.1.3.027/mkl-10.1.3.027) N/A 452.9 -- -- -- acml-4.0.1/acml-4.0.1/(default/acml-4.0.1)* 508.6 N/A N/A -- -- blas-3.0-37/lapack-3.0-37/(default/acml-4.0.1)* -- -- -- -- -- goto-1.26/acml-4.3.0/(default/acml-4.0.1)* N/A N/A N/A N/A N/A atlas-3.8.3/atlas-3.8.3/(default/acml-4.0.1)* -- -- -- -- -- mkl-10.1.3.027/mkl-10.1.3.027/(default/acml-4.0.1)* -- 429.3 -- -- -- mkl-10.1.3.027/mkl-10.1.3.027/(mkl-10.1.3.027/mkl-10.1.3.027) -- 440.9 -- 405.6 F -- mkl-10.2.1.017/mkl-10.2.1.017/(mkl-10.1.3.027/mkl-10.1.3.027) -- 439.6 F -- -- -- mkl-10.2.4.032/mkl-10.2.4.032/(mkl-10.1.3.027/mkl-10.1.3.027) -- 442.5 F 438.3 F -- -- mkl-10.1.3.027/mkl-10.1.3.027/(blas-3.0-37/lapack-3.0-37) -- 440.4 -- -- -- ============================================================= ========= ========= ========= ========= ========= **Note**: the numpy version marked by \* (star) denotes that the ``_dotblas.so`` module was **NOT** built and the given lapack used. **Warning**: fields marked by **F** denote a failure in the GPAW's test suite. Fields marked by **FAIL** denote a failure in the memory_bandwidth_ benchmark. Errors were reported when using different blas/lapack in GPAW and NUMPY! ============================== ============================================= compiler options ============================== ============================================= gcc 4.1.2 20080704 -O3 -funroll-all-loops -std=c99 gcc43 4.3.2 20081007 -O3 -funroll-all-loops -std=c99 gcc44 4.4.0 20090514 -O3 -funroll-all-loops -std=c99 icc 11.0 083 -xHOST -O3 -ipo -no-prec-div -static -std=c99 icc 11.1 072 -xHOST -O3 -ipo -no-prec-div -static -std=c99 ============================== ============================================= Strong scaling benchmarks ========================= Goal ---- Fix the problem size, vary the number of processors, and measure the speedup. 1) Medium size system +++++++++++++++++++++ The system used in this benchmark is of medium size, as for the year 2008, and consists of 256 water molecules in a box of ~20**3 Angstrom**3, 2048 electrons, and 1056 bands, and 112**3 grid points (grid spacing of ~0.18). LCAO initialization stage is performed, then 3 SCF steps with a constant potential and 2 full SCF steps. All the stages are timed separately, due to their different scaling. **Note** that the size of the system can be changed easily by modifying just one variable in :git:`~doc/devel/256H2O/b256H2O.py`:: r = [2, 2, 2] Prerequisites +++++++++++++ This benchmark requires approximately 2 GB of RAM memory per core and at least 16 cores. The amount of disk space required is minimal. The following packages are required (names given for Fedora Core 10 system): * python, python-devel * numpy * python-matplotlib * openmpi, openmpi-devel * blacs, scalapack * bash * gpaw * ase **Note** that GPAW has to built with ScaLAPACK enabled - please refer to :ref:`platforms and architectures` for hints on installing GPAW on different platforms. Results +++++++ GPAW code is executed in parallel in order to benchmark a number of processes that ranges from 16, through integer powers of 2 up to 128. The number of bands (1056) and cores are chosen to make comparisons of different band parallelizations (:ref:`band_parallelization`) possible. **Note**: to achieve optimal performance diagonalization steps are performed on `4x4` blacs grid with block size of `64` specified by adding ``--gpaw=blacs=1 --sl_diagonalize=4,4,64`` options. **Note** also that a default domain decomposition is appplied, and different results can be obtained by tuning ``--domain-decomposition`` argument to your platform. **Note**: the ``--gpaw=usenewlfc=1`` option is required to skip the calculation of forces and decrease **memory** usage. The results of the benchmark is scaling of execution time of different stages of GPAW run with the number of processes (CPU cores). Getting the results +++++++++++++++++++ Please perform the following steps: - use the following commands to setup the benchmark:: bash mkdir 256H2O; cd 256H2O wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/256H2O/b256H2O.py wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/256H2O/akka.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/256H2O/surveyor.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/256H2O/prepare.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/256H2O/scaling.py # set the prefix directory: results will be in $PATTERN_*_ export PATTERN=b256H2O_112_04x04m64.grid sh prepare.sh **Warning**: the choice of the directory names is not free in the sense that the number of processes has to come at the end of directory name, and be delimited by two underscores. - run with, for example: - on akka:: cd ${PATTERN}_00016_; qsub -l nodes=2:8 ../akka.sh; cd .. cd ${PATTERN}_00032_; qsub -l nodes=4:8 ../akka.sh; cd .. cd ${PATTERN}_00064_; qsub -l nodes=8:8 ../akka.sh; cd .. cd ${PATTERN}_00128_; qsub -l nodes=16:8 ../akka.sh; cd .. **Warning**: on Linux clusters it s desirable to repeat these runs 2-3 times to make sure that they give reproducible time. Even with this procedure obtained runtimes may show up to 5% precision. - analyse the results:: python3 scaling.py -v --dir=. --pattern="b256H2O_112_04x04m64.grid_*_" b256H2O Niflheim results: - opteron (IBM eServer x3455: Opteron 2218 dual-core 2.60 GHz CPUs) nodes (infiniband): performed on EL4 with gcc/acml-4.0.1/acml-4.0.1, GPAW **0.6.5092**, numpy *1.0.3* compiled with gcc/blas-3.0-25/lapack-3.0-25 (with dotblas); no ScaLAPACK used:: # p - processes, p0 - reference processes, t - time [sec], s - speedup, e - efficiency # GPAW version 6.5092: stages: 1 - initialization, 2 - fixdensity, 3 - SCF, 4 - forces, 5 - total # p p/p0 t1 s1 e1 t2 s2 e2 t3 s3 e3 t4 s4 e4 t5 s5 e5 16 1.00 201.5 16.0 1.00 778.5 16.0 1.00 533.0 16.0 1.00 0.0 0.0 0.00 1513.0 16.0 1.00 32 2.00 113.5 28.4 0.89 391.5 31.8 0.99 267.0 31.9 1.00 0.0 0.0 0.00 772.0 31.4 0.98 64 4.00 69.0 46.7 0.73 204.0 61.1 0.95 139.0 61.4 0.96 0.0 0.0 0.00 412.0 58.8 0.92 - opteron (IBM eServer x3455: Opteron 2218 dual-core 2.60 GHz CPUs) nodes (ethernet): performed on EL5 with gcc43/goto-1.26/acml-4.3.0, GPAW **0.6.5092**, numpy *1.3.0* compiled with gcc/acml-4.0.1 (no dotblas); no ScaLAPACK used:: # p - processes, p0 - reference processes, t - time [sec], s - speedup, e - efficiency # GPAW version 6.5092: stages: 1 - initialization, 2 - fixdensity, 3 - SCF, 4 - forces, 5 - total # p p/p0 t1 s1 e1 t2 s2 e2 t3 s3 e3 t4 s4 e4 t5 s5 e5 16 1.00 190.5 16.0 1.00 823.5 16.0 1.00 563.0 16.0 1.00 0.0 0.0 0.00 1577.0 16.0 1.00 32 2.00 112.5 27.1 0.85 454.5 29.0 0.91 310.0 29.1 0.91 0.0 0.0 0.00 877.0 28.8 0.90 64 4.00 71.0 42.9 0.67 255.0 51.7 0.81 172.0 52.4 0.82 0.0 0.0 0.00 498.0 50.7 0.79 - xeon (HP DL160 G6: 64-bit Intel Nehalem Xeon X5570 quad-core 2.93 GHz CPUs) nodes (ethernet): performed on EL5 with gcc43/acml-4.3.0/acml-4.3.0, GPAW **0.6.5092**, numpy *1.3.0* compiled with gcc/acml-4.0.1 (no dotblas); no ScaLAPACK used:: # p - processes, p0 - reference processes, t - time [sec], s - speedup, e - efficiency # GPAW version 6.5092: stages: 1 - initialization, 2 - fixdensity, 3 - SCF, 4 - forces, 5 - total # p p/p0 t1 s1 e1 t2 s2 e2 t3 s3 e3 t4 s4 e4 t5 s5 e5 16 1.00 116.0 16.0 1.00 444.0 16.0 1.00 302.0 16.0 1.00 0.0 0.0 0.00 862.0 16.0 1.00 32 2.00 66.0 28.1 0.88 270.0 26.3 0.82 184.0 26.3 0.82 0.0 0.0 0.00 520.0 26.5 0.83 64 4.00 48.0 38.7 0.60 159.0 44.7 0.70 109.0 44.3 0.69 0.0 0.0 0.00 316.0 43.6 0.68 Clearly SCF part scales better than the initialization stage. Using of ScaLAPACK does not result in any noticeable improvement: even for the fastest 64 cores run on xeon the diagonalization part takes only 4% of the total runtime. This is to be expected from a rather small hamiltonian matrix size (1056 bands). **Note** that runtimes on opteron ethernet (EL5) and infiniband (EL4) nodes are not directly comparable due to different operating system, gcc, and numpy versions. - for a comparison of what to expect on different machines, the following absolute times where obtained with r=[1,1,1] (without ScaLAPACK) =================== ================= ============ ======= ============ ======== ======== host type cpu type MHz # procs time [s] date =================== ================= ============ ======= ============ ======== ======== jump.fz-juelich.de IBM Regatta p690+ Power4+ 1700 2 88 23.3.09 jump.fz-juelich.de IBM Regatta p690+ Power4+ 1700 4 51 23.3.09 mmos3 LINUX Intel Q6600 2394 2 85 23.3.09 mmos3 LINUX Intel Q6600 2394 4 62 23.3.09 bfg.uni-freiburg.de LINUX Xeon 5160 3000 2 156 23.3.09 bfg.uni-freiburg.de LINUX Xeon 5160 3000 4 119 23.3.09 =================== ================= ============ ======= ============ ======== ======== 2. Medium size system +++++++++++++++++++++ The system used in this benchmark is another one of medium size, as for the year 2008, and consists of a gold cluster interacting with organic groups (see ``_) in a box of 32**3 Angstrom**3, 3366 electrons, and 1728 bands, and 240**3 grid points (grid spacing of ~0.13). LCAO initialization stage is performed, then 3 SCF steps with a constant potential and 2 full SCF steps. All the stages are timed separately, due to their different scaling. **Note** that the size of the system can be changed easily by modifying just one variable in :git:`~doc/devel/Au_cluster/Au_cluster.py`:: r = [1, 1, 1] Prerequisites +++++++++++++ This benchmark requires approximately 2 GB of RAM memory per core and at least 512 cores, up to 4096. The amount of disk space required is minimal. The following packages are required (names given for Fedora Core 10 system): * python, python-devel * numpy * python-matplotlib * openmpi, openmpi-devel * blacs, scalapack * bash * gpaw * ase **Note** that GPAW has to built with ScaLAPACK enabled - please refer to :ref:`platforms and architectures` for hints on installing GPAW on different platforms. Results +++++++ GPAW code is executed in parallel in order to benchmark a number of processes that ranges from 256, through integer powers of 2 and up to the total number of CPU 4096 cores. The number of bands (1728) and cores are chosen to make comparisons of different band parallelizations (:ref:`band_parallelization`) possible. **Note**: to achieve optimal performance diagonalization steps are performed on `5x5` blacs grid with block size of `64` specified by adding ``--gpaw=blacs=1 --sl_diagonalize=5,5,64`` options. **Note** also that a default domain decomposition is appplied, and different results can be obtained by tuning ``--domain-decomposition`` argument to your platform. **Note**: the ``--gpaw=usenewlfc=1`` option is required to skip the calculation of forces and decrease **memory** usage. The results of the benchmark is scaling of execution time of different stages of GPAW run with the number of processes (CPU cores). Getting the results +++++++++++++++++++ Please perform the following steps: - use the following commands to setup the benchmark:: bash mkdir Au_cluster; cd Au_cluster wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/Au_cluster/Au102_revised.xyz wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/Au_cluster/Au_cluster.py wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/Au_cluster/akka.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/Au_cluster/intrepid.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/Au_cluster/prepare.sh wget http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/devel/256H2O/scaling.py # set the prefix directory: results will be in $PATTERN_*_ export PATTERN=Au_cluster_240_05x05m64.grid sh prepare.sh **Warning**: the choice of the directory names is not free in the sense that the number of processes has to come at the end of directory name, and be delimited by two underscores. - run with, for example: - on akka:: cd ${PATTERN}_00256_; qsub -l nodes=32:8 ../akka.sh; cd .. cd ${PATTERN}_00512_; qsub -l nodes=64:8 ../akka.sh; cd .. cd ${PATTERN}_01024_; qsub -l nodes=128:8 ../akka.sh; cd .. cd ${PATTERN}_02048_; qsub -l nodes=256:8 ../akka.sh; cd .. cd ${PATTERN}_04096_; qsub -l nodes=512:8 ../akka.sh; cd .. **Warning**: on Linux clusters it s desirable to repeat these runs 2-3 times to make sure that they give reproducible time. - analyse the results:: python3 scaling.py -v --dir=. --pattern="Au_cluster_240_05x05m64.grid_*_" Au_cluster A typical output may look like (example given for Intel Xeon dual-socket, quad-core L5k CPUs, 2.5 GHz, GPAW linked with Intel mkl, infiniband):: # p - processes, p0 - reference processes, t - time [sec], s - speedup, e - efficiency # GPAW version 2843: stages: 1 - initialization, 2 - fixdensity, 3 - SCF, 4 - forces, 5 - total # p p/p0 t1 s1 e1 t2 s2 e2 t3 s3 e3 t4 s4 e4 t5 s5 e5 512 1.00 243.5 512.0 1.00 856.5 512.0 1.00 900.0 512.0 1.00 0.0 0.0 0.00 2000.0 512.0 1.00 1024 2.00 155.5 801.7 0.78 466.5 940.0 0.92 489.0 942.3 0.92 0.0 0.0 0.00 1111.0 921.7 0.90 2048 4.00 148.5 839.5 0.41 241.5 1815.9 0.89 256.0 1800.0 0.88 0.0 0.0 0.00 646.0 1585.1 0.77 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/bigpicture.py000066400000000000000000000215211316441372200245000ustar00rootroot00000000000000# creates: bigpicture.svg, bigpicture.png from math import pi, cos, sin import numpy as np import matplotlib.patches as mpatches import matplotlib.pyplot as plt class Box: def __init__(self, name, description=(), attributes=(), color='grey'): self.name = name if isinstance(description, str): description = [description] self.description = description self.attributes = attributes self.color = color self.owns = [] self.position = None def set_position(self, position): self.position = np.asarray(position) def has(self, other, name, angle=None, distance=None, x=0.4, style='<-'): self.owns.append((other, name, x, style)) if angle is not None: angle *= pi / 180 other.set_position(self.position + [cos(angle) * distance, sin(angle) * distance]) def cut(size, dir): if abs(size[0] * dir[1]) < abs(size[1] * dir[0]): x = min(max(-size[0] / 2, dir[0]), size[0] / 2) y = x * dir[1] / dir[0] else: y = min(max(-size[1] / 2, dir[1]), size[1] / 2) x = y * dir[0] / dir[1] return x, y class MPL: def __init__(self, boxes): self.boxes = boxes def plot(self): a4 = 100 * np.array([2**-1.75, 2**-2.25]) inch = 2.54 self.fig = plt.figure(1, a4 / inch) self.ax = ax = self.fig.add_axes([0, 0, 1, 1], frameon=False) ax.set_xlim(0, a4[0]) ax.set_ylim(0, a4[1]) ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) ax.add_patch(mpatches.Rectangle((22.5, 16), 6, 4, fc='orange')) ax.text(22.7, 19.5, 'ASE package') for b in boxes: x, y = b.position text = b.name for txt in b.description: text += '\n' + txt for txt in b.attributes: text += '\n' + txt b.text = ax.text(x, y, text, fontsize=9, ha='center', va='center', bbox=dict(boxstyle='round', facecolor=b.color, alpha=0.75)) self.fig.canvas.mpl_connect('draw_event', self.on_draw) plt.savefig('bigpicture.png', dpi=50) plt.savefig('bigpicture.svg') def on_draw(self, event): for b in self.boxes: bbox = b.text.get_window_extent() t = b.text.get_transform() b.size = t.inverted().transform(bbox.size) for b in self.boxes: for other, name, s, style in b.owns: d = other.position - b.position p1 = b.position + cut(b.size, d) p2 = other.position + cut(other.size, -d) if style == '-|>': arrowprops = dict(arrowstyle=style, fc='white') else: arrowprops = dict(arrowstyle=style) self.ax.annotate('', p1, p2, arrowprops=arrowprops) if name: p = (1 - s) * p1 + s * p2 self.ax.text(p[0], p[1], name, fontsize=7, ha='center', va='center', bbox=dict(facecolor='white', ec='white')) self.fig.canvas.callbacks.callbacks[event.name] = {} self.fig.canvas.draw() return False boxes = [] def box(*args, **kwargs): b = Box(*args, **kwargs) boxes.append(b) return b atoms = box('Atoms', [''], ['positions, numbers, cell, pbc'], color='white') paw = box('PAW', [], [], 'green') scf = box('SCFLoop', []) density = box('Density', [r'$\tilde{n}_\sigma = \sum_{\mathbf{k}n}' + r'|\tilde{\psi}_{\sigma\mathbf{k}n}|^2' + r'+\frac{1}{2}\sum_a \tilde{n}_c^a$', r'$\tilde{\rho}(\mathbf{r}) = ' + r'\sum_\sigma\tilde{n}_\sigma + \sum_{aL}Q_L^a \hat{g}_L^a$'], ['nspins, nt_sG, nt_sg,', 'rhot_g, Q_aL, D_asp']) mixer = box('Mixer') hamiltonian = box('Hamiltonian', [r'$-\frac{1}{2}\nabla^2 + \tilde{v} + ' + r'\sum_a \sum_{i_1i_2} |\tilde{p}_{i_1}^a \rangle ' + r'\Delta H_{i_1i_2} \langle \tilde{p}_{i_2}^a|$'], ['nspins, vt_sG, vt_sg, vHt_g, dH_asp', 'Etot, Ekin, Exc, e_coulomb, Ebar']) wfs = box('WaveFunctions', [r'$\tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r})$'], ['nspins, ibzk_qc, mynbands', 'kpt_comm, band_comm'], color='magenta') gd = box('GridDescriptor', ['(coarse grid)'], ['cell_cv, N_c,', 'pbc_c, dv, comm'], 'orange') finegd = box('GridDescriptor', '(fine grid)', ['cell_cv, N_c, pbc_c, dv, comm'], 'orange') rgd = box('RadialGridDescriptor', [], ['r_g, dr_g, rcut'], color='orange') setups = box('Setups', ['', '', '', ''], ['nvalence, nao, Eref, corecharge']) xccorrection = box('XCCorrection') nct = box('LFC', r'$\tilde{n}_c^a(r)$', [], 'red') vbar = box('LFC', r'$\bar{v}^a(r)$', [], 'red') ghat = box('LFC', r'$\hat{g}_{\ell m}^a(\mathbf{r})$', [], 'red') fd = box('FDWaveFunctions', r"""$\tilde{\psi}_{\sigma\mathbf{k}n}(ih,jh,kh)$""", [], 'magenta') pt = box('LFC', r'$\tilde{p}_i^a(\mathbf{r})$', [], 'red') lcao = box('LCAOWaveFunctions', r"$\tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r})=\sum_{\mu\mathbf{R}} C_{\sigma\mathbf{k}n\mu} \Phi_\mu(\mathbf{r} - \mathbf{R}) \exp(i\mathbf{k}\cdot\mathbf{R})$", ['S_qMM, T_qMM, P_aqMi'], 'magenta') atoms0 = box('Atoms', '(copy)', ['positions, numbers, cell, pbc'], color='grey') parameters = box('InputParameters', [], ['xc, nbands, ...']) forces = box('ForceCalculator') occupations = box( 'OccupationNumbers', r'$\epsilon_{\sigma\mathbf{k}n} \rightarrow f_{\sigma\mathbf{k}n}$') poisson = box('PoissonSolver', r'$\nabla^2 \tilde{v}_H(\mathbf{r}) = -4\pi \tilde{\rho}(\mathbf{r})$') eigensolver = box('EigenSolver') symmetry = box('Symmetry') restrictor = box('Transformer', '(fine -> coarse)', color='yellow') interpolator = box('Transformer', '(coarse -> fine)', color='yellow') xc = box('XCFunctional') kin = box('FDOperator', r'$-\frac{1}{2}\nabla^2$') hsoperator = box('HSOperator', [r"$\langle \psi_n | A | \psi_{n'} \rangle$", r"$\sum_{n'}U_{nn'}|\tilde{\psi}_{n'}\rangle$"]) overlap = box('Overlap') basisfunctions = box('BasisFunctions', r'$\Phi_\mu(\mathbf{r})$', color='red') tci = box('TwoCenterIntegrals', r'$\langle\Phi_\mu|\Phi_\nu\rangle,' r'\langle\Phi_\mu|\hat{T}|\Phi_\nu\rangle,' r'\langle\tilde{p}^a_i|\Phi_\mu\rangle$') atoms.set_position((25, 18.3)) atoms.has(paw, 'calculator', -160, 7.5) paw.has(scf, 'scf', 160, 4, x=0.48) paw.has(density, 'density', -150, 14, 0.23) paw.has(hamiltonian, 'hamiltonian', 180, 10, 0.3) paw.has(wfs, 'wfs', -65, 5.5, x=0.48) paw.has(atoms0, 'atoms', 9, 7.5) paw.has(parameters, 'input_parameters', 90, 4) paw.has(forces, 'forces', 50, 4) paw.has(occupations, 'occupations', 136, 4) density.has(mixer, 'mixer', 130, 3.3) density.has(gd, 'gd', x=0.33) density.has(finegd, 'finegd', 76, 3.5) density.has(setups, 'setups', 0, 7, 0.45) density.has(nct, 'nct', -90, 3) density.has(ghat, 'ghat', -130, 3.4) density.has(interpolator, 'interpolator', -45, 4) hamiltonian.has(restrictor, 'restrictor', 40, 4) hamiltonian.has(xc, 'xc', 160, 6, x=0.6) hamiltonian.has(vbar, 'vbar', 80, 4) hamiltonian.has(setups, 'setups', x=0.3) hamiltonian.has(gd, 'gd', x=0.45) hamiltonian.has(finegd, 'finegd') hamiltonian.has(poisson, 'poissonsolver', 130, 4) wfs.has(gd, 'gd', 160, 4.8, x=0.48) wfs.has(setups, 'setups', x=0.4) wfs.has(lcao, None, -55, 5.9, style='-|>') wfs.has(fd, None, -112, 5.0, style='-|>') wfs.has(eigensolver, 'eigensolver', 30, 5, x=0.6) wfs.has(symmetry, 'symmetry', 80, 3) fd.has(pt, 'pt', -45, 3.6) fd.has(kin, 'kin', -90, 3) fd.has(overlap, 'overlap', -135, 3.5) lcao.has(basisfunctions, 'basis_functions', -50, 3.5) lcao.has(tci, 'tci', -90, 4.2) overlap.has(setups, 'setups', x=0.4) overlap.has(hsoperator, 'operator', -115, 2.5, x=0.41) for i in range(3): setup = box('Setup', [], ['Z, Nv, Nc, pt_j, nct,', 'vbar, ghat_l, Delta_pl'], 'blue') setup.set_position(setups.position + (0.9 - i * 0.14, 0.3 - i * 0.14)) setup.has(xccorrection, 'xc_correction', -110, 3.7) xccorrection.has(rgd, 'rgd', -105, 2.4, 0.4) kpts = [box('KPoint', [], ['psit_nG, C_nM,', 'eps_n, f_n, P_ani'], color='cyan') for i in range(3)] wfs.has(kpts[1], 'kpt_u', 0, 5.4, 0.48) kpts[0].set_position(kpts[1].position - 0.14) kpts[2].set_position(kpts[1].position + 0.14) MPL(boxes).plot() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/bugs.rst000066400000000000000000000054051316441372200234660ustar00rootroot00000000000000======================= Bugs in the latest GPAW ======================= See here: :ref:`bugs` ------------------ Handling segfaults ------------------ Segmentation faults are probably the hardest type of runtime error to track down, but they are also quite common during the *unstable* part of the release cycle. As a rule of thumb, if you get a segfault, start by checking that all array arguments passed from Python to C functions have the correct shapes and types. Apart from appending ``--debug`` to the command line arguments when running ``python`` or ``gpaw-python``, please familiarize yourself with the :ref:`debugging tools ` for the Python and C code. If you experience segfaults or unexplained MPI crashes when running GPAW in parallel, it is recommended to try a :ref:`custom installation ` with a debugging flag in ``customize.py``:: define_macros += [('GPAW_MPI_DEBUG', 1)] ---------------------- Common sources of bugs ---------------------- * General: - Elements of NumPy arrays are C ordered, BLAS and LAPACK routines expect Fortran ordering. * Python: - Always give contiguous arrays to C functions. If ``x`` is contiguous with ``dtype=complex``, then ``x.real`` is non-contiguous of ``dtype=float``. - Giving array arguments to a function is a *carte blanche* to alter the data:: def double(a): a *= 2 return a x = np.ones(5) print double(x) # x[:] is now 2. - Forgetting a ``n += 1`` statement in a for loop:: n = 0 for thing in things: thing.do_stuff(n) n += 1 Use this instead:: for n, thing in enumerate(things): thing.do_stuff(n) - Indentation errors like this one:: if ok: x = 1.0 else: x = 0.5 do_stuff(x) where ``do_stuff(x)`` should have been reached in both cases. Emacs: always use ``C-c >`` and ``C-c <`` for shifting in and out blocks of code (mark the block first). - Don't use mutables as default values:: class A: def __init__(self, a=[]): self.a = a # All instances get the same list! - There are subtle differences between ``x == y`` and ``x is y``. - If ``H`` is a numeric array, then ``H - x`` will subtract ``x`` from *all* elements - not only the diagonal, as in Matlab! * C: - Try building GPAW from scratch. - Typos like ``if (x = 0)`` which should have been ``if (x == 0)``. - Remember ``break`` in switch-case statements. - Check ``malloc-free`` pairs. Test for :ref:`memory leaks ` by repeating the call many times. - Remember to update reference counts of Python objects. - *Never* put function calls inside ``assert``'s. Compiling with ``-DNDEBUG`` will remove the call. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/c_extension.rst000066400000000000000000000047501316441372200250460ustar00rootroot00000000000000.. _c_extension: ============ C extensions ============ The GPAW Python code makes use of some compiled C code in the dynamically linked extension ``_gpaw.so``. In the following it is demonstrated how a C function is made available to Python through a Python extension (more details can be found in the official `Python documentation`_. The wrapper code from ``c/blas.c`` shows how to wrap the two BLAS functions ``daxpy`` and ``zaxpy`` in Python:: PyObject* axpy(PyObject *self, PyObject *args) { PyObject* alpha; PyArrayObject* x; PyArrayObject* y; if (!PyArg_ParseTuple(args, "OOO", &alpha, &x, &y)) return NULL; integer n = x->dimensions[0]; for (int d = 1; d < x->nd; d++) n *= x->dimensions[d]; integer incx = 1; integer incy = 1; if (PyFloat_Check(alpha)) { PyFloatObject* palpha = (PyFloatObject*)alpha; daxpy_(&n, &(palpha->ob_fval), DOUBLEP(x), &incx, DOUBLEP(y), &incy); } else { PyComplexObject* palpha = (PyComplexObject*)alpha; zaxpy_(&n, (doublecomplex*)(&(palpha->cval)), (doublecomplex*)COMPLEXP(x), &incx, (doublecomplex*)COMPLEXP(y), &incy); } Py_RETURN_NONE; } In ``c/_gpaw.c``, we find:: static PyMethodDef functions[] = { {"axpy", axpy, METH_VARARGS, 0}, {0, 0, 0, 0} }; DL_EXPORT(void) init_gpaw(void) { PyObject* m = Py_InitModule3("_gpaw", functions, doc); if (m == NULL) return; import_array(); } We could use the C extension code directly as:: import numpy as np import _gpaw a = 2.7 x = np.array([1.1, 1.2, 1.3]) y = np.zeros(3) _gpaw.axpy(a, x, y) Instead, we wrap the code in a Python function ``axpy`` in the file ``gpaw/utilities/blas.py``:: def axpy(alpha, x, y): assert x.shape == y.shape assert x.flags.contiguous and y.flags.contiguous assert x.dtype == y.dtype if isinstance(alpha, complex): assert x.dtype == complex else: assert isinstance(alpha, float) _gpaw.axpy(alpha, x, y) if not debug: axpy = _gpaw.axpy The Python ``axpy`` function takes care of all value and type checking of the arguments to the function. There is therefore no need to do those checks in the C code (where it would be much more cumbersome to code). If the code is run in production mode (``debug == False``, default), then the Python wrapper function is bypassed for calls to the function. .. _Python documentation: http://docs.python.org/extending/index.html gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/code_count.py000066400000000000000000000047131316441372200244710ustar00rootroot00000000000000# creates: lines.png from __future__ import division import datetime as dt import os import subprocess import numpy as np import pylab as pl def count(dir, pattern): if not os.path.isdir(dir): return 0 files = subprocess.check_output('find {} -name {}'.format(dir, pattern), shell=True).decode().split()[:-1] if not files: return 0 out = subprocess.check_output('wc -l {} | tail -1'.format(' '.join(files)), shell=True) return int(out.split()[0]) def polygon(x, y1, y2, *args, **kwargs): x = pl.concatenate((x, x[::-1])) y = pl.concatenate((y1, y2[::-1])) pl.fill(x, y, *args, **kwargs) def plot_count(dpi=70): year, month, f, c, py, test, doc, rst = np.loadtxt('lines.data').T date = year + (month - 1) / 12 fig = pl.figure(1, figsize=(10, 5), dpi=dpi) ax = fig.add_subplot(111) polygon(date, c + py + test + doc, c + py + test + doc + rst, facecolor='m', label='Documentation (.rst)') polygon(date, c + py + test, c + py + test + doc, facecolor='c', label='Documentation (.py)') polygon(date, c + py, c + py + test, facecolor='y', label='Tests (.py)') polygon(date, c, c + py, facecolor='g', label='Python-code (.py) ') polygon(date, f, c, facecolor='r', label='C-code (.c, .h)') polygon(date, f, f, facecolor='b', label='Fortran-code') pl.axis('tight') pl.legend(loc='upper left') pl.title('Number of lines') pl.savefig('lines.png', dpi=dpi) def count_lines(): now = dt.date.today() stop = now.year, now.month year = 2005 month = 11 fd = open('lines.data', 'w') results = [] while (year, month) <= stop: hash = subprocess.check_output( 'git rev-list -n 1 --before="{}-{}-01 12:00" master' .format(year, month), shell=True).strip() print(year, month, hash) subprocess.call(['git', 'checkout', hash]) c = count('c', '\*.[ch]') py = count('.', '\*.py') test = count('gpaw/test', '\*.py') test += count('test', '\*.py') doc = count('doc', '\*.py') py -= test + doc # avoid double counting rst = count('.', '\*.rst') print(year, month, 0, c, py, test, doc, rst, file=fd) month += 1 if month == 13: month = 1 year += 1 fd.close() plot_count() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/codingstandard.rst000066400000000000000000000006551316441372200255140ustar00rootroot00000000000000.. _codingstandard: ================== Coding Conventions ================== Python Coding Conventions ========================= Follow ASE's :ref:`ase:coding conventions`. C-code ====== Code C in the C99 style:: for (int i = 0; i < 3; i++) { double f = 0.5; a[i] = 0.0; b[i + 1] = f * i; } and try to follow PEP7_. Use **M-x c++-mode** in emacs. .. _PEP7: http://www.python.org/dev/peps/pep-0007 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/communicators.rst000066400000000000000000000001541316441372200254050ustar00rootroot00000000000000.. _communicators: MPI communicators ================= .. autoclass:: gpaw.mpi._Communicator :members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/debugging.rst000066400000000000000000000232441316441372200244620ustar00rootroot00000000000000.. _debugging: ========= Debugging ========= Python debugging ================ Even though some debugging can done just with print statements, a real debugger offers several advantages. It is possible, for example, to set breakpoints in certain files or functions, execute the code step by step, examine and change values of variables. Python contains a standard debugger *pdb*. A script can be started under the debugger control as *python3 -m pdb script.py*. Now before the execution of the script starts one enters the debugger prompt. The most important debugger commands are: h(elp) [command] b(reak) [[filename:]lineno|function[, condition]] Set a breakpoint. s(tep) Execute the current line, stop at the first possible occasion (either in a function that is called or on the next line in the current function). n(ext) Continue execution until the next line in the current function is reached or it returns. r(eturn) Continue execution until the current function returns. c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. l(ist) [first[, last]] List source code for the current file. p expression Evaluate the expression in the current context and print its value. Note: "print" can also be used, but is not a debugger command -- this executes the Python print statement Most commands can be invoked with only the first letter. A full list of all the commands and their explanation can be found in the `Python debugger (PDB) documentation `_. An example session might look like:: corona1 ~/gpaw/trunk/test> python3 -m pdb H.py > /home/csc/jenkovaa/gpaw/trunk/test/H.py(1)?() -> from gpaw import GPAW (Pdb) l 11,5 11 hydrogen.SetCalculator(calc) 12 e1 = hydrogen.GetPotentialEnergy() 13 14 calc.Set(kpts=(1, 1, 1)) 15 e2 = hydrogen.GetPotentialEnergy() 16 equal(e1, e2) (Pdb) break 12 Breakpoint 1 at /home/csc/jenkovaa/gpaw/trunk/test/H.py:12 (Pdb) c ... output from the script... > /home/csc/jenkovaa/gpaw/trunk/test/H.py(12)?() -> e1 = hydrogen.GetPotentialEnergy() (Pdb) s --Call-- > /v/solaris9/appl/chem/CamposASE/ASE/ListOfAtoms.py(224)GetPotentialEnergy() -> def GetPotentialEnergy(self): (Pdb) p self [Atom('H', (2.0, 2.0, 2.0))] Emacs has a special mode for Python debugging which can be invoked as *M-x pdb*. After that one has to give the command to start the debugger (e.g. python3 -m pdb script.py). Emacs opens two windows, one for the debugger command prompt and one which shows the source code and the current point of execution. Breakpoints can be set also on the source-code window. C debugging =========== First of all, the C-extension should be compiled with the *-g* flag in order to get the debug information into the library. Also, the optimizations should be switched off which could be done in :ref:`customize.py ` as:: extra_link_args += ['-g'] extra_compile_args += ['-O0', '-g'] There are several debuggers available, the following example session applies to *gdb*:: sepeli ~/gpaw/trunk/test> gdb python GNU gdb Red Hat Linux (6.1post-1.20040607.52rh) (gdb) break Operator_apply Function "Operator_apply" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (Operator_apply) pending. (gdb) run H.py Starting program: /usr/bin/python2.4 H.py ... output ... Breakpoint 2, Operator_apply (self=0x2a98f8f670, args=0x2a9af73b78) at c/operators.c:83 (gdb) One can also do combined C and Python debugging by starting the input script as ``run -m pdb H.py`` i.e:: sepeli ~/gpaw/trunk/test> gdb python GNU gdb Red Hat Linux (6.1post-1.20040607.52rh) (gdb) break Operator_apply Function "Operator_apply" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (Operator_apply) pending. (gdb) run -m pdb H.py Starting program: /usr/bin/python2.4 -m pdb H.py [Thread debugging using libthread_db enabled] [New Thread -1208371520 (LWP 1575)] > /home/jenkovaa/test/H.py(1)?() -> from gpaw import GPAW (Pdb) The basic gdb commands are the same as in pdb (or vice versa). Full documentation can be found in the `GDB user manual `_. Apart from the commands mentioned earlier, a few are worthy of mention here: backtrace [n | full] Print a backtrace of the entire stack: one line per frame for all frames in the stack ``full`` prints the values of the local variables also. ``n`` specifies the number of frames to print jump linespec Resume execution at line ``linespec`` i.e. at the given location in the corresponding source code. Any location of the type ``filename:linenum`` will do, but the results may be bizarre if ``linespec`` is in a different function from the one currently executing. tbreak [[filename:]lineno|function[, condition]] Set a breakpoint similar to how ``break`` operates, but this type of breakpoint is automatically deleted after the first time your program stops there. p(rint) expr Inquire about the symbols (names of variables, functions and types) defined in a compiled program. ``expr`` may include calls to functions in the program being debugged. Can also be used to evaluate more complicated expressions or referring to static variables in other source files as ``'foo.c'::x``. .. hint:: Emacs can be used also with gdb. Start with *M-x gdb* and then continue as when starting from the command line. .. _memory_leaks: Tracking memory leaks --------------------- Although a C-extensions runs fine, or so it seems, reference counting of Python objects and matching calls to ``malloc`` and ``free`` may not always be up to par. Frequently, the symptom of such disproportions is all too clear, resulting in segmentation faults (i.e. ``SIGSEGV``) e.g. when a memory address is accessed before it has been allocated or after is has been deallocated. Such situations can be debugged using *gdb* as described above. .. note:: Please refer to the Python/C API Reference Manual or the unofficial (but helpful) introduction to `reference counting in Python `_. On the other hand, neglecting the deallocation or forgetting to decrease the reference count of a Python object will lead to a build-up of unreachable memory blocks - a process known as memory leakage. Despite being non-critical bugs, severe memory leaks in C-code will eventually bring all computations to a halt when the program runs out of available memory. Suppose you have written a Python script called ``test.py`` which appears to suffer from memory leaks. Having build GPAW with the *-g* flag as described, tracking down the source of the memory leak (in this case line 123 of ``myfile.c``) can be done using Valgrind_ as follows:: sepeli ~/gpaw/trunk/test> valgrind --tool=memcheck --leak-check=yes \ --show-reachable=yes --num-callers=20 --track-fds=yes gpaw-python test.py ==16442== 6,587,460 bytes in 29,943 blocks are definitely lost in loss record 85 of 85 ==16442== at 0x40053C0: malloc (vg_replace_malloc.c:149) ==16442== by 0x5322831: ??? ==16442== by 0x8087BD5: my_leaky_function (myfile.c:123) Note that Valgrind_ is more than just a memory profiler for C; it provides an entire instrumentation framework for building dynamic analysis tools and thus includes other debugging tools, e.g. a heap/stack/global array overrun detector. .. _Valgrind: http://valgrind.org .. _parallel_debugging: Parallel debugging ================== Debugging programs that are run in parallel with MPI is not as straight forward as in serial, but many of the same tools can be used (e.g. GDB and Valgrind). Note that one cannot use the Python debugger as described above because GPAW requires that a custom Python interpreter is built with the necessary MPI bindings. There are probably numerous ways to debug an MPI application with GDB, and experimentation is strongly encouraged, but the following method is recommended for interactive debugging. This approach builds upon advice in Open MPI's FAQ `Debugging applications in parallel `_, but is adapted for use with Python on a GNU/Linux development platform. Prepend the following to your script:: import os, sys, time, math from gpaw.mpi import world from gpaw import get_gpaw_python_path gpaw_python_path = os.path.join(get_gpaw_python_path(), 'gpaw-python') ndigits = 1 + int(math.log10(world.size)) assert os.system('screen -S gdb.%0*d -dm gdb %s %d' \ % (ndigits, world.rank, gpaw_python_path, os.getpid())) == 0 time.sleep(ndigits) world.barrier() This runs ``gdb /path/to/gpaw-python pid`` from within each instance of the custom Python interpreter and detaches it into a `screen `_ session called ``gdb.0`` for rank 0 etc. You may now resume control of the debugger instances by running ``screen -rd gdb.0``, entering `c` to continue and so forth for all instances. .. hint:: Run ``screen -ls`` to get an overview of running sessions. Enable logging of an attached session with Ctrl+a H (capital H). Use Ctrl+a Ctrl+d to detach a session but leave it running. .. note:: This approach only works if the problem you're trying to address occurs *after* the GPAW executable has been loaded. In the alternate case, it is recommended to debug a single instance of the parallel program with the usual serial methods first. For details on using Valgrind on parallel programs, please refer to the online manual `Debugging MPI Parallel Programs with Valgrind `_ gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/density_and_hamiltonian.rst000066400000000000000000000002541316441372200274070ustar00rootroot00000000000000Density and hamiltonian objects =============================== .. autoclass:: gpaw.density.Density :members: .. autoclass:: gpaw.hamiltonian.Hamiltonian :members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/devel.rst000066400000000000000000000046661316441372200236350ustar00rootroot00000000000000.. _devel: =========== Development =========== GPAW development can be done by anyone! Just take a look at the `issue tracker`_ and find something that suits your talents! The primary source of information is still the :ref:`manual` and :ref:`documentation`, but as a developer you might need additional information which can be found here. For example the :ref:`code_overview`. As a developer, you should subscribe to the GPAW :ref:`mail list`. We would also like to encourage you to join our channel for :ref:`irc`. Now you are ready to to perfom a :ref:`developer installation` and start development! .. _issue tracker: https://gitlab.com/gpaw/gpaw/issues/ .. toctree:: :maxdepth: 2 projects/projects developer_installation .. note --- below toctrees are defined in separate files to make sure that the line spacing doesn't get very large (which is of course a bad hack) Development topics ================== When committing significant changes to the code, remember to add a note in the :ref:`releasenotes` at the top (development version) - the version to become the next release. .. toctree:: :maxdepth: 1 codingstandard c_extension writing_documentation formulas debugging profiling testing ase_optimize/ase_optimize bugs newrelease technology benchmarks * Details about supported :ref:`platforms and architectures`. .. _PyLint: http://www.logilab.org/857 .. _the_big_picture: .. _code_overview: Code Overview ============= Keep this :download:`picture ` under your pillow: .. image:: bigpicture.png :target: ../_downloads/bigpicture.svg The developer guide provides an overview of the PAW quantities and how the corresponding objects are defined in the code: .. toctree:: :maxdepth: 2 overview developersguide proposals/proposals paw symmetry wavefunctions setups density_and_hamiltonian planewaves communicators others The GPAW logo ============= The GPAW-logo is available as an svg-file: :download:`gpaw-logo.svg`. .. image:: gpaw-logo.svg Statistics ========== The image below shows the development in the volume of the code as per April 5 2016. .. image:: lines.png *Documentation* refers solely the contents of this homepage. Inline documentation is included in the other line counts. Contributing to GPAW ==================== Getting commit access to the GPAW code works the same way as for the :ref:`ASE project `. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/developer_installation.rst000066400000000000000000000022401316441372200272660ustar00rootroot00000000000000.. _developer installation: ====================== Developer installation ====================== Start by :ref:`forking and cloning as it is done for ASE develoment `. Let ```` be the folder where you have cloned to (could be ``~/gpaw``). Then do:: $ cd $ python3 setup.py build_ext This will build two things: 1) :file:`_gpaw.so`: A shared library for serial calculations containing GPAW's C-extension module. The module will be in :file:`/build/lib.-X.Y/`. For example ```` could be *linux-x86_64*, and ``X.Y`` could be *2.7*. 2) :file:`gpaw-python`: A special Python interpreter for parallel calculations. The interpreter has GPAW's C-code built in. The :file:`gpaw-python` executable is located in :file:`/build/bin.-X.Y/`. .. note:: The :file:`gpaw-python` interpreter will be built only if :git:`setup.py` finds an ``mpicc`` compiler. Prepend :file:`` and :file:`/build/lib.-X.Y/` onto your :envvar:`PYTHONPATH` and :file:`/tools:/build/bin.-X.Y` onto :envvar:`PATH` as described here: :ref:`envvars`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/developersguide.rst000066400000000000000000000255741316441372200257250ustar00rootroot00000000000000.. _developersguide: ======================== Developers guide to GPAW ======================== XXX Update page to new GPAW style (after guc merge) and mention NewLFCs. This page goes through the most important equations of a PAW calculation and has references to the code. It is a good idea to have :ref:`the big picture ` in front of you when reading this page. * Initial wave functions and densities (todo) * Finding the ground state (todo) * ... Wave functions ============== The central quantities in a PAW calculation are the pseudo wave-functions, `\tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r})`, from which the all-electron wave functions can be obtained: .. math:: \psi_{\sigma\mathbf{k}n}(\mathbf{r}) = \tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r}) + \sum_a \sum_i [\phi_i^a(\mathbf{r} - \mathbf{R}^a) - \tilde{\phi}_i^a(\mathbf{r} - \mathbf{R}^a)] \langle\tilde{p}_i^a | \tilde{\psi}_{\sigma\mathbf{k}n} \rangle, where .. math:: \langle\tilde{p}_i^a | \tilde{\psi}_{\sigma\mathbf{k}n} \rangle = \int d\mathbf{r} \tilde{p}_i^a(\mathbf{r} - \mathbf{R}^a) \tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r}). Here, `a` is the atom number, `\mathbf{R}^a` is the position of atom number `a` and `\tilde{p}_i^a`, `\tilde{\phi}_i^a` and `\phi_i^a` are the projector functions, pseudo partial waves, and all-electron partial waves respectively, of the atoms. See :ref:`overview_array_naming` for more information on the naming of arrays. Note that ``spos_c`` gives the position of the atom in scaled coordinates in the range [0:1[ (relative to the unit cell). Note, that in the code, ``i`` refers to `n`, `\ell` and `m` quantum numbers, and ``j`` refers to `n` and `\ell` only (see :ref:`overview_array_naming`). So, to put an atom-centered function like `\tilde{p}_{n\ell m}^a(\mathbf{r})` on the 3D grid, you need both the radial part `\tilde{p}_{n\ell}^a(r)` (one of the splines in ``paw.wfs.setups[a].pt_j``) and a spherical harmonics `Y_{\ell m}(\theta,\phi)`. Putting radial functions times spherical harmonics on a grid is done by the :class:`gpaw.lfc.NewLocalizedFunctionsCollection` class. See also :class:`gpaw.setup.Setup` and :class:`gpaw.spline.Spline`. .. _orthogonality: The wave-functions are othonormalized such that the pseudo wave-functions obey the following orthogonality requirements: .. math:: \langle \psi_{\sigma\mathbf{k}n} | \psi_{\sigma\mathbf{k}m} \rangle = \langle \tilde{\psi}_{\sigma\mathbf{k}n} | \hat{O} | \tilde{\psi}_{\sigma\mathbf{k}m} \rangle = \delta_{nm}, , where `\hat{O}` is the overlap operator in the PAW formalism. Refer to :ref:`Orthogonalizing the wave functions ` for details. .. _overlaps: Overlaps ========= The overlap operator is defined in terms of the PAW overlap corrections: .. math:: \hat{O} = 1 + \sum_a \sum_{i_1 i_2} |\tilde{p}_{i_1}^a\rangle \Delta O_{i_1 i_2}^a \langle\tilde{p}_{i_2}^a|. The constants `\Delta O_{i_1 i_2}^a` are found in ``paw.wfs.setups[a].dO_ii`` (``ndarray``). XXX Someone should rename ``dO_ii`` to ``dS_ii`` or `\hat{S}` to `\hat{O}`. .. math:: \Delta O_{i_1 i_2}^a = \int d\mathbf{r} [\phi_{i_1}^a(\mathbf{r})\phi_{i_2}^a(\mathbf{r}) - \tilde{\phi}_{i_1}^a(\mathbf{r})\tilde{\phi}_{i_2}^a(\mathbf{r})]. An approximate inverse overlap operator is similarly defined by: .. math:: \hat{O}^{\;-1}_\mathrm{approx.} = 1 + \sum_a \sum_{i_1 i_2} |\tilde{p}_{i_1}^a\rangle \Delta C_{i_1 i_2}^a \langle\tilde{p}_{i_2}^a|. The inverse overlap coefficients `\Delta C_{i_1 i_2}^a` are found in ``setup.dC_ii`` (``ndarray``) and are solutions to the system of linear equations: .. math:: \Delta C_{i_1 i_2}^a + \Delta O_{i_1 i_2}^a + \sum_{i_3 i_4} \Delta C_{i_1 i_3}^a B_{i_3 i_4}^a \Delta O_{i_4 i_2}^a = 0 \qquad ,\forall i_1,i_2 , such that `\hat{O}^{\;-1}_\mathrm{approx.}\hat{O} = \hat{I}` provided `\langle\tilde{p}_{i_1}^a|\tilde{p}_{i_2}^{a'}\rangle = \delta_{a a'} \langle\tilde{p}_{i_1}^a|\tilde{p}_{i_2}^{a}\rangle`. These projector overlaps `B_{i_1 i_2}^a = \langle\tilde{p}_{i_1}^a|\tilde{p}_{i_2}^{a}\rangle` are likewise found in ``setup.B_ii``. .. _density: Densities ========= From the pseudo wave-functions, the pseudo electron spin-densities can be constructed (see `here `_): .. math:: \tilde{n}_\sigma(\mathbf{r}) = \frac{1}{N_s} \sum_{s=1}^{N_s} \hat{S}_s \left [ \sum_{n\mathbf{k}} f_{n\mathbf{k}\sigma} |\tilde{\psi}_{n\mathbf{k}\sigma}(\mathbf{r})|^2 + \frac{1}{2} \sum_a \tilde{n}_c^a(|\mathbf{r}-\mathbf{R}^a|) \right ]. Here, `\hat{S}_s` is one of the `N_s` symmetry operators of the system (see :class:`gpaw.symmetry.Symmetry`), `f_{n\mathbf{k}\sigma}` are the occupation numbers (adding up to the number of valence elctrons), and `\tilde{n}_c^a(r)` is the pseudo core density for atom number `a`. The all-electron spin-densities are given as: .. math:: n_\sigma(\mathbf{r}) = \tilde{n}_\sigma(\mathbf{r}) + \sum_a [n_\sigma^a(\mathbf{r} - \mathbf{R}^a) - \tilde{n}_\sigma^a(\mathbf{r} - \mathbf{R}^a)], where .. math:: n_\sigma^a(\mathbf{r}) = \sum_{i_1 i_2} D_{\sigma i_1 i_2}^a \phi_{i_1}^a(\mathbf{r})\phi_{i_2}^a(\mathbf{r}) + \frac{1}{2} n_c^a(r), .. math:: \tilde{n}_\sigma^a(\mathbf{r}) = \sum_{i_1 i_2} D_{\sigma i_1 i_2}^a \tilde{\phi}_{i_1}^a(\mathbf{r})\tilde{\phi}_{i_2}^a(\mathbf{r}) + \frac{1}{2} \tilde{n}_c^a(r), are atom centered expansions, and .. math:: D_{\sigma i_1 i_2}^a = \sum_{n\mathbf{k}} \langle \tilde{\psi}_{\sigma\mathbf{k}n} | \tilde{p}_{i_1}^a \rangle f_{n\mathbf{k}\sigma} \langle \tilde{p}_{i_2}^a | \tilde{\psi}_{\sigma\mathbf{k}n} \rangle is an atomic spin-density matrix, which must be symmetrized the same way as the pseudo electron spin-densities. .. list-table:: * - formula - object - type * - `\hat{S}_s` - ``paw.wfs.symmetry`` - :class:`gpaw.symmetry.Symmetry` * - `\tilde{n}_\sigma` - ``paw.density.nt_sG`` and ``paw.density.nt_sg`` - ``ndarray`` * - `\tilde{n}=\sum_\sigma\tilde{n}_\sigma` - ``paw.density.nt_g`` - ``ndarray`` * - `\tilde{n}_c^a(r)` - ``paw.wfs.setups[a].nct`` - :class:`gpaw.spline.Spline` * - `\tilde{n}_c^a(\mathbf{r}-\mathbf{R}^a)` - ``paw.density.nct`` - :class:`gpaw.lfc.NewLocalizedFunctionsCollection` * - `f_{\sigma\mathbf{k}n}` - ``paw.wfs.kpt_u[u].f_n`` - ``ndarray`` * - `D_{\sigma i_1 i_2}^a` - ``paw.density.D_asp[a]`` - ``ndarray`` From the all-electron and pseudo electron densities we can now construct corresponding total all-electron and pseudo charge densities: .. math:: \rho(\mathbf{r}) = \sum_\sigma n_\sigma(\mathbf{r}) + \sum_a Z^a(\mathbf{r} - \mathbf{R}^a), .. math:: \tilde{\rho}(\mathbf{r}) = \sum_\sigma \tilde{n}_\sigma(\mathbf{r}) + \sum_a \tilde{Z}^a(\mathbf{r} - \mathbf{R}^a). If `\mathbb{Z}^a` is the atomic number of atom number `a`, then `Z^a(\mathbf{r})=-\mathbb{Z}^a\delta(\mathbf{r})` (we count the electrons as positive charge and the protons as negative charge). The compensation charges are given as: .. math:: \tilde{Z}^a(\mathbf{r}) = \sum_{\ell=0}^{\ell_{\text{max}}} \sum_{m=-\ell}^\ell Q_{\ell m}^a \hat{g}_{\ell m}^a(\mathbf{r}) = \sum_{\ell=0}^{\ell_{\text{max}}} \sum_{m=-\ell}^\ell Q_{\ell m}^a \hat{g}_\ell^a(r) Y_{\ell m}(\theta,\phi), where `\hat{g}_\ell^a(r)\propto r^\ell\exp(-\alpha^a r^2)` are Gaussians. The compensation charges should make sure that the two atom centered densities `\rho^a=\sum_\sigma n_\sigma^a + Z^a` and `\tilde{\rho}^a=\sum_\sigma \tilde{n}_\sigma^a + \tilde{Z}^a` have identical multipole expansions outside the augmentation sphere. This gives the following equation for `Q_L^a`: .. math:: Q_L^a = \sum_{i_1 i_2} \Delta_{i_1 i_2 L}^a \sum_\sigma D_{\sigma i_1 i_2}^a + \Delta_0^a \delta_{\ell,0}, where .. math:: \Delta_{i_1 i_2 L}^a = \int d\mathbf{r} Y_L(\hat{\mathbf{r}}) r^\ell [\phi_{i_1}^a(\mathbf{r})\phi_{i_2}^a(\mathbf{r}) - \tilde{\phi}_{i_1}^a(\mathbf{r})\tilde{\phi}_{i_2}^a(\mathbf{r})], .. math:: \Delta_0^a = \int d\mathbf{r} Y_{00}(\hat{\mathbf{r}}) [-\mathbb{Z}^a \delta(\mathbf{r}) + n_c^a(\mathbf{r}) - \tilde{n}_c^a(\mathbf{r})]. .. list-table:: * - formula - object - type * - `\tilde{\rho}` - ``paw.density.rhot_g`` - ``ndarray`` * - `\mathbb{Z}^a` - ``setup.Z`` - ``int`` * - `\Delta_{i_1 i_2 L}^a` - ``setup.Delta_pL`` - ``ndarray`` * - `\Delta_0^a` - ``setup.Delta0`` - ``float`` * - `\hat{g}_\ell^a(r)` - ``setup.ghat_l`` - List of :class:`gpaw.spline.Spline`\ s * - `\hat{g}_L^a(\mathbf{r}-\mathbf{R}^a)` - ``paw.density.ghat`` - :class:`gpaw.lfc.NewLocalizedFunctionsCollection` * - `Q_L^a` - ``paw.density.Q_aL[a]`` - ``ndarray`` .. _developersguide_total_energy: The total energy ================ The total PAW energy is composed of a smooth part evaluated using pseudo quantities on the 3D grid, plus corrections for each atom evaluated on radial grids inside the augmentation spheres: `E=\tilde{E}+\sum_a(E^a - \tilde{E}^a)`. .. math:: \tilde{E} &= -\frac{1}{2} \sum_{\sigma\mathbf{k}n} f_{\sigma\mathbf{k}n} \int d\mathbf{r} \tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r}) \nabla^2 \tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r}) + \frac{1}{2}\int d\mathbf{r}d\mathbf{r}' \frac{\tilde{\rho}(\mathbf{r})\tilde{\rho}(\mathbf{r}')} {|\mathbf{r}-\mathbf{r}'|} \\ &\quad+ \sum_\sigma\sum_a\int d\mathbf{r}\tilde{n}_\sigma(\mathbf{r}) \bar{v}^a(|\mathbf{r}-\mathbf{R}^a|) + E_{\text{xc}}[\tilde{n}_\uparrow, \tilde{n}_\downarrow] % %.. math:: % \\ E^a &= -\frac{1}{2} 2\sum_i^{\text{core}} \int d\mathbf{r} \phi_i^a(\mathbf{r}) \nabla^2 \phi_i^a(\mathbf{r}) -\frac{1}{2} \sum_\sigma \sum_{i_1 i_2} D_{\sigma i_1 i_2}^a \int d\mathbf{r} \phi_{i_1}^a(\mathbf{r}) \nabla^2 \phi_{i_2}^a(\mathbf{r}) \\ &\quad+ \frac{1}{2}\int d\mathbf{r}d\mathbf{r}' \frac{\rho^a(\mathbf{r})\rho^a(\mathbf{r}')} {|\mathbf{r}-\mathbf{r}'|} + E_{\text{xc}}[n^a_\uparrow, n^a_\downarrow] % %.. math:: % \\ \tilde{E}^a &= -\frac{1}{2} \sum_\sigma\sum_{i_1 i_2} D_{\sigma i_1 i_2}^a \int d\mathbf{r} \tilde{\phi}_{i_1}^a(\mathbf{r}) \nabla^2 \tilde{\phi}_{i_2}^a(\mathbf{r}) + \frac{1}{2}\int d\mathbf{r}d\mathbf{r}' \frac{\tilde{\rho}^a(\mathbf{r})\tilde{\rho}^a(\mathbf{r}')} {|\mathbf{r}-\mathbf{r}'|} \\ &\quad+ \sum_\sigma \int d\mathbf{r}\tilde{n}^a_\sigma(\mathbf{r}) \bar{v}^a(r) + E_{\text{xc}}[\tilde{n}^a_\uparrow, \tilde{n}^a_\downarrow] In the last two equations, the integrations are limited to inside the augmentation spheres only. The electrostatic energy part of `\tilde{E}` is calculated as `\frac{1}{2}\int d\mathbf{r}\tilde{v}_H(\mathbf{r})\tilde{\rho}(\mathbf{r})`, where the Hartree potential is found by solving Poissons equation: `\nabla^2 \tilde{v}_H(\mathbf{r})=-4\pi\tilde{\rho}(\mathbf{r})` (see :class:`gpaw.poisson.FDPoissonSolver`). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/eigenvalues_of_core_states.rst000066400000000000000000000035131316441372200301120ustar00rootroot00000000000000.. _eigenvalues_of_core_states: ========================== Eigenvalues of core states ========================== Calculating eigenvalues for core states can be useful for XAS, XES and core-level shift calculations. The eigenvalue of a core state `k` with a wave function `\phi_k^a(\mathbf{r})` located on atom number `a`, can be calculated using this formula: .. math:: \epsilon_k = \frac{\partial E}{\partial f_k} = \frac{\partial}{\partial f_k}(\tilde{E} - \tilde{E}^a + E^a), where `f_k` is the occupation of the core state. When `f_k` is varied, `Q_L^a` and `n_c^a(r)` will also vary: .. math:: \frac{\partial Q_L^a}{\partial f_k} = \int d\mathbf{r} Y_{00} [\phi_k^a(\mathbf{r})]^2 \delta_{\ell,0} = Y_{00}, .. math:: \frac{\partial n_c^a(r)}{\partial f_k} = [\phi_k^a(\mathbf{r})]^2. Using the PAW expressions for the :ref:`energy contributions`, we get: .. math:: \frac{\partial \tilde{E}}{\partial f_k} = Y_{00} \int d\mathbf{r} \int d\mathbf{r}' \frac{\tilde{\rho}(\mathbf{r}') \hat{g}_{00}^a(\mathbf{r} - \mathbf{R}^a)} {|\mathbf{r} - \mathbf{r}'|} = Y_{00} \int d\mathbf{r} \tilde{v}_H(\mathbf{r}) \hat{g}_{00}^a(\mathbf{r} - \mathbf{R}^a), .. math:: \frac{\partial \tilde{E}^a}{\partial f_k} = Y_{00} \int_{r` for details. So, the all-electron potential is: .. math:: v_H(\mathbf{r}) = \tilde{v}_H(\mathbf{r}) + \sum_a \Delta\tilde{v}_H^a(\mathbf{r} - \mathbf{R}^a) and .. math:: \Delta\tilde{v}_H^a(\mathbf{r}) = \int d\mathbf{r}' \frac{\Delta\tilde{\rho}^a(\mathbf{r}')} {|\mathbf{r}-\mathbf{r}'|}. Notice that the `Q_{\ell m}^a` have been chosen so that all multipole moments of `\Delta\tilde{\rho}^a` are zero and therefore, the potential from these correction charges (`\Delta\tilde{v}_H^a`) will be non-zero only inside the atomic augmentation spheres. The :meth:`~gpaw.calculator.GPAW.get_electrostatic_corrections` method will return an array of integrated corrections: .. math:: \int d\mathbf{r} \Delta\tilde{v}_H^a(\mathbf{r}) in units of eV Å\ :sup:`3`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/formulas.rst000066400000000000000000000071221316441372200243540ustar00rootroot00000000000000======== Formulas ======== Coulomb ======= .. math:: \frac{1}{|\br-\br'|} = \sum_\ell \sum_{m=-\ell}^\ell \frac{4\pi}{2\ell+1} \frac{r_<^\ell}{r_>^{\ell+1}} Y_{\ell m}^*(\hat\br) Y_{\ell m}(\hat\br') or .. math:: \frac{1}{r} = \int \frac{d\mathbf{G}}{(2\pi)^3}\frac{4\pi}{G^2} e^{i\mathbf{G}\cdot\br}. Fourier transforms ================== The Fourier transform of a radial function multiplied by a spherical harmonic is: .. math:: f(G)Y_{\ell m}(\hat G) = \int d\br e^{i\mathbf{G}\cdot\br} f(r)Y_{\ell m}(\br), where .. math:: f(G) = 4\pi i^\ell \int_0^\infty r^2 dr j_\ell(Gr) f(r). .. note:: .. math:: e^{i \mathbf{G} \cdot \br} = 4 \pi \sum_{\ell m} i^\ell j_\ell(Gr) Y_{\ell m}(\hat{\br}) Y_{lm}(\hat{\mathbf{G}}). The `spherical Bessel function`_ is defined as: .. math:: j_\ell(x) = \text{Re}\{ \frac{e^{ix}}{x} \sum_{n=0}^\ell \frac{(-i)^{\ell+1-n}}{n!(2x)^n} \frac{(\ell+n)!}{(\ell-n)!} \}. This is implemented in this function: .. autofunction:: gpaw.atom.radialgd.fsbt .. _spherical Bessel function: http://en.wikipedia.org/wiki/Bessel_function #Spherical_Bessel_functions:_jn.2C_yn Gaussians ========= .. math:: n(r) = (\alpha/\pi)^{3/2} e^{-\alpha r^2}, .. math:: \int_0^\infty 4\pi r^2 dr n(r) = 1 Its Fourier transform is: .. math:: n(k) = \int d\br e^{i\mathbf{k}\cdot\br} n(r) = \int_0^\infty 4\pi r^2 dr \frac{\sin(kr)}{kr} n(r) = e^{-k^2/(4a)}. With `\nabla^2 v=-4\pi n`, we get the potential: .. math:: v(r) = \frac{\text{erf}(\sqrt\alpha r)}{r}, and the energy: .. math:: \frac12 \int_0^\infty 4\pi r^2 dr n(r) v(r) = \sqrt{\frac{\alpha}{2\pi}}. Note: `\text{erf}(x) \simeq x\sqrt{4/\pi}` for small `x`. Shape functions --------------- GPAW uses Gaussians as shape functions for the PAW compensation charges: .. math:: g_{\ell m}(\br) = \frac{\alpha^{\ell + 3 / 2} \ell ! 2^{2\ell + 2}} {\sqrt{\pi} (2\ell + 1) !} e^{-\alpha r^2} Y_{\ell m}(\hat{\br}). They are normalized as: .. math:: \int d \br g_{\ell m}(\br) Y_{\ell m}(\hat{\br}) r^\ell = 1. Hydrogen ======== The 1s orbital: .. math:: \psi_{\text{1s}}(r) = 2Y_{00} e^{-r}, and the density is: .. math:: n(r) = |\psi_{\text{1s}}(r)|^2 = e^{-2r}/\pi. Radial Schrödinger equation =========================== With `\psi_{n\ell m}(\br) = u(r) / r Y_{\ell m}(\hat\br)`, we have the radial Schrödinger equation: .. math:: -\frac12 \frac{d^2u}{dr^2} + \frac{\ell(\ell + 1)}{2r^2} u + v u = \epsilon u. We want to solve this equation on a non-equidistant radial grid with `r_g=r(g)` for `g=0,1,...`. Inserting `u(r) = a(g) r^{\ell+1}`, we get: .. math:: \frac{d^2 a}{dg^2} (\frac{dg}{dr})^2 r^2 + \frac{da}{dg}(r^2 \frac{d^2g}{dr^2} + 2 (\ell+1) r \frac{dg}{dr}) - 2 r^2 (v - \epsilon) a = 0. Including Scalar-relativistic corrections ----------------------------------------- The scalar-relativistic equation is: .. math:: -\frac{1}{2 M} \frac{d^2u}{dr^2} + \frac{\ell(\ell + 1)}{2Mr^2} u - \frac{1}{(2Mc)^2}\frac{dv}{dr}(\frac{du}{dr}-\frac{u}{r}) + v u = \epsilon u. where the relativistic mass is: .. math:: M = 1 - \frac{1}{2c^2} (v - \epsilon). With `u(r) = a(g) r^\alpha`, `\kappa = (dv/dr)/(2Mc^2)` and .. math:: \alpha = \sqrt{\ell^2 + \ell + 1 -(Z/c)^2}, we get: .. math:: \frac{d^2 a}{dg^2} (\frac{dg}{dr})^2 r^2 + \frac{da}{dg}(r^2 \kappa \frac{dg}{dr} + r^2 \frac{d^2g}{dr^2} + 2 \alpha r \frac{dg}{dr}) + [2 M r^2 (\epsilon - v) + \alpha (\alpha - 1) - \ell (\ell + 1) + \kappa (\alpha - 1) r] a = 0. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/gpaw-logo.svg000066400000000000000000000322551316441372200244140ustar00rootroot00000000000000 image/svg+xml gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/grids.rst000066400000000000000000000025331316441372200236350ustar00rootroot00000000000000.. _grids: ===== Grids ===== Assume that we have an ``Atoms`` object contained in a cubic unit cell of sidelength ``L``:: L = 2.0 atoms = Atoms(cell=(L, L, L), pbc=True) and we use a calculator with a grid spacing of ``h=0.25`` Å or ``gpts=(8, 8, 8)``. Since we have periodic boundary conditions, the *x*-axis will look like this (the *y* and *z*-axes look the same):: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 -+---------------+---------------+---------------+- -L 0 L 2*L Wave functions are represented on 8x8x8 grids, where the grid points are numbered from 0 to 7. If we use zero boundary conditions (``pbc=False``), then the *x*-axis will look like this:: 0 1 2 3 4 5 6 +---------------+ 0 L Here the wave functions are exactly zero at *x*\ =0 Å and *x*\ =\ *L*, and only the non-zero values are stored in 7x7x7 grids (grid points numbered from 0 to 6). Update this XXX how about padding? An example: >>> L = 2.0 >>> atoms = Atoms(..., ... cell=(L, L, L), ... pbc=False) >>> calc = GPAW(..., gpts=(8, 8, 8)) >>> atoms.SetCalculator(calc) >>> e = atoms.get_potential_energy() >>> wf = calc.get_pseudo_wave_function(band=0) >>> wf.shape (7, 7, 7) >>> calc.GetGridSpacings() array([ 0.25, 0.25]) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/lines.data000066400000000000000000000122331316441372200237360ustar00rootroot000000000000002005 11 0 4112 12144 1067 0 0 2005 12 0 4285 12817 1162 0 0 2006 1 0 4375 14474 1187 0 0 2006 2 0 5165 13659 1327 0 0 2006 3 0 5176 14084 1443 0 0 2006 4 0 5255 14581 1446 0 0 2006 5 0 5050 15628 1470 0 0 2006 6 0 5056 15810 1462 0 0 2006 7 0 5518 16068 1464 0 0 2006 8 0 5553 15649 1500 0 0 2006 9 0 5557 16212 1501 0 0 2006 10 0 5635 16514 1537 0 0 2006 11 0 5713 16279 1583 0 0 2006 12 0 6419 16371 1614 0 0 2007 1 0 6630 17646 1777 0 0 2007 2 0 6916 18576 1884 0 0 2007 3 0 6916 18941 1884 0 0 2007 4 0 6917 19017 2017 0 0 2007 5 0 6944 20981 2086 0 0 2007 6 0 6973 25241 2255 0 0 2007 7 0 7096 27413 2358 0 0 2007 8 0 11947 28371 2556 0 0 2007 9 0 12031 29365 2712 0 0 2007 10 0 12186 31796 2919 0 0 2007 11 0 12248 33088 3171 0 0 2007 12 0 14561 35874 3581 0 0 2008 1 0 14611 36558 3875 0 0 2008 2 0 14762 36424 4340 0 0 2008 3 0 15673 38394 4464 0 0 2008 4 0 15759 38508 4478 0 0 2008 5 0 15817 39397 4763 0 0 2008 6 0 17530 41853 4807 0 0 2008 7 0 17685 44125 5017 273 416 2008 8 0 17859 45332 5093 1377 7591 2008 9 0 17874 44876 5178 2630 7671 2008 10 0 18085 45641 5180 2636 7791 2008 11 0 19452 46470 5375 2669 8393 2008 12 0 19510 47082 5741 2671 8628 2009 1 0 19551 48552 5949 3166 9142 2009 2 0 19570 46208 6062 3166 9204 2009 3 0 20465 47744 7401 3912 9685 2009 4 0 21404 50424 8274 4122 10078 2009 5 0 21542 52380 8963 4126 10088 2009 6 0 21524 53744 9502 4245 10715 2009 7 0 22602 58219 10935 4322 11291 2009 8 0 23222 65960 12504 4525 11668 2009 9 0 23514 67590 13525 4650 11720 2009 10 0 23553 65054 14287 4846 11828 2009 11 0 24355 66768 13531 5323 11937 2009 12 0 24884 70942 14120 5400 12228 2010 1 0 25855 71482 14584 5430 12357 2010 2 0 25708 74149 14092 5673 12879 2010 3 0 26464 75996 14936 5956 13348 2010 4 0 27336 77515 15123 6593 13452 2010 5 0 27372 80843 14878 6759 14035 2010 6 0 27378 83352 14802 7077 14240 2010 7 0 27459 79436 14999 8264 15221 2010 8 0 27545 81829 15184 8430 15623 2010 9 0 26392 82715 16044 8432 16089 2010 10 0 26395 83125 16057 8479 16155 2010 11 0 26033 82637 16130 8474 16376 2010 12 0 25221 82622 16940 8627 16684 2011 1 0 25326 82599 17221 8773 16786 2011 2 0 25340 78040 18593 8919 17664 2011 3 0 25356 78438 18781 9026 17965 2011 4 0 25357 79170 18931 9031 17999 2011 5 0 25935 79237 18799 9026 17977 2011 6 0 24564 80568 19180 9764 19098 2011 7 0 24613 81593 19376 9809 19157 2011 8 0 24613 82307 19528 9856 19587 2011 9 0 24613 82615 19631 9904 18880 2011 10 0 25230 83710 20014 9905 18987 2011 11 0 25218 84349 20094 10105 19185 2011 12 0 25515 85457 20311 10149 19182 2012 1 0 25515 86474 21163 10183 19218 2012 2 0 25898 86853 21497 10339 19277 2012 3 0 25397 87888 21996 10339 19370 2012 4 0 25539 89985 22815 10325 20019 2012 5 0 25539 90369 23401 10325 20032 2012 6 0 25786 91655 24370 10342 20072 2012 7 0 25787 92133 24372 10440 20403 2012 8 0 25793 92297 24379 10440 20541 2012 9 0 25793 92387 24379 10592 20804 2012 10 0 25793 92512 26236 10623 20907 2012 11 0 25793 92856 26247 10899 21022 2012 12 0 25793 93306 26805 10899 21064 2013 1 0 25826 93430 26861 11679 21131 2013 2 0 26473 94264 27084 11743 21351 2013 3 0 26473 94210 27079 11780 21442 2013 4 0 26477 94345 27254 11813 21484 2013 5 0 26728 94510 27344 11813 21701 2013 6 0 26733 95206 27461 12142 21898 2013 7 0 17139 98163 27536 12262 21712 2013 8 0 17139 98162 27555 12346 21841 2013 9 0 17194 98198 27556 12192 21841 2013 10 0 17241 98925 27853 12208 21842 2013 11 0 17237 98903 27862 12201 21853 2013 12 0 17238 99232 28079 12218 21962 2014 1 0 17250 101156 28360 12234 21940 2014 2 0 17237 100101 27866 12219 21969 2014 3 0 17238 100234 27957 12218 21972 2014 4 0 17238 100283 28086 12267 22002 2014 5 0 17386 101932 28225 12219 21972 2014 6 0 16645 99514 28087 12418 22229 2014 7 0 16645 100334 28246 12461 22254 2014 8 0 16658 101425 28393 12779 22285 2014 9 0 16658 101614 28532 13018 23011 2014 10 0 16844 98234 28046 13241 23174 2014 11 0 16889 102626 28645 13881 23653 2014 12 0 16889 103689 28886 13905 23821 2015 1 0 16843 103095 28799 14184 23909 2015 2 0 16843 103198 28923 14192 23845 2015 3 0 16924 104895 29174 14393 23822 2015 4 0 16924 106089 29400 14551 23808 2015 5 0 16954 107088 29583 14205 23857 2015 6 0 17768 109216 31801 14278 24006 2015 7 0 17874 109635 31343 14841 24609 2015 8 0 17805 108811 31410 14946 24994 2015 9 0 18023 109807 30849 14941 24846 2015 10 0 18012 110166 30897 14941 24846 2015 11 0 17979 112191 31034 15271 25060 2015 12 0 17993 112509 31006 15386 25373 2016 1 0 17993 112761 31057 15417 25585 2016 2 0 17993 113884 31088 15418 25587 2016 3 0 18010 113952 30980 15461 25761 2016 4 0 18010 113657 31010 15414 25451 2016 5 0 18528 114034 30888 15572 25549 2016 6 0 18528 106467 29552 15421 25518 2016 7 0 18528 105483 29452 15379 25493 2016 8 0 18528 104286 28022 15379 25478 2016 9 0 18528 103891 28005 15358 25744 2016 10 0 18528 105447 28127 15353 25757 2016 11 0 18528 105552 28158 15365 25756 2016 12 0 18532 105810 28215 15852 25831 2017 1 0 17834 96832 28077 13722 25168 2017 2 0 17834 97197 28079 13931 25222 2017 3 0 17834 97333 28095 13980 25296 2017 4 0 17834 97433 28097 14002 25306 2017 5 0 17843 97445 28128 13938 25314 2017 6 0 18038 99050 28221 14088 25502 2017 7 0 18060 99311 28219 14077 25577 2017 8 0 18059 99078 28287 14096 25562 2017 9 0 18060 99723 28460 14041 25865 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/000077500000000000000000000000001316441372200253245ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/H2Al110.py000066400000000000000000000070201316441372200266450ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function from optparse import OptionParser code_choices = ['gpaw', 'dacapo'] parser = OptionParser(usage='%prog [options] package.\nExample of call:\n'+ 'python %prog\n', version='%prog 0.1') parser.add_option('--code', dest="code", type="choice", default=code_choices[0], choices=code_choices, help='code: which code to use.') parser.add_option("--runs", dest="runs", default=7, help='use that many runs to calculate the average.') parser.add_option('-v', '--verbose', action='store_true', default=False, help='verbose mode.') opt, args = parser.parse_args() from os import remove from os.path import exists try: import numpy as np except ImportError: raise SystemExit('numpy is not installed!') try: import gpaw except ImportError: raise SystemExit('gpaw is not installed!') from gpaw.utilities.tools import gridspacing2cutoff try: import ase except ImportError: raise SystemExit('ase is not installed!') from ase import Atoms, Atom import time a = 4.00 d = a / 2**0.5 z = 1.1 b = 1.5 def memory_bandwidth(code='gpaw', runs=7): slab = Atoms([Atom('Al', (0, 0, 0)), Atom('Al', (a, 0, 0)), Atom('Al', (a/2, d/2, -d/2)), Atom('Al', (3*a/2, d/2, -d/2)), Atom('Al', (0, 0, -d)), Atom('Al', (a, 0, -d)), Atom('Al', (a/2, d/2, -3*d/2)), Atom('Al', (3*a/2, d/2, -3*d/2)), Atom('Al', (0, 0, -2*d)), Atom('Al', (a, 0, -2*d)), Atom('H', (a/2-b/2, 0, z)), Atom('H', (a/2+b/2, 0, z))], cell=(2*a, d, 5*d), pbc=(1, 1, 1)) h = 0.15 nbands = 28 kpts = (2, 6, 1) parameters = {} if code == 'gpaw': from gpaw import Calculator from gpaw.mpi import rank parameters['convergence'] = {'eigenstates': 1e-5} parameters['h'] = h elif code == 'dacapo': from ase.calculators.dacapo import Dacapo as Calculator parameters['planewavecutoff'] = gridspacing2cutoff(h) parameters['densitycutoff'] = parameters['planewavecutoff']*1.5 rank = 0 t = 0.0 t_runs = [] for n in range(runs): t0 = time.time() for i in range(1): calc = Calculator( nbands=nbands, kpts=kpts, **parameters) slab.set_calculator(calc) e = slab.get_potential_energy() del calc if exists('out.nc'): remove('out.nc') t1 = time.time() t = t + t1 - t0 t_runs.append(t1 - t0) print('Run: ', n, ' energy ', e, ' rank: ', str(rank), ' time: ', time.time() - t0) if rank == 0: print('Rank '+str(rank)+': time [sec]: avg '+str(round(np.average(t_runs),1))+', stddev '+str(round(np.std(t_runs),1))+', min '+str(round(min(t_runs),1))+', max '+str(round(max(t_runs),1))) if __name__ == '__main__': code = opt.code assert code in code_choices, code+' not in '+str(code_choices) if code == 'dacapo': try: import ASE except ImportError: raise SystemExit('ASE (2) is not installed!') runs = int(opt.runs) assert runs >= 1, runs+' must be >= 1' memory_bandwidth(code=code, runs=runs) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/analyse.py000066400000000000000000000006101316441372200273270ustar00rootroot00000000000000import os import shutil from gpaw.mpi import rank machine = os.environ.get('MACHINE', 'TEST') ncores = os.environ.get('NCORES', 8) if rank == 0: os.chdir(machine) os.system('python ../memory_bandwidth.py --runs=5 --startcores='+str(ncores)) #os.system('python ../memory_bandwidth.py --runs=5') # full memory benchmark shutil.copy('memory_bandwidth_'+machine+'_py.png', '..') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/memory_bandwidth.py000066400000000000000000000236711316441372200312430ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # Emacs: treat this as -*- python -*- from __future__ import print_function from optparse import OptionParser parser = OptionParser(usage='%prog [options]', version='%prog 0.1') parser.add_option('--dir', dest="dir", default='.', help='Results directory') parser.add_option("--runs", dest="runs", default=5, help='use that many runs to calculate the average.') parser.add_option("--startcores", dest="startcores", default=1, help='use at lease that many cores.') opt, args = parser.parse_args() import os import datetime from math import sqrt import numpy as np colors = [ 'black', 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'violet', 'gray', 'gray'] from ase.data import atomic_numbers as numbers def plot(xdata, ydata, std, title, xlabel, ylabel, label, color, num=1): import matplotlib #matplotlib.use('Agg') import pylab # all goes to figure num pylab.figure(num=num, figsize=(7, 5.5)) pylab.gca().set_position([0.10, 0.20, 0.85, 0.60]) # let the plot have fixed y-axis scale miny = min(ydata) maxy = max(ydata) ywindow = maxy - miny pylab.gca().set_ylim(miny-ywindow/4.0, maxy+ywindow/3.0) #pylab.plot(xdata, ydata, 'b.', label=label, color=color) #pylab.plot(xdata, ydata, 'b-', label='_nolegend_', color=color) pylab.bar(xdata, ydata, 0.3, yerr = std, label=label, color=color) pylab.title(title) pylab.xlabel(xlabel) pylab.ylabel(ylabel) #pylab.legend(loc='upper right') #pylab.savefig(directory_name + os.path.sep + out_prefix +'.png') def plot_save(directory_name, out_prefix): from os.path import exists assert exists(directory_name) import pylab pylab.savefig(directory_name + os.path.sep + out_prefix +'.png') def analyse_benchmark(ncores=8, startcores=1, machine='TEST', runs=7): #system = ['carbon_py'] #system = ['carbon'] #system = ['niflheim_py'] #system = ['niflheim'] #system = ['TEST_py'] system = machine+'_py' systems_string = { 'carbon_py' : 'gpaw 1865 on carbon', 'carbon' : 'mkl 10.0.2.018 dsyev on carbon', 'niflheim_py' : 'gpaw 1865 on niflheim', 'niflheim' : 'acml 4.0.1 dsyev on niflheim', #'TEST_py' : 'gpaw on TEST', }.get(system, False) processes = { 'carbon_py' : [1, 2, 4, 6, 8], 'carbon' : [1, 2, 4, 8], 'niflheim_py' : [1, 2, 3, 4], 'niflheim' : [1, 2, 4], #'TEST_py' : [1, 2, 4, 6, 8], }.get(system, False) if not systems_string: systems_string = 'gpaw on '+machine if not processes: processes = [startcores] for n in range(startcores+1, ncores+1): if n%2==0: processes.append(n) timer_entries_all = [] if system.find('_py') == -1: for i in range(runs): timer_entries_all.append('run: '+str(i)) else: for i in range(runs): timer_entries_all.append('Run: '+str(i)) import re # Select timer entries selected_entries = range(runs) height = {} gpaw_versions = [] pre_results = {} results = {} timer_entries = [] timer_entries_re = {} for entry in selected_entries: height[entry] = [] timer_entries.append(timer_entries_all[entry]) timer_entries_re[timer_entries_all[entry]] = re.compile(timer_entries_all[entry]) # absolute path to directory root_abspath = os.path.abspath(opt.dir) # length of directory name rootlen = len(root_abspath) + 1 ref_value_3300 = -44.85826 ref_SCF_3300 = 19 ref_value_3301 = -44.85709 ref_SCF_3301 = 31 ref_value_3721 = -44.85666 ref_SCF_3721 = 35 ref_value_5147 = -44.83504 ref_SCF_5147 = 30 ref_value_6383 = -44.84197 ref_SCF_6383 = 28 ref_value = ref_value_6383 ref_SCF = ref_SCF_6383 tolerance = 0.0001 ref_failed = False h_failed = False for run in [str(p)+'_01' for p in processes]: # extract results rundir = os.path.join(root_abspath, system+run) file = os.path.join(rundir, 'out.txt') try: f = open(file, 'r') # print('Analysing '+file, end=' ') # lines = f.readlines() except: pass # extract gpaw version for n, l in enumerate(lines): if l.startswith(' |__ | _|___|_____|'): gpaw_version = lines[n + 0].strip().split()[3].split('.')[-1] break if gpaw_version[-1] == 'M': gpaw_version = gpaw_version[:-1] if gpaw_version.rfind(':') != -1: gpaw_version = gpaw_version[:gpaw_version.rfind(':')] gpaw_version = int(gpaw_version) if len(str(gpaw_version)) > 1: if gpaw_version <= 6383: ref_value = ref_value_6383 ref_SCF = ref_SCF_6383 if gpaw_version <= 5147: ref_value = ref_value_5147 ref_SCF = ref_SCF_5147 if gpaw_version <= 3720: ref_value = ref_value_3301 ref_SCF = ref_SCF_3301 if gpaw_version <= 3300: ref_value = ref_value_3300 ref_SCF = ref_SCF_3300 elif len(str(gpaw_version)) == 1: if gpaw_version <= 4: ref_value = ref_value_3300 ref_SCF = ref_SCF_3300 gpaw_versions.append(gpaw_version) # search for timings print('gpaw version %d' % gpaw_version) for entry in selected_entries: h = [] ref = [] for line in lines: m = timer_entries_re[timer_entries_all[entry]].search(line) if m is not None: h.append(float(line.split(':')[-1])) #break # stop after the first match for h_entry in h: if float(h_entry) < 0.0: h_failed = True break height[entry].append(h) for line in lines: m = re.compile('Zero').search(line) if m is not None: ref.append(float(line.split(':')[-1])) #break # stop after the first match for ref_entry in ref: if abs(float(ref_entry)-ref_value) > tolerance: ref_failed = True break # assert len(processes) == len(gpaw_versions) for p in range(len(processes)): assert gpaw_versions[p] == max(gpaw_versions), 'incompatible gpaw versions across cores' # if h_failed: print('Panic: negative time in '+file) assert not h_failed if ref_failed: print('Panic: wrong Zero Kelvin: value in '+file+' - should be '+str(ref_value)+' +- '+str(tolerance)) assert not ref_failed # arrange results for p in range(len(processes)): pre_results[processes[p]] = [] for i in range(len(height)): pre_results[processes[p]].append(height[i][p]) # # arrange results - calculate statistics for p in processes: #for p in range(len([1])): #print pre_results[p] results[p] = [] temp = [] for q in range(p): temp_q = [] for i in range(len(pre_results[p])): #print pre_results[p][i][q] temp_q.append(pre_results[p][i][q]) temp.append(pre_results[p][i][q]) # averages for a given core q results[p].append((np.average(temp_q), np.std(temp_q))) # max, avrg, and std across all cores results[p].append((np.average(temp), np.std(temp), min(temp), max(temp))) #for p in processes: # #N = len(pre_results[p]) # #avg = sum(pre_results[p])/N # #q = sqrt(sum([(x-avg)**2/(N) for x in pre_results[p]])) # avg.append(np.average(pre_results[p])) # q.append(np.std(pre_results[p])) import matplotlib matplotlib.use('Agg') from matplotlib import pylab, ticker from twiny import twiny # from http://matplotlib.sourceforge.net/examples/dashtick.py ROTATION=75 DASHROTATION=115 DASHBASE=5 DASHLEN=25 DASHSTAGGER=3 FONTSIZE=10 def dashlen(step): return DASHBASE+(DASHLEN*(step%DASHSTAGGER)) # print scaling results parameters = processes zero = [0.0 for i in range(len(parameters))] pylab.plot(parameters, zero, 'k-', label='_nolegend_') ay1=pylab.gca() ay1.xaxis.set_ticks(parameters) ay1.xaxis.set_ticklabels([str(x) for x in parameters]) for p in processes: parameters = [] avg = [] std = [] for i in range(len(results[p])-1): parameters.append(p+0.3*i) # avg and std across processes avg.append(results[p][i][0]) std.append(results[p][i][1]) # height #print parameters, avg, std print('No. of processes '+str(int(parameters[0]))+': time [sec]: avg '+str(round(results[p][-1][0],1))+', stddev '+str(round(results[p][-1][1],1))+', min '+str(round(results[p][-1][2],1))+', max '+str(round(results[p][-1][3],1))) plot( parameters, avg, std, systems_string+' version '+str(gpaw_version), 'processes per node', 'time [s]', 'gpaw', (colors[p%10]), num=1) # from two_scales.py plot_save(".", 'memory_bandwidth_'+system) pylab.close(1) # if __name__ == '__main__': from os import environ NCORES = int(environ.get('NCORES', 8)) MACHINE = environ.get('MACHINE', 'TEST') assert NCORES >= 1, str(NCORES)+' must be >= 1' runs = int(opt.runs) assert runs >= 1, runs+' must be >= 1' startcores = int(opt.startcores) assert startcores >= 1, startcores+' must be >= 1' analyse_benchmark(NCORES, startcores, MACHINE, runs=runs) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/prepare.py000066400000000000000000000002131316441372200273300ustar00rootroot00000000000000import os import shutil machine = os.environ.get('MACHINE', 'TEST') shutil.rmtree(machine, ignore_errors=True) os.system('sh prepare.sh') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/prepare.sh000077500000000000000000000007611316441372200273250ustar00rootroot00000000000000#!/bin/sh if test -z $NCORES; then export NCORES=8 fi if test -z $MACHINE; then export MACHINE=TEST fi if [ ! -d "${MACHINE}" ]; then mkdir ${MACHINE} echo "${MACHINE} created" cd ${MACHINE} fi index=0 while [ "$index" -le "$NCORES" ]; do if [ "$index" -eq 0 ]; then p=1 else p=$index fi # if [ ! -d "${MACHINE}_py${p}_01" ]; then mkdir ${MACHINE}_py${p}_01 echo "${MACHINE}_py${p}_01 created" fi index=`expr $index + 2` done cd .. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/run.sh000077500000000000000000000023311316441372200264660ustar00rootroot00000000000000#!/bin/sh # Execute the GPAW code as one or more independent tasks if test -z $NCORES; then export NCORES=8 fi if test -z $STARTCORES; then export STARTCORES=0 fi if test -z $MACHINE; then export MACHINE=TEST fi # export PYTHONPATH=~/gpaw.mkl:${PYTHONPATH} export script=../../H2Al110.py ## CONFIGURE one of the following: if [ -f /home/camp/modulefiles.sh ]; then . /home/camp/modulefiles.sh module load openmpi fi # Using the GCC compiler and the AMD ACML library #. /usr/local/openmpi-1.2.5-gfortran/bin/mpivars-1.2.5.sh #export LD_LIBRARY_PATH=/opt/acml-4.0.1/gfortran64/lib:${LD_LIBRARY_PATH} # Using the Intel compiler and the Intel MKL library #. /usr/local/openmpi-1.2.7.intel/bin/mpivars-1.2.7.sh #. /opt/intel/cce/10.1.018/bin/iccvars.sh #. /opt/intel/mkl/10.0.4.023/tools/environment/mklvarsem64t.sh #. /opt/intel/fce/10.1.018/bin/ifortvars.sh export OMP_NUM_THREADS=1 index=${STARTCORES} while [ "$index" -le "$NCORES" ]; do if [ "$index" -eq 0 ]; then p=1 else p=$index fi # echo Benchmark for ${p} tasks started at `date` ( cd ${MACHINE}_py${p}_01; time mpiexec -np $p python $script > out.txt ) echo index=`expr $index + 2` done echo Benchmark runs ended at `date` gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/run_numactl.py000066400000000000000000000004261316441372200302270ustar00rootroot00000000000000import os from gpaw.mpi import rank machine = os.environ.get('MACHINE', 'TEST') ncores = os.environ.get('NCORES', 8) if rank == 0: os.chdir(machine) os.system('STARTCORES=%d &&. ../run_numactl.sh' % ncores) #os.system('. ../run_numactl.sh') # full memory benchmark gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/run_numactl.sh000077500000000000000000000025321316441372200302140ustar00rootroot00000000000000#!/bin/sh # Execute the GPAW code as one or more independent tasks if test -z $NCORES; then export NCORES=8 fi if test -z $STARTCORES; then export STARTCORES=0 fi if test -z $CORES_PER_SOCKET; then export CORES_PER_SOCKET=4 fi if test -z $MACHINE; then export MACHINE=TEST fi # export PYTHONPATH=~/gpaw.mkl:${PYTHONPATH} export script=../../H2Al110.py ## CONFIGURE one of the following: if [ -f /home/camp/modulefiles.sh ]; then . /home/camp/modulefiles.sh module load openmpi fi # Using the GCC compiler and the AMD ACML library #. /usr/local/openmpi-1.2.5-gfortran/bin/mpivars-1.2.5.sh #export LD_LIBRARY_PATH=/opt/acml-4.0.1/gfortran64/lib:${LD_LIBRARY_PATH} # Using the Intel compiler and the Intel MKL library #. /usr/local/openmpi-1.2.7.intel/bin/mpivars-1.2.7.sh #. /opt/intel/cce/10.1.018/bin/iccvars.sh #. /opt/intel/mkl/10.0.4.023/tools/environment/mklvarsem64t.sh #. /opt/intel/fce/10.1.018/bin/ifortvars.sh export OMP_NUM_THREADS=1 index=${STARTCORES} while [ "$index" -le "$NCORES" ]; do if [ "$index" -eq 0 ]; then p=1 else p=$index fi # echo Benchmark for ${p} tasks started at `date` ( cd ${MACHINE}_py${p}_01; time mpiexec -np $p ../../taskit.BINDING.one.node 0 ${CORES_PER_SOCKET} python $script --runs=5 > out.txt ) echo index=`expr $index + 2` done echo Benchmark runs ended at `date` gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/submit.agts.py000066400000000000000000000022101316441372200301310ustar00rootroot00000000000000import os def agts(queue): if 0: # disabled - this test use a mixture of shell and python # performs the "best performance" test from # https://wiki.fysik.dtu.dk/gpaw/devel/benchmarks.html#memory-benchmark # # Set the environment variables for your system before running this script! # Setting any variable in this script is ignored! machine = os.environ.get('MACHINE', 'TEST') ncores = int(os.environ.get('NCORES', 8)) # prepare = queue.add('prepare.py', queueopts='-l nodes=1:ppn=1', ncpus=1, walltime=5, deps=[]) run_numactl = queue.add('run_numactl.py', queueopts='-l nodes=1:ppn=8:xeon8', ncpus=1, walltime=1*60, deps=[prepare]) analyse = queue.add('analyse.py', queueopts='-l nodes=1:ppn=1', ncpus=1, walltime=5, deps=[run_numactl], creates=['memory_bandwidth_'+machine+'_py.png'], show=['memory_bandwidth_'+machine+'_py.png']) taskit.BINDING.one.node000077500000000000000000000026001316441372200312450ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth#!/bin/sh #UTILISATION METTRE 0 ET 1 EN ARGUMENT OFFSET=$1 shift # number cores per socket CORES_PER_SOCKET=$1 shift NCPU=$(grep "^processor" /proc/cpuinfo |wc -l) if [ -n "$OMPI_MCA_ns_nds_vpid" ]; then MPI_RANK=$OMPI_MCA_ns_nds_vpid #Myrinet with MX drivers elif [ -n "$MXMPI_ID" ]; then DMPI_RANK=$MXMPI_ID #Myrinet with GM drivers elif [ -n "$GMPI_ID" ]; then MPI_RANK=$GMPI_ID #INTEL MPI elif [ -n "${PMI_RANK}" ]; then MPI_RANK=${PMI_RANK} #OPEN MPI elif [ -n "${OMPI_MCA_ns_nds_vpid}" ]; then MPI_RANK=${OMPI_MCA_ns_nds_vpid} #OPEN MPI >= 1.3 # http://osdir.com/ml/clustering.open-mpi.user/2008-07/msg00048.html elif [ -n "${OMPI_COMM_WORLD_RANK}" ]; then MPI_RANK=${OMPI_COMM_WORLD_RANK} # VOLTAIRE IB & MVAPICH elif [ -n "${MPIRUN_RANK}" ]; then MPI_RANK=${MPIRUN_RANK} else echo "Error getting MPI_RANK"; fi CPU=`echo "($OFFSET + $MPI_RANK)"|bc` case $CPU in 0) CPU=0 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 1) CPU=1 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 2) CPU=2 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 3) CPU=3 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 4) CPU=4 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 5) CPU=5 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 6) CPU=6 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; 7) CPU=7 MEM=`echo "$CPU / $CORES_PER_SOCKET" |bc`;; esac #ulimit -s unlimited CMD="numactl --membind=$MEM --physcpubind=$CPU $@" echo $CMD eval $CMD gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/memory_bandwidth/twiny.py000066400000000000000000000007661316441372200270610ustar00rootroot00000000000000from pylab import * def twiny(ay=None): """ Make a second axes overlay ay (or the current axes if ay is None) sharing the yaxis. The ticks for ay2 will be placed on the top, and the ay2 instance is returned. See examples/two_scales.py """ if ay is None: ay=gca() ay2 = gcf().add_axes(ay.get_position(), sharey=ay, frameon=False) ay2.xaxis.tick_top() ay2.xaxis.set_label_position('top') ay.xaxis.tick_bottom() draw_if_interactive() return ay2 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/newrelease.rst000066400000000000000000000007711316441372200246610ustar00rootroot00000000000000.. _newrelease: =========== New release =========== * Update ``__version__`` in :git:`gpaw/__init__.py`. * If a new ase release is required to pass the tests modify ``__ase_version_required__`` in :git:`gpaw/__init__.py`. * Upload to PyPI:: $ python3 setup.py sdist $ twine upload dist/* * Push and make a tag. * Update :ref:`news`, :ref:`releasenotes` and :ref:`download` pages. * Increase the version number and push. * Send announcement email to the ``gpaw-users`` mailing list. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/others.rst000066400000000000000000000010771316441372200240330ustar00rootroot00000000000000Miscellaneous objects and functions =================================== .. autofunction:: gpaw.occupations.occupation_numbers .. autoclass:: gpaw.lfc.NewLocalizedFunctionsCollection :members: .. autoclass:: gpaw.spline.Spline :members: .. autoclass:: gpaw.poisson.FDPoissonSolver :members: .. autoclass:: gpaw.xc.functional.XCFunctional :members: .. autoclass:: gpaw.xc.gga.GGA :members: .. autofunction:: gpaw.forces.calculate_forces .. autoclass:: gpaw.grid_descriptor.GridDescriptor :members: .. autoclass:: gpaw.scf.SCFLoop :members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/overview.rst000066400000000000000000000320241316441372200243710ustar00rootroot00000000000000.. _overview: ======== Overview ======== This document describes the most important objects used for a DFT calculation. More information can be found in the :git:`code <>`. PAW === This object is the central object for a GPAW calculation:: +----------+ |GPAWLogger| +-----------+ +----------+ --->|Hamiltonian| ^ / +-----------+ | ---- +------+ | / ---->|Setups| +-----+ +------+ / +------+ |Atoms|<-------------| GPAW |----- +-----+ +------+ \ / | \ \ +-----------+ +-------------+ / | --- ----------->|Occupations| |WaveFunctions|<-- v \ +-----------+ +-------------+ +-------+ \ +-------+ |Density| -->|SCFLoop| +-------+ +-------+ The implementation is in :git:`gpaw/calculator.py`. The :class:`gpaw.calculator.GPAW` class doesn't do any part of the actual calculation - it only handles the logic of parsing the input parameters and setting up the necessary objects for doing the actual work (see figure above). A GPAW instance has the following attributes: ``atoms``, ``parameters``, ``wfs``, ``density``, ``setups``, ``hamiltonian``, ``scf``, ``log``, ``timer``, ``occupations``, ``initialized``, ``world`` and ``observers``. The :class:`gpaw.calculator.GPAW` inherits from: * :class:`ase.calculators.calculator.Calculator` This implements the ASE :ref:`ase:calculator interface` * :class:`gpaw.paw.PAW` Mixin that adds a number of extra methods without bloating the :git:`gpaw/calculator.py` file too much. .. note:: GPAW uses atomic units internally (`\hbar=e=m=1`) and ASE uses Angstrom and eV (:mod:`~ase.units`). Generating a GPAW instance from scratch --------------------------------------- When a GPAW instance is created from scratch:: calc = GPAW(xc='LDA', nbands=7) the GPAW object is almost empty. In order to start a calculation, one will have to do something like:: atoms = Atoms(...) atoms.calc = calc atoms.get_potential_energy() ASE will then arrange to call the :meth:`~gpaw.calculator.GPAW.calculate` method with the correct arguments. This will trigger: 1) A call to the :meth:`~gpaw.calculator.GPAW.initialize` method, which will set up the objects needed for a calculation: :class:`~gpaw.density.Density`, :class:`~gpaw.hamiltonian.Hamiltonian`, :class:`~gpaw.wavefunctions.base.WaveFunctions`, :class:`~gpaw.setup.Setups` and a few more (see figure above). 2) A call to the :meth:`~gpaw.calculator.GPAW.set_positions` method, which will initialize everything that depends on the atomic positions: a) Pass on the atomic positions to the wave functions, hamiltonian and density objects (call their ``set_positions()`` methods). b) Make sure the wave functions are initialized. c) Reset the :class:`~gpaw.scf.SCFLoop`. Generating a GPAW instance from a restart file ---------------------------------------------- When a GPAW instance is created like this:: calc = GPAW('restart.gpw') the :meth:`~gpaw.calculator.GPAW.initialize` method is called first, so that the parts read from the file can be placed inside the objects where they belong: the effective pseudo potential and the total energy are put in the hamiltonian, the pseudo density is put in the density object and so on. After a restart, everything *should* be as before the restart file was written. However, there are a few exceptions: * The wave functions are only read when needed ... XXX * Atom centered functions (`\tilde{p}_i^a`, `\bar{v}^a`, `\tilde{n}_c^a` and `\hat{g}_{\ell m}^a`) are not initialized. ... XXX WaveFunctions ============= We currently have two representations for the wave functions: uniform 3-d grids and expansions in atom centered basis functions as implemented in the two classes :class:`~gpaw.wavefunctions.fd.FDWaveFunctions` and :class:`~gpaw.wavefunctions.lcao.LCAOWaveFunctions`. Both inherit from the :class:`~gpaw.wavefunctions.base.WaveFunctions` class, so the wave functions object will always have a :class:`~gpaw.grid_descriptor.GridDescriptor`, an :class:`~gpaw.eigensolvers.eigensolver.Eigensolver`, a :class:`~gpaw.setup.Setups` object and a list of :class:`~gpaw.kpoint.KPoint` objects. :: +--------------+ +-----------+ |GridDescriptor| |Eigensolver| +--------------+ +-----------+ ^ ^ |gd | \ | +------+ +-------------+ kpt_u +------+ |Setups|<-------|WaveFunctions|-------->|KPoint|+ +------+ +-------------+ +------+|+ ^ +------+| /_\ +------+ | | -------------------------------- | | +-----------------+ +-----------------+ |LCAOWaveFunctions| | FDWaveFunctions | +-----------------+ +-----------------+ | | / | | v |tci | |kin |pt +--------------+ | v | v |BasisFunctions| | +-------+ | +----------+ +--------------+ | |Overlap| | |Projectors| v +-------+ | +----------+ +------------------+ v |TwoCenterIntegrals| +---------------------+ +------------------+ |KineticEnergyOperator| +---------------------+ Attributes of the wave function object: ``gd``, ``nspins``, ``nbands``, ``mynbands``, ``dtype``, ``world``, ``kpt_comm``, ``band_comm``, ``gamma``, ``bzk_kc``, ``ibzk_kc``, ``weight_k``, ``symmetry``, ``kpt_comm``, ``rank_a``, ``nibzkpts``, ``kpt_u``, ``setups``, ``ibzk_qc``, ``eigensolver``, and ``timer``. .. _overview_xc: Exchange-correlation functionals module ======================================= The ``gpaw.xc`` module contains all the code for XC functionals in GPAW:: +--------------+ | XCFunctional | +--------------+ ^ ^ /_\ /_\ | | +-------+ | +------------------------+ | LDA | ----|vdW-DF/HybridXC/SIC/GLLB| +-------+ +------------------------+ ^ /_\ | +---+ |GGA| +---+ ^ /_\ | +----+ |MGGA| +----+ An :class:`~gpaw.xc.functional.XCFunctional` object is usually created using the :func:`gpaw.xc.XC` function: .. autofunction:: gpaw.xc.XC Example:: # the default implementation of PBE from LibXC: from gpaw.xc import XC xc = XC('PBE') # alternative call: from gpaw.xc.libxc import LibXC from gpaw.xc.gga import GGA xc = GGA(LibXC('PBE')) # or, explicitly: xc = GGA(LibXC('GGA_X_PBE+GGA_C_PBE')) In this example, calling the ``calculate`` method of the ``xc`` object passing in a :class:`~gpaw.grid_descriptor.GridDescriptor`, an input density array and an output array for the potential, the :class:`~gpaw.xc.gga.GGA` object will calculate the gradient of the density and pass that and the density on to the libxc kernel. Refer to :ref:`manual_xc` for other examples. GPAW also has a few non-libxc kernels that one can use like this:: from gpaw.xc.kernel import XCKernel xc = XC(XCKernel('PBE')) .. _overview_array_naming: Naming convention for arrays ============================ A few examples: =========== =================== =========================================== name shape =========== =================== =========================================== ``spos_c`` ``(3,)`` **S**\ caled **pos**\ ition vector ``nt_sG`` ``(2, 24, 24, 24)`` Pseudo-density array `\tilde{n}_\sigma(\vec{r})` (``t`` means *tilde*): two spins, 24*24*24 grid points. ``cell_cv`` ``(3, 3)`` Unit cell vectors. =========== =================== =========================================== Commonly used indices: ======= ================================================== index description ======= ================================================== ``a`` Atom number ``c`` Unit cell axis-index (0, 1, 2) ``v`` *xyz*-index (0, 1, 2) ``k`` **k**-point index ``q`` **k**-point index (local, i.e. it starts at 0 on each processor) ``s`` Spin index (`\sigma`) ``u`` Combined spin and **k**-point index (local) ``G`` Three indices into the coarse 3D grid ``g`` Three indices into the fine 3D grid ``M`` LCAO orbital index (`\mu`) ``n`` Principal quantum number *or* band number ``l`` Angular momentum quantum number (s, p, d, ...) ``m`` Magnetic quantum number (0, 1, ..., 2*l - 1) ``L`` ``l`` and ``m`` (``L = l**2 + m``) ``j`` Valence orbital number (``n`` and ``l``) ``i`` Valence orbital number (``n``, ``l`` and ``m``) ``q`` ``j1`` and ``j2`` pair ``p`` ``i1`` and ``i2`` pair ``r`` CPU-rank ======= ================================================== Array names and their definition -------------------------------- .. list-table:: * - name in the code - definition * - wfs.kpt_u[u].P_ani - `\langle\tilde{p}_i^a|\tilde{\psi}_{\sigma\mathbf{k}n} \rangle` * - density.D_asp - `D_{s i_1i_2}^a` * - hamiltonian.dH_sp - `\Delta H_{s i_1i_2}^a` * - setup.Delta_pL - `\Delta_{Li_1i_2}^a` * - setup.M_pp - `\Delta C_{i_1i_2i_3i_4}^a` eq. (C2) in [1]_ or eq. (47) in [2]_ * - wfs.kpt_u[u].psit_nG - `\tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r})` * - setup.pt_j - `\tilde{p}_j^a(r)` * - wfs.pt - `\tilde{p}_i^a(\mathbf{r}-\mathbf{R}^a)` The :class:`~gpaw.setup.Setup` instances are stored in the :class:`~gpaw.setup.Setups` list, shared by the wfs, density, and hamiltonian instances. E.g. paw.wfs.setups, paw.density.setups, or paw.hamiltonian.setups. Parallelization over spins, k-points domains and states ======================================================= When using parallelization over spins, **k**-points, bands and domains, four different :ref:`MPI communicators ` are used: * *mpi.world* Communicator containing all processors. * *domain_comm* One *domain_comm* communicator contains the whole real space domain for a selection of the spin/k-point pairs and bands. * *kpt_comm* One *kpt_comm* communicator contains all k-points and spin for a selection of bands over part of the real space domain. * *band_comm* One *band_comm* communicator contains all bands for a selection of k-points and spins over part of the real space domain. These communicators constitute MPI groups, of which the latter three are subsets of the ``world`` communicator. The number of members in the a communicator group is signified by ``comm.size``. Within each group, every element (i.e. processor) is assigned a unique index ``comm.rank`` into the list of processor ids in the group. For instance, a *domain_comm* rank of zero signifies that the processor is first in the group, hence it functions as a domain master. For an example on how to use an MPI communicator to perform simple data communication, please refer to :git:`~doc/devel/parallelization.py`. To investigate the way GPAW distributes calculated quantities across the various MPI groups, simulating an MPI run can be done using ``gpaw-mpisim``:: $ gpaw-mpisim -v --dry-run=4 --spins=2 --kpoints=4 --bands=3 --domain-decomposition=2,1,1 Simulating: world.size = 4 parsize_c = (2, 1, 1) parsize_bands = 1 nspins = 2 nibzkpts = 4 nbands = 3 world: rank=0, ranks=None kpt_comm : rank=0, ranks=[0 2], mynks=4, kpt_u=[0^,1^,2^,3^] band_comm : rank=0, ranks=[0], mynbands=3, mybands=[0, 1, 2] domain_comm : rank=0, ranks=[0 1] world: rank=1, ranks=None kpt_comm : rank=0, ranks=[1 3], mynks=4, kpt_u=[0^,1^,2^,3^] band_comm : rank=0, ranks=[1], mynbands=3, mybands=[0, 1, 2] domain_comm : rank=1, ranks=[0 1] world: rank=2, ranks=None kpt_comm : rank=1, ranks=[0 2], mynks=4, kpt_u=[0v,1v,2v,3v] band_comm : rank=0, ranks=[2], mynbands=3, mybands=[0, 1, 2] domain_comm : rank=0, ranks=[2 3] world: rank=3, ranks=None kpt_comm : rank=1, ranks=[1 3], mynks=4, kpt_u=[0v,1v,2v,3v] band_comm : rank=0, ranks=[3], mynbands=3, mybands=[0, 1, 2] domain_comm : rank=1, ranks=[2 3] For the case of a `\Gamma`-point calculation without band-parallelization, all parallel communication is done in the one *domain_comm* communicator, which in this case is equal to *mpi.world*. .. [1] J J. Mortensen and L. B. Hansen and K. W. Jacobsen, Phys. Rev. B 71 (2005) 035109. .. [2] C. Rostgaard, `The Projector Augmented Wave Method <../paw_note.pdf>`_. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/parallelization.py000077500000000000000000000070661316441372200255500ustar00rootroot00000000000000#!/usr/bin/env python from __future__ import print_function import numpy as np from gpaw.mpi import world from gpaw.utilities.dscftools import mpi_debug W = world.size N = 32 assert N%W == 0 M = N//W # Create my share of data data = np.arange(world.rank*M, (world.rank+1)*M) # Let's calculate the global sum slocal = data.sum() s = world.sum(slocal) mpi_debug('data: %s, slocal=%d, s=%d' % (data,slocal,s)) assert s == N*(N-1)//2 # Subtract the global mean data -= s/N mpi_debug('data: %s' % data) # ------------------------------------------------------------------- if world.rank == 0: print('-'*16) # Who has global index 11? The master needs it! i = 11 rank, ilocal = divmod(i, M) mpi_debug('rank=%d, ilocal=%d, i=%d' % (rank,ilocal,i)) assert rank*M + ilocal == i # Do I have it? if world.rank == rank: # Yes, so extract data (must be an array) idata = np.array([data[ilocal]], dtype=data.dtype) else: # No, so just allocate space idata = np.empty(1, dtype=data.dtype) # Broadcast from owner to everyone else world.broadcast(idata, rank) """ # This does the same as broadcast with send/receive... # Do I have it? if world.rank == rank: # Yes, now send it to the others for other_rank in range(world.size): # We don't have to send it to ourselves if other_rank != rank: world.send(idata, other_rank, tag=123) else: # No, so receive from the one that own the data world.receive(idata, rank, tag=123) """ mpi_debug('idata=%d' % idata) # ------------------------------------------------------------------- if world.rank == 0: print('-'*16) # The master just calculated auxiliary data. Distribute it. aux = np.empty(N, dtype=float) # Only master knows the data right now if world.rank == 0: np.random.seed(1234567) aux[:] = np.random.uniform(0,1,size=N).round(2) print('MASTER aux: %s, mean=%f' % (aux, aux.mean())) # Allocate space for my part of the auxiliary data myaux = np.empty(M, dtype=float) # Scatter parts from master to everyone world.scatter(aux, myaux, 0) """ # This does the same as scatter with send/receive... # Are we the master? if world.rank == 0: # Yes, so extract my part directly myaux[:] = aux[0:M] # Now send parts to the slaves for slave_rank in range(1, world.size): youraux = aux[slave_rank*M:(slave_rank+1)*M] world.send(youraux, slave_rank, tag=123) else: # No, so receive from the master world.receive(myaux, 0, tag=123) """ # We don't need original data anymore del aux # Try to calculate mean now meanaux = world.sum(myaux.mean())/world.size mpi_debug('myaux: %s, mean=%f' % (myaux,meanaux)) # ------------------------------------------------------------------- if world.rank == 0: print('-'*16) # We've done something to our part of the auxiliary data. Master needs it all if world.rank == 0: result = np.empty(N, dtype=float) else: result = None # Do something to our auxiliary data myaux[:] = np.sin(2*np.pi*myaux).round(3) mpi_debug('myaux: %s' % myaux) # Gather parts from everyone on the master world.gather(myaux, 0, result) """ # This does the same as gather with send/receive... # Are we the master? if world.rank == 0: # Yes, so extract my part directly result[0:M] = myaux[:] # Now receive parts from the slaves for slave_rank in range(1, world.size): youraux = np.empty(M, dtype=float) world.receive(youraux, slave_rank, tag=123) result[slave_rank*M:(slave_rank+1)*M] = youraux else: # No, so send to the master world.send(myaux, 0, tag=123) """ mpi_debug('result: %s' % result) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/paw.rst000066400000000000000000000002761316441372200233160ustar00rootroot00000000000000The PAW calculator object ========================= .. autoclass:: gpaw.calculator.GPAW :members: :inherited-members: .. autoclass:: gpaw.paw.PAW :members: :inherited-members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/planewaves.rst000066400000000000000000000051151316441372200246710ustar00rootroot00000000000000========== Planewaves ========== With `N=N_1N_2N_3` grid points: `\br^T=(g_1/N_1,g_2/N_2,g_3/N_3)\mathbf A`, where `g_c=0,1,...,N_c-1`, we get a plane wave expansion of the wave function as: .. math:: \tilde\psi_{k n}(\br) = \frac{1}{N} \sum_\bG e^{i(\bG+\bk)\cdot \br}c_{\bk n}(\bG), where the coefficients are given as: .. math:: c_{\bk n}(\bG) = \sum_\br e^{-i(\bG+\bk)\cdot\br}\tilde\psi_{\bk n}(\br) Exact Exchange ============== From the pair densities: .. math:: \tilde\rho_{\bk_1n_1 \bk_2n_2}(\br) = \tilde\psi_{\bk_1n_1}(\br)^* \tilde\psi_{\bk_2n_2}(\br) + ... = \\ \frac{1}{N^2} \sum_{\bG\bG'} e^{i(\bG-\bk_1+\bk_2)\cdot \br} c_{\bk_1n_1}(\bG)^* c_{\bk_2n_2}(\bG+\bG') = \sum_\bG e^{i(\bG-\bk_1+\bk_2)\cdot \br}C_{\bk_1n_1\bk_2n_2}(\bG), we get the exact exchange energy: .. math:: E_x = -\pi\Omega \sum_{\bk_1n_1} \sum_{\bk_2n_2} f_{\bk_1n_1}f_{\bk_2n_2} \sum_\bG \frac{|C_{\bk_1n_1\bk_2n_2}(\bG)|^2}{|\bk_1-\bk_2-\bG|^2}, where the weight of a `\bk`-point is included in `f_{\bk n}`. Let `E_x'` be defined as the sum above excluding the divergent terms for `\bk_1=\bk_2` and `\bG=0`. With .. math:: F(\bG)=\frac{e^{-\alpha G^2}}{G^2}, we get (see [#Sorouri]_): .. math:: E_x = E_x' -\pi\Omega\sum_{\bk_1n_1n_2}f_{\bk_1n_1}f_{\bk_1n_2} |C_{\bk_1n_1\bk_1n_2}(0)|^2 \left(\sum_{\bk_2\bG}F(\bk_1-\bk_2-\bG)- \sum_{\bk_2}\sum_{\bG\neq\bk_1-\bk_2}F(\bk_1-\bk_2-\bG)\right). In the limit of an infinitely dense sampling of the BZ and a not too small `\alpha`, we get .. math:: \sum_{\bk_2\bG}F(\bk_1-\bk_2-\bG)= \frac{N_k\Omega}{(2\pi)^3}\int_{\text{BZ}}F(\bk)d\bk= \frac{N_k\Omega}{(2\pi)^2}\sqrt{\pi/\alpha}, where `N_k` is the number of `\bk`-points. Finally: .. math:: E_x = E_x' -\pi\Omega\sum_{\bk_1n_1n_2}f_{\bk_1n_1}f_{\bk_1n_2} |C_{\bk_1n_1\bk_1n_2}(0)|^2\gamma, where .. math:: \gamma = \frac{\Omega}{(2\pi)^2}\sqrt{\pi/\alpha}- \sum_{\bk}\sum_{\bG\neq\bk}F(\bk-\bG). The gradient is: .. math:: \frac{\partial E_x}{\partial\tilde\psi_{\bk_1n_1}(\br)}= -\pi\Omega\sum_{\bk_2n_2}f_{\bk_1n_1}f_{\bk_2n_2} e^{i(\bk_1-\bk_2)\cdot\br}\tilde\psi_{\bk_2n_2}(\br) \frac1N\sum_\bG\frac{C_{\bk_1n_1\bk_2n_2}(G)^*}{|\bk_1-\bk_2-\bG|^2} e^{-i\bG\cdot\br}, where `1/|\bk_1-\bk_2-\bG|^2` is replaced by `\gamma` for the term where `\bk_1=\bk_2` and `\bG=0`. .. [#Sorouri] *Accurate and Efficient Method for the Treatment of Exchange in a Plane-Wave Basis*, A. Sorouri, W.M.C. Foulkes, and N.D.M. Hine, J. Chem. Phys. 124, 064105-1 -- 064105-7 (2006) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/profiling.rst000066400000000000000000000044041316441372200245150ustar00rootroot00000000000000.. _profiling: ========= Profiling ========= profile ======= Python has a ``profile`` module to help you find the places in the code where the time is spent. Let's say you have a script ``script.py`` that you want to run through the profiler. This is what you do: >>> import profile >>> profile.run('import script', 'prof') This will run your script and generate a profile in the file ``prof``. You can also generate the profile by inserting a line like this in your script:: ... import profile profile.run('atoms.get_potential_energy()', 'prof') ... To analyse the results, you do this:: >>> import pstats >>> pstats.Stats('prof').strip_dirs().sort_stats('time').print_stats(20) Tue Oct 14 19:08:54 2008 prof 1093215 function calls (1091618 primitive calls) in 37.430 CPU seconds Ordered by: internal time List reduced from 1318 to 20 due to restriction <20> ncalls tottime percall cumtime percall filename:lineno(function) 37074 10.310 0.000 10.310 0.000 :0(calculate_spinpaired) 1659 4.780 0.003 4.780 0.003 :0(relax) 167331 3.990 0.000 3.990 0.000 :0(dot) 7559 3.440 0.000 3.440 0.000 :0(apply) 370 2.730 0.007 17.090 0.046 xc_correction.py:130(calculate_energy_and_derivatives) 37000 0.780 0.000 9.650 0.000 xc_functional.py:657(get_energy_and_potential_spinpaired) 37074 0.720 0.000 12.990 0.000 xc_functional.py:346(calculate_spinpaired) ... ... The list shows the 20 functions where the most time is spent. Check the pstats_ documentation if you want to do more fancy things. .. _pstats: http://docs.python.org/library/profile.html .. tip:: Since the ``profile`` module does not time calls to C-code, it is a good idea to run the code in debug mode - this will wrap calls to C-code in Python functions:: $ python3 script.py --debug .. tip:: There is also a quick and simple way to profile a script:: $ pyhton script.py --profile=prof This will produce a file called ``prof.0000`` where ``0000`` is the rank number (if your run the script in parallel, there will be one file per rank). Use:: $ python3 script.py --profile=- to write the report directly to standard output. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/profiling/000077500000000000000000000000001316441372200237615ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/profiling/select.tau000066400000000000000000000032771316441372200257640ustar00rootroot00000000000000 BEGIN_EXCLUDE_LIST void get_point_gga(functionals_type *, double *, double *, double *) C void xc_gga_vxc(const xc_gga_type *, const double *, const double *, double *, double *, double *) C void xc_gga(const xc_gga_type *, const double *, const double *, double *, double *, double *, double *, double *, double *) C void func(const xc_gga_type *, double, double *, double *, double *, double *) C void gga_c_pbe(const void *, const double *, const double *, double *, double *, double *, double *, double *, double *) C void xc_perdew_params(const xc_gga_type *, const double *, const double *, int, xc_perdew_t *) C void xc_rho2dzeta(int, const double *, double *, double *) C void get_vxc_lda(functionals_type *, double *, double *, double *) C void lda_x(const void *, const double *, double *, double *, double *) C void xc_lda_vxc(const xc_lda_type *, const double *, double *, double *) C void xc_lda(const xc_lda_type *, const double *, double *, double *, double *, double *) C void func(const xc_lda_type *, double *, double, double *, double *, double *, double *, double *, double *) C void g(int, int, double *, double *, double *, double *) C void get_vxc_gga(functionals_type *, double *, double *, double *) C void pbe_eq7(int, int, double, double, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *) C void pbe_eq8(int, int, double, double, double, double *, double *, double *, double *, double *, double *, double *) C void xc_perdew_potentials(xc_perdew_t *, const double *, double, int, double *, double *, double *, double *, double *) C PyObject *spherical_harmonics(PyObject *, PyObject *) C END_EXCLUDE_LIST gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/000077500000000000000000000000001316441372200236215ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/beef.rst000066400000000000000000000017621316441372200252620ustar00rootroot00000000000000Bayesian error estimation functional (BEEF) =========================================== :Who: Jess, Keld We use methods inspired from Bayesian statistics and a large number of datasets of molecular, surface chemical, and solid state materials properties to construct new exchange-correlation density functionals. An essential feature of these functionals is an ensemble of functionals around the optimum one, which allows an estimate of the computational error to be easily calculated in a non-self-consistent fashion. We have recently designed the BEEF-vdW, a GGA with vdW-DF2 type nonlocal correlation. It is fully implemented in GPAW, as is the ensemble error estimate. Presently and in the future we will expand on this work by considering: * metaGGA density functionals, which us the klinetic energy density * self-interaction correction methods, e.g., +U, non-Koopman corrections, etc. Most of the GPAW code related to this project is in :git:`~gpaw/xc/bee.py` and :git:`~c/xc/ensemble_gga.c`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/bse.rst000066400000000000000000000006061316441372200251260ustar00rootroot00000000000000Bethe-Salpeter equation ======================= :Who: Jun Documentation can be found at :ref:`bse theory`. The BSE module can work very well for small bulk systems. See gpaw/test/bse_silicon.py as an example. Recently I have implemented using scalapack library to diagonalize the BSE matrix, so in principle, it can also work for relatively bigger systems. Bigger tests coming soon. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/csm.rst000066400000000000000000000001731316441372200251360ustar00rootroot00000000000000Continuum Solvent Model (CSM) ============================= :Who: Alexander Held See :ref:`continuum_solvent_model`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/ehrenfest.rst000066400000000000000000000007541316441372200263440ustar00rootroot00000000000000Ehrenfest dynamics ================== :Who: Ari, Christian The implementation of Ehrenfest dynamics works and is now available in the development version of GPAW. The TODO list includes documentation, example scripts (high priority) and structural improvements in the code towards something reminiscent of the MD module in ASE. The latter requires a significant amount of work, and hence small improvements such as better automated output (.traj files, for example) will be done first. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/elph.rst000066400000000000000000000004201316441372200252770ustar00rootroot00000000000000Electron-phonon interaction =========================== :Who: Kristen Kaasbjerg A supercell method for calculating the electron-phonon interaction in bulk crystals, molecules, nanoscale contacts etc has been implemented (available from gpaw/elph/electronphonon.py). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/gpu.rst000066400000000000000000000114731316441372200251540ustar00rootroot00000000000000=== GPU === Aalto Effort ============ (Samuli Hakala, Ville Havu, Jussi Enkovaara (CSC) ) We have been implementing the most performance critical C-kernels in the finite-difference mode to utilize GPUs. Implementation is done using CUDA and cuBLAS libraries when possible, Python interface to CUDA, PyCUDA is also utilized. Code supports using multiple GPUs with MPI. First tests indicate promising speedups compared to CPU-only code, and we are hoping to test larger systems (where the benefits are expected to be larger) soon. Currently, we are extending the CUDA implementation to real-time TDDFT. Code is not in full production level yet. Stanford/SUNCAT Effort ====================== (Lin Li, Jun Yan, Christopher O'Grady) We have created a GPU version of the GPAW RPA code. We observe a speedup of 40 (GPU vs. CPU+GPU) making GPUs about a factor of 5 more cost effective for this calculation. It is available in the svn branch rpa-gpu-expt. Installation of cuda on Fedora 18 x86_64 ======================================== First, cuda_5.0.35 does not support gcc version 4.7 and up, either kernel 3.7 and up https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=902045, however there exist workarounds. Proceed as follows: 0. boot a 3.6 kernel 1. yum -y install wget make gcc-c++ freeglut-devel libXi-devel libXmu-devel mesa-libGLU-devel 2. configure rpmfusion-nonfree http://rpmfusion.org/Configuration 3. yum -y install xorg-x11-drv-nvidia-libs 4. disable X:: rm /etc/systemd/system/default.target&& ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 5. select a 3.6 version (see https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=902045 ) of kernel in ``/etc/grub2.cfg`` and make sure the *linux* line contains:: nouveau.modeset=0 rd.driver.blacklist=nouveau See http://www.pimp-my-rig.com/2012/01/unload-nouveau-install-nvidia-driver.html 6. disable kernel and nvidia updates in ``/etc/yum.conf``:: exclude=kernel* *nvidia* 7. reboot 8. download and install cuda:: wget http://developer.download.nvidia.com/compute/cuda/5_0/rel-update-1/installers/cuda_5.0.35_linux_64_fedora16-1.run sh cuda_5.0.35_linux_64_fedora16-1.run -override compiler Keep the recommended installation paths (``/usr/local/cuda-5.0``, ...), and after the installation create a link:: ln -s /usr/local/cuda /opt/cuda 9. add to ``~/bashrc``:: export PATH=/opt/cuda/bin:${PATH} export LD_LIBRARY_PATH=/opt/cuda/lib64:$LD_LIBRARY_PATH and source it. 10. convert error into a warning in ``/usr/local/cuda-5.0/include/host_config.h``:: // #error — unsupported GNU version! gcc 4.7 and up are not supported! #warning — unsupported GNU version! gcc 4.7 and up are not supported! See https://www.udacity.com/wiki/cs344/troubleshoot_gcc47 11. test:: cd NVIDIA_CUDA-5.0_Samples/1_Utilities/deviceQuery make&& ./deviceQuery 12. if X does not run the ``/dev/nvidia*`` will not be created. The solution seems to be creating them by hand (``NvidiaDevCreator.sh``):: #!/bin/bash /sbin/modprobe nvidia if [ "$?" -eq 0 ]; then # Count the number of NVIDIA controllers found. NVDEVS=`lspci | grep -i NVIDIA` N3D=`echo "$NVDEVS" | grep "3D controller" | wc -l` NVGA=`echo "$NVDEVS" | grep "VGA compatible controller" | wc -l` N=`expr $N3D + $NVGA - 1` for i in `seq 0 $N`; do mknod -m 666 /dev/nvidia$i c 195 $i done mknod -m 666 /dev/nvidiactl c 195 255 else exit 1 fi Or switch back to X:: cd /etc/systemd/system ln -s /lib/systemd/system/graphical.target default.target 13. install http://mathema.tician.de/software/pycuda (needed only for *Aalto Effort*):: cd&& git clone https://github.com/inducer/pycuda.git cd ~/pycuda PATH=$PATH:/opt/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib64 python configure.py --update-user --boost-compiler=gcc /bin/mv -f ~/.aksetup-defaults.py siteconf.py sed -i "s/boost_python-py27/boost_python/" siteconf.py sed -i 's/boost_thread/boost_thread-mt/' siteconf.py sed -i "s#'\${CUDA_ROOT}/lib', ##" siteconf.py PATH=$PATH:/opt/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib64 python setup.py install --root=~/pycuda-fc18-1 and add to ``~/.bashrc``:: export PYTHONPATH=~/pycuda-fc18-1/usr/lib64/python2.7/site-packages:${PYTHONPATH} May 7 2013: note that ``compyte`` has been removed from ``pucuda``, but the source of ``pucuda`` does not reflect that. Therefore ``git clone https://github.com/inducer/compyte.git`` and create a link under ``pucuda`` install tree. In addition https://pypi.python.org/pypi/pytools, https://pypi.python.org/pypi/py, https://pypi.python.org/pypi/pytest are required by ``pucuda``. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/gw.rst000066400000000000000000000017501316441372200247730ustar00rootroot00000000000000GW approximation ================ :Who: Falco Single-shot GW calculations are implemented and in the trunk and can be used by everybody. I've started writing documentations and tutorials, but I'm still working on some details. Recent features are: * non-linear frequency grid * Coulomb cutoff for low-dimensional systems * choice of two different methods for calculating the self energy (Hilbert transform False or True) * customized parallelization over k-points and frequencies * read Exact Exchange contributions from file * spin-polarized GW * support of grid, LCAO and planewave mode I've also implemented static COHSEX, but it's not yet in the repository, since I still haven't found a smart way to combine COHSEX and GW within the same piece of code. Right now, I'm preparing and testing self-consistent GW + COHSEX calculations by calculating off-diagonal matrix elements of the self energy and Kohn-Sham exchange-correlation contributions and diagonalizing the full Hamiltonian. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/gwtransport.rst000066400000000000000000000001031316441372200267370ustar00rootroot00000000000000GW-transport ============ :Who: Mikkel See :ref:`keldyshgf`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/hubu.rst000066400000000000000000000005661316441372200253250ustar00rootroot00000000000000Linear response Hubbard +U =========================================== :Who: Keld To implement the linear response approach to the Hubbard +U method of Cococcioni and Gironcili [Physical Review B 71, 035105 (2005)] and the following extensions by Cococcioni, Kulik, Mazari and co workers. The project will evolve in the HubU branch and eventually merge with trunk. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/hybrids.rst000066400000000000000000000007161316441372200260230ustar00rootroot00000000000000Hybrid functionals ================== :Who: Jens Jørgen Currently we have two implementation of exact exchange: 1) :git:`~gpaw/xc/hybrid.py`: Can handle Gamma-point only calculations self-consistently (for molecules and large cells). 2) :git:`~gpaw/xc/exx.py`: Can handle k-points, but not self-consitently. Things to work on: * Implement forces. * Self-consistent k-point calculations. * Hybrids with range separated Coulomb interaction (HSE). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/lrtddft.rst000066400000000000000000000003201316441372200260110ustar00rootroot00000000000000Linear response TDDFT (Casida equation) ======================================= :Who: Jussi Purpose of this branch is to distribute the large Omega matrix when parallelizing over electron-hole pairs. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/mixing.rst000066400000000000000000000006541316441372200256530ustar00rootroot00000000000000Improved density mixing ======================= :Who: Jens Jørgen For density mixing in real-space, we use a special metric (described :ref:`here `) for measuring input to output density changes with more weight on long wavelength changes. We will try to do the density mixing in reciprocal space, where the metric is easier to express and a wave length dependent preconditioning can also easily be applied. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/noncollinear.rst000066400000000000000000000004541316441372200270410ustar00rootroot00000000000000Non-collinear spin ================== :Who: Jens Jørgen We have a proof-of-concept implementation that works for LDA and LCAO. .. note:: Removed after version 1.1! To be done: * Test GGA implementation. * Compare with other codes. * Make it work for finite-difference and plane-wave modes. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/projects.rst000066400000000000000000000004231316441372200262030ustar00rootroot00000000000000.. _projects: ================ Ongoing Projects ================ .. toctree:: setups rmmdiis mixing response bse gw gwtransport ehrenfest beef qmmm sic lrtddft gpu noncollinear hybrids csm elph hubu gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/qmmm.rst000066400000000000000000000016401316441372200253230ustar00rootroot00000000000000QMMM ==== :Who: Elvar Have a functioning QM/MM code - which will soon be available in the development version. It produces reasonable radial distribution functions btw. classical water and quantum water, and quantum ions, when compared to experiment and other similar codes. As the code is written now it assumes that the quantum region is completely screened by the classical environment (no pbc), and that there is enough classical stuff (which is cheap) such that the classical interaction btw. supercells can be treated with the minimum image convention. Currently working on: A) a sensible way to optimize Lennard-Jones parameters for the QM system such that QM-MM interactions are as close as possible to QM-QM interactions (seems to be the norm in literature) B) an algorithm to fit classical inter- and intrapotentials to QM results (i.e. MM parameters on the run) C) Quasi-Newton for QM/MM systems. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/response.rst000066400000000000000000000036311316441372200262140ustar00rootroot00000000000000=================================== Response and RPA correlation energy =================================== (Jun Yan, Thomas Olsen) Excited state properties ======================== RPA correlation energy ====================== The response part of GPAW can be used to calculate ground state correlation energies within the Adiabatic-Connection Dissipation-Fluctuation theorem (ACDF). In Particular, the Random Phase Approximation (RPA) has been implemented and works. A major challenge for RPA calculations is the fact that correlation energies can rarely be converged with respect to plane wave cutoff. Instead one has to calculate the correlation energy as a function of cutoff and extrapolate to infinity. When comparing energy differences between isoelectronic systems in the same unit cell one can often neglect this since the error introduced by using a low cutoff tends to cancel out. When comparing energies obtained with different unit cells (lattice constant) or different electronic structure (atomization energies) extrapolaton is essential. Although the extrapolation is usually rather reliable, it is difficult to obtain an accuracy of a few meV which is needed for van der Waals bonded systems like graphite, BN and MoS2. Another problem is related to the q=0 contribution. A special method is applied to handle this limit where the coulomb interaction diverges. However, for systems with many degenerate states near the Fermi level (non-noble transition metals) the method breaks down and one cannot trust the q=0 contribtion to the correlation energy. For systems with many kpoints one can simply neglect this term, but for large systems where a sparse kpoint sampling is used, the q=0 term becomes important. Presently, the research is focussed on going beyond RPA in the ACDF formalism. In particular, including exchange-correlation kernels in the evalution of the interacting response function. More on this later. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/rmmdiis.rst000066400000000000000000000014111316441372200260140ustar00rootroot00000000000000Improving the RMM-DIIS eigensolver ================================== :Who: Jens Jørgen Currently, our :ref:`RMM-DIIS eigensolver ` will always take two steps for each state. In an attempt to make the eigensolver faster and more robust, we should investigate the effect of taking a variable number of steps depending on the change in the eigenstate error and occupations number as described in [Kresse]_. .. [Kresse] G. Kresse, J. Furthmüller: Phys. Rev. B 54, 11169 - 11186 (1996) "Efficient iterative schemes for ab initio total-energy calculations using a plane-wave basis set" Any potential improvements in algorithms need to be evaluated on a large set of systems. The :ref:`scf_conv_eval` page is dedicated to presenting those evaluations. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/setups.rst000066400000000000000000000010461316441372200256770ustar00rootroot00000000000000New PAW setups ============== :Who: Marcin and Jens Jørgen The goal is to produce new PAW setup for all elements. Compared to our old collection of PAW setups we will focus on: * higher accuracy - more semi-core states might be added * reduced eggbox error * faster convergence of energy with number of grid-points - if possible * tesing the setups more carfully against a bigger set of all-electron results The code is in :git:`~gpaw/atom/generator2.py` and it is based on a new and more robust atomic solver: :git:`~gpaw/atom/aeatom.py`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/projects/sic.rst000066400000000000000000000002351316441372200251310ustar00rootroot00000000000000Orbital-density dependent functionals and self-interaction correction ===================================================================== :Who: Peter gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/000077500000000000000000000000001316441372200240125ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/ase.py000066400000000000000000000004731316441372200251400ustar00rootroot00000000000000class ASECalculator: def __init__(self): self.atoms = None def get_potential_energy(self, atoms): if self.calculation_required(atoms, 'energy'): self.calculate(atoms) self.atoms = atoms.copy() # store copy of last configuration return None ... gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/density.py000066400000000000000000000015621316441372200260470ustar00rootroot00000000000000class Density: def __init__(self): self.gd = None self.mixer = None self.nt_sG = None self.nct = None def read(self, reader): self.gd = reader.get_grid_descriptor() self.mixer = reader.read('mixer') self.nt_sG = reader.get_array('...') def update(self, atoms, **kwargs): # Initialize stuff: if self.gd is None: self.gd = ... if self.mixer is None: self.mixer = Mixer(self.gd) if self.nct is None: self.nct = LFC(atoms) # Change stuff: if 'mixer' in kwargs: self.mixer = kwargs['mixer'] # Update stuff: self.nct.set_positions(atoms) def allocate(self, lfc=True): if lfc: self.nct.allocate() def memory_estimate(self): ... def write(self, foo): ... gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/initialization.rst000066400000000000000000000166121316441372200276010ustar00rootroot00000000000000============================== Initialization and I/O changes ============================== This is a proposal for some changes that will solve various issues with the maintainability and stability of the I/O code amongst other things. .. contents:: Rationale ========= Presently the gpw I/O is handled centrally by the module gpaw/io/__init__.py. If someone makes changes in setup.py or density.py, the I/O may break due to these "non-local correlations" (we in particular, being physicists, should know to appreciate locality), or it may misbehave in subtle ways for certain cases (TDDFT/LCAO/non-gamma-point/etc.). Most of this trouble can be avoided entirely by requiring that objects should know how to read and write themselves. Thus, responsibility for what to write (and how to read it back!) is delegated to various objects as per the usual 'object oriented' way. A different but sort of related issue: The output.py module writes lots of things to the log file, and those things would be better off 'writing themselves'. There are several bugs here waiting to be fixed: if the Poisson solver was created by hand with a non-standard stencil, then the wrong stencil is written. Scalapack/BLACS information is sometimes wrong (depending on the way it was specified). No information on the stridedness of the band descriptor is written (and thus parallelization info is incomplete). There are probably other issues. Object hierarki =============== So all the objects above may implement functions to read and write their own parameters. They could also implement functions to read/write human-readable information to log files (which is highly desirable). On a somewhat deeper level, we could formalize the tree hierarchy between the major GPAW objects and define a mandatory interface for all major objects to implement (read/write, memory estimate, initialize/set_positions/allocate -- these procesure *all* involve traversing the same tree hierarchy). This might make it easier for new programmers to learn the structure of GPAW (a well-known problem). Example of what an object could look like: .. literalinclude:: density.py The PAW calculator object ========================= The following base class (rough sketch) should propably be moved to ASE, so that all ASE-calculators can use it: .. literalinclude:: ase.py It should be possible to create the PAW calculator without knowing the atoms and also from a restart file - and both ways must be cheap. .. literalinclude:: paw.py Open questions -------------- The above pseudo code is not the final answer - it is an attempt to make the further discussions more concrete. There are several things to think about: * What should the ASECalculator look like? * How much should/can ``__init__()`` for the different objects do? Reading and writing =================== We should name things like described here: http://www.etsf.eu/fileformats (is there an ETSF XC library?) Things we need to write: * Version and units. * Atoms: atomic numbers, positions, initial magnetic moments, tags, boundary conditions, unit cell, charges. * Setups: lmax, fingerprints, setup types. * Basis set. * Hamiltonian: Poisson solver, XC functional, effective pseudopotential, non-local part of hamiltonian. * Density: Charge, density convergence criterion, density error, atomic density matrices, interpolation order, pseudoelectron density, multipole moments of compensation charges. * Mixer. * Occupations: fixed magnetic moment flag, smearing type, width, Fermi level, occupation numbers. * Symmmetry: Symmetry matrices, atom maps. * Parameters that the result should not depend on: hund, random, maxiter, eigensolver?, parallel (domain, band, stridebands, scalapack). * SCF: energy convergence criterion, energy error. * Eigensolver: eigenstates convergence criterion, number of bands to converge, eigenstate error(s)? * Calculated stuff: Ekin, Epot, Ebar, Eext, Exc, S, forces, potential energy, magnetic moments, dipole moment. * Brillouin zone sampling: BZ, IBZ, weights, maps, symmetries. * Projections. * Pseudo wave functions. * Eigenvalues. What do we do with these: fixdensity, mode, Kohn Sham stencil, h, charge? What do we need in order to better support: * DSCF * DFPT * response functions * GW * TDDFT * NEGF transport * LCAO * plane waves * other things? How should reading and writing work? * Should it be like pickle where the class name is written (example: gpaw.mixer.MixerSum). The reader will then create that object and read into it? * What methods should a reader have? ``get_object('name of object')``, ``get_array('name of array')``, ``get_atoms()``, ``get_grid_descriptor()``, ... * We need backwards compatibility. Also, there should be well defined interface so that it is easy to use different backends (.gpw, hdf5, ...). I think that the current io-interface ('__set_item__', 'dimension', 'add', 'fill', ...) is quite well defined, and if new IO scheme requires additions/modifications, they should be such that different backends can easily support them. Some thoughts about different backends: --------------------------------------- If/when each object writes/reads itself, some sort of hierarchical file format would be convenient. I am not that familiar with tarfile-interface used for .gpw files, but I think that it can support hierarchical structure (folders and files). Also, HDF5 supports hierarchical structure ("hierarchical data format"), basic structure of HDF5 file is groups and datasets. Other formats that one could think of are MPI-IO and netcdf, but that they do not really support hierarchical structure. Drawback of MPI-IO is also that the files are not necessarily portable (although it should be possible to ensure portability with the price of more expensive IO). Here is a prototype implementation of a hierarchical reader/writer framework: :download:`rw.py`. Parallel IO =========== For large calculations it will be more or less compulsory to perform IO in parallel. Even though a filesystem would not support parallel IO (meaning that read/write are not faster than in serial case), memory requirements can prohibit collecting the data into single process. As an example, in large calculation with e.g. 200**3 grid, collecting density into single process requires 8 * 400**3 ~ 500 MB. Some backends supporting parallel IO are MPI-IO, parallel-netcdf, and HDF5, and there are existing python interfaces to MPI-IO (mpi4py) and HDF5 (h5py and pytables). GPAW can already use h5py without parallel capabilities. Enabling parallel IO with h5py is quite simple as it requires adding only two simple functions to GPAW. At some point, we should start using mpi4py with GPAW. Backends ======== Tarfile ------- Relatively simple, portable and no external dependencies, but: * no parallel IO, single process has to collect data * no direct access with external software (visualization etc.) HDF5 ---- Portable, can perform parallel IO and external software can access the file directly, but: * additional dependencies (at least HDF5 library, a python interface could in principle be included in GPAW) * porting to more exotic architectures (Cray, Blue Gene) can be tricky? Directory --------- A bit like an extraxted tarfile. Different cpu's could write different states. When the writing is done, one can tar the directory to get a standard gpw file. The tarfile format would have to be modifyed so that one can read pseudo wave functions from several files. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/paw.py000066400000000000000000000024431316441372200251560ustar00rootroot00000000000000class PAW(ASECalculator): def __init__(self, restart=None, **kwargs): ASECalculator.__init__(self) self.density = Density() self.hamiltonian = Hamiltonian() self.wfs = WaveFunctions() if restart: self.read(Reader(restart)) self.update(self.atoms, **kwargs) def read(self, reader): self.atoms = reader.read_atoms() self.density.read(reader) self.hamiltonian.read(reader) self.wfs = self.wfs.read(reader) def update(self, atoms, **kwargs): """Lazy update.""" self.density.update(self.atoms, kwargs) self.hamiltonian.update(self.atoms, kwargs) # If we change mode, we could get a completely new type of # wave function object: self.wfs = self.wfs.update(self.atoms, kwargs) def set(self, **kwargs): self.update(self,atoms, **kwargs) def allocate(self, wfs=False, lfc=True): self.density.allocate(lfc) self.hamiltonian.allocate(lfc) self.wfs.allocate(wfs, lfc) def calculate(self, atoms): self.update(atoms) self.allocate(wfs=True) ... def get_potential_energy(self, atoms): ASECalculator.get_potential_energy(self, atoms) return self.hamiltonian.energy gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/proposals.rst000066400000000000000000000002031316441372200265610ustar00rootroot00000000000000========================== GPAW enhancement proposals ========================== .. toctree:: :maxdepth: 1 initialization gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/proposals/rw.py000066400000000000000000000227161316441372200250240ustar00rootroot00000000000000from __future__ import print_function """ File content:: 0: "IOASE..." 8: version 16: nitems (int64) 24: 32 (position of offsets, int64) 32: p0 (offset to json data, int64) 40: 8-byte aligned ndarrays p0: n (length of json data, int64) p0+8: json data p0+8+n: EOF """ # magig prefix?, ascii header? See hdf5 header, # ordereddict, endianness, todict? import numpy as np from ase.db.jsondb import encode, decode VERSION = 1 N1 = 42 # block size - max number of items: 1, N1, N1*N1, N1*N1*N1, ... def align(fd): """Advance file descriptor to 8 byte alignment and return position.""" pos = fd.tell() r = pos % 8 if r == 0: return pos fd.write(b'#' * (8 - r)) return pos + 8 - r def writeint(fd, n, pos=None): """Write 64 bit integer n at pos or current position.""" if pos is not None: fd.seek(pos) np.array(n, np.int64).tofile(fd) class Writer: def __init__(self, fd, mode='w', data=None): """Create writer object. The data dictionary holds: * data for type bool, int, float, complex and str * shape and dtype for ndarrays * class names for other objects These other objects must have a write() method and a static read() method.""" assert np.little_endian if data is None: data = {} if mode == 'w': self.nitems = 0 self.itemoffsets = 32 self.offsets = np.array([-1], np.int64) fd = open(fd, 'wb') # Write file format identifier: fd.write(b'IOASE...') np.array([VERSION, self.nitems, self.itemoffsets], np.int64).tofile(fd) self.offsets.tofile(fd) elif mode == 'a': fd = open(fd, 'r+b') version, self.nitems, self.itemoffsets, offsets = \ read_header(fd) assert version == VERSION n = 1 while self.nitems > n: n *= N1 padding = np.zeros(n - self.nitems, np.int64) self.offsets = np.concatenate((offsets, padding)) fd.seek(0, 2) else: 2 / 0 self.fd = fd self.data = data # Shape and dtype of array being filled: self.shape = (0,) self.dtype = None def add_array(self, name, shape, dtype=float, delayed_read=True): if isinstance(shape, int): shape = (shape,) i = align(self.fd) self.data[name] = {'_type': 'numpy.ndarray', 'shape': shape, 'dtype': np.dtype(dtype).name, 'offset': i} if delayed_read: self.data[name]['_delayed'] = True assert self.shape[0] == 0, 'last array not done' self.dtype = dtype self.shape = shape def fill(self, a): assert a.dtype == self.dtype if a.shape[1:] == self.shape[1:]: assert a.shape[0] <= self.shape[0] self.shape = (self.shape[0] - a.shape[0],) + self.shape[1:] else: assert a.shape == self.shape[1:] self.shape = (self.shape[0] - 1,) + self.shape[1:] assert self.shape[0] >= 0 a.tofile(self.fd) def sync(self): """Write data dictionary. Write bool, int, float, complex and str data, shapes and dtypes for ndarrays and class names for other objects.""" assert self.shape[0] == 0 i = self.fd.tell() s = encode(self.data).encode() writeint(self.fd, len(s)) self.fd.write(s) n = len(self.offsets) if self.nitems >= n: offsets = np.zeros(n * N1, np.int64) offsets[:n] = self.offsets self.itemoffsets = align(self.fd) offsets.tofile(self.fd) writeint(self.fd, self.itemoffsets, 24) self.offsets = offsets self.offsets[self.nitems] = i writeint(self.fd, i, self.itemoffsets + self.nitems * 8) self.nitems += 1 writeint(self.fd, self.nitems, 16) self.fd.flush() self.fd.seek(0, 2) # end of file self.data = {} def write(self, **kwargs): """Write data. Use:: writer.write(n=7, s='abc', a=np.zeros(3), density=density). """ for name, value in kwargs.items(): if isinstance(value, (bool, int, float, complex, dict, list, tuple, str)): self.data[name] = value elif isinstance(value, np.ndarray): self.add_array(name, value.shape, value.dtype, delayed_read=False) self.fill(value) else: self.data[name] = {'_type': value.__module__ + '.' + value.__class__.__name__} writer = Writer(self.fd, data=self.data[name]) value.write(writer) def close(self): self.sync() self.fd.close() def read_header(fd): fd.seek(0) assert fd.read(8) == b'IOASE...' version, nitems, itemoffsets = np.fromfile(fd, np.int64, 3) fd.seek(itemoffsets) offsets = np.fromfile(fd, np.int64, nitems) return version, nitems, itemoffsets, offsets class Reader: def __init__(self, fd, item=0, data=None): """Create hierarchy of readers. Store data as attributes for easy access and to allow tab-completion.""" assert np.little_endian if isinstance(fd, str): fd = open(fd, 'rb') self.fd = fd if data is None: self.version, self.nitems, self.itemoffsets, self.offsets = \ read_header(fd) data = self._read_data(item) for name, value in data.items(): if isinstance(value, dict) and '_type' in value: if value['_type'] == 'numpy.ndarray': read_now = '_delayed' not in value value = NDArrayReader(fd, value['shape'], np.dtype(value['dtype']), value['offset']) if read_now: value = value.read() else: value = Reader(self.fd, data=value) data[name] = value self.data = data def __dir__(self): return self.data.keys() def __getattr__(self, attr): value = self.data[attr] if isinstance(value, NDArrayReader): return value.read() return value def proxy(self, name): value = self.data[name] assert isinstance(value, NDArrayReader) return value def __len__(self): return self.nitems def _read_data(self, item): self.fd.seek(self.offsets[item]) size = np.fromfile(self.fd, np.int64, 1)[0] data = decode(self.fd.read(size).decode()) return data def __getitem__(self, i): data = self._read_data(i) return Reader(self.fd, data=data) read = Reader write = Writer class NDArrayReader: def __init__(self, fd, shape, dtype, offset): self.fd = fd self.shape = tuple(shape) self.dtype = dtype self.offset = offset self.ndim = len(self.shape) self.itemsize = dtype.itemsize self.size = np.prod(self.shape) self.nbytes = self.size * self.itemsize def __len__(self): return self.shape[0] def read(self): return self[:] def __getitem__(self, i): if isinstance(i, int): return self[i:i + 1][0] start, stop, step = i.indices(len(self)) offset = self.offset + start * self.nbytes // len(self) self.fd.seek(offset) count = (stop - start) * self.size // len(self) a = np.fromfile(self.fd, self.dtype, count) a.shape = (-1,) + self.shape[1:] if step != 1: return a[::step].copy() return a def main(): args = sys.argv[1:] r = Reader(args[0]) exec('x = ' + rags[1]) # csv for 2d ... print(x) if __name__ == '__main__': class A: def write(self, writer): writer.write(x=np.ones((2, 3))) @staticmethod def read(reader): a = A() a.x = reader.x return a w = Writer('a.ioase') w.write(a=A(), y=9) w.write(s='abc') w.sync() w.write(s='abc2') w.sync() w.write(s='abc3', z=np.ones(7, int)) w.close() print(w.data) r = Reader('a.ioase') print(r.y, r.s) print(A.read(r.a).x) print(r.a.x) print(r[1].s) print(r[2].s) print(r[2].z) w = Writer('a.ioase', 'a') print(w.nitems, w.offsets) w.write(d={'h': [1, 'asdf']}) w.add_array('psi', (4, 3)) w.fill(np.ones((1, 3))) w.fill(np.ones((1, 3)) * 2) w.fill(np.ones((2, 3)) * 3) w.close() print(Reader('a.ioase', 3).d) print(Reader('a.ioase')[2].z) print(Reader('a.ioase', 3).proxy('psi')[0:3]) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/setups.rst000066400000000000000000000032351316441372200240500ustar00rootroot00000000000000Atomic PAW setups ================= .. _setup_matrix_elements_nabla: Calculating matrix elements of nabla ------------------------------------ This integral is needed for LrTDDFT and response function related quantities: .. math:: \langle\phi_i|\mathbf\nabla|\phi_{i'}\rangle - \langle\tilde\phi_i|\mathbf\nabla|\tilde\phi_{i'}\rangle, where `|\phi_i\rangle = \phi_i(\mathbf r) = \phi_j(r)Y_{\ell m}(\hat{\mathbf r})`, and `|\tilde\phi_i\rangle = \tilde\phi_i(\mathbf r) = \tilde\phi_j(r)Y_{\ell m}(\hat{\mathbf r})`. .. math:: \langle\phi_i|\mathbf\nabla|\phi_{i'}\rangle = \langle\phi_i|\frac{\partial}{\partial r}(\phi_{j'}/r^{\ell'}) \frac{\partial r}{\partial \mathbf r} r^{\ell'}Y_{\ell'm'}\rangle + \langle\phi_i|\frac{\phi_{j'}}{r^{\ell'}} \mathbf\nabla(r^{\ell'}Y_{\ell'm'})\rangle. Since we use real-valued spherical harmonics, we have: .. math:: \frac{\partial r}{\partial \mathbf r}= \hat{\mathbf r}=(x/r,y/r,z/r)= \sqrt{\frac{4\pi}{3}}(Y_{1m_x},Y_{1m_y},Y_{1m_z}). Splitting the integral in radial and angular parts, we get: .. math:: \langle\phi_i|\frac{\partial}{\partial x}|\phi_{i'}\rangle = \sqrt{\frac{4\pi}{3}} \int r^2dr \phi_j\frac{\partial}{\partial r}(\phi_{j'}/r^{\ell'})r^{\ell'} G_{1m_x,\ell'm'}^{\ell m} + \int r^2dr \phi_j\phi_{j'}/r \int d\hat{\mathbf r} Y_{\ell m}r^{1-\ell'}\frac{\partial}{\partial x} (r^{\ell'}Y_{\ell'm'}), where `G_{\ell m,\ell'm'}^{\ell''m''}` are Gaunt coefficents and the last angular integral has been calculated as ``Y_LLv`` in the :git:`~gpaw/gaunt.py` module. More stuff ---------- .. autoclass:: gpaw.setup.Setup :members: .. autoclass:: gpaw.setup.Setups :members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/symmetry.rst000066400000000000000000000054071316441372200244210ustar00rootroot00000000000000Symmetry ======== Let `\mathbf A^T=(\mathbf a_0,\mathbf a_1, \mathbf a_2)`, where `\mathbf a_0`, `\mathbf a_1` and `\mathbf a_2` are the lattice vectors of the unit cell. .. note:: `(\mathbf a_c)_v=\mathbf A_{cv}` is stored in ``gd.cell_cv[c, v]`` in units of Bohr and in ``atoms.cell[c, v]`` in Å units. The relation between scaled positions `\mathbf s` and xyz-positions `\mathbf r` is `\mathbf r=\mathbf A^T\mathbf s`. A crystal has a set of symmetry operations (``symmetry.op_scc``) in the form of matrices `\mathbf U` so that the lattice vectors are transformed to `\mathbf A'=\mathbf U\mathbf A` and `\mathbf r` is transformed to `\mathbf r'` as: .. math:: \mathbf r'= \mathbf A'^T\mathbf s= \mathbf A^T\mathbf U^T\mathbf s= \mathbf A^T\mathbf U^T\mathbf A^{-T}\mathbf r= \mathbf M\mathbf r, where `\mathbf M=\mathbf A^T\mathbf U^T\mathbf A^{-T}`. If we want to express `\mathbf r'` in terms of the original lattice vectors (`\mathbf r'=\mathbf A^T\mathbf s'`), we get: .. math:: \mathbf s' = \mathbf U^T\mathbf s. .. note:: The `\mathbf U` matrices contain only the integers -1, 0 and 1. Also note, that if `\mathbf U` is a symmetry operation, then `\mathbf U^{-1}` is too. Let `\tilde\psi_{\mathbf k}(\mathbf r)` be a Bloch wave function and `\mathbf R` any Bravais lattice vector: .. math:: \tilde\psi_{\mathbf k}(\mathbf r+\mathbf R)= e^{i\mathbf k^T\mathbf R}\tilde\psi_{\mathbf k}(\mathbf r). Transforming `\tilde\psi_{\mathbf k}` with our symmetry operation, we get `\tilde\psi'_{\mathbf k'}(\mathbf r)=\tilde\psi_{\mathbf k}(\mathbf M\mathbf r)` and: .. math:: \tilde\psi'_{\mathbf k'}(\mathbf r+\mathbf R)= \tilde\psi_{\mathbf k}(\mathbf M\mathbf r+\mathbf M\mathbf R)= e^{i\mathbf k^T\mathbf M\mathbf R} \tilde\psi_{\mathbf k}(\mathbf M\mathbf r)= e^{i\mathbf k^T\mathbf M\mathbf R} \tilde\psi'_{\mathbf k'}(\mathbf r). From this equation it is seen that `\mathbf k'=\mathbf M^T\mathbf k`. In terms of scaled k-points `\mathbf q`, where: .. math:: \mathbf k=2\pi\mathbf A^{-1}\mathbf q, we get `\mathbf q'=\mathbf U\mathbf q`. Besides cystal symmetry, there is also time reversal symmetry for all systems with no magnetic field. The wavefunction for `{\mathbf k}` and `{-\mathbf k}` is related as: .. math:: \tilde\psi_{-\mathbf k}(\mathbf r) = \tilde\psi^{\ast}_{\mathbf k}(\mathbf r) If in addition the crystal has inversion symmetry, then the wavefunction should satisfy: .. math:: \tilde\psi_{\mathbf k}(\mathbf r) = \tilde\psi_{-\mathbf k}(-\mathbf r) = \tilde\psi^{\ast}_{\mathbf k}(-\mathbf r) .. note:: Time reversal symmetry operation is not included in ``symmetry.op_scc``. Details of the symmetry object ------------------------------ .. autoclass:: gpaw.symmetry.Symmetry :members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/technology.rst000066400000000000000000000030001316441372200246660ustar00rootroot00000000000000.. _technology: ========== Technology ========== List of important stuff: ================= ====================================================== Python_ An object oriented, interpreted language. `C`_ A compiled language. reStructuredText_ This document is written using reStructuredText_. BLAS_ Basic Linear Algebra Subroutines LAPACK_ Linear Algebra PACKage `NumPy`_ Numeric Python provides array manipulation and computational capabilities similar to those found in IDL, Matlab, or Octave. distutils_ A suite of standard distribution utilities for Python MPI_ Message Passing Interface BLACS_ Basic Linear Algebra Communication Subprograms ScaLAPACK_ Scalable LAPACK ================= ====================================================== .. _Python: https://www.python.org .. _C: http://www.open-std.org/jtc1/sc22/open/n2794/n2794.pdf .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _docutils: http://docutils.sourceforge.net .. _BLAS: http://www.netlib.org/blas .. _LAPACK: http://www.netlib.org/lapack .. _NumPy: http://www.numpy.org .. _distutils: https://docs.python.org/library/distutils.html .. _MPI: http://www.mpi-forum.org .. _FFTW: http://www.fftw.org .. _BLACS: http://www.netlib.org/blacs .. _ScaLAPACK: http://www.netlib.org/scalapack/scalapack_home.html gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/testing.rst000066400000000000000000000103611316441372200242000ustar00rootroot00000000000000.. _testing: ============ Testing GPAW ============ Testing of gpaw is done by a nightly test suite consisting of many small and quick tests and by a weekly set of larger test. Quick test suite ================ Use the :program:`gpaw-test` command to run the tests:: $ gpaw-test --help Usage: gpaw-test [options] [tests] Options: --version show program's version number and exit -h, --help show this help message and exit -x test1.py,test2.py,..., --exclude=test1.py,test2.py,... Exclude tests (comma separated list of tests). -f, --run-failed-tests-only Run failed tests only. --from=TESTFILE Run remaining tests, starting from TESTFILE --after=TESTFILE Run remaining tests, starting after TESTFILE --range=test_i.py,test_j.py Run tests in range test_i.py to test_j.py (inclusive) -j JOBS, --jobs=JOBS Run JOBS threads. --reverse Run tests in reverse order (less overhead with multiple jobs) -k, --keep-temp-dir Do not delete temporary files. A temporary directory will be made and the tests will run in that directory. If all tests pass, the directory is removed. The test suite consists of a large number of small and quick tests found in the :git:`gpaw/test/` directory. The tests run nightly in serial and in parallel. Here are the results from `BuildBot `_. Adding new tests ---------------- A test script should fulfill a number of requirements: * It should be quick. Preferably a few seconds, but a few minutes is OK. If the test takes several minutes or more, consider making the test a :ref:`big test `. * It should not depend on other scripts. * It should be possible to run it on 1, 2, 4, and 8 cores. A test can produce standard output and files - it doesn't have to clean up. Remember to add the new test to list of all tests specified in the :git:`gpaw/test/__init__.py` file. Use this function to check results: .. function:: gpaw.test.equal(x, y, tolerance=0, fail=True, msg='') .. _big-test: .. _agts: Big tests ========= The directory in :git:`gpaw/test/big/` contains a set of longer and more realistic tests that we run every weekend. These are submitted to a queueing system of a large computer. Here is an example for Niflheim: :git:`gpaw/test/big/niflheim.py`. Adding new tests ---------------- To add a new test, create a script somewhere in the file hierarchy ending with .agts.py (e.g. ``submit.agts.py``). ``AGTS`` is short for Advanced GPAW Test System (or Another Great Time Sink). This script defines how a number of scripts should be submitted to niflheim and how they depend on each other. Consider an example where one script, calculate.py, calculates something and saves a .gpw file and another script, analyse.py, analyses this output. Then the submit script should look something like:: def agts(queue): calc = queue.add('calculate.py', ncpus=8, walltime=25) queue.add('analyse.py' ncpus=1, walltime=5, deps=[calc]) As shown, this script has to contain the definition of the function ``agts()`` which should take exactly one argument, ``queue``. Then each script is added to a queue object, along with some data which defines how and when to run the job. Note how ``queue.add()`` returns a job object which can be used to specify dependencies. Possible keys are: ============= ======== ============= =================================== Name Type Default value Description ============= ======== ============= =================================== ``ncpus`` ``int`` ``1`` Number of cpus ``walltime`` ``int`` ``15`` Requested walltime in minutes ``deps`` ``list`` ``[]`` List of jobs this job depends on ``creates`` ``list`` ``[]`` List of files this job creates (figures and other stuff for the web-page) ============= ======== ============= =================================== gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/wavefunctions.rst000066400000000000000000000005431316441372200254170ustar00rootroot00000000000000Wave functions ============== .. autoclass:: gpaw.wavefunctions.base.WaveFunctions :members: .. autoclass:: gpaw.wavefunctions.fd.FDWaveFunctions :members: .. autoclass:: gpaw.wavefunctions.lcao.LCAOWaveFunctions :members: .. autoclass:: gpaw.kpoint.KPoint :members: .. autoclass:: gpaw.eigensolvers.eigensolver.Eigensolver :members: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/devel/writing_documentation.rst000066400000000000000000000034311316441372200271370ustar00rootroot00000000000000===================== Writing documentation ===================== .. highlight:: bash We use the Sphinx_ tool to generate the GPAW documentation. First, you should take a look at the documentation for Sphinx_ and reStructuredText_. Also, read carefully the :ref:`Writing documentation for ASE ` page. .. _reStructuredText: http://docutils.sf.net/rst.html .. _Sphinx: http://www.sphinx-doc.org Getting started =============== If you don't already have your own copy of the GPAW package, then perform a :ref:`developer installation`. Then :command:`cd` to the :file:`doc` directory and build the html-pages:: $ cd ~/gpaw/doc $ make .. Note:: Make sure that you build the Sphinx documentation using the corresponding GPAW version by setting the environment variables :envvar:`PYTHONPATH`, :envvar:`PATH` (described at :ref:`developer installation`) and the location of setups (described at :ref:`installation of paw datasets`). Make your changes to the ``.rst`` files, run the :command:`make` command again, check the results and if things looks ok, commit:: $ emacs index.rst $ make $ firefox build/html/index.html $ git add index.rst $ git commit -m "..." Adding figures and tables ========================= We don't want to have png and csv files committed to Git. Instead, you should add the Python scripts that generate the figures and table data so that we can always generate them again if needed. For quick scripts (no more than 5 seconds), see :ref:`ase:generated`. For more expensive scripts you can use :ref:`AGTS ` for running long jobs that create figures or table data for this web-page. For an example, look at the source code :git:`here ` which will produce this: :ref:`stm tutorial`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/000077500000000000000000000000001316441372200235425ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/advanced_topics.rst000066400000000000000000000012401316441372200274170ustar00rootroot00000000000000.. _advanced_topics: Advanced topics --------------- Here is a list of specific advanced topics and functionalities of the GPAW calculator: .. toctree:: :maxdepth: 2 lcao/lcao parallel_runs/parallel_runs convergence restart_files rmm-diis orthogonalization external xc/xc xc/exx xc/rpa poisson transport/keldyshgf tddft/tddft electrodynamics/electrodynamics bse/bse gw_theory/gw_theory dscf/dscf pdos/pdos xas/xas densitymix/densitymix scf_conv_eval/scf_conv_eval cmdline ../devel/electrostatic_potential ../devel/eigenvalues_of_core_states ../devel/grids ../setups/generation_of_setups gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/bse/000077500000000000000000000000001316441372200243135ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/bse/Feynman.png000066400000000000000000000264221316441372200264240ustar00rootroot00000000000000PNG  IHDRh IDATxr0ѩ,|K$OR-Nwu')C*["U~C _M B_nuX]? c0a @0 a 0 1`c0a @0 a 0 1`c0a <.$?EYDatm6[~ʗ/c,8 59$,1`$$}M2pAil0`IX]צ&ImXfcXK{[0]=䧜1rcR1B c!$gc}뺮svE-ƘA'g,1,SNsm$޶}iquC?o15L%1X` ܇K1Kq R\pAiTk6s46U` 8p?!sgˇ 5E3Hc3]oOI@`;յS4j0vCBJ>d#9<` ~ X?r{59$\i6^[ao!c!{).Q?1N6dKqte%v-ld6! HIoEaQ( YmҰHy x.۰g,[R upo/pV??>}蓮CuؠAeسӁf,mkrĸ Aۏ8#:xڒ`zI3!߫>E#(C1oy aNɪk5L   _4ӟ}lڮ>og:4]CziƦ>Օ6c_=4XGhO/+>\55NQ h u4$6 #ykN5@](sEbE/N#=릣ue}Nrq::{Jp=,@Jd8e"_^H<GRZI7B=Sƚl3LЌտ)Ge!QſgWh253flm>9+h^]+֢U$܇Qhƃ/_ٙ0Ҫ]O,陴S8r8;f}QWN3 仳#A94獻Wկ 'C)~=Tg.Nm6!TgIȂgҞ'I~VEyn)q(J`Mv^9S_a w[IϴKf) \Nb<9<ϝ'd9G\aIIL8W^{h%dT᳐zHa(kR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a @4\MJCIENDB`gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/bse/bse.rst000066400000000000000000000447251316441372200256320ustar00rootroot00000000000000.. _bse theory: ============================================ Bethe-Salpeter Equation - Theory ============================================ Introduction ============ The BSE object calculates optical and dielectric properties of extended systems including the electron-hole interaction (excitonic effects). The four point Bethe-Salpeter equation ====================================== Please refer to :ref:`df_theory` for the documentation on the density response function `\chi`. Most of the derivations in this page follow reference \ [#Review]_. The following diagrams \ [#Review]_ representing the four point Bethe-Salpeter equation: .. image:: Feynman.png :height: 200 px :align: center It can be written as: .. math:: :label: chi_4point &\chi(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3, \mathbf{r}_4; \omega) = \chi^{0}(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3, \mathbf{r}_4; \omega) \\ & + \int d \mathbf{r}_5 d \mathbf{r}_6 d \mathbf{r}_7 d \mathbf{r}_8 \chi^{0}(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_5, \mathbf{r}_6; \omega) K( \mathbf{r}_5, \mathbf{r}_6, \mathbf{r}_7, \mathbf{r}_8; \omega) \chi(\mathbf{r}_7, \mathbf{r}_8, \mathbf{r}_3, \mathbf{r}_4; \omega) where .. math:: K = V - W = \frac{1}{| \mathbf{r}_5 - \mathbf{r}_7|} \delta_{ \mathbf{r}_5, \mathbf{r}_6} \delta_{ \mathbf{r}_7, \mathbf{r}_8} - \int d \mathbf{r} \frac{\epsilon^{-1}( \mathbf{r}_5, \mathbf{r}; \omega )} {| \mathbf{r} - \mathbf{r}_6|} \delta_{ \mathbf{r}_5, \mathbf{r}_7} \delta_{ \mathbf{r}_6, \mathbf{r}_8} The density response function `\chi`, defined as `\chi(\mathrm{r}, \mathrm{r}^{\prime}) = \delta n(\mathrm{r}) / \delta V_{ext}(\mathrm{r}^{\prime})`, has a form of .. math:: :label: chi_2point \chi(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3, \mathbf{r}_4; \omega) = \chi(\mathbf{r}_1, \mathbf{r}_3; \omega) \delta_{ \mathbf{r}_1, \mathbf{r}_2} \delta_{ \mathbf{r}_3, \mathbf{r}_4} The above equation also applies for the non interacting density response function `\chi^0`. As a result, the four point Bethe-Salpeter equation :eq:`chi_4point` can be reduced to: .. math:: :label: chi_reduced \chi(\mathbf{r}, \mathbf{r}^{\prime}; \omega) &= \chi^0(\mathbf{r}, \mathbf{r}^{\prime}; \omega) + \int d \mathbf{r}_5 d \mathbf{r}_7 \chi^0(\mathbf{r}, \mathbf{r}_5; \omega) \frac{1}{| \mathbf{r}_5 - \mathbf{r}_7|} \chi(\mathbf{r}_7, \mathbf{r}^{\prime}; \omega) \\ &+ \int d \mathbf{r}_5 d \mathbf{r}_6 d \mathbf{r}^{\prime \prime} \chi^0(\mathbf{r}, \mathbf{r}_5, \mathbf{r}_6; \omega) \frac{\epsilon^{-1}( \mathbf{r}_5, \mathbf{r}^{\prime \prime}; \omega )} {| \mathbf{r}^{\prime \prime} - \mathbf{r}_6|} \chi(\mathbf{r}_5, \mathbf{r}_6, \mathbf{r}^{\prime}; \omega) Transform using electron-hole pair basis ======================================== Since for each excitation, only a limited number of electron-hole pairs will contribute , the above equation can be effectively transformed to electron-hole pair space. Supposed that the eigenfunctions `\psi_{n}` of the effective Kohn-Sham hamiltonian form an orthonormal and complete basis set, any four point function `S` can then be transformed as .. math:: :label: S S(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3, \mathbf{r}_4; \omega) = \sum_{n_1 n_2 n_3 n_4} \psi^{\ast}_{n_{1}}(\mathbf{r}_1) \psi_{n_{2}}(\mathbf{r}_2) \psi_{n_{3}}(\mathbf{r}_3) \psi^{\ast}_{n_{4}}(\mathbf{r}_4) S_{\begin{array}{l} n_1 n_2 \\ n_3 n_4 \end{array}} (\omega) The non interacting density response function `\chi^0` .. math:: :label: chi_0 \chi^0(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3, \mathbf{r}_4; \omega) = \sum_{n n^{\prime}} \frac{f_n - f_{n^{\prime}}}{\epsilon_n - \epsilon_{n^{\prime}}-\omega} \psi^{\ast}_n(\mathbf{r}_1) \psi_{n^{\prime}}(\mathbf{r}_2) \psi_n(\mathbf{r}_3) \psi^{\ast}_{n^{\prime}}(\mathbf{r}_4) is then diagonal in the electron-hole basis with .. math:: :label: chi_0_eh \chi^0_{\begin{array}{l} n_1 n_2 \\ n_3 n_4 \end{array}} (\omega) = \frac{f_{n_2} - f_{n_1}}{\epsilon_{n_2} - \epsilon_{n_1}-\omega} \delta_{n_1, n_3} \delta_{n_2, n_4} Substitute Eq. :eq:`S` and :eq:`chi_0` into Eq. :eq:`chi_reduced` and by using Eq. :eq:`chi_2point` ,the four point Bethe-Salpeter equation in electron-hole pair space becomes .. math:: :label: chi_eh \chi_{\begin{array}{l} n_1 n_2 \\ n_3 n_4 \end{array}} (\omega) = \chi^0_{n_1 n_2} (\omega) \left[ \delta_{n_1 n_3} \delta_{n_2 n_4} + \sum_{n_5 n_6} K_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} (\omega) \chi_{\begin{array}{l} n_5 n_6 \\ n_3 n_4 \end{array}} (\omega) \right] with `K = V - W` and .. math:: :label: V_2p V_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} = \int d \mathbf{r} d \mathbf{r}^{\prime} \psi_{n_1}(\mathbf{r}) \psi_{n_2}^{\ast}(\mathbf{r}) \frac{1}{| \mathbf{r}-\mathbf{r}^{\prime} |} \psi^{\ast}_{n_5}(\mathbf{r}^{\prime}) \psi_{n_6}(\mathbf{r}^{\prime}) .. math:: :label: W_2p W_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} (\omega) = \int d \mathbf{r} d \mathbf{r}^{\prime} d \mathbf{r}^{\prime \prime} \psi_{n_1}(\mathbf{r}) \psi_{n_2}^{\ast}(\mathbf{r}^{\prime}) \frac{\epsilon^{-1}( \mathbf{r}, \mathbf{r}^{\prime \prime}; \omega )}{| \mathbf{r}^{\prime \prime}-\mathbf{r}^{\prime} |} \psi^{\ast}_{n_5}(\mathbf{r}) \psi_{n_6}(\mathbf{r}^{\prime}) Bethe-Salpeter equation as an effective two-particle Hamiltonian ================================================================ In order to solve Eq. :eq:`chi_eh`, one has to invert a matrix for each frequency. This problem can be reformulated as an effective eigenvalue problem. Rewrite Eq. :eq:`chi_eh` as .. math:: \sum_{n_5 n_6} \left[ \delta_{n_1 n_5} \delta_{n_2 n_6} - \chi^0_{n_1 n_2}(\omega) K_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} (\omega) \right] \chi_{\begin{array}{l} n_5 n_6 \\ n_3 n_4 \end{array}} (\omega) = \chi^0_{n_1 n_2}(\omega) Insert Eq. :eq:`chi_0_eh` into the above equation, one gets .. math:: :label: chi_rewrite \sum_{n_5 n_6} \left[ (\epsilon_{n_2} - \epsilon_{n_1}-\omega) \delta_{n_1 n_5} \delta_{n_2 n_6} - (f_{n_2} - f_{n_1}) K_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} (\omega) \right] \chi_{\begin{array}{l} n_5 n_6 \\ n_3 n_4 \end{array}} (\omega) = f_{n_2} - f_{n_1} By using a static interaction kernel `K(\omega=0)`, an effective frequency-indendepnt two particle Hamiltonian is defined as: .. math:: :label: H_2p \mathcal{H}_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} \equiv (\epsilon_{n_2} - \epsilon_{n_1}) \delta_{n_1 n_5} \delta_{n_2 n_6} - (f_{n_2} - f_{n_1}) K_{\begin{array}{l} n_1 n_2 \\ n_5 n_6 \end{array}} Inserting the above effective Hamiltonian into Eq. :eq:`chi_rewrite`, one can then write .. math:: :label: chi_2p \chi_{\begin{array}{l} n_1 n_2 \\ n_3 n_4 \end{array}} = \left[ \mathcal{H} - I \omega \right]^{-1}_{\begin{array}{l} n_1 n_2 \\ n_3 n_4 \end{array}} (f_{n_2} - f_{n_1}) where `I` is an identity matrix that has the same size as `\mathcal{H}`. In the following subsection, we will show that by diagonalizing the Hamiltonian matrix `\mathcal{H}`, the obtained eigenvalues are the excitations energies of elementary electronic excitations such as excitons or plasmons, while the eigenvectors are related to the strength of the electronic excitations. The spectral representation of the inverse two-particle Hamiltonian is .. math:: :label: spectral \left[ \mathcal{H} - I \omega \right]^{-1}_{\begin{array}{l} n_1 n_2 \\ n_3 n_4 \end{array}} = \sum_{\lambda \lambda^{\prime}} \frac{A^{n_1 n_2}_{\lambda} A^{n_3 n_4}_{\lambda^{\prime}} N^{-1}_{\lambda \lambda^{\prime}}}{E_{\lambda} - \omega} with the eigenvalues `E_{\lambda}` and eigenvectors `A_{\lambda}` given by .. math:: \mathcal{H} A_{\lambda} = E_{\lambda} A_{\lambda} and the overlap matrix `N_{\lambda \lambda^{\prime} }` defined by .. math:: N_{\lambda \lambda^{\prime}} \equiv \sum_{n_1 n_2} [A_{\lambda}^{n_1 n_2}]^{\ast} A_{\lambda^{\prime}}^{n_1 n_2} If the Hamiltonian `\mathcal{H}` is Hermitian, the eigenvectors `A_{\lambda}` are then orthogonal and .. math:: N_{\lambda \lambda^{\prime}} = \delta_{\lambda \lambda^{\prime}} Explicit kpoint dependence ========================== In this subsection, the kpoint dependence of the eigenstates is written explicitly. The effective two particle Hamiltonian in Eq. :eq:`H_2p` becomes .. math:: \mathcal{H}_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) \equiv (\epsilon_{n_2 \mathbf{k}_1 + \mathbf{q}} - \epsilon_{n_1 \mathbf{k}_1}) \delta_{n_1 n_5} \delta_{n_2 n_6} \delta_{\mathbf{k}_1 \mathbf{k}_5} - (f_{n_2 \mathbf{k}_1 + \mathbf{q}} - f_{n_1 \mathbf{k}_1}) K_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) where `K=V-W` and according to Eq. :eq:`V_2p` and :eq:`W_2p`, .. math:: :label: V_eh V_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) = \int d \mathbf{r} d \mathbf{r}^{\prime} \psi_{n_1 \mathbf{k}_1}(\mathbf{r}) \psi_{n_2 \mathbf{k}_1 + \mathbf{q}}^{\ast}(\mathbf{r}) \frac{1}{| \mathbf{r}-\mathbf{r}^{\prime} |} \psi^{\ast}_{n_5 \mathbf{k}_5}(\mathbf{r}^{\prime}) \psi_{n_6 \mathbf{k}_5 + \mathbf{q}}(\mathbf{r}^{\prime}) .. math:: :label: W_eh W_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) = \int d \mathbf{r} d \mathbf{r}^{\prime} \psi_{n_1 \mathbf{k}_1}(\mathbf{r}) \psi_{n_2 \mathbf{k}_1 + \mathbf{q}}^{\ast}(\mathbf{r}^{\prime}) \frac{\epsilon^{-1}( \mathbf{r}, \mathbf{r}^{\prime}; \omega=0 )}{| \mathbf{r}-\mathbf{r}^{\prime} |} \psi^{\ast}_{n_5 \mathbf{k}_5}(\mathbf{r}) \psi_{n_6 \mathbf{k}_5 + \mathbf{q}}(\mathbf{r}^{\prime}) The response function in the electron-hole pair space, according to Eq. :eq:`chi_2p` and :eq:`spectral` becomes .. math:: :label: chi_ehk \chi_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_3 n_4 \mathbf{k}_3 \end{array}} (\mathbf{q}, \omega) = \sum_{\lambda \lambda^{\prime}} \frac{A^{n_1 n_2 \mathbf{k}_1}_{\lambda} A^{n_3 n_4 \mathbf{k}_3}_{\lambda^{\prime}} N^{-1}_{\lambda \lambda^{\prime}}}{E_{\lambda} - \omega} (f_{n_2 \mathbf{k}_1 + \mathbf{q}} - f_{n_1 \mathbf{k}_1}) Transform between electron-hole pair space and reciprocal space =============================================================== The physical quantities such as macroscopic dielectric function (refer to :ref:`macroscopic_dielectric_function`) are related to the long wavelength limit `(\mathbf{G}=0, \mathbf{G}^{\prime}=0)` component of the response function `\chi_{\mathbf{G} \mathbf{G}^{\prime}}`. Its relation to the response function in electron-hole pair space `\chi_{\begin{array}{l} n_1 n_2 \mathbf{k}_1\\ n_3 n_4 \mathbf{k}_3 \end{array}}` is written as .. math:: :label: chi_eh_G_transform \chi_{\mathbf{G} \mathbf{G}^{\prime}} (\mathbf{q}, \omega) = \frac{1}{\Omega} \sum_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_3 n_4 \mathbf{k}_3 \end{array}} \chi_{\begin{array}{l} n_1 n_2 \mathbf{k}_1\\ n_3 n_4 \mathbf{k}_3 \end{array}} (\mathbf{q},\omega) \ \ \rho_{\begin{array}{l} n_1 \mathbf{k}_1 \\ n_2 \mathbf{k}_1 + \mathbf{q} \end{array}} (\mathbf{G}) \ \ \rho^{\ast}_{\begin{array}{l} n_3 \mathbf{k}_3 \\ n_4 \mathbf{k}_3 + \mathbf{q} \end{array}} (\mathbf{G}^{\prime}) where the charge density matrix `\rho (\mathbf{G})` is defined as: .. math:: \rho_{\begin{array}{l} n_1 \mathbf{k}_1 \\ n_2 \mathbf{k}_1 + \mathbf{q} \end{array}} (\mathbf{G}) \equiv \langle \psi_{n_1 \mathbf{k}_1} | e^{-i(\mathbf{q}+\mathbf{G}) \cdot \mathbf{r} } | \psi_{n_2 \mathbf{k}_1 + \mathbf{q}} \rangle Employing Fourier transform .. math:: \frac{1}{| \mathbf{r}-\mathbf{r}^{\prime} |} = \frac{1}{\Omega} \sum_{\mathbf{q} \mathbf{G}} \frac{4\pi}{ | \mathbf{q} + \mathbf{G}|^2 } e^{i ( \mathbf{q} + \mathbf{G}) \cdot ( \mathbf{r} - \mathbf{r}^{\prime} ) } .. math:: \int d \mathbf{r}^{\prime \prime}\frac{\epsilon^{-1}(\mathbf{r},\mathbf{r}^{\prime \prime}) }{| \mathbf{r}^{\prime \prime}-\mathbf{r}^{\prime} |} = \frac{1}{\Omega} \sum_{\mathbf{q} \mathbf{G} \mathbf{G}^{\prime} } e^{i ( \mathbf{q} + \mathbf{G}) \cdot \mathbf{r} } \frac{4\pi \epsilon^{-1}_{\mathbf{G} \mathbf{G}^{\prime}} (\mathbf{q}) }{ | \mathbf{q} + \mathbf{G}|^2 } e^{-i ( \mathbf{q} + \mathbf{G}^{\prime}) \cdot \mathbf{r}^{\prime} } where `\Omega` is the volume of the unit cell, `V` and `W` in Eq. :eq:`V_eh` and :eq:`W_eh` can then be written respectively as .. math:: :label: V_eh_G V_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) =\sum_{\mathbf{G}} \rho^{\ast}_{\begin{array}{l} n_1 \mathbf{k}_1 \\ n_2 \mathbf{k}_1 + \mathbf{q} \end{array}} (\mathbf{G}) \ \frac{4\pi}{| \mathbf{q} + \mathbf{G}|^2} \ \rho_{\begin{array}{l} n_5 \mathbf{k}_5 \\ n_6 \mathbf{k}_5 + \mathbf{q} \end{array}} (\mathbf{G}) .. math:: W_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) = \sum_{\mathbf{G} \mathbf{G}^{\prime}} \rho^{\ast}_{\begin{array}{l} n_1 \mathbf{k}_1 \\ n_5 \mathbf{k}_5 \end{array}} (\mathbf{G}) \ \frac{4\pi \epsilon^{-1}_{\mathbf{G} \mathbf{G}^{\prime}} (\mathbf{q}; \omega=0) }{| \mathbf{q} + \mathbf{G}|^2} \ \rho_{\begin{array}{l} n_2 \mathbf{k}_1 + \mathbf{q} \\ n_6 \mathbf{k}_5 + \mathbf{q} \end{array}} (\mathbf{G}^{\prime}) Dielectric function and its relation to spectra =============================================== The dielectric matrix is related to the density response matrix by .. math:: \epsilon^{-1}_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) = \delta_{\mathbf G \mathbf G^{\prime}} + \frac{4\pi}{|\mathbf q + \mathbf G|^2} \chi_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) Electron energy loss spectra (EELS) is propotional to `-\mathrm{Im} \epsilon^{-1}_{00}`: .. math:: \mathrm{EELS} \propto -\mathrm{Im} \epsilon^{-1}_{00}(\mathbf q, \omega) = - \frac{4\pi}{|\mathbf{q}|^2} \mathrm{Im} \chi_{00}(\mathbf q, \omega) As shown in :ref:`macroscopic_dielectric_function`, optical absorption spectra (ABS) is `\mathrm{Im} \epsilon_M`. Instead of calculating from `\epsilon^{-1}_{00}`, `\epsilon_M` can also be constructed from a modified response function `\bar{\chi}` by .. math:: \epsilon_M (\omega) = 1 - \frac{4\pi}{|\mathbf{q}|^2} \bar{\chi}_{00}(\mathbf{q}\rightarrow 0, \omega) .. math:: \mathrm{ABS} = \mathrm{Im} \epsilon_M (\omega) = -\frac{4\pi}{|\mathbf{q}|^2} \mathrm{Im}\bar{\chi}_{00}(\mathbf{q}\rightarrow 0, \omega) The modified response function `\bar{\chi}` is constructed in the same way as `\chi`, except that the long range Coulomb interaction for kernel `V` in Eq. :eq:`V_eh_G` is excluded so that .. math:: \bar{V}_{\begin{array}{l} n_1 n_2 \mathbf{k}_1 \\ n_5 n_6 \mathbf{k}_5 \end{array}} ( \mathbf{q}) =\sum_{\mathbf{G} \neq 0} \rho^{\ast}_{\begin{array}{l} n_1 \mathbf{k}_1 \\ n_2 \mathbf{k}_1 + \mathbf{q} \end{array}} (\mathbf{G}) \ \frac{4\pi}{| \mathbf{q} + \mathbf{G}|^2} \ \rho_{\begin{array}{l} n_5 \mathbf{k}_5 \\ n_6 \mathbf{k}_5 + \mathbf{q} \end{array}} (\mathbf{G}) The implementation flowchart ============================ Here is a short summary for the actual implementation: 1. Construct the effective two particle Hamiltonian (using notation `S \equiv \left\{ n_1 n_2 \mathbf{k}_1; \mathbf{q} \right\}` and `S^{\prime} \equiv \left\{ n_3 n_4 \mathbf{k}_3; \mathbf{q} \right\}`) .. math:: \mathcal{H}_{SS^{\prime}} (\mathbf{q}) = \epsilon_S \delta_{SS^{\prime}} - f_S K_{SS^{\prime}} ( \mathbf{q}) where .. math:: :label: epsilon_S \epsilon_S = \epsilon_{n_2 \mathbf{k}_1 + \mathbf{q}} - \epsilon_{n_1 \mathbf{k}_1} .. math:: f_S = f_{n_2 \mathbf{k}_1 + \mathbf{q}} - f_{n_1 \mathbf{k}_1} with `K=V-0.5W`, where 0.5 accounts for the fact that only singlet excitations are allowed in the optical absorption and `W` are diagonal in spin. The Coulomb interaction `V` is given by .. math:: V_{SS^{\prime}} (\mathbf{q}) = \sum_{\mathbf{G} \neq 0} \rho^{\ast}_S(\mathbf{G}) \frac{4\pi}{| \mathbf{q} + \mathbf{G}|^2} \rho_{S^{\prime}}(\mathbf{G}) \ \ (\mathrm{ABS}) .. math:: V_{SS^{\prime}} (\mathbf{q}) = \sum_{\mathbf{G}} \rho^{\ast}_S(\mathbf{G}) \frac{4\pi}{| \mathbf{q} + \mathbf{G}|^2} \rho_{S^{\prime}}(\mathbf{G}) \ \ (\mathrm{EELS}) where .. math:: \rho_{S}(\mathbf{G}) = \langle \psi_{n_1 \mathbf{k}_1} | e^{-i(\mathbf{q}+\mathbf{G}) \cdot \mathbf{r} } | \psi_{n_2 \mathbf{k}_1 + \mathbf{q}} \rangle The screened interaction kernel `W` is given by .. math:: W_{SS^{\prime}} ( \mathbf{q}) = \sum_{\mathbf{G} \mathbf{G}^{\prime}} \rho^{\ast}_{\begin{array}{l} n_1 \mathbf{k}_1 \\ n_3 \mathbf{k}_3 \end{array}} (\mathbf{G}) \ \frac{4\pi \epsilon^{-1}_{\mathbf{G} \mathbf{G}^{\prime}} (\mathbf{k}_3 - \mathbf{k}_1; \omega=0) }{| \mathbf{k}_3 - \mathbf{k}_1 + \mathbf{G}|^2} \ \rho_{\begin{array}{l} n_2 \mathbf{k}_1 + \mathbf{q} \\ n_4 \mathbf{k}_4 + \mathbf{q} \end{array}} (\mathbf{G}^{\prime}) 2. Diagonalize `\mathcal{H}_{SS^{\prime}}` with the eigenvalues `E_{\lambda}` and eigenvectors `A_{\lambda}` given by .. math:: \mathcal{H} A_{\lambda} = E_{\lambda} A_{\lambda} and the overlap matrix `N_{\lambda \lambda^{\prime} }` defined by .. math:: N_{\lambda \lambda^{\prime}} \equiv \sum_{S} [A_{\lambda}^{S}]^{\ast} A_{\lambda^{\prime}}^{S} The eigenvalues `E_{\lambda}`, which correpond to the poles of `\chi`, give the excitation energies of the elementary electron excitations. 3. The spectra (both EELS and ABS) are calculated by .. math:: -\frac{4\pi}{|\mathbf{q}|^2} \mathrm{Im} \chi_{00}(\mathbf q, \omega) = - \frac{4\pi}{|\mathbf{q}|^2 \Omega} \sum_{\lambda \lambda^{\prime}} \sum_{SS^{\prime}} \frac{ f_S A^{S}_{\lambda} A^{S^{\prime}}_{\lambda^{\prime}} N^{-1}_{\lambda \lambda^{\prime}}}{E_{\lambda} - \omega} \ \rho_S(0) \rho_{S^{\prime}}(0) Tamm-Dancoff approximation ========================== The Tamm-Dancoff approximation corresponds to `\epsilon_S >= 0` in Eq. :eq:`epsilon_S`. .. [#Review] G. Onida, L. Reining and A. Rubio, Electronic excitations: density-functional versus many-body Green's-function approaches, *Rev. Mod. Phys.* **74**, 601 (2002) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/citations.py000066400000000000000000000053161316441372200261160ustar00rootroot00000000000000# creates: citations.png citations.csv from __future__ import print_function import os import datetime import matplotlib.pyplot as plt months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'] def f(filename): papers = {} lines = open(filename).readlines() n = 0 dois = set() while n < len(lines): line = lines[n] tag = line[:2] if tag == 'TI': ntitle = n y = None m = 1 d = 15 elif tag == 'SO': title = ' '.join(lines[i][3:-1] for i in range(ntitle, n)) elif tag == 'DI': doi = line[3:-1] elif tag == 'PY': y = int(line.split()[1]) elif tag == 'PD': for w in line.split()[1:]: if w[0].isdigit(): w = int(w) if w < 100: d = w else: y = w else: if '-' in w: w = w.split('-')[-1] m = months.index(w) + 1 elif tag == '\n': date = datetime.date(y, m, d) if doi not in dois: dois.add(doi) papers[doi] = (date, title) n += 1 return papers plt.figure(figsize=(8, 4)) total = {} for bib in ['gpaw1', 'tddft', 'lcao', 'gpaw2', 'response']: papers = {} for line in open(bib + '.txt'): date, doi, title = line.split(' ', 2) papers[doi] = (datetime.date(*[int(x) for x in date.split('-')]), title.strip()) if os.path.isfile(bib + '.bib'): papers.update(f(bib + '.bib')) papers = sorted((papers[doi][0], doi, papers[doi][1]) for doi in papers) plt.plot([paper[0] for paper in papers], range(1, len(papers) + 1), '-o', label=bib) fd = open(bib + '.txt', 'w') for date, doi, title in papers: fd.write('%d-%02d-%02d %s %s\n' % (date.year, date.month, date.day, doi, title)) assert '"' not in title, title total[doi] = (date, title) fd.close() x = dict([(p[1], 0) for p in papers]) print((bib, len(papers), len(x), len(total))) allpapers = sorted((paper[0], doi, paper[1]) for doi, paper in total.items()) plt.plot([paper[0] for paper in allpapers], range(1, len(allpapers) + 1), '-o', label='total') fd = open('citations.csv', 'w') n = len(allpapers) for date, doi, title in allpapers[::-1]: fd.write('%d,"`%s `__"\n' % (n, title, doi)) n -= 1 fd.close() plt.xlabel('date') plt.ylabel('number of citations') plt.legend(loc='upper left') plt.savefig('citations.png') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/cmdline.rst000066400000000000000000000027521316441372200257150ustar00rootroot00000000000000.. program:: gpaw .. highlight:: bash .. index:: gpaw, command line interface, CLI .. _cli: ====================== Command line interface ====================== GPAW has a command line tool called :program:`gpaw` with the following sub-commands: ============== ===================================================== sub-command description ============== ===================================================== help Help for sub-command run Run calculation with GPAW info Show versions of GPAW and its dependencies dos Calculate (projected) density of states from gpw-file gpw Write summary of GPAW-restart file completion Add tab-completion for Bash test Run the GPAW test suite atom Solve radial equation for an atom python Run GPAW's parallel Python interpreter sbatch Submit a GPAW Python script via sbatch dataset Calculate density of states from gpw-file symmetry Analyse symmetry install-data Install PAW datasets, pseudopotential or basis sets ============== ===================================================== Help ==== You can do:: $ gpaw --help $ gpaw sub-command --help to get help (or ``-h`` for short). .. _bash completion: Bash completion =============== You can enable bash completion like this:: $ gpaw completions This will append a line like this:: complete -o default -C /path/to/gpaw/gpaw/cli/complete.py gpaw to your ``~/.bashrc``. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/co_wavefunctions.py000066400000000000000000000036761316441372200275040ustar00rootroot00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import Numeric as num from gpaw import GPAW from gpaw.spherical_harmonics import Y a = 6.0 c = a / 2 d = 1.13 paw = GPAW('co.gpw', txt=None) import pylab as p dpi = 2*80 p.figure(figsize=(4, 3), dpi=dpi) p.axes([0.15, 0.15, 0.8, 0.8]) import sys if len(sys.argv) == 1: N = 1 else: N = int(sys.argv[1]) psit = paw.kpt_u[0].psit_nG[N] psit = psit[:, 0, 0] ng = len(psit) x = num.arange(ng) * a / ng - c p.plot(x, psit, 'bx', mew=2, label=r'$\tilde{\psi}$') C = 'g' for n in paw.nuclei: s = n.setup phi_j, phit_j = s.get_partial_waves()[:2] print(s.rcut_j[0]) r = num.arange(30) * s.rcut_j[0] / 30 phi_i = num.empty((s.ni, 59), num.Float) phit_i = num.empty((s.ni, 59), num.Float) x = num.empty(59, num.Float) x[29:] = r x[29::-1] = -r x *= paw.a0 i = 0 nj = len(phi_j) for j in range(nj): f = phi_j[j] ft = phit_j[j] l = f.get_angular_momentum_number() f = num.array([f(R) for R in r]) * r**l ft = num.array([ft(R) for R in r]) * r**l for m in range(2 * l + 1): L = l**2 + m phi_i[i + m, 29:] = f * Y(L, 1, 0, 0) phi_i[i + m, 29::-1] = f * Y(L, -1, 0, 0) phit_i[i + m, 29:] = ft * Y(L, 1, 0, 0) phit_i[i + m, 29::-1] = ft * Y(L, -1, 0, 0) i += 2 * l + 1 assert i == s.ni P_i = n.P_uni[0, N] X = n.spos_c[0] * a - c p.plot(X + x, num.dot(P_i, phit_i), C + '-', lw=1, label=r'$\tilde{\psi}^%s$' % s.symbol) p.plot(X + x, num.dot(P_i, phi_i), C + '-', lw=2, label=r'$\psi^%s$' % s.symbol) C = 'r' p.plot([-d / 2], [0], 'go', ms=2*0.8*4*80/a*1.0*0.53, mfc=None, label='_nolegend_') p.plot([d / 2], [0], 'ro', ms=2*0.8*4*80/a*1.2*0.53, mfc=None, label='_nolegend_') p.legend(loc='best') p.xlabel(u'x [Å]') p.ylabel(r'$\psi$') #p.show() p.savefig('co_wavefunctions.png', dpi=dpi) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/convergence.rst000066400000000000000000000066351316441372200266040ustar00rootroot00000000000000.. _convergence: ================== Convergence Issues ================== *Try to use default parameters for the calculator. Simple and often useful.* Here you find a list of suggestions that should be considered when encountering convergence problems: 1) Make sure the geometry and spin-state is physically sound. Remember that ASE uses Angstrom and not Bohr or nm! For spin polarized systems, make sure you have sensible initial magnetic moments. Don't do spin-paired calculations for molecules with an odd number of electrons. Before performing calculations of isolated atoms see :ref:`atomization_energy`. 2) Use less aggressive density mixing. Try something like ``mixer=Mixer(0.02, 5, 100)`` or ``mixer=MixerSum(0.02, 5, 100)``, ``mixer=MixerDif(0.02, 5, 100)`` for spin-polarized calculations and remember to import the mixer classes:: from gpaw import Mixer, MixerSum, MixerDif For some systems (for example transition metal atoms) it is helpful to reduce the number of history steps in the mixer to ``1`` (instead of ``5``). 3) Solve the eigenvalue problem more accurately at each scf-step. Import the Davidson eigensolver:: from gpaw import Davidson and increase the number iterations per scf-step ``eigensolver=Davidson(3)``. CG eigensolver tends converge fastest the unoccupied bands ``eigensolver='cg'``. 4) Use a smoother distribution function for the occupation numbers. Remember that for systems without periodic boundary conditions (molecules) the Fermi temperature is set to zero by default. You might want to specify a finite Fermi temperature as described :ref:`here ` and check the convergence of the results with respect to the temperature! 5) Try adding more empty states. If you are specifying the :ref:`number of bands ` manually, try to increase the number of empty states. You might also let GPAW choose the default number, which is in general large enough. 6) Use enough k-points. Try something like ``kpts={'density': 3.5, 'even': True}`` (see :ref:`manual_kpts`). 7) Don't let your structure optimization algorithm take too large steps. 8) Solve the Poisson equation more accurately. Sometimes for metallic systems of large dimensions (thick slabs or large clusters), one can have the situation that the wave functions converge nicely, but the density does not. For such cases it can help to solve the Poisson equation more accurately between each SCF step. Try something like ``poissonsolver=PoissonSolver(eps=1e-12)``. Import the class with:: from gpaw.poisson import PoissonSolver 9) Better initial guess for the wave functions. The initial guess for the wave functions is always calculated using the LCAO scheme, with a default single-zeta basis, i.e. one orbital for each valence electron. It is possible to use ``basis='szp(dzp)'`` to extract the single-zeta polarization basis set from the double-zeta polarization basis sets that are distributed together with the latest PAW datasets. You can also try to make a better initial guess by enlarging the :ref:`manual_basis`. Note that you first need to generate the basis file, as described in :ref:`LCAO mode `. Warning: this may in some cases worsen the convergence, and improves it usually only when the number of empty states is significantly increased. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/densitymix/000077500000000000000000000000001316441372200257375ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/densitymix/densitymix.rst000066400000000000000000000115411316441372200306700ustar00rootroot00000000000000.. _densitymix: ============== Density Mixing ============== Pulay Mixing ------------ The density is updated using Pulay-mixing [#Pulay1980]_, [#Kresse1996]_. Pulay mixing (or direct inversion of the iterative subspace (DIIS)) attempts to find a good approximation of the final solution as a linear combination of a set of trial vectors `\{n^i\}` generated during an iterative solution of a problem. If the error associated with a given solution is given as `\{R^i\}` then Pulay mixing assumes that the error of a linear combination of the trail vectors is given as the same linear combination of errors .. math:: n_{i+1}=\sum \alpha_i n_i \quad,\quad R_{i+1}=\sum \alpha_i R_i The norm `R^{i+1}` is thus given as .. math:: \langle R_{i+1}|R_{i+1}\rangle=\bar{\alpha}^T \bar{\bar{R}}\bar{\alpha} where elements of the matrix is given as `\bar{\bar{R}}_{ij}=\langle R_{i}|R_{j}\rangle`. The norm can thus be minimized by solving .. math:: \frac{\delta \langle R_{i+1}|R_{i+1}\rangle}{\delta \bar{\alpha}^T}=2 \bar{\bar{R}}\bar{\alpha}=0 In density mixing the error of a given input density is given as .. math:: R_i = n_i^{out}[n_i^{in}]-n_i^{in} The original Pulay mixing only uses `n_i^{out}` to calculate the errors and thereby the mixing parameters. To more efficiently cover solution space it can be an advantage to include them with a certain weight, given as the input parameter `\beta`. .. math:: n_{i+1}^{in}=\sum \alpha_i (n_i^{in}+\beta R_i) Special Metric -------------- Convergence is improved by an optimized metric `\hat{M}` for calculation of scalar products in the mixing scheme, `\langle A | B \rangle _s = \langle A | \hat{M} | B \rangle`, where `\langle \rangle _s` is the scalar product with the special metric and `\langle \rangle` is the usual scalar product. The metric is based on the rationale that contributions for small wave vectors are more important than contributions for large wave vectors [#Kresse1996]_. Using a metric that weighs short wave density changes more than long wave changes can reduce charge sloshing significantly. It has been found [#Kresse1996]_ that the metric .. math:: \hat{M} = \sum_q | q \rangle f_q \langle q |, \quad f_q = 1 + \frac{w}{q^2} is particularly useful (`w` is a suitably chosen weight). This is easy to apply in plane wave codes, as it is local in reciprocal space. Expressed in real space, this metric is .. math:: \hat{M} = \sum_{R R'} | R \rangle f(R' - R) \langle R' |, \quad f(R) = \sum_q f_q e^{i q R} As this is fully nonlocal in real space, it would be very costly to apply. Instead we use a semilocal stencil with only three nearest neighbors: .. math:: f(R) = \begin{cases} 1 + w/8 & R = 0 \\ w / 16 & R = \text{nearest neighbor dist.} \\ w / 32 & R = \text{2nd nearest neighbor dist.} \\ w / 64 & R = \text{3rd nearest neighbor dist.} \\ 0 & \text{otherwise} \end{cases} which corresponds to the reciprocal space metric .. math:: f_q = 1 + \frac{w}{8} (1 + \cos q_x + \cos q_y + \cos q_z + \cos q_x \cos q_y + \cos q_y \cos q_z + \cos q_x \cos q_z + \cos q_x \cos q_y \cos q_z) With the nice property that it is a monotonously decaying function from `f_q = w + 1` at `q = 0` to `f_q = 1` anywhere at the zone boundary in reciprocal space. A comparison of the two metrics is displayed in the figure below .. image:: metric.png :align: center Specifying a Mixing Scheme in GPAW ---------------------------------- Specifying the mixing scheme and metric is done using the ``mixer`` keyword of the GPAW calculator:: from gpaw import GPAW, Mixer calc = GPAW(mixer=Mixer(beta=0.05, nmaxold=5, weight=50.0)) which is the recommended value if the default fails to converge. The class ``Mixer`` indicates one of the possible mixing schemes. The Pulay mixing can be based on: 1. The spin densities separately, ``Mixer`` (This will *not* work for a spinpolarized system, unless the magnetic moment is fixed) 2. The total density, ``MixerSum2`` 3. Spin channels separately for the density matrices, and the summed channels for the pseudo electron density, ``MixerSum`` 4. The total density and magnetization densities separately, ``MixerDif`` Where the magnetization density is the difference between the two spin densities. All mixer classes takes the arguments ``(beta=0.25, nmaxold=3, weight=50.0)``. In addition, the ``MixerDif`` also takes the arguments ``(beta_m=0.7, nmaxold_m=2, weight_m=10.0)`` which is the corresponding mixing parameters for the magnetization density. Here ``beta`` is the linear mixing coefficient, ``nmaxold`` is the number of old densities used, and ``weight`` is the weight used by the metric, if any. MixerDif seems to be a good choice for spin polarized molecules. MixerSum is sometimes better for bulk systems. References ---------- .. [#Pulay1980] Pulay, Chem. Phys. Let. **73**, 393 (1980) .. [#Kresse1996] Kresse, Phys. Rev. B **54**, 11169 (1996) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/densitymix/metric.py000066400000000000000000000032061316441372200275750ustar00rootroot00000000000000# creates: metric.png import numpy as np import matplotlib import pylab as plt from math import pi, cos from distutils.version import LooseVersion # Special points in the BZ of a simple cubic cell G = pi * np.array([0., 0., 0.]) R = pi * np.array([1., 1., 1.]) X = pi * np.array([1., 0., 0.]) M = pi * np.array([1., 1., 0.]) # The path for the band plot path = [X, G, R, X, M, G] textpath = [r'$X$', r'$\Gamma$', r'$R$', r'$X$', r'$M$', r'$\Gamma$'] # Make band data qvec = [] lines = [0] previous = path[0] for next in path[1:]: Npoints = int(round(20 * np.linalg.norm(next - previous))) lines.append(lines[-1] + Npoints) for t in np.linspace(0, 1, Npoints): qvec.append((1 - t) * previous + t * next) previous = next vasp = [1 / max(np.linalg.norm(q), 1e-6)**2 for q in qvec] gpaw = [( 1 + cos(qx) + cos(qy) + cos(qz) + cos(qx) * cos(qy) + cos(qx) * cos(qz) + cos(qy) * cos(qz) + cos(qx) * cos(qy) * cos(qz)) / 8. for qx, qy, qz in qvec] # Plot band data fig = plt.figure(1, figsize=(5, 3), dpi=90) fig.subplots_adjust(left=.1, right=.95) lim = [0, lines[-1], 0, 1.25] plt.plot(vasp, 'k:', label='VASP') plt.plot(gpaw, 'k-', label='GPAW') for q in lines: plt.plot([q, q], lim[2:], 'k-') plt.xticks(lines, textpath) plt.yticks([0, 1], [r'$1$', r'$w+1$']) plt.axis(lim) # The pad keyword to legend was deprecated in MPL v. 0.98.4 if LooseVersion(matplotlib.__version__) < '0.98.4': kwpad = {'pad': 0.1, 'axespad': 0.06} else: kwpad = {'borderpad': 0.2, 'borderaxespad': 0.06} plt.legend(loc='upper right', **kwpad) plt.title('Special metric for density changes') plt.savefig('metric.png', dpi=90) #plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/documentation.rst000066400000000000000000000017241316441372200271510ustar00rootroot00000000000000.. _documentation: ============= Documentation ============= If you want to know how to *use* the GPAW code, we recommend looking at the :ref:`tutorials` and consulting the :ref:`manual` pages. If you are just looking for an introduction to the theory of PAW, you should have a look at the page :ref:`introduction_to_paw`, read this `pdf file on PAW theory`_, or maybe read some of the original :ref:`PAW_papers`. If you want some general information on the numerical techniques utilized by the GPAW code, you should read the page :ref:`features and algorithms`. Developers should consult the :ref:`devel` pages. .. The manual includes the basic instructions on how to use the GPAW calculator's functionalities: .. toctree:: :maxdepth: 2 manual tools/tools advanced_topics literature introduction_to_paw If you can not find what you are looking for in any of the above, please consult the :ref:`mail list`. .. _pdf file on PAW theory: paw_note.pdf gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/dscf/000077500000000000000000000000001316441372200244615ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/dscf/dscf.rst000066400000000000000000000140661316441372200261410ustar00rootroot00000000000000.. _dscf: =========================== Delta Self-Consistent Field =========================== -------------------------------------------- Linear expansion Delta Self-Consistent Field -------------------------------------------- The method of linear expansion Delta Self-Consistent Field \ [#delscf]_ adds the density of a specified orbital `\varphi_a(r)` to the total density in each step of the self-consistency cycle. The extra charge is usually taken from the fermi level to keep the system neutral: .. math:: n(r) = \sum_nf_{N-1}(T,\varepsilon_n)|\varphi_n(r)|^2 + |\varphi_a(r)|^2. with `N` being the total number of electrons and `f_{N-1}(T,\varepsilon_n)` is the Fermi-Dirac distribution of the `N-1` electron system . To get the band energy right `\varphi_a(r)` needs to be expanded in Kohn-Sham orbitals: .. math:: |\varphi_a\rangle = \sum_nc_{na}|\varphi_n\rangle, \qquad c_{na} = \langle\varphi_n|\varphi_a\rangle and the band energy of the orbital becomes .. math:: \varepsilon_a = \sum_n|c_{na}|^2\varepsilon_n. The method is a generalization of traditional Delta Self-Consistent Field where only the occupation numbers are modified and it will reduce to that, if only one (normalized) term is included in the expansion of `\varphi_a(r)`. ---------------- Simple molecules ---------------- The example below calculates the excitation energy of the `5\sigma\rightarrow2\pi` transition in CO. We only specify that the `2\pi` orbital should be occupied ([[1.0, lumo, 1]] means 1.0 electrons in lumo with spin 1) and the method will take the electron from highest occupied orbital which in this case is `5\sigma`. The lumo is an instance of the class AEOrbital which calculates the expansion of the saved `2\pi` state in each iteration step. In order to obtain the all-electron overlaps `\langle\varphi_n|2\pi\rangle` we need to supply the projector overlaps in addition to the pseudowavefunction. Exciting the LUMO in CO:: from ase.build import molecule from gpaw import GPAW from gpaw import dscf # Ground state calculation #------------------------------------------------------------------ calc = GPAW(nbands=8, h=0.2, xc='PBE', spinpol=True, convergence={'energy': 100, 'density': 100, 'eigenstates': 1.0e-9, 'bands': -1}) CO = molecule('CO') CO.center(vacuum=3) CO.set_calculator(calc) E_gs = CO.get_potential_energy() # Obtain the pseudowavefunctions and projector overlaps of the # state which is to be occupied. n=5,6 is the 2pix and 2piy orbitals n = 5 molecule = [0, 1] wf_u = [kpt.psit_nG[n] for kpt in calc.wfs.kpt_u] p_uai = [dict([(molecule[a], P_ni[n]) for a, P_ni in kpt.P_ani.items()]) for kpt in calc.wfs.kpt_u] # Excited state calculation #-------------------------------------------- calc_es = GPAW(nbands=8, h=0.2, xc='PBE', spinpol=True, convergence={'energy': 100, 'density': 100, 'eigenstates': 1.0e-9, 'bands': -1}) CO.set_calculator(calc_es) lumo = dscf.AEOrbital(calc_es, wf_u, p_uai) #lumo = dscf.MolecularOrbital(calc, weights={0: [0, 0, 0, 1], # 1: [0, 0, 0, -1]}) dscf.dscf_calculation(calc_es, [[1.0, lumo, 1]], CO) E_es = CO.get_potential_energy() print 'Excitation energy: ', E_es-E_gs The commented line ``lumo = dscf.Molecular...`` uses another class to specify the `2\pi` orbital of CO which does not require a ground state calculation of the molecule. In the simple example above the two methods give identical results, but for more complicated systems the AEOrbital class should be used \ [#des]_. When using the AEOrbital class a new calculator object must be constructed for the dscf calculation. In the example above we only specify a single state, but the function ``dscf.dscf_calculation`` takes a list of orbitals as input and we could for example have given the argument [[1.0, lumo, 1], [-1.0, pi, 0]] which would force the electron to be taken from the `\pi` orbital with spin 0. The pi should of course be another instance of the AEOrbital class. --------------------- Exciting an adsorbate --------------------- The method of linear expansion Delta Self-Consistent Field was designed for calculations with strongly hybridized orbitals. For example molecules chemisorbed on transition metals. In such cases the traditional Delta Self-Consistent Field breaks down since the orbital to be occupied is no longer well described by a single Kohn-Sham state. The script :git:`~doc/documentation/dscf/homo.py` calculates the HOMO energy of CO adsorbed on-top Pt(111). The script starts from scratch, but usually one would start from an optimized configuration saved in a file ``gs.gpw``. The script only calculates the total energy of the excited state so the excitation energy is obtained as the difference between ground and excited state energies. First a calculation of gas-phase CO is performed and the HOMO pseudo-wavefunctions and the projector overlaps are saved. The energy range [-100.0, 0.0] means we only include states below the Fermi level (default is states above). The script :git:`~doc/documentation/dscf/lumo.py` calculates the LUMO energy of the same system, but is slightly more complicated due to the degeneracy of the `2\pi` orbital. We would like to occupy the `2\pi_y` orbital and we need to figure out which band (5 or 6) this orbital corresponds to in each k-point before we start the slab calculation. .. [#delscf] J. Gavnholt, T. Olsen, M. Engelund and J. Schiøtz, Delta Self-Consistent Field as a method to obtain potential energy surfaces of excited molecules on surfaces, *Phys. Rev. B* **78**, 075441 (2008) .. [#des] T. Olsen, J. Gavnholt and J. Schiøtz, Hot electron mediated desorption rates calculated from excited state potential energy surfaces, *Phys. Rev. B* **79**, 035403 (2009) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/dscf/gs.xyz000066400000000000000000000017641316441372200256560ustar00rootroot0000000000000014 Pt 0.000000000000000 0.000000000000000 0.000000000000000 Pt 1.417500000000000 2.455182019728883 0.000000000000000 Pt 0.000000000000000 3.273576026305178 2.314777500000000 Pt 1.417500000000000 0.818394006576295 2.314777500000000 Pt 0.000000000000000 1.636788013152589 4.641355000000001 Pt 1.417500000000000 4.091970032881473 4.641355000000001 Pt 2.835000000000000 0.000000000000000 0.000000000000000 Pt 4.252500000000000 2.455182019728883 0.000000000000000 Pt 2.835000000000000 3.273576026305178 2.314777500000000 Pt 4.252500000000000 0.818394006576295 2.314777500000000 Pt 2.835000000000000 1.636788013152589 4.641355000000001 Pt 4.252500000000000 4.091970032881473 4.641355000000001 C 1.417500015396857 4.092053726367659 6.510235842827654 O 1.417500024461528 4.091934739974321 7.668105648600448 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/dscf/homo.py000066400000000000000000000033721316441372200260020ustar00rootroot00000000000000#!/usr/bin/env python from ase.visualize import view from ase.build import fcc111, add_adsorbate from gpaw import GPAW from gpaw.mixer import MixerSum import gpaw.dscf as dscf filename='homo' #------------------------------------------- c_mol = GPAW(nbands=9, h=0.2, xc='RPBE', kpts=(8,6,1), spinpol=True, convergence={'energy': 100, 'density': 100, 'eigenstates': 1.0e-9, 'bands': 'occupied'}, txt='CO_homo.txt') calc = GPAW(nbands=45, h=0.2, xc='RPBE', kpts=(8,6,1), eigensolver='cg', spinpol=True, mixer=MixerSum(nmaxold=5, beta=0.1, weight=100), convergence={'energy': 100, 'density': 100, 'eigenstates': 1.0e-7, 'bands': -10}, txt=filename+'.txt') #---------------------------------------- # Import Slab with relaxed CO #slab = ('gs.gpw').get_atoms() slab = fcc111('Pt', size=(1, 2, 3), orthogonal=True) add_adsorbate(slab, 'C', 2.0, 'ontop') add_adsorbate(slab, 'O', 3.15, 'ontop') slab.center(axis=2, vacuum=4.0) view(slab) molecule = slab.copy() del molecule [:-2] # Molecule #---------------- molecule.set_calculator(c_mol) molecule.get_potential_energy() #Homo wavefunction wf_u = [kpt.psit_nG[4] for kpt in c_mol.wfs.kpt_u] #Homo projector overlaps mol = range(len(slab))[-2:] p_uai = [dict([(mol[a], P_ni[4]) for a, P_ni in kpt.P_ani.items()]) for kpt in c_mol.wfs.kpt_u] # Slab with adsorbed molecule #----------------------------------- slab.set_calculator(calc) orbital = dscf.AEOrbital(calc, wf_u, p_uai, Estart=-100.0, Eend=0.0) dscf.dscf_calculation(calc, [[-1.0, orbital, 1]], slab) slab.get_potential_energy() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/dscf/lumo.py000066400000000000000000000045651316441372200260210ustar00rootroot00000000000000#!/usr/bin/env python from numpy import reshape, dot from ase.visualize import view from ase.build import fcc111, add_adsorbate from gpaw import GPAW from gpaw.mixer import MixerSum import gpaw.dscf as dscf filename='lumo' #------------------------------------------- c_mol = GPAW(nbands=9, h=0.2, xc='RPBE', kpts=(8,6,1), spinpol=True, convergence={'energy': 100, 'density': 100, 'eigenstates': 1.0e-9, 'bands': -2}, txt='CO_lumo.txt') calc = GPAW(nbands=60, h=0.2, xc='RPBE', kpts=(8,6,1), eigensolver='cg', spinpol=True, mixer=MixerSum(nmaxold=5, beta=0.1, weight=100), convergence={'energy': 100, 'density': 100, 'eigenstates': 1.0e-7, 'bands': -10}, txt=filename+'.txt') #---------------------------------------- # Import Slab with relaxed CO #slab = Calculator('gs.gpw').get_atoms() slab = fcc111('Pt', size=(1, 2, 3), orthogonal=True) add_adsorbate(slab, 'C', 2.0, 'ontop') add_adsorbate(slab, 'O', 3.15, 'ontop') slab.center(axis=2, vacuum=4.0) view(slab) molecule = slab.copy() del molecule [:-2] # Molecule #---------------- molecule.set_calculator(c_mol) molecule.get_potential_energy() #Find band corresponding to lumo lumo = c_mol.get_pseudo_wave_function(band=5, kpt=0, spin=1) lumo = reshape(lumo, -1) wf1_k = [c_mol.get_pseudo_wave_function(band=5, kpt=k, spin=1) for k in range(len(c_mol.wfs.weight_k))] wf2_k = [c_mol.get_pseudo_wave_function(band=6, kpt=k, spin=1) for k in range(len(c_mol.wfs.weight_k))] band_k = [] for k in range(len(c_mol.wfs.weight_k)): wf1 = reshape(wf1_k[k], -1) wf2 = reshape(wf2_k[k], -1) p1 = abs(dot(wf1, lumo)) p2 = abs(dot(wf2, lumo)) if p1 > p2: band_k.append(5) else: band_k.append(6) #Lumo wavefunction wf_u = [kpt.psit_nG[band_k[kpt.k]] for kpt in c_mol.wfs.kpt_u] #Lumo projector overlaps mol = range(len(slab))[-2:] p_uai = [dict([(mol[a], P_ni[band_k[kpt.k]]) for a, P_ni in kpt.P_ani.items()]) for kpt in c_mol.wfs.kpt_u] # Slab with adsorbed molecule #----------------------------------- slab.set_calculator(calc) orbital = dscf.AEOrbital(calc, wf_u, p_uai) dscf.dscf_calculation(calc, [[1.0, orbital, 1]], slab) slab.get_potential_energy() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/000077500000000000000000000000001316441372200267275ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/Au.yml000066400000000000000000000036431316441372200300250ustar00rootroot00000000000000# Permittivity of gold # Source: # http://refractiveindex.info/?shelf=main&book=Au&page=Johnson # Direct download link: # wget http://refractiveindex.info/database/main/Au/Johnson.yml -O Au.yml # # this file is part of refractiveindex.info database # refractiveindex.info database is in the public domain # copyright and related rights waived via CC0 1.0 REFERENCES: "P. B. Johnson and R. W. Christy. Optical Constants of the Noble Metals, Phys. Rev. B 6, 4370-4379 (1972)" COMMENTS: "Room temperature" DATA: - type: tabulated nk data: | 0.1879 1.28 1.188 0.1916 1.32 1.203 0.1953 1.34 1.226 0.1993 1.33 1.251 0.2033 1.33 1.277 0.2073 1.30 1.304 0.2119 1.30 1.350 0.2164 1.30 1.387 0.2214 1.30 1.427 0.2262 1.31 1.460 0.2313 1.30 1.497 0.2371 1.32 1.536 0.2426 1.32 1.577 0.2490 1.33 1.631 0.2551 1.33 1.688 0.2616 1.35 1.749 0.2689 1.38 1.803 0.2761 1.43 1.847 0.2844 1.47 1.869 0.2924 1.49 1.878 0.3009 1.53 1.889 0.3107 1.53 1.893 0.3204 1.54 1.898 0.3315 1.48 1.883 0.3425 1.48 1.871 0.3542 1.50 1.866 0.3679 1.48 1.895 0.3815 1.46 1.933 0.3974 1.47 1.952 0.4133 1.46 1.958 0.4305 1.45 1.948 0.4509 1.38 1.914 0.4714 1.31 1.849 0.4959 1.04 1.833 0.5209 0.62 2.081 0.5486 0.43 2.455 0.5821 0.29 2.863 0.6168 0.21 3.272 0.6595 0.14 3.697 0.7045 0.13 4.103 0.7560 0.14 4.542 0.8211 0.16 5.083 0.8920 0.17 5.663 0.9840 0.22 6.350 1.0880 0.27 7.150 1.2160 0.35 8.145 1.3930 0.43 9.519 1.6100 0.56 11.21 1.9370 0.92 13.78 electrodynamics.rst000066400000000000000000000012401316441372200325640ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics.. _electrodynamics: ========================= Classical electrodynamics ========================= GPAW can perform classical electrodynamics simulations using quasistatic finite-difference time-domain (QSFDTD) method. In these calculations you must specify the regions with classically polarizable material, as well as their permittivities `\epsilon(\mathbf{r}, \omega)`. The electric field and the polarization charge density are propagated in time under an influence of external perturbation. The QSFDTD method can be also merged with time-propagation simulation, which yields a hybrid multiscale method. .. toctree:: :maxdepth: 2 qsfdtd hybridscheme gold+na2_nanosphere/000077500000000000000000000000001316441372200324735ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamicscalculate.py000066400000000000000000000072521316441372200350100ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanospherefrom ase import Atoms from gpaw.fdtd.poisson_fdtd import QSFDTD from gpaw.fdtd.polarizable_material import (PermittivityPlus, PolarizableMaterial, PolarizableSphere) from gpaw.tddft import photoabsorption_spectrum import numpy as np # Nanosphere radius (Angstroms) radius = 7.40 # Geometry atom_center = np.array([30., 15., 15.]) sphere_center = np.array([15., 15., 15.]) simulation_cell = np.array([40., 30., 30.]) # Atoms object atoms = Atoms('Na2', atom_center + np.array([[-1.5, 0.0, 0.0], [1.5, 0.0, 0.0]])) # Permittivity of Gold # J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549 eps_gold = PermittivityPlus(data=[[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55], [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76], [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]]) # 1) Nanosphere only classical_material = PolarizableMaterial() classical_material.add_component(PolarizableSphere(center=sphere_center, radius=radius, permittivity=eps_gold)) qsfdtd = QSFDTD(classical_material=classical_material, atoms=None, cells=simulation_cell, spacings=[2.0, 0.5], remove_moments=(1, 1)) energy = qsfdtd.ground_state('gs.gpw', nbands=1) qsfdtd.time_propagation('gs.gpw', kick_strength=[0.001, 0.000, 0.000], time_step=10, iterations=1500, dipole_moment_file='dm.dat') photoabsorption_spectrum('dm.dat', 'spec.1.dat', width=0.15) # 2) Na2 only (radius=0) classical_material = PolarizableMaterial() classical_material.add_component(PolarizableSphere(center=sphere_center, radius=0.0, permittivity=eps_gold)) qsfdtd = QSFDTD(classical_material=classical_material, atoms=atoms, cells=(simulation_cell, 4.0), # vacuum = 4.0 Ang spacings=[2.0, 0.5], remove_moments=(1, 1)) energy = qsfdtd.ground_state('gs.gpw', nbands=-1) qsfdtd.time_propagation('gs.gpw', kick_strength=[0.001, 0.000, 0.000], time_step=10, iterations=1500, dipole_moment_file='dm.dat') photoabsorption_spectrum('dm.dat', 'spec.2.dat', width=0.15) # 3) Nanosphere + Na2 classical_material = PolarizableMaterial() classical_material.add_component(PolarizableSphere(center=sphere_center, radius=radius, permittivity=eps_gold)) qsfdtd = QSFDTD(classical_material=classical_material, atoms=atoms, cells=(simulation_cell, 4.0), # vacuum = 4.0 Ang spacings=[2.0, 0.5], remove_moments=(1, 1)) energy = qsfdtd.ground_state('gs.gpw', nbands=-1) qsfdtd.time_propagation('gs.gpw', kick_strength=[0.001, 0.000, 0.000], time_step=10, iterations=1500, dipole_moment_file='dm.dat') photoabsorption_spectrum('dm.dat', 'spec.3.dat', width=0.15) plot.py000066400000000000000000000012671316441372200340310ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanosphereimport numpy as np import pylab as plt # Plot spectrum with r=0nm and r=5nm spec0 = np.loadtxt('spec.1.dat') # AuNP spec1 = np.loadtxt('spec.2.dat') # Na2 spec2 = np.loadtxt('spec.3.dat') # AuNP+Na2 plt.figure() plt.plot(spec0[:, 0], spec0[:, 1], 'r', label='Au nanoparticle') plt.plot(spec1[:, 0], spec1[:, 1], 'g', label='Na$_2$') plt.plot(spec1[:, 0], spec1[:, 1] + spec0[:, 1], 'k:', label='Sum of Na$_2$ and Au nanoparticle') plt.plot(spec2[:, 0], spec2[:, 1], 'b', label='Na$_2$ near Au nanoparticle') plt.legend(loc=1) plt.xlabel('Energy [eV]', fontsize=12) plt.ylabel('Dipole strength [1/eV]', fontsize=12) plt.xlim((0, 5.0)) plt.ylim((-1, 22.5)) plt.savefig('hybrid.png') plot_geom.py000066400000000000000000000055561316441372200350450ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanosphereimport numpy as np import matplotlib.pyplot as plt from matplotlib import patches from ase.units import Bohr from gpaw.tddft import TDDFT # Initialize TDDFT and QSFDTD td_calc = TDDFT('gs.gpw') def generate_xygrid(d, g, box): vslice = 2 # yx # Determine the array lengths in each dimension ng = d.shape X = None Y = None U = None V = None # Slice data d_slice = np.rollaxis(d, vslice)[g[vslice], :, :] d_proj = np.zeros(d_slice.shape) for ind, val in np.ndenumerate(d_slice): d_proj[ind] = np.where( np.append( np.rollaxis(d, vslice)[:, ind[0], ind[1]], 1.0) != 0)[0][0] # Grids x = np.linspace(0, box[1], ng[1]) y = np.linspace(0, box[0], ng[0]) # Meshgrid and corresponding data X, Y = np.meshgrid(x, y) U = np.real(d_slice[1]) # y V = np.real(d_slice[0]) # x # Spacing dx = x[1] - x[0] dy = y[1] - y[0] return d_slice, d_proj, (x, y, dx, dy), (X, Y, U, V) poisson_solver = td_calc.hamiltonian.poisson atoms = td_calc.atoms box = np.diagonal(poisson_solver.cl.gd.cell_cv) * Bohr # in Ang atom_positions = atoms.positions + poisson_solver.qm.corner1 * Bohr # in Ang atom_elements = atoms.get_chemical_symbols() # create figure plt.figure(1, figsize=(4, 4)) plt.rcParams['font.size'] = 14 # prepare data plotData = poisson_solver.classical_material.beta[0] ng = plotData.shape axis = 2 ax = plt.subplot(1, 1, 1) g = [None, None, ng[2] // 2] dmy1, d_proj, (x, y, dx, dy), dmy2 = generate_xygrid(plotData, g, box) plt.imshow(d_proj, interpolation='bicubic', origin='lower', cmap=plt.cm.Blues, extent=[x[0] - dx / 2, x[-1] + dx / 2, y[0] - dy / 2, y[-1] + dy / 2]) # Plot atoms flt = np.array([True, True, False]) for position in atom_positions: plt.scatter(position[1], position[0], s=50, c='r', marker='o') plt.xlim(x[0], x[-1]) plt.ylim(y[0], y[-1]) # Mark the quantum region i, j = 1, 0 qmrect = patches.Rectangle( (poisson_solver.qm.corner1[i] * Bohr, poisson_solver.qm.corner1[j] * Bohr), (poisson_solver.qm.corner2[i] - poisson_solver.qm.corner1[i]) * Bohr, (poisson_solver.qm.corner2[j] - poisson_solver.qm.corner1[j]) * Bohr, color='black', # #0099FF', fill=0, linewidth=1.0) ax.add_patch(qmrect) # Classical dmy1, dmy_proj, (x, y, dx, dy), dmy3 = generate_xygrid(plotData, g, box) xx, yy = np.meshgrid(x, y) plt.scatter(xx, yy, s=0.75, c='k', marker='o') # Quantum dmy1, dmy_proj, (x, y, dx, dy), dmy3 = generate_xygrid( plotData, g, box=np.diagonal(poisson_solver.qm.gd.cell_cv) * Bohr) xx, yy = np.meshgrid(x, y) plt.scatter(poisson_solver.qm.corner1[i] * Bohr + xx, poisson_solver.qm.corner1[j] * Bohr + yy, s=0.25, c='k', marker='o') # Labels plt.xlabel('y [Ang]') plt.ylabel('x [Ang]') # Plot plt.tight_layout() plt.savefig('geom.png') submit.agts.py000066400000000000000000000004431316441372200353060ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanospheredef agts(queue): c1 = queue.add('calculate.py', ncpus=8, walltime=60) queue.add('plot_geom.py', deps=c1, creates=['geom.png']) queue.add('plot.py', deps=[c1], creates=['hybrid.png']) gold+na2_nanosphere_inducedfield/000077500000000000000000000000001316441372200351725ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamicscalculate.py000066400000000000000000000062731316441372200375110ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanosphere_inducedfieldfrom ase import Atoms from gpaw import GPAW from gpaw.fdtd.poisson_fdtd import FDTDPoissonSolver from gpaw.fdtd.polarizable_material import (PermittivityPlus, PolarizableMaterial, PolarizableSphere) from gpaw.tddft import TDDFT, photoabsorption_spectrum from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField from gpaw.inducedfield.inducedfield_fdtd import FDTDInducedField from gpaw.mpi import world import numpy as np # Nanosphere radius (Angstroms) radius = 7.40 # Geometry atom_center = np.array([30., 15., 15.]) sphere_center = np.array([15., 15., 15.]) simulation_cell = np.array([40., 30., 30.]) # Atoms object atoms = Atoms('Na2', atom_center + np.array([[-1.5, 0.0, 0.0], [1.5, 0.0, 0.0]])) # Permittivity of Gold # J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549 eps_gold = PermittivityPlus(data=[[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55], [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76], [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]]) # 3) Nanosphere + Na2 classical_material = PolarizableMaterial() classical_material.add_component(PolarizableSphere(center=sphere_center, radius=radius, permittivity=eps_gold)) # Combined Poisson solver poissonsolver = FDTDPoissonSolver(classical_material=classical_material, qm_spacing=0.5, cl_spacing=2.0, cell=simulation_cell, communicator=world, remove_moments=(1, 1)) poissonsolver.set_calculation_mode('iterate') # Combined system atoms.set_cell(simulation_cell) atoms, qm_spacing, gpts = poissonsolver.cut_cell(atoms, vacuum=4.0) # Initialize GPAW gs_calc = GPAW(gpts=gpts, nbands=-1, poissonsolver=poissonsolver) atoms.set_calculator(gs_calc) # Ground state energy = atoms.get_potential_energy() # Save state gs_calc.write('gs.gpw', 'all') # Initialize TDDFT and FDTD kick = [0.001, 0.000, 0.000] time_step = 10 iterations = 1500 td_calc = TDDFT('gs.gpw') td_calc.absorption_kick(kick_strength=kick) td_calc.hamiltonian.poisson.set_kick(kick) # Attach InducedFields to the calculation frequencies = [2.05, 2.60] width = 0.15 cl_ind = FDTDInducedField(paw=td_calc, frequencies=frequencies, width=width) qm_ind = TDDFTInducedField(paw=td_calc, frequencies=frequencies, width=width) # Propagate TDDFT and FDTD td_calc.propagate(time_step, iterations, 'dm.dat', 'td.gpw') # Save results td_calc.write('td.gpw', 'all') cl_ind.write('cl.ind') qm_ind.write('qm.ind') photoabsorption_spectrum('dm.dat', 'spec.3.dat', width=width) plot.py000066400000000000000000000045351316441372200365310ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanosphere_inducedfield# -*- coding: utf-8 -*- from gpaw.mpi import world assert world.size == 1, 'This script should be run in serial mode (with one process).' import numpy as np import matplotlib.pyplot as plt from gpaw.inducedfield.inducedfield_base import BaseInducedField from gpaw.tddft.units import aufrequency_to_eV # Helper function def do_plot(d_g, ng, box, atoms): # Take slice of data array d_yx = d_g[:, :, ng[2] // 2] y = np.linspace(0, box[0], ng[0] + 1)[:-1] dy = box[0] / (ng[0] + 1) y += dy * 0.5 ylabel = u'x / Å' x = np.linspace(0, box[1], ng[1] + 1)[:-1] dx = box[1] / (ng[1] + 1) x += dx * 0.5 xlabel = u'y / Å' # Plot plt.figure() ax = plt.subplot(1, 1, 1) X, Y = np.meshgrid(x, y) plt.contourf(X, Y, d_yx, 40) plt.colorbar() for atom in atoms: pos = atom.position plt.scatter(pos[1], pos[0], s=50, c='k', marker='o') plt.xlabel(xlabel) plt.ylabel(ylabel) plt.xlim([x[0], x[-1]]) plt.ylim([y[0], y[-1]]) ax.set_aspect('equal') for fname, name in zip(['cl_field.ind', 'qm_field.ind', 'tot_field.ind'], ['Classical subsystem', 'Quantum subsystem', 'Total hybrid system']): # Read InducedField object ind = BaseInducedField(fname, readmode='all') # Choose array w = 0 # Frequency index freq = ind.omega_w[w] * aufrequency_to_eV # Frequency box = np.diag(ind.atoms.get_cell()) # Calculation box d_g = ind.Ffe_wg[w] # Data array ng = d_g.shape # Size of grid atoms = ind.atoms # Atoms do_plot(d_g, ng, box, atoms) plt.title('%s\nField enhancement @ %.2f eV' % (name, freq)) plt.savefig(fname + '_Ffe.png', bbox_inches='tight') # Imaginary part of density d_g = ind.Frho_wg[w].imag ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('%s\nImaginary part of induced charge density @ %.2f eV' % (name, freq)) plt.savefig(fname + '_Frho.png', bbox_inches='tight') # Imaginary part of potential d_g = ind.Fphi_wg[w].imag ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('%s\nImaginary part of induced potential @ %.2f eV' % (name, freq)) plt.savefig(fname + '_Fphi.png', bbox_inches='tight') postprocess.py000066400000000000000000000013451316441372200401330ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanosphere_inducedfieldfrom gpaw.tddft import TDDFT from gpaw.inducedfield.inducedfield_fdtd import ( FDTDInducedField, calculate_hybrid_induced_field) from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField td_calc = TDDFT('td.gpw') # Classical subsystem cl_ind = FDTDInducedField(filename='cl.ind', paw=td_calc) cl_ind.calculate_induced_field(gridrefinement=2) cl_ind.write('cl_field.ind', mode='all') # Quantum subsystem qm_ind = TDDFTInducedField(filename='qm.ind', paw=td_calc) qm_ind.calculate_induced_field(gridrefinement=2) qm_ind.write('qm_field.ind', mode='all') # Total system, interpolate/extrapolate to a grid with spacing h tot_ind = calculate_hybrid_induced_field(cl_ind, qm_ind, h=1.0) tot_ind.write('tot_field.ind', mode='all') submit.agts.py000066400000000000000000000006271316441372200400110ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold+na2_nanosphere_inducedfielddef agts(queue): c1 = queue.add('calculate.py', ncpus=8, walltime=60) c2 = queue.add('postprocess.py', ncpus=8, walltime=10, deps=c1) queue.add('plot.py', deps=c2, creates=['cl_field.ind_Ffe.png', 'qm_field.ind_Ffe.png', 'tot_field.ind_Ffe.png']) gold_nanosphere/000077500000000000000000000000001316441372200320175ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamicscalculate.py000066400000000000000000000033161316441372200343310ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold_nanospherefrom gpaw.fdtd.poisson_fdtd import QSFDTD from gpaw.fdtd.polarizable_material import (PermittivityPlus, PolarizableMaterial, PolarizableSphere) from gpaw.tddft import photoabsorption_spectrum from gpaw.mpi import world import numpy as np # Nanosphere radius (Angstroms) radius = 50.0 # Whole simulation cell (Angstroms) large_cell = np.array([3 * radius, 3 * radius, 3 * radius]) # Permittivity of Gold # J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549 gold = [[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55], [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76], [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]] # Initialize classical material classical_material = PolarizableMaterial() # Classical nanosphere classical_material.add_component( PolarizableSphere(center=0.5 * large_cell, radius=radius, permittivity=PermittivityPlus(data=gold))) # Quasistatic FDTD qsfdtd = QSFDTD(classical_material=classical_material, atoms=None, cells=large_cell, spacings=[8.0, 1.0], communicator=world, remove_moments=(4, 1)) # Run ground state energy = qsfdtd.ground_state('gs.gpw', nbands=-1) # Run time evolution qsfdtd.time_propagation('gs.gpw', time_step=10, iterations=1000, kick_strength=[0.001, 0.000, 0.000], dipole_moment_file='dm.dat') # Spectrum photoabsorption_spectrum('dm.dat', 'spec.dat', width=0.0) plot.py000066400000000000000000000022261316441372200333510ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold_nanosphereimport numpy as np import pylab as plt from ase.units import Hartree, Bohr from gpaw.fdtd.polarizable_material import PermittivityPlus, _eps0_au # Nanosphere radius (Angstroms) radius = 50.0 # Permittivity of Gold # J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549 gold = [[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55], [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76], [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]] # Plot calculated spectrum and compare with Mie theory spec = np.loadtxt('spec.dat') perm = PermittivityPlus(data=gold).value(spec[:, 0] / Hartree) plt.figure() plt.plot(spec[:, 0], spec[:, 1], 'r', label='QSFDTD') plt.plot(spec[:, 0], 3. * (4. / 3. * np.pi * (radius / Bohr)**3) * (spec[:, 0] / Hartree) / (2. * np.pi**2) / Hartree * np.imag((perm - _eps0_au) / (perm + 2. * _eps0_au)), 'b', label='Mie theory') plt.legend(loc=2) plt.xlabel('Energy [eV]', fontsize=12) plt.ylabel('Dipole strength [1/eV]', fontsize=12) plt.xlim((0, 5.0)) plt.ylim((-1, 3500)) plt.savefig('qsfdtd_vs_mie.png') submit.agts.py000066400000000000000000000002621316441372200346310ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold_nanospheredef agts(queue): c1 = queue.add('calculate.py', walltime=60) queue.add('plot.py', deps=c1, creates=['qsfdtd_vs_mie.png']) gold_nanosphere_inducedfield/000077500000000000000000000000001316441372200345165ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamicscalculate.py000066400000000000000000000053521316441372200370320ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold_nanosphere_inducedfieldfrom ase import Atoms from gpaw import GPAW from gpaw.fdtd.poisson_fdtd import FDTDPoissonSolver from gpaw.fdtd.polarizable_material import (PermittivityPlus, PolarizableMaterial, PolarizableSphere) from gpaw.tddft import TDDFT, photoabsorption_spectrum from gpaw.inducedfield.inducedfield_fdtd import FDTDInducedField from gpaw.mpi import world import numpy as np # Nanosphere radius (Angstroms) radius = 50.0 # Whole simulation cell (Angstroms) large_cell = np.array([3 * radius, 3 * radius, 3 * radius]) # Permittivity of Gold # J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549 gold = [[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55], [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76], [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]] # Initialize classical material classical_material = PolarizableMaterial() # Classical nanosphere classical_material.add_component( PolarizableSphere(center=0.5 * large_cell, radius=radius, permittivity=PermittivityPlus(data=gold))) # Poisson solver poissonsolver = FDTDPoissonSolver(classical_material=classical_material, cl_spacing=8.0, qm_spacing=1.0, cell=large_cell, communicator=world, remove_moments=(4, 1)) poissonsolver.set_calculation_mode('iterate') # Dummy quantum system atoms = Atoms('H', [0.5 * large_cell], cell=large_cell) atoms, qm_spacing, gpts = poissonsolver.cut_cell(atoms) del atoms[:] # Remove atoms, quantum system is empty # Initialize GPAW gs_calc = GPAW(gpts=gpts, nbands=-1, poissonsolver=poissonsolver) atoms.set_calculator(gs_calc) # Ground state energy = atoms.get_potential_energy() # Save state gs_calc.write('gs.gpw', 'all') # Initialize TDDFT and FDTD kick = [0.001, 0.000, 0.000] time_step = 10 iterations = 1000 td_calc = TDDFT('gs.gpw') td_calc.absorption_kick(kick_strength=kick) td_calc.hamiltonian.poisson.set_kick(kick) # Attach InducedField to the calculation frequencies = [2.45] width = 0.0 ind = FDTDInducedField(paw=td_calc, frequencies=frequencies, width=width) # Propagate TDDFT and FDTD td_calc.propagate(time_step, iterations, 'dm0.dat', 'td.gpw') # Save results td_calc.write('td.gpw', 'all') ind.write('td.ind') # Spectrum photoabsorption_spectrum('dm0.dat', 'spec.dat', width=width) # Induced field ind.calculate_induced_field(gridrefinement=2) ind.write('field.ind', mode='all') plot.py000066400000000000000000000043331316441372200360510ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold_nanosphere_inducedfield# -*- coding: utf-8 -*- from gpaw.mpi import world assert world.size == 1, 'This script should be run in serial mode (with one process).' import numpy as np import matplotlib.pyplot as plt from gpaw.inducedfield.inducedfield_base import BaseInducedField from gpaw.tddft.units import aufrequency_to_eV # Helper function def do_plot(d_g, ng, box, atoms): # Take slice of data array d_yx = d_g[:, :, ng[2] // 2] y = np.linspace(0, box[0], ng[0] + 1)[:-1] dy = box[0] / (ng[0] + 1) y += dy * 0.5 ylabel = u'x / Å' x = np.linspace(0, box[1], ng[1] + 1)[:-1] dx = box[1] / (ng[1] + 1) x += dx * 0.5 xlabel = u'y / Å' # Plot plt.figure() ax = plt.subplot(1, 1, 1) X, Y = np.meshgrid(x, y) plt.contourf(X, Y, d_yx, 40) plt.colorbar() for atom in atoms: pos = atom.position plt.scatter(pos[1], pos[0], s=50, c='k', marker='o') plt.xlabel(xlabel) plt.ylabel(ylabel) plt.xlim([x[0], x[-1]]) plt.ylim([y[0], y[-1]]) ax.set_aspect('equal') for fname, name in zip(['field.ind'], ['Classical system']): # Read InducedField object ind = BaseInducedField(fname, readmode='all') # Choose array w = 0 # Frequency index freq = ind.omega_w[w] * aufrequency_to_eV # Frequency box = np.diag(ind.atoms.get_cell()) # Calculation box d_g = ind.Ffe_wg[w] # Data array ng = d_g.shape # Size of grid atoms = ind.atoms # Atoms do_plot(d_g, ng, box, atoms) plt.title('%s\nField enhancement @ %.2f eV' % (name, freq)) plt.savefig(fname + '_Ffe.png', bbox_inches='tight') # Imaginary part of density d_g = ind.Frho_wg[w].imag ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('%s\nImaginary part of induced charge density @ %.2f eV' % (name, freq)) plt.savefig(fname + '_Frho.png', bbox_inches='tight') # Imaginary part of potential d_g = ind.Fphi_wg[w].imag ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('%s\nImaginary part of induced potential @ %.2f eV' % (name, freq)) plt.savefig(fname + '_Fphi.png', bbox_inches='tight') submit.agts.py000066400000000000000000000002621316441372200373300ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/gold_nanosphere_inducedfielddef agts(queue): c1 = queue.add('calculate.py', walltime=60) queue.add('plot.py', deps=c1, creates=['field.ind_Ffe.png']) hybridscheme.rst000066400000000000000000000131751316441372200320570ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics.. _hybridscheme: =============================== Hybrid Quantum/Classical Scheme =============================== The basic idea is to separate the calculation into two parts: the first one is the quantum subsystem, which is propagated using :ref:`timepropagation` scheme, and the second one is the classical subsystem that is treated using :ref:`qsfdtd`. The subsystems are propagated separately in their own real space grids, but they share a common electrostatic potential. In the :ref:`timepropagation` part of the calculation the electrostatic potential is known as the Hartree potential `V^{\rm{qm}}(\mathbf{r}, t)` and it is solved from the Poisson equation `\nabla^2 V^{\rm{qm}}(\mathbf{r}, t) = -4\pi\rho^{\rm{qm}}(\mathbf{r}, t)` In the :ref:`qsfdtd` the electrostatic potential is solved from the Poisson equation as well: `V^{\rm{cl}}(\mathbf{r}, t) = -4\pi\rho^{\rm{cl}}(\mathbf{r}, t).` The hybrid scheme is created by replacing in both schemes the electrostatic (Hartree) potential by a common potential: `\nabla^2 V^{\rm{tot}}(\mathbf{r}, t) = -4\pi\left[\rho^{\rm{cl}}(\mathbf{r}, t)+\rho^{\rm{qm}}(\mathbf{r}, t)\right].` ----------- Double grid ----------- The observables of the quantum and classical subsystems are defined in their own grids, which are overlapping but can have different spacings. The following restrictions must hold: * The quantum grid must fit completely inside the classical grid * The spacing of the classical grid `h_{\rm{cl}}` must be equal to `2^n h_{\rm{qm}}`, where `h_{\rm{qm}}` is the spacing of the quantum grid and n is an integer. When these conditions hold, the potential from one subsystem can be transferred to the other one. The grids are automatically adjusted so that some grid points are common. -------------------------------------------- Transferring the potential between two grids -------------------------------------------- * Transferring the potential from classical subsystem to the quantum grid is performed by interpolating the classical potential to the denser grid of the quantum subsystem. The interpolation only takes place in the small subgrid around the quantum mechanical region. * Transferring the potential from quantum subsystem to the classical one is done in another way: instead of the potential itself, it is the quantum mechanical electron density `\rho^{\rm{qm}}(\mathbf{r}, t)` that is copied to the coarser classical grid. Its contribution to the total electrostatic potential is then determined by solving the Poisson equation in that grid. * Altogether this means that although there is only one potential to be determined `(V^{\rm{tot}}(\mathbf{r}, t))`, three Poisson equations must be solved: 1. `V^{\rm{cl}}(\mathbf{r}, t)` in classical grid 2. `V^{\rm{qm}}(\mathbf{r}, t)` in quantum grid 3. `V^{\rm{qm}}(\mathbf{r}, t)` in classical grid When these are ready and `V^{\rm{cl}}(\mathbf{r}, t)` is transferred to the quantum grid, `V^{\rm{tot}}(\mathbf{r}, t)` is determined in both grids. ---------------------------------------------------------------------------- Example: photoabsorption of Na2 near gold nanosphere ---------------------------------------------------------------------------- This example calculates the photoabsorption of `\text{Na}_2` molecule in (i) presence and (ii) absence of a gold nanosphere: .. literalinclude:: gold+na2_nanosphere/calculate.py |enhanced_absorption| .. |enhanced_absorption| image:: gold+na2_nanosphere/hybrid.png The optical response of the molecule apparently enhances when it is located near the metallic nanoparticle, see Ref. \ [#Sakko]_ for more examples. The geometry and the distribution of the grid points are shown in the following figure (generated with :download:`this script `): |geometry| .. |geometry| image:: gold+na2_nanosphere/geom.png .. _hybrid-inducedfield: ---------------------------------------------------------------------------- Advanced example: Near field enhancement of hybrid system ---------------------------------------------------------------------------- In this example we calculate the same hybrid Na2 + gold nanoparticle system as above, but using the advanced syntax instead of the :code:`QSFDTD` wrapper. This allows us to include :code:`InducedField` observers in the calculation, see :ref:`TDDFTInducedField module documentation `: .. literalinclude:: gold+na2_nanosphere_inducedfield/calculate.py The :code:`TDDFTInducedField` records the quantum part of the calculation and the :code:`FDTDInducedField` records the classical part. We can calculate the individual and the total induced field by the following script: .. literalinclude:: gold+na2_nanosphere_inducedfield/postprocess.py All the :code:`InducedField` objects can be analyzed in the same way as described in :ref:`TDDFTInducedField module documentation `. Here we show an example script for plotting (run in serial mode, i.e., with one process): .. literalinclude:: gold+na2_nanosphere_inducedfield/plot.py This produces the following figures for the electric near field: |cl_fe| |qm_fe| |tot_fe| .. |cl_fe| image:: gold+na2_nanosphere_inducedfield/cl_field.ind_Ffe.png :scale: 70 % .. |qm_fe| image:: gold+na2_nanosphere_inducedfield/qm_field.ind_Ffe.png :scale: 70 % .. |tot_fe| image:: gold+na2_nanosphere_inducedfield/tot_field.ind_Ffe.png :scale: 70 % ---------- References ---------- .. [#Sakko] A. Sakko, T. P. Rossi and R. M. Nieminen, Dynamical coupling of plasmons and molecular excitations by hybrid quantum/classical calculations: time-domain approach *J. Phys.: Condens. Matter* **26**, 315013 (2014) plot_permittivity.py000066400000000000000000000044641316441372200330410ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamicsimport numpy as np import matplotlib.pyplot as plt from ase.units import _hplanck, _c, _e, Hartree from gpaw.fdtd.polarizable_material import PermittivityPlus _eps0_au = 1.0 / (4.0 * np.pi) def eV_from_um(um_i): return _hplanck / _e * _c / (um_i * 1e-6) def plot(fname, fiteps): with open(fname, 'r') as yml: for line in yml: if line.strip().startswith('data'): data_ij = np.array([[float(d) for d in line.split()] for line in yml]) energy_j = eV_from_um(data_ij[:, 0]) n_j = data_ij[:, 1] k_j = data_ij[:, 2] eps_j = (n_j ** 2 - k_j ** 2) + 1.0j * 2 * n_j * k_j energy_e = np.linspace(1.0, 6.0, 100) fiteps_e = np.array([fiteps.value(energy / Hartree) / _eps0_au for energy in energy_e]) plt.figure(figsize=(12, 6)) plt.subplot(1, 2, 1) plt.plot(energy_j, eps_j.real, 'bv', label='data') plt.plot(energy_e, fiteps_e.real, 'b-', label='fit') plt.xlim(energy_e.min(), energy_e.max()) # plt.ylim(fiteps_e.real.min(), fiteps_e.real.max()) plt.ylim(-70, 0) plt.xlabel('Energy (eV)') plt.ylabel('Real($\epsilon$)') plt.legend(loc='best') plt.subplot(1, 2, 2) plt.plot(energy_j, eps_j.imag, 'bv') plt.plot(energy_e, fiteps_e.imag, 'b-') plt.xlim(energy_e.min(), energy_e.max()) # plt.ylim(fiteps_e.imag.min(), fiteps_e.imag.max()) plt.ylim(0, 7) plt.xlabel('Energy (eV)') plt.ylabel('Imaginary($\epsilon$)') plt.tight_layout() plt.savefig('%s.png' % fname) # Permittivity of Gold # Source: # http://refractiveindex.info/?shelf=main&book=Au&page=Johnson # Direct download link: # wget http://refractiveindex.info/database/main/Au/Johnson.yml -O Au.yml ymlfname = 'Au.yml' # Fit to the permittivity # J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549 fiteps = PermittivityPlus(data=[[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55], [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76], [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]]) plot(ymlfname, fiteps) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/qsfdtd.rst000066400000000000000000000261211316441372200307500ustar00rootroot00000000000000.. _qsfdtd: ================================================ Quasistatic Finite-Difference Time-Domain method ================================================ The optical properties of all materials depend on how they respond (absorb and scatter) to external electromagnetic fields. In classical electrodynamics, this response is described by the Maxwell equations. One widely used method for solving them numerically is the finite-difference time-domain (FDTD) approach. \ [#Taflove]_. It is based on propagating the electric and magnetic fields in time under the influence of an external perturbation (light) in such a way that the observables are expressed in real space grid points. The optical constants are obtained by analyzing the resulting far-field pattern. In the microscopic limit of classical electrodynamics the quasistatic approximation is valid and an alternative set of time-dependent equations for the polarization charge, polarization current, and the electric field can be derived.\ [#coomar]_ The quasistatic formulation of FDTD is implemented in GPAW. It can be used to model the optical properties of metallic nanostructures (i) purely classically, or (ii) in combination with :ref:`timepropagation`, which yields :ref:`hybridscheme`. .. TODO: a schematic picture of classical case and hybrid case ------------------------- Quasistatic approximation ------------------------- The quasistatic approximation of classical electrodynamics means that the retardation effects due to the finite speed of light are neglected. It is valid at very small length scales, typically below ~50 nm. Compared to full FDTD, quasistatic formulation has some advantageous features. The magnetic field is negligible and only the longitudinal electric field need to be considered, so the number of degrees of freedom is smaller. Because the retardation effects and propagating solutions are excluded, longer time steps and a simpler treatment of the boundary conditions can be used. ------------ Permittivity ------------ In the current implementation, the permittivity of the classical material is parametrized as a linear combination of Lorentzian oscillators .. math:: \epsilon(\mathbf{r}, \omega) = \epsilon_{\infty} + \sum_j \frac{\epsilon_0 \beta_j(\mathbf{r})}{\bar{\omega}_j^2(\mathbf{r})-\mbox{i}\omega\alpha_j(\mathbf{r})-\omega^2}, where `\alpha_j, \beta_j, \bar{\omega}_j` are fitted to reproduce the experimental permittivity. For gold and silver they can be found in Ref. \ [#Coomar]_. Permittivity defines how classical charge density polarizes when it is subject to external electric fields. The time-evolution for the charges in GPAW is performed with the leap-frog algorithm, following Ref. \ [#Gao]_. To test the quality of the fit, one can use :download:`this script `. This gives a following plot for Au permittivity fitting. .. image:: Au.yml.png :scale: 50 % ------------------- Geometry components ------------------- Several routines are available to generate the basic shapes: * `\text{PolarizableBox}(\mathbf{r}_1, \mathbf{r}_2, \epsilon({\mathbf{r}, \omega}))` where `\mathbf{r}_1` and `\mathbf{r}_2` are the corner points, and `\epsilon({\mathbf{r}, \omega})` is the permittivity inside the structure * `\text{PolarizableSphere}(\mathbf{p}, r, \epsilon({\mathbf{r}, \omega}))` where `\mathbf{p}` is the center and `r` is the radius of the sphere * `\text{PolarizableEllipsoid}(\mathbf{p}, \mathbf{r}, \epsilon({\mathbf{r}, \omega}))` where `\mathbf{p}` is the center and `\mathbf{r}` is the array containing the three radii * `\text{PolarizableRod}(\mathbf{p}, r, \epsilon({\mathbf{r}, \omega}), c)` where `\mathbf{p}` is an array of subsequent corner coordinates, `r` is the radius, and `c` is a boolean denoting whether the corners are rounded * `\text{PolarizableTetrahedron}(\mathbf{p}, \epsilon({\mathbf{r}, \omega}))` where `\mathbf{p}` is an array containing the four corner points of the tetrahedron These routines can generate many typical geometries, and for general cases a set of tetrahedra can be used. ---------------- Optical response ---------------- The QSFDTD method can be used to calculate the optical photoabsorption spectrum just like in :ref:`timepropagation`: The classical charge density is first perturbed with an instantaneous electric field, and then the time dependence of the induced dipole moment is recorderd. Its Fourier transformation gives the photoabsorption spectrum. ------------------------------------------- Example: photoabsorption of gold nanosphere ------------------------------------------- This example calculates the photoabsorption spectrum of a nanosphere that has a diameter of 10 nm, and compares the result with analytical Mie scattering limit. .. literalinclude:: gold_nanosphere/calculate.py Here the *QSFDTD* object generates a dummy quantum system that is treated using GPAW in *qsfdtd.ground_state*. One can pass the GPAW arguments, like *xc* or *nbands*, to this function: in the example script one empty KS-orbital was included (*nbands* =1) because GPAW needs to propagate something. Similarly, the arguments for TDDFT (such as *propagator*) can be passed to *time_propagation* method. Note that the permittivity was initialized as PermittivityPlus, where Plus indicates that a renormalizing Lorentzian term is included; this extra term brings the static limit to vacuum value, i.e., `\epsilon(\omega=0)=\epsilon_0`, see Ref. \ [#Sakko]_ for detailed explanation. The above script generates the photoabsorption spectrum and compares it with analytical formula of the Mie theory: .. math:: S(\omega) = \frac{3V\omega}{2\pi^2}\mbox{Im}\left[\frac{\epsilon(\omega)-1}{\epsilon(\omega)+2}\right], where *V* is the nanosphere volume: |qsfdtd_vs_mie| .. |qsfdtd_vs_mie| image:: gold_nanosphere/qsfdtd_vs_mie.png The general shape of Mie spectrum, and especially the localized surface plasmon resonance (LSPR) at 2.5 eV, is clearly reproduced by QSFDTD. The shoulder at 1.9 eV and the stronger overall intensity are examples of the inaccuracies of the used discretization scheme: the shoulder originates from spurious surface scattering, and the intensity from the larger volume of the nanosphere defined in the grid. For a better estimate of the effective volume, you can take a look at the standard output where the "Fill ratio" tells that 18.035% of the grid points locate inside the sphere. This means that the volume (and intensity) is roughly 16% too large: `\frac{V}{V_{\text{sphere}}}\approx\frac{0.18035\times(15\text{nm})^3)}{\frac{4}{3}\pi\times(5\text{nm})^3}\approx1.16`. ---------------------------------------- Advanced example: Near field enhancement ---------------------------------------- This example shows how to calculate the induced electric near field enhancement of the same nanosphere considered in the previous example. The induced field calculations can be included by using the advanced syntax instead of the simple :code:`QSFDTD` wrapper. In the example one can also see how the dummy empty quantum system is generated. .. literalinclude:: gold_nanosphere_inducedfield/calculate.py The contents of the obtained file :code:`field.ind` can be visualized like described in :ref:`hybrid-inducedfield`. We obtain a following plot of the field: |cl_fe| .. |cl_fe| image:: gold_nanosphere_inducedfield/field.ind_Ffe.png :scale: 70 % Note that the oscillations in the induced field (and density) inside the material are caused by numerical limitations of the current implementation. ----------- Limitations ----------- * The scattering from the spurious surfaces of materials, which are present because of the representation of the polarizable material in uniformly spaced grid points, can cause unphysical broadening of the spectrum. * Nonlinear response (hyperpolarizability) of the classical material is not supported, so do not use too large external fields. In addition to nonlinear media, also other special cases (nonlocal permittivity, natural birefringence, dichroism, etc.) are not enabled. * The frequency-dependent permittivity of the classical material must be represented as a linear combination of Lorentzian oscillators. Other forms, such as Drude terms, should be implemented in the future. Also, the high-frequency limit must be vacuum permittivity. Future implementations should get rid of also this limitation. * Only the grid-mode of GPAW (not e.g. LCAO) is supported. ----------------- Technical remarks ----------------- * Double grid technique: the calculation always uses two grids: one for the classical part and one for the TDDFT part. In purely classical simulations, suchs as the ones discussed in this page, the quantum subsystem contains one empty Kohn-Sham orbital. For more information, see the description of :ref:`hybridscheme` because there the double grid is very important. * Parallelizatility: QSFDTD calculations can by parallelized only over domains, so use either *communicator=serial_comm* or *communicator=world* when initializing *QSFDTD* (or *FDTDPoissonSolver*) class. The domain parallelization of QSFDTD does not affect the parallelization of DFT calculation. * Multipole corrections to Poissonsolver: QSFDTD module is mainly intended for nanoplasmonic simulations. There the charge oscillations are strong and the usual zero boundary conditions for the electrostatic potential can give inaccurate results if the simulation box is not large enough. In some cases, such as for single nanospheres, one can improve the situation by defining remove_moments argument in FDTDPoissonSolver: this will then use the multipole moments correction scheme, see e.g. Ref. \ [#Castro]_. ---- TODO ---- * Dielectrics (`\epsilon_{\infty}\neq\epsilon_0`) * Geometries from 3D model files * Subcell averaging * Full FDTD (retardation effects) or interface to an external FDTD software * Fix grid-dependent oscillations in the induced density ---------------------- Combination with TDDFT ---------------------- The QSFDTD module is mainly aimed to be used in combination with :ref:`timepropagation`: see :ref:`hybridscheme` for more information. ---------- References ---------- .. [#Taflove] A. Taflove and S. Hagness, Computational Electrodynamics: The Finite-Difference Time-Domain Method (3rd ed.), Artech House, Norwood, MA (2005). .. [#Coomar] A. Coomar, C. Arntsen, K. A. Lopata, S. Pistinner and D. Neuhauser, Near-field: a finite-difference time-dependent method for simulation of electrodynamics on small scales, *J. Chem. Phys.* **135**, 084121 (2011) .. [#Gao] Y. Gao and D. Neuhauser, Dynamical quantum-electrodynamics embedding: Combining time-dependent density functional theory and the near-field method *J. Chem. Phys.* **137**, 074113 (2012) .. [#Sakko] A. Sakko, T. P. Rossi and R. M. Nieminen, Dynamical coupling of plasmons and molecular excitations by hybrid quantum/classical calculations: time-domain approach *J. Phys.: Condens. Matter* **26**, 315013 (2014) .. [#Castro] A. Castro, A. Rubio, and M. J. Stott Solution of Poisson's equation for finite systems using plane wave methods *Canad. J. Phys.:* **81**, 1151 (2003) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/electrodynamics/submit.agts.py000066400000000000000000000001351316441372200315400ustar00rootroot00000000000000def agts(queue): queue.add('plot_permittivity.py', creates=['Au.yml.png']) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/external.rst000066400000000000000000000011341316441372200261150ustar00rootroot00000000000000.. module:: gpaw.external External potential ================== Examples -------- >>> # 2.5 eV/Ang along z: >>> from gpaw.external import ConstantElectricField >>> calc = GPAW(external=ConstantElectricField(2.5, [0, 0, 1]), ...) .. autoclass:: ConstantElectricField >>> # Two point-charges: >>> from gpaw.external import PointChargePotential >>> pc = PointChargePotential([-1, 1], [[4.0, 4.0, 0.0], [4.0, 4.0, 10.0]]) >>> calc = GPAW(external=pc, ...) .. autoclass:: PointChargePotential Your own potential ------------------ See an example here: :git:`gpaw/test/ext_potential/harmonic.py`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/gpaw1.txt000066400000000000000000002155501316441372200253320ustar00rootroot000000000000002005-11-18 10.1103/PhysRevLett.95.216401 Bayesian error estimation in density-functional theory 2006-04-15 10.1002/pssb.200541328 Implementation of linear-scaling plane wave density functional theory on parallel computers 2006-04-15 10.1002/pssb.200541348 Three real-space discretization techniques in electronic structure calculations 2006-04-15 10.1002/pssb.200541391 Car-Parrinello molecular dynamics using real space wavefunctions 2006-05-07 10.1063/1.2193514 A general and efficient pseudopotential Fourier filtering scheme for real space methods using mask functions 2007-01-12 10.1103/PhysRevLett.98.026804 First-principles study of electron-conduction properties of C-60 bridges 2007-02-15 10.1103/PhysRevB.75.075108 Evolution-operator method for density functional theory 2008-03-26 10.1021/ja800594p On the structure of thiolate-protected Au-25 2008-06-28 10.1063/1.2943138 Time-dependent density-functional theory in the projector augmented-wave method 2008-07-07 10.1063/1.2949547 Daubechies wavelets as a basis set for density functional pseudopotential calculations 2008-07-08 10.1073/pnas.0801001105 A unified view of ligand-protected gold clusters as superatom complexes 2008-08-15 10.1103/PhysRevB.78.075441 Delta self-consistent field method to obtain potential energy surfaces of excited molecules on surfaces 2008-09-15 10.1103/PhysRevB.78.104102 Compression curves of transition metals in the Mbar range: Experiments and projector augmented-wave calculations 2009-01-15 10.1002/chem.200900301 Synthesis, Stabilization, Functionalization and, DFT Calculations of Gold Nanoparticles in Fluorous Phases (PTFE and Ionic Liquids) 2009-01-15 10.1039/b904491d A density functional investigation of thiolate-protected bimetal PdAu24(SR)(18)(z) clusters: doping the superatom complex 2009-01-15 10.1039/b907148b Density functional theory for transition metals and transition metal chemistry 2009-01-15 10.1039/b911944b The interplay of van der Waals and weak chemical forces in the adsorption of salicylic acid on NaCl(001) 2009-01-15 10.1103/PhysRevB.79.035403 Hot-electron-mediated desorption rates calculated from excited-state potential energy surfaces 2009-01-15 10.1109/ICPPW.2009.42 Analyzing Checkpointing Trends for Applications on the IBM Blue Gene/P System 2009-01-26 10.1063/1.3075216 Gold in graphene: In-plane adsorption and diffusion 2009-01-28 10.1063/1.3055419 Effect of subsurface Ti-interstitials on the bonding of small gold clusters on rutile TiO2(110) 2009-03-13 10.1103/PhysRevLett.102.106102 Bright Beaches of Nanoscale Potassium Islands on Graphite in STM Imaging 2009-03-14 10.1063/1.3086040 Density functional study of the adsorption and van der Waals binding of aromatic and conjugated compounds on the basal plane of MoS2 2009-04-16 10.1021/jp811214k First-Principles Study on Even-Odd Conductance Oscillation of Pt Atomic Nanowires 2009-05-15 10.1103/PhysRevB.79.195326 First-principles study of leakage current through a Si/SiO2 interface 2009-05-15 10.1103/PhysRevB.79.195405 Hot-electron-assisted femtochemistry at surfaces: A time-dependent density functional theory approach 2009-05-22 10.1103/PhysRevLett.102.206801 Quantum Well States in Two-Dimensional Gold Clusters on MgO Thin Films 2009-06-15 10.1002/jcc.21138 Linear Augmented Slater-Type Orbital Method for Free Standing Clusters 2009-06-15 10.1103/PhysRevB.79.235414 Inelastic scattering in a local polaron model with quadratic coupling to bosons 2009-07-28 10.1063/1.3193462 Density functional for van der Waals forces accounts for hydrogen bond in benchmark set of water hexamers 2009-08-05 10.1021/ja903069x 2D-3D Transition for Cationic and Anionic Gold Clusters: A Kinetic Energy Density Functional Study 2009-08-07 10.1063/1.3176508 All-electron density functional theory and time-dependent density functional theory with high-order finite elements 2009-09-09 10.1021/ja905182g Characterization of Iron-Carbonyl-Protected Gold Clusters 2009-09-10 10.1021/jp9023298 Ligand-Protected Gold Alloy Clusters: Doping the Superatom 2009-09-30 10.1088/0953-8984/21/39/395502 QUANTUM ESPRESSO: a modular and open-source software project for quantum simulations of materials 2009-11-15 10.1016/j.commatsci.2009.07.013 Density-functional tight-binding for beginners 2009-11-15 10.1103/PhysRevB.80.195112 Localized atomic basis set in the projector augmented wave method 2009-11-25 10.1021/ja906865f Low Temperature CO Oxidation over Supported Ultrathin MgO Films 2009-12-04 10.1103/PhysRevLett.103.238301 Origin of Power Laws for Reactions at Metal Surfaces Mediated by Hot Electrons 2009-12-10 10.1016/j.jcat.2009.09.016 The effect of Co-promotion on MoS2 catalysts for hydrodesulfurization of thiophene: A density functional study 2010-01-14 10.1021/jp909308k Insight from First-Principles Calculations into the Interactions between Hydroxybenzoic Acids and Alkali Chloride Surfaces 2010-01-15 10.1002/anie.201003851 Formation of Gold(I) Edge Oxide at Flat Gold Nanoclusters on an Ultrathin MgO Film under Ambient Conditions 2010-01-15 10.1039/b917723j Adsorption and activation of O-2 at Au chains on MgO/Mo thin films 2010-01-15 10.1039/b926414k Complementarity between high-energy photoelectron and L-edge spectroscopy for probing the electronic structure of 5d transition metal catalysts 2010-01-15 10.1088/1742-6596/209/1/012030 Theoretical and experimental factors affecting measurements of semiconductor mean inner potentials 2010-01-20 10.1088/0953-8984/22/2/022201 Chemical accuracy for the van der Waals density functional 2010-02-15 10.1016/j.actamat.2009.10.049 Atomistic modeling of interfaces and their impact on microstructure and properties 2010-02-15 10.1103/PhysRevB.81.081408 Graphene on metals: A van der Waals density functional study 2010-02-15 10.1103/PhysRevB.81.085103 Fully self-consistent GW calculations for molecules 2010-02-21 10.1063/1.3298994 Communications: Elementary oxygen electrode reactions in the aprotic Li-air battery 2010-03-15 10.1016/j.elspec.2010.02.004 Theoretical approximations to X-ray absorption spectroscopy of liquid water and ice 2010-03-15 10.1103/PhysRevB.81.115443 Vibrationally mediated control of single-electron transmission in weakly coupled molecule-metal junctions 2010-03-15 10.1137/060651653 Numerical Methods for Electronic Structure Calculations of Materials 2010-04-15 10.1038/NCHEM.589 Quantum size effects in ambient CO oxidation catalysed by ligand-protected gold clusters 2010-04-22 10.1021/jp9116062 Water Dissociation on MgO/Ag(100): Support Induced Stabilization or Electron Pairing? 2010-05-13 10.1021/jp101265v Experimental and Density Functional Theory Analysis of Serial Introductions of Electron-Withdrawing Ligands into the Ligand Shell of a Thiolate-Protected Au-25 Nanoparticle 2010-05-15 10.1002/pssb.200945474 How to observe the oxidation of magnesia-supported Pd clusters by scanning tunnelling microscopy 2010-05-15 10.1007/s11244-010-9443-6 RPBE-vdW Description of Benzene Adsorption on Au(111) 2010-05-15 10.1038/NNANO.2010.45 Penetration of thin C-60 films by metal nanoparticles 2010-05-20 10.1021/jz1002988 Oligomeric Gold-Thiolate Units Define the Properties of the Molecular Junction between Gold and Benzene Dithiols 2010-06-04 10.1103/PhysRevB.81.245105 Projector augmented wave formulation of Hartree-Fock calculations of electronic structure 2010-06-14 10.1063/1.3451265 Electrochemical control of quantum interference in anthraquinone-based molecular switches 2010-06-16 10.1021/ja102934q Chirality and Electronic Structure of the Thiolate-Protected Au-38 Nanocluster 2010-06-22 10.1103/PhysRevB.81.245429 Modeling nanoscale gas sensors under realistic conditions: Computational screening of metal-doped carbon nanotubes 2010-06-25 10.1103/PhysRevLett.104.256102 Site Specificity in Femtosecond Laser Desorption of Neutral H Atoms from Graphite(0001) 2010-06-30 10.1088/0953-8984/22/25/253202 Electronic structure calculations with GPAW: a real-space implementation of the projector augmented-wave method 2010-07-15 10.1007/s11249-009-9566-8 Atomistic Insights into the Running-in, Lubrication, and Failure of Hydrogenated Diamond-Like Carbon Coatings 2010-07-21 10.1063/1.3457947 Quantum corrected Langevin dynamics for adsorbates on metal surfaces interacting with hot electrons 2010-08-15 10.1021/nn101330c Electron Stimulation of Internal Torsion of a Surface-Mounted Molecular Rotor 2010-08-19 10.1021/jp1045436 Theoretical Characterization of Cyclic Thiolated Copper, Silver, and Gold Clusters 2010-08-28 10.1063/1.3464481 CO oxidation on PdO surfaces 2010-09-07 10.1103/PhysRevB.82.115106 Kohn-Sham potential with discontinuity for band gap materials 2010-09-15 10.1016/j.susc.2010.05.024 A Density Functional Theory study on gold cyanide interactions: The fundamentals of ore cleaning 2010-09-16 10.1103/PhysRevB.82.121412 Quantifying transition voltage spectroscopy of molecular junctions: Ab initio calculations 2010-09-24 10.1103/PhysRevB.82.125444 Combined experimental and ab initio study of the electronic structure of narrow-diameter single-wall carbon nanotubes with predominant (6,4),(6,5) chirality 2010-09-30 10.1021/jp1015438 Thiolate-Protected Au-25 Superatoms as Building Blocks: Dimers and Crystals 2010-09-30 10.1021/jp9097342 On the Structure of a Thiolated Gold Cluster: Au-44(SR)(28)(2-) 2010-10-07 10.1063/1.3490247 Memory effects in nonadiabatic molecular dynamics at metal surfaces 2010-10-14 10.1063/1.3492449 DFT plus U study of defects in bulk rutile TiO2 2010-10-28 10.1021/jp1045707 First Principles Studies of the Effect of Nickel Carbide Catalyst Composition on Carbon Nanotube Growth 2010-11-05 10.1103/PhysRevB.82.195411 First-principles calculations of graphene nanoribbons in gaseous environments: Structural and electronic properties 2010-11-10 10.1088/1367-2630/12/11/113016 Graphene on the Ir(111) surface: from van der Waals to strong bonding 2010-11-15 10.1016/j.cpc.2010.07.036 Electronic structure packages: Two implementations of the projector augmented wave (PAW) formalism 2010-11-15 10.1016/j.cplett.2010.10.040 Desorption of H atoms from graphite (0001) using XUV free electron laser pulses 2010-11-16 10.1103/PhysRevB.82.205115 Real-space electronic structure calculations with full-potential all-electron precision for transition metals 2010-11-23 10.1103/PhysRevB.82.201410 Effective elastic properties of a van der Waals molecular monolayer at a metal surface 2010-11-30 10.1016/j.electacta.2010.02.056 The oxygen reduction reaction mechanism on Pt(111) from density functional theory calculations 2010-12-14 10.1063/1.3512618 Low O-2 dissociation barrier on Pt(111) due to adsorbate-adsorbate interactions 2010-12-15 10.1002/pssb.201000171 Designing multifunctional chemical sensors using Ni and Cu doped carbon nanotubes 2010-12-15 10.1002/pssb.201000226 Mechanism study of floating catalyst CVD synthesis of SWCNTs 2010-12-15 10.1002/pssb.201000373 A combined photoemission and ab initio study of the electronic structure of (6,4)/(6,5) enriched single wall carbon nanotubes 2010-12-15 10.1007/s11467-010-0133-4 First-principles modelling of scanning tunneling microscopy using non-equilibrium Green's functions 2011-01-15 10.1002/anie.201104381 'Ligand-Free' Cluster Quantized Charging in an Ionic Liquid 2011-01-15 10.1007/978-3-642-15748-6_3 Ligand Protected Gold Alloy Clusters as Superatoms 2011-01-15 10.1016/j.procs.2011.04.003 GPAW - massively parallel electronic structure calculations with Python-based software 2011-01-15 10.1039/c1cp20406h Thermodynamic and kinetic properties of hydrogen defect pairs in SrTiO3 from density functional theory 2011-01-15 10.1039/c1cp20454h Mechanism of the initial stages of nitrogen-doped single-walled carbon nanotube growth 2011-01-15 10.1039/c1cp20924h Graphical prediction of quantum interference-induced transmission nodes in functionalized organic molecules 2011-01-15 10.1039/c1sc00060h A 58-electron superatom-complex model for the magic phosphine-protected gold clusters (Schmid-gold, Nanogold (R)) of 1.4-nm dimension 2011-03-11 10.1103/PhysRevB.83.113401 Van der Waals effect in weak adsorption affecting trends in adsorption, reactivity, and the view of substrate nobility 2011-03-23 10.1021/ja111077e Electronic and Vibrational Signatures of the Au-102(p-MBA)(44) Cluster 2011-04-05 10.1103/PhysRevB.83.155407 Improving transition voltage spectroscopy of molecular junctions 2011-04-05 10.1103/PhysRevLett.106.146803 Nonlocal Screening of Plasmons in Graphene by Semiconducting and Metallic Substrates: First-Principles Calculations 2011-04-07 10.1063/1.3574836 Robust acceleration of self consistent field calculations for density functional theory 2011-04-11 10.1016/j.cplett.2011.03.001 Electronic hole localization in rutile and anatase TiO2 - Self-interaction correction in Delta-SCF DFT 2011-04-14 10.1103/PhysRevB.83.165418 Charge-transfer model for carbonaceous electrodes in polar environments 2011-04-28 10.1063/1.3563632 Pyrene: Hydrogenation, hydrogen evolution, and pi-band model 2011-05-05 10.1021/jp112114p Size and Shape Dependence of the Electronic and Spectral Properties in TiO2 Nanoparticles 2011-05-12 10.1021/jp2011827 Atomic Layer Deposition of Aluminum Oxide on TiO2 and Its Impact on N3 Dye Adsorption from First Principles 2011-05-15 10.1177/1094342010369118 Understanding Checkpointing Overheads on Massive-Scale Systems: Analysis of the IBM Blue Gene/P System 2011-05-16 10.1016/j.cattod.2010.12.022 The role of transition metal interfaces on the electronic transport in lithium-air batteries 2011-05-21 10.1063/1.3589861 Adsorption properties versus oxidation states of rutile TiO2(110) 2011-05-31 10.1103/PhysRevB.83.184119 Optimized orthogonal tight-binding basis: Application to iron 2011-06-10 10.1016/j.jcp.2011.03.018 A mesh-free convex approximation scheme for Kohn-Sham density functional theory 2011-06-15 10.1002/ejic.201100374 The Al50Cp*(12) Cluster - A 138-Electron Closed Shell (L=6) Superatom 2011-06-15 10.1038/NCHEM.1032 Visible-light-enhanced catalytic oxidation reactions on plasmonic silver nanostructures 2011-06-24 10.1103/PhysRevB.83.245122 Linear density response function in the projector augmented wave method: Applications to solids, surfaces, and interfaces 2011-08-04 10.1021/jp200893w Ab Initio Calculations of the Electronic Properties of Polypyridine Transition Metal Complexes and Their Adsorption on Metal Surfaces in the Presence of Solvent and Counterions 2011-08-11 10.1021/jp203274a Interaction of Au-16 Nanocluster with Defects in Supporting Graphite: A Density-Functional Study 2011-08-15 10.1007/s10562-011-0632-0 Finite Size Effects in Chemical Bonding: From Small Clusters to Solids 2011-08-18 10.1103/PhysRevB.84.085101 Construction and performance of fully numerical optimum atomic basis sets 2011-08-25 10.1021/jp204886n ALD Grown Aluminum Oxide Submonolayers in Dye-Sensitized Solar Cells: The Effect on Interfacial Electron Transfer and Performance 2011-08-28 10.1063/1.3624529 Self-consistent meta-generalized gradient approximation study of adsorption of aromatic molecules on noble metal surfaces 2011-09-07 10.1063/1.3632087 Evidence of superatom electronic shells in ligand-stabilized aluminum clusters 2011-09-12 10.1103/PhysRevB.84.104514 Tuning MgB2(0001) surface states through surface termination 2011-09-15 10.1021/jz201059k Electronic Structure and Bonding of Icosahedral Core-Shell Gold-Silver Nanoalloy Clusters Au144-xAgx(SR)(60) 2011-09-15 10.1166/mex.2011.1027 Computing C1s X-ray Absorption for Single-Walled Carbon Nanotubes with Distinct Electronic Type 2011-09-19 10.1103/PhysRevLett.107.136102 Direct Evidence for Ethanol Dissociation on Rutile TiO2(110) 2011-10-03 10.1103/PhysRevLett.107.156401 Dispersive and Covalent Interactions between Graphene and Metal Surfaces from the Random Phase Approximation 2011-10-06 10.1021/jp204360c Role of the Interface between Pd and PdO in Methane Dissociation 2011-10-21 10.1063/1.3653790 Controlling the transmission line shape of molecular t-stubs and potential thermoelectric applications 2011-10-25 10.1103/PhysRevB.84.153410 First-principles study for the adsorption of segments of BPA-PC on alpha-Al2O3(0001) 2011-11-04 10.1103/PhysRevLett.107.195502 Oxidation of Pt(111) under Near-Ambient Conditions 2011-11-08 10.1103/PhysRevB.84.193402 Au-40: A large tetrahedral magic cluster 2011-11-15 10.1007/s11244-011-9736-4 On the Importance of Gradient-Corrected Correlation for van der Waals Density Functionals 2011-11-15 10.1016/j.elspec.2011.05.004 An implementation of core level spectroscopies in a real space Projector Augmented Wave density functional theory code 2011-11-16 10.1103/PhysRevB.84.205434 Steps on rutile TiO2(110): Active sites for water and methanol dissociation 2011-11-22 10.1016/j.cattod.2011.03.072 Thermally activated transformation of the adsorption configurations of a complex molecule on a Cu(111) surface 2011-11-30 10.1016/j.electacta.2011.08.045 Trends in oxygen reduction and methanol activation on transition metal chalcogenides 2011-12-07 10.1063/1.3663385 Electrical conductivity in Li2O2 and its role in determining capacity limitations in non-aqueous Li-O-2 batteries 2011-12-08 10.1021/jp2040345 Ab Initio van der Waals Interactions in Simulations of Water Alter Structure from Mainly Tetrahedral to High-Density-Like 2011-12-14 10.1103/PhysRevB.84.245429 Electronic shell structure and chemisorption on gold nanoparticles 2011-12-15 10.1007/s11249-011-9864-9 Formation and Oxidation of Linear Carbon Chains and Their Role in the Wear of Carbon Materials 2011-12-20 10.1103/PhysRevB.84.235430 First-principles study of surface plasmons on Ag(111) and H/Ag(111) 2011-12-22 10.1021/jp209198g Progressive Shortening of sp-Hybridized Carbon Chains through Oxygen-Induced Cleavage 2012-01-05 10.1021/jz2013853 Scanning Tunneling Microscopy Measurements of the Full Cycle of a Heterogeneous Asymmetric Hydrogenation Reaction on Chirally Modified Pt(111) 2012-01-14 10.1063/1.3675494 Water monomer interaction with gold nanoclusters from van der Waals density functional theory 2012-01-15 10.1039/c1ce05737e Solvent driven formation of silver embedded resorcinarene nanorods 2012-01-15 10.1039/c2cp23229d The electronic structure of Ge-9[Si(SiMe3)(3)](3)(-): a superantiatom complex 2012-01-15 10.1039/c2cp40715a DFT studies of oxidation routes for Pd-9 clusters supported on gamma-alumina 2012-01-15 10.1039/c2nr30377a The halogen analogs of thiolated gold nanoclusters 2012-01-15 10.1137/110856976 PYCLAW: ACCESSIBLE, EXTENSIBLE, SCALABLE TOOLS FOR WAVE PROPAGATION PROBLEMS 2012-01-21 10.1063/1.3675834 X-ray emission spectroscopy and density functional study of CO/Fe(100) 2012-02-02 10.1021/jz201616z Ethanol Diffusion on Rutile TiO2(110) Mediated by H Adatoms 2012-02-08 10.1103/PhysRevB.85.085412 Physisorption of benzene on a tin dioxide surface: van der Waals interaction 2012-02-14 10.1103/PhysRevB.85.085422 Nonmagnetic and magnetic thiolate-protected Au-25 superatoms on Cu(111), Ag(111), and Au(111) surfaces 2012-02-15 10.1002/pssb.201100786 Ab initio derived force-field parameters for molecular dynamics simulations of deprotonated amorphous-SiO2/water interfaces 2012-02-15 10.1039/c1ee02717d Computational screening of perovskite metal oxides for optimal solar light capture 2012-02-23 10.1021/jp211749g Supramolecular Environment-Dependent Electronic Properties of Metal-Organic Interfaces. 2012-02-28 10.1063/1.3685849 Promoter effect of BaO on CO oxidation on PdO surfaces 2012-03-15 10.1021/jz300069s The Active Phase of Palladium during Methane Oxidation 2012-03-15 10.1088/0034-4885/75/3/036503 O(N) methods in electronic structure calculations 2012-03-19 10.1103/PhysRevLett.108.126101 Systematic Study of Au-6 to Au-12 Gold Clusters on MgO(100) F Centers Using Density-Functional Theory 2012-03-23 10.1103/PhysRevB.85.115317 Phonon-limited mobility in n-type single-layer MoS2 from first principles 2012-04-05 10.1021/jp210869r Study of Alkylthiolate Self-assembled Monolayers on Au(111) Using a Semilocal meta-GGA Density Functional 2012-04-14 10.1063/1.3700800 Nonadiabatic Ehrenfest molecular dynamics within the projector augmented-wave method 2012-04-21 10.1063/1.4704546 Perspective on density functional theory 2012-05-03 10.1021/jp300514f Adsorption and Cyclotrimerization Kinetics of C2H2 at a Cu(110) Surface 2012-05-07 10.1063/1.4707952 Adsorption, mobility, and dimerization of benzaldehyde on Pt(111) 2012-05-09 10.1021/ja211121m Oxidation State and Symmetry of Magnesia-Supported Pd13Ox Nanocatalysts Influence Activation Barriers of CO Oxidation 2012-05-15 10.1039/c2ee03590a Understanding the electrocatalysis of oxygen reduction on platinum and its alloys 2012-05-22 10.1103/PhysRevB.85.205437 Magnetism in nanoscale graphite flakes as seen via electron spin resonance 2012-06-07 10.1021/jp209506d Methanol Oxidation on Model Elemental and Bimetallic Transition Metal Surfaces 2012-06-07 10.1103/PhysRevLett.108.236103 Packing Defects into Ordered Structures: Strands on TiO2 2012-06-13 10.1021/ja3003765 Balance of Nanostructure and Bimetallic Interactions in Pt Model Fuel Cell Catalysts: In Situ XAS and DFT Study 2012-06-13 10.1088/0953-8984/24/23/233202 Time-dependent density-functional theory in massively parallel computer architectures: the OCTOPUS project 2012-06-15 10.1007/s11244-012-9801-7 Construction of New Electronic Density Functionals with Error Estimation Through Fitting 2012-06-15 10.1166/jctn.2012.2102 Progress in Understanding Controlled Single-Walled Carbon Nanotube Growth from Computer Simulations 2012-06-27 10.1103/PhysRevB.85.235149 Density functionals for surface science: Exchange-correlation model development with Bayesian error estimation 2012-07-19 10.1103/PhysRevB.86.045208 Optical properties of bulk semiconductors and graphene/boron nitride: The Bethe-Salpeter equation with derivative discontinuity-corrected density functional energies 2012-08-01 10.1021/ja305004a Structure and Mobility of Metal Clusters in MOFs: Au, Pd, and AuPd Clusters in MOF-74 2012-08-13 10.1103/PhysRevB.86.075429 Anomalous insulator-metal transition in boron nitride-graphene hybrid atomic layers 2012-08-15 10.1002/cctc.201100450 Evidence of Scrambling over Ruthenium-based Catalysts in Supercritical-water Gasification 2012-08-15 10.1021/ja3032339 Structural and Theoretical Basis for Ligand Exchange on Thiolate Monolayer Protected Gold Nanoclusters 2012-08-15 10.1103/PhysRevB.86.081103 Extending the random-phase approximation for electronic correlation energies: The renormalized adiabatic local density approximation 2012-08-16 10.1021/jp304946n Phase Transition of Mg during Hydrogenation of Mg-Nb2O5 Evaporated Composites 2012-08-30 10.1021/jp3004213 Understanding Charge Transfer in Donor-Acceptor/Metal Systems: A Combined Theoretical and Experimental Study 2012-08-30 10.1021/jp3056653 Reactivity and Morphology of Oxygen-Modified Au Surfaces 2012-08-30 10.1021/jp306376r Initial Stages of Growth of Nitrogen-Doped Single-Walled Carbon Nanotubes 2012-09-15 10.1007/s10562-012-0870-9 Modeling van der Waals Interactions in Zeolites with Periodic DFT: Physisorption of n-Alkanes in ZSM-22 2012-09-15 10.1021/ct300172m Ab Initio Parametrized Force Field for the Flexible Metal-Organic Framework MIL-53(Al) 2012-09-27 10.1021/jp306885u Effects of Silver Doping on the Geometric and Electronic Structure and Optical Absorption Spectra of the Au25-nAgn(SH)(18)(-) (n=1, 2, 4, 6, 8, 10, 12) Bimetallic Nanoclusters 2012-10-15 10.1016/j.cpc.2012.05.007 LIBXC: A library of exchange and correlation functionals for density functional theory 2012-10-15 10.1039/c2ee22341d New cubic perovskites for one- and two-photon water splitting using the computational materials repository 2012-10-24 10.1088/0953-8984/24/42/424210 Physisorption of nucleobases on graphene: a comparative van der Waals study 2012-10-24 10.1088/0953-8984/24/42/424212 Desorption of n-alkanes from graphene: a van der Waals density functional study 2012-11-07 10.1063/1.4764356 A van der Waals density functional study of chloroform and other trihalomethanes on graphene 2012-11-08 10.1021/jp307608k Global Minima of Protonated Water Clusters (H2O)(20)H+ Revisited 2012-11-15 10.1002/cctc.201200140 Volcano Relations for Oxidation of Hydrogen Halides over Rutile Oxide Surfaces 2012-11-15 10.1140/epjd/e2012-30485-5 Density functional theory molecular dynamics study of the Au-25(SR)(18)(-) cluster 2012-11-26 10.1103/PhysRevB.86.195429 TDDFT study of time-dependent and static screening in graphene 2012-12-15 10.1007/s11244-012-9908-x Finite-Size Effects in O and CO Adsorption for the Late Transition Metals 2012-12-20 10.1103/PhysRevB.86.241404 Conventional and acoustic surface plasmons on noble metal surfaces: A time-dependent density functional theory study 2013-01-03 10.1016/j.cplett.2012.10.055 The structural and electronic properties of small osmium clusters (2-14): A density functional theory study 2013-01-03 10.1016/j.cplett.2012.11.025 Avoiding pitfalls in the modeling of electrochemical interfaces 2013-01-10 10.1103/PhysRevB.87.045411 Charging properties of gold clusters in different environments 2013-01-15 10.1002/anie.201208443 The Redox Chemistry of Gold with High-Valence Doped Calcium Oxide 2013-01-15 10.1007/s10562-012-0918-x The Oxygen Reduction Reaction on Nitrogen-Doped Graphene 2013-01-15 10.1007/s10562-012-0947-5 CO and CO2 Hydrogenation to Methanol Calculated Using the BEEF-vdW Functional 2013-01-15 10.1039/c3cp50257k Generalized trends in the formation energies of perovskite oxides 2013-01-15 10.1039/c3cp50349f First principles investigation of zinc-anode dissolution in zinc-air batteries 2013-01-15 10.1039/c3cp51083b pH in atomic scale simulations of electrochemical interfaces 2013-01-15 10.1039/c3cp51295a A DFT study of adsorption of perylene on clean and altered anatase (101) TiO2 2013-01-15 10.1140/epjd/e2012-30537-x Structural and electronic properties of AuIr nanoalloys 2013-01-15 10.2533/chimia.2013.271 Methane Catalytic Combustion on Pd-9/gamma-Al2O3 with Different Degrees of Pd Oxidation 2013-01-21 10.1063/1.4773242 Theoretical evidence for low kinetic overpotentials in Li-O-2 electrochemistry 2013-01-30 10.1103/PhysRevB.87.045428 Stratified graphene/noble metal systems for low-loss plasmonics applications 2013-02-07 10.1021/jz3021155 Understanding Trends in the Electrocatalytic Activity of Metals and Enzymes for CO2 Reduction to CO 2013-02-13 10.1103/PhysRevB.87.075111 Random phase approximation applied to solids, molecules, and graphene-metal interfaces: From van der Waals to covalent bonding 2013-02-14 10.1063/1.4790368 Thiolate adsorption on Au(hkl) and equilibrium shape of large thiolate-covered gold nanoparticles 2013-02-15 10.1109/JPROC.2012.2197810 Quantum Transport Modeling From First Principles 2013-02-15 10.1140/epjd/e2012-30486-4 Modeling thiolate-protected gold clusters with density-functional tight-binding 2013-02-21 10.1021/jp305303q Refractive Index Functions of TiO2 Nanoparticles 2013-02-25 10.1103/PhysRevB.87.075207 Formation energies of group I and II metal oxides using random phase approximation 2013-03-15 10.1002/cctc.201200635 First-Principles Calculations of FischerTropsch Processes Catalyzed by Nitrogenase Enzymes 2013-03-15 10.1016/j.scriptamat.2012.10.026 Strain field of interstitial hydrogen atom in body-centered cubic iron and its effect on hydrogen-dislocation interaction 2013-03-18 10.1063/1.4798511 Chemisorption of hydrogen on Fe clusters through hybrid bonding mechanisms 2013-04-15 10.1016/j.carbon.2012.12.008 Binding of atomic oxygen on graphene from small epoxy clusters to a fully oxidized surface 2013-04-15 10.1016/j.jcat.2013.01.009 Guest-host interactions of arenes in H-ZSM-5 and their impact on methanol-to-hydrocarbons deactivation processes 2013-04-25 10.1021/jp400980y 1,3-Diketone Fluids and Their Complexes with Iron 2013-04-28 10.1063/1.4800754 Surface adsorption in strontium chloride ammines 2013-04-28 10.1063/1.4801943 A full implementation of the response iteration scheme for density functional calculations 2013-05-07 10.1103/PhysRevB.87.205410 Screened empirical bond-order potentials for Si-C 2013-05-09 10.1021/jp306172k Electrochemical CO2 and CO Reduction on Metal-Functionalized Porphyrin-like Graphene 2013-05-09 10.1021/jp311980h Li-ion Conduction in the LiBH4:Lil System from Density Functional Theory Calculations and Quasi-Elastic Neutron Scattering 2013-05-15 10.1140/epjb/e2013-40113-5 Carbon nanotubes as heat dissipaters in microelectronics 2013-05-23 10.1021/jp400287h Polycyclic Aromatic Hydrocarbons: Trends for Bonding Hydrogen 2013-06-06 10.1021/jp4024684 First-Principles Study of Excited State Evolution in a Protected Gold Complex 2013-06-19 10.1103/PhysRevB.87.235312 Acoustic phonon limited mobility in two-dimensional semiconductors: Deformation potential and piezoelectric scattering in monolayer MoS2 from first principles 2013-06-21 10.1126/science.1238187 Direct Imaging of Covalent Bond Structure in Single-Molecule Chemical Reactions 2013-06-26 10.1103/PhysRevB.87.235433 Visualizing hybridized quantum plasmons in coupled nanowires: From classical to tunneling regime 2013-07-07 10.1063/1.4812398 Excited-state potential-energy surfaces of metal-adsorbed organic molecules from linear expansion Delta-self-consistent field density-functional theory (Delta SCF-DFT) 2013-07-11 10.1103/PhysRevB.88.035418 Charge localization on a redox-active single-molecule junction and its influence on coherent electron transport 2013-07-11 10.1103/PhysRevLett.111.027601 Layer-Resolved Study of Mg Atom Incorporation at the MgO/Ag(001) Buried Interface 2013-07-15 10.7566/JPSJ.82.074709 A Comparative Density-Functional Theory Investigation of Oxygen Adsorption on Stepped Ni Surfaces 3(hkl) x (111) [hkl = (111), (100), (110)]: Role of Terrace Orientation 2013-08-13 10.1021/cm400541n Lithium Chalcogenidotetrelates: LiChT-Synthesis and Characterization of New Li+ Ion Conducting Li/Sn/Se Compounds 2013-08-15 10.1021/jp400486r Stability of Pt-Modified Cu(111) in the Presence of Oxygen and Its Implication on the Overall Electronic Structure 2013-09-04 10.1021/ja4059074 Protected but Accessible: Oxygen Activation by a Calixarene-Stabilized Undecagold Cluster 2013-09-05 10.1021/jz401553p Gold and Methane: A Noble Combination for Delicate Oxidation 2013-09-15 10.1016/j.jmmm.2013.04.025 Phase stability of chromium based compensated ferrimagnets with inverse Heusler structure 2013-09-18 10.1103/PhysRevB.88.115131 Beyond the random phase approximation: Improved description of short-range correlation by a renormalized adiabatic local density approximation 2013-09-24 10.1021/la402565b H-2 Dissociation over NbO: The First Step toward Hydrogenation of Mg 2013-10-01 10.1016/j.jpowsour.2013.03.110 Li+ adsorption at prismatic graphite surfaces enhances interlayer cohesion 2013-10-03 10.1021/jp4003092 (H2O)(20) Water Clusters at Finite Temperatures 2013-10-15 10.1016/j.susc.2013.06.014 Methane oxidation over Pd and Pt studied by DFT and kinetic modeling 2013-10-15 10.1021/ct400520e Real-Space Density Functional Theory on Graphical Processing Units: Computational Approach and Comparison to Gaussian Basis Set Methods 2013-10-17 10.1021/jp404569m Equilibrium Crystal Shape of Ni from First Principles 2013-10-28 10.1063/1.4827078 CO dissociation on iron nanoparticles: Size and geometry effects 2013-10-28 10.1088/1367-2630/15/10/105026 Stability and bandgaps of layered perovskites for one- and two-photon water splitting 2013-11-01 10.1016/j.jpowsour.2013.04.109 Crystal structure analysis and first principle investigation of F doping in LiFePO4 2013-11-05 10.1103/PhysRevA.88.052501 Koopmans' condition in self-interaction-corrected density-functional theory 2013-11-07 10.1021/jp405670v Improving the Adsorption of Au Atoms and Nanoparticles on Graphite via Li Intercalation 2013-11-15 10.1021/nn4046634 Birth of the Localized Surface Plasmon Resonance in Mono layer-Protected Gold Nanoclusters 2013-11-21 10.1063/1.4829539 Self-interaction corrected density functional calculations of molecular Rydberg states 2013-11-28 10.1063/1.4829640 Interfacial oxygen under TiO2 supported Au clusters revealed by a genetic algorithm search 2013-12-05 10.1021/jp409479h The Influence of Functionals on Density Functional Theory Calculations of the Properties of Reducible Transition Metal Oxide Catalysts 2013-12-12 10.1021/jp410379u Competition between Icosahedral Motifs in AgCu, AgNi, and AgCo Nanoalloys: A Combined Atomistic-DFT Study 2013-12-15 10.1016/j.cpc.2013.07.014 Graphics Processing Unit acceleration of the Random Phase Approximation in the projector augmented wave method 2013-12-15 10.1016/j.jallcom.2013.02.044 The catalytic effect of Nb, NbO and Nb2O5 with different surface planes on dehydrogenation in MgH2: Density functional theory study 2013-12-15 10.1038/NMAT3795 Enabling direct H2O2 production through rational electrocatalyst design 2013-12-21 10.1063/1.4840515 A density functional theory study of atomic steps on stoichiometric rutile TiO2(110) 2014-01-01 10.1080/10408436.2013.772503 Error Estimates for Solid-State Density-Functional Theory Predictions: An Overview by Means of the Ground-State Elemental Crystals 2014-01-15 10.1016/j.susc.2013.09.020 Formation of metastable, heterolytic H-pairs on the RuO2(110) surface 2014-01-15 10.1021/nn406219x Supramolecular Functionalization and Concomitant Enhancement in Properties of Au-25 Clusters 2014-01-15 10.1039/c3cp53922a Interactions of polymers with reduced graphene oxide: van der Waals binding energies of benzene on graphene with defects 2014-01-15 10.1039/c3cp54491e The molecular and magnetic structure of carbon-enclosed and partially covered Fe-55 particles 2014-01-15 10.1039/c3py00853c Soluble and stable alternating main-chain merocyanine copolymers through quantitative spiropyran-merocyanine conversion 2014-01-15 10.1039/c3ra47390b Selective poisoning of Li-air batteries for increased discharge capacity 2014-01-15 10.1039/c3ra47784c Dissociation of oxygen on pristine and nitrogen-doped carbon nanotubes: a spin-polarized density functional study 2014-01-15 10.1039/c4cp00705k H-2 production through electro-oxidation of SO2: identifying the fundamental limitations 2014-01-15 10.1039/c4cp03133d Designing mixed metal halide ammines for ammonia storage using density functional theory and genetic algorithms 2014-01-15 10.1039/c4sc01646g Ultrafast structural dynamics in Rydberg excited N,N,N ',N '-tetramethylethylenediamine: conformation dependent electron lone pair interaction and charge delocalization 2014-01-28 10.1103/PhysRevB.89.014304 Ab initio based thermal property predictions at a low cost: An error analysis 2014-01-31 10.3762/bjnano.5.11 The role of oxygen and water on molybdenum nanoclusters for electro catalytic ammonia production 2014-02-03 10.3762/bjnano.5.12 Core level binding energies of functionalized and defective graphene 2014-02-15 10.1007/s11244-013-0160-9 Genetic Algorithm Procreation Operators for Alloy Nanoparticle Catalysts 2014-02-15 10.1007/s11244-013-0173-4 Modeling Methyl Chloride Photo Oxidation by Oxygen Species on TiO2(110) 2014-02-15 10.1007/s11244-013-0181-4 Calculated Pourbaix Diagrams of Cubic Perovskites for Water Splitting: Stability Against Corrosion 2014-02-15 10.1016/j.jnucmat.2013.11.021 Effect of impurities on vacancy migration energy in Fe-based alloys 2014-02-15 10.1021/nn405114z Revealing the Adsorption Mechanisms of Nitroxides on Ultrapure, Metallicity-Sorted Carbon Nanotubes 2014-02-27 10.1021/jp500800n Graphene Edges Dictate the Morphology of Nanoparticles during Catalytic Channeling 2014-03-05 10.1002/jcc.23487 A Survey of the Parallel Performance and Accuracy of Poisson Solvers for Electronic Structure Calculations 2014-03-12 10.1103/PhysRevB.89.115412 Density functional theory based calculations of the transfer integral in a redox-active single-molecule junction 2014-03-15 10.1016/j.jssc.2013.12.006 Ionic conductivity and the formation of cubic CaH2 in the LiBH4-Ca(BH4)(2) composite 2014-03-15 10.1021/ct400931p Configurational Entropy in Ice Nanosystems: Tools for Structure Generation and Screening 2014-03-28 10.1063/1.4869212 Communication: The influence of CO2 poisoning on overvoltages and discharge capacity in non-aqueous Li-Air batteries 2014-03-28 10.1103/RevModPhys.86.253 First-principles calculations for point defects in solids 2014-04-02 10.1021/ja412141j Single Crystal XRD Structure and Theoretical Analysis of the Chiral Au30S(S-t-Bu)(18) Cluster 2014-04-08 10.1038/srep04598 Low temperature hydrogenation of iron nanoparticles on graphene 2014-04-14 10.1063/1.4870397 mBEEF: An accurate semi-local Bayesian error estimation density functional 2014-04-15 10.1021/cs400875k Remote Activation of Chemical Bonds in Heterogeneous Catalysis 2014-04-22 10.1021/cm4042007 X-ray Absorption Study of Structural Coupling in Photomagnetic Prussian Blue Analogue Core@Shell Particles 2014-05-15 10.1016/j.jcat.2014.04.006 Methanol-to-hydrocarbons conversion: The alkene methylation pathway 2014-05-15 10.1021/ct500087v Quasiparticle Level Alignment for Photocatalytic Interfaces 2014-06-15 10.1021/cs500202f Identification of the Catalytic Site at the Interface Perimeter of Au Clusters on Rutile TiO2(110) 2014-06-27 10.1103/PhysRevB.89.245445 Quasiparticle scattering from topological crystalline insulator SnTe (001) surface states 2014-07-15 10.1021/cs500328c Intermetallic Alloys as CO Electroreduction Catalysts-Role of Isolated Active Sites 2014-07-15 10.1088/0965-0393/22/5/055002 EON: software for long time simulations of atomic scale systems 2014-07-15 10.1088/0965-0393/22/5/055007 Designing rules and probabilistic weighting for fast materials discovery in the Perovskite structure 2014-07-15 10.1117/1.OE.53.7.071808 Optical and other material properties of SiO2 from ab initio studies 2014-07-17 10.1021/jz500850s Direct Dynamics Studies of a Binuclear Metal Complex in Solution: The Interplay Between Vibrational Relaxation, Coherence, and Solvent Effects 2014-07-24 10.1021/jp501581g Atomic Structure, Electronic Properties, and Reactivity of In-Plane Heterostructures of Graphene and Hexagonal Boron Nitride 2014-07-24 10.1021/jp5035147 Hydrogen-Induced Reconstruction of Cu(100): Two-Dimensional and One-Dimensional Structures of Surface Hydride 2014-08-01 10.1093/mnras/stu869 Do cement nanoparticles exist in space? 2014-08-06 10.1088/0953-8984/26/31/315013 Dynamical coupling of plasmons and molecular excitations by hybrid quantum/classical calculations: time-domain approach 2014-08-15 10.1016/j.ssc.2014.04.023 MoS2 nanostructures: Semiconductors with metallic edges 2014-08-15 10.1063/1.4893495 Bandgap calculations and trends of organometal halide perovskites 2014-08-21 10.1039/c4cp02204a Enhancing the hydrogen storage capacity of TiFe by utilizing clusters 2014-08-21 10.1039/c4dt01329h Chloride-bridged, defect-dicubane {Ln(4)} core clusters: syntheses, crystal structures and magnetic properties 2014-08-28 10.1021/jp505462m TDDFT Analysis of Optical Properties of Thiol Monolayer-Protected Gold and Intermetallic Silver-Gold Au-144(SR)(60) and Au84Ag60(SR)(60) Clusters 2014-09-11 10.1103/PhysRevLett.113.115501 Silicon-Carbon Bond Inversions Driven by 60-keV Electrons in Graphene 2014-09-15 10.1088/0031-8949/2014/T162/014019 Ab initio study of structural and electronic properties of partially reduced graphene oxide 2014-09-18 10.1021/jp412360b Electronic and Vibrational Properties of meso-Tetraphenylporphyrin on Silver Substrates 2014-09-18 10.1021/jp501185q Superatomic S-2 Silver Clusters Stabilized by a Thiolate-Phosphine Monolayer: Insight into Electronic and Optical Properties of Ag-14(SC6H3F2)(12)(PPh3)(8) and Ag-16(SC6H3F2)(14)(DPPE)(4) 2014-09-18 10.1021/jp506158c Periodic DFT Study of Benzene Adsorption on Pd(100) and Pd(110) at Medium and Saturation Coverage 2014-09-22 10.1103/PhysRevB.90.125433 Induced work function changes at Mg-doped MgO/Ag(001) interfaces: Combined Auger electron diffraction and density functional study 2014-10-15 10.1016/j.carbon.2014.06.060 Atomic and electronic structure of tetrahedral amorphous carbon surfaces from density functional theory: Properties and simulation strategies 2014-10-15 10.1016/j.ssc.2014.07.008 Physical properties of alpha-Fe upon the introduction of H, He, C, and N 2014-10-15 10.1016/j.susc.2014.05.017 Investigating energetics of Au-8 on graphene/Ru(0001) using a genetic algorithm and density functional theory 2014-10-15 10.1021/nl5029045 High-Conductive Organometallic Molecular Wires with De localized Electron Systems Strongly Coupled to Metal Electrodes 2014-10-16 10.1021/jp507349k Coverage-Dependent Adsorption of Bifunctional Molecules: Detailed Insights into Interactions between Adsorbates 2014-10-21 10.1039/c4cp00753k Segregation effects on the properties of (AuAg)(147) 2014-10-23 10.1021/jp508076c Temperature- and Pressure-Induced Changes in the Crystal Structure of Sr(NH3)(8)Cl-2 2014-11-07 10.1063/1.4900628 Thermodynamic aspects of dehydrogenation reactions on noble metal surfaces 2014-11-07 10.1063/1.4900838 Simplified continuum solvent model with a smooth cavity based on volumetric data 2014-11-15 10.1016/j.susc.2014.03.008 Structure determination of chemisorbed chirality transfer complexes: Accelerated STM analysis and exchange-correlation functional sensitivity 2014-11-17 10.1002/anie.201406246 Squeezing, Then Stacking: From Breathing Pores to Three-Dimensional Ionic Self-Assembly under Electrochemical Control 2014-11-17 10.1002/anie.201406528 A Surface Coordination Network Based on Copper Adatom Trimers 2014-12-04 10.1021/jp509510j Atomic-Scale View on the H2O Formation Reaction from H-2 on O-Rich RuO2(110) 2014-12-07 10.1063/1.4902249 Nucleation and growth of Pt nanoparticles on reduced and oxidized rutile TiO2 (110) 2014-12-11 10.1021/jp509970y Collective Diffusion of Gold Clusters and F-Centers at MgO(100) and CaO(100) Surfaces 2014-12-15 10.1002/pssb.201451171 PFO-BPy solubilizers for SWNTs: Modelling of polymers from oligomers 2014-12-15 10.1002/pssb.201451174 Theoretical electron energy loss spectroscopy of isolated graphene 2014-12-15 10.1364/OE.22.030725 Effects of exchange correlation functional on optical permittivity of gold and electromagnetic responses 2014-12-16 10.1021/la504056v Triazatriangulene as Binding Group for Molecular Electronics 2014-12-18 10.1021/jp505394e Operando Characterization of an Amorphous Molybdenum Sulfide Nanoparticle Catalyst during the Hydrogen Evolution Reaction 2014-12-21 10.1063/1.4903450 Orbital-free density functional theory implementation with the projector augmented-wave method 2015-01-13 10.1103/PhysRevB.91.045418 pi-plasmon dispersion in free-standing graphene by momentum-resolved electron energy-loss spectroscopy 2015-01-15 10.1002/cpe.3199 Design and performance characterization of electronic structure calculations on massively parallel supercomputers: a case study of GPAW on the Blue Gene/P architecture 2015-01-15 10.1016/j.jcp.2014.10.052 Real-time adaptive finite element solution of time-dependent Kohn-Sham equation 2015-01-15 10.1016/j.jssc.2014.09.014 Solid solution barium-strontium chlorides with tunable ammonia desorption properties and superior storage capacity 2015-01-15 10.1021/jp508932x Influence of Adsorbed Water on the Oxygen Evolution Reaction on Oxides 2015-01-15 10.1039/c4cc09467k Iron oxide cluster induced barrier-free conversion of nitric oxide to ammonia 2015-01-15 10.1039/c4cp02789b A DFT study of the effect of OH groups on the optical, electronic, and structural properties of TiO2 nanoparticles 2015-01-15 10.1039/c4cy01044b Single-chiral-catalytic-surface-sites: STM and DFT study of stereodirecting complexes formed between (R)-1-(1-naphthyl)ethylamine and ketopantolactone on Pt(111) 2015-01-15 10.1039/c5cc04513d UV photoexcitation of a dissolved metalloid Ge-9 cluster compound and its extensive ultrafast response 2015-01-15 10.1039/c5cp00298b A DFT-based genetic algorithm search for AuCu nanoalloy electrocatalysts for CO2 reduction 2015-01-15 10.1039/c5cp00435g An old workhorse for new applications: Fe(dpm)(3) as a precursor for low-temperature PECVD of iron(III) oxide 2015-01-15 10.1039/c5cp01211b Optimizing a parametrized Thomas-Fermi-Dirac-Weizsacker density functional for atoms 2015-01-15 10.1039/c5cp01222h A real-space stochastic density matrix approach for density functional electronic structure 2015-01-15 10.1039/c5cp03382a Low temperature pollutant trapping and dissociation over two-dimensional tin 2015-01-15 10.1039/c5cp90198g Real-space numerical grid methods in quantum chemistry 2015-01-15 10.1039/c5nr04324g Pd2Au36(SR)(24) cluster: structure studies 2015-01-15 10.1039/c5py00141b High molecular weight mechanochromic spiropyran main chain copolymers via reproducible microwave-assisted Suzuki polycondensation 2015-01-15 10.1039/c5ta01586c Calculated optical absorption of different perovskite phases 2015-01-22 10.1103/PhysRevB.91.045204 Strain sensitivity of band gaps of Sn-containing semiconductors 2015-01-28 10.1021/ja5109968 A Critical Size for Emergence of Nonbulk Electronic and Geometric Structures in Dodecanethiolate-Protected Au Clusters 2015-02-02 10.1103/PhysRevB.91.081401 Calculation of the graphene C 1s core level binding energy 2015-02-05 10.1021/jz502637b Copper Induces a Core Plasmon in Intermetallic Au(144,145)-xCux(SR)(60) Nanoclusters 2015-03-03 10.1103/PhysRevB.91.094104 High-pressure neutron scattering of the magnetoelastic Ni-Cr Prussian blue analog 2015-03-07 10.1063/1.4913739 Nanoplasmonics simulations at the basis set limit through completeness-optimized, local numerical basis sets 2015-03-09 10.1103/PhysRevB.91.125410 Density functional theory based direct comparison of coherent tunneling and electron hopping in redox-active single-molecule junctions 2015-03-14 10.1063/1.4906048 Chemical insight from density functional modeling of molecular adsorption: Tracking the bonding and diffusion of anthracene derivatives on Cu(111) with molecular orbitals 2015-03-14 10.1063/1.4908062 Selection of conformational states in self-assembled surface structures formed from an oligo(naphthylene-ethynylene) 3-bit binary switch 2015-03-15 10.1007/s10562-015-1495-6 CatMAP: A Software Package for Descriptor-Based Microkinetic Mapping of Catalytic Trends 2015-03-15 10.1016/j.susc.2014.11.006 Detection of adsorbate overlayer structural transitions using sum-frequency generation spectroscopy 2015-03-15 10.1021/nn506711a Molecule-like Photodynamics of Au-102(pMBA)(44) Nano cluster 2015-03-15 10.1088/2053-1583/2/1/014001 The growth of Fe clusters over graphene/Cu(111) 2015-03-18 10.1002/adfm.201404388 Molecular Heterojunctions of Oligo(phenylene ethynylene)s with Linear to Cruciform Framework 2015-03-24 10.1103/PhysRevB.91.115431 Localized surface plasmon resonance in silver nanoparticles: Atomistic first-principles time-dependent density-functional theory calculations 2015-03-26 10.1021/acs.jpca.5b01797 Ultrafast Structural Pathway of Charge Transfer in N,N,N ',N '-Tetramethylethylenediamine 2015-03-28 10.1063/1.4915265 Density functional theory and chromium: Insights from the dimers 2015-04-01 10.1016/j.cplett.2015.02.013 Relationship between unbranched alkane dimer interaction energies using different theoretical methods and correlations with thermodynamic properties 2015-04-02 10.1021/acs.jpcc.5b00734 Isolating a Reaction Intermediate in the Hydrogenation of 2,2,2-Trifluoroacetophenone on Pt(111) 2015-04-05 10.1002/jcc.23834 van der Waals Interactions are Critical in Car-Parrinello Molecular Dynamics Simulations of Porphyrin-Fullerene Dyads 2015-04-08 10.1002/aenm.201401082 Design Principles for Metal Oxide Redox Materials for Solar-Driven Isothermal Fuel Production 2015-04-15 10.1515/ntrev-2012-0047 On the interaction between gold and silver metal atoms and DNA/RNA nucleobases - a comprehensive computational study of ground state properties 2015-04-16 10.1021/jp5125475 Impacts of Copper Position on the Electronic Structure of [Au25-xCux(SH)(18)](-) Nanoclusters 2015-04-16 10.1103/PhysRevLett.114.156101 Strong Influence of Coadsorbate Interaction on CO Desorption Dynamics on Ru(0001) Probed by Ultrafast X-Ray Spectroscopy and Ab Initio Simulations 2015-04-24 10.1103/PhysRevB.91.165309 Band-gap engineering of functional perovskites through quantum confinement and tunneling 2015-04-30 10.1021/acs.jpcc.5b01068 The Role of the Anchor Atom in the Ligand of the Monolayer-Protected Au-25(XR)(18)(-) Nanocluster 2015-05-07 10.1021/acs.jpclett.5b00353 Two-Dimensional Metal Dichalcogenides and Oxides for Hydrogen Evolution: A Computational Screening Approach 2015-05-08 10.1088/0953-8984/27/17/175007 The effect of point defects on diffusion pathway within alpha-Fe 2015-05-13 10.1088/0953-8984/27/18/183202 Subsystem density-functional theory as an effective tool for modeling ground and excited states, their dynamics and many-body interactions 2015-05-14 10.1021/acs.jpcc.5b01580 Improved Tight-Binding Charge Transfer Model and Calculations of Energetics of a Step on the Rutile TiO2(110) Surface 2015-05-14 10.1038/srep10163 Silver (I) as DNA glue: Ag+-mediated guanine pairing revealed by removing Watson-Crick constraints 2015-05-15 10.1021/cs501673g A Consistent Reaction Scheme for the Selective Catalytic Reduction of Nitrogen Oxides with Ammonia 2015-05-21 10.1021/jp510926q Theoretical Analysis of the M12Ag32(SR)(40)(4-) and X@M12Ag32(SR)(30)(4-) Nanoclusters (M = Au, Ag; X = H, Mn) 2015-06-03 10.1103/PhysRevB.91.235201 Heats of formation of solids with error estimation: The mBEEF functional with and without fitted reference energies 2015-06-06 10.1098/rsfs.2014.0084 Rational design of metal nitride redox materials for solar-driven ammonia synthesis 2015-06-08 10.1002/cssc.201500239 Design Principles of Perovskites for Thermochemical Oxygen Separation 2015-06-11 10.1021/acs.jpcc.5b02950 Computational 2D Materials Database: Electronic Structure of Transition-Metal Dichalcogenides and Oxides 2015-06-15 10.1002/anie.201410974 Ketene as a Reaction Intermediate in the Carbonylation of Dimethyl Ether to Methyl Acetate over Mordenite 2015-06-20 10.1016/j.electacta.2015.04.006 First principles study of (Cd, Hg, In, Tl, Sn, Pb, As, Sb, Bi, Se) modified Pt (111), Pt(100) and Pt(211) electrodes as CO oxidation catalysts 2015-06-24 10.1021/cr500551h Quantum-Chemical Characterization of the Properties and Reactivities of Metal-Organic Frameworks 2015-06-25 10.1021/acs.jpcc.5b04106 From Chemistry to Functionality: Trends for the Length Dependence of the Thermopower in Molecular Junctions 2015-07-01 10.1016/j.comptc.2015.03.026 Hydrogen oxidation reaction on Pd(111) electrode in alkaline media: Ab-initio DFT study of OH effects 2015-07-02 10.1021/acs.jpclett.5b01045 Impact of Ga-V Codoping on Interfacial Electron Transfer in Dye-Sensitized TiO2 2015-07-14 10.1021/acs.chemmater.5b00446 Accelerated DFT-Based Design of Materials for Ammonia Storage 2015-07-15 10.1002/ente.201500065 Carbon Dioxide Reforming of Methane using an Isothermal Redox Membrane Reactor 2015-07-15 10.1021/acs.nanolett.5b01251 Dielectric Genome of van der Waals Heterostructures 2015-07-15 10.1021/acscatal.5b00754 Tailoring Gold Nanoparticle Characteristics and the Impact on Aqueous-Phase Oxidation of Glycerol 2015-07-15 10.1021/cs501542n Mechanistic Pathway in the Electrochemical Reduction of CO2 on RuO2 2015-07-15 10.1595/205651315X687975 Atomic-Scale Modelling and its Application to Catalytic Materials Science Developing an interdisciplinary approach to modelling 2015-07-16 10.1021/acs.jpclett.5b01043 Electrochemical Barriers Made Simple 2015-07-30 10.1021/acs.jpcc.5b04977 Self-Metalation of Phthalocyanine Molecules with Silver Surface Atoms by Adsorption on Ag(110) 2015-08-05 10.1088/1367-2630/17/8/083006 Calculations of Al dopant in alpha-quartz using a variational implementation of the Perdew-Zunger self-interaction correction 2015-08-11 10.1103/PhysRevB.92.081109 Influence of molecular conformations on the electronic structure of organic charge transfer salts 2015-08-13 10.1021/acs.jpcc.5b04432 Role of Li2O2@Li2CO3 Interfaces on Charge Transport in Nonaqueous Li-Air Batteries 2015-08-15 10.1021/acs.nanolett.5b02188 Electric-Field Control of Interfering Transport Pathways in a Single-Molecule Anthraquinone Transistor 2015-08-20 10.1021/acs.jpcc.5b04985 Real-Time Study of CVD Growth of Silicon Oxide on Rutile TiO2(110) Using Tetraethyl Orthosilicate 2015-08-20 10.1021/acs.jpcc.5b05894 Optical Properties of Monolayer-Protected Aluminum Clusters: Time-Dependent Density Functional Theory Study 2015-08-21 10.1063/1.4928646 Indication of non-thermal contribution to visible femtosecond laser-induced CO oxidation on Ru(0001) 2015-08-26 10.1038/srep13382 Edge state magnetism in zigzag-interfaced graphene via spin susceptibility measurements 2015-08-27 10.1021/acs.jpcc.5b05392 Using G(0)W(0) Level Alignment to Identify Catechol's Structure on TiO2(110) 2015-08-27 10.1021/acs.jpcc.5b05580 Tuning the Schottky Barrier at the Graphene/MoS2 Interface by Electron Doping: Density Functional Theory and Many-Body Calculations 2015-08-27 10.1021/acs.jpcc.5b07622 Photodynamics of a Molecular Water-Soluble Nanocluster Identified as Au-130(pMBA)(50) 2015-09-05 10.1002/qua.24945 Unoccupied titanium 3d states due to subcluster formation in stoichiometric TiO2 nanoparticles 2015-09-15 10.1016/j.ccr.2015.05.002 The role of density functional theory methods in the prediction of nanostructured gas-adsorbent materials 2015-09-15 10.1016/j.molcata.2015.04.016 Identifying the active sites for CO dissociation on Fe-BCC nanoclusters 2015-09-20 10.1016/j.electacta.2015.01.136 Theoretical modeling of the PEMFC catalyst layer: A review of atomistic methods 2015-10-15 10.1016/j.susc.2015.03.011 Optical laser-induced CO desorption from Ru(0001) monitored with a free-electron X-ray laser: DFT prediction and X-ray confirmation of a precursor state 2015-10-15 10.1016/j.susc.2015.04.013 Dissociative adsorption of water on Au/MgO/Ag(001) from first principles calculations 2015-10-15 10.1021/acs.jpcc.5b06132 Coexistence of Square Pyramidal Structures of Oxo Vanadium (+5) and (+4) Species Over Low-Coverage VOX/TiO2 (101) and (001) Anatase Catalysts 2015-10-15 10.1021/acscatal.5b01254 Comparison between the Oxygen Reduction Reaction Activity of Pd5Ce and Pt5Ce: The Importance of Crystal Structure 2015-10-16 10.1103/PhysRevD.92.083517 Modulation effects in dark matter-electron scattering experiments 2015-10-25 10.1016/j.jallcom.2015.05.253 Dependence of constituent elements of AB(5) type metal hydrides on hydrogenation degradation by CO2 poisoning 2015-12-01 10.1103/PhysRevLett.115.236804 Quantized Evolution of the Plasmonic Response in a Stretched Nanorod 2015-12-15 10.1016/j.ultramic.2015.07.011 Surface effects on mean inner potentials studied using density functional theory 2016-01-15 10.1016/j.carbon.2015.09.062 Planar versus three-dimensional growth of metal nanostructures at graphene 2016-01-15 10.1016/j.commatsci.2015.09.013 AiiDA: automated interactive infrastructure and database for computational science 2016-01-15 10.1039/c5cy01016k Graphene decorated with Fe nanoclusters for improving the hydrogen sorption kinetics of MgH2 - experimental and theoretical evidence 2016-01-15 10.1039/c5cy01839k Gold assisted oxygen dissociation on a molybdenum-doped CaO(001) surface 2016-01-15 10.1039/c5dt04542h Hydrophobic and antioxidant effects in In, Sn, and Sb based two dimensional materials 2016-01-15 10.1039/c5fd00203f Effects of particle size and edge structure on the electronic structure, spectroscopic features, and chemical properties of Au(111)-supported MoS2 nanoparticles 2016-01-15 10.1039/c5nr08122j Tuning Ag-29 nanocluster light emission from red to blue with one and two-photon excitation 2016-01-15 10.1039/c5sc03042k Charge transfer and ultrafast nuclear motions: the complex structural dynamics of an electronically excited triamine 2016-01-15 10.1039/c6cp04194a Decoupling strain and ligand effects in ternary nanoparticles for improved ORR electrocatalysis 2016-01-15 10.1039/c6cy00756b H-2/D-2 exchange reaction on mono-disperse Pt clusters: enhanced activity from minute O-2 concentrations 2016-01-15 10.1039/c6ee01010e Computer calculations across time and length scales in photovoltaic solar cells 2016-01-15 10.1039/c6ra21668d Ab initio calculation of halide ligand passivation on PbSe quantum dot facets 2016-01-15 10.1039/c6sc01360k Conformations of cyclopentasilane stereoisomers control molecular junction conductance 2016-01-19 10.1016/j.ssc.2015.11.017 Strain engineering of electronic properties of transition metal dichalcogenide monolayers 2016-01-19 10.1038/srep19375 Machine learning bandgaps of double perovskites 2016-01-19 10.1103/PhysRevB.93.041302 Transformation of metallic boron into substitutional dopants in graphene on 6H-SiC(0001) 2016-01-28 10.1021/acs.jpcc.5b10025 Photoinduced Absorption within Single-Walled Carbon Nanotube Systems 2016-01-28 10.1039/c5cp04694g Correlation between diffusion barriers and alloying energy in binary alloys 2016-02-09 10.1088/0957-4484/27/7/075501 B-40 fullerene as a highly sensitive molecular device for NH3 detection at low bias: a first-principles study 2016-02-10 10.1016/j.electacta.2016.01.070 Targeted design of alpha-MnO2 based catalysts for oxygen reduction 2016-02-15 10.1007/s11082-015-0370-4 A model for terahertz plasmons in graphene 2016-02-15 10.1016/j.commatsci.2015.11.013 Material synthesis and design from first principle calculations and machine learning 2016-02-15 10.1021/acscatal.5b02369 Catalytic Activities of Sulfur Atoms in Amorphous Molybdenum Sulfide for the Electrochemical Hydrogen Evolution Reaction 2016-02-15 10.1038/NNANO.2015.255 Field-induced conductance switching by charge-state alternation in organometallic single-molecule junctions 2016-02-17 10.1021/acsami.5b11792 Selective Growth of Noble Gases at Metal/Oxide Interface 2016-02-18 10.1002/cctc.201501049 Exploring Scaling Relations for Chemisorption Energies on Transition-Metal-Exchanged Zeolites ZSM-22 and ZSM-5 2016-02-26 10.1038/srep21990 Unravelling Site-Specific Photo-Reactions of Ethanol on Rutile TiO2(110) 2016-02-28 10.1063/1.4942665 Structure and role of metal clusters in a metal-organic coordination network determined by density functional theory 2016-03-15 10.1016/j.commatsci.2015.12.012 Plasmonic and dielectric properties of ideal graphene 2016-03-15 10.1021/acs.cgd.6b00003 Designing Square Two-Dimensional Gold and Platinum 2016-03-15 10.1038/ncomms11013 Charge localization in a diamine cation provides a test of energy functionals and self-interaction correction 2016-03-31 10.1021/acs.jpca.5b12739 Reversible Hydrogen Uptake by BN and BC3 Monolayers Functionalized with Small Fe Clusters: A Route to Effective Energy Storage 2016-03-31 10.1021/acs.jpcc.5b11211 When Conductance Is Less than the Sum of Its Parts: Exploring Interference in Multiconnected Molecules 2016-03-31 10.1021/acs.jpcc.5b12611 Theoretical Insight into the Internal Quantum Efficiencies of Polymer/C-60 and Polymer/SWNT Photovoltaic Devices 2016-04-06 10.1002/adma.201505498 Extremely Weak van der Waals Coupling in Vertical ReS2 Nanowalls for High-Current-Density Lithium-Ion Batteries 2016-04-15 10.1002/qua.25106 Update to ACE-molecule: Projector augmented wave method on lagrange-sinc basis set 2016-04-15 10.1016/j.jcp.2016.01.034 Development of an exchange-correlation functional with uncertainty quantification capabilities for density functional theory 2016-04-15 10.1016/j.susc.2015.11.018 A comparative study of diastereomeric complexes formed by a prochiral substrate and three structurally analogous chiral molecules on Pt(111) 2016-04-15 10.1038/NCHEM.2454 Effects of correlated parameters and uncertainty in electronic-structure-based chemical kinetic modelling 2016-04-21 10.1021/acs.jpcc.5b12448 Atomic-Scale Analysis of the RuO2/Water Interface under Electrochemical Conditions 2016-04-27 10.1002/adma.201504650 Evidence of Porphyrin-Like Structures in Natural Melanin Pigments Using Electrochemical Fingerprinting 2016-04-27 10.1088/0022-3727/49/16/165303 Effect of interface geometry on electron tunnelling in Al/Al2O3/Al junctions 2016-04-28 10.1063/1.4947225 Pyridine adsorption and diffusion on Pt(111) investigated with density functional theory 2016-05-01 10.1016/j.jcp.2016.02.023 Grid-based electronic structure calculations: The tensor decomposition approach 2016-05-05 10.1021/acs.jpcc.6b01828 Tuning Conductance in Aromatic Molecules: Constructive and Counteractive Substituent Effects 2016-05-21 10.1063/1.4950828 An approach to develop chemical intuition for atomistic electron transport calculations using basis set rotations 2016-06-15 10.1016/j.cpc.2016.02.005 High performance Python for direct numerical simulations of turbulent flows 2016-06-21 10.1063/1.4954003 All-silicon tandem solar cells: Practical limits for energy conversion and possible routes for improvement 2016-06-23 10.1021/acs.jpcc.6b05207 Revealing the Multibonding State between Hydrogen and GrapheneSupported Ti Clusters 2016-06-30 10.1103/PhysRevB.93.235162 mBEEF-vdW: Robust fitting of error estimation density functionals 2016-07-01 10.1103/PhysRevB.94.041401 Stark shift and electric-field-induced dissociation of excitons in monolayer MoS2 and hBN/MoS2 heterostructures 2016-07-07 10.1039/c6cp02274j The reaction mechanism for the SCR process on monomer V5+ sites and the effect of modified Bronsted acidity 2016-07-12 10.1103/PhysRevB.94.035128 Limitations of effective medium theory in multilayer graphite/hBN heterostructures 2016-07-14 10.1021/acs.jpcc.6b05068 Machine Learning Assisted Predictions of Intrinsic Dielectric Breakdown Strength of ABX(3) Perovskites 2016-07-25 10.1103/PhysRevB.94.041112 Offset-corrected Delta-Kohn-Sham scheme for semiempirical prediction of absolute x-ray photoelectron energies in molecules and solids 2016-08-05 10.7498/aps.65.157303 First-principles study on thermodynamic properties of CdxZn1-xO alloys 2016-08-15 10.1016/j.enconman.2016.05.069 Computational study on oxynitride perovskites for CO2 photoreduction 2016-08-15 10.1016/j.engfracmech.2016.04.024 Hydrogen induced amorphisation around nanocracks in aluminium 2016-08-15 10.1021/acs.jctc.6b00456 Minimal Basis Iterative Stockholder: Atoms in Molecules for Force-Field Development 2016-08-16 10.1103/PhysRevB.94.064105 Quantification of uncertainty in first-principles predicted mechanical properties of solids: Application to solid ion conductors 2016-08-18 10.1021/acs.jpcc.6b06163 Disentangling Vacancy Oxidation on Metallicity-Sorted Carbon Nanotubes 2016-08-23 10.1021/acs.chemmater.6b01956 Thermodynamic Insight in the High-Pressure Behavior of UiO-66: Effect of Linker Defects and Linker Expansion 2016-09-05 10.1002/anie.201604269 Controlling the Adsorption of Carbon Monoxide on Platinum Clusters by Dopant-Induced Electronic Structure Modification 2016-09-15 10.1209/0295-5075/115/57002 Ab initio study of M2SnBr6 (M = K, Rb, Cs): Electronic and optical properties 2016-09-19 10.1002/anie.201605559 Charge Transport and Conductance Switching of Redox-Active Azulene Derivatives 2016-09-19 10.1021/acs.inorgchem.6b01635 Reactivity of Two-Dimensional Au-9, Pt-9, and Au18Pt18 against Common Molecules 2016-09-28 10.1039/c6cp05188j Strong 1D localization and highly anisotropic electron-hole masses in heavy-halogen functionalized graphenes 2016-09-29 10.1021/acs.jpcc.6b06254 Gold/lsophorone Interaction Driven by Keto/Enol Tautomerization 2016-09-29 10.1103/PhysRevB.94.125444 Band-gap control in phosphorene/BN structures from first-principles calculations 2016-10-06 10.1038/ncomms12962 Metal-free photochemical silylations and transfer hydrogenations of benzenoid hydrocarbons and graphene 2016-10-10 10.1038/ncomms13040 Isotope analysis in the transmission electron microscope 2016-10-15 10.1007/s00706-016-1795-6 Bias-induced conductance switching in single molecule junctions containing a redox-active transition metal complex 2016-10-15 10.1088/0953-8984/28/39/393001 Applications of large-scale density functional theory in biology 2016-10-15 10.15199/62.2016.10.11 Role of support in industrial catalytic processes. Theoretical modeling 2016-10-17 10.1038/srep35605 Spectromicroscopy of C-60 and azafullerene C59N: Identifying surface adsorbed water 2016-10-21 10.1039/c6cp05014j Enhanced hydrogen desorption properties of LiAlH4 by doping lithium metatitanate 2016-10-21 10.1063/1.4964671 Accelerating the search for global minima on potential energy surfaces using machine learning 2016-10-30 10.1002/jcc.24477 Density Functional Theory for Molecular and Periodic Systems Using Density Fitting and Continuous Fast Multipole Method: Analytical Gradients 2016-11-01 10.1016/j.jphotochem.2016.08.007 Does organic/organic interface mimic band bending by deforming structure? 2016-11-10 10.1021/acs.jpcc.6b06638 A DFT Structural Investigation of New Bimetallic PtSnx Surface Alloys Formed on the Pt(110) Surface and Their Interaction with Carbon Monoxide 2016-11-15 10.1016/j.cpc.2016.06.012 A wavelet-based Projector Augmented-Wave (PAW) method: Reaching frozen-core all-electron precision with a systematic, adaptive and localized wavelet basis set 2016-11-15 10.1021/acs.jctc.6b00815 Implementation of Constrained DFT for Computing Charge Transfer Rates within the Projector Augmented Wave Method 2016-11-15 10.1021/acscatal.6b01848 Operando Raman Spectroscopy of Amorphous Molybdenum Sulfide (MoSx) during the Electrochemical Hydrogen Evolution Reaction: Identification of Sulfur Atoms as Catalytically Active Sites for H+ Reduction 2016-11-21 10.1039/c6cp04575h Investigating the coverage dependent behaviour of CO on Gd/Pt(111) 2017-01-24 10.3762/bjnano.8.25 Colorimetric gas detection by the varying thickness of a thin film of ultrasmall PTSA-coated TiO2 nanoparticles on a Si substrate 2017-01-26 10.1021/acs.jpcc.6b10251 Toward Two-Dimensional Superatomic Honeycomb Structures. Evaluation of [Ge-9(Si(SiMe3))(3)](-) as Source of Ge-9-Cluster Building Blocks for Extended Materials 2017-02-14 10.1021/acs.chemmater.6b04216 Solution-Synthesized In4SnSe4 Semiconductor Microwires with a Direct Band Gap 2017-02-14 10.1103/PhysRevB.95.054110 Unveiling descriptors for predicting the bulk modulus of amorphous carbon 2017-02-15 10.1016/j.jcat.2016.12.017 A complete reaction mechanism for standard and fast selective catalytic reduction of nitrogen oxides on low coverage VOx/TiO2(001) catalysts 2017-02-15 10.1021/acs.jctc.6b00809 Theory and Applications of Generalized Pipek-Mezey Wannier Functions 2017-02-15 10.1103/PhysRevB.95.085422 Alternative structure of TiO2 with higher energy valence band edge 2017-02-25 10.1016/j.jallcom.2016.11.153 Global structural optimization and growth mechanism of cobalt oxide nanoclusters by genetic algorithm with spin-polarized DFT 2017-03-02 10.1021/acs.jpcc.6b11953 Adsorption and Activation of Water on Cuboctahedral Rhodium and Platinum Nanoparticles 2017-03-07 10.1039/c6cy01904h Reaction mechanism of dimethyl ether carbonylation to methyl acetate over mordenite a combined DFT/experimental study 2017-03-15 10.1002/sia.6106 Probing CO/Fe(100) surfaces from firstprinciples: structures, energetics, and vibrations 2017-03-15 10.1021/acscatal.6b02590 STM Study of Ketopantolactone/(R)-1-(1-Naphthyl)ethylamine Complexes on Pt(111): Comparison of Prochiral and Enantiomeric Ratios and Examination of the Contribution of CH center dot center dot center dot OC Bonding 2017-03-23 10.1021/acs.jpcc.6b09289 Synergetic Surface Sensitivity of Photoelectrochemical Water Oxidation on TiO2 (Anatase) Electrodes 2017-04-06 10.1021/acs.jpca.7b01248 Substituent Correlations Characterized by Hammett Constants in the Spiropyran Merocyanine Transition 2017-04-07 10.1002/cctc.201601662 A New Type of Scaling Relations to Assess the Accuracy of Computational Predictions of Catalytic Activities Applied to the Oxygen Evolution Reaction 2017-04-07 10.1039/c7dt00372b Structural stability and electronic properties of an octagonal allotrope of two dimensional boron nitride 2017-04-10 10.1002/cssc.201601869 High Redox Capacity of Al-Doped La1-xSrxMnO3- Perovskites for Splitting CO2 and H2O at Mn-Enriched Surfaces 2017-04-15 10.1016/j.commatsci.2017.01.031 Growth of two-dimensional Au patches in graphene pores: A density-functional study 2017-04-20 10.1021/acs.jpcc.7b00283 Effects of Aromaticity and Connectivity on the Conductance of Five-Membered Rings 2017-05-07 10.1039/c7tc00336f Probing lattice vibration and surface electronic state in a layered (NH4)(2)V3O8 single crystal 2017-05-09 10.1002/cssc.201601632 Determination of Conduction and Valence Band Electronic Structure of LaTiOxNy Thin Film 2017-05-10 10.1002/smll.201604161 One-Step In Situ Growth of Iron-Nickel Sulfide Nanosheets on FeNi Alloy Foils: High-Performance and Self-Supported Electrodes for Water Oxidation 2017-05-15 10.1007/s11244-016-0701-0 Understanding Structure and Stability of Monoclinic Zirconia Surfaces from First-Principles Calculations 2017-05-15 10.1016/j.cplett.2017.02.018 Catalysis in real time using X-ray lasers 2017-05-15 10.1021/acs.accounts.6b00516 Structure and Dynamics of Individual Diastereomeric Complexes on Platinum: Surface Studies Related to Heterogeneous Enantioselective Catalysis 2017-05-18 10.1002/ejic.201700008 Rapid Ultrasound-Assisted Synthesis of Mesoporous Manganese Oxides for Low-Concentration NO Elimination with Superior Water-Resistance 2017-05-25 10.1021/acs.jpcc.6b10618 Analysis of the Electronic Structure of Non-Spherical Ligand-Protected Metal Nanoclusters: The Case of a Box-Like Ag-67 2017-05-25 10.1021/acs.jpcc.6b12004 Isophorone on Au/MgO/Ag(001): Physisorption with Electrostatic Site Selection 2017-05-26 10.1103/PhysRevB.95.195158 Convergence behavior of the random phase approximation renormalized correlation energy 2017-06-01 10.1002/anie.201701135 Reversible Supracolloidal Self-Assembly of Cobalt Nanoparticles to Hollow Capsids and Their Superstructures 2017-06-07 10.1039/c7cp01440f Stability, electronic structure, and optical properties of protected gold-doped silver Ag29-xAux (x=0-5) nanoclusters 2017-06-15 10.1016/j.cattod.2017.02.028 Single site porphyrine-like structures advantages over metals for selective electrochemical CO2 reduction 2017-06-15 10.1016/j.micromeso.2017.02.065 Distribution of open sites in Sn-Beta zeolite 2017-06-15 10.1038/NCHEM.2753 Monitoring interconversion between stereochemical states in single chirality-transfer complexes on a platinum surface 2017-06-28 10.1021/jacs.7b04755 Formation of Germa-ketenimine on the Ge(100) Surface by Adsorption of tert-Butyl Isocyanide 2017-07-01 10.1016/j.camwa.2016.12.003 Multi-domain muffin tin finite element density functional calculations for small molecules 2017-07-12 10.1088/1361-648X/aa680e The atomic simulation environment-a Python library for working with atoms 2017-07-15 10.1021/acs.nanolett.7b01592 The Role of Through-Space Interactions in Modulating Constructive and Destructive Interference Effects in Benzene 2017-07-17 10.1103/PhysRevB.96.045419 Adsorption sites of individual metal atoms on ultrathin MgO(100) films 2017-07-18 10.1103/PhysRevB.96.035422 Anisotropic plasmons, excitons, and electron energy loss spectroscopy of phosphorene 2017-07-20 10.1021/acs.jpcc.7b02608 Defect Chemistry and Electrical Conductivity of Sm-Doped La1-xSrxCoO3-delta for Solid Oxide Fuel Cells 2017-08-02 10.1021/jacs.7b05599 Extreme Conductance Suppression in Molecular Siloxanes 2017-08-07 10.1039/c7ta02081c Design principles of perovskites for solar-driven thermochemical splitting of CO2 2017-08-11 10.1038/s41598-017-08651-1 Spectroscopic observation of oxygen dissociation on nitrogen-doped graphene 2017-08-14 10.1088/1361-6455/aa7d2c Spectroscopic signatures of triplet states in acenes 2017-08-15 10.1103/PhysRevB.96.085421 Quantum interference in coherent tunneling through branched molecular junctions containing ferrocene centers 2017-08-21 10.1038/s41467-017-00385-y Visualizing atomic-scale redox dynamics in vanadium oxide-based catalysts 2017-09-01 10.1088/1361-651X/aa7320 libvdwxc: a library for exchange-correlation functionals in the vdW-DF family 2017-09-15 10.1002/sia.6238 Unsaturated surface in CO saturation 2017-10-15 10.1016/j.jcis.2017.06.017 Investigation of anti-solvent induced optical properties change of cesium lead bromide iodide mixed perovskite (CsPbBr3-xIx) quantum dots gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/gpaw2.txt000066400000000000000000002115511316441372200253300ustar00rootroot000000000000002010-01-15 10.1002/anie.201003851 Formation of Gold(I) Edge Oxide at Flat Gold Nanoclusters on an Ultrathin MgO Film under Ambient Conditions 2010-09-16 10.1103/PhysRevB.82.121412 Quantifying transition voltage spectroscopy of molecular junctions: Ab initio calculations 2010-10-14 10.1063/1.3492449 DFT plus U study of defects in bulk rutile TiO2 2010-10-15 10.1021/nl101688a The Relation between Structure and Quantum Interference in Single Molecule Junctions 2010-11-05 10.1103/PhysRevB.82.195411 First-principles calculations of graphene nanoribbons in gaseous environments: Structural and electronic properties 2010-12-30 10.1021/jp1076774 Ab Initio Adsorption Thermodynamics of H2S and H-2 on Ni(111): The Importance of Thermal Corrections and Multiple Reaction Equilibria 2011-01-15 10.1002/anie.201104381 'Ligand-Free' Cluster Quantized Charging in an Ionic Liquid 2011-01-15 10.1016/j.procs.2011.04.003 GPAW - massively parallel electronic structure calculations with Python-based software 2011-01-15 10.1021/nn102887x Solid-State Reactions in Binary Molecular Assemblies of F16CuPc and Pentacene 2011-01-15 10.1039/c1cp20406h Thermodynamic and kinetic properties of hydrogen defect pairs in SrTiO3 from density functional theory 2011-01-15 10.1039/c1cp20924h Graphical prediction of quantum interference-induced transmission nodes in functionalized organic molecules 2011-01-15 10.1039/c1sc00060h A 58-electron superatom-complex model for the magic phosphine-protected gold clusters (Schmid-gold, Nanogold (R)) of 1.4-nm dimension 2011-03-04 10.1103/PhysRevB.83.115108 Self-consistent GW calculations of electronic transport in thiol- and amine-linked molecular junctions 2011-03-23 10.1021/ja111077e Electronic and Vibrational Signatures of the Au-102(p-MBA)(44) Cluster 2011-04-05 10.1103/PhysRevB.83.155407 Improving transition voltage spectroscopy of molecular junctions 2011-04-05 10.1103/PhysRevLett.106.146803 Nonlocal Screening of Plasmons in Graphene by Semiconducting and Metallic Substrates: First-Principles Calculations 2011-04-07 10.1063/1.3574836 Robust acceleration of self consistent field calculations for density functional theory 2011-04-11 10.1016/j.cplett.2011.03.001 Electronic hole localization in rutile and anatase TiO2 - Self-interaction correction in Delta-SCF DFT 2011-04-15 10.1103/PhysRevB.83.165423 Stacking and band structure of van derWaals bonded graphane multilayers 2011-04-28 10.1063/1.3563632 Pyrene: Hydrogenation, hydrogen evolution, and pi-band model 2011-05-05 10.1021/jp112114p Size and Shape Dependence of the Electronic and Spectral Properties in TiO2 Nanoparticles 2011-05-12 10.1021/jp2011827 Atomic Layer Deposition of Aluminum Oxide on TiO2 and Its Impact on N3 Dye Adsorption from First Principles 2011-05-16 10.1016/j.cattod.2010.12.022 The role of transition metal interfaces on the electronic transport in lithium-air batteries 2011-05-19 10.1021/jp1121799 Density Functional Theory Study on Propane and Propene Adsorption on Pt(111) and PtSn Alloy Surfaces 2011-05-21 10.1063/1.3589861 Adsorption properties versus oxidation states of rutile TiO2(110) 2011-05-31 10.1103/PhysRevB.83.184119 Optimized orthogonal tight-binding basis: Application to iron 2011-06-15 10.1002/ejic.201100374 The Al50Cp*(12) Cluster - A 138-Electron Closed Shell (L=6) Superatom 2011-06-15 10.1103/PhysRevB.83.235419 PbSe nanocrystals remain intrinsic after surface adsorption of hydrazine 2011-06-24 10.1103/PhysRevB.83.245122 Linear density response function in the projector augmented wave method: Applications to solids, surfaces, and interfaces 2011-07-11 10.1088/0953-8984/23/27/276004 Tight-binding simulation of transition-metal alloys 2011-07-15 10.1007/s10562-011-0637-8 Atomic-Scale Modeling of Particle Size Effects for the Oxygen Reduction Reaction on Pt 2011-07-22 10.1103/PhysRevB.84.035117 Self-consistent meta-generalized gradient approximation within the projector-augmented-wave method 2011-07-25 10.1103/PhysRevB.84.035434 Electronic structure of gold, aluminum, and gallium superatom complexes 2011-07-29 10.1103/PhysRevB.84.041412 Multiterminal single-molecule-graphene-nanoribbon junctions with the thermoelectric figure of merit optimized via evanescent mode transport and gate voltage 2011-08-04 10.1021/jp200893w Ab Initio Calculations of the Electronic Properties of Polypyridine Transition Metal Complexes and Their Adsorption on Metal Surfaces in the Presence of Solvent and Counterions 2011-08-11 10.1021/jp203274a Interaction of Au-16 Nanocluster with Defects in Supporting Graphite: A Density-Functional Study 2011-08-25 10.1021/jp204886n ALD Grown Aluminum Oxide Submonolayers in Dye-Sensitized Solar Cells: The Effect on Interfacial Electron Transfer and Performance 2011-08-28 10.1063/1.3624529 Self-consistent meta-generalized gradient approximation study of adsorption of aromatic molecules on noble metal surfaces 2011-09-01 10.1021/jz200513h Nonspectral Methods for Solving the Schrodinger Equation for Electronic and Vibrational Problems 2011-09-07 10.1063/1.3632087 Evidence of superatom electronic shells in ligand-stabilized aluminum clusters 2011-09-12 10.1103/PhysRevB.84.104514 Tuning MgB2(0001) surface states through surface termination 2011-09-15 10.1166/mex.2011.1027 Computing C1s X-ray Absorption for Single-Walled Carbon Nanotubes with Distinct Electronic Type 2011-09-19 10.1103/PhysRevLett.107.136102 Direct Evidence for Ethanol Dissociation on Rutile TiO2(110) 2011-09-29 10.1103/PhysRevB.84.121203 Electronic hole transfer in rutile and anatase TiO2: Effect of a delocalization error in the density functional theory on the charge transfer barrier height 2011-10-03 10.1103/PhysRevLett.107.156401 Dispersive and Covalent Interactions between Graphene and Metal Surfaces from the Random Phase Approximation 2011-10-06 10.1021/jp204360c Role of the Interface between Pd and PdO in Methane Dissociation 2011-10-14 10.1063/1.3646510 Robust conductance of dumbbell molecular junctions with fullerene anchoring groups 2011-10-14 10.1103/PhysRevB.84.155113 Adaptation of the projector-augmented-wave formalism to the treatment of orbital-dependent exchange-correlation functionals 2011-10-15 10.1002/cctc.201100160 Tailoring the Activity for Oxygen Evolution Electrocatalysis on Rutile TiO2(110) by Transition-Metal Substitution 2011-10-20 10.1103/PhysRevB.84.153104 Pseudopotential approximation in van derWaals density functional calculations 2011-10-21 10.1063/1.3651239 All-electron time-dependent density functional theory with finite elements: Time-propagation approach 2011-10-21 10.1063/1.3653790 Controlling the transmission line shape of molecular t-stubs and potential thermoelectric applications 2011-10-25 10.1103/PhysRevB.84.153410 First-principles study for the adsorption of segments of BPA-PC on alpha-Al2O3(0001) 2011-11-04 10.1103/PhysRevLett.107.195502 Oxidation of Pt(111) under Near-Ambient Conditions 2011-11-08 10.1103/PhysRevB.84.193402 Au-40: A large tetrahedral magic cluster 2011-11-09 10.3762/bjnano.2.82 Towards quantitative accuracy in first-principles transport calculations: The GW method applied to alkane/gold junctions 2011-11-16 10.1103/PhysRevB.84.205434 Steps on rutile TiO2(110): Active sites for water and methanol dissociation 2011-11-30 10.1016/j.electacta.2011.08.045 Trends in oxygen reduction and methanol activation on transition metal chalcogenides 2011-12-07 10.1063/1.3663385 Electrical conductivity in Li2O2 and its role in determining capacity limitations in non-aqueous Li-O-2 batteries 2011-12-08 10.1021/jp2040345 Ab Initio van der Waals Interactions in Simulations of Water Alter Structure from Mainly Tetrahedral to High-Density-Like 2011-12-14 10.1103/PhysRevB.84.245429 Electronic shell structure and chemisorption on gold nanoparticles 2011-12-15 10.1007/s11249-011-9864-9 Formation and Oxidation of Linear Carbon Chains and Their Role in the Wear of Carbon Materials 2011-12-20 10.1103/PhysRevB.84.235430 First-principles study of surface plasmons on Ag(111) and H/Ag(111) 2011-12-22 10.1021/jp209198g Progressive Shortening of sp-Hybridized Carbon Chains through Oxygen-Induced Cleavage 2012-01-05 10.1021/jz2013853 Scanning Tunneling Microscopy Measurements of the Full Cycle of a Heterogeneous Asymmetric Hydrogenation Reaction on Chirally Modified Pt(111) 2012-01-14 10.1063/1.3675494 Water monomer interaction with gold nanoclusters from van der Waals density functional theory 2012-01-15 10.1039/c1cp23212f Solar hydrogen production with semiconductor metal oxides: new directions in experiment and theory 2012-01-15 10.1039/c2cp23229d The electronic structure of Ge-9[Si(SiMe3)(3)](3)(-): a superantiatom complex 2012-01-15 10.1039/c2cp40715a DFT studies of oxidation routes for Pd-9 clusters supported on gamma-alumina 2012-01-15 10.1039/c2nr30377a The halogen analogs of thiolated gold nanoclusters 2012-01-15 10.1039/c2nr30444a One-pot synthesis and characterization of subnanometre-size benzotriazolate protected copper clusters 2012-01-21 10.1063/1.3675834 X-ray emission spectroscopy and density functional study of CO/Fe(100) 2012-02-02 10.1021/jz201616z Ethanol Diffusion on Rutile TiO2(110) Mediated by H Adatoms 2012-02-08 10.1103/PhysRevB.85.085412 Physisorption of benzene on a tin dioxide surface: van der Waals interaction 2012-02-14 10.1103/PhysRevB.85.085422 Nonmagnetic and magnetic thiolate-protected Au-25 superatoms on Cu(111), Ag(111), and Au(111) surfaces 2012-02-15 10.1002/pssb.201100786 Ab initio derived force-field parameters for molecular dynamics simulations of deprotonated amorphous-SiO2/water interfaces 2012-02-15 10.1016/j.susc.2011.11.007 Preservation of the Pt(100) surface reconstruction after growth of a continuous layer of graphene 2012-02-15 10.1039/c1ee02717d Computational screening of perovskite metal oxides for optimal solar light capture 2012-02-16 10.1103/PhysRevB.85.085424 Channeling of charge carrier plasmons in carbon nanotubes 2012-02-22 10.1088/0953-8984/24/7/075604 A self-consistent DFT+DMFT scheme in the projector augmented wave method: applications to cerium, Ce2O3 and Pu2O3 with the Hubbard I solver and comparison to DFT+U 2012-02-28 10.1063/1.3685849 Promoter effect of BaO on CO oxidation on PdO surfaces 2012-03-15 10.1007/s10825-012-0386-y First-principles quantum transport modeling of thermoelectricity in single-molecule nanojunctions with graphene nanoribbon electrodes 2012-03-19 10.1103/PhysRevLett.108.126101 Systematic Study of Au-6 to Au-12 Gold Clusters on MgO(100) F Centers Using Density-Functional Theory 2012-03-23 10.1103/PhysRevB.85.115317 Phonon-limited mobility in n-type single-layer MoS2 from first principles 2012-04-05 10.1021/jp210869r Study of Alkylthiolate Self-assembled Monolayers on Au(111) Using a Semilocal meta-GGA Density Functional 2012-04-05 10.1021/jz300051d Understanding Periodic Dislocations in 2D Supramolecular Crystals: The PFP/Ag(111) Interface 2012-04-14 10.1063/1.3700800 Nonadiabatic Ehrenfest molecular dynamics within the projector augmented-wave method 2012-04-15 10.1021/cs200693g NaBr Poisoning of Au/TiO2 Catalysts: Effects on Kinetics, Poisoning Mechanism, and Estimation of the Number of Catalytic Active Sites 2012-04-23 10.1103/PhysRevB.85.155441 First-principles analysis of photocurrent in graphene PN junctions 2012-04-23 10.1103/PhysRevB.85.165440 Unraveling the acoustic electron-phonon interaction in graphene 2012-04-27 10.1103/PhysRevB.85.155140 Ab initio nonequilibrium quantum transport and forces with the real-space projector augmented wave method 2012-05-01 10.1016/j.cplett.2012.03.031 Ab-initio calculations of the direct and hydrogen-assisted dissociation of CO on Fe(310) 2012-05-03 10.1021/jp300514f Adsorption and Cyclotrimerization Kinetics of C2H2 at a Cu(110) Surface 2012-05-07 10.1063/1.4707952 Adsorption, mobility, and dimerization of benzaldehyde on Pt(111) 2012-05-09 10.1021/ja211121m Oxidation State and Symmetry of Magnesia-Supported Pd13Ox Nanocatalysts Influence Activation Barriers of CO Oxidation 2012-05-22 10.1103/PhysRevB.85.205437 Magnetism in nanoscale graphite flakes as seen via electron spin resonance 2012-05-25 10.1103/PhysRevB.85.184426 Magnetoresistance and negative differential resistance in Ni/graphene/Ni vertical heterostructures driven by finite bias voltage: A first-principles study 2012-06-07 10.1021/jp209506d Methanol Oxidation on Model Elemental and Bimetallic Transition Metal Surfaces 2012-06-07 10.1103/PhysRevLett.108.236103 Packing Defects into Ordered Structures: Strands on TiO2 2012-06-10 10.1088/0004-637X/752/1/3 EXPERIMENTAL EVIDENCE FOR THE FORMATION OF HIGHLY SUPERHYDROGENATED POLYCYCLIC AROMATIC HYDROCARBONS THROUGH H ATOM ADDITION AND THEIR CATALYTIC ROLE IN H-2 FORMATION 2012-06-13 10.1021/ja3003765 Balance of Nanostructure and Bimetallic Interactions in Pt Model Fuel Cell Catalysts: In Situ XAS and DFT Study 2012-06-15 10.1007/s11244-012-9801-7 Construction of New Electronic Density Functionals with Error Estimation Through Fitting 2012-06-15 10.1016/j.jcat.2012.03.007 Elementary steps of syngas reactions on Mo2C(001): Adsorption thermochemistry and bond dissociation 2012-06-27 10.1103/PhysRevB.85.235149 Density functionals for surface science: Exchange-correlation model development with Bayesian error estimation 2012-07-05 10.1002/jcc.22987 ERKALEuA flexible program package for X-ray properties of atoms and molecules 2012-07-12 10.1021/jp302424g Scanning Tunneling Microscopy Evidence for the Dissociation of Carbon Monoxide on Ruthenium Steps 2012-07-16 10.1103/PhysRevB.86.041406 Edge currents and nanopore arrays in zigzag and chiral graphene nanoribbons as a route toward high-ZT thermoelectrics 2012-07-19 10.1103/PhysRevB.86.045208 Optical properties of bulk semiconductors and graphene/boron nitride: The Bethe-Salpeter equation with derivative discontinuity-corrected density functional energies 2012-08-01 10.1021/ja305004a Structure and Mobility of Metal Clusters in MOFs: Au, Pd, and AuPd Clusters in MOF-74 2012-08-03 10.1103/PhysRevB.86.085405 Graphene on metal surfaces and its hydrogen adsorption: A meta-GGA functional study 2012-08-08 10.1103/PhysRevB.86.075417 Reversible graphene-metal contact through hydrogenation 2012-08-13 10.1103/PhysRevB.86.075429 Anomalous insulator-metal transition in boron nitride-graphene hybrid atomic layers 2012-08-15 10.1002/cctc.201100450 Evidence of Scrambling over Ruthenium-based Catalysts in Supercritical-water Gasification 2012-08-15 10.1021/ja3032339 Structural and Theoretical Basis for Ligand Exchange on Thiolate Monolayer Protected Gold Nanoclusters 2012-08-15 10.1103/PhysRevB.86.081103 Extending the random-phase approximation for electronic correlation energies: The renormalized adiabatic local density approximation 2012-08-27 10.1103/PhysRevB.86.075146 Tuning the magnetic moments in zigzag graphene nanoribbons: Effects of metal substrates 2012-08-30 10.1021/jp3004213 Understanding Charge Transfer in Donor-Acceptor/Metal Systems: A Combined Theoretical and Experimental Study 2012-08-30 10.1021/jp3056653 Reactivity and Morphology of Oxygen-Modified Au Surfaces 2012-08-30 10.1021/jp306376r Initial Stages of Growth of Nitrogen-Doped Single-Walled Carbon Nanotubes 2012-09-15 10.1007/s10562-012-0870-9 Modeling van der Waals Interactions in Zeolites with Periodic DFT: Physisorption of n-Alkanes in ZSM-22 2012-09-27 10.1021/jp306885u Effects of Silver Doping on the Geometric and Electronic Structure and Optical Absorption Spectra of the Au25-nAgn(SH)(18)(-) (n=1, 2, 4, 6, 8, 10, 12) Bimetallic Nanoclusters 2012-10-09 10.1103/PhysRevB.86.155115 DFT-based tight-binding modeling of iron-carbon 2012-10-10 10.1103/RevModPhys.84.1419 Maximally localized Wannier functions: Theory and applications 2012-10-15 10.1016/j.cpc.2012.05.007 LIBXC: A library of exchange and correlation functionals for density functional theory 2012-10-15 10.1039/c2ee22341d New cubic perovskites for one- and two-photon water splitting using the computational materials repository 2012-10-18 10.1021/jz301261x Experimental and Theoretical Determination of the Optical Gap of the Au-144(SC2H4Ph)(60) Cluster and the (Au/Ag)(144)(SC2H4Ph)(60) Nanoalloys 2012-10-24 10.1088/0953-8984/24/42/424212 Desorption of n-alkanes from graphene: a van der Waals density functional study 2012-10-24 10.1088/0953-8984/24/42/424215 Rationale for switching to nonlocal functionals in density functional theory 2012-10-24 10.1088/0953-8984/24/42/424219 Nonequilibrium thermodynamics of interacting tunneling transport: variational grand potential, density functional formulation and nature of steady-state forces 2012-11-08 10.1021/jp307608k Global Minima of Protonated Water Clusters (H2O)(20)H+ Revisited 2012-11-15 10.1021/nn3040588 Graphene Coatings: Probing the Limits of the One Atom Thick Protection Layer 2012-11-15 10.1063/1.4765721 Optical and elastic properties of diamond-like carbon with metallic inclusions: A theoretical study 2012-11-15 10.1140/epjd/e2012-30485-5 Density functional theory molecular dynamics study of the Au-25(SR)(18)(-) cluster 2012-11-26 10.1103/PhysRevB.86.195429 TDDFT study of time-dependent and static screening in graphene 2012-12-05 10.1021/ja309619n Au-40(SR)(24) Cluster as a Chiral Dimer of 8-Electron Superatoms: Structure and Optical Properties 2012-12-15 10.1007/s11244-012-9908-x Finite-Size Effects in O and CO Adsorption for the Late Transition Metals 2012-12-15 10.1038/NMAT3454 Singular characteristics and unique chemical bond activation mechanisms of photocatalytic reactions on plasmonic nanostructures 2012-12-15 10.1039/c2ee22721e Oxidative trends of TiO2-hole trapping at anatase and rutile surfaces 2012-12-20 10.1021/jz301806b Thermodynamics of Pore Filling Metal Clusters in Metal Organic Frameworks: Pd in UiO-66 2012-12-20 10.1103/PhysRevB.86.241404 Conventional and acoustic surface plasmons on noble metal surfaces: A time-dependent density functional theory study 2012-12-26 10.1103/PhysRevB.86.245129 Spatially resolved quantum plasmon modes in metallic nano-films from first-principles 2013-01-03 10.1021/jz3018286 Investigation of Catalytic Finite-Size-Effects of Platinum Metal Clusters 2013-01-10 10.1021/jp310667r Electronic Origin of the Surface Reactivity of Transition-Metal-Doped TiO2(110) 2013-01-10 10.1103/PhysRevB.87.045411 Charging properties of gold clusters in different environments 2013-01-15 10.1002/anie.201208443 The Redox Chemistry of Gold with High-Valence Doped Calcium Oxide 2013-01-15 10.1007/s10562-012-0918-x The Oxygen Reduction Reaction on Nitrogen-Doped Graphene 2013-01-15 10.1007/s10562-012-0947-5 CO and CO2 Hydrogenation to Methanol Calculated Using the BEEF-vdW Functional 2013-01-15 10.1039/c3cp51083b pH in atomic scale simulations of electrochemical interfaces 2013-01-15 10.1039/c3cp51295a A DFT study of adsorption of perylene on clean and altered anatase (101) TiO2 2013-01-15 10.1140/epjd/e2012-30537-x Structural and electronic properties of AuIr nanoalloys 2013-01-15 10.2533/chimia.2013.271 Methane Catalytic Combustion on Pd-9/gamma-Al2O3 with Different Degrees of Pd Oxidation 2013-01-30 10.1103/PhysRevB.87.045428 Stratified graphene/noble metal systems for low-loss plasmonics applications 2013-02-07 10.1021/jz3021155 Understanding Trends in the Electrocatalytic Activity of Metals and Enzymes for CO2 Reduction to CO 2013-02-13 10.1103/PhysRevB.87.075111 Random phase approximation applied to solids, molecules, and graphene-metal interfaces: From van der Waals to covalent bonding 2013-02-15 10.1140/epjd/e2012-30486-4 Modeling thiolate-protected gold clusters with density-functional tight-binding 2013-02-25 10.1103/PhysRevB.87.075207 Formation energies of group I and II metal oxides using random phase approximation 2013-03-15 10.1147/JRD.2013.2238371 Argonne applications for the IBM Blue Gene/Q, Mira 2013-03-20 10.1088/0953-8984/25/11/115502 Environmental tight-binding modeling of nickel and cobalt clusters 2013-03-21 10.1021/jp3107809 DFT plus U Study of Polaronic Conduction in Li2O2 and Li2CO3: Implications for Li-Air Batteries 2013-04-15 10.1016/j.carbon.2012.12.008 Binding of atomic oxygen on graphene from small epoxy clusters to a fully oxidized surface 2013-04-15 10.1016/j.jcat.2013.01.009 Guest-host interactions of arenes in H-ZSM-5 and their impact on methanol-to-hydrocarbons deactivation processes 2013-04-25 10.1021/jp400980y 1,3-Diketone Fluids and Their Complexes with Iron 2013-05-07 10.1103/PhysRevB.87.205410 Screened empirical bond-order potentials for Si-C 2013-05-09 10.1021/jp306172k Electrochemical CO2 and CO Reduction on Metal-Functionalized Porphyrin-like Graphene 2013-05-15 10.1021/nl400830u Adsorption and Diffusion of Lithium on Layered Silicon for Li-Ion Storage 2013-05-15 10.1021/nn400780x Controlling Hydrogenation of Graphene on Ir(111) 2013-05-15 10.1140/epjb/e2013-40113-5 Carbon nanotubes as heat dissipaters in microelectronics 2013-05-23 10.1021/jp400287h Polycyclic Aromatic Hydrocarbons: Trends for Bonding Hydrogen 2013-06-06 10.1021/jp4024684 First-Principles Study of Excited State Evolution in a Protected Gold Complex 2013-06-19 10.1103/PhysRevB.87.235312 Acoustic phonon limited mobility in two-dimensional semiconductors: Deformation potential and piezoelectric scattering in monolayer MoS2 from first principles 2013-06-21 10.1063/1.4811455 Optoelectronic properties of single-layer, double-layer, and bulk tin sulfide: A theoretical study 2013-06-21 10.1126/science.1238187 Direct Imaging of Covalent Bond Structure in Single-Molecule Chemical Reactions 2013-06-24 10.1103/PhysRevB.87.235132 Quasiparticle GW calculations for solids, molecules, and two-dimensional materials 2013-06-26 10.1103/PhysRevB.87.235433 Visualizing hybridized quantum plasmons in coupled nanowires: From classical to tunneling regime 2013-07-04 10.1021/jp404240h Interaction between Coronene and Graphite from Temperature-Programmed Desorption and DFT-vdW Calculations: Importance of Entropic Effects and Insights into Graphite Interlayer Binding 2013-07-07 10.1063/1.4812398 Excited-state potential-energy surfaces of metal-adsorbed organic molecules from linear expansion Delta-self-consistent field density-functional theory (Delta SCF-DFT) 2013-07-11 10.1103/PhysRevB.88.035418 Charge localization on a redox-active single-molecule junction and its influence on coherent electron transport 2013-07-11 10.1103/PhysRevLett.111.027601 Layer-Resolved Study of Mg Atom Incorporation at the MgO/Ag(001) Buried Interface 2013-07-15 10.1038/ncomms3121 Direct measurement and modulation of single-molecule coordinative bonding forces in a transition metal complex 2013-07-15 10.7566/JPSJ.82.074709 A Comparative Density-Functional Theory Investigation of Oxygen Adsorption on Stepped Ni Surfaces 3(hkl) x (111) [hkl = (111), (100), (110)]: Role of Terrace Orientation 2013-08-07 10.1063/1.4817001 A variational method for density functional theory calculations on metallic systems with thousands of atoms 2013-08-13 10.1021/cm400541n Lithium Chalcogenidotetrelates: LiChT-Synthesis and Characterization of New Li+ Ion Conducting Li/Sn/Se Compounds 2013-08-15 10.1021/jp400486r Stability of Pt-Modified Cu(111) in the Presence of Oxygen and Its Implication on the Overall Electronic Structure 2013-08-15 10.1021/jp4043045 CO Intercalation of Graphene on Ir(111) in the Millibar Regime 2013-08-20 10.1103/PhysRevLett.111.085503 Interlayer Carbon Bond Formation Induced by Hydrogen Adsorption in Few-Layer Supported Graphene 2013-09-04 10.1021/ja4059074 Protected but Accessible: Oxygen Activation by a Calixarene-Stabilized Undecagold Cluster 2013-09-05 10.1021/jz401553p Gold and Methane: A Noble Combination for Delicate Oxidation 2013-09-11 10.1021/ja405997s Theoretical Investigation of the Activity of Cobalt Oxides for the Electrochemical Oxidation of Water 2013-09-11 10.1088/0953-8984/25/36/365403 Modelling the lattice dynamics in SixGe1-x alloys 2013-09-15 10.1038/ncomms3422 All-thiol-stabilized Ag-44 and Au12Ag32 nanoparticles with single-crystal structures 2013-09-18 10.1103/PhysRevB.88.115131 Beyond the random phase approximation: Improved description of short-range correlation by a renormalized adiabatic local density approximation 2013-10-03 10.1021/jp4003092 (H2O)(20) Water Clusters at Finite Temperatures 2013-10-10 10.1021/jp407494v Electronic Structure and Optical Properties of the Thiolate-Protected Au-28(SMe)(20) Cluster 2013-10-15 10.1007/s10853-013-7448-9 Performance of genetic algorithms in search for water splitting perovskites 2013-10-15 10.1016/j.susc.2013.06.014 Methane oxidation over Pd and Pt studied by DFT and kinetic modeling 2013-10-15 10.1021/ct400520e Real-Space Density Functional Theory on Graphical Processing Units: Computational Approach and Comparison to Gaussian Basis Set Methods 2013-10-17 10.1021/jp404569m Equilibrium Crystal Shape of Ni from First Principles 2013-10-17 10.1103/PhysRevA.88.043202 Hybridization of angular-momentum eigenstates in nonspherical sodium clusters 2013-10-23 10.1103/PhysRevB.88.155128 Plasmons in metallic monolayer and bilayer transition metal dichalcogenides 2013-10-28 10.1063/1.4827078 CO dissociation on iron nanoparticles: Size and geometry effects 2013-10-28 10.1088/1367-2630/15/10/105026 Stability and bandgaps of layered perovskites for one- and two-photon water splitting 2013-11-07 10.1021/jp405670v Improving the Adsorption of Au Atoms and Nanoparticles on Graphite via Li Intercalation 2013-11-14 10.1063/1.4829520 Energy level alignment and quantum conductance of functionalized metal-molecule junctions: Density functional theory versus GW calculations 2013-11-15 10.1002/pssb.201349217 Quantitatively accurate calculations of conductance and thermopower of molecular junctions 2013-11-15 10.1021/nn4046634 Birth of the Localized Surface Plasmon Resonance in Mono layer-Protected Gold Nanoclusters 2013-11-21 10.1063/1.4829539 Self-interaction corrected density functional calculations of molecular Rydberg states 2013-11-28 10.1063/1.4829640 Interfacial oxygen under TiO2 supported Au clusters revealed by a genetic algorithm search 2013-12-05 10.1021/jp409479h The Influence of Functionals on Density Functional Theory Calculations of the Properties of Reducible Transition Metal Oxide Catalysts 2013-12-12 10.1021/jp410379u Competition between Icosahedral Motifs in AgCu, AgNi, and AgCo Nanoalloys: A Combined Atomistic-DFT Study 2013-12-15 10.1016/j.cpc.2013.07.014 Graphics Processing Unit acceleration of the Random Phase Approximation in the projector augmented wave method 2013-12-21 10.1063/1.4840515 A density functional theory study of atomic steps on stoichiometric rutile TiO2(110) 2014-01-01 10.1080/10408436.2013.772503 Error Estimates for Solid-State Density-Functional Theory Predictions: An Overview by Means of the Ground-State Elemental Crystals 2014-01-14 10.1103/PhysRevB.89.035120 Electronic stopping power from first-principles calculations with account for core electron excitations and projectile ionization 2014-01-15 10.1016/j.jcat.2013.10.015 Thermochemistry and micro-kinetic analysis of methanol synthesis on ZnO (0001) 2014-01-15 10.1016/j.susc.2013.09.020 Formation of metastable, heterolytic H-pairs on the RuO2(110) surface 2014-01-15 10.1021/nn406219x Supramolecular Functionalization and Concomitant Enhancement in Properties of Au-25 Clusters 2014-01-15 10.1039/c3cp53922a Interactions of polymers with reduced graphene oxide: van der Waals binding energies of benzene on graphene with defects 2014-01-15 10.1039/c3cp54491e The molecular and magnetic structure of carbon-enclosed and partially covered Fe-55 particles 2014-01-15 10.1039/c3py00853c Soluble and stable alternating main-chain merocyanine copolymers through quantitative spiropyran-merocyanine conversion 2014-01-15 10.1039/c4cp01289e Optimizing porphyrins for dye sensitized solar cells using large-scale ab initio calculations 2014-01-15 10.1039/c4cy00262h Verification of the dual cycle mechanism for methanol-to-olefin conversion in HSAPO-34: a methylbenzene-based cycle from DFT calculations 2014-01-15 10.1039/c4nr01255k Solvation chemistry of water-soluble thiol-protected gold nanocluster Au-102 from DOSY NMR spectroscopy and DFT calculations 2014-01-28 10.1103/PhysRevB.89.014304 Ab initio based thermal property predictions at a low cost: An error analysis 2014-01-31 10.3762/bjnano.5.11 The role of oxygen and water on molybdenum nanoclusters for electro catalytic ammonia production 2014-02-15 10.1007/s11244-013-0160-9 Genetic Algorithm Procreation Operators for Alloy Nanoparticle Catalysts 2014-02-15 10.1007/s11244-013-0173-4 Modeling Methyl Chloride Photo Oxidation by Oxygen Species on TiO2(110) 2014-02-15 10.1007/s11244-013-0181-4 Calculated Pourbaix Diagrams of Cubic Perovskites for Water Splitting: Stability Against Corrosion 2014-02-15 10.1021/nn405114z Revealing the Adsorption Mechanisms of Nitroxides on Ultrapure, Metallicity-Sorted Carbon Nanotubes 2014-02-15 10.1088/0268-1242/29/2/023002 Hard x-ray emission spectroscopy: a powerful tool for the characterization of magnetic semiconductors 2014-02-20 10.1016/j.electacta.2013.12.047 Balance of the interfacial interactions of 4,4 '-bipyridine at Bi(111) surface 2014-02-21 10.1103/PhysRevB.89.085420 Temperature effects on quantum interference in molecular junctions 2014-03-12 10.1103/PhysRevB.89.115412 Density functional theory based calculations of the transfer integral in a redox-active single-molecule junction 2014-03-13 10.1098/rsta.2013.0270 Density functional theory in the solid state 2014-03-15 10.1016/j.jssc.2013.12.006 Ionic conductivity and the formation of cubic CaH2 in the LiBH4-Ca(BH4)(2) composite 2014-03-15 10.1021/ct400931p Configurational Entropy in Ice Nanosystems: Tools for Structure Generation and Screening 2014-03-19 10.1021/ja500809p Chiral Phase Transfer and Enantioenrichment of Thiolate-Protected Au-102 Clusters 2014-03-28 10.1063/1.4869212 Communication: The influence of CO2 poisoning on overvoltages and discharge capacity in non-aqueous Li-Air batteries 2014-04-02 10.1021/ja412141j Single Crystal XRD Structure and Theoretical Analysis of the Chiral Au30S(S-t-Bu)(18) Cluster 2014-04-14 10.1063/1.4870397 mBEEF: An accurate semi-local Bayesian error estimation density functional 2014-04-15 10.1021/cs400875k Remote Activation of Chemical Bonds in Heterogeneous Catalysis 2014-04-15 10.1021/nn500963m Designer Titania-Supported Au-Pd Nanoparticles for Efficient Photocatalytic Hydrogen Production 2014-04-17 10.1021/jz500449k A DFT Study of Linear Gold-Thiolate Superclusters Absorbing in the Therapeutic NIR Window 2014-04-18 10.1371/journal.pone.0095390 Performance Analysis of Electronic Structure Codes on HPC Systems: A Case Study of SIESTA 2014-04-22 10.1021/cm4042007 X-ray Absorption Study of Structural Coupling in Photomagnetic Prussian Blue Analogue Core@Shell Particles 2014-04-28 10.1063/1.4871875 Static correlation beyond the random phase approximation: Dissociating H-2 with the Bethe-Salpeter equation and time-dependent GW 2014-05-01 10.1021/jz500482z Reactivity Descriptor in Solid Acid Catalysis: Predicting Turnover Frequencies for Propene Methylation in Zeotypes 2014-05-07 10.1063/1.4874775 Structural stability and electronic properties of low-index surfaces of SnS 2014-05-15 10.1007/s00339-013-8034-3 Atomistic approach for simulating plasmons in nanostructures 2014-05-15 10.1016/j.jcat.2014.04.006 Methanol-to-hydrocarbons conversion: The alkene methylation pathway 2014-05-15 10.1021/ct500087v Quasiparticle Level Alignment for Photocatalytic Interfaces 2014-05-21 10.1103/PhysRevLett.112.203001 Accurate Ground-State Energies of Solids and Molecules from Time-Dependent Density-Functional Theory 2014-06-12 10.1021/jp5033959 Electronic Structure and Optical Properties of the Intrinsically Chiral 16-Electron Superatom Complex [Au-20(PP3)(4)](4+) 2014-06-15 10.1021/cs500202f Identification of the Catalytic Site at the Interface Perimeter of Au Clusters on Rutile TiO2(110) 2014-06-27 10.1103/PhysRevB.89.245445 Quasiparticle scattering from topological crystalline insulator SnTe (001) surface states 2014-07-15 10.1088/0965-0393/22/5/055007 Designing rules and probabilistic weighting for fast materials discovery in the Perovskite structure 2014-07-24 10.1021/jp501581g Atomic Structure, Electronic Properties, and Reactivity of In-Plane Heterostructures of Graphene and Hexagonal Boron Nitride 2014-07-24 10.1021/jp5035147 Hydrogen-Induced Reconstruction of Cu(100): Two-Dimensional and One-Dimensional Structures of Surface Hydride 2014-07-24 10.1021/jp504709d Effect of Magnetic States on the Reactivity of an FCC(111) Iron Surface 2014-08-01 10.1093/mnras/stu869 Do cement nanoparticles exist in space? 2014-08-06 10.1088/0953-8984/26/31/315013 Dynamical coupling of plasmons and molecular excitations by hybrid quantum/classical calculations: time-domain approach 2014-08-07 10.1021/jp505464z Ultrafast Electronic Relaxation and Vibrational Cooling Dynamics of Au-144(SC2H4Ph)(60) Nanocluster Probed by Transient Mid-IR Spectroscopy 2014-08-11 10.1103/PhysRevB.90.075115 Simultaneous description of conductance and thermopower in single-molecule junctions from many-body ab initio calculations 2014-08-15 10.1016/j.ssc.2014.04.023 MoS2 nanostructures: Semiconductors with metallic edges 2014-08-15 10.1063/1.4893495 Bandgap calculations and trends of organometal halide perovskites 2014-08-21 10.1039/c4dt01329h Chloride-bridged, defect-dicubane {Ln(4)} core clusters: syntheses, crystal structures and magnetic properties 2014-08-28 10.1021/jp503494g Mechanism of Trichloroethene Hydrodehalogenation: A First-Principles Kinetic Monte Carlo Study 2014-08-28 10.1021/jp505462m TDDFT Analysis of Optical Properties of Thiol Monolayer-Protected Gold and Intermetallic Silver-Gold Au-144(SR)(60) and Au84Ag60(SR)(60) Clusters 2014-09-09 10.1103/PhysRevB.90.125413 Quantum interference in off-resonant transport through single molecules 2014-09-11 10.1103/PhysRevLett.113.115501 Silicon-Carbon Bond Inversions Driven by 60-keV Electrons in Graphene 2014-09-15 10.1021/nl502571b Controlling Catalytic Selectivity on Metal Nanoparticles by Direct Photoexcitation of Adsorbate-Metal Bonds 2014-09-18 10.1021/jp501185q Superatomic S-2 Silver Clusters Stabilized by a Thiolate-Phosphine Monolayer: Insight into Electronic and Optical Properties of Ag-14(SC6H3F2)(12)(PPh3)(8) and Ag-16(SC6H3F2)(14)(DPPE)(4) 2014-09-18 10.1021/jp506158c Periodic DFT Study of Benzene Adsorption on Pd(100) and Pd(110) at Medium and Saturation Coverage 2014-09-23 10.1088/1367-2630/16/9/093029 GOLLUM: a next-generation simulation tool for electron, thermal and spin transport 2014-10-15 10.1016/j.susc.2014.05.017 Investigating energetics of Au-8 on graphene/Ru(0001) using a genetic algorithm and density functional theory 2014-10-15 10.1016/j.susc.2014.06.001 Interplay of hydrogen bonding and molecule-substrate interaction in self-assembled adlayer structures of a hydroxyphenyl-substituted porphyrin 2014-10-15 10.1021/nl5029045 High-Conductive Organometallic Molecular Wires with De localized Electron Systems Strongly Coupled to Metal Electrodes 2014-10-21 10.1039/c4cp00753k Segregation effects on the properties of (AuAg)(147) 2014-10-29 10.1103/PhysRevB.90.161410 Plasmons on the edge of MoS2 nanostructures 2014-11-06 10.1021/jp506935a Physical Factors Affecting Charge Transfer at the Pe-COOH-TiO2 Anatase Interface 2014-11-07 10.1063/1.4900628 Thermodynamic aspects of dehydrogenation reactions on noble metal surfaces 2014-11-07 10.1063/1.4900838 Simplified continuum solvent model with a smooth cavity based on volumetric data 2014-11-10 10.1016/j.electacta.2014.09.056 Ti atoms in Ru0.3Ti0.7O2 mixed oxides form active and selective sites for electrochemical chlorine evolution 2014-11-15 10.1016/j.susc.2014.03.021 Walking-like diffusion of two-footed asymmetric aromatic adsorbates on Pt(111) 2014-11-17 10.1002/anie.201406246 Squeezing, Then Stacking: From Breathing Pores to Three-Dimensional Ionic Self-Assembly under Electrochemical Control 2014-11-17 10.1002/anie.201406528 A Surface Coordination Network Based on Copper Adatom Trimers 2014-11-19 10.1021/ja5095099 Active and Selective Conversion of CO2 to CO on Ultrathin Au Nanowires 2014-11-20 10.1021/jp509505j Toward Stronger Al-BN Nanotube Composite Materials: Insights into Bonding at the Al/BN Interface from First-Principles Calculations 2014-11-27 10.1021/jp508557w Dynamics of the Photogenerated Hole at the Rutile TiO2(110)/Water Interface: A Nonadiabatic Simulation Study 2014-12-04 10.1021/jp509510j Atomic-Scale View on the H2O Formation Reaction from H-2 on O-Rich RuO2(110) 2014-12-07 10.1063/1.4902249 Nucleation and growth of Pt nanoparticles on reduced and oxidized rutile TiO2 (110) 2014-12-08 10.1063/1.4903340 Designing pi-stacked molecular structures to control heat transport through molecular junctions 2014-12-11 10.1021/jp506508x Au-36(SPh)(24) Nanomolecules: X-ray Crystal Structure, Optical Spectroscopy, Electrochemistry, and Theoretical Analysis 2014-12-11 10.1021/jp509970y Collective Diffusion of Gold Clusters and F-Centers at MgO(100) and CaO(100) Surfaces 2014-12-15 10.1002/pssb.201451174 Theoretical electron energy loss spectroscopy of isolated graphene 2014-12-15 10.1021/cs5014267 Methanol-Alkene Reactions in Zeotype Acid Catalysts: Insights from a Descriptor-Based Approach and Microkinetic Modeling 2014-12-15 10.1364/OE.22.030725 Effects of exchange correlation functional on optical permittivity of gold and electromagnetic responses 2014-12-18 10.1021/jp505394e Operando Characterization of an Amorphous Molybdenum Sulfide Nanoparticle Catalyst during the Hydrogen Evolution Reaction 2014-12-21 10.1063/1.4902383 Self-interaction corrected density functional calculations of Rydberg states of molecular clusters: N,N-dimethylisopropylamine 2014-12-31 10.1021/ja510335z Electrochemical Control of Single-Molecule Conductance by FermiLevel Tuning and Conjugation Switching 2015-01-13 10.1103/PhysRevB.91.045418 pi-plasmon dispersion in free-standing graphene by momentum-resolved electron energy-loss spectroscopy 2015-01-15 10.1002/cctc.201402756 Enhancing Activity for the Oxygen Evolution Reaction: The Beneficial Interaction of Gold with Manganese and Cobalt Oxides 2015-01-15 10.1016/j.jcat.2014.10.009 Ab initio prediction of the equilibrium shape of supported Ag nanoparticles on alpha-Al2O3(0001) 2015-01-15 10.1016/j.jcp.2014.10.052 Real-time adaptive finite element solution of time-dependent Kohn-Sham equation 2015-01-15 10.1021/cs5015749 Understanding the Early Stages of the Methanol-to-Olefin Conversion on H-SAPO-34 2015-01-15 10.1021/jp508932x Influence of Adsorbed Water on the Oxygen Evolution Reaction on Oxides 2015-01-15 10.1021/n1503518q1 Single-Molecule Electrochemical Transistor Utilizing a Nickel-Pyridyl Spinterface 2015-01-15 10.1039/c4cp02789b A DFT study of the effect of OH groups on the optical, electronic, and structural properties of TiO2 nanoparticles 2015-01-15 10.1039/c4cy01044b Single-chiral-catalytic-surface-sites: STM and DFT study of stereodirecting complexes formed between (R)-1-(1-naphthyl)ethylamine and ketopantolactone on Pt(111) 2015-01-15 10.1103/PhysRevB.91.041112 Unified picture of the doping dependence of superconducting transition temperatures in alkali metal/ammonia intercalated FeSe 2015-01-21 10.1002/aenm.201400915 New Light-Harvesting Materials Using Accurate and Efficient Bandgap Calculations 2015-01-22 10.1021/jp511037x Silver Sulfide Nanoclusters and the Superatom Model 2015-01-22 10.1103/PhysRevB.91.045204 Strain sensitivity of band gaps of Sn-containing semiconductors 2015-01-28 10.1021/ja5109968 A Critical Size for Emergence of Nonbulk Electronic and Geometric Structures in Dodecanethiolate-Protected Au Clusters 2015-02-02 10.1103/PhysRevB.91.081401 Calculation of the graphene C 1s core level binding energy 2015-02-05 10.1021/jz502637b Copper Induces a Core Plasmon in Intermetallic Au(144,145)-xCux(SR)(60) Nanoclusters 2015-02-05 10.1038/srep08276 Real-space Wigner-Seitz Cells Imaging of Potassium on Graphite via Elastic Atomic Manipulation 2015-02-28 10.1063/1.4913290 Interference enhanced thermoelectricity in quinoid type structures 2015-03-03 10.1103/PhysRevB.91.094104 High-pressure neutron scattering of the magnetoelastic Ni-Cr Prussian blue analog 2015-03-07 10.1063/1.4913739 Nanoplasmonics simulations at the basis set limit through completeness-optimized, local numerical basis sets 2015-03-09 10.1103/PhysRevB.91.125410 Density functional theory based direct comparison of coherent tunneling and electron hopping in redox-active single-molecule junctions 2015-03-14 10.1063/1.4906048 Chemical insight from density functional modeling of molecular adsorption: Tracking the bonding and diffusion of anthracene derivatives on Cu(111) with molecular orbitals 2015-03-14 10.1063/1.4908062 Selection of conformational states in self-assembled surface structures formed from an oligo(naphthylene-ethynylene) 3-bit binary switch 2015-03-15 10.1007/s10562-015-1495-6 CatMAP: A Software Package for Descriptor-Based Microkinetic Mapping of Catalytic Trends 2015-03-15 10.1016/j.susc.2014.11.006 Detection of adsorbate overlayer structural transitions using sum-frequency generation spectroscopy 2015-03-15 10.1021/ct501155k Removing External Degrees of Freedom from Transition-State Search Methods using Quaternions 2015-03-15 10.1021/nn506711a Molecule-like Photodynamics of Au-102(pMBA)(44) Nano cluster 2015-03-15 10.1088/2053-1583/2/1/014001 The growth of Fe clusters over graphene/Cu(111) 2015-03-18 10.1002/adfm.201404388 Molecular Heterojunctions of Oligo(phenylene ethynylene)s with Linear to Cruciform Framework 2015-03-26 10.1021/acs.jpca.5b01797 Ultrafast Structural Pathway of Charge Transfer in N,N,N ',N '-Tetramethylethylenediamine 2015-03-28 10.1063/1.4915265 Density functional theory and chromium: Insights from the dimers 2015-04-01 10.1016/j.cplett.2015.02.013 Relationship between unbranched alkane dimer interaction energies using different theoretical methods and correlations with thermodynamic properties 2015-04-02 10.1021/acs.jpcc.5b00734 Isolating a Reaction Intermediate in the Hydrogenation of 2,2,2-Trifluoroacetophenone on Pt(111) 2015-04-05 10.1002/jcc.23834 van der Waals Interactions are Critical in Car-Parrinello Molecular Dynamics Simulations of Porphyrin-Fullerene Dyads 2015-04-08 10.1002/aenm.201401082 Design Principles for Metal Oxide Redox Materials for Solar-Driven Isothermal Fuel Production 2015-04-15 10.1515/ntrev-2012-0047 On the interaction between gold and silver metal atoms and DNA/RNA nucleobases - a comprehensive computational study of ground state properties 2015-04-24 10.1103/PhysRevB.91.165309 Band-gap engineering of functional perovskites through quantum confinement and tunneling 2015-04-30 10.1021/acs.jpcc.5b01068 The Role of the Anchor Atom in the Ligand of the Monolayer-Protected Au-25(XR)(18)(-) Nanocluster 2015-05-08 10.1088/0953-8984/27/17/175007 The effect of point defects on diffusion pathway within alpha-Fe 2015-05-13 10.1088/0953-8984/27/18/183202 Subsystem density-functional theory as an effective tool for modeling ground and excited states, their dynamics and many-body interactions 2015-05-14 10.1021/acs.jpcc.5b01580 Improved Tight-Binding Charge Transfer Model and Calculations of Energetics of a Step on the Rutile TiO2(110) Surface 2015-05-15 10.1021/cs501673g A Consistent Reaction Scheme for the Selective Catalytic Reduction of Nitrogen Oxides with Ammonia 2015-05-21 10.1021/jp510926q Theoretical Analysis of the M12Ag32(SR)(40)(4-) and X@M12Ag32(SR)(30)(4-) Nanoclusters (M = Au, Ag; X = H, Mn) 2015-06-06 10.1098/rsfs.2014.0084 Rational design of metal nitride redox materials for solar-driven ammonia synthesis 2015-06-08 10.1002/cssc.201500239 Design Principles of Perovskites for Thermochemical Oxygen Separation 2015-06-15 10.1002/anie.201410974 Ketene as a Reaction Intermediate in the Carbonylation of Dimethyl Ether to Methyl Acetate over Mordenite 2015-06-20 10.1016/j.electacta.2015.04.006 First principles study of (Cd, Hg, In, Tl, Sn, Pb, As, Sb, Bi, Se) modified Pt (111), Pt(100) and Pt(211) electrodes as CO oxidation catalysts 2015-06-24 10.1021/cr500551h Quantum-Chemical Characterization of the Properties and Reactivities of Metal-Organic Frameworks 2015-06-25 10.1021/acs.jpcc.5b04106 From Chemistry to Functionality: Trends for the Length Dependence of the Thermopower in Molecular Junctions 2015-07-01 10.1016/j.comptc.2015.03.026 Hydrogen oxidation reaction on Pd(111) electrode in alkaline media: Ab-initio DFT study of OH effects 2015-07-02 10.1021/acs.jpclett.5b01045 Impact of Ga-V Codoping on Interfacial Electron Transfer in Dye-Sensitized TiO2 2015-07-14 10.1021/acs.chemmater.5b00446 Accelerated DFT-Based Design of Materials for Ammonia Storage 2015-07-15 10.1002/ente.201500065 Carbon Dioxide Reforming of Methane using an Isothermal Redox Membrane Reactor 2015-07-15 10.1021/acs.nanolett.5b01251 Dielectric Genome of van der Waals Heterostructures 2015-07-15 10.1021/acscatal.5b00754 Tailoring Gold Nanoparticle Characteristics and the Impact on Aqueous-Phase Oxidation of Glycerol 2015-07-15 10.1021/cs501542n Mechanistic Pathway in the Electrochemical Reduction of CO2 on RuO2 2015-07-15 10.1595/205651315X687975 Atomic-Scale Modelling and its Application to Catalytic Materials Science Developing an interdisciplinary approach to modelling 2015-07-16 10.1021/acs.jpclett.5b01043 Electrochemical Barriers Made Simple 2015-07-30 10.1021/acs.jpcc.5b04977 Self-Metalation of Phthalocyanine Molecules with Silver Surface Atoms by Adsorption on Ag(110) 2015-08-05 10.1088/1367-2630/17/8/083006 Calculations of Al dopant in alpha-quartz using a variational implementation of the Perdew-Zunger self-interaction correction 2015-08-11 10.1103/PhysRevB.92.081109 Influence of molecular conformations on the electronic structure of organic charge transfer salts 2015-08-13 10.1021/acs.jpcc.5b04432 Role of Li2O2@Li2CO3 Interfaces on Charge Transport in Nonaqueous Li-Air Batteries 2015-08-15 10.1021/acs.nanolett.5b02188 Electric-Field Control of Interfering Transport Pathways in a Single-Molecule Anthraquinone Transistor 2015-08-20 10.1021/acs.jpcc.5b04985 Real-Time Study of CVD Growth of Silicon Oxide on Rutile TiO2(110) Using Tetraethyl Orthosilicate 2015-08-20 10.1021/acs.jpcc.5b05894 Optical Properties of Monolayer-Protected Aluminum Clusters: Time-Dependent Density Functional Theory Study 2015-08-21 10.1063/1.4928646 Indication of non-thermal contribution to visible femtosecond laser-induced CO oxidation on Ru(0001) 2015-08-26 10.1038/srep13382 Edge state magnetism in zigzag-interfaced graphene via spin susceptibility measurements 2015-08-27 10.1021/acs.jpcc.5b05392 Using G(0)W(0) Level Alignment to Identify Catechol's Structure on TiO2(110) 2015-08-27 10.1021/acs.jpcc.5b05580 Tuning the Schottky Barrier at the Graphene/MoS2 Interface by Electron Doping: Density Functional Theory and Many-Body Calculations 2015-08-27 10.1021/acs.jpcc.5b07622 Photodynamics of a Molecular Water-Soluble Nanocluster Identified as Au-130(pMBA)(50) 2015-09-05 10.1002/qua.24945 Unoccupied titanium 3d states due to subcluster formation in stoichiometric TiO2 nanoparticles 2015-09-10 10.1021/acs.jpcc.5b05824 Superatom Model for Ag-S Nanocluster with Delocalized Electrons 2015-09-14 10.1063/1.4919236 Adiabatic-connection fluctuation-dissipation DFT for the structural properties of solids-The renormalized ALDA and electron gas kernels 2015-09-15 10.1016/j.ccr.2015.05.002 The role of density functional theory methods in the prediction of nanostructured gas-adsorbent materials 2015-09-15 10.1016/j.molcata.2015.04.016 Identifying the active sites for CO dissociation on Fe-BCC nanoclusters 2015-09-15 10.1021/acsnano.5b03199 In Situ Detection of Active Edge Sites in Single-Layer MoS2 Catalysts 2015-09-20 10.1016/j.electacta.2015.01.136 Theoretical modeling of the PEMFC catalyst layer: A review of atomistic methods 2015-09-21 10.1103/PhysRevB.92.115140 Improved description of metal oxide stability: Beyond the random phase approximation with renormalized kernels 2015-10-01 10.1021/acs.jpclett.5b01746 Surface Tension Effects on the Reactivity of Metal Nanoparticles 2015-10-15 10.1016/j.susc.2015.03.011 Optical laser-induced CO desorption from Ru(0001) monitored with a free-electron X-ray laser: DFT prediction and X-ray confirmation of a precursor state 2015-10-15 10.1016/j.susc.2015.04.013 Dissociative adsorption of water on Au/MgO/Ag(001) from first principles calculations 2015-10-15 10.1021/acs.jpcc.5b06132 Coexistence of Square Pyramidal Structures of Oxo Vanadium (+5) and (+4) Species Over Low-Coverage VOX/TiO2 (101) and (001) Anatase Catalysts 2015-10-15 10.1021/acs.jpclett.5b01864 The Role of Hydrogen Bonds in the Stabilization of Silver-Mediated Cytosine Tetramers 2015-10-20 10.1016/j.electacta.2015.08.003 Adsorption of 4,4 '-bipyridine on the Cd(0001) single crystal electrode surface 2015-11-18 10.1002/aenm.201500991 Toward an Active and Stable Catalyst for Oxygen Evolution in Acidic Media: Ti-Stabilized MnO2 2015-11-20 10.1103/PhysRevB.92.201205 Anharmonic stabilization and band gap renormalization in the perovskite CsSnI3 2015-11-23 10.1002/anie.201506026 Controlling Electrical Conductance through a pi-Conjugated Cruciform Molecule by Selective Anchoring to Gold Electrodes 2015-12-01 10.1103/PhysRevLett.115.236804 Quantized Evolution of the Plasmonic Response in a Stretched Nanorod 2015-12-03 10.1021/acs.jpcc.5b10407 Illusory Connection between Cross-Conjugation and Quantum Interference 2015-12-07 10.1063/1.4936409 Electron transport in molecular junctions with graphene as protecting layer 2015-12-15 10.1016/j.jallcom.2015.08.241 First-principles modelling of solid Ni-Rh (nickel-rhodium) alloys 2015-12-15 10.1016/j.ultramic.2015.07.011 Surface effects on mean inner potentials studied using density functional theory 2015-12-15 10.1021/acsnano.5b02850 Dynamic Diglyme-Mediated Self-Assembly of Gold Nanoclusters 2015-12-16 10.1088/0953-8984/27/49/495501 Exploiting the locality of periodic subsystem density-functional theory: efficient sampling of the Brillouin zone 2015-12-17 10.1103/PhysRevB.92.245123 Excitons in van der Waals heterostructures: The important role of dielectric screening 2015-12-24 10.1021/acs.jpcc.5b10182 Charge Transfer at the Hybrid Interfaces in the Presence of Water: A Theoretical Study 2016-01-13 10.1021/jacs.5b09401 Intercluster Reactions between Au-25(SR)(18) and Ag-44(SR)(30) 2016-01-15 10.1016/j.carbon.2015.09.062 Planar versus three-dimensional growth of metal nanostructures at graphene 2016-01-15 10.1016/j.cpc.2015.09.010 An object oriented Python interface for atomistic simulations 2016-01-15 10.1038/ncomms10401 Conformation and dynamics of the ligand shell of a water-soluble Au-102 nanoparticle 2016-01-15 10.1038/ncomms10545 Evidence and implications of direct charge excitation as the dominant mechanism in plasmon-mediated photocatalysis 2016-01-15 10.1039/c5cy01839k Gold assisted oxygen dissociation on a molybdenum-doped CaO(001) surface 2016-01-15 10.1039/c5dt03141a Magnetic structures of the low temperature phase of Mn-3(VO4)(2) - towards understanding magnetic ordering between adjacent Kagome layers 2016-01-15 10.1039/c5fd00203f Effects of particle size and edge structure on the electronic structure, spectroscopic features, and chemical properties of Au(111)-supported MoS2 nanoparticles 2016-01-15 10.1039/c5nr08122j Tuning Ag-29 nanocluster light emission from red to blue with one and two-photon excitation 2016-01-15 10.1039/c5nr08671j Tunable charge transfer properties in metal-phthalocyanine heterojunctions 2016-01-15 10.1039/c5sc03042k Charge transfer and ultrafast nuclear motions: the complex structural dynamics of an electronically excited triamine 2016-01-15 10.1039/c6cp04194a Decoupling strain and ligand effects in ternary nanoparticles for improved ORR electrocatalysis 2016-01-15 10.1039/c6nr00931j Isolation of atomically precise mixed ligand shell PdAu24 clusters 2016-01-15 10.1039/c6nr05267c Covalently linked multimers of gold nanoclusters Au-102(p-MBA)(44) and Au-similar to 250(p-MBA)(n) 2016-01-15 10.1039/c6ra21668d Ab initio calculation of halide ligand passivation on PbSe quantum dot facets 2016-01-19 10.1016/j.ssc.2015.11.017 Strain engineering of electronic properties of transition metal dichalcogenide monolayers 2016-01-19 10.1103/PhysRevB.93.041302 Transformation of metallic boron into substitutional dopants in graphene on 6H-SiC(0001) 2016-01-25 10.1103/PhysRevB.93.035133 Hubbard-U corrected Hamiltonians for non-self-consistent random-phase approximation total-energy calculations: A study of ZnS, TiO2, and NiO 2016-01-26 10.1002/anie.201507631 First Principles Calculations for Hydrogenation of Acrolein on Pd and Pt: Chemoselectivity Depends on Steric Effects on the Surface 2016-01-28 10.1021/acs.jpcc.5b10025 Photoinduced Absorption within Single-Walled Carbon Nanotube Systems 2016-02-02 10.1103/PhysRevLett.116.056401 Simple Screened Hydrogen Model of Excitons in Two-Dimensional Materials 2016-02-09 10.1088/0957-4484/27/7/075501 B-40 fullerene as a highly sensitive molecular device for NH3 detection at low bias: a first-principles study 2016-02-10 10.1016/j.electacta.2016.01.070 Targeted design of alpha-MnO2 based catalysts for oxygen reduction 2016-02-14 10.1039/c5cp06969f The electrooxidation-induced structural changes of gold di-superatomic molecules: Au-23 vs. Au-25 2016-02-15 10.1007/s11082-015-0370-4 A model for terahertz plasmons in graphene 2016-02-15 10.1016/j.jcp.2015.12.014 RESCU: A real space electronic structure method 2016-02-15 10.1021/acscatal.5b02369 Catalytic Activities of Sulfur Atoms in Amorphous Molybdenum Sulfide for the Electrochemical Hydrogen Evolution Reaction 2016-02-15 10.1038/NNANO.2015.255 Field-induced conductance switching by charge-state alternation in organometallic single-molecule junctions 2016-02-24 10.1103/PhysRevB.93.085135 Self-consistent parametrization of DFT plus U framework using linear response approach: Application to evaluation of redox potentials of battery cathodes 2016-02-25 10.1021/acs.jpcc.5b11489 Comparative Ab-Initio Study of Substituted Norbornadiene-Quadricyclane Compounds for Solar Thermal Storage 2016-02-26 10.1038/srep21990 Unravelling Site-Specific Photo-Reactions of Ethanol on Rutile TiO2(110) 2016-02-28 10.1063/1.4942665 Structure and role of metal clusters in a metal-organic coordination network determined by density functional theory 2016-03-03 10.1080/10408436.2015.1053603 Understanding the Growth of Interfacial Reaction Product Layers between Dissimilar Materials 2016-03-15 10.1016/j.carbon.2015.10.098 Activation and mechanochemical breaking of C-C bonds initiate wear of diamond (110) surfaces in contact with silica 2016-03-15 10.1016/j.commatsci.2015.12.012 Plasmonic and dielectric properties of ideal graphene 2016-03-15 10.1021/acs.jctc.5b01053 A Unified AMBER-Compatible Molecular Mechanics Force Field for Thiolate-Protected Gold Nanoclusters 2016-03-15 10.1038/ncomms11013 Charge localization in a diamine cation provides a test of energy functionals and self-interaction correction 2016-03-31 10.1021/acs.jpcc.5b11211 When Conductance Is Less than the Sum of Its Parts: Exploring Interference in Multiconnected Molecules 2016-03-31 10.1021/acs.jpcc.5b12611 Theoretical Insight into the Internal Quantum Efficiencies of Polymer/C-60 and Polymer/SWNT Photovoltaic Devices 2016-04-07 10.1021/acs.jpcc.5b11696 Structural Changes in RuO2 during Electrochemical Hydrogen Evolution 2016-04-14 10.1557/jmr.2016.99 Perturbation theory for weakly coupled two-dimensional layers 2016-04-15 10.1002/ejic.201501270 The Stability of Copper Oxo Species in Zeolite Frameworks 2016-04-15 10.1002/qua.25106 Update to ACE-molecule: Projector augmented wave method on lagrange-sinc basis set 2016-04-15 10.1016/j.jcp.2016.01.034 Development of an exchange-correlation functional with uncertainty quantification capabilities for density functional theory 2016-04-15 10.1016/j.susc.2015.11.018 A comparative study of diastereomeric complexes formed by a prochiral substrate and three structurally analogous chiral molecules on Pt(111) 2016-04-15 10.1021/acs.nanolett.5b04513 Defect-Tolerant Monolayer Transition Metal Dichalcogenides 2016-04-15 10.1038/NCHEM.2454 Effects of correlated parameters and uncertainty in electronic-structure-based chemical kinetic modelling 2016-04-21 10.1021/acs.jpcc.6b02342 Correlation between sp(3)-to-sp(2) Ratio and Surface Oxygen Functionalities in Tetrahedral Amorphous Carbon (ta-C) Thin Film Electrodes and Implications of Their Electrochemical Properties 2016-04-27 10.1002/adma.201504650 Evidence of Porphyrin-Like Structures in Natural Melanin Pigments Using Electrochemical Fingerprinting 2016-04-27 10.1088/0022-3727/49/16/165303 Effect of interface geometry on electron tunnelling in Al/Al2O3/Al junctions 2016-04-27 10.1103/PhysRevB.93.165437 Band-gap engineering by Bi intercalation of graphene on Ir(111) 2016-04-28 10.1021/acs.jpcc.6b01710 Stability and Polaronic Motion of Self-Trapped Holes in Silver Halides: Insight through DFT plus U Calculations 2016-04-28 10.1039/c5cp07624b The structure-function relationship for alumina supported platinum during the formation of ammonia from nitrogen oxide and hydrogen in the presence of oxygen 2016-04-28 10.1063/1.4947225 Pyridine adsorption and diffusion on Pt(111) investigated with density functional theory 2016-05-17 10.1038/srep25988 Prospect of quantum anomalous Hall and quantum spin Hall effect in doped kagome lattice Mott insulators 2016-05-21 10.1063/1.4950828 An approach to develop chemical intuition for atomistic electron transport calculations using basis set rotations 2016-05-28 10.1063/1.4951686 Ab initio electronic structure of quasi-two-dimensional materials: A 'native' Gaussian-plane wave approach 2016-06-02 10.1021/acs.jpclett.6b00742 Self-Interaction Corrected Functional Calculations of a Dipole-Bound Molecular Anion 2016-06-02 10.1103/PhysRevB.93.241401 Effective gating and tunable magnetic proximity effects in two-dimensional heterostructures 2016-06-30 10.1103/PhysRevB.93.235162 mBEEF-vdW: Robust fitting of error estimation density functionals 2016-07-01 10.1103/PhysRevB.94.041401 Stark shift and electric-field-induced dissociation of excitons in monolayer MoS2 and hBN/MoS2 heterostructures 2016-07-07 10.1039/c6cp02274j The reaction mechanism for the SCR process on monomer V5+ sites and the effect of modified Bronsted acidity 2016-07-21 10.1021/acs.jpcc.6b04769 Toward a Janus Cluster: Regiospecific Decarboxylation of Ag-44(4-MBA)(30)@Ag Nanoparticles 2016-07-25 10.1088/1367-2630/18/7/073043 Exciton ionization in multilayer transition-metal dichalcogenides 2016-07-25 10.1103/PhysRevB.94.041112 Offset-corrected Delta-Kohn-Sham scheme for semiempirical prediction of absolute x-ray photoelectron energies in molecules and solids 2016-08-09 10.1371/journal.pone.0159168 Involving High School Students in Computational Physics University Research: Theory Calculations of Toluene Adsorbed on Graphene 2016-08-15 10.1016/j.enconman.2016.05.069 Computational study on oxynitride perovskites for CO2 photoreduction 2016-08-15 10.1021/acs.jctc.6b00456 Minimal Basis Iterative Stockholder: Atoms in Molecules for Force-Field Development 2016-08-16 10.1103/PhysRevB.94.064105 Quantification of uncertainty in first-principles predicted mechanical properties of solids: Application to solid ion conductors 2016-08-18 10.1021/acs.jpcc.6b06163 Disentangling Vacancy Oxidation on Metallicity-Sorted Carbon Nanotubes 2016-08-23 10.1021/acs.chemmater.6b01956 Thermodynamic Insight in the High-Pressure Behavior of UiO-66: Effect of Linker Defects and Linker Expansion 2016-09-05 10.1002/anie.201604269 Controlling the Adsorption of Carbon Monoxide on Platinum Clusters by Dopant-Induced Electronic Structure Modification 2016-09-07 10.1063/1.4961868 An automated nudged elastic band method 2016-09-15 10.1016/j.jmgm.2016.07.008 Open source molecular modeling 2016-09-15 10.1021/acs.jpclett.6b01543 Chemical Bond Activation Observed with an X-ray Laser 2016-09-15 10.1038/ncomms12809 Plasmonic twinned silver nanoparticles with molecular precision 2016-09-19 10.1002/anie.201605559 Charge Transport and Conductance Switching of Redox-Active Azulene Derivatives 2016-09-20 10.1103/PhysRevB.94.125136 Reduction of magnetic interlayer coupling in barlowite through isoelectronic substitution 2016-09-22 10.1021/acs.jpcc.6b02126 Surface Chemistry Controls Magnetism in Cobalt Nanoclusters 2016-09-28 10.1039/c6cp05188j Strong 1D localization and highly anisotropic electron-hole masses in heavy-halogen functionalized graphenes 2016-09-28 10.1063/1.4963338 Molecular spin on surface: From strong correlation to dispersion interactions 2016-09-29 10.1021/acs.jpcc.6b06141 Atomic Layer Deposition of Zinc Oxide: Diethyl Zinc Reactions and Surface Saturation from First-Principles 2016-09-29 10.1021/acs.jpcc.6b06254 Gold/lsophorone Interaction Driven by Keto/Enol Tautomerization 2016-09-29 10.1103/PhysRevB.94.125444 Band-gap control in phosphorene/BN structures from first-principles calculations 2016-10-05 10.1002/qua.25193 Improvement of initial guess via grid-cutting for efficient grid-based density functional calculations 2016-10-06 10.1103/PhysRevB.94.155406 Efficient many-body calculations for two-dimensional materials using exact limits for the screened potential: Band gaps of MoS2, h-BN, and phosphorene 2016-10-10 10.1038/ncomms13040 Isotope analysis in the transmission electron microscope 2016-10-13 10.1021/acs.jpcc.6b07283 Atomically Thin Ordered Alloys of Transition Metal Dichalcogenides: Stability and Band Structures 2016-10-15 10.1016/j.cpc.2016.05.010 Amp: A modular approach to machine learning in atomistic simulations 2016-10-15 10.1016/j.jcat.2016.07.014 Comparison of mechanistic understanding and experiments for CO methanation over nickel 2016-10-15 10.1088/0953-8984/28/39/393001 Applications of large-scale density functional theory in biology 2016-10-15 10.15199/62.2016.10.11 Role of support in industrial catalytic processes. Theoretical modeling 2016-10-18 10.1103/PhysRevB.94.155309 Ab initio density functional theory study on the atomic and electronic structure of GaP/Si(001) heterointerfaces 2016-10-21 10.1063/1.4964671 Accelerating the search for global minima on potential energy surfaces using machine learning 2016-11-01 10.1016/j.jphotochem.2016.08.007 Does organic/organic interface mimic band bending by deforming structure? 2016-11-03 10.1021/acs.jpclett.6b01998 Band Gap Tuning and Defect Tolerance of Atomically Thin Two-Dimensional Organic-Inorganic Halide Perovskites 2016-11-07 10.1063/1.4966259 The influence of coronene super-hydrogenation on the coronene-graphite interaction 2016-11-09 10.1021/jacs.6b09007 [Ag-67(SPhMe2)(32)(PPh3)(8)](3+): Synthesis, Total Structure, and Optical Properties of a Large Box-Shaped Silver Nanocluster 2016-11-09 10.1103/RevModPhys.88.045004 Time-dependent density-functional description of nuclear dynamics 2016-11-10 10.1021/acs.jpcc.6b06638 A DFT Structural Investigation of New Bimetallic PtSnx Surface Alloys Formed on the Pt(110) Surface and Their Interaction with Carbon Monoxide 2016-11-10 10.1038/ncomms13447 Structure-conserving spontaneous transformations between nanoparticles 2016-11-15 10.1016/j.cpc.2016.06.012 A wavelet-based Projector Augmented-Wave (PAW) method: Reaching frozen-core all-electron precision with a systematic, adaptive and localized wavelet basis set 2016-11-15 10.1016/j.jcat.2016.03.016 Mechanism of CO2 reduction by H-2 on Ru(0001) and general selectivity descriptors for late-transition metal catalysts 2016-11-15 10.1021/acs.jctc.6b00815 Implementation of Constrained DFT for Computing Charge Transfer Rates within the Projector Augmented Wave Method 2016-11-15 10.1021/acscatal.6b01848 Operando Raman Spectroscopy of Amorphous Molybdenum Sulfide (MoSx) during the Electrochemical Hydrogen Evolution Reaction: Identification of Sulfur Atoms as Catalytically Active Sites for H+ Reduction 2016-11-21 10.1039/c6cp04575h Investigating the coverage dependent behaviour of CO on Gd/Pt(111) 2017-03-15 10.1016/j.jallcom.2016.12.116 Influence of titanium doping on the Raman spectra of nanocrystalline ZnAl2O4 2017-03-16 10.1021/acs.jpclett.6b03014 Stabilization of the Perovskite Phase of Formamidinium Lead Triiodide by Methylammonium, Cs, and/or Rb Doping 2017-03-22 10.1021/acsami.6b12261 First-Principles Study of the Band Diagrams and Schottky-Type Barrier Heights of Aqueous Ta3N5 Interfaces 2017-03-23 10.1021/acs.jpcc.6b09289 Synergetic Surface Sensitivity of Photoelectrochemical Water Oxidation on TiO2 (Anatase) Electrodes 2017-03-29 10.1021/jacs.7b01081 Quantitative and Atomic-Scale View of CO-Induced Pt Nanoparticle Surface Reconstruction at Saturation Coverage via DFT Calculations Coupled with in Situ TEM and IR 2017-04-06 10.1021/acs.jpcc.7b02005 A Strategy to Suppress Phonon Transport in Molecular Junctions Using pi-Stacked Systems 2017-04-10 10.1002/cssc.201601869 High Redox Capacity of Al-Doped La1-xSrxMnO3- Perovskites for Splitting CO2 and H2O at Mn-Enriched Surfaces 2017-04-11 10.1038/s41699-017-0003-9 Probing the local nature of excitons and plasmons in few-layer MoS2 2017-04-14 10.1039/c6cp06965g Facile embedding of single vanadium atoms at the anatase TiO2(101) surface 2017-04-15 10.1016/j.commatsci.2017.01.031 Growth of two-dimensional Au patches in graphene pores: A density-functional study 2017-04-20 10.1021/acs.jpcc.7b00283 Effects of Aromaticity and Connectivity on the Conductance of Five-Membered Rings 2017-04-20 10.1103/PhysRevB.95.165130 Real-space and plane-wave hybrid method for electronic structure calculations for two-dimensional materials 2017-04-24 10.1038/ncomms15133 Band structure engineered layered metals for low-loss plasmonics 2017-05-01 10.1016/j.cattod.2017.02.004 Screening the bulk properties and reducibility of Fe-doped Mn2O3 from first principles calculations 2017-05-09 10.1002/cssc.201601632 Determination of Conduction and Valence Band Electronic Structure of LaTiOxNy Thin Film 2017-05-15 10.1007/s11244-016-0701-0 Understanding Structure and Stability of Monoclinic Zirconia Surfaces from First-Principles Calculations 2017-05-15 10.1016/j.cattod.2016.09.023 Computational screening of perovskite redox materials for solar thermochemical ammonia synthesis from N-2 and H2O 2017-05-15 10.1016/j.cplett.2017.02.018 Catalysis in real time using X-ray lasers 2017-05-21 10.1063/1.4983697 Single-molecule spin orientation control by an electric field 2017-05-25 10.1021/acs.jpcc.6b12004 Isophorone on Au/MgO/Ag(001): Physisorption with Electrostatic Site Selection 2017-06-01 10.1002/anie.201701135 Reversible Supracolloidal Self-Assembly of Cobalt Nanoparticles to Hollow Capsids and Their Superstructures 2017-06-07 10.1039/c7cp01440f Stability, electronic structure, and optical properties of protected gold-doped silver Ag29-xAux (x=0-5) nanoclusters 2017-06-08 10.1021/acs.jpcc.7b01819 Comparative Analysis of the Electronic Structure and Nonlinear Optical Susceptibility of alpha-TeO2 and beta-TeO3 Crystals 2017-06-15 10.1016/j.cattod.2017.02.028 Single site porphyrine-like structures advantages over metals for selective electrochemical CO2 reduction 2017-06-15 10.1016/j.micromeso.2017.02.065 Distribution of open sites in Sn-Beta zeolite 2017-06-15 10.1021/acsnano.7b01912 Manifestation of Geometric and Electronic Shell Structures of Metal Clusters in Intercluster Reactions 2017-06-15 10.1038/NCHEM.2753 Monitoring interconversion between stereochemical states in single chirality-transfer complexes on a platinum surface 2017-06-15 10.1088/2053-1583/aa6531 Band structure engineering in van der Waals heterostructures via dielectric screening: the G Delta W method 2017-06-15 10.1126/sciadv.1700176 Buckyball sandwiches 2017-06-28 10.3389/fninf.2017.00040 The NEST Dry-Run Mode: Efficient Dynamic Analysis of Neuronal Network Simulation Code 2017-06-29 10.1021/acs.jpcc.7b05270 Two-Dimensional MXenes as Catalysts for Electrochemical Hydrogen Evolution: A Computational Screening Study 2017-06-30 10.1038/s41598-017-04683-9 Computational insights and the observation of SiC nanograin assembly: towards 2D silicon carbide 2017-07-01 10.1016/j.camwa.2016.12.003 Multi-domain muffin tin finite element density functional calculations for small molecules 2017-07-12 10.1088/1361-648X/aa680e The atomic simulation environment-a Python library for working with atoms 2017-07-15 10.1021/acs.nanolett.7b01592 The Role of Through-Space Interactions in Modulating Constructive and Destructive Interference Effects in Benzene 2017-07-17 10.1103/PhysRevB.96.045419 Adsorption sites of individual metal atoms on ultrathin MgO(100) films 2017-07-18 10.1103/PhysRevB.96.035422 Anisotropic plasmons, excitons, and electron energy loss spectroscopy of phosphorene 2017-07-20 10.1021/acs.jpcc.7b02608 Defect Chemistry and Electrical Conductivity of Sm-Doped La1-xSrxCoO3-delta for Solid Oxide Fuel Cells 2017-08-01 10.1038/s41598-017-07456-6 Excitation-dependent fluorescence from atomic/molecular layer deposited sodium-uracil thin films 2017-08-07 10.1039/c7ta02081c Design principles of perovskites for solar-driven thermochemical splitting of CO2 2017-08-14 10.1088/1361-6455/aa7d2c Spectroscopic signatures of triplet states in acenes 2017-08-15 10.1103/PhysRevB.96.085421 Quantum interference in coherent tunneling through branched molecular junctions containing ferrocene centers 2017-08-17 10.1021/acs.jpclett.7b01549 Real-Time Elucidation of Catalytic Pathways in CO Hydrogenation on Ru 2017-08-21 10.1038/s41467-017-00385-y Visualizing atomic-scale redox dynamics in vanadium oxide-based catalysts 2017-08-22 10.1038/s41467-017-00412-y Layered van der Waals crystals with hyperbolic light dispersion 2017-09-01 10.1088/1361-651X/aa7320 libvdwxc: a library for exchange-correlation functionals in the vdW-DF family 2017-09-15 10.1002/sia.6238 Unsaturated surface in CO saturation 2017-09-15 10.1016/j.susc.2017.05.007 Initial stages of Lutetium growth on Si (111)-7 x 7 probed by STM and core-level photoelectron spectroscopy 2017-10-15 10.1016/j.jcis.2017.06.017 Investigation of anti-solvent induced optical properties change of cesium lead bromide iodide mixed perovskite (CsPbBr3-xIx) quantum dots gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/gw_theory/000077500000000000000000000000001316441372200255515ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/gw_theory/gw_theory.rst000066400000000000000000000233561316441372200303230ustar00rootroot00000000000000.. _gw_theory: ======================================================= Quasi-particle spectrum in the GW approximation: theory ======================================================= The foundations of the GW method are described in Refs. \ [#Hedin1965]_ and \ [#Hybertsen1986]_. The implementation in GPAW is documented in Ref. \ [#Hueser2013]_. For examples, see :ref:`gw tutorial`. Introduction ============ Quasi-particle energies are obtained by replacing the DFT exchange- correlation contributions by the GW self energy and exact exchange: .. math:: E_{n \mathbf{k}} = \epsilon_{n \mathbf{k}} + Z_{n \mathbf{k}} \cdot \text{Re} \left(\Sigma_{n \mathbf{k}}^{\vphantom{\text{XC}}} + \epsilon^{\text{EXX}}_{n \mathbf{k}} - V^{\text{XC}}_{n \mathbf{k}} \right) where `n` and `\mathbf{k}` are band and k-point indices, respectively. The different contributions are: `\epsilon_{n \mathbf{k}}`: Kohn-Sham eigenvalues taken from a groundstate calculation `V^{\text{XC}}_{n \mathbf{k}}`: DFT exchange-correlation contributions extracted from a groundstate calculation `\epsilon^{\text{EXX}}_{n \mathbf{k}}`: exact exchange contributions The renormalization factor is given by: .. math:: Z_{n \mathbf{k}} = \left(1 - \text{Re}\left< n \mathbf{k}\middle| \frac{\partial}{\partial\omega} \Sigma(\omega)_{|\omega = \epsilon_{n \mathbf{k}}}\middle| n \mathbf{k}\right>\right)^{-1} `\left| n \mathbf{k} \right>` denotes the Kohn-Sham wavefunction which is taken from the groundstate calculation. The self energy is expanded in plane waves, denoted by `\mathbf{G}` and `\mathbf{G}'`: .. math:: \Sigma_{n \mathbf{k}}(\omega = \epsilon_{n \mathbf{k}}) =& \left\\ =& \frac{1}{\Omega} \sum\limits_{\mathbf{G} \mathbf{G}'} \sum\limits_{\vphantom{\mathbf{G}}\mathbf{q}}^{1. \text{BZ}} \sum\limits_{\vphantom{\mathbf{G}}m}^{\text{all}} \frac{i}{2 \pi} \int\limits_{-\infty}^\infty\!d\omega'\, W_{\mathbf{G} \mathbf{G}'}(\mathbf{q}, \omega') \, \cdot \\ & \frac{\rho^{n \mathbf{k}}_{m \mathbf{k} - \mathbf{q}}(\mathbf{G}) \rho^{n \mathbf{k}*}_{m \mathbf{k} - \mathbf{q}}(\mathbf{G}')}{\omega + \omega' - \epsilon_{m \, \mathbf{k} - \mathbf{q}} + i \eta \, \text{sgn}(\epsilon_{m \, \mathbf{k} - \mathbf{q}} - \mu)} where `m` runs both over occupied and unoccupied bands and `\mathbf{q}` covers the differences between all k-points in the first Brillouin zone. `\Omega = \Omega_\text{cell} \cdot N_\mathbf{k}` is the volume and `\eta` an (artificial) broadening parameter. `\mu` is the chemical potential. The screened potential is calculated from the (time-ordered) dielectric matrix in the Random Phase Approximation: .. math:: W_{\mathbf{G} \mathbf{G}'}(\mathbf{q}, \omega) = \frac{4 \pi}{|\mathbf{q} + \mathbf{G}|} \left( (\varepsilon^{\text{RPA}-1}_{\mathbf{G} \mathbf{G}'}(\mathbf{q}, \omega) - \delta^{\vphantom{\text{RPA}}}_{\mathbf{G} \mathbf{G}'} \right) \frac{1}{|\mathbf{q} + \mathbf{G}'|} Refer to :ref:`df_theory` for details on how the response function and the pair density matrix elements `\rho^{n \mathbf{k}}_{m \mathbf{k} - \mathbf{q}}(\mathbf{G}) \equiv \left` including the PAW corrections are calculated. Coulomb divergence ================== The head of the screened potential (`\mathbf{G} = \mathbf{G}' = 0`) diverges as `1/q^2` for `\mathbf{q} \rightarrow 0`. This divergence, however, is removed for an infinitesimally fine k-point sampling, as `\sum\limits_{\mathbf{q}} \rightarrow \frac{\Omega}{(2\pi)^3} \int\!d^3 \mathbf{q} \propto q^2`. Therefore, the `\mathbf{q} = 0` term can be evaluated analytically, which yields: .. math:: W_{\mathbf{00}}(\mathbf{q}=0, \omega) = \frac{2\Omega}{\pi} \left(\frac{6\pi^2}{\Omega}\right)^{1/3} \varepsilon^{-1}_{\mathbf{00}}(\mathbf{q} \rightarrow 0, \omega) for the head and similarly .. math:: W_{\mathbf{G0}}(\mathbf{q}=0, \omega) = \frac{1}{|\mathbf{G}|} \frac{\Omega}{\pi} \left(\frac{6\pi^2}{\Omega}\right)^{2/3} \varepsilon^{-1}_{\mathbf{G0}}(\mathbf{q} \rightarrow 0, \omega) for the wings of the screened potential. Here, the dielectric function is used in the optical limit. This is only relevant for the terms with `n = m`, as otherwise the pair density matrix elements vanish: `\rho^{n \mathbf{k}}_{m \mathbf{k}} = 0` for `n \neq m`. Frequency integration ===================== `\rightarrow` ``domega0, omega2`` The frequency integration is performed numerically on a user-defined grid for positive values only. This is done by rewriting the integral as: .. math:: & \int\limits_{-\infty}^\infty\!d\omega'\, \frac{W(\omega')}{\omega + \omega' - \epsilon_{m \, \mathbf{k} - \mathbf{q}} \pm i \eta}\\ =& \int\limits_{0}^\infty\!d\omega'\, W(\omega') \left(\frac{1}{\omega + \omega' - \epsilon_{m \, \mathbf{k} - \mathbf{q}} \pm i \eta} + \frac{1}{\omega - \omega' - \epsilon_{m \, \mathbf{k} - \mathbf{q}} \pm i \eta}\right) with the use of `W(\omega') = W(-\omega')`. The frequency grid is the same as that used for the dielectric function. Read more about it here: :ref:`df_tutorial_freq`. .. _gw_theory_ppa: Plasmon Pole Approximation ========================== `\rightarrow` ``ppa = True`` Within the plasmon pole approximation (PPA), the dielectric function is modelled as a single peak at the main plasmon frequency `\tilde{\omega}_{\mathbf{G}\mathbf{G}'}(\mathbf{q})`: .. math:: \varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, \omega) = R _{\mathbf{G}\mathbf{G}'}(\mathbf{q}) \left(\frac{1}{\omega - \tilde{\omega}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}) + i\eta} - \frac{1}{\omega + \tilde{\omega}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}) - i\eta}\right) The two parameters are found by fitting this expression to the full dielectric function for the values `\omega = 0` and `\omega = i E_0`: .. math:: \varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, 0) =& \frac{-2 R}{\tilde{\omega}} \hspace{0.5cm} \varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, iE_0) = \frac{-2 R \tilde{\omega}}{E_0^2 + \tilde{\omega}^2}\\ \Rightarrow \tilde{\omega}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}) =& E_0 \sqrt{\frac{\varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, iE_0)} {\varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, 0) - \varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, iE_0)}}\\ R _{\mathbf{G}\mathbf{G}'}(\mathbf{q}) =& -\frac {\tilde{\omega}_{\mathbf{G}\mathbf{G}'}(\mathbf{q})}{2} \varepsilon^{-1}_{\mathbf{G}\mathbf{G}'}(\mathbf{q}, 0) In this way, the frequency integration for the self energy can be evaluated analytically. The fitting value `E_0` has to be chosen carefully. By default, it is 1 H. Hilbert transform ================= The self-energy is evaluated using the Hilbert transform technique described in \ [#Kresse2006]_ . Parallelization =============== `\rightarrow` ``nblocks = int`` By default, the calculation is fully parallelized over k-points and bands. If more memory is required for storing the response function in the plane wave basis, additional block parallelization is possible. This distributes the matrix amongst the number of CPUs specified by ``nblocks``, resulting in a lower total memory requirement of the node. ``nblocks`` needs to be an integer divisor of the number of requested CPUs. I/O === All necessary informations of the system are read from ``calc = 'filename.gpw'`` which must contain the wavefunctions. This is done by performing ``calc.write('groundstate.gpw', 'all')`` after the groundstate calculation. GW supports spin-paired planewave calculations. The exchange-correlation contribution to the Kohn-Sham eigenvalues is stored in ``'filename.vxc.npy'`` and the exact-exchange eigenvalues are stored in ``'filename.exx.npy'``. The resulting output is written to ``'filename_results.pckl'`` and a summary of input as well as a output parameters are given in the human-readable ``'filename.txt'`` file. Information about the calculation of the screened coulomb interaction is printed in ``'filename.w.txt'``. Convergence =========== The results must be converged with respect to: - the number of k-points from the groundstate calculation A much finer k-point sampling might be required for converging the GW results than for the DFT bandstructure. - the number of bands included in the calculation of the self energy ``nbands`` - the planewave energy cutoff ``ecut`` ``ecut`` and ``nbands`` do not converge independently. As a rough estimation, ``ecut`` should be around the energy of the highest included band. If ``nbands`` is not specified it will be set equal to the amount of plane waves determined by ``ecut``. - the number of frequency points ``domega0, omega2`` The grid needs to resolve the features of the DFT spectrum. - the broadening ``eta`` This parameter is only used for the response function and in the plasmon pole approximation. Otherwise, it is automatically set to `\eta = 0.1`. Parameters ========== For input parameters, see :ref:`gw tutorial`. References ========== .. [#Hedin1965] L. Hedin, "New Method for Calculating the One-Particle Green's Function with Application to the Electron-Gas Problem", *Phys. Rev.* **139**, A796 (1965). .. [#Hybertsen1986] M.S. Hybertsen and S.G. Louie, "Electron correlation in semiconductors and insulators: Band gaps and quasiparticle energies", *Phys. Rev. B* **34**, 5390 (1986). .. [#Hueser2013] F. Hüser, T. Olsen, and K. S. Thygesen, "Quasiparticle GW calculations for solids, molecules, and two-dimensional materials", *Phys. Rev. B* **87**, 235132 (2013). .. [#Kresse2006] M. Shishkin and G. Kresse, "Implementation and performance of the frequency-dependent GW method within the PAW framework", *Phys. Rev. B* **74**, 035101 (2006). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/h2.py000066400000000000000000000005331316441372200244260ustar00rootroot00000000000000# creates: h2.txt from __future__ import print_function from ase import Atoms from gpaw import GPAW d = 0.74 a = 6.0 atoms = Atoms('H2', positions=[(0, 0, 0), (0, 0, d)], cell=(a, a, a)) atoms.center() calc = GPAW(nbands=2, txt='h2.txt') atoms.set_calculator(calc) print(atoms.get_forces()) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/introduction_to_paw.rst000066400000000000000000000030521316441372200303660ustar00rootroot00000000000000.. _introduction_to_paw: =================== Introduction to PAW =================== A simple example ================ We look at the `2\sigma`\ * orbital of a CO molecule: |ts| .. |ts| image:: 2sigma.png The main quantity in the PAW method is the pseudo wave-function (blue crosses) defined in all of the simulation box: .. math:: \tilde{\psi}(\mathbf{r}) = \tilde{\psi}(ih, jh, kh), where `h` is the grid spacing and `(i, j, k)` are the indices of the grid points. .. figure:: co_wavefunctions.png In order to get the all-electron wave function, we add and subtract one-center expansions of the all-electron (thick lines) and pseudo wave-functions (thin lines): .. math:: \tilde{\psi}^a(\mathbf{r}) = \sum_i C_i^a \tilde{\phi}_i^a(\mathbf{r}) .. math:: \psi^a(\mathbf{r}) = \sum_i C_i^a \phi_i^a(\mathbf{r}), where `a` is C or O and `\phi_i` and `\tilde{\phi}_i` are atom centered basis functions formed as radial functions on logarithmic radial grid multiplied by spherical harmonics. The expansion coefficients are given as: .. math:: C_i^a = \int d\mathbf{r} \tilde{p}^a_i(\mathbf{r} - \mathbf{R}^a) \tilde{\psi}(\mathbf{r}). Approximations ============== * Frozen core orbitals. * Truncated angular momentum expansion of compensation charges. * Finite number of basis functions and projector functions. More information on PAW ======================= You can find additional information on the :ref:`literature` page, or by reading the `paw note`_ .. _paw note: paw_note.pdf Script ====== .. literalinclude:: co_wavefunctions.py gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao.txt000066400000000000000000000311641316441372200252260ustar00rootroot000000000000002010-02-15 10.1103/PhysRevB.81.085103 Fully self-consistent GW calculations for molecules 2010-06-04 10.1103/PhysRevB.81.245105 Projector augmented wave formulation of Hartree-Fock calculations of electronic structure 2010-06-14 10.1063/1.3451265 Electrochemical control of quantum interference in anthraquinone-based molecular switches 2010-06-30 10.1088/0953-8984/22/25/253202 Electronic structure calculations with GPAW: a real-space implementation of the projector augmented-wave method 2010-09-16 10.1103/PhysRevB.82.121412 Quantifying transition voltage spectroscopy of molecular junctions: Ab initio calculations 2010-10-15 10.1021/nl101688a The Relation between Structure and Quantum Interference in Single Molecule Junctions 2010-12-30 10.1021/jp1076774 Ab Initio Adsorption Thermodynamics of H2S and H-2 on Ni(111): The Importance of Thermal Corrections and Multiple Reaction Equilibria 2011-01-15 10.1039/c1cp20924h Graphical prediction of quantum interference-induced transmission nodes in functionalized organic molecules 2011-03-04 10.1103/PhysRevB.83.115108 Self-consistent GW calculations of electronic transport in thiol- and amine-linked molecular junctions 2011-04-05 10.1103/PhysRevB.83.155407 Improving transition voltage spectroscopy of molecular junctions 2011-05-16 10.1016/j.cattod.2010.12.022 The role of transition metal interfaces on the electronic transport in lithium-air batteries 2011-05-21 10.1063/1.3589861 Adsorption properties versus oxidation states of rutile TiO2(110) 2011-05-31 10.1103/PhysRevB.83.184119 Optimized orthogonal tight-binding basis: Application to iron 2011-06-24 10.1103/PhysRevB.83.245122 Linear density response function in the projector augmented wave method: Applications to solids, surfaces, and interfaces 2011-07-11 10.1088/0953-8984/23/27/276004 Tight-binding simulation of transition-metal alloys 2011-08-04 10.1021/jp200893w Ab Initio Calculations of the Electronic Properties of Polypyridine Transition Metal Complexes and Their Adsorption on Metal Surfaces in the Presence of Solvent and Counterions 2011-10-14 10.1063/1.3646510 Robust conductance of dumbbell molecular junctions with fullerene anchoring groups 2011-10-17 10.1103/PhysRevB.84.155119 Parameterization of tight-binding models from density functional theory calculations 2011-10-21 10.1063/1.3653790 Controlling the transmission line shape of molecular t-stubs and potential thermoelectric applications 2011-11-09 10.3762/bjnano.2.82 Towards quantitative accuracy in first-principles transport calculations: The GW method applied to alkane/gold junctions 2011-11-16 10.1103/PhysRevB.84.205434 Steps on rutile TiO2(110): Active sites for water and methanol dissociation 2011-12-07 10.1063/1.3663385 Electrical conductivity in Li2O2 and its role in determining capacity limitations in non-aqueous Li-O-2 batteries 2011-12-14 10.1103/PhysRevB.84.245429 Electronic shell structure and chemisorption on gold nanoparticles 2012-03-23 10.1103/PhysRevB.85.115317 Phonon-limited mobility in n-type single-layer MoS2 from first principles 2012-04-27 10.1103/PhysRevB.85.155140 Ab initio nonequilibrium quantum transport and forces with the real-space projector augmented wave method 2012-06-13 10.1021/ja3003765 Balance of Nanostructure and Bimetallic Interactions in Pt Model Fuel Cell Catalysts: In Situ XAS and DFT Study 2012-08-01 10.1021/ja305004a Structure and Mobility of Metal Clusters in MOFs: Au, Pd, and AuPd Clusters in MOF-74 2012-10-09 10.1103/PhysRevB.86.155115 DFT-based tight-binding modeling of iron-carbon 2012-11-15 10.1140/epjd/e2012-30485-5 Density functional theory molecular dynamics study of the Au-25(SR)(18)(-) cluster 2012-12-20 10.1021/jz301806b Thermodynamics of Pore Filling Metal Clusters in Metal Organic Frameworks: Pd in UiO-66 2013-01-15 10.1039/c3cp54050b Computational screening of functionalized zinc porphyrins for dye sensitized solar cells 2013-06-19 10.1103/PhysRevB.87.235312 Acoustic phonon limited mobility in two-dimensional semiconductors: Deformation potential and piezoelectric scattering in monolayer MoS2 from first principles 2013-07-15 10.1038/ncomms3121 Direct measurement and modulation of single-molecule coordinative bonding forces in a transition metal complex 2013-11-14 10.1063/1.4829520 Energy level alignment and quantum conductance of functionalized metal-molecule junctions: Density functional theory versus GW calculations 2013-11-15 10.1002/pssb.201349217 Quantitatively accurate calculations of conductance and thermopower of molecular junctions 2013-11-28 10.1063/1.4829640 Interfacial oxygen under TiO2 supported Au clusters revealed by a genetic algorithm search 2014-01-15 10.1016/j.jcat.2013.10.015 Thermochemistry and micro-kinetic analysis of methanol synthesis on ZnO (0001) 2014-01-15 10.1039/c4cp01289e Optimizing porphyrins for dye sensitized solar cells using large-scale ab initio calculations 2014-02-15 10.1007/s11244-013-0160-9 Genetic Algorithm Procreation Operators for Alloy Nanoparticle Catalysts 2014-06-15 10.1021/cs500202f Identification of the Catalytic Site at the Interface Perimeter of Au Clusters on Rutile TiO2(110) 2014-08-11 10.1103/PhysRevB.90.075115 Simultaneous description of conductance and thermopower in single-molecule junctions from many-body ab initio calculations 2014-10-15 10.1016/j.susc.2014.06.001 Interplay of hydrogen bonding and molecule-substrate interaction in self-assembled adlayer structures of a hydroxyphenyl-substituted porphyrin 2014-11-10 10.1016/j.electacta.2014.09.056 Ti atoms in Ru0.3Ti0.7O2 mixed oxides form active and selective sites for electrochemical chlorine evolution 2014-12-07 10.1063/1.4902249 Nucleation and growth of Pt nanoparticles on reduced and oxidized rutile TiO2 (110) 2015-01-15 10.1039/c4nr06371f Surface-confined 2D polymerization of a brominated copper-tetraphenylporphyrin on Au(111) 2015-01-15 10.1039/c4sc03835e Design of two-photon molecular tandem architectures for solar cells by ab initio theory 2015-01-15 10.1039/c5cp00298b A DFT-based genetic algorithm search for AuCu nanoalloy electrocatalysts for CO2 reduction 2015-01-15 10.1039/c5cp01881a Electronic and magnetic properties of DUT-8(Ni) 2015-01-15 10.1039/c5cp03382a Low temperature pollutant trapping and dissociation over two-dimensional tin 2015-03-07 10.1063/1.4913739 Nanoplasmonics simulations at the basis set limit through completeness-optimized, local numerical basis sets 2015-03-14 10.1063/1.4906048 Chemical insight from density functional modeling of molecular adsorption: Tracking the bonding and diffusion of anthracene derivatives on Cu(111) with molecular orbitals 2015-03-18 10.1002/adfm.201404388 Molecular Heterojunctions of Oligo(phenylene ethynylene)s with Linear to Cruciform Framework 2015-03-24 10.1103/PhysRevB.91.115431 Localized surface plasmon resonance in silver nanoparticles: Atomistic first-principles time-dependent density-functional theory calculations 2015-04-02 10.1021/acs.jpcc.5b00734 Isolating a Reaction Intermediate in the Hydrogenation of 2,2,2-Trifluoroacetophenone on Pt(111) 2015-04-05 10.1002/jcc.23834 van der Waals Interactions are Critical in Car-Parrinello Molecular Dynamics Simulations of Porphyrin-Fullerene Dyads 2015-05-08 10.1088/0953-8984/27/17/175007 The effect of point defects on diffusion pathway within alpha-Fe 2015-06-11 10.1021/jp512627e Importance of the Reorganization Energy Barrier in Computational Design of Porphyrin-Based Solar Cells with Cobalt-Based Redox Mediators 2015-07-30 10.1021/acs.jpcc.5b04977 Self-Metalation of Phthalocyanine Molecules with Silver Surface Atoms by Adsorption on Ag(110) 2015-11-20 10.1103/PhysRevB.92.201205 Anharmonic stabilization and band gap renormalization in the perovskite CsSnI3 2015-12-01 10.1103/PhysRevLett.115.236804 Quantized Evolution of the Plasmonic Response in a Stretched Nanorod 2016-01-15 10.1007/128_2014_616 Dynamical Processes in Open Quantum Systems from a TDDFT Perspective: Resonances and Electron Photoemission 2016-01-15 10.1039/c6cp04194a Decoupling strain and ligand effects in ternary nanoparticles for improved ORR electrocatalysis 2016-01-15 10.1039/c6ra21668d Ab initio calculation of halide ligand passivation on PbSe quantum dot facets 2016-01-15 10.1039/c6sc01360k Conformations of cyclopentasilane stereoisomers control molecular junction conductance 2016-01-28 10.1021/acs.jpcc.5b10025 Photoinduced Absorption within Single-Walled Carbon Nanotube Systems 2016-01-28 10.1039/c5cp04694g Correlation between diffusion barriers and alloying energy in binary alloys 2016-03-31 10.1021/acs.jpcc.5b11211 When Conductance Is Less than the Sum of Its Parts: Exploring Interference in Multiconnected Molecules 2016-03-31 10.1021/acs.jpcc.5b12611 Theoretical Insight into the Internal Quantum Efficiencies of Polymer/C-60 and Polymer/SWNT Photovoltaic Devices 2016-04-07 10.1021/acs.jpcc.5b11696 Structural Changes in RuO2 during Electrochemical Hydrogen Evolution 2016-04-15 10.1038/NCHEM.2454 Effects of correlated parameters and uncertainty in electronic-structure-based chemical kinetic modelling 2016-05-05 10.1021/acs.jpcc.6b01828 Tuning Conductance in Aromatic Molecules: Constructive and Counteractive Substituent Effects 2016-06-21 10.1063/1.4954003 All-silicon tandem solar cells: Practical limits for energy conversion and possible routes for improvement 2016-07-25 10.1002/anie.201603584 Fulleretic Well-Defined Scaffolds: Donor-Fullerene Alignment Through Metal Coordination and Its Effect on Photophysics 2016-09-07 10.1063/1.4961868 An automated nudged elastic band method 2016-09-19 10.1002/anie.201605559 Charge Transport and Conductance Switching of Redox-Active Azulene Derivatives 2016-10-10 10.1038/ncomms13040 Isotope analysis in the transmission electron microscope 2016-10-15 10.1007/s00706-016-1795-6 Bias-induced conductance switching in single molecule junctions containing a redox-active transition metal complex 2016-10-15 10.1021/acscatal.6b01310 Reaction Pathways and Intermediates in Selective Ring Opening of Biomass-Derived Heterocyclic Compounds by Iridium 2016-10-17 10.1021/acs.inorgchem.6b01840 Electron Transfer and Solvent-Mediated Electronic Localization in Molecular Photocatalysis 2016-10-21 10.1063/1.4964671 Accelerating the search for global minima on potential energy surfaces using machine learning 2016-11-15 10.1021/acs.jctc.6b00815 Implementation of Constrained DFT for Computing Charge Transfer Rates within the Projector Augmented Wave Method 2016-12-21 10.1002/aenm.201601427 Inter-Fullerene Electronic Coupling Controls the Efficiency of Photoinduced Charge Generation in Organic Bulk Heterojunctions 2016-12-22 10.1021/acs.jpcc.6b09682 Field-Induced Conformational Change in a Single-Molecule-Graphene-Nanoribbon Junction: Effect of Vibrational Energy Redistribution 2016-12-29 10.1021/acs.jpcc.6b09019 pH in Grand Canonical Statistics of an Electrochemical Interface 2017-01-06 10.1103/PhysRevB.95.045407 Principles and simulations of high-resolution STM imaging with a flexible tip apex 2017-01-15 10.1039/c6nr08958e Grain boundary-mediated nanopores in molybdenum disulfide grown by chemical vapor deposition 2017-02-15 10.1021/acs.jctc.6b00809 Theory and Applications of Generalized Pipek-Mezey Wannier Functions 2017-04-20 10.1021/acs.jpcc.7b00283 Effects of Aromaticity and Connectivity on the Conductance of Five-Membered Rings 2017-06-15 10.1016/j.micromeso.2017.02.065 Distribution of open sites in Sn-Beta zeolite 2017-06-15 10.1021/acsnano.7b01912 Manifestation of Geometric and Electronic Shell Structures of Metal Clusters in Intercluster Reactions 2017-06-15 10.1126/sciadv.1700176 Buckyball sandwiches 2017-07-12 10.1088/1361-648X/aa680e The atomic simulation environment-a Python library for working with atoms 2017-07-15 10.1021/acs.jctc.7b00404 Projector Augmented Wave Method Incorporated into Gauss-Type Atomic Orbital Based Density Functional Theory 2017-07-15 10.1021/acs.nanolett.7b01592 The Role of Through-Space Interactions in Modulating Constructive and Destructive Interference Effects in Benzene 2017-08-01 10.1038/s41598-017-07456-6 Excitation-dependent fluorescence from atomic/molecular layer deposited sodium-uracil thin films 2017-08-10 10.1021/acs.jpcc.7b04700 Spectroelectrochemical Approaches to Mechanistic Aspects of Charge Transport in meso-Nickel(II) Schiff Base Electrochromic Polymer 2017-08-15 10.1103/PhysRevB.96.085421 Quantum interference in coherent tunneling through branched molecular junctions containing ferrocene centers 2017-09-01 10.1088/1361-651X/aa7320 libvdwxc: a library for exchange-correlation functionals in the vdW-DF family 2017-10-15 10.1016/j.jcis.2017.06.017 Investigation of anti-solvent induced optical properties change of cesium lead bromide iodide mixed perovskite (CsPbBr3-xIx) quantum dots 2017-10-15 10.1016/j.jssc.2017.07.015 The native point defects of ternary C14 Laves phase Mg2Cu3Si: Ab initio investigation gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao/000077500000000000000000000000001316441372200244605ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao/basisgeneration.py000066400000000000000000000016371316441372200302160ustar00rootroot00000000000000from gpaw.atom.generator import Generator from gpaw.atom.configurations import parameters from gpaw.atom.basis import BasisMaker symbol = 'Au' args = parameters[symbol] # Dictionary of default setup parameters args['rcut'] = 2.6 # Set cutoff of augmentation sphere generator = Generator(symbol, 'RPBE') generator.N *= 2 # Increase grid resolution generator.run(write_xml=False, **args) bm = BasisMaker(generator, name='special', run=False) # Create double-zeta RPBE basis where p orbital is considered a valence state # (ordinary dzp basis would use a smaller p-type Gaussian for polarization) # The list jvalues indicates which states should be included, and the # ordering corresponds to the valence states in the setup. basis = bm.generate(zetacount=2, polarizationcount=0, energysplit=0.1, jvalues=[0, 1, 2], rcutmax=12.0) basis.write_xml() # Dump to file 'Au.special.dz.basis' gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao/lcao.rst000066400000000000000000000236741316441372200261440ustar00rootroot00000000000000.. _lcao: ========= LCAO Mode ========= .. highlight:: bash GPAW supports an alternative mode of calculation, :dfn:`LCAO mode`, which will use a basis set of atomic orbital-like functions rather than grid-based wave functions. This makes calculations considerably cheaper, although the accuracy will be limited by the quality of the chosen basis. The sections below explain briefly how LCAO mode works, how to generate basis sets and how to use them in calculations. LCAO mode is available for TD-DFT via the :ref:`LCAOTDDFT ` module. Introduction ------------ In the LCAO mode the Kohn-Sham pseudo wave functions `\tilde{\psi}_n(\mathbf r)` are expanded onto a set of atomic-like orbitals `\Phi_{nlm}(\mathbf r)`, in the same spirit as the SIESTA method [Siesta]_ : .. math:: \tilde{\psi}_n(\mathbf r) = \sum_\mu c_{\mu n} \Phi_{\mu}(\mathbf r) The basis functions are constructed as products of numerical radial functions and spherical harmonics .. math:: \Phi_{nlm}(\mathbf{r}) = \Phi_{nlm}(\mathbf r^a + \mathbf R^a) = \varphi_{nl}(r^a) Y_{lm}(\hat{\mathbf{r}}^a) where `\mathbf R^a` is the position of nucleus `a`, and `\mathbf r^a = \mathbf r - \mathbf R^a`. In this approximation the variational parameters are the coefficients `c_{\mu n}` rather than the real space wave function. The eigenvalue problem then becomes .. math:: \sum_\nu H_{\mu\nu} c_{\nu n} = \sum_{\nu} S_{\mu\nu} c_{\nu n} \epsilon_n which can be solved by directly diagonalizating the Hamiltonian in the basis of the atomic orbitals. Some detailed information can be found in the master theses `1`_ and `2`_. .. _1: ../../_static/askhl_master.pdf .. _2: ../../_static/marco_master.pdf Basis-set generation -------------------- In order to perform an LCAO calculation, a basis-set must be generated for every element in your system. This can be done by using the :command:`gpaw-basis` tool, located in your :file:`{gpaw-directory}/tools` directory. For example, typing:: $ gpaw-basis H Cl will generate the basis-set files :file:`H.dzp.basis` and :file:`Cl.dzp.basis` for hydrogen and chlorine with sensible default parameters. Note that :file:`dzp` stands for ``double zeta polarized`` which is the default basis-set type. The basis-set should be placed in the same directory as the GPAW setups (see :ref:`installation of paw datasets` for details). For a complete list of the parameters do:: $ gpaw-basis --help For technical reasons, the basis set generator always generates the corresponding PAW, even if the latter exists on the user's system. Use the ``--save-setup`` option to save the calculated setup along with the basis set. Running a calculation --------------------- In order to run an LCAO calculation, the ``lcao`` mode and a basis-set should be set in the calculator:: >>> calc = GPAW(mode='lcao', >>> basis='dzp', >>> ...) The calculator can then be used in the usual way. The ``basis`` keyword accepts the same types of values as the ``setups`` keyword, such as ``basis={'H' : 'dzp', 'O' : 'mine', 'C' : 'szp'}``. Example ------- The following example will relax a water molecule using the LCAO calculator. The ``QuasiNewton`` minimizer will use the forces calculated using the localized basis set. .. literalinclude:: lcao_h2o.py It is possible to switch to the Finite Difference mode and further relax the structure simply by doing:: >>> calc.set(mode='fd') >>> dyn.run(fmax=0.05) More on basis sets ------------------ A minimal basis set consists of one atomic orbital-like function for each valence state of the atom. Extra radial functions can be added to improve the span of the basis; basis sets are called *single-zeta* (sz), *double-zeta* (dz) and so on, depending on the number of such radial functions per valence state. It is normally desirable to add a basis function corresponding to the lowest unoccupied angular momentum quantum number. This is called a *polarization* function. *Double-zeta polarized* basis sets are normally required *and* sufficient to obtain results of reasonable accuracy; they are also the basis type generated by default. A dzp basis set for nitrogen will have 2s and 2p valence states, each with two radial functions, plus a polarization function of type d, for a total of 5 distinct radial functions. Each will be degenerate by `2l+1`, meaning that GPAW will use a total of 13 basis functions to represent the atom during a calculation. Transition metals, having s- and d-type valence states, get a p-type polarization function and thus a total of 15 basis functions. To plot already generated basis functions, use the :command:`gpaw-analyse-basis` command like:: $ gpaw-analyse-basis -f H.dzp.basis O.dzp.basis This will plot the basis functions in the specified files. If the ``-f`` option is not included, the script will look for the first matching file in the GPAW setups paths, rather than the precise specified files. Run ``gpaw-analyse-basis --help`` for more options. .. _ghost-atoms: Ghost atoms and basis set superposition errors ---------------------------------------------- In the vicinity of a surface with many basis functions, an adsorbate can "benefit" from the degrees of freedom from the surface basis functions, resulting in a lower energy compared to a calculation on the isolated adsorbate and thus too strong binding energy. This error referred to as the *basis set superposition error*. It can be eliminated by adding *ghost* atoms to the calculation on the isolated adsorbate. Ghost atoms possess basis functions as normal but do not otherwise affect the calculation (no projectors, compensation charges and so on), thereby ensuring that the same degrees of freedom are available to the wave functions in any calculation. A calculation with ghost atoms is performed precisely like a normal calculation, in the sense that the ASE atoms object should contain all the involved atoms including those which are ghosts, with the only difference being that ghost atoms have their setup type set to ``ghost``. It is stressed that the *only* difference between an ordinary atom and the corresponding ghost atom is the setup type. Perform a calculation using ghost copper atoms and ordinary oxygen and hydrogen atoms:: >>> GPAW(setups={'Cu' : 'ghost', 'O' : 'paw', 'H' : 'paw'}, basis='dzp', mode='lcao', ...) Perform a calculation where atom 17 and atom 42 (designated by their indices in the ``Atoms`` object) use ordinary setups, while all other atoms are ghosts:: >>> GPAW(setups={'default': 'ghost', 17: 'paw', 42:'paw'}, basis='dzp', mode='lcao', ...) .. _poisson_performance: Notes on performance -------------------- For larger LCAO calculations, it is crucial to use ScaLAPACK. See the dedicated section on :ref:`manual_ScaLAPACK` for more information. Below are some hints on how to obtain good performance for operations not related to ScaLAPACK. The *only* difference between the FD (grid-based finite-difference) and LCAO modes is the way in which pseudo wave functions are represented. The usual real-space grid methods are still used for the density and potential. The associated computations will therefore take a larger percentage of the CPU time compared to FD mode, where operations on the wave functions usually dominate. Thus it makes sense to pay some attention to the performance of these operations. The multigrid method used in the Poisson solver relies on alternating interpolations and restrictions of the density on grids of different sizes. Make sure that the grid point count along each axis is divisible by 8, by specifying e.g. ``gpts=(96, 96, 96)`` when creating the calculator -- this will *dramatically* reduce the number of required Poisson iterations in large or very oblong systems in those cases where the code would otherwise have chosen a grid point count not divisible by 8. By default, the Poisson solver uses the *Jacobi method*. To increase performance further use the *Gauss-Seidel* method instead, which usually reduces the Poisson iteration count by around 40% (ideally 50%). The convergence criterion of the Poisson solver in FD mode, ``eps=2e-10``, is very strict. A value of around ``eps=1e-7`` can reduce the required Poisson iteration count considerably without increasing the required number of SCF steps. Larger values like ``eps=1e-5`` tend to increase the number of SCF steps, possibly making the calculation take longer. Example: .. literalinclude:: lcao_opt.py Advanced basis generation ------------------------- The class :class:`gpaw.atom.basis.BasisMaker` is the backend of the basis generation programme. Use this to create basis sets with specialized parameters that cannot be set using the command line interface. In particular, the basis generator relies on the *setup* generator to define the basis functions; therefore, any parameters that apply to setup generation will equally apply to basis set generation. .. autoclass:: gpaw.atom.basis.BasisMaker This example shows how to generate an RPBE double-zeta basis set for gold, in which the otherwise empty p-state is considered a valence state, and using a non-standard size of the augmentation sphere. .. literalinclude:: basisgeneration.py Miscellaneous remarks --------------------- In FD or PW mode, a single LCAO iteration is used to initialize the wave functions and density. Specifying a basis to the calculator in FD or PW mode can be used to increase the quality of the initial guess, but does not in any other way affect the subsequent iterations:: >>> calc = GPAW(mode='fd', basis='dzp', ...) In either mode, if a basis is not specified to the calculator, the calculator will use the pseudo partial waves `\tilde \phi_i^a(\mathbf r)`, smoothly truncated to 8 Bohr radii, as a basis. This corresponds to a single-zeta basis in most cases. Depending on the unoccupied states defined on the PAW setups, it may be roughly equivalent to a single-zeta polarized basis set for certain elements. .. [Siesta] J.M. Soler et al., J. Phys. Cond. Matter 14, 2745-2779 (2002) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao/lcao_h2o.py000066400000000000000000000007071316441372200265240ustar00rootroot00000000000000from ase import Atoms from ase.optimize import QuasiNewton from gpaw import GPAW a = 6 b = a / 2 mol = Atoms('H2O', [(b, 0.7633 + b, -0.4876 + b), (b, -0.7633 + b, -0.4876 + b), (b, b, 0.1219 + b)], cell=[a, a, a]) calc = GPAW(nbands=4, h=0.2, mode='lcao', basis='dzp') mol.set_calculator(calc) dyn = QuasiNewton(mol, trajectory='lcao_h2o.traj') dyn.run(fmax=0.05) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao/lcao_opt.py000066400000000000000000000011331316441372200266300ustar00rootroot00000000000000from ase import Atoms from ase.optimize import QuasiNewton from gpaw import GPAW from gpaw.poisson import PoissonSolver a = 6 b = a / 2 mol = Atoms('H2O', positions=[(b, 0.7633 + b, -0.4876 + b), (b, -0.7633 + b, -0.4876 + b), (b, b, 0.1219 + b)], cell=[a, a, a]) calc = GPAW(nbands=4, mode='lcao', basis='dzp', gpts=(32, 32, 32), poissonsolver=PoissonSolver(relax='GS', eps=1e-7)) mol.set_calculator(calc) dyn = QuasiNewton(mol, trajectory='lcao2_h2o.traj') dyn.run(fmax=0.05) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/lcao/submit.agts.py000066400000000000000000000002621316441372200272720ustar00rootroot00000000000000def agts(queue): queue.add('basisgeneration.py', ncpus=1, walltime=10) queue.add('lcao_h2o.py', ncpus=1, walltime=10) queue.add('lcao_opt.py', ncpus=1, walltime=10) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/literature.rst000066400000000000000000000115461316441372200264630ustar00rootroot00000000000000.. _literature: ---------- Literature ---------- Links to guides and manual pages -------------------------------- * The GPAW calculator :ref:`manual` * The :ref:`devel` pages * The :ref:`guide for developers ` * The code :ref:`overview` * The :ref:`features and algorithms` in GPAW .. _literature_reports_presentations_and_theses: Reports, presentations, and theses using gpaw --------------------------------------------- * Summer-school 2014 talk about PAW, GPAW and ASE: :download:`ss14.pdf` * A short note on the basics of PAW: :download:`paw_note.pdf` * A master thesis on the inclusion of non-local exact exchange in the PAW formalism, and the implementation in gpaw: :download:`rostgaard_master.pdf` * A master thesis on the inclusion of a localized basis in the PAW formalism, plus implementation and test results in GPAW: :download:`marco_master.pdf` * A master thesis on the inclusion of localized basis sets in the PAW formalism, focusing on basis set generation and force calculations: :download:`askhl_master.pdf` * A course report on a project involving the optimization of the setups (equivalent of pseudopotentials) in gpaw: :download:`askhl_10302_report.pdf` * Slides from a talk about PAW: :download:`mortensen_paw.pdf` * Slides from a talk about GPAW development: :download:`mortensen_gpaw-dev.pdf` * Slides from a mini symposium during early development stage: :download:`mortensen_mini2003talk.pdf` .. _paw_papers: Articles on the PAW formalism ----------------------------- The original article introducing the PAW formalism: | P. E. Blöchl | `Projector augmented-wave method`__ | Physical Review B, Vol. **50**, 17953, 1994 __ http://dx.doi.org/10.1103/PhysRevB.50.17953 A different formulation of PAW by Kresse and Joubert designed to make the transition from USPP to PAW easy. | G. Kresse and D. Joubert | `From ultrasoft pseudopotentials to the projector augmented-wave method`__ | Physical Review B, Vol. **59**, 1758, 1999 __ http://dx.doi.org/10.1103/PhysRevB.59.1758 A second, more pedagogical, article on PAW by Blöchl and co-workers. | P. E. Blöchl, C. J. Först, and J. Schimpl | `Projector Augmented Wave Method: ab-initio molecular dynamics with full wave functions`__ | Bulletin of Materials Science, Vol. **26**, 33, 2003 __ http://www.ias.ac.in/matersci/ .. _gpaw_publications: Citations of the GPAW method papers ----------------------------------- .. image:: citations.png :width: 750 (updated on May 18, 2013) The total number of citations above is the number of publications citing at least one of the other papers, not the sum of all citation counts. The six method papers are: gpaw1: \J. J. Mortensen, L. B. Hansen, and K. W. Jacobsen `Real-space grid implementation of the projector augmented wave method`__ Physical Review B, Vol. **71**, 035109 (2005) __ http://dx.doi.org/10.1103/PhysRevB.71.035109 tddft: \M. Walter, H. Häkkinen, L. Lehtovaara, M. Puska, J. Enkovaara, C. Rostgaard, and J. J. Mortensen `Time-dependent density-functional theory in the projector augmented-wave method`__ Journal of Chemical Physics, Vol. **128**, 244101 (2008) __ http://dx.doi.org/10.1063/1.2943138 lcao: \A. H. Larsen, M. Vanin, J. J. Mortensen, K. S. Thygesen, and K. W. Jacobsen `Localized atomic basis set in the projector augmented wave method`__ Physical Review B, Vol. **80**, 195112 (2009) __ http://dx.doi.org/10.1103/PhysRevB.80.195112 gpaw2: \J. Enkovaara, C. Rostgaard, J. J. Mortensen, J. Chen, M. Dulak, L. Ferrighi, J. Gavnholt, C. Glinsvad, V. Haikola, H. A. Hansen, H. H. Kristoffersen, M. Kuisma, A. H. Larsen, L. Lehtovaara, M. Ljungberg, O. Lopez-Acevedo, P. G. Moses, J. Ojanen, T. Olsen, V. Petzold, N. A. Romero, J. Stausholm, M. Strange, G. A. Tritsaris, M. Vanin, M. Walter, B. Hammer, H. Häkkinen, G. K. H. Madsen, R. M. Nieminen, J. K. Nørskov, M. Puska, T. T. Rantala, J. Schiøtz, K. S. Thygesen, and K. W. Jacobsen `Electronic structure calculations with GPAW: a real-space implementation of the projector augmented-wave method`__ \J. Phys.: Condens. Matter **22**, 253202 (2010) __ http://stacks.iop.org/0953-8984/22/253202 response: Jun Yan, Jens. J. Mortensen, Karsten W. Jacobsen, and Kristian S. Thygesen `Linear density response function in the projector augmented wave method: Applications to solids, surfaces, and interfaces`__ Phys. Rev. B **83**, 245122 (2011) __ http://prb.aps.org/abstract/PRB/v83/i24/e245122 csm: \A. Held and M. Walter `Simplified continuum solvent model with a smooth cavity based on volumetric data`__ \J. Chem. Phys. **141**, 174108 (2014) __ http://dx.doi.org/10.1063/1.4900838 All citing articles: .. csv-table:: :file: citations.csv :header: #, title :widths: 1, 15 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/manual.rst000066400000000000000000001205561316441372200255620ustar00rootroot00000000000000.. _manual: ====== Manual ====== GPAW calculations are controlled through scripts written in the programming language Python_. GPAW relies on the `Atomic Simulation Environment `_ (ASE), which is a Python package that helps us describe our atoms. The ASE package also handles molecular dynamics, analysis, visualization, geometry optimization and more. If you don't know anything about ASE, then it might be a good idea to familiarize yourself with it before continuing (at least read the :ref:`ase:about` section). Below, there will be Python code examples starting with ``>>>`` (and ``...`` for continuation lines). It is a good idea to start the Python interpreter and try some of the examples below. .. _Python: http://www.python.org The units used by the GPAW calculator correspond to the :mod:`ASE conventions `, most importantly electron volts and angstroms. ----------------------- Doing a PAW calculation ----------------------- To do a PAW calculation with the GPAW code, you need an ASE :class:`~ase.Atoms` object and a :class:`~gpaw.calculator.GPAW` calculator:: _____________ ____________ | | | | | Atoms |------->| GPAW | | | | | |_____________| |____________| atoms calc In Python code, it looks like this: .. literalinclude:: h2.py :start-after: from __future__ If the above code was executed, a calculation for a single `\rm{H}_2` molecule would be started. The calculation would be done using a supercell of size `6.0 \times 6.0 \times 6.0` Å with cluster boundary conditions. The parameters for the PAW calculation are: * 2 electronic bands. * Local density approximation (LDA)\ [#LDA]_ for the exchange-correlation functional. * Spin-paired calculation. * `32 \times 32 \times 32` grid points. The values of these parameters can be found in the text output file: :download:`h2.txt`. The calculator will try to make sensible choices for all parameters that the user does not specify. Specifying parameters can be done like this: >>> calc = GPAW(nbands=1, ... xc='PBE', ... gpts=(24, 24, 24)) Here, we want to use one electronic band, the Perdew, Burke, Ernzerhof (PBE)\ [#PBE]_ exchange-correlation functional and 24 grid points in each direction. ---------- Parameters ---------- The complete list of all possible parameters and their defaults is shown below. A detailed description of the individual parameters is given in the following sections. .. list-table:: :header-rows: 1 :widths: 1 1 1 2 * - keyword - type - default value - description * - ``basis`` - ``str`` or dict - ``{}`` - Specification of :ref:`manual_basis` * - ``charge`` - ``float`` - ``0`` - Total :ref:`manual_charge` of the system * - ``communicator`` - Object - - :ref:`manual_communicator` * - ``convergence`` - ``dict`` - - :ref:`manual_convergence` * - ``eigensolver`` - ``str`` - ``'dav'`` - :ref:`manual_eigensolver` * - ``external`` - Object - - :ref:`manual_external` * - ``fixdensity`` - ``bool`` - ``False`` - Use :ref:`manual_fixdensity` * - ``gpts`` - *seq* - - :ref:`manual_gpts` * - ``h`` - ``float`` - ``0.2`` - :ref:`manual_h` * - ``hund`` - ``bool`` - ``False`` - :ref:`Use Hund's rule ` * - ``idiotproof`` - ``bool`` - ``True`` - Set to ``False`` to ignore setup fingerprint mismatch (allows restart when the original setup files are not available) * - ``kpts`` - *seq* - `\Gamma`-point - :ref:`manual_kpts` * - ``maxiter`` - ``int`` - ``333`` - :ref:`manual_maxiter` * - ``mixer`` - Object - - Pulay :ref:`manual_mixer` scheme * - ``mode`` - ``str`` - ``'fd'`` - :ref:`manual_mode` * - ``nbands`` - ``int`` - - :ref:`manual_nbands` * - ``occupations`` - occ. obj. - - :ref:`manual_occ` * - ``parallel`` - ``dict`` - - :ref:`manual_parallel` * - ``poissonsolver`` - Object - - Specification of :ref:`Poisson solver ` or :ref:`dipole correction ` or :ref:`Advanced Poisson solver ` * - ``random`` - ``bool`` - ``False`` - Use random numbers for :ref:`manual_random` * - ``setups`` - ``str`` or ``dict`` - ``'paw'`` - :ref:`manual_setups` * - ``spinpol`` - ``bool`` - - :ref:`manual_spinpol` * - ``symmetry`` - ``dict`` - ``{}`` - :ref:`manual_symmetry` * - ``txt`` - ``str``, None, or file obj. - ``'-'`` (``sys.stdout``) - :ref:`manual_txt` * - ``xc`` - ``str`` - ``'LDA'`` - :ref:`manual_xc` *seq*: A sequence of three ``int``'s. .. note:: Parameters can be changed after the calculator has been constructed by using the :meth:`~gpaw.calculator.GPAW.set` method: >>> calc.set(txt='H2.txt', charge=1) This would send all output to a file named :file:`'H2.txt'`, and the calculation will be done with one electron removed. Deprecated keywords (in favour of the ``parallel`` keyword) include: ================= ========= ============= ============================ keyword type default value description ================= ========= ============= ============================ ``parsize`` *seq* Parallel :ref:`manual_parsize_domain` ``parsize_bands`` ``int`` ``1`` :ref:`manual_parsize_bands` ================= ========= ============= ============================ .. _manual_mode: Finite-difference, plane-wave or LCAO mode ------------------------------------------ Finite-difference: The default mode (``mode='fd'``) is Finite Difference. This means that the wave functions will be expanded on a real space grid. LCAO: Expand the wave functions in a basis-set constructed from atomic-like orbitals, in short LCAO (linear combination of atomic orbitals). This is done by setting ``mode='lcao'``. See also the page on :ref:`lcao`. Plane-waves: Expand the wave functions in plane-waves. Use ``mode='pw'`` if you want to use the default plane-wave cutoff of `E_{\text{cut}}=340` eV. The plane-waves will be those with `|\mathbf G+\mathbf k|^2/2`_. For the list of all functionals available in GPAW see :ref:`overview_xc`. GPAW uses the functionals from libxc_ by default. Keywords are based on the names in the libxc :file:`'xc_funcs.h'` header file (the leading ``'XC_'`` should be removed from those names). Valid keywords are strings or combinations of exchange and correlation string joined by **+** (plus). For example, "the" (most common) LDA approximation in chemistry corresponds to ``'LDA_X+LDA_C_VWN'``. XC functionals can also be specified as dictionaries. This is useful for functionals that depend on one or more parameters. For example, to use a stencil with two nearest neighbours for the density-gradient with the PBE functional, use ``xc={'name': 'PBE', 'stencil': 2}``. The ``stencil`` keyword applies to any GGA or MGGA. Some functionals may take other parameters; see their respective documentation pages. Hybrid functionals (the feature is described at :ref:`exx`) require the setups containing exx information to be generated. Check available setups for the presence of exx information, for example:: [~]$ zcat $GPAW_SETUP_PATH/O.PBE.gz | grep ">> from ase.dft.kpoints import monkhorst_pack >>> kpts = monkhorst_pack((1, 1, 4)) >>> kpts array([[ 0. , 0. , -0.375], [ 0. , 0. , -0.125], [ 0. , 0. , 0.125], [ 0. , 0. , 0.375]]) >>> kpts+=(0,0,0.125) >>> kpts array([[ 0. , 0. , -0.25], [ 0. , 0. , 0. ], [ 0. , 0. , 0.25], [ 0. , 0. , 0.5 ]]) .. _manual_spinpol: Spinpolarized calculation ------------------------- If any of the atoms have magnetic moments, then the calculation will be spin-polarized - otherwise, a spin-paired calculation is carried out. This behavior can be overruled with the ``spinpol`` keyword (``spinpol=True``). .. _manual_gpts: Number of grid points --------------------- The number of grid points to use for the grid representation of the wave functions determines the quality of the calculation. More gridpoints (smaller grid spacing, *h*), gives better convergence of the total energy. For most elements, *h* should be 0.2 Å for reasonable convergence of total energies. If a ``n1`` `\times` ``n2`` `\times` ``n3`` grid is desired, use ``gpts=(n1, n2, n3)``, where ``n1``, ``n2`` and ``n3`` are positive ``int``'s all divisible by four. Alternatively, one can use something like ``h=0.25``, and the program will try to choose a number of grid points that gives approximately a grid-point density of `1/h^3`. For more details, see :ref:`grids`. If you are more used to think in terms of plane waves; a conversion formula between plane wave energy cutoffs and realspace grid spacings have been provided by Briggs *et. al* PRB **54**, 14362 (1996). The conversion can be done like this:: >>> from gpaw.utilities.tools import cutoff2gridspacing, gridspacing2cutoff >>> from ase.units import Rydberg >>> h = cutoff2gridspacing(50 * Rydberg) .. _manual_h: Grid spacing ------------ The parameter ``h`` specifies the grid spacing in Å that has to be used for the realspace representation of the smooth wave functions. Note, that this grid spacing in most cases is approximate as it has to fit to the unit cell (see :ref:`manual_gpts` above). In case you want to specify ``h`` exactly you have to choose the unit cell accordingly. This can be achieved by:: from gpaw.cluster import * d = 0.74 a = 6.0 atoms = Cluster('H2', positions=[(0, 0, 0), (0, 0, d)]) # set the amount of vacuum at least to 4 Å # and ensure a grid spacing of h=0.2 atoms.minimal_box(4., h=.2) .. _manual_symmetry: Use of symmetry --------------- The default behavior is to use all point-group symmetries and time-reversal symmetry to reduce the **k**-points to only those in the irreducible part of the Brillouin-zone. Moving the atoms so that a symmetry is broken will cause an error. This can be avoided by using:: symmetry={'point_group': False} This will reduce the number of applied symmetries to just the time-reversal symmetry (implying that the Hamiltonian is invariant under **k** -> -**k**). For some purposes you might want to have no symmetry reduction of the **k**-points at all (debugging, band-structure calculations, ...). This can be achieved by specifying:: symmetry={'point_group': False, 'time_reversal': False} or simply ``symmetry='off'`` which is a short-hand notation for the same thing. For full control, here are all the available keys of the ``symmetry`` dictionary: ================= ======== =============================== key default description ================= ======== =============================== ``point_group`` ``True`` Use point-group symmetries ``time_reversal`` ``True`` Use time-reversal symmetry ``symmorphic`` ``True`` Use only symmorphic symmetries ``tolerance`` ``1e-7`` Relative tolerance ================= ======== =============================== .. _manual_random: Wave function initialization ---------------------------- By default, a linear combination of atomic orbitals is used as initial guess for the wave functions. If the user wants to calculate more bands than there are precalculated atomic orbitals, random numbers will be used for the remaining bands. .. _manual_occ: Occupation numbers ------------------ The smearing of the occupation numbers is controlled like this:: from gpaw import GPAW, FermiDirac calc = GPAW(..., occupations=FermiDirac(width), ...) The distribution looks like this (width = `k_B T`): .. math:: f(E) = \frac{1}{1 + \exp[E / (k_B T)]} For calculations with periodic boundary conditions, the default value is 0.1 eV and the total energies are extrapolated to *T* = 0 Kelvin. For a molecule (no periodic boundaries) the default value is ``width=0``, which gives integer occupation numbers. For a spin-polarized calculation, one can fix the magnetic moment at the initial value using ``FermiDirac(width, fixmagmom=True)``. .. _manual_lmax: Compensation charges -------------------- The compensation charges are expanded with correct multipoles up to and including `\ell=\ell_{max}`. Default value: ``lmax=2``. .. _manual_charge: Charge ------ The default is charge neutral. The systems total charge may be set in units of the negative electron charge (i.e. ``charge=-1`` means one electron more than the neutral). .. _manual_convergence: Accuracy of the self-consistency cycle -------------------------------------- The ``convergence`` keyword is used to set the convergence criteria. The default value is this Python dictionary:: {'energy': 0.0005, # eV / electron 'density': 1.0e-4, 'eigenstates': 4.0e-8, # eV^2 / electron 'bands': 'occupied', 'forces': float('inf')} # eV / Ang Max In words: * The energy change (last 3 iterations) should be less than 0.5 meV per valence electron. * The change in density (integrated absolute value of density change) should be less than 0.0001 electrons per valence electron. * The integrated value of the square of the residuals of the Kohn-Sham equations should be less than `4.0 \times 10^{-8} \mathrm{eV}^2` per valence electron. This criterion does not affect LCAO calculations. * The maximum change in the magnitude of the vector representing the difference in forces for each atom. Setting this to infinity (default) disables this functionality, saving computational time and memory usage. The individual criteria can be changed by giving only the specific entry of dictionary e.g. ``convergence={'energy': 0.0001}`` would set the convergence criteria of energy to 0.1 meV while other criteria remain in their default values. As the total energy and charge density depend only on the occupied states, unoccupied states do not contribute to the convergence criteria. However, with the ``bands`` set to ``'all'``, it is possible to force convergence also for the unoccupied states. One can also use ``{'bands': 200}`` to converge the lowest 200 bands. One can also write ``{'bands': -10}`` to converge all bands except the last 10. It is often hard to converge the last few bands in a calculation. .. _manual_maxiter: Maximum number of SCF-iterations -------------------------------- The calculation will stop with an error if convergence is not reached in ``maxiter`` self-consistent iterations. .. _manual_txt: Where to send text output ------------------------- The ``txt`` keyword defaults to the string ``'-'``, which means standard output. One can also give a ``file`` object (anything with a ``write`` method will do). If a string (different from ``'-'``) is passed to the ``txt`` keyword, a file with that name will be opened and used for output. Use ``txt=None`` to disable all text output. .. _manual_mixer: Density mixing -------------- Three parameters determine how GPAW does Pulay mixing of the densities: * ``beta``: linear mixing coefficient * ``nmaxold``: number of old densities to mix * ``weight``: when measuring the change from input to output density, long wavelength changes are weighted ``weight`` times higher than short wavelength changes For small molecules, the best choice is to use ``mixer=Mixer(beta=0.25, nmaxold=3, weight=1.0)``, which is what GPAW will choose if the system has zero-boundary conditions. If your system is a big molecule or a cluster, it is an advantage to use something like ``mixer=Mixer(beta=0.1, nmaxold=5, weight=50.0)``, which is also what GPAW will choose if the system has periodic boundary conditions in one or more directions. In spin-polarized calculations using Fermi-distribution occupations one has to use ``MixerSum`` instead of ``Mixer``. See also the documentation on :ref:`density mixing `. .. _manual_fixdensity: Fixed density ------------- When calculating band structures or when adding unoccupied states to calculation (and wanting to converge them) it is often useful to use existing density without updating it. By using ``fixdensity=True`` the initial density (e.g. one read from .gpw or existing from previous calculation) is used throughout the SCF-cycle (so called Harris calculation). .. _manual_setups: PAW datasets or pseudopotentials -------------------------------- The ``setups`` keyword is used to specify the name(s) of the setup files used in the calulation. For a given element ``E``, setup name ``NAME``, and xc-functional 'XC', GPAW looks for the file :file:`E.NAME.XC` or :file:`E.NAME.XC.gz` (in that order) in the setup locations (see :ref:`installation of paw datasets`). Unless ``NAME='paw'``, in which case it will simply look for :file:`E.XC` (or :file:`E.XC.gz`). The ``setups`` keyword can be either a single string, or a dictionary. If specified as a string, the given name is used for all atoms. If specified as a dictionary, each keys can be either a chemical symbol or an atom number. The values state the individual setup names. The special key ``'default'`` can be used to specify the default setup name. Thus ``setups={'default': 'paw'}`` is equivalent to ``setups='paw'`` which is the GPAW default. As an example, the latest PAW setup of Na includes also the 6 semicore p states in the valence, in order to use non-default setup with only the 1 s electron in valence (:file:`Na.1.XC.gz`) one can specify ``setups={'Na': '1'}`` There exist three special names that, if used, do not specify a file name: * ``'ae'`` is used for specifying all-electron mode for an atom. I.e. no PAW or pseudo potential is used. * ``sg15`` specifies the `SG15 optimized norm-conserving Vanderbilt pseudopotentials`_ for the PBE functional. These have to be installed separately. Use :command:`gpaw install-data --sg15 {}` to download and unpack the pseudopotentials into :file:`{}/sg15_oncv_upf_{}`. As of now, the SG15 pseudopotentials should still be considered experimental in GPAW. You can plot a UPF pseudopotential by running :file:`gpaw-upfplot {}`. Here, :file:`{}` can be either a direct path to a UPF file or the symbol or identifier to search for in the GPAW setup paths. * ``'hgh'`` is used to specify a norm-conserving Hartwigsen-Goedecker-Hutter pseudopotential (no installation necessary). Some elements have better semicore pseudopotentials. To use those, specify ``'hgh.sc'`` for the elements or atoms in question. * ``'ghost'`` is used to indicated a *ghost* atom in LCAO mode, see :ref:`ghost-atoms`. .. _SG15 optimized norm-conserving Vanderbilt pseudopotentials: http://fpmd.ucdavis.edu/qso/potentials/sg15_oncv/ If a dictionary contains both chemical element specifications *and* atomic number specifications, the latter is dominant. An example:: setups={'default': 'soft', 'Li': 'hard', 5: 'ghost', 'H': 'ae'} Indicates that the files named 'hard' should be used for lithium atoms, an all-electron potential is used for hydrogen atoms, atom number 5 is a ghost atom (even if it is a Li or H atom), and for all other atoms the files named 'soft' will be used. .. _manual_basis: Atomic basis set ---------------- The ``basis`` keyword can be used to specify the basis set which should be used in LCAO mode. This also affects the LCAO initialization in FD or PW mode, where initial wave functions are constructed by solving the Kohn-Sham equations in the LCAO basis. If ``basis`` is a string, :file:`basis='basisname'`, then GPAW will look for files named :file:`{symbol}.{basisname}.basis` in the setup locations (see :ref:`installation of paw datasets`), where :file:`{symbol}` is taken as the chemical symbol from the ``Atoms`` object. If a non-default setup is used for an element, its name is included as :file:`{symbol}.{setupname}.{basisname}.basis`. If ``basis`` is a dictionary, its keys specify atoms or species while its values are corresponding basis names which work as above. Distinct basis sets can be specified for each atomic species by using the atomic symbol as a key, or for individual atoms by using an ``int`` as a key. In the latter case the integer corresponds to the index of that atom in the ``Atoms`` object. As an example, ``basis={'H': 'sz', 'C': 'dz', 7: 'dzp'}`` will use the ``sz`` basis for hydrogen atoms, the ``dz`` basis for carbon, and the ``dzp`` for whichever atom is number 7 in the ``Atoms`` object. .. note:: If you want to use only the ``sz`` basis functinons from a ``dzp`` basis set, then you can use this syntax: ``basis='sz(dzp)'``. This will read the basis functions for, say hydrogen, from the ``H.dzp.basis`` file. If the basis has a custom name, it is specified as ``'szp(mybasis.dzp)'``. The value ``None`` (default) implies that the pseudo partial waves from the setup are used as a basis. This basis is always available; choosing anything else requires the existence of the corresponding basis set file in setup locations (see :ref:`installation of paw datasets`). For details on the LCAO mode and generation of basis set files; see the :ref:`LCAO ` documentation. .. _manual_eigensolver: Eigensolver ----------- The default solver for iterative diagonalization of the Kohn-Sham Hamiltonian is a simple Davidson method, (``eigensolver='dav'``), which seems to perform well in most cases. Sometimes more efficient/stable convergence can be obtained with a different eigensolver. One option is the RMM-DIIS (Residual minimization method - direct inversion in iterative subspace), (``eigensolver='rmm-diis'``), which performs well when only a few unoccupied states are calculated. Another option is the conjugate gradient method (``eigensolver='cg'``), which is very stable but slower. If parallellization over bands is necessary, then Davidson or RMM-DIIS must be used. More control can be obtained by using directly the eigensolver objects:: from gpaw.eigensolvers import CG calc = GPAW(eigensolver=CG(niter=5, rtol=0.20)) Here, ``niter`` specifies the maximum number of conjugate gradient iterations for each band (within a single SCF step), and if the relative change in residual is less than ``rtol``, the iteration for the band is not continued. LCAO mode has its own eigensolver, which directly diagonalizes the Hamiltonian matrix instead of using an iterative method. .. _manual_poissonsolver: Poisson solver -------------- The *poissonsolver* keyword is used to specify a Poisson solver class or enable dipole correction. The default Poisson solver uses a multigrid Jacobian method. Use this keyword to specify a different method. This example corresponds to the default Poisson solver:: from gpaw import GPAW, PoissonSolver calc = GPAW(poissonsolver=PoissonSolver(nn=3, relax='J', eps=2e-10)) The first argument is the stencil, see :ref:`manual_stencils`. Second argument is the method, either ``'J'`` (Jacobian) or ``'GS'`` (Gauss-Seidel). The Gauss-Seidel method requires half as many iterations to solve the Poisson equation, but involves more communication. The Gauss-Seidel implementation also depends slightly on the domain decomposition used. The last argument, ``eps``, is the convergence criterion. .. note:: The Poisson solver is rarely a performance bottleneck, but it can sometimes perform poorly depending on the grid layout. This is mostly important in LCAO calculations, but can be good to know in general. See the LCAO notes on :ref:`Poisson performance `. .. _manual_dipole_correction: The *poissonsolver* keyword can also be used to specify that a dipole correction should be applied along a given axis. The system should be non-periodic in that direction but periodic in the two other directions. :: from gpaw import GPAW correction = {'dipolelayer': 'xy'} calc = GPAW(poissonsolver=correction) Without dipole correction, the potential will approach 0 at all non-periodic boundaries. With dipole correction, there will be a potential difference across the system depending on the size of the dipole moment. Other parameters in this dictionary are forwarded to the Poisson solver:: GPAW(poissonsolver={'dipolelayer': 'xy', 'name': 'fd', 'relax': 'GS'}) An alternative Poisson solver based on Fourier transforms is available for fully periodic calculations:: GPAW(poissonsolver={'name': 'fft'}) The FFT Poisson solver will reduce the dependence on the grid spacing and is in general less picky about the grid. It may be beneficial for non-periodic systems as well, but the system must be set up explicitly as periodic and hence should be well padded with vacuum in non-periodic directions to avoid unphysical interactions across the cell boundary. .. _manual_stencils: Finite-difference stencils -------------------------- GPAW can use finite-difference stencils for the Laplacian in the Kohn-Sham and Poisson equations. You can set the range of the stencil (number of neighbor grid points) used for the Poisson equation like this:: from gpaw import GPAW, PoissonSolver calc = GPAW(poissonsolver=PoissonSolver(nn=n)) This will give an accuracy of `O(h^{2n})`, where ``n`` must be between 1 and 6. The default value is ``n=3``. Similarly, for the Kohn-Sham equation, you can use:: from gpaw import GPAW, FD calc = GPAW(mode=FD(nn=n)) where the default value is also ``n=3``. In PW-mode, the interpolation of the density from the coarse grid to the fine grid is done with FFT's. In FD and LCAO mode, tri-quintic interpolation is used (5. degree polynomium):: from gpaw import GPAW, FD calc = GPAW(mode=FD(interpolation=n)) # or from gpaw import GPAW, LCAO calc = GPAW(mode=LCAO(interpolation=n)) The order of polynomium is `2n-1`, default value is ``n=3`` and ``n`` must be between 1 and 4 (linear, cubic, quintic, heptic). .. _manual_hund: Using Hund's rule for guessing initial magnetic moments ------------------------------------------------------- The ``hund`` keyword can be used for single atoms only. If set to ``True``, the calculation will become spinpolarized, and the initial ocupations, and magnetic moment of the atom will be set to the value required by Hund's rule. You may further wish to specify that the total magnetic moment be fixed, by passing e.g. ``occupations=FermiDirac(0.0, fixmagmom=True)``. Any user specified magnetic moment is ignored. Default is False. .. _manual_external: External potential ------------------ Example:: from gpaw.external import ConstanElectricField calc = GPAW(..., external=ConstanElectricField(2.0, [1, 0, 0]), ...) See also: :mod:`gpaw.external`. .. _manual_verbose: Output verbosity ---------------- By default, only a limited number of information is printed out for each SCF step. It is possible to obtain more information (e.g. for investigating convergen problems in more detail) by ``verbose=1`` keyword. .. _manual_communicator: Communicator object ------------------- By specifying a communicator object, it is possible to use only a subset of processes for the calculator when calculating e.g. different atomic images in parallel. See :ref:`different_calculations_in parallel` for more details. .. _manual_parallel_calculations: --------------------- Parallel calculations --------------------- Information about running parallel calculations can be found on the :ref:`parallel_runs` page. .. _zero_energy: -------------- Total Energies -------------- The GPAW code calculates energies relative to the energy of separated reference atoms, where each atom is in a spin-paired, neutral, and spherically symmetric state - the state that was used to generate the setup. For a calculation of a molecule, the energy will be minus the atomization energy and for a solid, the resulting energy is minus the cohesive energy. So, if you ever get positive energies from your calculations, your system is in an unstable state! .. note:: You don't get the true atomization/cohesive energy. The true number is always lower, because most atoms have a spin-polarized and non-spherical symmetric ground state, with an energy that is lower than that of the spin-paired, and spherically symmetric reference atom. ------------------------ Restarting a calculation ------------------------ The state of a calculation can be saved to a file like this: >>> calc.write('H2.gpw') The file :file:`H2.gpw` is a binary file containing wave functions, densities, positions and everything else (also the parameters characterizing the PAW calculator used for the calculation). If you want to restart the `\rm{H}_2` calculation in another Python session at a later time, this can be done as follows: >>> from gpaw import * >>> atoms, calc = restart('H2.gpw') >>> print atoms.get_potential_energy() Everything will be just as before we wrote the :file:`H2.gpw` file. Often, one wants to restart the calculation with one or two parameters changed slightly. This is very simple to do. Suppose you want to change the number of grid points: >>> atoms, calc = restart('H2.gpw', gpts=(20, 20, 20)) >>> print atoms.get_potential_energy() .. tip:: There is an alternative way to do this, that can be handy sometimes: >>> atoms, calc = restart('H2.gpw') >>> calc.set(gpts=(20, 20, 20)) >>> print atoms.get_potential_energy() More details can be found on the :ref:`restart_files` page. --------------------------------------- Customizing behaviour through observers --------------------------------------- An *observer* function can be *attached* to the calculator so that it will be executed every *N* iterations during a calculation. The below example saves a differently named restart file every 5 iterations:: calc = GPAW(...) occasionally = 5 class OccasionalWriter: def __init__(self): self.iter = 0 def write(self): calc.write('filename.%03d.gpw' % self.iter) self.iter += occasionally calc.attach(OccasionalWriter().write, occasionally) See also :meth:`~gpaw.calculator.GPAW.attach`. .. _command line options: -------------------- Command-line options -------------------- The behaviour of GPAW can be controlled with some command line arguments. The arguments for GPAW should be specified after the python-script, i.e.:: $ python3 script.py --gpaw key1=val1,key2=val2,... The possible keys are: * ``debug=True``: run in debug-mode, e.g. check consistency of arrays passed to c-extensions. * ``dry_run=nprocs``: Print out the computational parameters and estimate memory usage, do not perform actual calculation. Print also which parallelization settings would be employed when run on ``nprocs`` processors. .. tip:: Extra key-value pairs will be available for development work:: $ python3 - --gpaw a=1,b=2.3 >>> from gpaw import extra_parameters >>> extra_parameters {'a': 1, 'b': 2.3} Other command-line arguments: =============================== ============================================= argument description =============================== ============================================= ``--memory-estimate-depth[=n]`` Print out an itemized memory estimate by stepping recursively through the object hierarchy of the calculator. If ``n`` is specified, print a summary for depths greater than the specified value. Default: ``n=2`` ``--domain-decomposition=comp`` Specify the domain decomposition with ``comp`` as a positive integer or, for greater control, a tuple of three integers. Allowed values are equivalent to those of the ``domain`` argument in the :ref:`parallel ` keyword, with tuples specified as ``nx,ny,nz``. See :ref:`manual_parsize_domain` for details. ``--state-parallelization=nbg`` Specify the parallelization over Kohn-Sham orbitals with ``nbg`` as a positive integer. Allowed values are equivalent to those of the ``band`` argument in the :ref:`parallel ` keyword. See :ref:`manual_parsize_bands` for details. ``--sl_...=m,n,mb`` Specify ScaLAPACK / BLACS parameters for diagonalization (``--sl_default``), inverse Cholesky factorization (``--sl_inverse_cholesky``) and LCAO general diagonalization (``--sl_lcao``) respectively. Use ``--sl_default`` to specify all three of the above at once or just the default value for those not explicitly given. Allowed values are equivalent to those of the four ``sl_...`` arguments in the :ref:`parallel ` keyword. Requires GPAW to be built with ScaLAPACK. =============================== ============================================= .. [#LDA] J. P. Perdew and Y. Wang, Accurate and simple analytic representation of the electron-gas correlation energy *Phys. Rev. B* **45**, 13244-13249 (1992) .. [#PBE] J. P. Perdew, K. Burke, and M. Ernzerhof, Generalized Gradient Approximation Made Simple, *Phys. Rev. Lett.* **77**, 3865 (1996) .. [#revPBE] Y. Zhang and W. Yang, Comment on "Generalized Gradient Approximation Made Simple", *Phys. Rev. Lett.* **80**, 890 (1998) .. [#RPBE] B. Hammer, L. B. Hansen and J. K. Nørskov, Improved adsorption energetics within density-functional theory using revised Perdew-Burke-Ernzerhof functionals, *Phys. Rev. B* **59**, 7413 (1999) .. [#PBE0] C. Adamo and V. Barone, *J. Chem. Phys.* **110** 6158-6170 (1999) Toward reliable density functional methods without adjustable parameters: The PBE0 model .. [#B3LYP] P. J. Stephens, F. J. Devlin, C. F. Chabalowski, and M.J. Frisch, *J. Phys. Chem.* **98** 11623-11627 (1994) Ab-Initio Calculation of Vibrational Absorption and Circular-Dichroism Spectra Using Density-Functional Force-Fields gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/orthogonalization.rst000066400000000000000000000046421316441372200300540ustar00rootroot00000000000000.. _orthogonalization: ================================== Orthogonalizing the wave functions ================================== Let `\tilde{\Psi}_{nG}` be an element of a wave function matrix holding the value of `\tilde{\psi}_{n}(\mathbf{r}_G)` (state number `n` and grid point number `G`). Then we can write the :ref:`orthogonality requirement ` like this: .. math:: \Delta v \tilde{\mathbf{\Psi}}^T \hat{\mathbf{O}} \tilde{\mathbf{\Psi}} = \mathbf{1}, where `\Delta v` is the volume per grid point and .. math:: \hat{\mathbf{O}} = \mathbf{1} + \sum_a \tilde{\mathbf{P}}^a \mathbf{\Delta O}^a (\tilde{\mathbf{P}}^a)^T \Delta v is the matrix form of the overlap operator. This matrix is very sparse because the projector functions `\tilde{P}^a_{iG} = \tilde{p}^a_i(\mathbf{r}_G - \mathbf{R}^a)` are localized inside the augmentation spheres. The `\Delta O^a_{i_1i_2}` atomic PAW overlap corrections are small `N_p^a \times N_p^a` matrices (`N_p^a \sim 10`) defined :ref:`here `. Gram-Schmidt procedure ====================== The traditional sequential Gram-Schmidt orthogonalization procedure is not very efficient, so we do some linear algebra to allow us to use efficient matrix-matrix products. Let `\tilde{\mathbf{\Psi}}_0` be the non-orthogonal wave functions. We calculate the overlap matrix: .. math:: \mathbf{S} = \Delta v \tilde{\mathbf{\Psi}}_0^T \hat{\mathbf{O}} \tilde{\mathbf{\Psi}}_0, from the raw overlap `\tilde{\mathbf{\Psi}}_0^T \tilde{\mathbf{\Psi}}_0` and the projections `(\tilde{\mathbf{P}}^a)^T \tilde{\mathbf{\Psi}}_0`. This can be Cholesky factored into `\mathbf{S} = \mathbf{L}^T \mathbf{L}` and we can get the orthogonalized wave functions as: .. math:: \tilde{\mathbf{\Psi}} = \tilde{\mathbf{\Psi}}_0 \mathbf{L}^{-1}. Parallelization =============== The orthogonalization can be paralleized over **k**-points, spins, domains, and bands. **k**-points and spins ---------------------- Each **k**-point and each spin can be treated separately. Domains ------- Each domain will have its contribution to the overlap matrix, and these will have to be summed up using the domain communicator. The dense linear algebra can be performed in a replication fashion on all MPI tasks using LAPACK or in parallel on a subset of MPI tasks using ScaLAPACK. Bands ----- Band parallelization is described at :ref:`Band parallelization `. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/000077500000000000000000000000001316441372200264055ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/000077500000000000000000000000001316441372200302275ustar00rootroot00000000000000pdsyevd/000077500000000000000000000000001316441372200316265ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapackMakefile000066400000000000000000000005521316441372200332700ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevdinclude Makefile.fjorm COMPILE = $(CC) $(CFLAGS) $(INCLUDEMPI) -c %.o: %.c $(COMPILE) $*.c -o $@ SOURCES = main.c OBJECTS = $(SOURCES:%.c=%.o) PDSYEV = test.exe all: $(PDSYEV) pdsyev: $(PDSYEV) LINK = $(F77) LIBS = $(LIBSCALAPACK) $(LIBBLACS) $(LIBBLAS) $(LIBMPI) $(LDFLAGS) test.exe: main.o $(LINK) main.o $(LIBS) -o $@ clean: rm -f $(PDSYEV) main.o Makefile.fjorm000066400000000000000000000015701316441372200344050ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevdCC = /opt/openmpi/1.3.3-1.el5.fys.gfortran43.4.3.2/bin/mpicc F77 = /opt/openmpi/1.3.3-1.el5.fys.gfortran43.4.3.2/bin/mpicc CFLAGS = -O3 -Wall -I./include -DGPAW_NO_UNDERSCORE_CBLACS -DGPAW_NO_UNDERSCORE_CSCALAPACK -std=c99 INCLUDEMPI = -I/opt/openmpi/1.3.3-1.el5.fys.gfortran43.4.3.2/include LDFLAGS = -O3 -lgfortran LIBSCALAPACK = /opt/scalapack/1.8.0/1.el5.fys.gfortran43.4.3.2.openmpi.1.3.3.acml.4.3.0.acml.4.3.0/lib64/libscalapack.a LIBBLACS = /opt/blacs/1.1/24.el5.fys.gfortran43.4.3.2.openmpi.1.3.3/lib64/libmpiblacsCinit.a /opt/blacs/1.1/24.el5.fys.gfortran43.4.3.2.openmpi.1.3.3/lib64/libmpiblacs.a /opt/blacs/1.1/24.el5.fys.gfortran43.4.3.2.openmpi.1.3.3/lib64/libmpiblacsCinit.a /opt/blacs/1.1/24.el5.fys.gfortran43.4.3.2.openmpi.1.3.3/lib64/libmpiblacs.a LIBBLAS = /opt/acml/4.3.0/gfortran4364/lib/libacml.a LIBMPI = -L/opt/openmpi/1.3.3-1.el5.fys.gfortran43.4.3.2/lib64 -lmpi Makefile.surveyor000066400000000000000000000013111316441372200351570ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevdCC = /bgsys/drivers/ppcfloor/comm/bin/mpicc F77 = /bgsys/drivers/ppcfloor/comm/bin/mpicc CFLAGS = -O3 -Wall -I./include -DGPAW_NO_UNDERSCORE_CBLACS -DGPAW_NO_UNDERSCORE_CSCALAPACK -DGPAW_NO_UNDERSCORE_BLACS -DGPAW_NO_UNDERSCORE_SCALAPACK -std=c99 INCLUDEMPI = -I/bgsys/drivers/ppcfloor/comm/include LDFLAGS = -O3 -L/opt/ibmcmp/xlf/bg/11.1/bglib -lxlf90_r -lxlopt -lxl -lxlfmath -L/opt/ibmcmp/xlsmp/bg/1.7/bglib -lxlsmp LIBSCALAPACK = /soft/apps/LAPACK/liblapack_bgp.a /soft/apps/SCALAPACK/libscalapack.a LIBBLACS = /soft/apps/BLACS/libblacsCinit_MPI-BGP-0.a /soft/apps/BLACS/libblacs_MPI-BGP-0.a LIBBLAS = /soft/apps/LAPACK/liblapack_bgp.a /soft/apps/LIBGOTO/libgoto.a LIBMPI = -L/bgsys/drivers/ppcfloor/comm/lib diag.c000066400000000000000000000305651316441372200327070ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevd#include #include #include #include #include #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) // BLACS #ifdef GPAW_NO_UNDERSCORE_CBLACS #define Cblacs_barrier_ Cblacs_barrier #define Cblacs_exit_ Cblacs_exit #define Cblacs_get_ Cblacs_get #define Cblacs_gridexit_ Cblacs_gridexit #define Cblacs_gridinfo_ Cblacs_gridinfo #define Cblacs_gridinit_ Cblacs_gridinit #define Cblacs_pinfo_ Cblacs_pinfo #define Cblacs_pnum_ Cblacs_pnum #define Cblacs_setup_ Cblacs_setup #define Csys2blacs_handle_ Csys2blacs_handle #endif #ifdef GPAW_NO_UNDERSCORE_BLACS #define dgebr2d_ dgebr2d #define dgebs2d_ dgebs2d #define zgebr2d_ zgebr2d #define zgebs2d_ zgebs2d #endif void Cblacs_barrier_(int ConTxt, char *scope); void Cblacs_exit_(int NotDone); void Cblacs_get_(int ConTxt, int what, int* val); void Cblacs_gridexit_(int ConTxt); void Cblacs_gridinfo_(int ConTxt, int *nprow, int *npcol, int *myrow, int *mycol); void Cblacs_gridinit_(int *ConTxt, char* order, int nprow, int npcol); void Cblacs_pinfo_(int *mypnum, int *nprocs); int Cblacs_pnum_(int ConTxt, int prow, int pcol); void Cblacs_setup_(int *mypnum, int *nprocs); int Csys2blacs_handle_(MPI_Comm SysCtxt); void dgebr2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda, int *rsrc, int *csrc); void dgebs2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda); void zgebr2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda, int *rsrc, int *csrc); void zgebs2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda); // End of BLACS // ScaLapack #ifdef GPAW_NO_UNDERSCORE_SCALAPACK #define descinit_ descinit #define numroc_ numroc #define pdelset_ pdelset #define pzelset_ pzelset #define pdlaset_ pdlaset #define pzlaset_ pzlaset #define pdgemr2d_ pdgemr2d #define pdlamch_ pdlamch #define pdpotrf_ pdpotrf #define pdpotri_ pdpotri #define pzpotrf_ pzpotrf #define pzpotri_ pzpotri #define pdtrtri_ pdtrtri #define pztrtri_ pztrtri #define pdsyevd_ pdsyevd #define pdsyev_ pdsyev #define pdsyevx_ pdsyevx #define pdsygvx_ pdsygvx #define pzheev_ pzheev #define sl_init_ sl_init #endif #ifdef GPAW_NO_UNDERSCORE_CSCALAPACK #define Cpdgemr2d_ Cpdgemr2d #endif #ifdef GPAW_SECOND_UNDERSCORE_SL_INIT #define sl_init_ sl_init__ #endif void descinit_(int* desc, int* m, int* n, int* mb, int* nb, int* irsrc, int* icsrc, int* ictxt, int* lld, int* info); int numroc_(int* n, int* nb, int* iproc, int* isrcproc, int* nprocs); void pdelset_(double* a,int* ia,int* ja,int* desca,double* alpha); void pzelset_(void* a,int* ia,int* ja,int* desca,void* alpha); void pdlaset_(char* uplo, int* m, int* n, double* alpha, double* beta, double* a, int* ia, int* ja, int* desca); void pzlaset_(char* uplo, int* m, int* n, void* alpha, void* beta, void* a, int* ia, int* ja, int* desca); int pdgemr2d_(int* m, int*n, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb, int* ctxt); double pdlamch_(int* ictxt, char* cmach); void Cpdgemr2d_(int m, int n, double *A, int IA, int JA, int *descA, double *B, int IB, int JB, int *descB, int gcontext); // cholesky void pdpotrf_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pdpotri_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pzpotrf_(char *uplo, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pzpotri_(char *uplo, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pdtrtri_(char *uplo, char *diag, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pztrtri_(char *uplo, char *diag, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pdsyevd_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *info); void pdsyev_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *info); void pdsyevx_(char *jobz, char *range, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *ifail, int *iclustr, double* gap, int *info); void pdsygvx_(int *ibtype, char *jobz, char *range, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double* b, int *ib, int* jb, int* descb, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *ifail, int *iclustr, double* gap, int *info); void pzheev_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, double *rwork, int *lrwork, int *info); void sl_init_(int* ictxt, int* nprow, int* npcol); // End of ScaLapack // int MPIX_Get_last_algorithm(MPI_Comm comm, int *lastalgorithm); int main(int argc, char *argv[]) { // Some constants int minusone = -1; int zero = 0; int one = 1; double dzero = 0.0; // ConText int ConTxt = minusone; // order char order = 'R'; char scope = 'A'; // root process int root = zero; // BLACS/SCALAPACK parameters // the size of the blocks the distributed matrix is split into // (applies to both rows and columns) int mb = 32; int nb = mb; // PDSYEVxxx constraint // the number of rows and columns in the processor grid // only square processor grids due to C vs. Fortran ordering int nprow = 2; int npcol = nprow; // only square processor grids, // starting row and column in grid, do not change int rsrc = zero; int csrc = zero; // dimensions of the matrix to diagonalize int m = 1000; int n = m; // only square matrices int info = zero; // Rest of code will only work for: // nprow = npcol // mb = nb; // m = n; // rsrc = crsc; // Paramteres for Trivial Matrix double alpha = 0.1; // off-diagonal double beta = 75.0; // diagonal // For timing: double tdiag0, tdiag, ttotal0, ttotal; // BLACS Communicator MPI_Comm blacs_comm; int nprocs; int iam; int myrow, mycol; MPI_Init(&argc, &argv); MPI_Barrier(MPI_COMM_WORLD); ttotal0 = MPI_Wtime(); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &iam); if (argc > one) { nprow = strtod(argv[1],NULL); m = strtod(argv[2],NULL); npcol = nprow; n = m; } if (iam == root) { printf("world size %d \n",nprocs); printf("n %d \n", n); printf("nprow %d \n", nprow); printf("npcol %d \n", npcol); } // We can do this on any subcommunicator. #ifdef CartComm int dim[2]; int pbc[2]; dim[0] = nprow; dim[1] = npcol; pbc[0] = 0; pbc[1] = 0; MPI_Cart_create(MPI_COMM_WORLD, 2, dim, pbc, 1, &blacs_comm); #else blacs_comm = MPI_COMM_WORLD; #endif // initialize the grid // The lines below are equivalent to the one call to: if (blacs_comm != MPI_COMM_NULL) { ConTxt = Csys2blacs_handle_(blacs_comm); Cblacs_gridinit_(&ConTxt, &order, nprow, npcol); // get information back about the grid Cblacs_gridinfo_(ConTxt, &nprow, &npcol, &myrow, &mycol); } if (ConTxt != minusone) { int desc[9]; // get the size of the distributed matrix int locM = numroc_(&m, &mb, &myrow, &rsrc, &nprow); int locN = numroc_(&n, &nb, &mycol, &csrc, &npcol); // printf ("locM = %d \n", locM); // printf ("locN = %d \n", locN); int lld = MAX(one,locM); // build the descriptor descinit_(desc, &m, &n, &mb, &nb, &rsrc, &csrc, &ConTxt, &lld, &info); // Allocate arrays // eigenvalues double* eigvals = malloc(n * sizeof(double)); // allocate the distributed matrices double* mata = malloc(locM*locN * sizeof(double)); // allocate the distributed matrix of eigenvectors double* z = malloc(locM*locN * sizeof(double)); // Eigensolver parameters int ibtype = one; char jobz = 'V'; // eigenvectors also char range = 'A'; // all eiganvalues char uplo = 'L'; // work with upper double vl, vu; int il, iu; char cmach = 'U'; double abstol = 2.0 * pdlamch_(&ConTxt, &cmach); int eigvalm, nz; double orfac = -1.0; //double orfac = 0.001; int* ifail; ifail = malloc(m * sizeof(int)); int* iclustr; iclustr = malloc(2*nprow*npcol * sizeof(int)); double* gap; gap = malloc(nprow*npcol * sizeof(double)); double* work; work = malloc(3 * sizeof(double)); int querylwork = minusone; int* iwork; iwork = malloc(1 * sizeof(int)); int queryliwork = minusone; // Build a trivial distributed matrix: Diagonal matrix pdlaset_(&uplo, &m, &n, &alpha, &beta, mata, &one, &one, desc); // First there is a workspace query // pdsyevx_(&jobz, &range, &uplo, &n, mata, &one, &one, desc, &vl, // &vu, &il, &iu, &abstol, &eigvalm, &nz, eigvals, &orfac, z, &one, // &one, desc, work, &querylwork, iwork, &queryliwork, ifail, iclustr, gap, &info); pdsyevd_(&jobz, &uplo, &n, mata, &one, &one, desc, eigvals, z, &one, &one, desc, work, &querylwork, iwork, &queryliwork, &info); //pdsyev_(&jobz, &uplo, &m, mata, &one, &one, desc, eigvals, // z, &one, &one, desc, work, &querylwork, &info); int lwork = (int)work[0]; //printf("lwork %d\n", lwork); free(work); int liwork = (int)iwork[0]; //printf("liwork %d\n", liwork); free(iwork); work = (double*)malloc(lwork * sizeof(double)); iwork = (int*)malloc(liwork * sizeof(int)); // This is actually diagonalizes the matrix // pdsyevx_(&jobz, &range, &uplo, &n, mata, &one, &one, desc, &vl, // &vu, &il, &iu, &abstol, &eigvalm, &nz, eigvals, &orfac, z, &one, // &one, desc, work, &lwork, iwork, &liwork, ifail, iclustr, gap, &info); Cblacs_barrier(ConTxt, &scope); tdiag0 = MPI_Wtime(); pdsyevd_(&jobz, &uplo, &n, mata, &one, &one, desc, eigvals, z, &one, &one, desc, work, &lwork, iwork, &liwork, &info); //pdsyev_(&jobz, &uplo, &m, mata, &one, &one, desc, eigvals, // z, &one, &one, desc, work, &lwork, &info); Cblacs_barrier(ConTxt, &scope); tdiag = MPI_Wtime() - tdiag0; free(work); free(iwork); free(gap); free(iclustr); free(ifail); free(z); free(mata); // Destroy BLACS grid Cblacs_gridexit_(ConTxt); // Check eigenvalues if (myrow == zero && mycol == zero) { for (int i = 0; i < n; i++) { if (fabs(eigvals[i] - beta) > 0.0001) printf("Problem: eigval %d != %f5.2 but %f\n", i, beta, eigvals[i]); } if (info != zero) { printf("info = %d \n", info); } printf("Time (s) diag: %f\n", tdiag); } free(eigvals); } MPI_Barrier(MPI_COMM_WORLD); ttotal = MPI_Wtime() - ttotal0; if (iam == 0) printf("Time (s) total: %f\n", ttotal); MPI_Finalize(); } fjorm.sh000066400000000000000000000005551316441372200333040ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevd#!/bin/bash #PBS -l nodes=1:ppn=4 . /home/camp/modulefiles.sh module load openmpi/1.3.3-1.el5.fys.gfortran43.4.3.2 module load blacs-gfortran4364/1.1-24.el5.fys.gfortran43.4.3.2.openmpi.1.3.3 module load acml-gfortran4364/4.3.0-1.el5.fys module load scalapack-gfortran4364/1.8.0-1.el5.fys.gfortran43.4.3.2.openmpi.1.3.3.acml.4.3.0.acml.4.3.0 mpirun -np 4 test.exe householder.c000066400000000000000000000252021316441372200343140ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevd#include #include #include #include #include #ifdef BGP #include #endif #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) // BLACS #ifdef GPAW_NO_UNDERSCORE_CBLACS #define Cblacs_barrier_ Cblacs_barrier #define Cblacs_exit_ Cblacs_exit #define Cblacs_get_ Cblacs_get #define Cblacs_gridexit_ Cblacs_gridexit #define Cblacs_gridinfo_ Cblacs_gridinfo #define Cblacs_gridinit_ Cblacs_gridinit #define Cblacs_pinfo_ Cblacs_pinfo #define Cblacs_pnum_ Cblacs_pnum #define Cblacs_setup_ Cblacs_setup #define Csys2blacs_handle_ Csys2blacs_handle #endif #ifdef GPAW_NO_UNDERSCORE_BLACS #define dgebr2d_ dgebr2d #define dgebs2d_ dgebs2d #define zgebr2d_ zgebr2d #define zgebs2d_ zgebs2d #endif void Cblacs_barrier_(int ConTxt, char *scope); void Cblacs_exit_(int NotDone); void Cblacs_get_(int ConTxt, int what, int* val); void Cblacs_gridexit_(int ConTxt); void Cblacs_gridinfo_(int ConTxt, int *nprow, int *npcol, int *myrow, int *mycol); void Cblacs_gridinit_(int *ConTxt, char* order, int nprow, int npcol); void Cblacs_pinfo_(int *mypnum, int *nprocs); int Cblacs_pnum_(int ConTxt, int prow, int pcol); void Cblacs_setup_(int *mypnum, int *nprocs); int Csys2blacs_handle_(MPI_Comm SysCtxt); void dgebr2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda, int *rsrc, int *csrc); void dgebs2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda); void zgebr2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda, int *rsrc, int *csrc); void zgebs2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda); // End of BLACS // ScaLapack #ifdef GPAW_NO_UNDERSCORE_SCALAPACK #define descinit_ descinit #define numroc_ numroc #define pdelset_ pdelset #define pzelset_ pzelset #define pdlaset_ pdlaset #define pzlaset_ pzlaset #define pdgemr2d_ pdgemr2d #define pdlamch_ pdlamch #define pdpotrf_ pdpotrf #define pdpotri_ pdpotri #define pzpotrf_ pzpotrf #define pzpotri_ pzpotri #define pdtrtri_ pdtrtri #define pztrtri_ pztrtri #define pdsytrd_ pdsytrd #define pdsyevd_ pdsyevd #define pdsyev_ pdsyev #define pdsyevx_ pdsyevx #define pdsygvx_ pdsygvx #define pzheev_ pzheev #define sl_init_ sl_init #endif #ifdef GPAW_NO_UNDERSCORE_CSCALAPACK #define Cpdgemr2d_ Cpdgemr2d #endif #ifdef GPAW_SECOND_UNDERSCORE_SL_INIT #define sl_init_ sl_init__ #endif void descinit_(int* desc, int* m, int* n, int* mb, int* nb, int* irsrc, int* icsrc, int* ictxt, int* lld, int* info); int numroc_(int* n, int* nb, int* iproc, int* isrcproc, int* nprocs); void pdelset_(double* a,int* ia,int* ja,int* desca,double* alpha); void pzelset_(void* a,int* ia,int* ja,int* desca,void* alpha); void pdlaset_(char* uplo, int* m, int* n, double* alpha, double* beta, double* a, int* ia, int* ja, int* desca); void pzlaset_(char* uplo, int* m, int* n, void* alpha, void* beta, void* a, int* ia, int* ja, int* desca); int pdgemr2d_(int* m, int*n, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb, int* ctxt); double pdlamch_(int* ictxt, char* cmach); void Cpdgemr2d_(int m, int n, double *A, int IA, int JA, int *descA, double *B, int IB, int JB, int *descB, int gcontext); // cholesky void pdpotrf_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pdpotri_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pzpotrf_(char *uplo, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pzpotri_(char *uplo, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pdtrtri_(char *uplo, char *diag, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pztrtri_(char *uplo, char *diag, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pdsytrd_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *d, double *e, double *tau, double *work, int *lwork, int *info); void pdsyevd_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *info); void pdsyev_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *info); void pdsyevx_(char *jobz, char *range, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *ifail, int *iclustr, double* gap, int *info); void pdsygvx_(int *ibtype, char *jobz, char *range, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double* b, int *ib, int* jb, int* descb, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *ifail, int *iclustr, double* gap, int *info); void pzheev_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, double *rwork, int *lrwork, int *info); void sl_init_(int* ictxt, int* nprow, int* npcol); // End of ScaLapack // int MPIX_Get_last_algorithm(MPI_Comm comm, int *lastalgorithm); int main(int argc, char *argv[]) { // Some constants int minusone = -1; int zero = 0; int one = 1; double dzero = 0.0; // ConText int ConTxt = minusone; // order char order = 'R'; char scope = 'A'; // root process int root = zero; // BLACS/SCALAPACK parameters // the size of the blocks the distributed matrix is split into // (applies to both rows and columns) int mb = 32; int nb = mb; // PDSYEVxxx constraint // the number of rows and columns in the processor grid // only square processor grids due to C vs. Fortran ordering int nprow = 2; int npcol = nprow; // only square processor grids, // starting row and column in grid, do not change int rsrc = zero; int csrc = zero; // dimensions of the matrix to diagonalize int m = 1000; int n = m; // only square matrices int info = zero; // Rest of code will only work for: // nprow = npcol // mb = nb; // m = n; // rsrc = crsc; // Paramteres for Trivial Matrix double alpha = 0.1; // off-diagonal double beta = 75.0; // diagonal // For timing: double tdiag0, tdiag, ttotal0, ttotal; // BLACS Communicator MPI_Comm blacs_comm; int nprocs; int iam; int myrow, mycol; int result; MPI_Init(&argc, &argv); MPI_Barrier(MPI_COMM_WORLD); ttotal0 = MPI_Wtime(); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &iam); if (argc > one) { nprow = strtod(argv[1],NULL); m = strtod(argv[2],NULL); npcol = nprow; n = m; } // We can do this on any subcommunicator. #ifdef CartComm int dim[2]; int pbc[2]; dim[0] = nprow; dim[1] = npcol; pbc[0] = 0; pbc[1] = 0; MPI_Cart_create(MPI_COMM_WORLD, 2, dim, pbc, 1, &blacs_comm); #else blacs_comm = MPI_COMM_WORLD; #endif if (iam == root) { printf("world size %d \n",nprocs); printf("n %d \n", n); printf("nprow %d \n", nprow); printf("npcol %d \n", npcol); #ifdef BGP MPIX_Get_property(blacs_comm, MPIDO_RECT_COMM, &result); if (result) printf("this is a rectangular communicator\n"); #endif } // initialize the grid // The lines below are equivalent to the one call to: if (blacs_comm != MPI_COMM_NULL) { ConTxt = Csys2blacs_handle_(blacs_comm); Cblacs_gridinit_(&ConTxt, &order, nprow, npcol); // get information back about the grid Cblacs_gridinfo_(ConTxt, &nprow, &npcol, &myrow, &mycol); } if (ConTxt != minusone) { int desc[9]; // get the size of the distributed matrix int locM = numroc_(&m, &mb, &myrow, &rsrc, &nprow); int locN = numroc_(&n, &nb, &mycol, &csrc, &npcol); // printf ("locM = %d \n", locM); // printf ("locN = %d \n", locN); int lld = MAX(one,locM); // build the descriptor descinit_(desc, &m, &n, &mb, &nb, &rsrc, &csrc, &ConTxt, &lld, &info); // Allocate arrays double* mata = malloc(locM*locN * sizeof(double)); double* matd = malloc(locM*locN * sizeof(double)); double* mate = malloc(locM*locN * sizeof(double)); double* tau = malloc(locM*locN * sizeof(double)); double* work; work = malloc(3 * sizeof(double)); int querylwork = minusone; // Build a trivial distributed matrix: Diagonal matrix char uplo = 'L'; // work with upper pdlaset_(&uplo, &m, &n, &alpha, &beta, mata, &one, &one, desc); // First there is a workspace query pdsytrd_(&uplo, &n, mata, &one, &one, desc, matd, mate, tau, work, &querylwork, &info); int lwork = (int)work[0]; //printf("lwork %d\n", lwork); free(work); work = (double*)malloc(lwork * sizeof(double)); // This is actually performs the tridiagonalization tdiag0 = MPI_Wtime(); Cblacs_barrier(ConTxt, &scope); pdsytrd_(&uplo, &n, mata, &one, &one, desc, matd, mate, tau, work, &lwork, &info); Cblacs_barrier(ConTxt, &scope); tdiag = MPI_Wtime() - tdiag0; free(work); free(mata); free(matd); free(mate); free(tau); // Destroy BLACS grid Cblacs_gridexit_(ConTxt); // Print time if (myrow == zero && mycol == zero) { if (info != zero) { printf("info = %d \n", info); } printf("Time (s) diag: %f\n", tdiag); } } MPI_Barrier(MPI_COMM_WORLD); ttotal = MPI_Wtime() - ttotal0; if (iam == 0) printf("Time (s) total: %f\n", ttotal); MPI_Finalize(); } main.c000066400000000000000000000307171316441372200327260ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevd#include #include #include #include "mpi.h" #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) // BLACS #ifdef GPAW_NO_UNDERSCORE_CBLACS #define Cblacs_barrier_ Cblacs_barrier #define Cblacs_exit_ Cblacs_exit #define Cblacs_get_ Cblacs_get #define Cblacs_gridexit_ Cblacs_gridexit #define Cblacs_gridinfo_ Cblacs_gridinfo #define Cblacs_gridinit_ Cblacs_gridinit #define Cblacs_pinfo_ Cblacs_pinfo #define Cblacs_pnum_ Cblacs_pnum #define Cblacs_setup_ Cblacs_setup #endif #ifdef GPAW_NO_UNDERSCORE_BLACS #define dgebr2d_ dgebr2d #define dgebs2d_ dgebs2d #define zgebr2d_ zgebr2d #define zgebs2d_ zgebs2d #endif void Cblacs_barrier_(int ConTxt, char *scope); void Cblacs_exit_(int NotDone); void Cblacs_get_(int ConTxt, int what, int* val); void Cblacs_gridexit_(int ConTxt); void Cblacs_gridinfo_(int ConTxt, int *nprow, int *npcol, int *myrow, int *mycol); void Cblacs_gridinit_(int *ConTxt, char* order, int nprow, int npcol); void Cblacs_pinfo_(int *mypnum, int *nprocs); int Cblacs_pnum_(int ConTxt, int prow, int pcol); void Cblacs_setup_(int *mypnum, int *nprocs); void dgebr2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda, int *rsrc, int *csrc); void dgebs2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda); void zgebr2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda, int *rsrc, int *csrc); void zgebs2d_(int *ConTxt, char* scope, char* top, int *m, int *n, double *A, int *lda); // End of BLACS // ScaLapack #ifdef GPAW_NO_UNDERSCORE_SCALAPACK #define descinit_ descinit #define numroc_ numroc #define pdelset_ pdelset #define pzelset_ pzelset #define pdgemr2d_ pdgemr2d #define pdlamch_ pdlamch #define pdpotrf_ pdpotrf #define pdpotri_ pdpotri #define pzpotrf_ pzpotrf #define pzpotri_ pzpotri #define pdtrtri_ pdtrtri #define pztrtri_ pztrtri #define pdsyevd_ pdsyevd #define pdsyev_ pdsyev #define pdsyevx_ pdsyevx #define pdsygvx_ pdsygvx #define pzheev_ pzheev #define sl_init_ sl_init #endif #ifdef GPAW_NO_UNDERSCORE_CSCALAPACK #define Cpdgemr2d_ Cpdgemr2d #endif #ifdef GPAW_SECOND_UNDERSCORE_SL_INIT #define sl_init_ sl_init__ #endif void descinit_(int* desc, int* m, int* n, int* mb, int* nb, int* irsrc, int* icsrc, int* ictxt, int* lld, int* info); int numroc_(int* n, int* nb, int* iproc, int* isrcproc, int* nprocs); void pdelset_(double* a,int* ia,int* ja,int* desca,double* alpha); //void pdelset2_(double* alpha,double* a,int* ia,int* ja,int* desca,double* beta); void pzelset_(void* a,int* ia,int* ja,int* desca,void* alpha); int pdgemr2d_(int* m, int*n, double* a, int* ia, int* ja, int* desca, double* b, int* ib, int* jb, int* descb, int* ctxt); double pdlamch_(int* ictxt, char* cmach); void Cpdgemr2d_(int m, int n, double *A, int IA, int JA, int *descA, double *B, int IB, int JB, int *descB, int gcontext); // cholesky void pdpotrf_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pdpotri_(char *uplo, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pzpotrf_(char *uplo, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pzpotri_(char *uplo, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pdtrtri_(char *uplo, char *diag, int *n, double* a, int *ia, int* ja, int* desca, int *info); void pztrtri_(char *uplo, char *diag, int *n, void* a, int *ia, int* ja, int* desca, int *info); void pdsyevd_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *info); void pdsyev_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *info); void pdsyevx_(char *jobz, char *range, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *ifail, int *iclustr, double* gap, int *info); void pdsygvx_(int *ibtype, char *jobz, char *range, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double* b, int *ib, int* jb, int* descb, double* vl, double* vu, int* il, int* iu, double* abstol, int* m, int* nz, double* w, double* orfac, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, int *iwork, int *liwork, int *ifail, int *iclustr, double* gap, int *info); void pzheev_(char *jobz, char *uplo, int *n, double* a, int *ia, int* ja, int* desca, double *w, double* z, int *iz, int* jz, int* descz, double *work, int *lwork, double *rwork, int *lrwork, int *info); void sl_init_(int* ictxt, int* nprow, int* npcol); // End of ScaLapack void buildCustomMatrix(double* m, int row, int col) { int r,c; for(r = 0; r < row; r++) { for(c = 0 ; c < col; c++) { m[r*row+c] = -(r+c+1); if (r != c) {m[r*row+c] = m[r*row+c] / (row+col+1);}; //// if (r != c) {m[r*row+c] = 0.0;}; } } } void printMatrix(double* m, int row, int col, int myrow, int mycol) { int r,c; printf("p(%d, %d)\n", myrow, mycol); for(r = 0; r < row; r++) { for(c = 0 ; c < col; c++) printf("%f ", m[r*row+c]); printf("\n"); } } int main(int argc, char **argv) { static int minusone = -1; static int zero = 0; static int one = 1; // root process int root = zero; // the size of the blocks the distributed matrix is split into // (applies to both rows and columns) int mb = 1; int nb = mb; // the number of rows in the process grid // over which the matrix is distributed int nprow = 1; // the number of columns in the process grid // over which the matrix is distributed int npcol = 1; // dimensions of the matrix to diagonalize int n = 2; int m = n; int lda = n; int ldb = n; int ibtype = 1; int info = 0; int iam = -1; int ConTxt; // 2x2 blacs grid nprow = 1; npcol = 1; MPI_Init(&argc, &argv); // initialize the grid sl_init_(&ConTxt, &nprow, &npcol); // get information back about the grid int myrow = -1; int mycol = -1; Cblacs_gridinfo_(ConTxt, &nprow, &npcol, &myrow, &mycol); int pnum; char TOP = ' '; // ? char scope = 'A'; // All grid int rsrc = 0; int csrc = 0; // matrix to be diagonalized double* a = (double*)malloc(n*m * sizeof(double)); // eigenvalues double* eigvals = (double*)malloc(n * sizeof(double)); int row = n; int col = m; if (myrow == 0 && mycol == 0) { buildCustomMatrix(a, row, col); } if (myrow == 0 && mycol == 0) { printMatrix(a, row, col, myrow, mycol); } if (myrow != -1 && mycol != -1) { // Returns the system process number of the process in the process grid pnum = Cblacs_pnum_(ConTxt, myrow, mycol); // build the descriptor int desc0[9]; descinit_(desc0, &m, &n, &m, &n, &rsrc, &csrc, &ConTxt, &m, &info); // distribute the full matrix to the process grid if (pnum == root) { //printf("C diagonalize ScaLapack\n"); // http://icl.cs.utk.edu/lapack-forum/viewtopic.php?p=87& // distribute the matrix // Uncomment for PDSYEV: //printf("run %d\n", 1); dgebs2d_(&ConTxt,&scope,&TOP,&m,&n,a,&lda); //printf("run %d\n", 2); // Uncomment for PZHEEV: //zgebs2d_(&ConTxt,&scope,&TOP,&m,&n,&a,&lda); } else { // receive the matrix // Uncomment for PDSYEV: //printf("run %d\n", 3); dgebr2d_(&ConTxt,&scope,&TOP,&m,&n,a,&lda,&rsrc,&csrc); //printf("run %d\n", 4); // Uncomment for PZHEEV: //zgebr2d_(&ConTxt,&scope,&TOP,&m,&n,&a,&lda,&rsrc,&csrc); } int desc[9]; // get the size of the distributed matrix int locM = numroc_(&m, &mb, &myrow, &rsrc, &nprow); int locN = numroc_(&n, &nb, &mycol, &csrc, &npcol); // allocate the distributed matrices double* mata = (double*)malloc(locM*locN * sizeof(double)); // allocate the distributed matrix of eigenvectors double* z = (double*)malloc(locM*locN * sizeof(double)); int lld = MAX(1,locM); // build the descriptor descinit_(desc, &m, &n, &mb, &nb, &rsrc, &csrc, &ConTxt, &lld, &info); // build the distributed matrices for(int i1 = one; i1 < m+one; ++i1) for(int i2 = one; i2 < n+one; ++i2) { // Uncomment for PDSYEV: // http://icl.cs.utk.edu/lapack-forum/viewtopic.php?t=321&sid=f2ac0a3c06c66d74a2fbd65c222ffdb0 pdelset_(mata,&i1,&i2,desc,&a[(i1-one)*n+i2-one]); // Uncomment for PZHEEV: //pzelset_(mata,&i1,&i2,desc,&a(i1-one,i2-one)); } char jobz = 'V'; // eigenvectors also char range = 'A'; // all eiganvalues char uplo = 'U'; // work with upper double vl, vu; int il, iu; char cmach = 'U'; double abstol = 2.0 * pdlamch_(&ConTxt, &cmach); int eigvalm, nz; double orfac = -1.0; //double orfac = 0.001; int* ifail; ifail = (int*)malloc(m * sizeof(int)); int* iclustr; iclustr = (int*)malloc(2*nprow*npcol * sizeof(int)); double* gap; gap = (double*)malloc(nprow*npcol * sizeof(double)); double* work; work = (double*)malloc(3 * sizeof(double)); int querylwork = -1; int* iwork; iwork = (int*)malloc(1 * sizeof(int)); int queryliwork = 1; //pdsyevx_(&jobz, &range, &uplo, &n, mata, &one, &one, desc, &vl, // &vu, &il, &iu, &abstol, &eigvalm, &nz, eigvals, &orfac, z, &one, // &one, desc, work, &querylwork, iwork, &queryliwork, ifail, iclustr, gap, &info); pdsyevd_(&jobz, &uplo, &n, mata, &one, &one, desc, eigvals, z, &one, &one, desc, work, &querylwork, iwork, &queryliwork, &info); //pdsyev_(&jobz, &uplo, &m, mata, &one, &one, desc, eigvals, // z, &one, &one, desc, work, &querylwork, &info); int lwork = (int)work[0]; //printf("lwork %d\n", lwork); free(work); int liwork = (int)iwork[0]; //printf("liwork %d\n", liwork); free(iwork); work = (double*)malloc(lwork * sizeof(double)); iwork = (int*)malloc(liwork * sizeof(int)); //pdsyevx_(&jobz, &range, &uplo, &n, mata, &one, &one, desc, &vl, // &vu, &il, &iu, &abstol, &eigvalm, &nz, eigvals, &orfac, z, &one, // &one, desc, work, &lwork, iwork, &liwork, ifail, iclustr, gap, &info); pdsyevd_(&jobz, &uplo, &n, mata, &one, &one, desc, eigvals, z, &one, &one, desc, work, &lwork, iwork, &liwork, &info); //pdsyev_(&jobz, &uplo, &m, mata, &one, &one, desc, eigvals, // z, &one, &one, desc, work, &lwork, &info); free(work); free(iwork); Cpdgemr2d_(m, n, z, one, one, desc, a, one, one, desc0, ConTxt); // a constains eigenvectors now free(gap); free(iclustr); free(ifail); free(z); free(mata); // clean up the grid Cblacs_gridexit_(ConTxt); } free(a); free(eigvals); Cblacs_exit_(zero); //MPI_Finalize(); exit(0); } surveyor.sh000077500000000000000000000002141316441372200340600ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/ScaLapack/pdsyevdqsub -A Gpaw -n 1 -t 10 --mode vn --env LD_LIBRARY_PATH="/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib:$LD_LIBRARY_PATH" test.exe band_parallelization/000077500000000000000000000000001316441372200325045ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runsband_parallelization.rst000066400000000000000000000030551316441372200374170ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs/band_parallelization.. _band_parallelization: ==================== Band parallelization ==================== The orthogonalization can be paralleized over **k**-points, spins, domains (see :ref:`orthogonalization`), and bands, described below. Let's say we split the bands in five groups and give each group of wave functions to one of five processes: The overlap matrix contains 5x5 blocks. These are the steps:: rank: 1 2 3 4 5 A . . . . . B . . . . . C . . . . . . . . . . . . . . . . . . A . . . . . B . . . . . C . . . . . . S: . . . . . . . . . . . . A . . . . . B . . . . . C C . . . . . . . . . . . . . . . . . A . . . . . B B . . . . . C . . . . . . . . . . . . . . . . . A A. Each process calculates its block in the diagonal and sends a copy of its wave functions to the right (rank 5 sends to rank 1). B. Rank 1 now has the wave functions from rank 5, so it can do the row 5, column 1 block of `\mathbf{S}`. Rank 2 can do the row 1, column 2 block and so on. Shift wave functions to the right. C. Rank 1 now has the wave functions from rank 4, so it can do the row 4, column 1 block of `\mathbf{S}` and so on. Since `\mathbf{S}` is symmetric, we have all we need:: A B C . . . A B C . . . A B C C . . A B B C . . A With `B` blocks, we need `(B - 1) / 2` shifts. Now we can calculate `\mathbf{L}^{-1}` and do the matrix product `\tilde{\mathbf{\Psi}}_0 \mathbf{L}^{-1}` which requires `B - 1` shifts of the wave functions. gpaw-qsub.dtu-databar000077500000000000000000000030561316441372200323550ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs#!/usr/bin/env python # This version of gpaw-qsub works in the DTU databar as per August 2012. from optparse import OptionParser import os import sys queue='hpc' # Other option is app maxcores = 8 p = OptionParser() p.disable_interspersed_args() p.add_option('-p', '--procs', type=int, default=1, help='number of processes') p.add_option('-t', '--time', type=int, default=72, help='max running time in hours') opts, args = p.parse_args() # How many nodes? if opts.procs <= maxcores: # Single node nodeclause = "nodes=1:ppn="+str(opts.procs) print "Job will be submitted to a single nodes with %i cores." % (opts.procs,) elif opts.procs % maxcores == 0: # Use an integer number of nodes nodeclause = "nodes=%i:ppn=%i" % (opts.procs // maxcores, maxcores) print "Job will be submitted to %i nodes each with %i cores." % (opts.procs // maxcores, maxcores) else: whole = opts.procs // maxcores remainder = opts.procs % maxcores nodeclause = "nodes=%i:ppn=%i+1:ppn=%i" % (whole, maxcores, remainder) print "Job will be submitted to %i nodes with %i cores, and one node with %i cores. THIS IS NOT OPTIMAL." % (whole, maxcores, remainder) print "Node clause is:", nodeclause jobdir = os.getcwd() #jobname = os.path.join(os.getcwd(), args[0]) jobname = args[0] qsub = '''#!/bin/bash cd %s mpirun gpaw-python %s %s''' % (jobdir, jobname, ' '.join(args[1:])) pipe = os.popen('qsub -N %s -q %s -l %s -l walltime=%i:00:00' % (jobname, queue, nodeclause, opts.time), 'w') pipe.write(qsub) pipe.close() parallel_atomization.py000066400000000000000000000025101316441372200331100ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs"""This script calculates the atomization energy of nitrogen using two processes, each process working on a separate system.""" from __future__ import print_function from gpaw import GPAW, mpi import numpy as np from ase import Atoms, Atom cell = (8., 8., 8.) p = 4. separation = 1.103 rank = mpi.world.rank # Master process calculates energy of N, while the other one takes N2 if rank == 0: system = Atoms('N', [(p, p, p)], magmoms=[3], cell=cell) elif rank == 1: system = Atoms('N2', [(p, p, p + separation / 2.), (p, p, p - separation / 2.)], cell=cell) else: raise Exception('This example uses only two processes') # Open different files depending on rank output = '%d.txt' % rank calc = GPAW(communicator=[rank], txt=output, xc='PBE') system.set_calculator(calc) energy = system.get_potential_energy() # Now send the energy from the second process to the first process, if rank == 1: # Communicators work with arrays from Numeric only: mpi.world.send(np.array([energy]), 0) else: # The first process receives the number and prints the atomization energy container = np.array([0.]) mpi.world.receive(container, 1) # Ea = E[molecule] - 2 * E[atom] atomization_energy = container[0] - 2 * energy print('Atomization energy: %.4f eV' % atomization_energy) parallel_runs.rst000066400000000000000000000333041316441372200317260ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/parallel_runs.. _parallel_runs: ============= Parallel runs ============= .. toctree:: :maxdepth: 1 .. _parallel_running_jobs: Running jobs in parallel ======================== Parallel calculations are done with MPI and a special :program:`gpaw-python` python-interpreter. The parallelization can be done over the **k**-points, bands, spin in spin-polarized calculations, and using real-space domain decomposition. The code will try to make a sensible domain decomposition that match both the number of processors and the size of the unit cell. This choice can be overruled, see :ref:`manual_parallelization_types`. Before starting a parallel calculation, it might be useful to check how the parallelization corresponding to the given number of processes would be done with ``--gpaw dry-run=N`` command line option:: $ python3 script.py --gpaw dry-run=8 The output will contain also the "Calculator" RAM Memory estimate per process. In order to start parallel calculation, you need to know the command for starting parallel processes. This command might contain also the number of processors to use and a file containing the names of the computing nodes. Some examples:: mpirun -np 4 gpaw-python script.py poe "gpaw-python script.py" -procs 8 Simple submit tool ================== Instead writing a file with the line "mpirun ... gpaw-python script.py" and then submitting it to a queueing system, it is simpler to automate this:: #!/usr/bin/env python3 from sys import argv import os options = ' '.join(argv[1:-1]) job = argv[-1] dir = os.getcwd() f = open('script.sh', 'w') f.write("""\ NP=`wc -l < $PBS_NODEFILE` cd %s mpirun -np $NP -machinefile $PBS_NODEFILE gpaw-python %s """ % (dir, job)) f.close() os.system('qsub ' + options + ' script.sh') Now you can do:: $ qsub.py -l nodes=20 -m abe job.py You will have to modify the script so that it works with your queueing system. Alternative submit tool ======================= Alternatively, the script gpaw-runscript can be used, try:: $ gpaw-runscript -h to get the architectures implemented and the available options. As an example, use:: $ gpaw-runscript script.py 32 to write a job sumission script running script.py on 32 cpus. The tool tries to guess the architecture/host automatically. By default it uses the following environment variables to write the runscript: =============== =================================== variable meaning =============== =================================== HOSTNAME name used to assing host type PYTHONPATH path for Python GPAW_PYTHON where to find gpaw-python GPAW_SETUP_PATH where to find the setups GPAW_MAIL where to send emails about the jobs =============== =================================== Writing to files ================ Be careful when writing to files in a parallel run. Instead of ``f = open('data', 'w')``, use: >>> from ase.parallel import paropen >>> f = paropen('data', 'w') Using ``paropen``, you get a real file object on the master node, and dummy objects on the slaves. It is equivalent to this: >>> from ase.parallel import rank >>> if rank == 0: ... f = open('data', 'w') ... else: ... f = open('/dev/null', 'w') If you *really* want all nodes to write something to files, you should make sure that the files have different names: >>> from ase.parallel import rank >>> f = open('data.%d' % rank, 'w') Writing text output =================== Text output written by the ``print`` statement is written by all nodes. To avoid this use: >>> from ase.parallel import parprint >>> print('This is written by all nodes') >>> parprint('This is written by the master only') which is equivalent to >>> from ase.parallel import rank >>> print('This is written by all nodes') >>> if rank == 0: ... print('This is written by the master only') .. _different_calculations_in parallel: Running different calculations in parallel ========================================== A GPAW calculator object will per default distribute its work on all available processes. If you want to use several different calculators at the same time, however, you can specify a set of processes to be used by each calculator. The processes are supplied to the constructor, either by specifying an :ref:`MPI Communicator object `, or simply a list of ranks. Thus, you may write:: from gpaw import GPAW import gpaw.mpi as mpi # Create a calculator using ranks 0, 3 and 4 from the mpi world communicator ranks = [0, 3, 4] comm = mpi.world.new_communicator(ranks) if mpi.world.rank in ranks: calc = GPAW(communicator=comm) ... Be sure to specify different output files to each calculator, otherwise their outputs will be mixed up. Here is an example which calculates the atomization energy of a nitrogen molecule using two processes: .. literalinclude:: parallel_atomization.py .. _manual_parallelization_types: .. _manual_parallel: Parallelization options ======================= In version 0.7, a new keyword called ``parallel`` was introduced to provide a unified way of specifying parallelization-related options. Similar to the way we :ref:`specify convergence criteria ` with the ``convergence`` keyword, a Python dictionary is used to contain all such options in a single keyword. The default value corresponds to this Python dictionary:: {'kpt': None, 'domain': None, 'band': 1, 'order': 'kdb', 'stridebands': False, 'sl_auto': False, 'sl_default': None, 'sl_diagonalize': None, 'sl_inverse_cholesky': None, 'sl_lcao': None, 'sl_lrtddft': None, 'buffer_size': None} In words: * ``'kpt'`` is an integer and denotes the number of groups of k-points over which to parallelize. k-point parallelization is the most efficient type of parallelization for most systems with many electrons and/or many k-points. If unspecified, the calculator will choose a parallelization itself which maximizes the k-point parallelization unless that leads to load imbalance; in that case, it may prioritize domain decomposition. * The ``'domain'`` value specifies either an integer ``n`` or a tuple ``(nx,ny,nz)`` of 3 integers for :ref:`domain decomposition `. If not specified (i.e. ``None``), the calculator will try to determine the best domain parallelization size based on number of kpoints, spins etc. * The ``'band'`` value specifies the number of parallelization groups to use for :ref:`band parallelization ` and defaults to one, i.e. no band parallelization. * ``'order'`` specifies how different parallelization modes are nested within the calculator's world communicator. Must be a permutation of the characters ``'kdb'`` which is the default. The characters denote k-point, domain or band parallelization respectively. The last mode will be assigned contiguous ranks and thus, depending on network layout, probably becomes more efficient. Usually for static calculations the most efficient order is ``'kdb'`` whereas for TDDFT it is ``'kbd'``. * The ``'stridebands'`` value only applies when band parallelization is used, and can be used to toggle between grouped and strided band distribution. * If ``'sl_auto'`` is ``True``, ScaLAPACK will be enabled with automatically chosen parameters and using all available CPUs. * The other ``'sl_...'`` values are for using ScaLAPACK with different parameters in different operations. Each can be specified as a tuple ``(m,n,mb)`` of 3 integers to indicate an ``m*n`` grid of CPUs and a block size of ``mb``. If any of the three latter keywords are not specified (i.e. ``None``), they default to the value of ``'sl_default'``. Presently, ``'sl_inverse_cholesky'`` must equal ``'sl_diagonalize'``. * The ``'buffer_size'`` is specified as an integer and corresponds to the size of the buffer in KiB used in the 1D systolic parallel matrix multiply algorithm. The default value corresponds to sending all wavefunctions simultaneously. A reasonable value would be the size of the largest cache (L2 or L3) divide by the number of MPI tasks per CPU. Values larger than the default value are non-sensical and internally reset to the default value. .. note:: With the exception of ``'stridebands'``, these parameters all have an equivalent command line argument which can equally well be used to specify these parallelization options. Note however that the values explicitly given in the ``parallel`` keyword to a calculator will override those given via the command line. As such, the command line arguments thus merely redefine the default values which are used in case the ``parallel`` keyword doesn't specifically state otherwise. .. _manual_parsize_domain: Domain decomposition -------------------- Any choice for the domain decomposition can be forced by specifying ``domain`` in the ``parallel`` keyword. It can be given in the form ``parallel={'domain': (nx,ny,nz)}`` to force the decomposition into ``nx``, ``ny``, and ``nz`` boxes in x, y, and z direction respectively. Alternatively, one may just specify the total number of domains to decompose into, leaving it to an internal cost-minimizer algorithm to determine the number of domains in the x, y and z directions such that parallel efficiency is optimal. This is achieved by giving the ``domain`` argument as ``parallel={'domain': n}`` where ``n`` is the total number of boxes. .. tip:: ``parallel={'domain': world.size}`` will force all parallelization to be carried out solely in terms of domain decomposition, and will in general be much more efficient than e.g. ``parallel={'domain': (1,1,world.size)}``. You might have to add ``from gpaw.mpi import wold`` to the script to define ``world``. There is also a command line argument ``--domain-decomposition`` which allows you to control domain decomposition. .. _manual_parsize_bands: Band parallelization -------------------- Parallelization over Kohn-Sham orbitals (i.e. bands) becomes favorable when the number of bands `N` is so large that `\mathcal{O}(N^2)` operations begin to dominate in terms of computational time. Linear algebra for orthonormalization and diagonalization of the wavefunctions is the most noticeable contributor in this regime, and therefore, band parallelization can be used to distribute the computational load over several CPUs. This is achieved by giving the ``band`` argument as ``parallel={'band': nbg}`` where ``nbg`` is the number of band groups to parallelize over. .. tip:: Whereas band parallelization in itself will reduce the amount of operations each CPU has to carry out to calculate e.g. the overlap matrix, the actual linear algebra necessary to solve such linear systems is in fact still done using serial LAPACK by default. It is therefor advisable to use both band parallelization and ScaLAPACK in conjunction to reduce this potential bottleneck. There is also a command line argument ``--state-parallelization`` which allows you to control band parallelization. More information about these topics can be found here: .. toctree:: :maxdepth: 1 band_parallelization/band_parallelization .. _manual_ScaLAPACK: ScaLAPACK --------- ScaLAPACK improves performance of calculations beyond a certain size. This size depends on whether using FD, LCAO, or PW mode. In FD or PW mode, ScaLAPACK operations are applied to arrays of size nbands by nbands, whereas in LCAO mode, the arrays are generally the number of orbitals by the number of orbitals and therefore larger, making ScaLAPACK particularly important for LCAO calculations. With LCAO, it starts to become an advantage to use ScaLAPACK at around 800 orbitals which corresponds to about 50 normal (non-hydrogen, non-semicore) atoms with standard DZP basis set. In FD mode, calculations with nbands > 500 will benefit from ScaLAPACK; otherwise, the default serial LAPACK might as well be used. The ScaLAPACK parameters are defined either using the aforementioned ``'sl_...'`` entry in the parallel keyword dictionary (recommended) such as ``sl_default=(m, n, block)``, or alternatively using a command line argument such as ``--sl_default=m,n,block``. A block size of 64 has been found to be a universally good choice both in all modes. In LCAO mode, it is normally best to assign as many cores as possible, which means that ``m`` and ``n`` should multiply to the total number of cores divided by the k-point/spin parallelization. For example with 128 cores and parallelizing by 4 over k-points, there are 32 cores per k-point available per scalapack and a sensible choice is ``m=8``, ``n=4``. You can use ``sl_auto=True`` to make such a choice automatically. In FD or PW mode, a good guess for these parameters on most systems is related to the numbers of bands. We recommend for FD/PW:: mb = 64 m = floor(sqrt(nbands/mb)) n = m There are a total of four ``'sl_...'`` keywords. Most people will be fine just using ``'sl_default'`` or even ``'sl_auto'``. Here we use the same ScaLAPACK parameters in three different places: i) general eigensolve in the LCAO intilization ii) standard eigensolve in the FD calculation and iii) Cholesky decomposition in the FD calculation. It is currently possible to use different ScaLAPACK parameters in the LCAO initialization and the FD calculation by using two of the ScaLAPACK keywords in tandem, e.g:: --sl_lcao=p,q,pb --sl_default=m,n,mb where ``p``, ``q``, ``pb``, ``m``, ``n``, and ``mb`` all have different values. The most general case is the combination of three ScaLAPACK keywords, e.g:: --sl_lcao=p,q,pb --sl_diagonalize=m,n,mb --sl_inverse_cholesky=r,s,rb however, we do not presently support ``m != r``, ``n != s``, and ``mb != rb``. We may implement this in the future. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/paw_note/000077500000000000000000000000001316441372200253565ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/paw_note/make_paw_note.py000066400000000000000000000024101316441372200305360ustar00rootroot00000000000000# creates: paw_note.pdf import os from distutils.version import LooseVersion import matplotlib import matplotlib.pyplot as plt from gpaw.atom.all_electron import AllElectron ae = AllElectron('Pt') ae.run() fig = plt.figure(figsize=(7, 4), dpi=80) fig.subplots_adjust(left=0.05, bottom=0.11, right=0.85, top=0.95) for n, l, u in zip(ae.n_j, ae.l_j, ae.u_j): plt.plot(ae.r, u, label='%i%s' % (n, 'spdf'[l])) rcut = 2.5 lim = [0, 3.5, -2, 3] plt.plot([rcut, rcut], lim[2:], 'k--', label='_nolegend_') plt.axis(lim) # The pad keyword to legend was deprecated in MPL v. 0.98.4 if LooseVersion(matplotlib.__version__) < '0.98.4': kwpad = {'pad': 0.05} else: kwpad = {'borderpad': 0.05, 'labelspacing': 0.01} plt.legend(loc=(1.02, 0.03), markerscale=1, **kwpad) plt.xlabel(r'$r$ [Bohr]') plt.text(rcut + 0.05, lim[2] + 0.05, '$r_c$', ha='left', va='bottom') plt.text(0.6, 2, '[Pt] = [Xe]4f$^{14}$5d$^9$6s$^1$') plt.savefig('Pt.png', dpi=80) error = 0 error += os.system('pdflatex -interaction=nonstopmode paw_note > /dev/null') error += os.system('bibtex paw_note > /dev/null') error += os.system('pdflatex -interaction=nonstopmode paw_note > /dev/null') error += os.system('pdflatex -interaction=nonstopmode paw_note > /dev/null') error += os.system('cp paw_note.pdf ..') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/paw_note/paw_note.tex000066400000000000000000002501441316441372200277220ustar00rootroot00000000000000\documentclass[a4paper]{article} \usepackage{amsmath} \usepackage{graphicx} %\usepackage{a4wide} \newcommand{\gpaw}{\textsc{gpaw}} \newcommand{\trans}[1]{{#1}^{\mbox{\tiny $T$}}} \newcommand{\f}[1]{\mathbf{#1}} \newcommand{\fs}[1]{\mathbf{\tilde{#1}}} \newcommand{\s}[1]{\tilde{#1}} \newcommand{\ws}[1]{\widetilde{#1}} \newcommand{\h}[1]{\hat{#1}} \newcommand{\wh}[1]{\widehat{#1}} \newcommand{\ext}{\text{ext}} \newcommand{\br}{\mathbf{r}} \newcommand{\rr}{|\mathbf{r} - \mathbf{r}'|} \newcommand{\bk}{\mathbf{k}} \newcommand{\bR}{\mathbf{R}} \newcommand{\T}{\hat{\mathcal{T}}} \newcommand{\Z}{\mathcal{Z}} \newcommand{\Ham}{\widehat{H}} \newcommand{\bra}[1]{\langle #1 |} \newcommand{\ket}[1]{| #1 \rangle} \newcommand{\braket}[2]{\langle #1 | #2 \rangle} \newcommand{\psit}{\tilde{\psi}} \newcommand{\phit}{\tilde{\phi}} \newcommand{\pt}{\tilde{p}} \title{\vspace*{-21mm}% \textbf{The Projector Augmented-wave Method}} \author{Carsten Rostgaard} \date{February 3, 2010} \begin{document} \thispagestyle{empty} \maketitle \begin{abstract} The purpose of this text is to give a self-contained description of the basic theory of the projector augmented-wave (PAW) method, as well as most of the details required to make the method work in practice. These two topics are covered in the first two sections, while the last is dedicated to examples of how to apply the PAW transformation when extracting non-standard quantities from a density-functional theory (DFT) calculation. The formalism is based on Bl{\"o}chl's original formulation of PAW \cite{Blochl1994}, and the notation and extensions follow those used and implemented in the \gpaw\cite{gpaw} code. \end{abstract} %\vspace*{15mm} \tableofcontents \clearpage \section{Formalism}\label{sec: paw} By the requirement of orthogonality, DFT wave functions have very sharp features close to the nuclei, as all the states are non-zero in this region. Further out only the valence states are non-zero, resulting in much smoother wave functions in this interstitial region. The oscillatory behavior in the core regions, requires a very large set of plane waves, or equivalently a very fine grid, to be described correctly. One way of solving this problem is the use of pseudopotentials in which the collective system of nuclei and core electrons are described by an effective, much smoother, potential. The KS equations are then solved for the valence electrons only. The pseudopotentials are constructed such that the correct scattering potential is obtained beyond a certain radius from the core. This method reduces the number of wave functions to be calculated, since the pseudo potentials only have to be calculated and tabulated once for each type of atom, so that only calculations on the valence states are needed. It justifies the neglect of relativistic effects in the KS equations, since the valence electrons are non-relativistic (the pseudopotentials describing core states are of course constructed with full consideration of relativistic effects). The technique also removes the unwanted singular behavior of the ionic potential at the lattice points. \par The drawback of the method is that all information on the full wave function close to the nuclei is lost. This can influence the calculation of certain properties, such as hyperfine parameters, and electric field gradients. Another problem is that one has no before hand knowledge of when the approximation yields reliable results. \par A different approach is the augmented-plane-wave method (APW), in which space is divided into atom-centered augmentation spheres inside which the wave functions are taken as some atom-like partial waves, and a bonding region outside the spheres, where some envelope functions are defined. The partial waves and envelope functions are then matched at the boundaries of the spheres. \par A more general approach is the projector augmented wave method (PAW) presented here, which offers APW as a special case\cite{Blochl2003}, and the pseudopotential method as a well defined approximation\cite{Kresse1999}. The PAW method was first proposed by Blchl in 1994\cite{Blochl1994}. \subsection{The Transformation Operator}\label{sec: transformation operator} The features of the wave functions, are very different in different regions of space. In the bonding region it is smooth, but near the nuclei it displays rapid oscillations, which are very demanding on the numerical representation of the wave functions. To address this problem, we seek a linear transformation $\T$ which takes us from an auxiliary smooth wave function $\ket{\s{\psi}_n}$ to the true all electron Kohn-Sham single particle wave function $\ket{\psi_n}$ % \begin{equation} \ket{\psi_n}=\T\ket{\s{\psi}_n}, \end{equation} % where $n$ is the quantum state label, containing a $\f{k}$ index, a band index, and a spin index. \par This transformation yields the transformed KS equations % \begin{equation}\label{eq: paw ks equations} \T^\dagger \Ham \T \ket{\s{\psi}_n}=\epsilon_n\T^\dagger\T\ket{\s{\psi}_n}, \end{equation} % which needs to be solved instead of the usual KS equation. Now we need to define $\T$ in a suitable way, such that the auxiliary wave functions obtained from solving \ref{eq: paw ks equations} becomes smooth. \par Since the true wave functions are already smooth at a certain minimum distance from the core, $\T$ should only modify the wave function close to the nuclei. We thus define % \begin{equation} \T = 1 + \sum_a \T^a, \end{equation} % where $a$ is an atom index, and the atom-centered transformation, $\T^a$, has no effect outside a certain atom-specific augmentation region $|\f{r}-\f{R}^a|r_c^a \end{equation*} % where $\phi_i^a(\f{r})=\braket{\f{r}}{\phi_i^a}$ and likewise for $\s{\phi}_i^a$. \par If the smooth partial waves form a complete set inside the augmentation sphere, we can formally expand the smooth all electron wave functions as % \begin{equation}\label{eq: smooth psi expansion} \ket{\s{\psi}_n} = \sum_i P_{ni}^a \ket{\s{\phi}_i^a} \text{, for } |\f{r}-\f{R}^a|r_c^a$. \par Note that the completeness relation \ref{eq: phi p completeness} is equivalent to the requirement that $\s{p}_i^a$ should produce the correct expansion coefficients of \ref{eq: smooth psi expansion}-\ref{eq: psi expansion}, while \ref{eq: phi p orthogonal} is merely an implication of this restriction. Translating \ref{eq: phi p completeness} to an explicit restriction on the projector functions is a rather involved procedure, but according to Blchl, \cite{Blochl1994}, the most general form of the projector functions is: % \begin{equation}\label{eq: projector general} \bra{\s{p}_i^a} = \sum_j (\{\braket{f_k^a}{\s{\phi}_l^a}\})^{-1}_{ij}\bra{f_j^a}, \end{equation} % where $\ket{f_j^a}$ is any set of linearly independent functions. The projector functions will be localized if the functions $\ket{f_j^a}$ are localized. \par Using the completeness relation \ref{eq: phi p completeness}, we see that % \begin{equation*} \T^a =\sum_i \T^a\ket{\s{\phi}_i^a}\bra{\s{p}_i^a} = \sum_i \big(\ket{\phi_i^a} - \ket{\s{\phi}_i^a}\big) \bra{\s{p}_i^a}, \end{equation*} % where the first equality is true in all of space, since \ref{eq: phi p completeness} holds inside the augmentation spheres and outside $\T^a$ is zero, so anything can be multiplied with it. The second equality is due to \ref{eq: ta} (remember that $\ket{\phi_i^a} - \ket{\s{\phi}_i^a}=0$ outside the augmentation sphere). Thus we conclude that % \begin{equation}\label{eq: T operator} \T =1+ \sum_a\sum_i \big(\ket{\phi_i^a} - \ket{\s{\phi}_i^a}\big) \bra{\s{p}_i^a}. \end{equation} % \par To summarize, we obtain the all electron KS wave function $\psi_n(\f{r})=\braket{\f{r}}{\psi_n}$ from the transformation % \begin{equation}\label{eq: psi transform in r} \psi_n(\f{r}) = \s{\psi}_n(\f{r})+\sum_a\sum_i \big( \phi_i^a(\f{r}) - \s{\phi}_i^a(\f{r}) \big)\braket{\s{p}_i^a}{\s{\psi}_n}, \end{equation} % where the smooth (and thereby numerically convenient) auxiliary wave function $\s{\psi}_n(\f{r})$ is obtained by solving the eigenvalue equation \ref{eq: paw ks equations}. % Note that although the double sum has been indicated by a single % summation symbol, the order of summation must be preserved, since % the number of states $i$ depends on the nature of the current atom % (index $a$). \par The transformation \ref{eq: psi transform in r} is expressed in terms of the three components: a) the partial waves $\phi_i^a(\f{r})$, b) the smooth partial waves $\s{\phi}_i^a(\f{r})$, and c) the smooth projector functions $\s{p}_i^a(\f{r})$. \par The restriction on the choice of these sets of functions are: a) Since the partial- and smooth partial wave functions are used to expand the all electron wave functions, i.e. are used as atom-specific basis sets, these must be complete (inside the augmentation spheres). b) the smooth projector functions must satisfy \ref{eq: phi p completeness}, i.e. be constructed according to \ref{eq: projector general}. All remaining degrees of freedom are used to make the expansions converge as fast as possible, and to make the functions termed `smooth', as smooth as possible. For a specific choice of these sets of functions, see section \ref{sec: partial wave basis}. As the partial- and smooth partial waves are merely used as basis sets they can be chosen as real functions (any imaginary parts of the functions they expand, are then introduced through the complex expansion coefficients $P_{ni}^a$). In the remainder of this document $\phi$ and $\s{\phi}$ will be assumed real. \par Note that the sets of functions needed to define the transformation are system independent, and as such they can conveniently be pre-calculated and tabulated for each element of the periodic table. \par For future convenience, we also define the one center expansions \begin{subequations} \begin{align} \psi_{n}^a(\f{r}) &= \sum_i \phi_i^a(\f{r})\braket{\s{p}_i^a}{\s{\psi}_n},\\ \s{\psi}_{n}^a(\f{r}) &= \sum_i \s{\phi}_i^a(\f{r})\braket{\s{p}_i^a}{\s{\psi}_n}. \end{align} \end{subequations} % In terms of these, the all electron KS wave function is % \begin{equation} \psi_n(\f{r})=\s{\psi}_n(\f{r})+\sum_{a} \big( \psi_{n}^{a}(\f{r}-\f{R}^a) - \s{\psi}_{n}^a(\f{r}-\f{R}^a) \big). \end{equation} \par So what have we achieved by this transformation? The trouble of the original KS wave functions, was that they displayed rapid oscillations in some parts of space, and smooth behavior in other parts of space. By the decomposition \ref{eq: psi transform in r} we have separated the original wave functions into auxiliary wave functions which are smooth everywhere and a contribution which contains rapid oscillations, but only contributes in certain, small, areas of space. This decomposition is shown on the front page for the hydrogen molecule. Having separated the different types of waves, these can be treated individually. The localized atom centered parts, are indicated by a superscript $a$, and can efficiently be represented on atom centered radial grids. Smooth functions are indicated by a tilde \~{}. The delocalized parts (no superscript $a$) are all smooth, and can thus be represented on coarse Fourier- or real space grids. \subsection{The Frozen Core Approximation}\label{sec: frozen core} In the frozen core approximation, it is assumed that the core states are naturally localized within the augmentation spheres, and that the core states of the isolated atoms are not changed by the formation of molecules or solids. Thus the core KS states are identical to the atomic core states % \begin{figure} \begin{center} \includegraphics[scale=0.6]{Pt.png}% \caption{The core states of Platinum.}\label{fig: frozen core}% \end{center} \end{figure} % \begin{equation*} \ket{\psi^c_n} = \ket{\phi_\alpha^{a,\text{core}}}, \end{equation*} % where the index $n$ on the left hand site refers to both a specific atom, $a$, and an atomic state, $\alpha$. \par In this approximation only valence states are included in the expansions of $\ket{\psi_n}$, \ref{eq: psi expansion}, and $\ket{\s{\psi}_n}$, \ref{eq: smooth psi expansion}. \par Figure \ref{fig: frozen core}, shows the atomic states of Platinum in its ground state, obtained with an atomic DFT program at an LDA level, using spherical averaging, i.e. a spin-compensated calculation, assuming the degenerate occupation 9/10 of all 5d states, and both of the 6s states half filled. It is seen that at the typical length of atomic interaction (the indicated cut-off $r_c=2.5$ Bohr is approximately half the inter-atomic distance in bulk Pt), only the 5d and 6s states are non-zero. Note that the frozen core approximation is not a prerequisite for PAW. See e.g. \cite{Marsman2006} for a relaxation of this requirement. \subsection{Expectation Values}\label{sec: expectation values} The expectation value of an operator $\wh{O}$ is, within the frozen core approximation, given by % \begin{equation} \langle \wh{O} \rangle = \sum_n^\text{val} f_n \bra{\psi_n}\wh{O}\ket{\psi_n} + \sum_a \sum_\alpha^\text{core} \bra{\phi_\alpha^{a,\text{core}}}\wh{O}\ket{\phi_\alpha^{a,\text{core}}}. \end{equation} % Using that $\bra{\psi_n}\wh{O}\ket{\psi_n} = \bra{\s{\psi}_n}\T^\dagger \wh{O}\T\ket{\s{\psi}_n}$, and skipping the state index for notational convenience, we see that % \begin{equation} \begin{split} \bra{\psi}\wh{O}\ket{\psi} &= \bra{\s{\psi} + \sum_a(\psi^a - \s{\psi}^a)} \wh{O} \ket {\s{\psi} + \sum_a(\psi^a - \s{\psi}^a)}\\ &= \bra{\s{\psi}}\wh{O}\ket{\s{\psi}} + \sum_{aa'} \bra{\psi^a - \s{\psi}^a}\wh{O}\ket{\psi^{a'} - \s{\psi}^{a'}} + \sum_a \left(\bra{\s{\psi}}\wh{O}\ket{\psi^a - \s{\psi}^a} + \bra{\psi^a - \s{\psi}^a}\wh{O}\ket{\s{\psi}}\right)\\ &= \bra{\s{\psi}}\wh{O}\ket{\s{\psi}} + \sum_{a}\left( \bra{\psi^a}\wh{O}\ket{\psi^a} - \bra{\s{\psi}^a}\wh{O}\ket{\s{\psi}^a} \right)\\ & \hspace{48pt}+ \sum_a \left( \bra{\psi^a - \s{\psi}^a}\wh{O}\ket{\s{\psi} - \s{\psi}^a} + \bra{\s{\psi} - \s{\psi}^a}\wh{O}\ket{\psi^a - \s{\psi}^a} \right)\\ & \hspace{48pt}+ \sum_{a\neq a'} \bra{\psi^a - \s{\psi}^a}\wh{O}\ket{\psi^{a'} - \s{\psi}^{a'}}. \end{split} \end{equation} % For local operators\footnote{Local operator $\wh{O}$: An operator which does not correlate separate parts of space, i.e. $\bra{\br}\wh{O}\ket{\br'} = 0$ if $\br\neq \br'$.} the last two lines does not contribute. The first line, because $\ket{\psi^a - \s{\psi}^a}$ is only non-zero inside the spheres, while $\ket{\s{\psi} - \s{\psi}^a}$ is only non-zero outside the spheres. The second line simply because $\ket{\psi^a - \s{\psi}^a}$ is zero outside the spheres, so two such states centered on different nuclei have no overlap (provided that the augmentation spheres do not overlap). \par Reintroducing the partial waves in the one-center expansions, we see that % \begin{equation} \sum_n^\text{val} f_n \bra{\psi_{n}^{a}}\wh{O}\ket{\psi_{n}^{a}} = \sum_n^\text{val} f_n \sum_{i_1i_2} \bra{\phi_{i_1}^{a}P^a_{ni_1}} \wh{O} \ket{\phi_{i_2}^{a} P_{ni_2}^{a}} = \sum_{i_1i_2}\bra{\phi_{i_1}^{a}}\wh{O}\ket{\phi_{i_2}^a} \sum_n^\text{val} f_n P_{ni_1}^{a*}P_{ni_2}^a, \end{equation} % and likewise for the smooth waves.%: $\sum_n f_n \bra{\s{\psi}_{n}^{a}}\wh{O}\ket{\s{\psi}_{n}^{a}} = \sum_{i_1i_2}^\text{val} \bra{\s{\phi}_{i_1}^{a}}\wh{O}\ket{\s{\phi}_{i_2}^a} \sum_n^\text{val}f_n P_{i_1}^{a*}P_{i_2}^a$. \par Introducing the Hermitian one-center density matrix % \begin{equation}\label{eq: density matrix} D_{i_1i_2}^a =\sum_n f_n P_{ni_1}^{a*} P_{ni_2}^{a} = \sum_n f_n \braket{\s{\psi}_n}{\s{p}_{i_1}^a} \braket{\s{p}_{i_2}^a}{\s{\psi}_n}. \end{equation} % We conclude that for any local operator $\wh{O}$, the expectation value is % \begin{equation}\label{eq: local exp values} \langle \wh{O} \rangle = \sum_n^\text{val} f_n \bra{\s{\psi}_n}\wh{O}\ket{\s{\psi}_n} + \sum_a \sum_{i_1i_2} \left( \bra{\phi_{i_1}^{a}}\wh{O}\ket{\phi_{i_2}^a} - \bra{\s{\phi}_{i_1}^{a}}\wh{O}\ket{\s{\phi}_{i_2}^a} \right)D_{i_1i_2}^a + \sum_a \sum_\alpha^\text{core} \bra{\phi_\alpha^{a,\text{core}}}\wh{O}\ket{\phi_\alpha^{a,\text{core}}}. \end{equation} % \subsection{Densities}\label{sec: densities} The electron density is obviously a very important quantity in DFT, as all observables in principle are calculated as functionals of the density. In reality the kinetic energy is calculated as a functional of the orbitals, and some specific exchange-correlation functionals also rely on KS-orbitals rather then the density for their evaluation, but these are still \emph{implicit} functionals of the density. \par To obtain the electron density we need to determine the expectation value of the real-space projection operator $\ket{\f{r}}\bra{\f{r}}$ % \begin{equation} n(\f{r}) = \sum_n f_n \braket{\psi_n}{\f{r}}\braket{\f{r}}{\psi_n} = \sum_n f_n|\psi_n(\f{r})|^2, \end{equation} % where $f_n$ are the occupation numbers. \par As the real-space projection operator is obviously a local operator, we can use the results \ref{eq: local exp values} of the previous section, and immediately arrive at % \begin{equation}\label{eq: electron density} n(\f{r}) = \sum_n^\text{val} f_n |\s{\psi}_n|^2 + \sum_a \sum_{i_1i_2} \left(\phi_{i_1}^{a} \phi_{i_2}^{a} - \s{\phi}_{i_1}^{a} \s{\phi}_{i_2}^{a} \right) D_{i_1i_2}^a + \sum_a \sum_\alpha^\text{core} |\phi_\alpha^{a,\text{core}}|^2. \end{equation} % \par To ensure that \ref{eq: electron density} reproduce the correct density even though some of the core states are not strictly localized within the augmentation spheres, a smooth core density, $\s{n}_c(\f{r})$, is usually constructed, which is identical to the core density outside the augmentation sphere, and a smooth continuation inside. Thus the density is typically evaluated as % \begin{equation}\label{eq: PAW density} n(\f{r}) = \s{n}(\f{r}) + \sum_a \left( n^a(\f{r}) - \s{n}^a(\f{r}) \right), \end{equation} % where % \begin{subequations}\label{eq: density contributions} \begin{align} \s{n}(\f{r}) &= \sum_n^\text{val} f_n |\s{\psi}_n(\f{r})|^2 + \s{n}_c(\f{r})\label{eq: smooth n}\\ n^a(\f{r}) &= \sum_{i_1i_2} D_{i_1i_2}^a \phi_{i_1}^a(\f{r})\phi_{i_2}^{a}(\f{r}) + n_c^a(\f{r})\label{eq: partial n}\\ \s{n}^a(\f{r}) &= \sum_{i_1i_2} D_{i_1i_2}^a \s{\phi}_{i_1}^a(\f{r})\s{\phi}_{i_2}^{a}(\f{r}) + \s{n}_c^a(\f{r})\label{eq: smooth partial n} \end{align} \end{subequations} % \subsection{Total Energies}\label{sec: total energies} The total energy of the electronic system is given by: % \begin{equation} E[n] = T_s[n]+U_H[n]+V_{ext}[n]+E_{xc}[n]. \end{equation} % In this section, the usual energy expression above, is sought re-expressed in terms of the PAW quantities: the smooth waves and the auxiliary partial waves. \par For the local and semi-local functionals, we can utilize \ref{eq: local exp values}, while the nonlocal parts needs more careful consideration. \subsubsection{The Semi-local Contributions} \par The kinetic energy functional $T_s = \sum_n f_n \bra{\psi_n} -\frac{1}{2}\nabla^2\ket{\psi_n}$ is obviously a (semi-) local functional, so we can apply \ref{eq: local exp values} and immediately arrive at: % \begin{equation} \begin{split} T_s[\{\psi_n\}] &= \sum_n f_n \bra{\psi_n} -\tfrac{1}{2}\nabla^2\ket{\psi_n}\\ &= \sum_n^\text{val} f_n \bra{\s{\psi}_n} - \tfrac{1}{2} \nabla^2\ket{\s{\psi}_n} + \sum_a \left(T_c^a + \Delta T_{i_1i_2}^a D^a_{i_1i_2} \right), \end{split} \end{equation} % where % \begin{equation} T_c^a = \sum_\alpha^\text{core} \bra{\phi_\alpha^{a,\text{core}}} - \tfrac{1}{2}\nabla^2 \ket{\phi_\alpha^{a,\text{core}}} \quad \text{and} \quad \Delta T_{i_1i_2}^a = \bra{\phi_{i_1}^{a}} - \tfrac{1}{2}\nabla^2\ket{\phi_{i_2}^a} - \bra{\s{\phi}_{i_1}^{a}} - \tfrac{1}{2} \nabla^2 \ket{\s{\phi}_{i_2}^a}. \end{equation} % For LDA and GGA type exchange-correlation functionals, $E_{xc}$ is likewise, per definition, a semi-local functional, such that it can be expressed as % \begin{equation} E_{xc}[n] = E_{xc}[\s{n}] + \sum_a \left( E_{xc}[n^a] - E_{xc}[\s{n}^a] \right). \end{equation} % By virtue of \ref{eq: partial n}-\ref{eq: smooth partial n} we can consider the atomic corrections as functionals of the density matrix defined in \ref{eq: density matrix}, i.e. % \begin{equation} E_{xc}[n] = E_{xc}[\s{n}] + \sum_a \Delta E_{xc}^a[\{D^a_{i_1i_2}\}], \end{equation} % where % \begin{equation} \Delta E_{xc}^a[\{D^a_{i_1i_2}\}] = E_{xc}[n^a] - E_{xc}[\s{n}^a]. \end{equation} % \subsubsection{The Nonlocal Contributions} The Hartree term is both nonlinear and nonlocal, so more care needs to be taken when introducing the PAW transformation for this expression. \par In the following we will assume that there is no `true' external field, such that $V_\text{ext}[n]$ is only due to the static nuclei, i.e. it is a sum of the classical interaction of the electron density with the static ionic potential, and the electrostatic energy of the nuclei. \par We define the total classical electrostatic energy functional as % \begin{equation}\label{eq: coulomb energy} \begin{split} E_C[n] &= U_H[n] + V_\text{ext}[n] = \frac{1}{2} ((n)) + (n|\textstyle\sum_a Z^a) + \frac{1}{2} \sum_{a\neq a'} (Z^a | Z^{a'}),%\\ % &= \frac{1}{2}((n+\textstyle\sum_a Z^a)) - \frac{1}{2} \sum_a ((Z^a)) \end{split} \end{equation} % where the notation (f|g) indicates the Coulomb integral % \begin{equation} (f|g) = \iint d\br d\br' \frac{f^*(\br) g(\br') }{|\br-\br'|} \end{equation} % and I have introduced the short hand notation $((f)) = (f|f)$. In \ref{eq: coulomb energy}, $Z^a(\br)$ is the charge density of the nucleus at atomic site $a$, which in the classical point approximation is given by % \begin{equation} Z^a(\br) = -\Z^a\delta(\br-\bR^a) \end{equation} % with $\Z^a$ being the atomic number of the nuclei. As the Hartree energy of a density with non-zero total charge is numerically inconvenient, we introduce the charge neutral total density % \begin{equation} \rho(\br) = n(\br) + \sum_a Z^a(\br) \quad (= n_\text{electrons} + n_\text{nuclei}). \end{equation} % In terms of this, the coulombic energy of the system can be expressed by % \begin{equation}\label{eq: coulomb energy reduced} E_C[n] = U_H'[\rho] = \frac{1}{2}((n+{\textstyle\sum_a Z^a}))' \end{equation} % where the prime indicates that one should remember the self-interaction error of the nuclei introduced in the Hartree energy of the total density. This correction is obviously ill defined, and different schemes exist for making this correction. As it turns out, this correction is handled very naturally in the PAW formalism. \par For now, we will focus on the term $((\rho)) = ((n+\textstyle\sum_a Z^a))$. If one where to directly include the expansion of $n(\br)$ according to \ref{eq: PAW density}, one would get: % \begin{align*} ((n+\textstyle\sum_a Z^a)) &= ((\s{n}+\textstyle\sum_a n^a - \s{n}^a + Z^a)) \\&= ((\s{n})) + \sum_{aa'}(n^a - \s{n}^a + Z^a|n^{a'} - \s{n}^{a'} + Z^{a'}) + 2\sum_a(\s{n}|n^a - \s{n}^a + Z^a), \end{align*} % where in the last expression, the first term is the Hartree energy of the smooth electron density, which is numerically problematic because of the nonzero total charge. The second term contains a double summation over all nuclei, which would scale badly with system size, and the last term involves integrations of densities represented on incompatible grids (remember that the one-center densities are represented on radial grids to capture the oscillatory behavior near the nuclei)\footnote{One could separate the terms in other ways, but it is impossible to separate the smooth and the localized terms completely.}. This is clearly not a feasible procedure. To correct these problem we add and subtract some atom centered compensation charges $\s{Z}^a$: % \begin{multline*} ((n+\textstyle\sum_a \s{Z}^a + \textstyle\sum_a \left[Z^a - \s{Z}^a\right])) = ((\s{n} + \textstyle\sum_a \s{Z}^a)) + \sum_{aa'}(n^a - \s{n}^a + Z^a - \s{Z}^a|n^{a'} - \s{n}^{a'} + Z^{a'}- \s{Z}^a) \\+ 2\sum_a(\s{n}+\textstyle\sum_{a'}\s{Z}^{a'}|n^a - \s{n}^a + Z^a - \s{Z}^a). \end{multline*} % If we define $\s{Z}^a(\br)$ in such a way that $n^a(\br) - \s{n}^a(\br) + Z^a(\br) - \s{Z}^a(\br)$ has no multipole moments, i.e. % \begin{equation}\label{eq: no multipole} \int d\br r^l Y_L(\wh{\br-\bR^a}) (n^a - \s{n}^a + Z^a - \s{Z}^a) = 0 \end{equation} % for all $a$, the potentials of these densities are zero outside their respective augmentation spheres ($L=(l,m)$ is a collective angular- and magnetic quantum number). Exploiting this feature, the Coulomb integral reduce to % \begin{align*} ((n+\textstyle\sum_a Z^a)) %&= ((n+\textstyle\sum_a \s{Z}^a + \textstyle\sum_a Z^a - \s{Z}^a))\\ &= ((\s{n} + \textstyle\sum_a \s{Z}^a)) + \sum_{a}((n^a - \s{n}^a + Z^a - \s{Z}^a)) + 2\sum_a(\s{n}^a+\s{Z}^a|n^a - \s{n}^a + Z^a - \s{Z}^a)\\ % &= ((\s{n} + \textstyle\sum_a \s{Z}^a)) + \sum_{a}(n^a + \s{n}^a + Z^a + \s{Z}^a|n^a - \s{n}^a + Z^a - \s{Z}^a)\\ &= ((\s{n} + \textstyle\sum_a \s{Z}^a)) + \sum_{a}\left( ((n^a + Z^a)) - ((\s{n}^a + \s{Z}^a)) \right) \end{align*} % where it has been used that inside the augmentation spheres $\s{n} = \s{n}^a$. In this expression, we have circumvented all of the previous problems. None of the terms correlates functions on different grids, there is only a single summation over the atomic sites, and furthermore the only thing that has to be evaluated in the full space is the Hartree energy of $\s{n}(\br) + \sum_a \s{Z}^a(\br)$ which is charge neutral (see eq. \ref{eq: rhot charge neutral}). \par Inserting the final expression in \ref{eq: coulomb energy}, we see that % \begin{equation} \begin{split} E_C[n] &= \frac{1}{2}((\s{n} + {\textstyle\sum_a} \s{Z}^a)) + \frac{1}{2}\sum_a \left(((n^a + Z^a))' - ((\s{n}^a + \s{Z}^a))\right)\\ &=U_H[\s{\rho}] + \frac{1}{2}\sum_a \left( ((n^a)) + 2(n^a|Z^a) - ((\s{n}^a + \s{Z}^a))\right) \end{split} \end{equation} % where we have introduced the smooth total density % \begin{equation} \s{\rho}(\br) = \s{n} + \sum_a \s{Z}^a(\br). \end{equation} % Note that the problem with the self interaction error of the nuclei could easily be resolved once it was moved to the atom centered part, as handling charged densities is not a problem on radial grids. \par To obtain an explicit expression for the compensation charges, we make a multipole expansion of $\s{Z}^a(\br)$ % \begin{equation}\label{eq: compensation expansion} \s{Z}^a = \sum_L Q_L^a ~\s{g}_L^a(\br), \end{equation} % where $\s{g}_L^a(\br)$ is any smooth function localized within $|\br-\bR^a|^{l+1}} Y_L^*(\h{\br})Y_L(\h{\br}') \end{equation} % with $r_< = \min(r, r')$ and $r_> = \max(r, r')$. Using this it is seen that for any density with a known angular dependence, e.g. the density $R(r) Y_L(\h{\br})$, the potential can be determined by % \begin{equation}\label{eq: radial potential} \begin{split} v[R(r) Y_L(\h{\br})](\br) &= \int d\br' \frac{R(r') Y_L(\h{\br}')}{|\br - \br'|}\\ &= \frac{4\pi}{2l+1} Y_L(\h{\br}) \int_0^\infty r'^2dr' R(r') \frac{r_<^l}{r_>^{l+1}}\\ &= \frac{4\pi}{2l+1} Y_L(\h{\br}) \left[\int_0^r dr' R(r')r'\Big(\frac{r'}{r}\Big)^{l+1} + \int_r^\infty dr' R(r')r'\Big(\frac{r}{r'}\Big)^l \right] \end{split} \end{equation} % if the angular dependence is not a spherical harmonic, one can always do a multipole expansion, and use the above expression on the individual terms. \par In the case of a radial density $n(\br) = n(r)$, the Hartree potential becomes % \begin{equation} u_H(r) = \frac{4\pi}{r}\int_0^r dr' n(r')r'^2 + 4\pi\int_r^\infty dr' n(r')r' \end{equation} % A purely radial dependent density also implies that the xc-potential is a radial function. Using this, the entire KS equation can be reduced to a 1D problem in $r$, while the angular part is treated analytically. \subsubsection{The Radial Kohn-Sham Equation} For a spherical KS potential, and using that $Y_L$ are eigenstates of the Laplacian, the KS equation can be reduced to the simpler one-dimensional second order eigenvalue problem % \begin{equation}\label{eq: radial KS equation} \left[ -\frac{1}{2}\frac{d^2}{dr^2} - \frac{1}{r}\frac{d}{dr} + \frac{l(l+1)}{2r^2} + v_s(r)\right]R_j(r) = \epsilon_j R_j(r) \end{equation} % If we introduce the radial wave function $u_j(r)$ defined by % \begin{equation} r R_j(r) = u_j(r) \end{equation} % the KS equation can be written as % \begin{equation} u_j''(r) + \left(2\epsilon_j - 2v_s(r)- \frac{l(l+1)}{r^2}\right) u_j(r) = 0 \end{equation} % which is easily integrated using standard techniques. See e.g. \cite[chapter 6]{Fiolhais2003}. \subsection{The Atomic Data Set of PAW}\label{sec: partial wave basis} The very large degree of freedom when choosing the functions defining the PAW transformation means that the choice varies a great deal between different implementations. In any actual implementation expansions are obviously finite, and many numerical considerations must be made when choosing these basis sets, to ensure fast and reliable convergence. This section provides an overview of the information needed for uniquely defining the PAW transformation, and the level of freedom when choosing the parameters. \subsubsection*{The Partial Waves} The basis functions, $\phi_i^a$, for the expansion of $\ket{\psi_n}$ should be chosen to ensure a fast convergence to the KS wave function. For this reason we choose the partial waves as the eigenstates of the Schrdinger equation for the isolated spin-saturated atoms. Thus the index $i$ is a combination of main-, angular-, and magnetic quantum number, $(n,l,m)$. And the explicit form is % \begin{equation*} \phi_i^a(\f{r})=\phi_{nl}^a(r)Y_{lm}(\hat{\f{r}}) \end{equation*} % where $\phi_{nl}^a(r)$ are the solutions of the radial KS Schrdinger equation \ref{eq: radial KS equation}, and $Y_{lm}$ are the spherical harmonics. For convenience we choose $\phi_i^a(\f{r})$ to be real, i.e. we use the real spherical harmonics instead of the complex valued. This choice of partial waves implies that the smooth partial waves and the smooth projector functions can also be chosen real, and as products of some radial functions and the same real spherical harmonic. \par Note that including unbound states of the radial KS equation in the partial waves is not a problem, as the diverging tail is exactly canceled by the smooth partial waves. In practice we only integrate the KS equation outward from the origin to the cutoff radius for unbound states, thus making the energies free parameters. In principle the same could be done for the bound states, but in \gpaw, the energies of bound states are fixed by making the inward integration for these states and doing the usual matching (see e.g. \cite[chapter 6]{Fiolhais2003}), i.e. the energies are chosen as the eigen energies of the system. \subsubsection*{The Smooth Partial Waves} \par The smooth partial waves $\s{\psi}_i^a(\br)$ are per construction identical to the partial waves outside the augmentation sphere. Inside the spheres, we can choose them as any smooth continuation. Presently \gpaw{} uses simple 6'th order polynomials of even powers only (as odd powers in $r$ results in a kink in the functions at the origin, i.e. that the first derivatives are not defined at this point), where the coefficients are used to match the partial waves smoothly at $r=r_c$. Other codes uses Bessel functions\cite{Kresse1999} or Gaussians. \subsubsection*{The Smooth Projector Functions} \par The smooth projector functions are a bit more tricky. Making them orthonormal to $\s{\phi}_i^a(\f{r})$ is a simple task of applying an orthonormalization procedure. This is the only formal requirement, but in any actual implementation all expansions are necessarily finite, and we therefore want them to converge as fast as possible, so only a few terms needs to be evaluated. \par A popular choice is to determine the smooth projector functions according to % \begin{equation}\label{eq: construct projector} \ket{\s{p}_i^a} = \left( -\tfrac{1}{2} \nabla^2 + \s{v}_s - \epsilon_i\right) \ket{\s{\phi}^a_i} \end{equation} % or equivalently % \begin{equation} \s{p}_{j}^a(r) = \left[-\frac{1}{2}\frac{d^2}{dr^2} - \frac{1}{r}\frac{d}{dr} + \frac{l(l+1)}{2r^2} + \s{v}_s(r) - \epsilon_j \right] \s{\phi}^a_j(r) \end{equation} % where $\s{v}_s(r)$ is the smooth KS potential $u_H[\s{\rho}](r) + v_{xc}[\s{n}](r)$. And then enforce the complementary orthogonality condition $\braket{\s{p}_{j}^a}{\s{\phi}^a_{j'}} = \delta_{j,j'}$ inside the augmentation sphere, e.g. by a standard Gram-Schmidt procedure. Using this procedure ensures that the reference atom is described correctly despite the finite number of projectors. \subsubsection*{The Smooth Compensation Charge Expansion Functions}\label{sec: choosing comp charge} The smooth compensation charges $\s{g}_L^a(\br)$, are products of spherical harmonics, and radial functions $\s{g}_l^a(r)$ satisfying that % \begin{equation} \int d\f{r} r^l Y_L(\hat{\f{r}})\s{g}_{L'}^a(\f{r}) = \delta_{LL'} \end{equation} % In \gpaw{} the radial functions are chosen as generalized Gaussian according to (here shown for $\bR^a=0$): % \begin{equation}\label{eq: generalized gaussians} \s{g}_L^a(\f{r}) = \s{g}_l^a(r) Y_L(\hat{\f{r}})~~,\quad \s{g}_l^a(r) = \frac{1}{\sqrt{4\pi}}\frac{l!}{(2l+1)!}(4\alpha^a)^{l+3/2}r^le^{-\alpha^ar^2} \end{equation} % where the atom-dependent decay factor $\alpha$ is chosen such that the charges are localized within the augmentation sphere. %\par With this choice of compensation charges, the tensors %$N_{L_1L_2}^a$ and the potential part of the $M_{i_1i_2L}^a$ tensors %can be evaluated analytically, see \cite{Obara:1986}. \subsubsection*{The Core- and Smooth Core Densities } The core density follows directly from the all electron partial waves by % \begin{equation}\label{eq: core density} n_c(r) = \sum_i^\text{core} |\phi_i(\br)|^2 = \sum_j^\text{core} 2(2l+1) |\phi_j(r)|^2 / 4\pi \end{equation} % \par The smooth core densities $\s{n}_c^a(\br)$ are like the smooth partial waves expanded in a few (two or three) Bessel functions, Gaussians, polynomials or otherwise, fitted such that it matches the true core density smoothly at the cut-off radius. \subsubsection*{The Localized Potential} An additional freedom in PAW is that for any operator $\wh{L}$, localized within the augmentation spheres, we can exploit the identity \ref{eq: phi p completeness} % \begin{equation} \sum_i \ket{\s{\phi}_i^a}\bra{\s{p}_i^a} = 1 %\qquad\text{, for }|\f{r}-\f{R}^a|r_c^a$) we get the identity % \begin{equation*} 0 = \int d\br \s{n}(\br) \sum_a \bar{v}^a(\br) - \sum_a \int d\br \s{n}^a \bar{v}^a(\br) \end{equation*} % This expression can be used as an `intelligent zero'. Using this, we can make the replacement of the smooth potential % \begin{equation} \s{v}_\text{eff}(\br) = u_H[\s{\rho}](\br) + v_{xc}[\s{n}](\br) \to \s{v}_\text{eff}(\br) = u_H[\s{\rho}](\br) + v_{xc}[\s{n}](\br) + \bar{v}(\br) \end{equation} % if we at the same time add % \begin{equation} B^a + \sum_{i_1i_2} B^a_{i_1i_2} D^a_{i_1i_2} \end{equation} % to the energy corrections $\Delta E^a$, where % \begin{equation} B^a = -\int d\br \s{n}_c^a\bar{v}^a(\br) \quad\text{and}\quad \Delta B^a_{i_1i_2} = -\int d\br \s{\phi}^a_{i_1}\s{\phi}^a_{i_2}\bar{v}^a(\br) \end{equation} % This also implies that $B^a_{i_1i_2}$ should be added to $\Delta H^a_{i_1i_2}$. \par The advantage of doing this is that the Hartree potential and the xc-potential might not be optimally smooth close to the nuclei, but if we define the localized potential properly, the sum of the three potentials might still be smooth. Thus one can initially evaluate $u_H[\s{\rho}](\br)$ and $v_{xc}[\s{n}](\br)$ on an extra fine grid, add $\bar{v}(\br)$ and then restrict the total potential to the coarse grid again before solving the KS equation. \par The typical way of constructing the localized potentials $\bar{v}^a$ is by expanding it in some basis, and then choosing the coefficients such that the potential $u_H[\s{\rho}](\br) + v_{xc}[\s{n}](\br) + \bar{v}(\br)$ is optimally smooth at the core for the reference system. \par Inclusion of $\bar{v}^a(\br)$ changes the forces on each atom only through the redefinitions of $\s{v}_\text{eff}(\br)$ and $\Delta H^a_{i_1i_2}$. \subsubsection*{Summary} When constructing a data set for a specific atom, one must specify the following quantities, all defined within the augmentation spheres only: % \begin{enumerate} \item $\phi_i^a$ from radial KS equation \item $\s{\phi}_i^a$ by appropriate smooth continuation of $\phi_i^a$ \item $\s{p}_i^a$ from equation \ref{eq: construct projector} \item $\s{g}_L^a$ localized within $r^{l+1}} u^a_{j_1}(r)u^a_{j_c}(r) u^a_{j_c}(r')u^a_{j_2}(r'). \end{split} \end{equation} % Although the valence-core interaction is computationally trivial to include, it is not unimportant, giving rise to shifts in the valence eigenvalues of up to 1eV (though only a few kcal/mol in atomization energies), and we note that this contribution is unavailable in pseudopotential schemes. The core-core exchange is simply a reference energy, and will not affect self-consistency or energy differences. For the iterative minimization schemes used in real-space and plane wave codes, the explicit form of the non-local Fock operator $v^\text{NL}(\br, \br')$ is never needed, and would indeed be impossible to represent on any realistic grid. Instead only the action of the operator on a state is needed. As with the Hamiltonian operator, the action on the pseudo waves is derived via the relation $f_n \hat{v}^\text{NL} \ket{\tilde{\psi}_n} = \partial E_\text{xx} / \partial \bra{\tilde{\psi}_n}$. Referring to \cite{Paier2005} for a derivation, we merely state the result \begin{multline}\label{eq: nonlocal exchange} \h{v}^\text{NL} \ket{\s{\psi}_n} = \sum_m f_m \s{v}_{nm}(\br) \ket{\s{\psi}_m} \\ + \sum_a \sum_{i_1i_2} \ket{\s{p}_{i_1}^a} \left[ \sum_m v_{nm,i_1i_2}^a P^a_{mi_2} - X^a_{i_1i_2} P^a_{ni_2} - 2 \left( \sum_{i_3i_4}C^a_{i_1i_3i_2i_4}D^a_{i_3i_4} \right) P^a_{ni_2} \right] \end{multline} where $\tilde{v}_{nm}$ is the solution of $\nabla^2 \tilde{v}_{nm}(\br) = -4\pi \tilde{\rho}_{nm}(\br)$, and $v_{nm,i_1i_2}^a = \sum_L \Delta^a_{Li_1i_2}\int d\br\s{g}^a_L(\br) \tilde{v}_{nm}(\br)$. Again the computationally demanding first term is related to smooth pseudo quantities only, which can be accurately represented on coarse grids, making it possible to do basis set converged self-consistent EXX calculations at a relatively modest cost. Applying the Fock operator is however still expensive, as a Poisson equation must be solved for all pairs of orbitals. As a technical consideration, note that the effect of the atomic corrections due to valence-valence, valence-core, and core-core exchange interactions can simply be incorporated into the standard equations by redefining equations \ref{eq:coulom tensor 2}, \ref{eq:coulom tensor 1}, and \ref{eq:coulom tensor 0} respectively, which will also take care of the last two terms in the Fock operator above. The introduction of the pair orbital compensation charges does however lead to a non-trivial correction to the Fock operato; the term proportional to $v^a_{nm, i_1i_2}$. This term also leads to a distinct contribution when calculating the kinetic energy via the eigenvalues as done in equation \ref{eq:kinetic-energy}. The additional term (besides those related to redefining \ref{eq:coulom tensor 0}--\ref{eq:coulom tensor 2}) \begin{equation} \sum_{nm}f_n\left[f_{m} \delta_{\sigma_n,\sigma_{m}} \int d\br \tilde{v}_{nm}(\br) \psit_n^*(\br)\psit_{m}(\br) - \sum_a\sum_{i_1i_2} P_{ni_1}^aP_{mi_2}^a v^a_{nm,i_1i_2}\right], \end{equation} should be added to the right hand side of \ref{eq:kinetic-energy} on inclusion of exact exchange. In a similar fashion, the compensation charges leads to an additional force contribution in equation \ref{eq: force no exx} given by \begin{equation}\label{eq:paw-exx-force} \begin{split} \mathbf{F}^a_{xx} = \sum_{nm} f_{n}f_{nm}\delta_{\sigma_{n} \sigma_{m}}\Bigg\{ &\int d\br' \tilde{v}_{nm}(\br') \sum_{i_1i_2} P^{a*}_{ni_1}P^{a}_{mi_2}\sum_L\Delta_{Li_1i_2}\frac{\partial \tilde{g}^a_L(\br')}{\partial \bR^a}\\ & + \sum_{i_1i_2} v^a_{n_1n_2i_1i_2}\left( P^{a*}_{n i_1}\braket{\frac{d \pt^a_{i_2}}{d\bR^a}}{\psit_{m}} + \braket{\psit_{n}}{\frac{d \pt^a_{i_1}}{d\bR^a}} P^a_{m i_2} \right)\Bigg\}. \end{split} \end{equation} \subsubsection{Optimized Effective Potential} The optimized effective potential (OEP) method, is a way of converting the non-local Fock operator $\hat{v}^\text{NL}_x$ into a local form $\hat{v}^\text{L}_x = v^\text{L}_x(\br)$. One way to derive the OEP equations in standard KS-DFT, is to use perturbation theory along the adiabatic connection (G\"orling-Levy perturbation theory \cite{Gorling1994}). On converting the OEP equation to the PAW formalism, it should be remembered that local potentials in PAW transform to a local pseudo part plus non-local atomic corrections. Hence we want to arrive at a potential of the form \begin{equation}\label{eq: local exchange} \h{v}_x^\text{L} = \s{v}_x^\text{L}(\br) + \sum_a \sum_{i_1i_2} \ket{\s{p}_{i_1}^a}\Delta v_{i_1i_2}^a \bra{\s{p}_{i_2}^a}, \end{equation} where both the pseudo part $\s{v}_x^\text{L}$ as well as the coefficients $\Delta v_{i_1i_2}^a$ should be determined. The derivation is more or less straight forward, if one remembers the the PAW KS equation is a generalized eigenvalue problem, that the variational quantity is the pseudo orbitals, and that the first order shift in the density has both a pseudo and an atomic part. The result is \begin{subequations}\label{eq: paw oep2} \begin{align} \sum_n f_n \s{\psi}_n^*(\br) \sum_{m\neq n} \s{\psi}_m(\br) \frac{\bra{\s{\psi}_m} \h{v}_x^\text{NL} - \h{v}_x^\text{L} \ket{\s{\psi}_n}}{\epsilon_n - \epsilon_m} + c.c. &= 0\\ \sum_n f_n P_{ni_1}^{a*}\sum_{m\neq n}P_{mi_2}^{a} \frac{\bra{\s{\psi}_m} \h{v}_x^\text{NL} - \h{v}_x^\text{L} \ket{\s{\psi}_n}}{\epsilon_n - \epsilon_m} + c.c. &= 0 \end{align} \end{subequations} where $\hat{v}^\text{NL}_x$ is the non-local exchange operator of equation \ref{eq: nonlocal exchange} and $\hat{v}^\text{L}_x$ is the local version in \ref{eq: local exchange}. These can be solved iteratively starting from a local density-function approximation to the exchange potential in the spirit of \cite{Kummel2003}. It might seem that OEP is just extra work on top of the already expensive non-local operator, but it can in some cases be faster, as the number of SCF iterations in the KS cycle are greatly reduced. \clearpage \addcontentsline{toc}{section}{References} \bibliographystyle{unsrt} \bibliography{references} \end{document} gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/paw_note/references.bib000066400000000000000000000245501316441372200301630ustar00rootroot00000000000000% This file was created with JabRef 2.5. % Encoding: ISO8859_1 @ARTICLE{Blochl1994, author = {P. E. Bl{\"o}chl}, title = {Projector augmented-wave method}, journal = {Physical Review B}, year = {1994}, volume = {50}, pages = {17953--17979}, number = {24}, month = {Dec}, doi = {10.1103/PhysRevB.50.17953}, numpages = {26}, publisher = {American Physical Society}, review = {The original PAW paper.} } @ARTICLE{Blochl2003, author = {P. E. Bl{\"o}chl and C. J. F{\"o}rst and J. Schimpl}, title = {Projector Augmented Wave Method: ab-initio molecular dynamics with full wave functions}, journal = {Bulletin of Materials Science}, year = {2003}, volume = {26}, pages = {33--41}, review = {Review of the PAW method by Bl{\"o}chl and coworkers. Easier to read than the original.} } @ARTICLE{Dudarev1998, author = {Dudarev, S. L. and Botton, G. A. and Savrasov, S. Y. and Humphreys, C. J. and Sutton, A. P.}, title = {Electron-energy-loss spectra and the structural stability of nickel oxide: An LSDA+U study}, journal = {Phys. Rev. B}, year = {1998}, volume = {57}, pages = {1505--1509}, number = {3}, month = {Jan}, doi = {10.1103/PhysRevB.57.1505}, numpages = {4}, publisher = {American Physical Society} } @ARTICLE{Ferretti2007, author = {A Ferretti and A Calzolari and B Bonferroni and R Di Felice}, title = {Maximally localized Wannier functions constructed from projector-augmented waves or ultrasoft pseudopotentials}, journal = {Journal of Physics: Condensed Matter}, year = {2007}, volume = {19}, pages = {036215 (16pp)}, number = {3}, abstract = {We report a theoretical scheme that enables the calculation of maximally localized Wannier functions within the formalism of projector-augmented waves (PAW), which also includes the ultrasoft pseudopotential (USPP) approach. We give a description of the basic underlying formalism and explicitly write out all the required matrix elements using the common ingredients of the PAW/USPP theory. We report an implementation of the method in a form suitable for accepting the input electronic structure from USPP plane-wave DFT simulations. We apply the method to the calculation of Wannier functions, dipole moments and spontaneous polarizations for a range of test cases. A comparison with norm-conserving pseudopotentials is reported as a benchmark.}, doi = {10.1088/0953-8984/19/3/036215}, url = {http://stacks.iop.org/0953-8984/19/036215} } @ARTICLE{Gorling1994, author = {A. G\"orling and M. Levy}, title = {Exact Kohn-Sham scheme based on perturbation theory}, journal = PRA, year = {1994}, volume = {50}, pages = {196--204}, review = {Scheme for doing exact xc} } @ARTICLE{Kummel2003, author = {S. K\"ummel and J. P. Perdew}, title = {Simple Iterative Construction of the Optimized Effective Potential for Orbital Functionals, Including Exact Exchange}, journal = PRL, year = {2003}, volume = {90}, pages = {043004}, review = {Iterate from KLI to OEP: short} } @ARTICLE{Kresse1999, author = {G. Kresse and D. Joubert}, title = {From ultrasoft pseudopotentials to the projector augmented-wave method}, journal = {Physical Review B}, year = {1999}, volume = {59}, pages = {1758--1775}, month = {Jan}, abstract = {The formal relationship between ultrasoft (US) Vanderbilt-type pseudopotentials and Blchl's projector augmented wave (PAW) method is derived. It is shown that the total energy functional for US pseudopotentials can be obtained by linearization of two terms in a slightly modified PAW total energy functional. The Hamilton operator, the forces, and the stress tensor are derived for this modified PAW functional. A simple way to implement the PAW method in existing plane-wave codes supporting US pseudopotentials is pointed out. In addition, critical tests are presented to compare the accuracy and efficiency of the PAW and the US pseudopotential method with relaxed core all electron methods. These tests include small molecules (H2, H2O, Li2, N2, F2, BF3, SiF4) and several bulk systems (diamond, Si, V, Li, Ca, CaF2, Fe, Co, Ni). Particular attention is paid to the bulk properties and magnetic energies of Fe, Co, and Ni.}, doi = {10.1103/PhysRevB.59.1758}, numpages = {17}, publisher = {American Physical Society}, review = {From USPP to PAW} } @ARTICLE{Marsman2006, author = {M. Marsman and G. Kresse}, title = {Relaxed core projector-augmented-wave method}, journal = {The Journal of Chemical Physics}, year = {2006}, volume = {125}, pages = {104101}, number = {10}, eid = {104101}, doi = {10.1063/1.2338035}, keywords = {density functional theory; SCF calculations}, numpages = {12}, publisher = {AIP}, url = {http://link.aip.org/link/?JCP/125/104101/1} } @ARTICLE{Paier2005, author = {Joachim Paier and Robin Hirschl and Martijn Marsman and Georg Kresse}, title = {The Perdew--Burke--Ernzerhof exchange-correlation functional applied to the G2-1 test set using a plane-wave basis set}, journal = {The Journal of Chemical Physics}, year = {2005}, volume = {122}, pages = {234102}, number = {23}, eid = {234102}, doi = {10.1063/1.1926272}, keywords = {molecular configurations; dissociation energies; ab initio calculations; electron correlations}, numpages = {13}, publisher = {AIP}, review = {Implementation of exact exchange in VASP, (PAW program), and very large test on molecular systems.}, url = {http://link.aip.org/link/?JCP/122/234102/1} } @ARTICLE{Rohrbach2004, author = {Rohrbach, A. and Hafner, J. and Kresse, G.}, title = {Molecular adsorption on the surface of strongly correlated transition-metal oxides: A case study for CO/NiO(100)}, journal = {Physical Review B}, year = {2004}, volume = {69}, pages = {075413}, number = {7}, month = {Feb}, doi = {10.1103/PhysRevB.69.075413}, numpages = {13}, publisher = {American Physical Society} } @Article{Rostgaard2010, title = {Fully self-consistent GW calculations for molecules}, author = {Rostgaard, C. and Jacobsen, K. W. and Thygesen, K. S.}, journal = {Phys. Rev. B}, volume = {81}, number = {8}, pages = {085103}, numpages = {10}, year = {2010}, month = {Feb}, doi = {10.1103/PhysRevB.81.085103}, publisher = {American Physical Society} } @ARTICLE{Tang2009, author = {W Tang and E Sanville and G Henkelman}, title = {A grid-based Bader analysis algorithm without lattice bias}, journal = {Journal of Physics: Condensed Matter}, year = {2009}, volume = {21}, pages = {084204 (7pp)}, number = {8}, abstract = {A computational method for partitioning a charge density grid into Bader volumes is presented which is efficient, robust, and scales linearly with the number of grid points. The partitioning algorithm follows the steepest ascent paths along the charge density gradient from grid point to grid point until a charge density maximum is reached. In this paper, we describe how accurate off-lattice ascent paths can be represented with respect to the grid points. This improvement maintains the efficient linear scaling of an earlier version of the algorithm, and eliminates a tendency for the Bader surfaces to be aligned along the grid directions. As the algorithm assigns grid points to charge density maxima, subsequent paths are terminated when they reach previously assigned grid points. It is this grid-based approach which gives the algorithm its efficiency, and allows for the analysis of the large grids generated from plane-wave-based density functional theory calculations.}, pdf = {Tang2009.pdf}, url = {http://stacks.iop.org/0953-8984/21/084204} } @ARTICLE{Thygesen2005, author = {Thygesen, K. S. and Hansen, L. B. and Jacobsen, K. W.}, title = {Partly occupied Wannier functions: Construction and applications}, journal = {Physical Review B}, year = {2005}, volume = {72}, pages = {125119}, number = {12}, month = sep, abstract = {We have developed a practical scheme to construct partly occupied, maximally localized Wannier functions (WFs) for a wide range of systems. We explain and demonstrate how the inclusion of selected unoccupied states in the definition of the WFs can improve both their localization and symmetry properties. A systematic selection of the relevant unoccupied states is achieved by minimizing the spread of the resulting WFs. The method is applied to a silicon cluster, a copper crystal, and a Cu(100) surface with nitrogen adsorbed. In all cases we demonstrate the existence of a set of WFs with particularly good localization and symmetry properties, and we show that this set of WFs is characterized by a maximal average localization.} } @ARTICLE{Walter2008, author = {Michael Walter and Hannu H{\"a}kkinen and Lauri Lehtovaara and Martti Puska and Jussi Enkovaara and Carsten Rostgaard and Jens J{\o}rgen Mortensen}, title = {Time-dependent density-functional theory in the projector augmented-wave method}, journal = {The Journal of Chemical Physics}, year = {2008}, volume = {128}, pages = {244101}, number = {24}, eid = {244101}, doi = {10.1063/1.2943138}, keywords = {density functional theory; excited states; photoacoustic spectra; potential energy surfaces}, numpages = {10}, publisher = {AIP}, url = {http://link.aip.org/link/?JCP/128/244101/1} } @ARTICLE{Yin2009, author = {F. Yin and J. Akola and P. Koskinen and M. Manninen and R. E. Palmer}, title = {Bright Beaches of Nanoscale Potassium Islands on Graphite in STM Imaging}, journal = {Physical Review Letters}, year = {2009}, volume = {102}, pages = {106102}, number = {10}, eid = {106102}, doi = {10.1103/PhysRevLett.102.106102}, numpages = {4}, publisher = {APS}, review = {GPAW with linear external potential applied to STM simulation.}, url = {http://link.aps.org/abstract/PRL/v102/e106102} } @BOOK{Fiolhais2003, title = {A Primer in Density Functional Theory}, publisher = {Springer}, year = {2003}, editor = {C. Fiolhais and F. Nogueira and M. Margues}, volume = {620}, series = {Lecture Notes in Physics}, review = {Very good DFT book.} } @MISC{gpaw, title = {{The real-space PAW-DFT code GPAW is part of the CAMP Open-Source (CAMPOS) project.}}, note = {GPAW is freely available at https://wiki.fysik.dtu.dk/gpaw.}, review = {Where to find GPAW} } @comment{jabref-meta: selector_publisher:} @comment{jabref-meta: selector_author:} @comment{jabref-meta: selector_journal:} @comment{jabref-meta: selector_keywords:} gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/000077500000000000000000000000001316441372200245075ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/agts.py000066400000000000000000000003411316441372200260150ustar00rootroot00000000000000def agts(queue): top = queue.add('top.py', ncpus=8) queue.add('pdos.py', deps=top, creates='pdos.png') calc = queue.add('lcaodos_gs.py', ncpus=8) queue.add('lcaodos_plt.py', deps=calc, creates='lcaodos.png') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/lcaodos_gs.py000066400000000000000000000013001316441372200271700ustar00rootroot00000000000000from ase.build import mx2 from gpaw import GPAW, FermiDirac atoms = mx2(formula='HfS2', kind='1T', a=3.648, thickness=2.895, size=(1, 1, 1), vacuum=12.0) atoms.center(vacuum=6.0, axis=2) name = atoms.get_chemical_formula(mode='hill') h = 0.18 kx = 9 ky = 9 kz = 1 calc = GPAW(mode='lcao', h=h, kpts={'size': (kx, ky, kz), 'gamma': True}, xc='PBE', basis='dzp', parallel={'band': 1}, symmetry='off', convergence={'bands': -2}, maxiter=600, txt=None, occupations=FermiDirac(width=0.01)) atoms.set_calculator(calc) atoms.get_potential_energy() calc.write(name + '.gpw') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/lcaodos_plt.py000066400000000000000000000031401316441372200273620ustar00rootroot00000000000000import matplotlib.pyplot as plt import numpy as np from ase.io import read from ase.units import Hartree from gpaw import GPAW from gpaw.utilities.dos import RestartLCAODOS, fold name = 'HfS2' calc = GPAW(name + '.gpw', txt=None) atoms = read(name + '.gpw') ef = calc.get_fermi_level() dos = RestartLCAODOS(calc) energies, weights = dos.get_subspace_pdos(range(51)) e, w = fold(energies * Hartree, weights, 2000, 0.1) e, m_s_pdos = dos.get_subspace_pdos([0, 1]) e, m_s_pdos = fold(e * Hartree, m_s_pdos, 2000, 0.1) e, m_p_pdos = dos.get_subspace_pdos([2, 3, 4]) e, m_p_pdos = fold(e * Hartree, m_p_pdos, 2000, 0.1) e, m_d_pdos = dos.get_subspace_pdos([5, 6, 7, 8, 9]) e, m_d_pdos = fold(e * Hartree, m_d_pdos, 2000, 0.1) e, x_s_pdos = dos.get_subspace_pdos([25]) e, x_s_pdos = fold(e * Hartree, x_s_pdos, 2000, 0.1) e, x_p_pdos = dos.get_subspace_pdos([26, 27, 28]) e, x_p_pdos = fold(e * Hartree, x_p_pdos, 2000, 0.1) w_max = [] for i in range(len(e)): if (-4.5 <= e[i] - ef <= 4.5): w_max.append(w[i]) w_max = np.asarray(w_max) # Plot things: plt.plot(e - ef, w, label='Total', c='k', lw=2, alpha=0.7) plt.plot(e - ef, x_s_pdos, label='X-s', c='g', lw=2, alpha=0.7) plt.plot(e - ef, x_p_pdos, label='X-p', c='b', lw=2, alpha=0.7) plt.plot(e - ef, m_s_pdos, label='M-s', c='y', lw=2, alpha=0.7) plt.plot(e - ef, m_p_pdos, label='M-p', c='c', lw=2, alpha=0.7) plt.plot(e - ef, m_d_pdos, label='M-d', c='r', lw=2, alpha=0.7) plt.axis(ymin=0., ymax=np.max(w_max), xmin=-4.5, xmax=4.5, ) plt.xlabel(r'$\epsilon - \epsilon_F \ \rm{(eV)}$') plt.ylabel('DOS') plt.legend(loc=1) plt.savefig('lcaodos.png') plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/p1.py000066400000000000000000000011231316441372200253760ustar00rootroot00000000000000from gpaw import GPAW, restart import pickle slab, calc = restart('top.gpw') c_mol = GPAW('CO.gpw') molecule = range(len(slab))[-2:] e_n = [] P_n = [] for n in range(c_mol.get_number_of_bands()): print('Band: ', n) wf_k = [kpt.psit_nG[n] for kpt in c_mol.wfs.kpt_u] P_aui = [[kpt.P_ani[a][n] for kpt in c_mol.wfs.kpt_u] for a in range(len(molecule))] e, P = calc.get_all_electron_ldos(mol=molecule, wf_k=wf_k, spin=0, P_aui=P_aui, raw=True) e_n.append(e) P_n.append(P) pickle.dump((e_n, P_n), open('top.pickle', 'wb')) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/p2.py000066400000000000000000000007241316441372200254050ustar00rootroot00000000000000from ase.units import Hartree from gpaw import GPAW from gpaw.utilities.dos import fold import pickle import matplotlib.pyplot as plt e_f = GPAW('top.gpw').get_fermi_level() e_n, P_n = pickle.load(open('top.pickle', 'rb')) for n in range(2, 7): e, ldos = fold(e_n[n] * Hartree, P_n[n], npts=2001, width=0.2) plt.plot(e - e_f, ldos, label='Band: ' + str(n)) plt.legend() plt.axis([-15, 10, None, None]) plt.xlabel('Energy [eV]') plt.ylabel('PDOS') plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/pdos.py000066400000000000000000000016321316441372200260300ustar00rootroot00000000000000from gpaw import GPAW, restart import matplotlib.pyplot as plt # Density of States plt.subplot(211) slab, calc = restart('top.gpw') e, dos = calc.get_dos(spin=0, npts=2001, width=0.2) e_f = calc.get_fermi_level() plt.plot(e - e_f, dos) plt.axis([-15, 10, None, 4]) plt.ylabel('DOS') molecule = range(len(slab))[-2:] plt.subplot(212) c_mol = GPAW('CO.gpw') for n in range(2, 7): print('Band', n) # PDOS on the band n wf_k = [kpt.psit_nG[n] for kpt in c_mol.wfs.kpt_u] P_aui = [[kpt.P_ani[a][n] for kpt in c_mol.wfs.kpt_u] for a in range(len(molecule))] e, dos = calc.get_all_electron_ldos(mol=molecule, spin=0, npts=2001, width=0.2, wf_k=wf_k, P_aui=P_aui) plt.plot(e - e_f, dos, label='Band: ' + str(n)) plt.legend() plt.axis([-15, 10, None, None]) plt.xlabel('Energy [eV]') plt.ylabel('All-Electron PDOS') plt.savefig('pdos.png') plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/pdos.rst000066400000000000000000000257751316441372200262260ustar00rootroot00000000000000.. _pdos: ================= Density Of States ================= The density of states is defined by .. math:: \rho(\varepsilon) = \sum_n \langle\psi_n|\psi_n\rangle \delta(\varepsilon-\varepsilon_n), where `\varepsilon_n` is the eigenvalue of the eigenstate `|\psi_n\rangle`. Inserting a complete orthonormal basis, this can be rewritten as .. math:: \begin{array}{rlrl} \rho(\varepsilon) &= \sum_i \rho_i(\varepsilon) ,& \rho_i(\varepsilon) &= \sum_n \langle \psi_n | i \rangle \langle i | \psi_n \rangle \delta(\varepsilon - \varepsilon_n)\\ \rho(\varepsilon) &= \int\!\mathrm{d}r \rho(r, \varepsilon),& \rho(r, \varepsilon) &= \sum_n \langle\psi_n | r \rangle \langle r | \psi_n \rangle \delta(\varepsilon - \varepsilon_n) \end{array} using that `1 = \sum_i | i \rangle\langle i |` and `1 = \int\!\mathrm{d}r |r\rangle\langle r|`. `\rho_i(\varepsilon)` is called the projected density of states (PDOS), and `\rho(r, \varepsilon)` the local density of states (LDOS). Notice that an energy integrating of the LDOS multiplied by a Fermi distribution gives the electron density .. math:: \int\!\mathrm{d}\varepsilon\, n_F(\varepsilon) \rho(r, \varepsilon) = n(r) Summing the PDOS over `i` gives the spectral weight of orbital `i`. A GPAW calculator gives access to four different kinds of projected density of states: * Total density of states. * Molecular orbital projected density of states. * Atomic orbital projected density of states. * Wigner-Seitz local density of states. Each of which are described in the following sections. --------- Total DOS --------- The total density of states can be obtained by the GPAW calculator method ``get_dos(spin=0, npts=201, width=None)``. ---------------------- Molecular Orbital PDOS ---------------------- As shown in the section `Density Of States`_, the construction of the PDOS requires the projection of the Kohn-Sham eigenstates `|\psi_n\rangle` onto a set of orthonormal states `|\psi_{\bar n}\rangle`. .. math:: \rho_{\bar n}(\varepsilon) = \sum_n | \langle \psi_{\bar n} | \psi_n \rangle |^2 \delta(\varepsilon - \varepsilon_n) The all electron overlaps `\langle \psi_{\bar n}|\psi_n\rangle` can be calculated within the PAW formalism from the pseudo wave functions `|\tilde\psi\rangle` and their projector overlaps by [#Blo94]_: .. math:: \langle \psi_{\bar n} | \psi_n\rangle = \langle \tilde \psi_{\bar n} | \tilde \psi_n \rangle + \sum_a \sum_{i_1i_2} \langle \tilde \psi_{\bar n} | \tilde p_{i_1}^a \rangle \Delta S^a_{i_1i_2} P^a_{ni_2}, where `\Delta S^a_{i_1i_2} = \langle\phi_{i_1}^a|\phi_{i_2}^a\rangle - \langle\tilde\phi_{i_1}^a|\tilde\phi_{i_2}^a\rangle` is the overlap metric, `\phi_i^a(r)`, `\tilde \phi_i^a(r)`, and `\tilde p^a_i(r)` are the partial waves, pseudo partial waves and projector functions of atom `a` respectively, and `P^a_{ni} = \langle \tilde p_i^a|\tilde\psi_n\rangle`. If one chooses the states `|\psi_{\bar n}\rangle` as eigenstates of a different reference Kohn-Sham system, with the projector overlaps `\bar P_{\bar n i}^a`, the PDOS relative to these states can simply be calculated by .. math:: \langle \psi_{\bar n} | \psi_n\rangle = \langle \tilde \psi_{\bar n} | \tilde \psi_n \rangle + \sum_a \sum_{i_1i_2} \bar P_{\bar n i_1}^{a*} \Delta S^a_{i_1i_2} P^a_{ni_2}. The example below calculates the density of states for CO adsorbed on a Pt(111) slab and the density of states projected onto the gas phase orbitals of CO. The ``.gpw`` files can be generated with the script :git:`~doc/documentation/pdos/top.py` PDOS script (:git:`~doc/documentation/pdos/pdos.py`): .. literalinclude:: pdos.py .. image:: pdos.png When running the script `\int d\varepsilon\rho_i(\varepsilon)` is printed for each spin and k-point. The value should be close to one if the orbital `\psi_i(r)` is well represented by an expansion in Kohn-Sham orbitals and thus the integral is a measure of the completeness of the Kohn-Sham system. The bands 7 and 8 are delocalized and are not well represented by an expansion in the slab eigenstates (Try changing ``range(2,7)`` to ``range(2,9)`` and note the integral is less than one). The function ``calc.get_all_electron_ldos()`` calculates the square modulus of the overlaps and multiply by normalized gaussians of a certain width. The energies are in ``eV`` and relative to the average potential. Setting the keyword ``raw=True`` will return only the overlaps and energies in Hartree. It is useful to simply save these in a ``.pickle`` file since the ``.gpw`` files with wave functions can be quite large. The following script pickles the overlaps Pickle script (:git:`~doc/documentation/pdos/p1.py`): .. literalinclude:: p1.py Plot PDOS (:git:`~doc/documentation/pdos/p2.py`): .. literalinclude:: p2.py .. [#Blo94] P. E. Blöchl, Phys. Rev. B 50, 17953 (1994) ------------------- Atomic Orbital PDOS ------------------- If one chooses to project onto the all electron partial waves (i.e. the wave functions of the isolated atoms) `\phi_i^a`, we see directly from the expression of section `Molecular Orbital PDOS`_, that the relevant overlaps within the PAW formalism is .. math:: \langle \phi^a_i | \psi_n\rangle = \langle \tilde \phi^a_i | \tilde \psi_n \rangle + \sum_{a'} \sum_{i_1i_2} \langle \tilde \phi^a_i | \tilde p_{i_1}^{a'} \rangle \Big(\langle \phi_{i_1}^{a'} | \phi_{i_2}^{a'} \rangle - \langle \tilde \phi_{i_1}^{a'} | \tilde \phi_{i_2}^{a'}\rangle \Big)\langle \tilde p^{a'}_{i_2} | \tilde \psi_n \rangle Using that projectors and pseudo partial waves form a complete basis within the augmentation spheres, this can be re-expressed as .. math:: \langle \phi^a_i | \psi_n \rangle = P^a_{ni} + \sum_{a' \neq a} \sum_{i_1i_2} \langle \tilde \phi^a_i | \tilde p^{a'}_{i_1} \rangle \Delta S^{a'}_{i_1i_2} P^{a'}_{ni_2} if the chosen orbital index `i` correspond to a bound state, the overlaps `\langle \tilde \phi^a_i | \tilde p^{a'}_{i_1} \rangle`, `a'\neq a` will be small, and we see that we can approximate .. math:: \langle \phi^a_i | \psi_n \rangle \approx \langle \tilde p_i^a | \tilde \psi_n \rangle We thus define an atomic orbital PDOS by .. math:: \rho^a_i(\varepsilon) = \sum_n |\langle\tilde p_i^a | \tilde \psi_n \rangle |^2 \delta(\varepsilon - \varepsilon_n) \approx \sum_n | \langle \phi_i^a | \psi_n \rangle |^2 \delta(\varepsilon - \varepsilon_n) available from a GPAW calculator from the method ``get_orbital_ldos(a, spin=0, angular='spdf', npts=201, width=None)``. A specific projector function for the given atom can be specified by an integer value for the keyword ``angular``. Specifying a string value for ``angular``, being one or several of the letters s, p, d, and f, will cause the code to sum over all bound state projectors with the specified angular momentum. The meaning of an integer valued ``angular`` keyword can be determined by running:: >>> from gpaw.utilities.dos import print_projectors >>> print_projectors('Fe') Note that the set of atomic partial waves do not form an orthonormal basis, thus the properties of the introduction are not fulfilled. This PDOS can however be used as a qualitative measure of the local character of the DOS. An example of how to obtain and plot the *d* band on atom number ``10`` of a stored calculation, is shown below:: import numpy as np import pylab as plt from gpaw import GPAW calc = GPAW('old_calculation.gpw', txt=None) energy, pdos = calc.get_orbital_ldos(a=10, angular='d') I = np.trapz(pdos, energy) center = np.trapz(pdos * energy, energy) / I width = np.sqrt(np.trapz(pdos * (energy - center)**2, energy) / I) plt.plot(energy, pdos) plt.xlabel('Energy (eV)') plt.ylabel('d-projected DOS on atom 10') plt.title('d-band center = %s eV, d-band width = %s eV' % (center, width)) plt.show() Warning: You should always plot the PDOS before using the calculated center and width to check that it is sensible. The very localized functions used to project onto can sometimes cause an artificial rising tail on the PDOS at high energies. If this happens, you should try to project onto LCAO orbitals instead of projectors, as these have a larger width. This however requires some calculation time, as the LCAO projections are not determined in a standard grid calculation. The projections onto the projector functions are always present, hence using these takes no extra computational effort. ----------------- Wigner-Seitz LDOS ----------------- For the Wigner-Seitz LDOS, the eigenstates are projected onto the function .. math:: \theta^a(r) = \begin{cases} 1 & \text{if for all } a' \neq a: |r - R^a| < | r - R^{a'}\\ 0 & \text{otherwise} \end{cases} This defines an LDOS: .. math:: \rho^a(\varepsilon) = \sum_n |\langle \theta^a| \psi_n \rangle|^2 \delta(\varepsilon - \varepsilon_n) Introducing the PAW formalism shows that the weights can be calculated by .. math:: |\langle \theta^a| \psi_n \rangle|^2 = |\langle \theta^a| \tilde \psi_n \rangle|^2 + \sum_{ij} P^{a*}_{ni} \Delta S^a_{ij} P^a_{nj}, This property can be accessed by ``calc.get_wigner_seitz_ldos(a, spin=0, npts=201, width=None)``. It represents a local probe of the density of states at atom `a`. Summing over all atomic sites reproduces the total DOS (more efficiently computed using ``calc.get_dos``). Integrating over energy gives the number of electrons contained in the region ascribed to atom `a` (more efficiently computed using ``calc.get_wigner_seitz_densities(spin)``. Notice that the domain ascribed to each atom is deduced purely on a geometrical criterion. A more advanced scheme for assigning the charge density to atoms is the :ref:`bader analysis` algorithm (all though the Wigner-Seitz approach is faster). --------------------- PDOS on LCAO orbitals --------------------- DOS can be also be projected onto the LCAO basis functions. A subspace of the atomic orbitals is required as an input onto which one wants the projected density of states. For example, if the p orbitals of a particular atom in have the indices 41, 42 and 43, and the PDOS is required on the subpspace of these three orbital then an array ``[41, 42, 43]`` has to be given as an input for the PDOS calculation. An example and with explanation is provided below. LCAO PDOS (see :git:`~doc/documentation/pdos/lcaodos_gs.py` and :git:`~doc/documentation/pdos/lcaodos_plt.py`): .. literalinclude:: lcaodos_plt.py :end-before: things Few comments about the above script. There are 51 basis functions in the calculations and the total density of state (DOS) is calculated by projecting the DOS on all the orbitals. The projected density of state (PDOS) is calculated for other orbitals as well, for example, s, p and d orbitals of the metal atom and s and p orbitals for the chalcogen atoms. In the subspace of orbitals the basis localized part of the basis functions is not taken into account and only the confined orbital part (larger rc) is chosen. There is a smarter way of getting the above orbitals in an automated way but it will come later. .. image:: lcaodos.png Last part of :git:`~doc/documentation/pdos/lcaodos_plt.py` script: .. literalinclude:: lcaodos_plt.py :start-after: things gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/pdos/top.py000066400000000000000000000013231316441372200256620ustar00rootroot00000000000000from ase.build import fcc111, add_adsorbate from gpaw import GPAW, PW # Slab with CO: slab = fcc111('Pt', size=(1, 1, 3)) add_adsorbate(slab, 'C', 2.0, 'ontop') add_adsorbate(slab, 'O', 3.15, 'ontop') slab.center(axis=2, vacuum=4.0) slab.calc = GPAW(mode=PW(400), xc='RPBE', kpts=(12, 12, 1), convergence={'bands': -10}, txt='top.txt') slab.get_potential_energy() slab.calc.write('top.gpw', mode='all') # Molecule molecule = slab[-2:] molecule.calc = GPAW(mode=PW(400), xc='RPBE', kpts=(12, 12, 1), txt='CO.txt') molecule.get_potential_energy() molecule.calc.write('CO.gpw', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/poisson.rst000066400000000000000000000126251316441372200257740ustar00rootroot00000000000000.. _advancedpoisson: ======================== Advanced Poisson solvers ======================== The ``PoissonSolver`` with default parameters uses zero boundary conditions on the cell boundaries. This becomes a problem in systems involving large dipole moment, for example (due to, e.g., plasmonic charge oscillation on a nanoparticle). The potential due to the dipole is long-ranged and, thus, the converged potential requires large vacuum sizes. However, in LCAO approach large vacuum size is often unnecessary. Thus, to avoid using large vacuum sizes but get converged potential, one can use two approaches or their combination: 1) use multipole moment corrections or 2) solve Poisson equation on a extended grid. These two approaches are implemented in ``ExtendedPoissonSolver``. Also regular PoissonSolver in GPAW has the option remove_moment. In any nano-particle plasmonics calculation, it is necessary to use multipole correction. Without corrections more than 10Å of vacuum is required for converged results. Multipole moment corrections ---------------------------- The boundary conditions can be improved by adding multipole moment corrections to the density so that the corresponding multipoles of the density vanish. The potential of these corrections is added to the obtained potential. For a description of the method, see [#Castro2003]_. This can be accomplished by following solver:: from gpaw.poisson_extended import ExtendedPoissonSolver poissonsolver = ExtendedPoissonSolver(eps=eps, moment_corrections=4) This corrects the 4 first multipole moments, i.e., `s`, `p_x`, `p_y`, and `p_z` type multipoles. The range of multipoles can be changed by changing ``moment_corrections`` parameter. For example, ``moment_correction=9`` includes in addition to the previous multipoles, also `d_{xx}`, `d_{xy}`, `d_{yy}`, `d_{yz}`, and `d_{zz}` type multipoles. This setting suffices usually for spherical-like metallic nanoparticles, but more complex geometries require inclusion of very high multipoles or, alternatively, a multicenter multipole approach. For this, consider the advanced syntax of the moment_corrections. The previous code snippet is equivalent to:: from gpaw.poisson_extended import ExtendedPoissonSolver poissonsolver = ExtendedPoissonSolver(eps=eps, moment_corrections=[{'moms': range(4), 'center': None}]) Here ``moment_corrections`` is a list of dictionaries with following keywords: ``moms`` specifies the considered multipole moments, e.g., ``range(4)`` equals to `s`, `p_x`, `p_y`, and `p_z` multipoles, and ``center`` specifies the center of the added corrections in atomic units (``None`` corresponds to the center of the cell). As an example, consider metallic nanoparticle dimer where the nanoparticle centers are at ``(x1, y1, z1)`` Å and ``(x2, y2, z2)`` Å. In this case, the following settings for the ``ExtendedPoissonSolver`` may be tried out:: import numpy as np from ase.units import Bohr from gpaw.poisson_extended import ExtendedPoissonSolver moms = range(4) center1 = np.array([x1, y1, z1]) / Bohr center2 = np.array([x2, y2, z2]) / Bohr poissonsolver = ExtendedPoissonSolver(eps=eps, moment_corrections=[{'moms': moms, 'center': center1}, {'moms': moms, 'center': center2}]) When multiple centers are used, the multipole moments are calculated on non-overlapping regions of the calculation cell. Each point in space is associated to its closest center. See `Voronoi diagrams `_ for analogous illustration of the partitioning of a plane. .. [#Castro2003] A. Castro, A. Rubio, and M. J. Stott, Solution of Poisson's equation for finite systems using plane-wave methods, *Can. J. Phys.* **81**, 1151 (2003). `doi:10.1139/p03-078 `_ Extended Poisson grid --------------------- The multipole correction scheme is not always successful for complex system geometries. For these cases, one can use a separate large grid just for solving the Hartree potential. Such extended grid can be set up as follows:: from gpaw.poisson_extended import ExtendedPoissonSolver poissonsolver = ExtendedPoissonSolver(eps=eps, extended={'gpts': (128, 128, 128), 'useprev': False}) This solves the Poisson equation on an extended grid. The size of the grid is given **in units of coarse grid**. Thus, in this case the fine extended grid used in evaluating the Hartree potential is of size (256, 256, 256). It is important to **use grid sizes that are divisible by high powers of 2 to accelerate the multigrid scheme** used in ``PoissonSolver``. The ``useprev`` parameter describes whether the ``ExtendedPoissonSolver`` uses the previous solution as a initial potential for subsequent calls of the function ``solver.solve()``. It is often reasonable to use ``useprev = True``, which mimics the behaviour of the usual ``PoissonSolver`` in most cases. In such cases, the value ``useprev = False`` would lead to significant performance decrease since the Hartree potential is always calculated from scratch. .. note:: When extended grid is in use, the implementation neglects the ``phi`` parameter given to the ``solver.solve()`` due to its incompatibility with the extended grid. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/response.txt000066400000000000000000000172401316441372200261450ustar00rootroot000000000000002011-09-15 10.1166/mex.2011.1027 Computing C1s X-ray Absorption for Single-Walled Carbon Nanotubes with Distinct Electronic Type 2011-10-03 10.1103/PhysRevLett.107.156401 Dispersive and Covalent Interactions between Graphene and Metal Surfaces from the Random Phase Approximation 2011-12-20 10.1103/PhysRevB.84.235430 First-principles study of surface plasmons on Ag(111) and H/Ag(111) 2012-02-16 10.1103/PhysRevB.85.085424 Channeling of charge carrier plasmons in carbon nanotubes 2012-07-19 10.1103/PhysRevB.86.045208 Optical properties of bulk semiconductors and graphene/boron nitride: The Bethe-Salpeter equation with derivative discontinuity-corrected density functional energies 2012-08-15 10.1103/PhysRevB.86.081103 Extending the random-phase approximation for electronic correlation energies: The renormalized adiabatic local density approximation 2012-12-20 10.1103/PhysRevB.86.241404 Conventional and acoustic surface plasmons on noble metal surfaces: A time-dependent density functional theory study 2012-12-26 10.1103/PhysRevB.86.245129 Spatially resolved quantum plasmon modes in metallic nano-films from first-principles 2013-01-30 10.1103/PhysRevB.87.045428 Stratified graphene/noble metal systems for low-loss plasmonics applications 2013-02-13 10.1103/PhysRevB.87.075111 Random phase approximation applied to solids, molecules, and graphene-metal interfaces: From van der Waals to covalent bonding 2013-02-25 10.1103/PhysRevB.87.075207 Formation energies of group I and II metal oxides using random phase approximation 2013-06-19 10.1103/PhysRevB.87.235312 Acoustic phonon limited mobility in two-dimensional semiconductors: Deformation potential and piezoelectric scattering in monolayer MoS2 from first principles 2013-06-21 10.1063/1.4811455 Optoelectronic properties of single-layer, double-layer, and bulk tin sulfide: A theoretical study 2013-06-24 10.1103/PhysRevB.87.235132 Quasiparticle GW calculations for solids, molecules, and two-dimensional materials 2013-06-26 10.1103/PhysRevB.87.235433 Visualizing hybridized quantum plasmons in coupled nanowires: From classical to tunneling regime 2013-09-18 10.1103/PhysRevB.88.115131 Beyond the random phase approximation: Improved description of short-range correlation by a renormalized adiabatic local density approximation 2013-10-23 10.1103/PhysRevB.88.155128 Plasmons in metallic monolayer and bilayer transition metal dichalcogenides 2013-12-15 10.1016/j.cpc.2013.07.014 Graphics Processing Unit acceleration of the Random Phase Approximation in the projector augmented wave method 2013-12-26 10.1103/PhysRevB.88.245309 How dielectric screening in two-dimensional crystals affects the convergence of excited-state calculations: Monolayer MoS2 2013-12-27 10.1103/PhysRevB.88.245204 Calculated formation and reaction energies of 3d transition metal oxides using a hierachy of exchange-correlation functionals 2014-04-28 10.1063/1.4871875 Static correlation beyond the random phase approximation: Dissociating H-2 with the Bethe-Salpeter equation and time-dependent GW 2014-05-15 10.1007/s00339-013-8034-3 Atomistic approach for simulating plasmons in nanostructures 2014-05-21 10.1103/PhysRevLett.112.203001 Accurate Ground-State Energies of Solids and Molecules from Time-Dependent Density-Functional Theory 2014-07-15 10.1117/1.OE.53.7.071808 Optical and other material properties of SiO2 from ab initio studies 2014-08-15 10.1016/j.ssc.2014.04.023 MoS2 nanostructures: Semiconductors with metallic edges 2014-10-29 10.1103/PhysRevB.90.161410 Plasmons on the edge of MoS2 nanostructures 2014-12-15 10.1002/pssb.201451171 PFO-BPy solubilizers for SWNTs: Modelling of polymers from oligomers 2014-12-15 10.1002/pssb.201451174 Theoretical electron energy loss spectroscopy of isolated graphene 2014-12-15 10.1364/OE.22.030725 Effects of exchange correlation functional on optical permittivity of gold and electromagnetic responses 2014-12-17 10.1088/0953-8984/26/50/505302 Quantum size effect on dielectric function of ultrathin metal film: a first-principles study of Al(111) 2015-01-13 10.1103/PhysRevB.91.045418 pi-plasmon dispersion in free-standing graphene by momentum-resolved electron energy-loss spectroscopy 2015-01-15 10.1002/cpe.3199 Design and performance characterization of electronic structure calculations on massively parallel supercomputers: a case study of GPAW on the Blue Gene/P architecture 2015-01-15 10.1039/c5ta01586c Calculated optical absorption of different perovskite phases 2015-04-24 10.1103/PhysRevB.91.165309 Band-gap engineering of functional perovskites through quantum confinement and tunneling 2015-05-11 10.1103/PhysRevB.91.195407 Changing character of electronic transitions in graphene: From single-particle excitations to plasmons 2015-05-15 10.1016/j.progsurf.2014.12.002 The influence of electron confinement, quantum size effects, and film morphology on the dispersion and the damping of plasmonic modes in Ag and Au thin films 2015-07-01 10.1016/j.nimb.2014.11.080 Computation of electron energy loss spectra by an iterative method 2015-07-15 10.1021/acs.nanolett.5b01251 Dielectric Genome of van der Waals Heterostructures 2015-09-14 10.1063/1.4919236 Adiabatic-connection fluctuation-dissipation DFT for the structural properties of solids-The renormalized ALDA and electron gas kernels 2015-09-21 10.1103/PhysRevB.92.115140 Improved description of metal oxide stability: Beyond the random phase approximation with renormalized kernels 2016-01-19 10.1016/j.ssc.2015.11.017 Strain engineering of electronic properties of transition metal dichalcogenide monolayers 2016-01-25 10.1103/PhysRevB.93.035133 Hubbard-U corrected Hamiltonians for non-self-consistent random-phase approximation total-energy calculations: A study of ZnS, TiO2, and NiO 2016-01-28 10.1021/acs.jpcc.5b10025 Photoinduced Absorption within Single-Walled Carbon Nanotube Systems 2016-02-02 10.1103/PhysRevLett.116.056401 Simple Screened Hydrogen Model of Excitons in Two-Dimensional Materials 2016-02-15 10.1007/s11082-015-0370-4 A model for terahertz plasmons in graphene 2016-03-15 10.1016/j.commatsci.2015.12.012 Plasmonic and dielectric properties of ideal graphene 2016-07-12 10.1103/PhysRevB.94.035128 Limitations of effective medium theory in multilayer graphite/hBN heterostructures 2016-07-25 10.1088/1367-2630/18/7/073043 Exciton ionization in multilayer transition-metal dichalcogenides 2016-09-28 10.1039/c6cp05188j Strong 1D localization and highly anisotropic electron-hole masses in heavy-halogen functionalized graphenes 2016-09-29 10.1103/PhysRevB.94.125444 Band-gap control in phosphorene/BN structures from first-principles calculations 2016-10-06 10.1103/PhysRevB.94.155406 Efficient many-body calculations for two-dimensional materials using exact limits for the screened potential: Band gaps of MoS2, h-BN, and phosphorene 2016-10-27 10.1103/PhysRevB.94.155310 Strain dependence of band gaps and exciton energies in pure and mixed transition-metal dichalcogenides 2017-04-11 10.1038/s41699-017-0003-9 Probing the local nature of excitons and plasmons in few-layer MoS2 2017-04-24 10.1038/ncomms15133 Band structure engineered layered metals for low-loss plasmonics 2017-05-26 10.1103/PhysRevB.95.195158 Convergence behavior of the random phase approximation renormalized correlation energy 2017-06-05 10.1103/PhysRevB.95.235405 Quantum-size effects in the loss function of Pb(111) thin films: An ab initio study 2017-06-07 10.1088/1361-648X/aa6c4f Robust theoretical modelling of core ionisation edges for quantitative electron energy loss spectroscopy of B- and N-doped graphene 2017-06-14 10.1103/PhysRevB.95.235123 Periodic GW calculations in the Gaussian and plane-waves scheme 2017-06-15 10.1088/2053-1583/aa6531 Band structure engineering in van der Waals heterostructures via dielectric screening: the G Delta W method gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/restart_files.rst000066400000000000000000000013361316441372200271450ustar00rootroot00000000000000.. _restart_files: ============= Restart files ============= Writing restart files ===================== Use ``calc.write('xyz.gpw')`` or ``calc.write('xyz.gpw', mode='all')`` to include also the wave functions. You can register an automatic call to the ``write`` method, every ``n``'th iteration like this:: calc.attach(calc.write, n, 'xyz.gpw') or:: calc.attach(calc.write, n, 'xyz.gpw', mode='all') Reading restart files ===================== The calculation can be read from file like this:: calc = GPAW('xyz.gpw') or this:: atoms, calc = restart('xyz.gpw') By adding the option txt=None you can suppress text output when restarting (e.g. when plotting a DOS):: atoms, calc = restart('xyz.gpw', txt=None) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/rmm-diis.rst000066400000000000000000000050041316441372200260140ustar00rootroot00000000000000.. _RMM-DIIS: ================================ The residual minimization method ================================ Algorithm --------- 1) Initial guess for wave functions (`\tilde{\psi}_n`). 2) Orthogonalize wavefunctions (make sure `\langle \tilde{\psi}_n | \hat{S} | \tilde{\psi}_m \rangle = \delta_{nm}`). 3) Calculate density (`\tilde{n}`, `D_{ij}^a`). 4) Calculate potential (`\tilde{v}`, `\Delta H_{ij}^a`). 5) Apply hamiltonian (`\hat{H}\tilde{\psi}_n`). 6) Subspace diagonalization (rotate `\tilde{\psi}_n` so that `\langle \tilde{\psi}_n | \hat{H} | \tilde{\psi}_m \rangle = \delta_{nm} \epsilon_n`). 7) Calculate residuals (`R_n = \hat{H}\tilde{\psi}_n - \epsilon_n \hat{S}\tilde{\psi}_n`). 8) Improve wave functions using the RMM-DIIS algorithm (see below). 9) Back to (2). RMM-DIIS step ------------- For each wave function we calculate the residual: .. math:: R_n = (\hat{H} - \epsilon_n \hat{S}) \tilde{\psi}_n New improved wave function: `\tilde{\psi}_n' = \tilde{\psi}_n + \lambda \hat{P} R_n`, where `\hat{P}` is a preconditioner_. Find step length `\lambda` by minimizing the norm of: .. math:: R_n' = (\hat{H} - \epsilon_n \hat{S}) \tilde{\psi}_n' Since we already have `R_n'`, we might as well use it to take an extra step (with the same step length as for the first step): .. math:: \tilde{\psi}_n \leftarrow \tilde{\psi}_n' + \lambda \hat{P} R_n' = \tilde{\psi}_n + \lambda \hat{P} R_n + \lambda \hat{P} R_n' See [Kresse96]_ for details. .. _preconditioner: Preconditioning --------------- .. hhhh image:: images/preconditioning.png :width: 3cm :align: center The ideal preconditioner would be: .. math:: \hat{P} = -(\hat{H} - \epsilon_n \hat{S})^{-1}. For the short wavelength parts of the residuals, `\hat{H} - \epsilon_n \hat{S}` will be dominated by the kinetic energy operator, so we have approximately `\hat{P} \simeq -\hat{T}^{-1}`. We calculate preconditioned residuals (`\tilde{R}_n = \hat{P} R_n`) by solving `\hat{T} \tilde{R}_n = -R_n` or equivalently .. math:: \frac{1}{2} \nabla^2 \tilde{R}_n = R_n approximately using multigrid techniques as described in [Briggs95]_. References ---------- .. [Kresse96] G. Kresse, J. Furthmüller: Phys. Rev. B 54, 11169 - 11186 (1996) "Efficient iterative schemes for ab initio total-energy calculations using a plane-wave basis set" .. [Briggs95] E. L. Briggs, D. J. Sullivan and J. Bernholc: Phys. Rev. B 52, R5471 (1995), "Large Scale Electronic Structure Calculations with Multigrid Acceleration" gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/scf_conv_eval/000077500000000000000000000000001316441372200263515ustar00rootroot00000000000000scf_conv_eval.rst000066400000000000000000000035651316441372200316440ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/scf_conv_eval.. _scf_conv_eval: ========================== SCF Convergence Evaluation ========================== This page presents influence of the choice of different parameters on the number of steps in the self-consistent total energy calculation. G2-1 ==== PBE0 total energy calculation of molecules from the G2-1 set. All systems are calculated in spin-polarized mode, with the default number of bands (left unspecified), unless stated otherwise. On the plots: the number of self-consistent steps (stats), the total run time, the systems with the largest number of steps, and the number of systems for which convergence succeeded. In the corresponding tables: the most common value of the total energy ("energy"), and the differences (run - "energy"). The dot sign denotes the above difference below a threshold (same as the printed precision of "energy" in eV), and "N/A" denotes a convergence failure. Only the systems that fail to converge or converge to a total energy above the threshold are given in the tables. Calculator used: GPAW mode='fd' (see :git:`gpaw/test/big/scf/g2_1_pbe0_fd.py`) .. image:: scf_g2_1_pbe0_fd_calculator_steps.png .. csv-table:: :file: scf_g2_1_pbe0_fd_energy.csv DeltaCodesDFT ============= PBE total energy calculation of bulk systems from http://molmod.ugent.be/DeltaCodesDFT All systems are calculated in spin-polarized mode, with the number of bands specified as ``nbands=-5``, unless stated otherwise. Corresponding dacapo https://wiki.fysik.dtu.dk/dacapo results given for comparison. The runs marked with "initial cg iter N" perform N ``eigensolver=cg`` iterations before switching to the selected eigensolver. Those initial iterations are included in the final reported number. Calculator used: GPAW mode=PW() (see :git:`gpaw/test/big/scf/dcdft_pbe_pw.py`) .. image:: scf_dcdft_pbe_pw_calculator_steps.png .. csv-table:: :file: scf_dcdft_pbe_pw_energy.csv gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft.txt000066400000000000000000000215551316441372200254200ustar00rootroot000000000000002009-01-15 10.1039/b904491d A density functional investigation of thiolate-protected bimetal PdAu24(SR)(18)(z) clusters: doping the superatom complex 2009-09-09 10.1021/ja905182g Characterization of Iron-Carbonyl-Protected Gold Clusters 2010-02-15 10.1103/PhysRevB.81.085103 Fully self-consistent GW calculations for molecules 2010-06-30 10.1088/0953-8984/22/25/253202 Electronic structure calculations with GPAW: a real-space implementation of the projector augmented-wave method 2010-09-30 10.1021/jp1015438 Thiolate-Protected Au-25 Superatoms as Building Blocks: Dimers and Crystals 2010-09-30 10.1021/jp9097342 On the Structure of a Thiolated Gold Cluster: Au-44(SR)(28)(2-) 2011-03-23 10.1021/ja111077e Electronic and Vibrational Signatures of the Au-102(p-MBA)(44) Cluster 2011-06-15 10.1002/ejic.201100374 The Al50Cp*(12) Cluster - A 138-Electron Closed Shell (L=6) Superatom 2011-09-07 10.1063/1.3632087 Evidence of superatom electronic shells in ligand-stabilized aluminum clusters 2011-10-21 10.1063/1.3651239 All-electron time-dependent density functional theory with finite elements: Time-propagation approach 2012-01-15 10.1039/c2cp23229d The electronic structure of Ge-9[Si(SiMe3)(3)](3)(-): a superantiatom complex 2012-01-15 10.1039/c2nr30444a One-pot synthesis and characterization of subnanometre-size benzotriazolate protected copper clusters 2012-04-14 10.1063/1.3700800 Nonadiabatic Ehrenfest molecular dynamics within the projector augmented-wave method 2012-05-14 10.1063/1.4712616 Enhanced charge transfer by phenyl groups at a rubrene/C-60 interface 2012-10-18 10.1021/jz301261x Experimental and Theoretical Determination of the Optical Gap of the Au-144(SC2H4Ph)(60) Cluster and the (Au/Ag)(144)(SC2H4Ph)(60) Nanoalloys 2013-01-15 10.1016/j.cpc.2012.08.001 Large nonadiabatic quantum molecular dynamics simulations on parallel computers 2013-01-15 10.1039/c3cp51685g Porphyrin adsorbed on the (10(1)over-bar0) surface of the wurtzite structure of ZnO - conformation induced effects on the electron transfer characteristics 2013-01-30 10.1103/PhysRevB.87.045428 Stratified graphene/noble metal systems for low-loss plasmonics applications 2013-08-22 10.1021/jp405769e Gold Nanowires: A Time-Dependent Density Functional Assessment of Plasmonic Behavior 2013-09-15 10.1038/ncomms3422 All-thiol-stabilized Ag-44 and Au12Ag32 nanoparticles with single-crystal structures 2013-11-15 10.1021/nn4046634 Birth of the Localized Surface Plasmon Resonance in Mono layer-Protected Gold Nanoclusters 2014-01-15 10.1039/c3py00853c Soluble and stable alternating main-chain merocyanine copolymers through quantitative spiropyran-merocyanine conversion 2014-04-02 10.1021/ja412141j Single Crystal XRD Structure and Theoretical Analysis of the Chiral Au30S(S-t-Bu)(18) Cluster 2014-05-14 10.1063/1.4869342 A divide-conquer-recombine algorithmic paradigm for large spatiotemporal quantum molecular dynamics simulations 2014-05-15 10.1007/s00339-013-8034-3 Atomistic approach for simulating plasmons in nanostructures 2014-08-06 10.1088/0953-8984/26/31/315013 Dynamical coupling of plasmons and molecular excitations by hybrid quantum/classical calculations: time-domain approach 2014-08-07 10.1021/jp505464z Ultrafast Electronic Relaxation and Vibrational Cooling Dynamics of Au-144(SC2H4Ph)(60) Nanocluster Probed by Transient Mid-IR Spectroscopy 2014-08-28 10.1021/jp505462m TDDFT Analysis of Optical Properties of Thiol Monolayer-Protected Gold and Intermetallic Silver-Gold Au-144(SR)(60) and Au84Ag60(SR)(60) Clusters 2014-09-15 10.1021/nl502571b Controlling Catalytic Selectivity on Metal Nanoparticles by Direct Photoexcitation of Adsorbate-Metal Bonds 2014-09-18 10.1021/jp501185q Superatomic S-2 Silver Clusters Stabilized by a Thiolate-Phosphine Monolayer: Insight into Electronic and Optical Properties of Ag-14(SC6H3F2)(12)(PPh3)(8) and Ag-16(SC6H3F2)(14)(DPPE)(4) 2014-11-06 10.1021/jp506935a Physical Factors Affecting Charge Transfer at the Pe-COOH-TiO2 Anatase Interface 2014-12-15 10.1002/pssb.201451171 PFO-BPy solubilizers for SWNTs: Modelling of polymers from oligomers 2015-01-15 10.1002/cpe.3199 Design and performance characterization of electronic structure calculations on massively parallel supercomputers: a case study of GPAW on the Blue Gene/P architecture 2015-01-15 10.1016/j.jcp.2014.10.052 Real-time adaptive finite element solution of time-dependent Kohn-Sham equation 2015-01-15 10.1039/c4cp02789b A DFT study of the effect of OH groups on the optical, electronic, and structural properties of TiO2 nanoparticles 2015-01-15 10.1039/c5cc04513d UV photoexcitation of a dissolved metalloid Ge-9 cluster compound and its extensive ultrafast response 2015-01-15 10.1039/c5cp00435g An old workhorse for new applications: Fe(dpm)(3) as a precursor for low-temperature PECVD of iron(III) oxide 2015-01-15 10.1039/c5nr04324g Pd2Au36(SR)(24) cluster: structure studies 2015-01-22 10.1021/jp511037x Silver Sulfide Nanoclusters and the Superatom Model 2015-01-28 10.1021/ja5109968 A Critical Size for Emergence of Nonbulk Electronic and Geometric Structures in Dodecanethiolate-Protected Au Clusters 2015-02-05 10.1021/jz502637b Copper Induces a Core Plasmon in Intermetallic Au(144,145)-xCux(SR)(60) Nanoclusters 2015-03-07 10.1063/1.4913739 Nanoplasmonics simulations at the basis set limit through completeness-optimized, local numerical basis sets 2015-03-15 10.1021/nn506711a Molecule-like Photodynamics of Au-102(pMBA)(44) Nano cluster 2015-03-24 10.1103/PhysRevB.91.115431 Localized surface plasmon resonance in silver nanoparticles: Atomistic first-principles time-dependent density-functional theory calculations 2015-04-30 10.1021/acs.jpcc.5b01068 The Role of the Anchor Atom in the Ligand of the Monolayer-Protected Au-25(XR)(18)(-) Nanocluster 2015-05-21 10.1021/jp510926q Theoretical Analysis of the M12Ag32(SR)(40)(4-) and X@M12Ag32(SR)(30)(4-) Nanoclusters (M = Au, Ag; X = H, Mn) 2015-07-02 10.1021/acs.jpclett.5b01045 Impact of Ga-V Codoping on Interfacial Electron Transfer in Dye-Sensitized TiO2 2015-07-20 10.1103/PhysRevB.92.045209 Beyond the Tamm-Dancoff approximation for extended systems using exact diagonalization 2015-08-14 10.1063/1.4928510 Subspace formulation of time-dependent density functional theory for large-scale calculations 2015-08-27 10.1021/acs.jpcc.5b07622 Photodynamics of a Molecular Water-Soluble Nanocluster Identified as Au-130(pMBA)(50) 2015-09-10 10.1021/acs.jpcc.5b05824 Superatom Model for Ag-S Nanocluster with Delocalized Electrons 2015-12-01 10.1103/PhysRevLett.115.236804 Quantized Evolution of the Plasmonic Response in a Stretched Nanorod 2015-12-14 10.1063/1.4937379 Nonlinear electronic excitations in crystalline solids using meta-generalized gradient approximation and hybrid functional in time-dependent density functional theory 2015-12-15 10.1021/acsnano.5b02850 Dynamic Diglyme-Mediated Self-Assembly of Gold Nanoclusters 2015-12-24 10.1021/acs.jpcc.5b10182 Charge Transfer at the Hybrid Interfaces in the Presence of Water: A Theoretical Study 2016-01-15 10.1039/c5nr08122j Tuning Ag-29 nanocluster light emission from red to blue with one and two-photon excitation 2016-01-15 10.1039/c6cp05681d A DFT study of the effect of SO4 groups on the properties of TiO2 nanoparticles 2016-02-14 10.1039/c5cp06969f The electrooxidation-induced structural changes of gold di-superatomic molecules: Au-23 vs. Au-25 2016-02-25 10.1021/acs.jpcc.5b11489 Comparative Ab-Initio Study of Substituted Norbornadiene-Quadricyclane Compounds for Solar Thermal Storage 2016-06-28 10.1038/srep28618 Role of Polar Phonons in the Photo Excited State of Metal Halide Perovskites 2016-07-15 10.1021/acs.jctc.6b00263 Electrostatic Embedding To Model the Impact of Environment on Photophysical Properties of Molecular Crystals: A Self-Consistent Charge Adjustment Procedure 2016-09-15 10.1038/ncomms12809 Plasmonic twinned silver nanoparticles with molecular precision 2016-11-09 10.1021/jacs.6b09007 [Ag-67(SPhMe2)(32)(PPh3)(8)](3+): Synthesis, Total Structure, and Optical Properties of a Large Box-Shaped Silver Nanocluster 2017-02-14 10.1063/1.4975193 Macroscopic dielectric function within time-dependent density functional theory-Real time evolution versus the Casida approach 2017-05-25 10.1021/acs.jpcc.6b10618 Analysis of the Electronic Structure of Non-Spherical Ligand-Protected Metal Nanoclusters: The Case of a Box-Like Ag-67 2017-05-26 10.1103/PhysRevB.95.195158 Convergence behavior of the random phase approximation renormalized correlation energy 2017-06-07 10.1039/c7cp01440f Stability, electronic structure, and optical properties of protected gold-doped silver Ag29-xAux (x=0-5) nanoclusters 2017-08-01 10.1038/s41598-017-07456-6 Excitation-dependent fluorescence from atomic/molecular layer deposited sodium-uracil thin films 2017-08-14 10.1088/1361-6455/aa7d2c Spectroscopic signatures of triplet states in acenes 2017-08-22 10.1002/chem.201701673 Coinage Metal Superatomic Cores: Insights into Their Intrinsic Stability and Optical Properties from Relativistic DFT Calculations gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/000077500000000000000000000000001316441372200246475ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/Be_8bands_lrtddft.py000066400000000000000000000005431316441372200305330ustar00rootroot00000000000000from gpaw import GPAW from gpaw.lrtddft import LrTDDFT c = GPAW('Be_gs_8bands.gpw') istart = 0 # band index of the first occ. band to consider jend = 8 # band index of the last unocc. band to consider lr = LrTDDFT(c, xc='LDA', istart=istart, jend=jend, nspins=2) # force the calculation of triplet excitations also lr.write('lr.dat.gz') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/Be_8bands_lrtddft_dE.py000066400000000000000000000003331316441372200311400ustar00rootroot00000000000000from gpaw import GPAW from gpaw.lrtddft import LrTDDFT c = GPAW('Be_gs_8bands.gpw') dE = 10 # maximal Kohn-Sham transition energy to consider in eV lr = LrTDDFT(c, xc='LDA', energy_range=dE) lr.write('lr_dE.dat.gz') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/Be_gs_8bands.py000066400000000000000000000012041316441372200274740ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW # Beryllium atom atoms = Atoms(symbols='Be', positions=[(0, 0, 0)], pbc=False) # Add 4.0 ang vacuum around the atom atoms.center(vacuum=4.0) # Create GPAW calculator calc = GPAW(nbands=10, h=0.3) # Attach calculator to atoms atoms.set_calculator(calc) # Calculate the ground state energy = atoms.get_potential_energy() # converge also the empty states (the density is converged already) calc.set(convergence={'bands': 8}, fixdensity=True, eigensolver='cg') atoms.get_potential_energy() # Save the ground state calc.write('Be_gs_8bands.gpw', 'all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/Na2_relax_excited.py000066400000000000000000000021231316441372200305370ustar00rootroot00000000000000from ase import Atom, io, optimize from gpaw import GPAW, FermiDirac from gpaw.cluster import Cluster from gpaw.lrtddft import LrTDDFT from gpaw.lrtddft.excited_state import ExcitedState box = 5. # box dimension h = 0.25 # grid spacing width = 0.01 # Fermi width nbands = 6 # bands in GS calculation nconv = 4 # bands in GS calculation to converge R = 2.99 # starting distance iex = 1 # excited state index d = 0.01 # step for numerical force evaluation exc = 'LDA' # xc for the linear response TDDFT kernel s = Cluster([Atom('Na'), Atom('Na', [0, 0, R])]) s.minimal_box(box, h=h) c = GPAW(h=h, nbands=nbands, eigensolver='cg', occupations=FermiDirac(width=width), setups={'Na': '1'}, convergence={'bands': nconv}) c.calculate(s) lr = LrTDDFT(c, xc=exc, eps=0.1, jend=nconv - 1) ex = ExcitedState(lr, iex, d=d) s.set_calculator(ex) ftraj = 'relax_ex' + str(iex) ftraj += '_box' + str(box) + '_h' + str(h) ftraj += '_d' + str(d) + '.traj' traj = io.Trajectory(ftraj, 'w', s) dyn = optimize.FIRE(s) dyn.attach(traj.write) dyn.run(fmax=0.05) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/Oxirane_lrtddft2_lr.py000066400000000000000000000024021316441372200311260ustar00rootroot00000000000000from ase import * from ase.io import * from ase.parallel import parprint from gpaw import * from gpaw.poisson import * from gpaw.mpi import world, size, rank from gpaw.lrtddft2 import * from gpaw.lrtddft2.lr_communicators import LrCommunicators # atoms, gs_calc = restart('r-methyl-oxirane.gpw') dd_size = 2 * 2 * 2 eh_size = size // dd_size assert eh_size * dd_size == size lr_comms = LrCommunicators(world, dd_size, eh_size) gs_calc = GPAW('r-methyl-oxirane.gpw', communicator=lr_comms.dd_comm, txt='lr_gs.txt', poissonsolver=PoissonSolver(eps=1e-20, remove_moment=(1 + 3 + 5))) lr = LrTDDFT2('lrtddft2', gs_calc, fxc='LDA', min_occ=0, # usually zero max_occ=15, # a few above LUMO min_unocc=10, # a few before HOMO max_unocc=20, # number of converged states max_energy_diff=7.0, # eV recalculate=None, lr_communicators=lr_comms, txt='-') # This is the expensive part! lr.calculate() # transitions (w, S, R, Sx, Sy, Sz) = lr.get_transitions('trans.dat') # spectrum lr.get_spectrum('spectrum.dat', 0, 10.) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/Oxirane_lrtddft2_lr2.py000066400000000000000000000031171316441372200312140ustar00rootroot00000000000000from ase import * from ase.io import * from ase.parallel import parprint from gpaw import * from gpaw.poisson import * from gpaw.mpi import world, size, rank from gpaw.lrtddft2 import * from gpaw.lrtddft2.lr_communicators import LrCommunicators # atoms, gs_calc = restart('r-methyl-oxirane.gpw') dd_size = 2 * 2 * 2 eh_size = size // dd_size assert eh_size * dd_size == size lr_comms = LrCommunicators(world, dd_size, eh_size) gs_calc = GPAW('r-methyl-oxirane.gpw', communicator=lr_comms.dd_comm, txt='lr_gs.txt', poissonsolver=PoissonSolver(eps=1e-20, remove_moment=(1 + 3 + 5))) lr = LrTDDFT2('lrtddft2', gs_calc, fxc='LDA', min_occ=0, # usually zero max_occ=15, # a few above LUMO min_unocc=10, # a few before HOMO max_unocc=20, # number of converged states max_energy_diff=8.0, # eV recalculate=None, lr_communicators=lr_comms, txt='-') # This is the expensive part! lr.calculate() # transitions (w, S, R, Sx, Sy, Sz) = lr.get_transitions('trans.dat') # spectrum lr.get_spectrum('spectrum.dat', 0, 10.) parprint('') parprint(' %5s => %5s contribution' % ('occ', 'unocc')) f2 = lr.lr_transitions.get_transition_contributions(0) for (ip, val) in enumerate(f2): if (val > 1e-3): parprint(' %5d => %5d %lf %%\n ' % (lr.ks_singles.kss_list[ip].occ_ind, lr.ks_singles.kss_list[ip].unocc_ind, val / 2. * 100)) Oxirane_lrtddft2_unocc.py000066400000000000000000000006141316441372200315440ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddftfrom gpaw import * from ase.io import * L = 14 # ang atoms = read('r-methyl-oxirane.xyz') atoms.set_cell((L, L, L)) atoms.center() calc = GPAW(h=0.25, nbands=30, convergence={'bands': 20}, xc='LDA', maxiter=300, txt='unocc.txt') atoms.set_calculator(calc) atoms.get_potential_energy() calc.write('r-methyl-oxirane.gpw', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/ag55.xyz000066400000000000000000000075741316441372200262010ustar00rootroot0000000000000055 Ag 10.103905000389176 10.103905000008758 10.103904999876299 Ag 7.834679336211867 10.103904999352315 8.701370697682759 Ag 7.834679340832878 10.103904999354150 11.506439314621725 Ag 8.701370665688859 7.834679357161356 10.103905007696909 Ag 8.701370665308216 12.373130642197591 10.103905007698188 Ag 10.103904976158379 8.701370686292490 12.373130653292217 Ag 10.103904976157530 11.506439317177399 7.834679353935756 Ag 10.103904976156278 8.701370681789365 7.834679354325114 Ag 10.103904976159003 11.506439312673004 12.373130653681239 Ag 11.506439296195815 7.834679342845536 10.103905007694889 Ag 11.506439296575573 12.373130656515496 10.103905007695612 Ag 12.373130635565678 10.103904999354432 11.506439328570341 Ag 12.373130640188251 10.103904999353622 8.701370683735332 Ag 5.469156666114690 10.103904999354842 10.103905005512239 Ag 5.588478493238041 10.103904999233938 7.312739879070636 Ag 5.588478495850199 10.103904999235979 12.895070137309508 Ag 6.353892546503481 7.786587195926696 8.671410351460853 Ag 6.353892547580336 7.786587194385294 11.536399662804023 Ag 6.353892546538882 12.421222803061172 8.671410351584541 Ag 6.353892547615006 12.421222804601117 11.536399662678935 Ag 7.312739841949994 5.588478517787002 10.103905009100099 Ag 7.312739841749010 14.619331481141657 10.103905009101180 Ag 7.786587177872104 8.671410339353447 6.353892573461263 Ag 7.786587177387537 8.671410340347787 13.853917439738002 Ag 7.786587178005386 11.536399659450783 6.353892573376582 Ag 7.786587177517367 11.536399658456247 13.853917439827566 Ag 8.671410320022330 6.353892568399456 12.421222812032616 Ag 8.671410321487164 13.853917430038301 7.786587200094877 Ag 8.671410321573923 6.353892568847229 7.786587200055542 Ag 8.671410319937563 13.853917430483618 12.421222811991546 Ag 10.103904971805569 7.312739867717672 14.619331491980857 Ag 10.103904971804868 12.895070133267549 5.588478520538273 Ag 10.103904971803416 7.312739865356937 5.588478520758856 Ag 10.103904976215832 10.103904999536681 5.469156690727183 Ag 10.103904976215198 10.103904999536679 14.738653321284643 Ag 10.103904971806967 12.895070130906749 14.619331492201322 Ag 10.103904982922902 5.469156684217877 10.103905007678017 Ag 10.103904982918419 14.738653314772066 10.103905007676579 Ag 11.536399635790955 6.353892565071086 12.421222807257857 Ag 11.536399634320981 13.853917433377452 7.786587204865930 Ag 11.536399634238530 6.353892565517794 7.786587204827500 Ag 11.536399635872016 13.853917433825520 12.421222807218275 Ag 12.421222785164929 8.671410345151649 13.853917438345588 Ag 12.421222784549244 11.536399654642805 6.353892574763493 Ag 12.421222784677941 8.671410344157460 6.353892574853783 Ag 12.421222785039685 11.536399653645935 13.853917438442179 Ag 12.895070107302825 5.588478509698299 10.103905009097678 Ag 12.895070107502168 14.619331489229758 10.103905009099620 Ag 13.853917412593216 7.786587197434970 8.671410348376295 Ag 13.853917411514395 7.786587195896960 11.536399665888940 Ag 13.853917412553468 12.421222801546829 8.671410348511326 Ag 13.853917411478047 12.421222803086360 11.536399665751484 Ag 14.619331464680650 10.103904999236820 12.895070144622364 Ag 14.619331467291348 10.103904999234961 7.312739871757974 Ag 14.738653296671229 10.103904999357042 10.103905005516358 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/dielectric_response.rst000066400000000000000000000413241316441372200314320ustar00rootroot00000000000000.. _df_theory: ======================================================== Linear dielectric response of an extended system: theory ======================================================== Introduction ============ The DF (dielectric function) object calculates optical and dielectric properties of extended systems. It computes the linear response function of an interacting many-body system from its ground state electronic structure, which are obtained from GPAW in the real-space grids scheme. The frequency and wave-vector dependent density response function are calculated within Time-Dependent Density-Functional Theory formalism using the projector-augmented wave method. Random phase approximation and adiabatic local density approximation are used for exchange-correlation functional. Local field, which indicate the inhomogeneity of the system, are included by constructing the density response matrix in reciprocal space. Fast Fourier Transform (FFT) are utilized to transform between real and reciprocal spaces. Refer to :ref:`df_tutorial` for getting started with examples. Non-interacting density response function ========================================= The Non-interacting density response function in real space is written as, .. math:: \chi^0(\mathbf{r}, \mathbf{r}^{\prime}, \omega) = \sum_{\mathbf{k}, \mathbf{q}}^{\mathrm{BZ}} \sum_{n, n^{\prime}} \frac{f_{n\mathbf{k}}-f_{n^{\prime} \mathbf{k} + \mathbf{q}}}{\omega + \epsilon_{n\mathbf{k}} - \epsilon_{n^{\prime} \mathbf{k} + \mathbf{q} } + i\eta} \psi_{n\mathbf{k}}^{\ast}(\mathbf{r}) \psi_{n^{\prime} \mathbf{k} + \mathbf{q} }(\mathbf{r}) \psi_{n\mathbf{k}}(\mathbf{r}^{\prime}) \psi^{\ast}_{n^{\prime} \mathbf{k} + \mathbf{q} }(\mathbf{r}^{\prime}), where `\epsilon_{n \mathbf{k}}` and `\psi_{n \mathbf{k}}(\mathbf{r})` are the eigenvalue and eigen wavefunction, which is normalized to 1 in the crystal volume `\Omega (= \Omega_{\mathrm{cell}} N_k)`. The sum of occupation `f_{n \mathbf{k}}` should be the total number of electrons in the crystal, satisfing .. math:: \sum_{n \mathbf{k}} f_{n \mathbf{k}}= N_k N where `N` is the number of electrons in a single unit cell and `N_k` is the number of unit cells (kpoints). For translation invariant systems, `\chi^0` can be expanded in planewave basis as .. math:: \chi^0(\mathbf{r}, \mathbf{r}^{\prime}, \omega) = \frac{1}{\Omega} \sum_{\mathbf{q}}^{\mathrm{BZ}} \sum_{\mathbf{G} \mathbf{G}^{\prime}} e^{i(\mathbf{q} + \mathbf{G}) \cdot \mathbf{r}} \chi^0_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega) e^{-i(\mathbf{q} + \mathbf{G}^{\prime}) \cdot \mathbf{r}^{\prime}} where `\mathbf q` stands for the Bloch vector of the incident wave and `\mathbf G (\mathbf G^{\prime})` are reciprocal lattice vectors. The Fourier coefficients, derived by Adler \ [#Adler]_ and Wiser \ [#Wiser]_, are written as .. math:: \chi^0_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega) = \frac{1}{\Omega} \sum_{\mathbf{k}}^{\mathrm{BZ}} \sum_{n, n^{\prime}} \frac{f_{n\mathbf{k}}-f_{n^{\prime} \mathbf{k} + \mathbf{q} }}{\omega + \epsilon_{n\mathbf{k}} - \epsilon_{n^{\prime} \mathbf{k} + \mathbf{q} } + i\eta} \langle \psi_{n \mathbf{k}} | e^{-i(\mathbf{q} + \mathbf{G}) \cdot \mathbf{r}} | \psi_{n^{\prime} \mathbf{k} + \mathbf{q} } \rangle_{\Omega_{\mathrm{cell}}} \langle \psi_{n\mathbf{k}} | e^{i(\mathbf{q} + \mathbf{G}^{\prime}) \cdot \mathbf{r}^{\prime}} | \psi_{n^{\prime} \mathbf{k} + \mathbf{q} } \rangle_{\Omega_{\mathrm{cell}}} Interacting density response function ===================================== The full interacting density response function is obtained by solving Dyson's equation: .. math:: \chi(\mathbf r, \mathbf{r^{\prime}}, \omega) = \chi_0(\mathbf r, \mathbf{r^{\prime}}, \omega) + \iint_{\Omega} d\mathbf{r}_1 d\mathbf{r}_2 \ \chi_0(\mathbf r, \mathbf{r}_1, \omega) K(\mathbf{r}_1, \mathbf{r}_2) \chi(\mathbf{r}_2, \mathbf{r^{\prime}} ,\omega), where the kernel is the summation of coulomb and exchange-correlation interaction .. math:: K(\mathbf{r}_1, \mathbf{r}_2) = \frac{1}{|\mathbf{r}_1 -\mathbf{r}_2|} + \frac{\partial V_{xc}[n]}{\partial n}. By Fourier transform, the Dyson's equation in reciprocal space becomes .. math:: \chi_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) = \chi^0_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) + \sum_{\mathbf G_1 \mathbf G_2} \chi^0_{\mathbf G \mathbf G_1}(\mathbf q \omega) K_{\mathbf G_1 \mathbf G_2}(\mathbf q) \chi_{\mathbf G_2 \mathbf G^{\prime}}(\mathbf q, \omega). Note, the coulomb kernel becomes diagonal in reciprocal space .. math:: K^{\mathrm{Coulomb}}_{\mathbf G_1 \mathbf G_2}(\mathbf q) = \frac{4\pi}{|\mathbf q+\mathbf G_1|^2} \delta_{\mathbf G_1 \mathbf G_2} The exchange-correlation (xc) is obtained using adiabatic local density approximation (ALDA): .. math:: K^{xc.ALDA}_{\mathbf G_1 \mathbf G_2}(\mathbf q) = \frac{1}{\Omega} \int d\mathbf{r} f_{xc}[n(\mathbf{r})] e^{-i(\mathbf{G}_1-\mathbf{G}_2)\cdot \mathbf{r}} with .. math:: f_{xc}[n(\mathbf{r})] = \left. \frac{\partial^2 E_{xc}[n]}{\partial n^2} \right|_{n_0(\mathbf{r})}. .. _macroscopic_dielectric_function: Dielectric function and its relation to spectra =============================================== The dielectric matrix is related to the density response matrix by .. math:: \epsilon^{-1}_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) = \delta_{\mathbf G \mathbf G^{\prime}} + \frac{4\pi}{|\mathbf q + \mathbf G|^2} \chi_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) Within RPA approximation, the dielectric matrix can also be written as .. math:: \epsilon^{\mathrm{RPA}}_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) = \delta_{\mathbf G \mathbf G^{\prime}} - \frac{4\pi}{|\mathbf q + \mathbf G|^2} \chi^0_{\mathbf G \mathbf G^{\prime}}(\mathbf q, \omega) The macroscopic dielectric function is defined by .. math:: \epsilon_M(\mathbf q, \omega) = \frac{1}{\epsilon^{-1}_{00}(\mathbf q, \omega)} Optical absorption spectrum is obtained through .. math:: \mathrm{ABS} = \mathrm{Im} \epsilon_M(\mathbf q \rightarrow 0, \omega) Electron energy loss spectrum is .. math:: \mathrm{EELS} = -\mathrm{Im}\frac{1}{\epsilon_M(\mathbf q, \omega)} The f-sum rule ============== The scalar dielectric function is related to the dielectric tensor by .. math:: \epsilon_M(\mathbf q, \omega) = \mathrm{lim}_{\mathbf q \rightarrow 0} \ \hat{q}_{\alpha} \epsilon_{\alpha \beta}(\mathbf q, \omega) \hat{q}_{\beta}, and the dielectric tensor `\epsilon_{\alpha \beta}(\omega)` satify the "f-sum rule" .. math:: \int_0^{\infty} d\omega \ \omega \ \mathrm{Im} \epsilon_{\alpha \beta}(\omega) = \frac{2\pi^2N}{\Omega_{\mathrm{cell}}} \delta_{\alpha \beta} where `N` is the number of electrons in the unit cell and `\frac{N}{\Omega_{\mathrm{cell}}}` is the electron density. Optical limit (q -> 0) ====================== In the above sections we have derived the longitudianl dielectric function `\epsilon(\mathbf q, \omega)`. For external perturbation by a tranverse electro-magnetic field, the full dielectric tensor should be calculated. However, in the long-wavelength limit, which is the case for light absorption, the dielectric tensor can be recovered by scalar or longitudinal dielectric function considering different direction of `\hat{\mathbf q}`. Although `\mathbf q` is close to zero, we can't use the approximation `\mathbf q = 0` because the Coulomb kernel (`\frac{4\pi}{|\mathbf q + \mathbf G|^2}`) diverges at `\mathbf q = \mathbf G = 0`. In this section we will focus on evaluating `\chi_{\mathbf G \mathbf G^{\prime}}^0(\mathbf q, \omega)` in the limit of `\mathbf q \rightarrow 0` and `\mathbf G = 0` \ [#Louie]_. The dipole transition matrix `\langle \psi_{n \mathbf k} | e^{-i (\mathbf q + \mathbf G) \cdot \mathbf r} | \psi_{n^{\prime} \mathbf k + \mathbf q} \rangle` with `\mathbf G = 0` becomes .. math:: \langle \psi_{n \mathbf k} | e^{-i (\mathbf q + \mathbf G) \cdot \mathbf r} | \psi_{n^{\prime} \mathbf k + \mathbf q} \rangle = \langle u_{n \mathbf k} | u_{n^{\prime} \mathbf k + \mathbf q} \rangle Note, `\psi_{n \mathbf k}` is all-electron wavefunction with band index `n` at kpoint `\mathbf k` , and `u_{n \mathbf k}` is the periodic part of the Bloch wave written as `\psi_{n \mathbf k}(\mathbf r) = u_{n \mathbf k}(\mathbf r) e^{i \mathbf k \cdot \mathbf r}`. Employing second order perturbation theory, `u_{n^{\prime} \mathbf k + \mathbf q}` can be expanded in terms of other orbitals written as .. math:: | u_{n^{\prime} \mathbf k + \mathbf q} \rangle = | u_{n^{\prime} \mathbf k } \rangle + \sum_{m \neq n^{\prime}} \frac{ \langle u_{m \mathbf k} | \tilde V | u_{n^{\prime} \mathbf k} \rangle }{\epsilon_{n^{\prime} \mathbf k} - \epsilon_{m \mathbf k} } | u_{m \mathbf k} \rangle where the perturbation `\tilde V` is obtained in the following through k.p perturbation theory. The k.p Hamiltonian is expressed as .. math:: H(\mathbf k) u_{n \mathbf k}(\mathbf r) = \left[ -\frac{\hbar^2}{2m}(\nabla + i\mathbf k)^2 + V(\mathbf r) \right] u_{n \mathbf k}(\mathbf r) = \epsilon_{n \mathbf k} u_{n \mathbf k}(\mathbf r), where `V(\mathbf r)` is the periodic crystal potential. The perturbation Hamiltonian `\tilde V` is calculated by (atomic unit): .. math:: \tilde V = H(\mathbf k + \mathbf q) - H(\mathbf k) = -i\mathbf q \cdot (\nabla + i \mathbf k) Substitute `\tilde V` into the expression of `| u_{n^{\prime} \mathbf k + \mathbf q} \rangle`, multiply `\langle u_{n \mathbf k} |` to the left, and apply the orthonormalized condition for the all-electron wavefunction `\langle u_{n \mathbf k} | u_{m \mathbf k} \rangle = \delta_{nm}`, we get .. math:: \langle \psi_{n \mathbf k} | e^{-i (\mathbf q + \mathbf G) \cdot \mathbf r} | \psi_{n^{\prime} \mathbf k + \mathbf q} \rangle_{\mathbf q \rightarrow 0, \mathbf G=0} = -i \mathbf q \cdot \frac{ \langle u_{n \mathbf k} | \nabla + i \mathbf k |u_{n^{\prime} \mathbf k} \rangle }{\epsilon_{n^{\prime} \mathbf k} - \epsilon_{n \mathbf k}} = -i \mathbf q \cdot \frac{ \langle \psi_{n \mathbf k} | \nabla |\psi_{n^{\prime} \mathbf k} \rangle }{\epsilon_{n^{\prime} \mathbf k} - \epsilon_{n \mathbf k}} Hilbert Transform ================= The non-interaction density response function `\chi^0_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega)` can be calculated through hilbert transform, written as .. math:: \chi^0_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega) = \int_{-\infty}^{\infty} d\omega^{\prime} \frac{A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime})} {\omega - \omega^{\prime}+ i\eta} where spectral function `A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime})` is defined as .. math:: A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime}) = \frac{1}{\Omega} \sum_{\mathbf{k}}^{\mathrm{BZ}} \sum_{n, n^{\prime}} ( f_{n\mathbf{k}}-f_{n^{\prime} \mathbf{k} + \mathbf{q}} ) \langle \psi_{n \mathbf{k}} | e^{-i(\mathbf{q} + \mathbf{G}) \cdot \mathbf{r}} | \psi_{n^{\prime} \mathbf{k} + \mathbf{q} } \rangle_{\Omega_{\mathrm{cell}}} \langle \psi_{n\mathbf{k}} | e^{i(\mathbf{q} + \mathbf{G}^{\prime}) \cdot \mathbf{r}^{\prime}} | \psi_{n^{\prime} \mathbf{k} + \mathbf{q} } \rangle_{\Omega_{\mathrm{cell}}} \times \delta( \omega^{\prime} + \epsilon_{n\mathbf{k}} - \epsilon_{n^{\prime} \mathbf{k} + \mathbf{q} } ) Note that the integration above requires both positive and negative frequencies. In the following derivation, the integration will be reduced to only half of the frequency domain. In the system that possesses the time-reversal symmetry, the bloch states have the following properties .. math:: \epsilon_{n, -\mathbf{k}} = \epsilon_{n, \mathbf{k}} f_{n, -\mathbf{k}} = f_{n, \mathbf{k}} \psi_{n, -\mathbf{k}}(\mathbf{r}) = \psi^{\ast}_{n, \mathbf{k}}(\mathbf{r}) Change the index in `A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime})` as .. math:: n, \mathbf{k} \rightarrow n^{\prime}, -\mathbf{k}-\mathbf{q} n^{\prime}, \mathbf{k}+\mathbf{q} \rightarrow n, -\mathbf{k} and employing the time-reversal symmetry, one can get .. math:: A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime}) = - A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, -\omega^{\prime}) Substitute it to the integration in the beginning of this section, one get .. math:: \chi^0_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega) = \int_0^{\infty} d\omega^{\prime} \frac{ A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime})}{\omega-\omega^{\prime}+i\eta} + \int_{-\infty}^{0} d\omega^{\prime} \frac{ A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime})}{\omega-\omega^{\prime}+i\eta} = \int_0^{\infty} d\omega^{\prime} \left[ \frac{1}{ \omega-\omega^{\prime}+i\eta } - \frac{1}{ \omega+\omega^{\prime}+i\eta }\right] A_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega^{\prime}) Applying the hilbert transform can make the calculations of `\chi^0_{\mathbf{G} \mathbf{G}^{\prime}}(\mathbf{q}, \omega)` `Nw / 2` times faster, where `Nw` is the number of frequency points used. For the delta function, we use either a triangular function, which is described in \ [#DeltaFunc]_ and is normalized to 1 or a gaussian function, which is in principle normalized but in fact not due to numerically finite frequency points used. We tried both and it turns out that the spectrum does not sensitively depend on the function applied. PAW terms ========= The PAW terms comes in when calculating the dipole transition matrix .. math:: \langle \psi_{n \mathbf k} | e^{-i (\mathbf q + \mathbf G) \cdot \mathbf r} | \psi_{n^{\prime} \mathbf k + \mathbf q} \rangle = \langle \tilde{\psi}_{n \mathbf k} | e^{-i (\mathbf q + \mathbf G) \cdot \mathbf r} | \tilde{\psi}_{n^{\prime} \mathbf k + \mathbf q} \rangle + \sum_{a,ij} \langle \tilde{\psi}_{n \mathbf k} | \tilde{p}_i^a \rangle^{\ast} \langle \tilde{\psi}_{n^{\prime} \mathbf k + \mathbf q} | \tilde{p}_j^a \rangle \left[ \langle \phi_i^a | e^{-i(\mathbf{q} + \mathbf{G}) \cdot \mathbf{r}} | \phi_j^a \rangle - \langle \tilde{\phi}_i^a | e^{-i(\mathbf{q} + \mathbf{G}) \cdot \mathbf{r}} | \tilde{\phi}_j^a \rangle \right] We calculate the last term in the above equation by expanding the planewave in such a way .. math:: e^{i \mathbf{k} \cdot \mathbf{r}} = 4 \pi \sum_{lm} i^l j_l(kr) Y_{lm}(\hat{\mathbf{r}}) Y_{lm}(\hat{\mathbf{k}}) where `j_l` is spherical bessel function and write (for simplicity, define `\mathbf{k} = \mathbf{q} + \mathbf{G}`) .. math:: \langle \phi_i^a | e^{-i \mathbf{k} \cdot \mathbf{r}} | \phi_j^a \rangle - \langle \tilde{\phi}_i^a | e^{-i \mathbf{k} \cdot \mathbf{r}} | \tilde{\phi}_j^a \rangle = 4 \pi e^{-i \mathbf{k} \cdot \mathbf{R}_a} \sum_{lm} (-i)^l Y_{lm}(\hat{\mathbf{k}}) \int dr \ r^2 j_l(kr) \left[ \phi^{a}_{n_1 l_1}(r) \phi^{a}_{n_2 l_2}(r) - \tilde{\phi}^{a}_{n_1 l_1}(r) \tilde{\phi}^{a}_{n_2 l_2}(r) \right] \int d\Omega \ Y_{lm} Y_{l_1 m_1} Y_{l_2 m_2} where `\mathbf{R}_a` are the positions of atoms in the unit cell. For optical limit calculation, the dipole matrix related is .. math:: \langle \psi_{n \mathbf{k}} | \nabla | \psi_{n^{\prime} \mathbf{k}} \rangle = \langle \tilde{\psi}_{n \mathbf{k}} | \nabla | \tilde{\psi}_{n^{\prime} \mathbf{k}} \rangle + \sum_{a,ij} \langle \tilde{\psi}_{n \mathbf k} | \tilde{p}_i^a \rangle^{\ast} \langle \tilde{\psi}_{n^{\prime} \mathbf k} | \tilde{p}_j^a \rangle \left[ \langle \phi_i^a | \nabla_{\mathbf{r}} | \phi_j^a \rangle - \langle \tilde{\phi}_i^a | \nabla_{\mathbf{r}} | \tilde{\phi}_j^a \rangle \right] Refer to :ref:`setup_matrix_elements_nabla` for calculation of `\langle \phi_i^a | \nabla_{\mathbf{r}} | \phi_j^a \rangle - \langle \tilde{\phi}_i^a | \nabla_{\mathbf{r}} | \tilde{\phi}_j^a \rangle` .. [#Adler] S. L. Adler, Quantum theory of the dielectric constant in real solids, *Phys. Rev.* **126**, 413 (1962) .. [#Wiser] N. Wiser, Dielectric constant with local field effects included, *Phys. Rev.* **129**, 62 (1963). .. [#Louie] M. S. Hybertsen and S. G. Louie, Ab initio static dielectric matrices from the density-functional approach. I. Formulation and application to semiconductors and insulators, *Phys. Rev. B* **35**, 5585 (1987). .. [#DeltaFunc] M. Shishkin and G. Kresse, Implementation and performance of the frequency-dependent GW method within the PAW framework, *Phys. Rev. B* **74**, 035101 (2006). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfield/000077500000000000000000000000001316441372200272665ustar00rootroot00000000000000casida_calculate.py000066400000000000000000000013461316441372200330260ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfieldfrom ase import Atoms from gpaw import GPAW from gpaw.lrtddft import LrTDDFT # Na2 cluster atoms = Atoms(symbols='Na2', positions=[(0, 0, 0), (3.0, 0, 0)], pbc=False) atoms.center(vacuum=6.0) # Standard ground state calculation with empty states calc = GPAW(nbands=100, h=0.4, setups={'Na': '1'}) atoms.set_calculator(calc) energy = atoms.get_potential_energy() calc.set(convergence={'bands' : 90}, fixdensity=True, eigensolver='cg') atoms.get_potential_energy() calc.write('na2_gs_casida.gpw', mode='all') # Standard Casida calculation calc = GPAW('na2_gs_casida.gpw') istart = 0 jend = 90 lr = LrTDDFT(calc, xc='LDA', istart=istart, jend=jend) lr.diagonalize() lr.write('na2_lr.dat.gz') casida_plot.py000066400000000000000000000041111316441372200320400ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfield# -*- coding: utf-8 -*- from gpaw.mpi import world assert world.size == 1, 'This script should be run in serial mode (with one process).' import numpy as np import matplotlib.pyplot as plt from gpaw.inducedfield.inducedfield_base import BaseInducedField from gpaw.tddft.units import (attosec_to_autime, autime_to_attosec, eV_to_aufrequency, aufrequency_to_eV) # Helper function def do_plot(d_g, ng, box, atoms): # Take slice of data array d_yx = d_g[:, ng[1] // 2, :] y = np.linspace(0, box[0], ng[0]) ylabel = u'x / Å' x = np.linspace(0, box[2], ng[2]) xlabel = u'z / Å' # Plot plt.figure() ax = plt.subplot(1, 1, 1) X, Y = np.meshgrid(x, y) plt.contourf(X, Y, d_yx, 40) plt.colorbar() for atom in atoms: pos = atom.position plt.scatter(pos[2], pos[0], s=50, c='k', marker='o') plt.xlabel(xlabel) plt.ylabel(ylabel) plt.xlim([x[0], x[-1]]) plt.ylim([y[0], y[-1]]) ax.set_aspect('equal') # Read InducedField object ind = BaseInducedField('na2_casida_field.ind', readmode='all') # Choose array w = 1 # Frequency index freq = ind.omega_w[w] * aufrequency_to_eV # Frequency box = np.diag(ind.atoms.get_cell()) # Calculation box d_g = ind.Ffe_wg[w] # Data array ng = d_g.shape # Size of grid atoms = ind.atoms # Atoms do_plot(d_g, ng, box, atoms) plt.title('Field enhancement @ %.2f eV' % freq) plt.savefig('na2_casida_Ffe.png', bbox_inches='tight') # Imaginary part of density d_g = ind.Frho_wg[w].imag * 1e-3 # Multiply by kick strength ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('Imaginary part of induced charge density @ %.2f eV' % freq) plt.savefig('na2_casida_Frho.png', bbox_inches='tight') # Imaginary part of potential d_g = ind.Fphi_wg[w].imag * 1e-3 # Multiply by kick strength ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('Imaginary part of induced potential @ %.2f eV' % freq) plt.savefig('na2_casida_Fphi.png', bbox_inches='tight') casida_postprocess.py000066400000000000000000000022171316441372200334530ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfieldfrom gpaw import GPAW from gpaw.lrtddft import LrTDDFT, photoabsorption_spectrum from gpaw.inducedfield.inducedfield_lrtddft import LrTDDFTInducedField # Load LrTDDFT object lr = LrTDDFT('na2_lr.dat.gz') # Calculate photoabsorption spectrum as usual folding = 'Gauss' width = 0.1 e_min = 0.0 e_max = 4.0 photoabsorption_spectrum(lr, 'na2_casida_spectrum.dat', folding=folding, width=width, e_min=e_min, e_max=e_max, delta_e=1e-2) # Load GPAW object calc = GPAW('na2_gs_casida.gpw') # Calculate induced field frequencies = [1.0, 2.08] # Frequencies of interest in eV folding = 'Gauss' # Folding function width = 0.1 # Line width for folding in eV kickdir = 0 # Kick field direction 0, 1, 2 for x, y, z ind = LrTDDFTInducedField(paw=calc, lr=lr, frequencies=frequencies, folding=folding, width=width, kickdir=kickdir) ind.calculate_induced_field(gridrefinement=2, from_density='comp') ind.write('na2_casida_field.ind', mode='field') inducedfield.rst000066400000000000000000000040551316441372200323640ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfield.. _inducedfield: ====================================== Induced electric near field from TDDFT ====================================== Induced electric near field can be calculated for finite systems from :ref:`inducedfield_timepropagation` or :ref:`inducedfield_casida`. The implementation is described in Ref. [#Rossi2013]_. .. _inducedfield_timepropagation: Time-propagation TDDFT =========================================== See :ref:`timepropagation` for instructions how to use time-propagation TDDFT. Example code for time-propagation calculation .. literalinclude:: timepropagation_calculate.py Example code for continuing time-propagation .. literalinclude:: timepropagation_continue.py Induced electric potential and near field are calculated after time-propagation as follows: .. literalinclude:: timepropagation_postprocess.py Plotting example (run in serial mode, i.e., with one process) .. literalinclude:: timepropagation_plot.py |na2_td_Frho| |na2_td_Fphi| |na2_td_Ffe| .. |na2_td_Frho| image:: na2_td_Frho.png .. |na2_td_Fphi| image:: na2_td_Fphi.png .. |na2_td_Ffe| image:: na2_td_Ffe.png TODO: notes about AE/comp corrections, extending grid .. _inducedfield_casida: Linear response TDDFT (Casida's equation) =========================================== See :ref:`lrtddft` for instructions how to use linear response TDDFT. Example code for linear response calculation .. literalinclude:: casida_calculate.py Induced electric potential and near field are calculated as post-processing step as follows: .. literalinclude:: casida_postprocess.py Plotting example (same as in time propagation) .. literalinclude:: casida_plot.py |na2_casida_Frho| |na2_casida_Fphi| |na2_casida_Ffe| .. |na2_casida_Frho| image:: na2_casida_Frho.png .. |na2_casida_Fphi| image:: na2_casida_Fphi.png .. |na2_casida_Ffe| image:: na2_casida_Ffe.png References ========== .. [#Rossi2013] T. P. Rossi, Simulating electric field enhancement in plasmonic nanomaterials, Master's thesis, Aalto University (2013). ``_ submit.agts.py000066400000000000000000000022561316441372200320260ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfielddef agts(queue): calc1 = queue.add('timepropagation_calculate.py', ncpus=8, walltime=60) calc2 = queue.add('timepropagation_continue.py', ncpus=8, walltime=60, deps=calc1) calc3 = queue.add('timepropagation_postprocess.py', ncpus=8, walltime=5, deps=calc2) calc4 = queue.add('timepropagation_plot.py', ncpus=1, walltime=5, deps=calc3, creates=['na2_td_Ffe.png', 'na2_td_Frho.png', 'na2_td_Fphi.png']) calc5 = queue.add('casida_calculate.py', ncpus=8, walltime=60) calc6 = queue.add('casida_postprocess.py', ncpus=8, walltime=5, deps=calc5) calc7 = queue.add('casida_plot.py', ncpus=1, walltime=5, deps=calc6, creates=['na2_casida_Ffe.png', 'na2_casida_Frho.png', 'na2_casida_Fphi.png']) timepropagation_calculate.py000066400000000000000000000024171316441372200350040ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfieldfrom ase import Atoms from gpaw import GPAW from gpaw.tddft import TDDFT from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField # Na2 cluster atoms = Atoms(symbols='Na2', positions=[(0, 0, 0), (3.0, 0, 0)], pbc=False) atoms.center(vacuum=6.0) # Standard ground state calculation calc = GPAW(nbands=2, h=0.4, setups={'Na': '1'}) atoms.set_calculator(calc) energy = atoms.get_potential_energy() calc.write('na2_gs.gpw', mode='all') # Standard time-propagation initialization time_step = 10.0 iterations = 3000 kick_strength = [1.0e-3, 0.0, 0.0] td_calc = TDDFT('na2_gs.gpw') td_calc.absorption_kick(kick_strength=kick_strength) # Create and attach InducedField object frequencies = [1.0, 2.08] # Frequencies of interest in eV folding = 'Gauss' # Folding function width = 0.1 # Line width for folding in eV ind = TDDFTInducedField(paw=td_calc, frequencies=frequencies, folding=folding, width=width, restart_file='na2_td.ind') # Propagate as usual td_calc.propagate(time_step, iterations, 'na2_td_dm.dat', 'na2_td.gpw') # Save TDDFT and InducedField objects td_calc.write('na2_td.gpw', mode='all') ind.write('na2_td.ind') timepropagation_continue.py000066400000000000000000000010631316441372200346670ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfieldfrom gpaw.tddft import TDDFT from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField # Load TDDFT object td_calc = TDDFT('na2_td.gpw') # Load and attach InducedField object ind = TDDFTInducedField(filename='na2_td.ind', paw=td_calc, restart_file='na2_td.ind') # Continue propagation as usual time_step = 20.0 iterations = 250 td_calc.propagate(time_step, iterations, 'na2_td_dm.dat', 'na2_td.gpw') # Save TDDFT and InducedField objects td_calc.write('na2_td.gpw', mode='all') ind.write('na2_td.ind') timepropagation_plot.py000066400000000000000000000037611316441372200340300ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfield# -*- coding: utf-8 -*- from gpaw.mpi import world assert world.size == 1, 'This script should be run in serial mode (with one process).' import numpy as np import matplotlib.pyplot as plt from gpaw.inducedfield.inducedfield_base import BaseInducedField from gpaw.tddft.units import (attosec_to_autime, autime_to_attosec, eV_to_aufrequency, aufrequency_to_eV) # Helper function def do_plot(d_g, ng, box, atoms): # Take slice of data array d_yx = d_g[:, ng[1] // 2, :] y = np.linspace(0, box[0], ng[0]) ylabel = u'x / Å' x = np.linspace(0, box[2], ng[2]) xlabel = u'z / Å' # Plot plt.figure() ax = plt.subplot(1, 1, 1) X, Y = np.meshgrid(x, y) plt.contourf(X, Y, d_yx, 40) plt.colorbar() for atom in atoms: pos = atom.position plt.scatter(pos[2], pos[0], s=50, c='k', marker='o') plt.xlabel(xlabel) plt.ylabel(ylabel) plt.xlim([x[0], x[-1]]) plt.ylim([y[0], y[-1]]) ax.set_aspect('equal') # Read InducedField object ind = BaseInducedField('na2_td_field.ind', readmode='all') # Choose array w = 1 # Frequency index freq = ind.omega_w[w] * aufrequency_to_eV # Frequency box = np.diag(ind.atoms.get_cell()) # Calculation box d_g = ind.Ffe_wg[w] # Data array ng = d_g.shape # Size of grid atoms = ind.atoms # Atoms do_plot(d_g, ng, box, atoms) plt.title('Field enhancement @ %.2f eV' % freq) plt.savefig('na2_td_Ffe.png', bbox_inches='tight') # Imaginary part of density d_g = ind.Frho_wg[w].imag ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('Imaginary part of induced charge density @ %.2f eV' % freq) plt.savefig('na2_td_Frho.png', bbox_inches='tight') # Imaginary part of potential d_g = ind.Fphi_wg[w].imag ng = d_g.shape do_plot(d_g, ng, box, atoms) plt.title('Imaginary part of induced potential @ %.2f eV' % freq) plt.savefig('na2_td_Fphi.png', bbox_inches='tight') timepropagation_postprocess.py000066400000000000000000000013551316441372200354330ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/inducedfieldfrom gpaw.tddft import TDDFT, photoabsorption_spectrum from gpaw.inducedfield.inducedfield_tddft import TDDFTInducedField # Calculate photoabsorption spectrum as usual folding = 'Gauss' width = 0.1 e_min = 0.0 e_max = 4.0 photoabsorption_spectrum('na2_td_dm.dat', 'na2_td_spectrum_x.dat', folding=folding, width=width, e_min=e_min, e_max=e_max, delta_e=1e-2) # Load TDDFT object td_calc = TDDFT('na2_td.gpw') # Load InducedField object ind = TDDFTInducedField(filename='na2_td.ind', paw=td_calc) # Calculate induced electric field ind.calculate_induced_field(gridrefinement=2, from_density='comp') # Save induced electric field ind.write('na2_td_field.ind', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft.agts.py000066400000000000000000000006371316441372200301300ustar00rootroot00000000000000def agts(queue): basis = queue.add('lcaotddft_basis.py', ncpus=1, walltime=10) ag55 = queue.add('lcaotddft_ag55.py', deps=[basis], ncpus=64, walltime=120) queue.add('lcaotddft_fig1.py', deps=[ag55], creates='fig1.png') induced = queue.add('lcaotddft_induced.py', ncpus=4, walltime=60) queue.add('lcaotddft_analyse.py', deps=[induced], ncpus=1, walltime=15, creates='Na8_imag.png') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft.py000066400000000000000000000015651316441372200271740ustar00rootroot00000000000000# Simplest example of use of LCAO-TDDFT code from ase import Atoms from gpaw.tddft import photoabsorption_spectrum from gpaw import PoissonSolver # Sodium dimer atoms = Atoms('Na2', positions=[[0.0, 0.0, 0.0], [3.0, 0.0, 0.0]]) atoms.center(vacuum=3.5) from gpaw.lcaotddft import LCAOTDDFT # Increase accuragy of density for ground state convergence = {'density': 1e-7} # Increase accuracy of Poisson Solver and apply multipole corrections up to l=1 poissonsolver = PoissonSolver(eps=1e-14, remove_moment=1 + 3) td_calc = LCAOTDDFT( setups={'Na': '1'}, basis='dzp', xc='LDA', h=0.3, nbands=1, convergence=convergence, poissonsolver=poissonsolver) atoms.set_calculator(td_calc) # Relax the ground state atoms.get_potential_energy() td_calc.absorption_kick([1e-5, 0.0, 0.0]) td_calc.propagate(20, 250, 'Na2.dm') photoabsorption_spectrum('Na2.dm', 'Na2.spec', width=0.4) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft.rst000066400000000000000000000270131316441372200273500ustar00rootroot00000000000000.. _lcaotddft: =================================================== Time-propagation TDDFT with LCAO : Theory and usage =================================================== This page documents the use of time-propagation TDDFT in :ref:`LCAO mode `. The implementation is described in Ref. [#Kuisma2015]_. Real time propagation of LCAO-functions ======================================= In the real-time LCAO-TDDFT approach, the time-dependent wave functions are represented using the localized basis functions `\tilde{\phi}_{\mu}(\mathbf r)` as .. math:: \tilde{\psi}_n(\mathbf{r},t) = \sum_{\mu} \tilde{\phi}_{\mu}(\mathbf{r}-\mathbf{R}^\mu) c_{\mu n}(t) . The time-dependent Kohn--Sham equation in the PAW formalism can be written as .. math:: \left[ \widehat T^\dagger \left( -i \frac{{\rm d}}{{\rm d}t} + \hat H_{\rm KS}(t) \right) \widehat T \right] \tilde{\Psi(\mathbf{r},t)} = 0. From this, the following matrix equation can be derived for the LCAO wave function coefficients: .. math:: {\rm i}\mathbf{S} \frac{{\rm d}\mathbf{C}(t)}{{\rm d}t} = \mathbf{H}(t) \mathbf{C}(t). In the current implementation, `\mathbf C`, `\mathbf S` and `\mathbf H` are dense matrices which are distributed using ScaLAPACK/BLACS. Currently, a semi-implicit Crank--Nicolson method (SICN) is used to propagate the wave functions. For wave functions at time `t`, one propagates the system forward using `\mathbf H(t)` and solving the linear equation .. math:: \left( \mathbf{S} + {\rm i} \mathbf{H}(t) {\rm d}t / 2 \right) \mathbf{C}'(t+{\rm d}t) = \left( \mathbf{S} - {\rm i} \mathbf{H}(t) {\rm d}t / 2 \right) \mathbf{C}(t). Using the predicted wave functions `C'(t+\mathrm dt)`, the Hamiltonian `H'(t+\mathrm dt)` is calculated and the Hamiltonian at middle of the time step is estimated as .. math:: \mathbf{H}(t+{\rm d}t/2) = (\mathbf{H}(t) + \mathbf{H}'(t+{\rm d}t)) / 2 With the improved Hamiltonian, the wave functions are again propagated from `t` to `t+\mathrm dt` by solving .. math:: \left( \mathbf{S} + {\rm i} \mathbf{H}(t+{\rm d}t/2) {\rm d}t / 2 \right) \mathbf{C}(t+{\rm d}t) = \left( \mathbf{S} - {\rm i} \mathbf{H}(t+{\rm d}t/2) {\rm d}t / 2 \right) \mathbf{C}(t). This procedure is repeated using 500--2000 time steps of 5--40 as to calculate the time evolution of the electrons. Usage ===== Create an LCAOTDDFT object like a GPAW calculator:: >>> from gpaw.lcaotddft import LCAOTDDFT >>> td_calc = LCAOTDDFT(setups={'Na': '1'}, basis='dzp', xc='LDA', h=0.3, nbands=1, convergence={'density': 1e-7}, poissonsolver=PoissonSolver(eps=1e-20, remove_moment=1 + 3 + 5)) Some important points are: * The grid spacing is only used to calculate the Hamiltonian matrix and therefore a coarser grid than usual can be used. * Completely unoccupied bands should be left out of the calculation, since they are not needed. * The density convergence criterion should be a few orders of magnitude more accurate than in ground state calculations. * The convergence tolerance of the Poisson solver should be at least 1e-14, but 1e-20 does not hurt (note that this is the *quadratic* error). * One should use multipole-corrected Poisson solvers in any TDDFT run. See the documentation on :ref:`advancedpoisson`. Perform a regular ground state calculation and get the ground state wave functions:: >>> atoms.set_calculator(td_calc) >>> atoms.get_potential_energy() If you wish to save here, write the wave functions also:: >>> td_calc.write('Na2.gpw', mode='all') The calculation proceeds as in grid mode. We kick the system in the x direction and propagate 500 steps of 10 as:: >>> td_calc.absorption_kick([1e-5, 0.0, 0.0]) >>> td_calc.propagate(10, 500, out='Na2.dm') The spectrum is obtained in the same manner as in FD time-propagations. Simple example script ===================== .. literalinclude:: lcaotddft.py General notes about basis sets ============================== In time-propagation LCAO-TDDFT, it is much more important to think about the basis sets compared to ground state LCAO calculations. It is required that the basis set can represent both the occupied (holes) and relevant unoccupied states (electrons) adequately. Custom basis sets for the time propagation should be generated according to one's need, and then benchmarked. **Irrespective of the basis sets you choose, ALWAYS, ALWAYS, benchmark LCAO results with respect to the FD time-propagation code** on the largest system possible. For example, one can create a prototype system which consists of similar atomic species with similar roles as in the parent system, but small enough to calculate with grid propagation mode. See Figs. 4 and 5 of Ref. [#Kuisma2015]_ for example benchmarks. After these remarks, we describe two packages of basis sets that can be used as a starting point for choosing a suitable basis set for your needs. Namely, :ref:`pvalence basis sets` and :ref:`coopt basis sets`. .. _pvalence basis sets: p-valence basis sets -------------------- The so-called p-valence basis sets are constructed for transition metals by replacing the p-type polarization function of the default basis sets with a bound unoccupied p-type orbital and its split-valence complement. Such basis sets correspond to the ones used in Ref. [#Kuisma2015]_. These basis sets significantly improve density of states of unoccupied states. The p-valence basis sets can be easily obtained for the appropriate elements with the :command:`gpaw install-data` tool using the following options:: $ gpaw install-data {} --basis --version=pvalence See :ref:`installation of paw datasets` for more information on basis set installation. It is again reminded that these basis sets are not thoroughly tested and **it is essential to benchmark the performance of the basis sets for your application**. .. _coopt basis sets: Completeness-optimized basis sets --------------------------------- A systematic approach for improving the basis sets can be obtained with the so-called completeness-optimization approach. This approach is used in Ref. [#Rossi2015]_ to generate basis set series for TDDFT calculations of copper, silver, and gold clusters. For further details of the basis sets, as well as their construction and performance, see [#Rossi2015]_. For convenience, these basis sets can be easily obtained with:: $ gpaw install-data {} --basis --version=coopt See :ref:`installation of paw datasets` for basis set installation. Finally, it is again emphasized that when using the basis sets, **it is essential to benchmark their suitability for your application**. Parallelization =============== LCAO-TDDFT is parallelized using ScaLAPACK. It runs without ScaLAPACK, but in this case only a single core is used for linear alrebra. * Use ``parallel={'sl_default':(N,M,64)}``; See :ref:`manual_parallel`. * ScaLAPACK can be also enabled by specifying --sl_default=N,M,64 in command line. * It is necessary that N*M equals the total number of cores used by the calculator, and ``max(N,M)*64 < nbands``. The block size 64 can be changed to, e.g., 16 if necessary. * Apart from parallelization of linear algrebra, normal domain and band parallelizations can be used. As in ground-state LCAO calculations, use band parallelization to reduce memory consumption. Timing ====== TODO: add ``ParallelTimer`` example Advanced tutorial - Plasmon resonance of silver cluster ======================================================= One should think about what type of transitions of interest are present, and make sure that the basis set can represent such Kohn-Sham electron and hole wave functions. The first transitions in silver clusters will be `5s \rightarrow 5p` like. We require 5p orbitals in the basis set, and thus, we must generate a custom basis set. Here is how to generate a double-zeta basis set with 5p orbital in valence for Silver for GLLB-SC potential. Note that the extra 5p valence state effectively improves on the ordinary polarization function, so this basis set is *better* than the default double-zeta polarized one. We will use the 10-electron Ag setup, since the semi-core p states included in the default setup are not relevant here. .. literalinclude:: lcaotddft_basis.py We calculate the icosahedral Ag55 cluster: :download:`ag55.xyz` This code uses ScaLAPACK parallelization with 64 cores. .. literalinclude:: lcaotddft_ag55.py Code runs for approximately two hours wall-clock time. The resulting spectrum shows already emerging plasmonic excitation around 4 eV. For more details, see [#Kuisma2015]_. .. image:: fig1.png Induced density =============== Plotting the induced density is especially interesting in case of plasmon resonances. As an example, we calculate a dummy Na8 wire and write the density to a file on every iteration. There are certain advantages of writing the density on every iteration instead of using the predefined frequencies and on-the-fly Fourier transformation: Only one TDDFT run is required as any frequency can be analysed as a post processing operation. Hard disk requirements are large, but tolerable (1-100GB) in most cases. .. literalinclude:: lcaotddft_induced.py Files with extensions ``.sG`` and ``.asp`` are created, where ``.sG`` files contain the density on the coarse grid while ``.asp`` files contain the atomic density matrices. With these, it is possible to reconstruct the full density. This can now be fourier transformed at the desired frequency. Here, we look from the produced spectrum file that plasmonic peak, and perform Fourier transform at that frequency. .. literalinclude:: lcaotddft_analyse.py Two cube files are created, one for the sin (imag) and cos (real) transform at the frequency. Usually, one is interested in the absorbing part, i.e., the imaginary part. Below the plasmon resonance is visualized in the Na8 wire. In their current form, these cube files contain just the pseudo part of density. .. image:: Na8_imag.png Advanced tutorial - large organic molecule ========================================== General notes ------------- On large organic molecules, on large conjugated systems, there will `\pi \rightarrow \pi^*`, `\sigma \rightarrow \sigma^*`. These states consist of only the valence orbitals of carbon, and they are likely by quite similar few eV's below and above the fermi lavel. These are thus a reason to believe that these states are well described with hydrogen 1s and carbon 2s and 2p valence orbitals around the fermi level. Here, we will calculate a small and a large organic molecule with lcao-tddft. **TODO** Kohn-Sham decomposition of the transition density matrix ======================================================== Soon it will be possible to analyse the origin of the transitions the same way as is commonly done in Casida-based codes. The LCAO basis will be transformed to an electron-hole basis of the Kohn-Sham system. References ========== .. [#Kuisma2015] M. Kuisma, A. Sakko, T. P. Rossi, A. H. Larsen, J. Enkovaara, L. Lehtovaara, and T. T. Rantala, Localized surface plasmon resonance in silver nanoparticles: Atomistic first-principles time-dependent density functional theory calculations, *Phys. Rev. B* **69**, 245419 (2004). `doi:10.1103/PhysRevB.91.115431 `_ .. [#Rossi2015] T. P. Rossi, S. Lehtola, A. Sakko, M. J. Puska, and R. M. Nieminen, Nanoplasmonics simulations at the basis set limit through completeness-optimized, local numerical basis sets, *J. Chem. Phys.* **142**, 094114 (2015). `doi:10.1063/1.4913739 `_ gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft_ag55.py000066400000000000000000000023031316441372200300040ustar00rootroot00000000000000from ase.io import read from gpaw.tddft import photoabsorption_spectrum from gpaw import PoissonSolver from gpaw.lcaotddft import LCAOTDDFT from gpaw.occupations import FermiDirac from gpaw import setup_paths setup_paths.insert(0, '.') atoms = read('ag55.xyz') atoms.center(vacuum=5.0) # Increase accuragy of density for ground state convergence = {'density': 1e-6} # Increase accuracy of Poisson Solver and apply multipole corrections up to l=2 poissonsolver = PoissonSolver(eps=1e-14, remove_moment=1 + 3) td_calc = LCAOTDDFT(xc='GLLBSC', basis='GLLBSC.dz', h=0.3, nbands=352, convergence=convergence, poissonsolver=poissonsolver, occupations=FermiDirac(0.1), parallel={'sl_default': (8, 8, 32), 'band': 2}) atoms.set_calculator(td_calc) # Relax the ground state atoms.get_potential_energy() # For demonstration purposes, save intermediate ground state result to a file td_calc.write('ag55.gpw', mode='all') td_calc = LCAOTDDFT('ag55.gpw', parallel={'sl_default': (8, 8, 32), 'band': 2}) td_calc.absorption_kick([1e-5, 0.0, 0.0]) td_calc.propagate(20, 500, 'ag55.dm') photoabsorption_spectrum('ag55.dm', 'ag55.spec', width=0.2) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft_analyse.py000066400000000000000000000015051316441372200307020ustar00rootroot00000000000000import matplotlib.pyplot as plt from ase.io import read from gpaw.lcaotddft.tddfpt import transform_local_operator transform_local_operator(gpw_file='Na8_gs.gpw', tdop_file='Na8.TdDen', fqop_file='Na8.FqDen', omega=1.8, eta=0.23) dct = read('Na8.FqDen.imag.cube', full_output=True) data = dct['data'][:, :, 16] atoms = dct['atoms'] extent = [0, atoms.cell[0][0], 0, atoms.cell[1][1]] plt.imshow(data.T, origin='lower', extent=extent) for atom in atoms: circle = plt.Circle((atom.position[0], atom.position[1]), 0.3, color='r', clip_on=False) fig = plt.gcf() fig.gca().add_artist(circle) plt.title('Induced density of $Na_{8}$') plt.xlabel('$\\AA$') plt.ylabel('$\\AA$') plt.savefig('Na8_imag.png') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft_basis.py000066400000000000000000000007621316441372200303530ustar00rootroot00000000000000from gpaw.atom.generator import Generator from gpaw.atom.basis import BasisMaker args = {'core': '[Kr]', 'rcut': 2.45} generator = Generator('Ag', 'GLLBSC', scalarrel=True) generator.N *= 2 # Increase grid resolution generator.run(**args) bm = BasisMaker(generator, name='GLLBSC', run=False) basis = bm.generate(zetacount=2, polarizationcount=0, energysplit=0.07, jvalues=[0, 1, 2], # include d, s and p rcutmax=12.0) basis.write_xml() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft_fig1.py000066400000000000000000000004701316441372200300740ustar00rootroot00000000000000import numpy as np import matplotlib.pyplot as plt plt.figure(figsize=(6, 6 / 2 ** 0.5)) data = np.loadtxt('ag55.spec') plt.plot(data[:, 0], data[:, 1], 'k') plt.title(r'Absorption spectrum of $Ag_{55}$ with GLLB-SC potential') plt.xlabel('eV') plt.ylabel('Absorption (arbitrary units)') plt.savefig('fig1.png') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/lcaotddft_induced.py000066400000000000000000000015001316441372200306540ustar00rootroot00000000000000from ase import Atoms from gpaw.tddft import photoabsorption_spectrum from gpaw import PoissonSolver from gpaw.lcaotddft.tddfpt import TDDFPT, DensityCollector from gpaw.lcaotddft import LCAOTDDFT atoms = Atoms('Na8', positions=[[i * 3.0, 0, 0] for i in range(8)]) atoms.center(vacuum=5.0) # Calculate all bands td_calc = LCAOTDDFT( basis='dzp', setups={'Na': '1'}, xc='LDA', h=0.3, nbands=4, convergence={'density': 1e-7}, poissonsolver=PoissonSolver(eps=1e-14, remove_moment=1 + 3 + 5)) atoms.set_calculator(td_calc) atoms.get_potential_energy() td_calc.write('Na8_gs.gpw', mode='all') td_calc = LCAOTDDFT('Na8_gs.gpw') td_calc.attach(DensityCollector('Na8.TdDen', td_calc)) td_calc.absorption_kick([1e-4, 0.0, 0.0]) td_calc.propagate(20, 1000, 'Na8.dm') photoabsorption_spectrum('Na8.dm', 'Na8.spec', width=0.15) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/linear_response.rst000066400000000000000000000106261316441372200305760ustar00rootroot00000000000000.. _lrtddft: ===================== Linear response TDDFT ===================== Ground state ============ The linear response TDDFT calculation needs a converged ground state calculation with a set of unoccupied states. The standard eigensolver 'rmm-diis' should not be used for the calculation of unoccupied states, better use 'dav' or 'cg': .. literalinclude:: Be_gs_8bands.py Calculating the Omega Matrix ============================ The next step is to calculate the Omega Matrix from the ground state orbitals: .. literalinclude:: Be_8bands_lrtddft.py alternatively one can also restrict the number of transitions by their energy: .. literalinclude:: Be_8bands_lrtddft_dE.py Note, that parallelization over spin does not work here. As a workaround, domain decomposition only (``parallel={'domain': world.size}``, see :ref:`manual_parsize_domain`) has to be used for spin polarised calculations in parallel. Extracting the spectrum ======================= The dipole spectrum can be evaluated from the Omega matrix and written to a file:: from gpaw.lrtddft import LrTDDFT from gpaw.lrtddft import photoabsorption_spectrum lr = LrTDDFT('lr.dat.gz') lr.diagonalize() # write the spectrum to the data file photoabsorption_spectrum(lr, 'spectrum_w.05eV.dat', # data file name width=0.05) # width in eV Testing convergence =================== You can test the convergence of the Kohn-Sham transition basis size by restricting the basis in the diagonalisation step, e.g.:: from gpaw.lrtddft import LrTDDFT lr = LrTDDFT('lr.dat.gz') lr.diagonalize(energy_range=2.) This can be automated by using the check_convergence function:: from gpaw.lrtddft import LrTDDFT from gpaw.lrtddft.convergence import check_convergence lr = LrTDDFT('lr.dat.gz') check_convergence(lr, 'linear_response', 'my plot title', dE=.2, emax=6.) which will create a directory 'linear_response'. In this directory there will be a file 'conv.gpl' for gnuplot that compares the spectra varying the basis size. Analysing the transitions ========================= The single transitions (or a list of transitions) can be analysed as follows (output printed):: from gpaw.lrtddft import LrTDDFT lr = LrTDDFT('lr.dat.gz') lr.diagonalize() # analyse transition 1 lr.analyse(1) # analyse transition 0-10 lr.analyse(range(11)) Relaxation in the excited state =============================== This example shows how to relax in the B excited state of the sodium dimer: .. literalinclude:: Na2_relax_excited.py Quick reference =============== Parameters for LrTDDFT: ================ ============== =================== ======================================== keyword type default value description ================ ============== =================== ======================================== ``calculator`` ``GPAW`` Calculator object of ground state calculation ``filename`` ``string`` read the state of LrTDDFT calculation (i.e. omega matrix, excitations) from ``filename`` ``istart`` ``int`` 0 first occupied state to consider ``jend`` ``int`` number of bands last unoccupied state to consider ``energy_range`` ``float`` None Energy range to consider in the involved Kohn-Sham orbitals (replaces [istart,jend]) ``nspins`` ``int`` 1 number of excited state spins, i.e. singlet-triplet transitions are calculated with ``nspins=2``. Effective only if ground state is spin-compensated ``xc`` ``string`` xc of calculator Exchange-correlation for LrTDDFT, can differ from ground state value ``eps`` ``float`` 0.001 Minimal occupation difference for a transition ================ ============== =================== ======================================== gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/linear_response2.rst000066400000000000000000000101721316441372200306540ustar00rootroot00000000000000.. _lrtddft2: ========================================= Linear response TDDFT 2 - indexed version ========================================= Ground state ============ The linear response TDDFT calculation needs a converged ground state calculation with a set of unoccupied states. It is safer to use 'dav' or 'cg' eigensolver instead of the default 'rmm-diis' eigensolver to converge unoccupied states. However, 'dav' and 'cg' are often too expensive for large systems. In this case, you should use 'rmm-diis' with tens or hundreds of extra states in addition to the unoccupied states you wish to converge. .. literalinclude:: r-methyl-oxirane.xyz .. literalinclude:: Oxirane_lrtddft2_unocc.py Calculating response matrix and spectrum ======================================== The next step is to calculate the response matrix: .. literalinclude:: Oxirane_lrtddft2_lr.py Note: Unfortunately, spin is not implemented yet. For now, use 'lrtddft'. Restarting, recalculating and analyzing spectrum ================================================ .. literalinclude:: Oxirane_lrtddft2_lr2.py Quick reference =============== Parameters for LrCommunicators: ================ ================= =================== ======================================== keyword type default value description ================ ================= =================== ======================================== ``world`` ``Communicator`` None parent communicator (usually gpaw.mpi.world) ``dd_size`` `int`` None Number of domains for domain decomposition ``eh_size`` `int`` None Number of groups for parallelization over e-h -pairs ================ ================= =================== ======================================== Note: world.size = dd_size x eh_size Parameters for LrTDDFT2: ==================== ================== =================== ======================================== keyword type default value description ==================== ================== =================== ======================================== ``basefilename`` ``string`` Prefix for all files created by LRTDDFT2 (e.g. ``dir/lr``) ``gs_calc`` ``GPAW`` Ground-state calculator, which has been loaded from a file with communicator=lr_communicators calculation ``fxc`` ``string`` None Exchange-correlation kernel ``min_occ`` ``int`` None Index of the first occupied state (inclusive) ``max_occ`` ``int`` None Index of the last occupied state (inclusive) ``min_unocc`` ``int`` None Index of the first unoccupied state (inclusive) ``max_unocc`` ``int`` None Index of the last unoccupied state (inclusive) ``max_energy_diff`` ``float`` None Maximum Kohn-Sham eigenenergy difference ``recalculate`` ``string`` None What should be recalculated. Usually nothing. ``lr_communicators`` ``LrCommuncators`` None ``txt`` ``string`` None Output ==================== ================== =================== ======================================== gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/r-methyl-oxirane.xyz000066400000000000000000000005571316441372200306360ustar00rootroot0000000000000010 http://cccbdb.nist.gov/ Geometry for C3H6O (Propylene oxide), CISD/6-31G* O 0.8171 -0.7825 -0.2447 C -1.5018 0.1019 -0.1473 H -1.3989 0.3323 -1.2066 H -2.0652 -0.8262 -0.0524 H -2.0715 0.8983 0.3329 C -0.1488 -0.0393 0.4879 H -0.1505 -0.2633 1.5506 C 1.0387 0.6105 -0.0580 H 0.9518 1.2157 -0.9531 H 1.8684 0.8649 0.5908 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/submit.agts.py000066400000000000000000000006741316441372200274700ustar00rootroot00000000000000def agts(queue): calc1 = queue.add('Be_gs_8bands.py', ncpus=2, walltime=20) queue.add('Be_8bands_lrtddft.py', ncpus=2, walltime=20, deps=calc1) queue.add('Be_8bands_lrtddft_dE.py', ncpus=2, walltime=20, deps=calc1) queue.add('Na2_relax_excited.py', ncpus=4, walltime=500) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/tddft.rst000066400000000000000000000005411316441372200265060ustar00rootroot00000000000000================================================ Time-dependent density-functional theory (TDDFT) ================================================ Currently two different approaches are available: .. toctree:: :maxdepth: 2 timepropagation lcaotddft linear_response linear_response2 dielectric_response inducedfield/inducedfield gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tddft/timepropagation.rst000066400000000000000000000345631316441372200306160ustar00rootroot00000000000000.. module:: gpaw.tddft .. _timepropagation: ====================== Time-propagation TDDFT ====================== Optical photoabsorption spectrum as well as nonlinear effects can be studied using time propagation TDDFT. This approach scales better than linear response, but the prefactor is so large that for small and moderate systems linear response is significantly faster. ------------ Ground state ------------ To obtain the ground state for TDDFT, one has to just do a standard ground state with a larger simulation box. A proper distance from any atom to edge of the simulation box is problem dependent, but a minimum reasonable value is around 6 Ångströms and recommended between 8-10 Ång. In TDDFT, one can use larger grid spacing than for geometry optimization. For example, if you use h=0.25 for geometry optimization, try h=0.3 for TDDFT. This saves a lot of time. A good way to start is to use too small box (vacuum=6.0), too large grid spacing (h=0.35), and too large time step (dt=16.0). Then repeat the simulation with better parameter values and compare. Probably lowest peaks are already pretty good, and far beyond the ionization limit, in the continuum, the spectrum is not going to converge anyway. The first run takes only fraction of the time of the second run. For a parallel-over-states TDDFT calculation, you must choose the number of states so, that these can be distributed equally to processors. For example, if you have 79 occupied states and you want to use 8 processes in parallelization over states, add one unoccupied state to get 80 states in total. Ground state example:: # Standard magic from ase import Atoms from gpaw import GPAW # Beryllium atom atoms = Atoms(symbols='Be', positions=[(0, 0, 0)], pbc=False) # Add 6.0 ang vacuum around the atom atoms.center(vacuum=6.0) # Create GPAW calculator calc = GPAW(nbands=1, h=0.3) # Attach calculator to atoms atoms.set_calculator(calc) # Calculate the ground state energy = atoms.get_potential_energy() # Save the ground state calc.write('be_gs.gpw', 'all') Time-propagation TDDFT is also available in :ref:`LCAO mode `. -------------------------------- Optical photoabsorption spectrum -------------------------------- Optical photoabsorption spectrum can be obtained by applying a weak delta pulse of dipole electric field, and then letting the system evolve freely while recording the dipole moment. A time-step around 4.0-8.0 attoseconds is reasonable. The total simulation time should be few tens of femtoseconds depending on the desired resolution. Example:: from gpaw.tddft import * time_step = 8.0 # 1 attoseconds = 0.041341 autime iterations = 2500 # 2500 x 8 as => 20 fs kick_strength = [0.0,0.0,1e-3] # Kick to z-direction # Read ground state td_calc = TDDFT('be_gs.gpw') # Kick with a delta pulse to z-direction td_calc.absorption_kick(kick_strength=kick_strength) # Propagate, save the time-dependent dipole moment to 'be_dm.dat', # and use 'be_td.gpw' as restart file td_calc.propagate(time_step, iterations, 'be_dm.dat', 'be_td.gpw') # Calculate photoabsorption spectrum and write it to 'be_spectrum_z.dat' photoabsorption_spectrum('be_dm.dat', 'be_spectrum_z.dat') .. note:: Make sure to number of iterations is divisible by the dump interval such that the last iteration will be stored in the restart file. Otherwise append td_calc.write('be_td.gpw', mode='all') to the script. When propagating after an absorption kick has been applied, it is a good idea to periodically write the time-evolution state to a restart file. This ensures that you can resume adding data to the dipole moment file if you experience artificial oscillations in the spectrum because the total simulation time was too short. Example:: from gpaw.tddft import * time_step = 8.0 # 1 attoseconds = 0.041341 autime iterations = 2500 # 2500 x 8 as => 20 fs # Read restart file with result of previous propagation td_calc = TDDFT('be_td.gpw') # Propagate more, appending the time-dependent dipole moment to the # already existing 'be_dm.dat' and use 'be_td2.gpw' as restart file td_calc.propagate(time_step, iterations, 'be_dm.dat', 'be_td2.gpw') # Recalculate photoabsorption spectrum and write it to 'be_spectrum_z2.dat' photoabsorption_spectrum('be_dm.dat', 'be_spectrum_z2.dat') Typically in experiments, the spherically averaged spectrum is measured. To obtain this, one must repeat the time-propagation to each Cartesian direction and average over the Fourier transformed dipole moments. -------------------------------- Fourier transformed density -------------------------------- If one merely wishes to record the time-evolution of the dipole moment and analyze the resulting spectrum, TDDFT offers little advantage over the much faster :ref:`LrTDDFT `. Further, one must bear in mind that only excitations induced by the absorption kick will show up in the spectrum. However, propagating a slightly perturbed ground state density may offer much more structural information, starting with the ability to distinguish which spectral peaks correspond to which principal directions in a lattice. Since the dipole moment is generated by displacements in the charge density, most strong peaks in the optical photoabsorption spectrum signify nearly harmonic oscillations herein. Therefore, taking Fourier transforms of the time-evolution of the density at the resonant frequencies is a great way of analyzing the spatial extent of the oscillating modes. The discrete moving-average Fourier transform of the pseudo-electron density `\tilde{n}(\mathbf{r},t)` is defined: .. math:: F_N(\mathbf{r},\omega) = \frac{1}{\sqrt{\pi}} \sum_{j=0}^N \big( \tilde{n}(\mathbf{r},t_j)-\overline{n}_N(\mathbf{r})\big) \mathrm{e}^{-\textstyle\frac{1}{2}t_j^2\sigma^2} \mathrm{e}^{\displaystyle\mathrm{i}\omega t_j} \Delta t_j , where we allow for variable time-step `\Delta t_j` along the `N` propagation steps in the time-series `j=0,1,\ldots,N`. With a total propagation time of `t_N`, the Fourier transforms are taken relative to the time-average `\overline{n}_N(\mathbf{r})` of the pseudo density: .. math:: \overline{n}_N(\mathbf{r}) = \frac{1}{t_{N+1}} \sum_{j=0}^N \tilde{n}(\mathbf{r},t_j) \Delta t_j \qquad, t_N = \sum_{j=0}^{N-1}\Delta t_j Regrettably, having arrived at time `t_N` will not enable us to perform the above summations because recording `N\sim 10^4` sets of grid data is completely intractable. Instead, an iterative cumulation scheme is implemented, which only requires data from one time-step at a time. XXX more on this later The class :class:`gpaw.tddft.fourier.DensityFourierTransform` is used to calculate and maintain Fourier transforms of the pseudo electron density. It functions by attaching itself to a TDDFT instance, which in turn notifies it after each time-step and allows it to update the density Fourier transforms. .. important:: An incontestable restriction of the iterative approach is the requirement that the frequencies must be given upon initialization (i.e. time zero). To avoid wasted effort, getting the peak frequencies right is essential. It is recommended to use either :ref:`LrTDDFT ` or a somewhat cruder time-propagation to estimate which frequencies could be of interest. In the latter case, applying a weak kick ``[1e-3, 1e-3, 1e-3]`` will probably be sufficient to excite and detect all the relevant modes in a short time-span. For quick estimates, using the ``ECN`` propagator and the ``CSCG`` eigensolver with a tolerance around ``1e-4`` works reasonably well for timesteps of 5-10 as. .. tip:: Using a finite width `\sigma` around ``0.1 eV`` will make any ballpark figure a much safer bet. Be aware that peaks found using :ref:`LrTDDFT ` may shift slightly. Example:: from gpaw.tddft import TDDFT from gpaw.tddft.fourier import DensityFourierTransform time_step = 4.0 # 1 attoseconds = 0.041341 autime iterations = 5000 # 5000 x 4 as => 20 fs kick_strength = [0.0,5e-3,0.0] # Kick to y-direction frequencies = [4.26,6.27,13.0, \ 16.9,18.1,19.9] # Pre-determined peak frequencies in eV sigma = 0.05 # Width of Gaussian envelope in eV # Read ground state td_calc = TDDFT('bda_gs.gpw') # Kick with a delta pulse to y-direction td_calc.absorption_kick(kick_strength=kick_strength) # Create and attach Fourier transform observer obs = DensityFourierTransform(timestep, frequencies, sigma) obs.initialize(td_calc) # Propagate, save the time-dependent dipole moment to 'bda_dm.dat', # (just for comparison) and use 'bda_td.gpw' as restart file td_calc.propagate(time_step, iterations, 'bda_dm.dat', 'bda_td.gpw') # Save result of the Fourier transformations to a .ftd file obs.write('bda_fourier.ftd') You can now resume adding data to both the dipole moment file and the density fourier transform if the spectrum is not sufficiently evolved because the total simulation time was too short. Example:: from gpaw.tddft import TDDFT from gpaw.tddft.fourier import DensityFourierTransform time_step = 4.0 # 1 attoseconds = 0.041341 autime iterations = 5000 # 5000 x 4 as => 20 fs frequencies = [4.26,6.27,13.0, \ 16.9,18.1,19.9] # Pre-determined peak frequencies in eV sigma = 0.05 # Width of Gaussian envelope in # Read restart file with result of previous propagation td_calc = TDDFT('bda_td.gpw') # Create and attach Fourier transform observer obs = DensityFourierTransform(timestep, frequencies, sigma) obs.initialize(td_calc) # Read previous result of the corresponding Fourier transformations obs.read('bda_fourier.ftd') # Propagate more, appending the time-dependent dipole moment to the # already existing 'bda_dm.dat' and use 'bda_td2.gpw' as restart file td_calc.propagate(time_step, iterations, 'bda_dm.dat', 'bda_td2.gpw') # Save result of the improved Fourier transformations to an .ftd file obs.write('bda_fourier2.ftd') -------------------------------- Time propagation -------------------------------- Since the total CPU time also depends on the number of iterations performed by the linear solvers in each time-step, smaller time-steps around 2.0-4.0 attoseconds might prove to be faster with the ``ECN`` and ``SICN`` propagators because they have an embedded Euler step in each predictor step: .. math:: \tilde{\psi}_n(t+\Delta t) \approx (1 - i \hat{S}^{\;-1}_\mathrm{approx.}(t) \tilde{H}(t) \Delta t)\tilde{\psi}_n(t) , where `\hat{S}^{\;-1}_\mathrm{approx.}` is an inexpensive operation which approximates the inverse of the overlap operator `\hat{S}`. See the :ref:`Developers Guide ` for details. Therefore, as a rule-of-thumb, choose a time-step small enough to minimize the number of iterations performed by the linear solvers in each time-step, but large enough to minimize the number of time-steps required to arrive at the desired total simulation time. -------------------------------- TDDFT reference manual -------------------------------- The :class:`~gpaw.tddft.TDDFT` class and keywords: ===================== =============== ============== ===================================== Keyword Type Default Description ===================== =============== ============== ===================================== ``ground_state_file`` ``string`` Name of the ground state file ``td_potential`` ``TDPotential`` ``None`` Time-dependent external potential ``propagator`` ``string`` ``'SICN'`` Time-propagator (``'ECN'``/``'SICN'``/``'SITE'``/``'SIKE'``) ``solver`` ``string`` ``'CSCG'`` Linear equation solver (``'CSCG'``/``'BiCGStab'``) ``tolerance`` ``float`` ``1e-8`` Tolerance for linear solver ===================== =============== ============== ===================================== Keywords for :func:`~gpaw.tddft.TDDFT.absorption_kick`: ================== =============== ================== ===================================== Keyword Type Default Description ================== =============== ================== ===================================== ``kick_strength`` ``float[3]`` ``[0,0,1e-3]`` Kick strength ================== =============== ================== ===================================== Keywords for :func:`~gpaw.tddft.TDDFT.propagate`: ====================== =========== =========== ================================================ Keyword Type Default Description ====================== =========== =========== ================================================ ``time_step`` ``float`` Time step in attoseconds (``1 autime = 24.188 as``) ``iterations`` ``integer`` Iterations ``dipole_moment_file`` ``string`` ``None`` Name of the dipole moment file ``restart_file`` ``string`` ``None`` Name of the restart file ``dump_interal`` ``integer`` ``500`` How often restart file is written ====================== =========== =========== ================================================ Keywords for :func:`gpaw.tddft.photoabsorption_spectrum`: ====================== ============ ============== =============================================== Keyword Type Default Description ====================== ============ ============== =============================================== ``dipole_moment_file`` ``string`` Name of the dipole moment file ``spectrum_file`` ``string`` Name of the spectrum file ``folding`` ``string`` ``Gauss`` Gaussian folding (or Lorentzian in future) ``width`` ``float`` ``0.2123`` Width of the Gaussian/Lorentzian (in eV) ``e_min`` ``float`` ``0.0`` Lowest energy shown in spectrum (in eV) ``e_max`` ``float`` ``30.0`` Highest energy shown in spectrum (in eV) ``delta_e`` ``float`` ``0.05`` Resolution of energy in spectrum (in eV) ====================== ============ ============== =============================================== .. autoclass:: gpaw.tddft.TDDFT :members: .. autofunction:: gpaw.tddft.photoabsorption_spectrum .. autoclass:: gpaw.tddft.fourier.DensityFourierTransform gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tools/000077500000000000000000000000001316441372200247025ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/tools/tools.rst000066400000000000000000000017521316441372200266010ustar00rootroot00000000000000.. _tools: Command-line tools ================== Finding all or some unocupied states ------------------------------------ If you have a gpw-file containing the ground-state density for a plane-wave calculation, then you can set up the full `H_{\mathbf{G}\mathbf{G}'}(\mathbf{k})` and `S_{\mathbf{G}\mathbf{G}'}(\mathbf{k})` matrices in your plane-wave basis and use direct diagonalization to find all the eigenvalues and eigenstates in one step. Usage:: $ python3 -m gpaw.fulldiag [options] Options: -h, --help Show this help message and exit -n BANDS, --bands=BANDS Number of bands to calculate. Defaults to all. -s SCALAPACK, --scalapack=SCALAPACK Number of cores to use for ScaLapack. Default is one. -d, --dry-run Just write out size of matrices. Typpically, you will want to run this in parallel and distrubute the matrices using ScaLapack:: $ mpiexec gpaw-python -m gpaw.fulldiag abc.gpw --scalapack=8 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/transport/000077500000000000000000000000001316441372200255765ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/transport/GW_eq.py000066400000000000000000000050421316441372200271530ustar00rootroot00000000000000from __future__ import print_function import pickle import numpy as np from gpaw.mpi import world from parms import V, H, h1, ion_shift from kgf.GreenFunctions import NonEqNonIntGreenFunction, NonEqIntGreenFunction from kgf.ScatteringHamiltonianMatrix import ScatteringHamiltonianMatrix from kgf.LeadHamiltonianMatrix import LeadHamiltonianMatrix from kgf.CurrentCalculator import CurrentCalculator from kgf.selfenergies import NonEqConstantSelfEnergy from kgf.selfenergies.GW2index import Hartree2index, Fock2index, GW2index hmat = ScatteringHamiltonianMatrix(leftprincipallayer=1, rightprincipallayer=1, hamiltonianmatrix=H) left = LeadHamiltonianMatrix(principallayer=1, hamiltonianmatrix=h1) right = LeadHamiltonianMatrix(principallayer=1, hamiltonianmatrix=h1) energies = np.arange(-96.0, 96.0, 0.02) de = energies[1] - energies[0] assert abs(energies).min() < 1.0e-8 fermi = 0.0 g0 = NonEqNonIntGreenFunction(hmat, left, right, E_Fermi=fermi, energies=energies) g0.SetInfinitesimal(2*de) Ntot = g0.GetTotalParticleNumber() if world.rank==0: print('Total electron number:', Ntot) se_null = NonEqConstantSelfEnergy(g0, np.zeros((6, 6), complex), 'null') se_ion = NonEqConstantSelfEnergy(g0, ion_shift, 'shift') se_hartree = Hartree2index(g0, V, initialhartree=np.zeros((6, 6), complex)) se_fock = Fock2index(g0, V) se_gw = GW2index(g0, V) gf = NonEqIntGreenFunction([se_null, se_ion, se_hartree, se_fock, se_gw]) orbitals = range(1, 5) pulay = (0.03, 0.25, 1) # Non interacting calculation se_ion.SetActive(False) se_hartree.SetActive(False) se_fock.SetActive(False) se_gw.SetActive(False) gf.WriteSpectralInfoToNetCDFFile('nonint.nc', diagonalize=True, orbitals=orbitals, spectral='individual') # HF calculation se_ion.SetActive(True) se_hartree.SetActive(True) se_fock.SetActive(True) gf.SelfConsistent(log='HF.log', pulay=pulay) gf.WriteSpectralInfoToNetCDFFile('HF.nc', diagonalize=True, orbitals=orbitals, spectral='individual') # GW calculation se_gw.SetActive(True) gf.SelfConsistent(log='GW.log', pulay=pulay) gf.WriteSpectralInfoToNetCDFFile('GW.nc', diagonalize=True, orbitals=orbitals, spectral='individual') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/transport/keldyshgf.rst000066400000000000000000000120061316441372200303070ustar00rootroot00000000000000.. _keldyshgf: ======================= Keldysh Green functions ======================= The Keldysh Green function (KGF) code allows for calculations of non-equilibrium transport calculations where electron exchange and correlation effect are threated using many body perturbation theory such as Hartree-Fock, second Born and the GW approximation. It is recommended that you go through the ASE/GPAW electron transport exercice to get familiar with the general transport setup and definitions used in ase and gpaw and the KGF code. ------------------------- Download and Installation ------------------------- The KGF code is currently being merged into the development version of GPAW and is expected to be part of the GPAW package in the near future. The latest revision can be obtained from svn:: $ svn checkout https://svn.fysik.dtu.dk/projects/KeldyshGF/trunk KeldyshGF Installation is completed by adding the path of KeldyshGF to the PYTHONPATH environment variable. ----------------------- Doing a KGF calculation ----------------------- The KGF code can perform finite bias non-equilibrium calculation of a molecular junction using various electron exchange and correlation approximations. It is assumed that interactions are only included in a central region. The KGF code can handle both model Hamiltonians of the the Pariser-Parr-Pople (extended Hubbard) as well as abinitio calculated Hamiltonians. A KGF calculatoin normally involves the following steps: - Setting up the non-interacting lead and scattering Hamiltonian. - Setting up a non-interacting GF - Setting up various self-energies to handle Hartree, exchange and correlation - Runnig the calculation XXX. Example: Pariser-Parr-Model Hamiltonian --------------------------------------- To do an electron transport calculation using a model Hamiltonian the parameters of both the non-interacting part as well as the interacting part of the Hamiltonian need to be explicitly specified. The non-interacting part h_ij describe kinetic energy and electron-electron interaction part in the PPP approximation is on the form V_ij = v_iijj, where the v_ijkl's are two electron Coulomb integrals. To get started consider a simple four site interacting model. The four the x's in the figure below represent the sites where electron-electron interactions are included. The o's (dashes) represents non-interacting sites.:: Left lead Molecule Right Lead --------------------------------- o o o o x| x x x x |x o o o o --------------------------------- 0 1 2 3 4 5 The numbers refers to indix numbers in the Green functions - the Green function will be a 6x6 matrix where the subspace corresponding to the molecule will be the central 4x4 matrix. Leads are treated as simple nearest neighbour tight-binding chains with a principal layer size of one. The following parameters will be used to simulate a physisorbed molecule: ================= ========= ============================== parameter value description ================= ========= ============================== ``t_ll`` -20.0 intra lead hopping ``t_lm`` -1.0 lead-molecule hopping ``t_mm`` -2.4 intra molecule hopping ``V`` electron-electron interaction ================= ========= ============================== where V is the matrix:: V = [[ 0. 7.45 4.54 3.18 2.42 0. ] [ 7.45 11.26 7.45 4.54 3.18 2.42] [ 4.54 7.45 11.26 7.45 4.54 3.18] [ 3.18 4.54 7.45 11.26 7.45 4.54] [ 2.42 3.18 4.54 7.45 11.26 7.45] [ 0. 2.42 3.18 4.54 7.45 0. ]] In Python code the input parameters can generated like this: .. literalinclude:: parms.py We begin by performing an equilibrium calculation (zero bias). An equilibrium involces setting the relevant Green's functions and self-energies. All Green's functions are represented on energy grid which should have a grid spacing fine enough to resolve all spectreal feautres. In practise this accomplished by choosing an energy grid spacing about half the size of the infinitesimal eta appearing in the Green's functions (which is given a finite value in numerical calculations). In Python code an equilibrium non-interacting calculatoins followed by a Hartree-Fock calculations and a GW calculation look like this: .. literalinclude:: GW_eq.py Self-consistency ----------------- The self-consistent solution is obtained by mixing Green's function using a pulay mixing scheme, which is controllod by three parameters (tol:float , mix:float : float, history:int). The self-consistent cycles is initianted by the GF method ``selfconsistent``. The self-consistent iterations can be monited if written to the logfiles files. Saving calculated data to a NetCDFFile -------------------------------------- The GF method ``WriteSpectralInfoToNetCDFFile`` is used to save all the calculated data such as spectral functions, transmission function etc. to a NetCDFFile. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/transport/parms.py000066400000000000000000000023221316441372200272710ustar00rootroot00000000000000from __future__ import print_function import numpy as np pos = np.asarray([1.450 * a for a in range(6)]) n = len(pos) d2_ii = np.zeros((n, n)) for i1, i2 in np.ndindex(n, n): d2_ii[i1, i2] = ((pos[i1]-pos[i2])**2).sum() d_ii = np.sqrt(d2_ii) U = 11.26 t_m = -2.4 t_lm = -1.0 # Two particle interaction V = U / np.sqrt(1.0 + 0.6117*d2_ii) V[0,-1] = V[-1,0] = 0.0 V[0,0] = V[-1,-1] = 0.0 # One particle part mask_c = d_ii < 1.5 mask_c *= d_ii > 0.0 mask_c = mask_c.astype(int) nbf = len(d_ii) h = t_m * np.ones((nbf, nbf)) * mask_c h[0, 1] = h[1, 0] = t_lm h[-2,-1] = h[-1,-2] = t_lm # H_lead h1 = np.zeros((2,2), complex) t_l = -20.0 h1[0,1] = t_l h1[1,0] = t_l nbf = len(h) # H_scat H = np.zeros((nbf+2, nbf+2), complex) H[0,1] = H[1,0] = t_l H[-2,-1] = H[-1,-2] = t_l H[1:-1, 1:-1] = h # Hartree potential of the ions (Z=1) ion_shift = np.zeros((n, n)) for i in range(n): ion_shift[i, i] += -0.5 * V[i, i] for k in range(n): if k!=i: ion_shift[i, i] += -1.0 * V[i, k] H = H.astype(complex) V = V.astype(complex) ion_shift = ion_shift.astype(complex) if __name__=='__main__': print(np.around(H.real, 2)) print(np.around(V.real ,2)) print(np.around(ion_shift.diagonal().real, 2)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xas/000077500000000000000000000000001316441372200243355ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xas/xas.rst000066400000000000000000000061741316441372200256720ustar00rootroot00000000000000.. _xas: =================================== X-Ray Absorption Spectroscopy (XAS) =================================== Introduction ============ The pseudo wave-functions are solutions to this generalized eigenvalue problem: .. math:: H \tilde{\psi}_n = \epsilon_n S \tilde{\psi}_n. This can be transformed into a standard eigenvalue problem: .. math:: S^{-1/2} H S^{-1/2} \psi_n = \epsilon_n \psi_n, where `\psi_n = S^{1/2} \tilde{\psi}_n` is an all-electron wave function. XAS cross section ================= For the cross section, we need this quantity: .. math:: \langle \psi_n | x | \phi^a \rangle = \sum_i \langle \tilde{\psi}_n | \tilde{p}_i^a \rangle \langle \phi_i^a | x | \phi^a \rangle = \langle \tilde{\psi}_n | \tilde{\phi}^a \rangle, where `\phi^a` is the core state localized on atom `a` and `\tilde{\phi}^a = \sum_i \langle \phi_i^a | x | \phi^a \rangle \tilde{p}_i^a`. Now, the cross section is: .. math:: \sum_n |\langle \tilde{\psi}_n | \tilde{\phi}^a \rangle|^2 \delta(\epsilon_n - E) = \sum_n \langle \tilde{\phi}^a | S^{-1/2} | \psi_n \rangle \delta(\epsilon_n - E) \langle \psi_n | S^{-1/2} | \tilde{\phi}^a \rangle. By introducing `G(E) = (E - S^{-1/2} H S^{-1/2} + i \gamma)^{-1}`, we get: .. math:: \text{Im}[\langle S^{-1/2} \tilde{\phi}^a | G(E) | S^{-1/2} \tilde{\phi}^a \rangle]. Recursion method ================ Instead of working with the `u_i` functions from the Taillefumier paper, we introduce `w_i=S^{1/2}u_i` which are the actual functions that we need to find. We now define `y_i` and `z_i` as: .. math:: w_i = S z_i, .. math:: y_i = H z_i. With these definitions, the recursion formula reads: .. math:: y_i = a_i w_i + b_{i+1} w_{i+1} + b_i w_{i-1}, where: .. math:: a_i = \langle z_i | y_i \rangle, and .. math:: b_i = \langle z_i | y_{i-1} \rangle = \langle z_{i-1} | y_i \rangle. The `w_i` functions should be normalized as: .. math:: \langle w_i | S^{-1} | w_i \rangle = \langle w_i | z_i \rangle = 1, and the recursion is started with `w_0 \propto \tilde{\phi}^a`. Inverting the S matrix ====================== The S (or O) operator is defined as: .. math:: \hat O = 1 + \sum_a \sum_{i_1 i_2} |\tilde p^a_{i_1}> O^a_{i_1 i_2}< \tilde p^q_{i_2}| Where `O^a_{i_1 i_2} = <\phi ^a_{i_1}| \phi ^a_{i_2}> - <\tilde \phi ^a_{i_1}| \tilde \phi ^a_{i_2}>` Assume that `\hat O^{-1}` can be written as .. math:: \hat O^{-1} = 1 + \sum_a \sum_{i_1 i_2} |\tilde p^a_{i_1}> P^a_{i_1 i_2}< \tilde p^a_{i_2}| Then according to [P.J. Hasnip et al, Comp. Phys. Comm. 174 (2006) 24-29 ] the coefficients `P^a_{i_1 i_2}` are given by .. math:: P^a_{i_1 i_2} = -O^a_{i_1 j} ( 1 + B^a_{kl} O^a_{lm} )^{-1}_{j i_2} .. math:: B^a_{kl} = < \tilde p^a_{k}| \tilde p^a_{l}> With summation over equal indices (except a). These formulas ignore overlap between projectors on different atoms. The accuracy of the `\hat O^{-1}` operator can be checked for example by doing: .. math:: <\tilde \phi_{i_1}| \hat O \hat O^{-1} \hat O |\tilde \phi_{i_2}> - \delta_{i_1 i_2} which should be zero for all normalized, orthogonalized `\tilde \phi` gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/000077500000000000000000000000001316441372200241545ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/E_rpa.png000066400000000000000000001264351316441372200257230ustar00rootroot00000000000000PNG  IH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h%0!"j*<!)) HHH;vUn:5 fffd啷0 !j `4R?_~߇$I(ToĈ͛7aoo>gϞEYYYuQ`BDAd2888`֭:yO 0K,?hhhLPJն4JSW""|$I2d(\HIIRk֬gr`ӦMɩWZ$PBDD-Qr-ذa Æ  BL>r 5j޽tRݻ;v,Ν;qsxxx@CCCioGΝ;n*//O?%K<<` page. A comparison of the atomization energies of the g2-1 test-set calculated in VASP, Gaussian03, and GPAW is shown in the below two figures for the PBE and the PBE0 functional respectively. .. image:: g2test_pbe.png .. image:: g2test_pbe0.png In the last figure, the curve marked ``GPAW (nonself.)`` is a non-selfconsistent PBE0 calculation using self-consistent PBE orbitals. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/functionals.rst000066400000000000000000000124241316441372200272360ustar00rootroot00000000000000.. _xc_functionals: ==================================== Exchange and correlation functionals ==================================== .. index:: libxc Libxc ===== We used the functionals from libxc_. ... Calculation of GGA potential ============================ In libxc_ we have (see also "Standard subroutine calls" on ccg_dft_design_) `\sigma_0=\sigma_{\uparrow\uparrow}`, `\sigma_1=\sigma_{\uparrow\downarrow}` and `\sigma_2=\sigma_{\downarrow\downarrow}` with .. math:: \sigma_{ij} = \mathbf{\nabla}n_i \cdot \mathbf{\nabla}n_j .. _libxc: http://www.tddft.org/programs/octopus/wiki/index.php/Libxc .. _ccg_dft_design: http://www.cse.scitech.ac.uk/ccg/dft/design.html Uniform 3D grid =============== We use a finite-difference stencil to calculate the gradients: .. math:: \mathbf{\nabla}n_g = \sum_{g'} \mathbf{D}_{gg'} n_{g'}. The `x`-component of `\mathbf{D}_{gg'}` will be non-zero only when `g` and `g'` grid points are neighbors in the `x`-direction, where the values will be `1/(2h)` when `g'` is to the right of `g` and `-1/(2h)` when `g'` is to the left of `g`. Similar story for the `y` and `z` components. Let's look at the spin-`k` XC potential from the energy expression `\sum_g\epsilon(\sigma_{ijg})`: .. math:: v_{kg} = \sum_{g'} \frac{\partial \epsilon(\sigma_{ijg'})}{\partial n_{kg}} = \sum_{g'} \frac{\partial \epsilon(\sigma_{ijg'})}{\partial \sigma_{ijg'}} \frac{\partial \sigma_{ijg'}}{\partial n_{kg}} Using `v_{ijg}=\partial \epsilon(\sigma_{ijg})/\partial \sigma_{ijg}`, `\mathbf{D}_{gg'}=-\mathbf{D}_{g'g}` and .. math:: \frac{\partial \sigma_{ijg'}}{\partial n_{kg}} = (\delta_{jk} \mathbf{D}_{g'g} \cdot \mathbf{\nabla}n_{ig'} + \delta_{ik} \mathbf{D}_{g'g} \cdot \mathbf{\nabla}n_{jg'}), we get: .. math:: v_{kg} = -\sum_{g'} \mathbf{D}_{gg'} \cdot (v_{ijg'} [\delta_{jk} \mathbf{\nabla}n_{ig'} + \delta_{ik} \mathbf{\nabla}n_{jg'}]). The potentials from the general energy expression `\sum_g\epsilon(\sigma_{0g}, \sigma_{1g}, \sigma_{2g})` will be: .. math:: v_{\uparrow g} = -\sum_{g'} \mathbf{D}_{gg'} \cdot (2v_{\uparrow\uparrow g'} \mathbf{\nabla}n_{\uparrow g'} + v_{\uparrow\downarrow g'} \mathbf{\nabla}n_{\downarrow g'}) and .. math:: v_{\downarrow g} = -\sum_{g'} \mathbf{D}_{gg'} \cdot (2v_{\downarrow\downarrow g'} \mathbf{\nabla}n_{\downarrow g'} + v_{\uparrow\downarrow g'} \mathbf{\nabla}n_{\uparrow g'}). PAW correction ============== Spin-paired case: .. math:: \Delta E = \sum_g 4 \pi w r_g^2 \Delta r_g [\epsilon(n_g, \sigma_g) - \epsilon(\tilde n_g, \tilde\sigma_g)], where `w` is the weight ... .. math:: n_g = \sum_{i_ii_2} D_{i_1i_2} \phi_{j_1g} Y_{L_1} \phi_{j_2g} Y_{L_2} + n_c(r_g) = \sum_L n_{Lg} Y_L, where .. math:: n_{Lg} = \sum_q D_{Lq} n_{qg} + \delta_{L,0} \sqrt{4 \pi} n_c(r_g) and .. math:: D_{Lq} = \sum_p D_p G_{L_1L_2}^L \delta_{q_p,q} = \sum_p D_p B_{Lpq}. .. math:: \mathbf{\nabla} n_g = \sum_L Y_L \sum_{g'} D_{gg'} n_{Lg'} \hat{\mathbf{r}} + \sum_L \frac{n_{Lg}}{r_g} r \mathbf{\nabla} Y_L = a_g \hat{\mathbf{r}} + \mathbf{b}_g / r_g. Notice that `r \mathbf{\nabla} Y_L` is independent of `r` - just as `Y_L` is. From the two contributions, which are orthogonal (`\hat{\mathbf{r}} \cdot \mathbf{b}_g = 0`), we get .. math:: \sigma_g = a_g^2 + \mathbf b_g \cdot \mathbf b_g / r_g^2. .. math:: \frac{\partial \Delta E}{\partial n_{Lg}} = 4 \pi w \sum_{g'} r_{g'}^2 \Delta r_{g'} \frac{\partial \epsilon}{\partial \sigma_{g'}} \frac{\partial \sigma_{g'}}{\partial n_{Lg}}. Inserting .. math:: \frac{\partial \sigma_{g'}}{\partial n_{Lg}} = 2 a_{g'} Y_L D_{g'g} + 2 \mathbf b_g \cdot (r \mathbf{\nabla} Y_L) \delta_{gg'} / r_g^2, we get .. math:: \frac{\partial \Delta E}{\partial n_{Lg}} = 8 \pi w \sum_{g'} r_{g'}^2 \Delta r_{g'} \frac{\partial \epsilon}{\partial \sigma_{g'}} a_{g'} Y_L D_{g'g} + 8 \pi w \Delta r_g \frac{\partial \epsilon}{\partial \sigma_g} \mathbf b_g \cdot (r \mathbf{\nabla} Y_L). Non-collinear case ------------------ .. math:: \mathbf{m}_g = \sum_L \mathbf{M}_{Lg} Y_L. .. math:: n_{\alpha g} = (n_g + \alpha m_g) / 2. .. math:: 2 \mathbf{\nabla} n_{\alpha g} = \mathbf{\nabla} n_g + \alpha \sum_L ( Y_L \sum_{g'} D_{gg'} \frac{\mathbf{m}_g \cdot \mathbf{M}_{Lg'}}{m_g} \hat{\mathbf{r}} + \frac{\mathbf{m}_g \cdot \mathbf{M}_{Lg}}{m_g r_g} r \mathbf{\nabla} Y_L) .. math:: = (a_g + \alpha c_g) \hat{\mathbf{r}} + (\mathbf{b}_g + \alpha \mathbf{d}_g) / r_g. .. math:: 4 \sigma_{\alpha \beta g} = (a_g + \alpha c_g) (a_g + \beta c_g) + (\mathbf{b}_g + \alpha \mathbf{d}_g) \cdot (\mathbf{b}_g + \beta \mathbf{d}_g) / r_g^2. .. math:: \frac{\partial c_g}{\partial \mathbf{M}_{Lg'}} = \frac{Y_L}{m_g} ( D_{gg'} \mathbf{m}_g + \delta_{gg'} \mathbf{m}_g' - \delta_{gg'} \frac{\mathbf{m}_g \cdot \mathbf{m}_g'}{m_g^2} \mathbf{m}_g). .. math:: \frac{\partial (\mathbf{d}_g)_\gamma}{\partial \mathbf{M}_{Lg'}} = \frac{Y_L \delta_{gg'}}{m_g} ( \mathbf{m}_g r \nabla_\gamma Y_L + \sum_{L'} \mathbf{M}_{L'g} r \nabla_\gamma Y_{L'} - \frac{\mathbf{m}_g}{m_g^2} \sum_{L'} \mathbf{m}_g \cdot \mathbf{M}_{L'g} r \nabla_\gamma Y_{L'}). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/libvdwxc-example.py000066400000000000000000000003421316441372200300000ustar00rootroot00000000000000from ase.build import molecule from gpaw import GPAW from gpaw.xc.libvdwxc import vdw_df_cx atoms = molecule('H2O') atoms.center(vacuum=3.0) calc = GPAW(xc=vdw_df_cx()) atoms.set_calculator(calc) atoms.get_potential_energy() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/libvdwxc-pfft-example.py000066400000000000000000000005611316441372200307400ustar00rootroot00000000000000from ase.build import bulk from gpaw import GPAW, PW from gpaw.xc.libvdwxc import vdw_df_cx # "Large" system: atoms = bulk('Cu').repeat((2, 2, 2)) calc = GPAW(mode=PW(600), kpts=(4, 4, 4), xc=vdw_df_cx(mode='pfft', pfft_grid=(2, 2)), parallel=dict(kpt=4, augment_grids=True)) atoms.set_calculator(calc) atoms.get_potential_energy() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/libvdwxc.rst000066400000000000000000000025051316441372200265320ustar00rootroot00000000000000.. _libvdwxc-doc: libvdwxc ======== `libvdwxc `_ is a library which provides fast and scalable implementations of non-local van der Waals density functionals in the vdW-DF family. To use libvdwxc, you need to install it and compile GPAW with it. libvdwxc can be used with other semilocal functionals like optPBE, optB88, and BEEF-vdW. `Install `_ libvdwxc, making sure that its dependencies FFTW3 and FFTW3-MPI are available on the system. For truly large systems, you may install PFFT to achieve better scalability, but FFTW3-MPI may well be more efficient except for very large systems. Currently there is no stable libvdwxc release yet. Clone the project from git and install manually. Run a calculation as follows: .. literalinclude:: libvdwxc-example.py libvdwxc will automatically parallelize with as many cores as are available for domain decomposition. If you parallelize over *k*-points or bands, and *especially* if you use planewave mode, be sure to pass the parallelization keyword ``augment_grids=True`` to make use of *all* cores including those for *k*-point and band parallelization. Here is a more complex example: .. literalinclude:: libvdwxc-pfft-example.py Normally you should probably not bother to set pfft_grid as it is chosen automatically. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/rpa.rst000066400000000000000000000166261316441372200255030ustar00rootroot00000000000000.. _rpa: ======================= RPA correlation energy ======================= The correlation energy within the Random Phase Approximation (RPA) can be written .. math:: E_c^{RPA} = \int_0^{\infty}\frac{d\omega}{2\pi}\text{Tr}\Big[\text{ln}\{1-\chi^0(i\omega)v\}+\chi^0(i\omega)v\Big], where `\chi^0(i\omega)` is the non-interacting (Kohn-Sham) response function evaluated at complex frequencies, `\text{Tr}` is the Trace and `\it{v}` is the Coulomb interaction. The response function and Coulomb interaction are evaluated in a plane wave basis as described in :ref:`df_tutorial` and :ref:`df_theory` and for periodic systems the Trace therefore involves a summation over `\mathbf{q}`-points, which are determined from the Brillouin zone sampling used when calculating `\chi^0(i\omega)`. The RPA correlation energy is obtained by:: from gpaw.xc.rpa import RPACorrelation rpa = RPACorrelation(calc, txt='rpa_correlation.txt') E_rpa = rpa.calculate(ecut=400) where calc is either a calculator object containing converged wavefunctions from a ground state calculation or a string reference to a .gpw file containing wavefunctions. If calc is a calculator object it should be loaded in serial since the RPA parallellization scheme is rather different from that of standard DFT calculatons. txt denotes the output file. The RPACorrelation also takes a number of optional keywords described below. The calculate() function performs the actual calculation at the cutoff energy specified by ecut (in eV). In addition the rpa calculator will calculate the correlation energy at four values for the cutoff energies up to the specified cutoff, but one can also give a list of cutoff values instead. By default, the response function is calculated with the same number of bands as the number of plane waves, but one can also specify that it should use N bands with nbands=N in the calculate() function. Parameters ========== =================== ================== =================== ================================================================== keyword type default value description =================== ================== =================== ================================================================== ``nfrequencies`` ``int`` 16 Number of Gauss-legendre points used in the integration. ``frequency_cut`` ``float`` 800. (eV) The maximum frequency is the largest frequency included in the Gauss-Legendre integration. The integral is always an approximation to the infinite integral, but the max frequency determines the distribution of frequencies. ``frequency_scale`` ``float`` 2.0 (eV) The frequency scale sets the density of frequency points near `\omega = 0`. ``frequencies`` ``numpy.ndarray`` None Specifies frequency points used to integrate the correlation integrand. Ex: numpy.linspace(0,20,201). If None, the Gauss-legendre method is used. ``weights`` ``numpy.ndarray`` None Should be used in conjunction with frequencies (e.i. when not using the Gauss-Legendre integration). For example np.array([0.5,1,1,...,1,1,0.5] gives a trapezoid integration ``skip_gamma`` ``bool`` False For metals the `\mathbf{q} = 0` point can give rise to divergent contributions and it may be faster to converge the k-point sampling if this point is excluded. ``nblocks`` ``int`` 1 **G**-vector parallelization. Default parallelization scheme is over kpoints, spin and bands. If memory becomes an issue it can be an advantage to use **G**-vector parallelization also. ``filename`` ``str`` None Restart file. If calculations with k-point sampling, the contributions from different q-points are calculated sequentially and written to filename such that these do not have to be recalculated when a calculation is restarted. =================== ================== =================== ================================================================== In addition to the usual kpoint and plane wave cutoff, the RPA correlation energy needs to be converged with respect to a plane wave cutoff in the response function (set by ecut) and the frequency integration. As it turns out, the integrand is usually rather smooth and one can perform the integration with 8-16 (special!) Gauss-Legendre frequency points, but see the tutorial :ref:`rpa_tut` for an example of converging the frequency integration. Convergence =========== A major complication with the RPA correlation energy is that it converges very slowly with the number of unoccupied bands included in the evaluation of `\chi^0(i\omega)`. However, as described in Ref. \ [#Harl1]_ the high energy part of the response function resembles the Lindhard function, which for high energies gives a correlation energy converging as .. math:: E_c^{Lindhard}(E^{\chi}_{cut}) = E_c^{\infty}+\frac{A}{(E^{\chi}_{cut})^{3/2}}, where `E^{\chi}_{cut}` is cutoff energy used in the evaluation of `\chi^0`. With an external potential, the number of unoccupied bands is an additional convergence parameter, but for reproducing the scaling of the Lindhard function, it is natural to set the total number of bands equal to the number of plane waves used. Thus, to obtain a converged RPA correlation energy one should proceed in three steps. * Perform a ground state calculation with a lot of converged unoccupied bands. * Define a list of cutoff energies - typically something like [200, 225, 250, 275, 300] (eV). For each cutoff energy perform an RPA correlation energy calculation with the number bands `n` set equal to the number of plane waves defined by that cutoff energy. * Fit the list of obtained correlation energies to `E_c^{RPA}(E) = E_c^{\infty}+A/E^{3/2}` to obtain `E_c^{\infty}=E_c^{RPA}`. Per default, the rpa module defines a list of five cutoff energies up to the specified value and performs the extrapolation at the end of the calculation. If one is not interested in the total correlation energy, but only energy differences between similar systems, it is sometimes possible to avoid the extrapolation procedure and the rpa correlation energy can be obtained at a single point by specifying a list with one element (for example ecut=[400]). .. [#Harl1] J. Harl and G. Kresse, *Phys. Rev. B* **77**, 045136 (2008) .. [#Harl2] J. Harl and L. Schimka and G. Kresse, *Phys. Rev. B* **81**, 115126 (2010) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/s22_test.py000066400000000000000000000032541316441372200261770ustar00rootroot00000000000000from __future__ import print_function from ase import Atoms from ase.parallel import paropen from ase.data.s22 import data from ase.calculators.vdwcorrection import vdWTkatchenko09prl from gpaw import GPAW, FermiDirac from gpaw.cluster import Cluster from gpaw.analyse.hirshfeld import HirshfeldPartitioning from gpaw.analyse.vdwradii import vdWradii h = 0.18 box = 4. xc = 'TS09' f = paropen('energies_' + xc + '.dat', 'w') print('# h=', h, file=f) print('# box=', box, file=f) print('# molecule E[1] E[2] E[1+2] E[1]+E[2]-E[1+2]', file=f) for molecule in data: print(molecule, end=' ', file=f) ss = Cluster(Atoms(data[molecule]['symbols'], data[molecule]['positions'])) # split the structures s1 = ss.find_connected(0) s2 = ss.find_connected(-1) assert(len(ss) == len(s1) + len(s2)) if xc == 'TS09' or xc == 'TPSS' or xc == 'M06-L': c = GPAW(xc='PBE', h=h, nbands=-6, occupations=FermiDirac(width=0.1)) else: c = GPAW(xc=xc, h=h, nbands=-6, occupations=FermiDirac(width=0.1)) E = [] for s in [s1, s2, ss]: s.set_calculator(c) s.minimal_box(box, h=h) if xc == 'TS09': s.get_potential_energy() cc = vdWTkatchenko09prl(HirshfeldPartitioning(c), vdWradii(s.get_chemical_symbols(), 'PBE')) s.set_calculator(cc) if xc == 'TPSS' or xc == 'M06-L': ene = s.get_potential_energy() ene += c.get_xc_difference(xc) E.append(ene) else: E.append(s.get_potential_energy()) print(E[0], E[1], E[2], end=' ', file=f) print(E[0] + E[1] - E[2], file=f) f.flush() f.close() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/submit.agts.py000066400000000000000000000005751316441372200267750ustar00rootroot00000000000000from gpaw.utilities import compiled_with_libvdwxc from gpaw.xc.libvdwxc import libvdwxc_has_pfft def agts(queue): # Is walltime minutes or seconds? If it crashes, we will know. if compiled_with_libvdwxc(): queue.add('libvdwxc-example.py', ncpus=1, walltime=1) if libvdwxc_has_pfft(): queue.add('libvdwxc-pfft-example.py', ncpus=8, walltime=1) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/tpss.rst000066400000000000000000000023761316441372200257070ustar00rootroot00000000000000========== TPSS notes ========== Kinetic energy density ====================== Inside the augmentation sphere of atom `a` (`r` library. Note that these use different kernels and hence will yield slightly different results. Several vdW-DF [#vdW-DF1a]_ type XC functionals are implemented selfconsistently in GPAW, and also the BEEF-vdW [#BEEF-vdW]_ density functional. The vdW-DF variants include vdW-DF [#vdW-DF1a]_, [#vdW-DF1b]_, [#vdW-DF-cx]_, vdW-DF2 [#vdW-DF2]_, optPBE-vdW [#opt-vdW]_, optB88-vdW [#opt-vdW]_, and C09-vdW [#C09-vdW]_. Of these, vdW-DF-cx is available only through libvdwxc. The spin-polarized generalization of the vdW-DF functionals, [#svdW-DF]_, is also only available with libvdwxc. The selfconsistent implementation uses the Perez-Soler [#soler]_ FFT algorithm to evaluate the total energy and potential of the Rutgers-Chalmers nonlocal correlation, which is originally a six dimensional integral in real space. However, a non-selfconsistent method which directly sums up the real-space integral is also available. Doing a vdW-DF calculation ================================== The selfconsistent FFT method is highly recommended over the real-space method. Often, the vdW-DF electron density will be very similar to an ordinary GGA density, so non-selfconsistent evaluations of a vdW-DF type total energy using the FFT method is often ok. However, vdW-DF forces obviously require a selfconsistent potential. As the examples below illustrate, FFT-based vdW-DF calculations are most easily done by setting e.g. "xc='vdW-DF'" in the GPAW calculator object. However, parameters of the FFT algorithm can be assigned non-default values by importing the vdW-DF base class. For larger systems, the van der Waals functionals may be computationally expensive. Consider using :ref:`libvdwxc ` which typically increases the efficiency of the van der Waals evaluation by an order of magnitude, and parallelizes to any desired system size. Selfconsistent vdW-DF calculations ------------------------------------- >>> from ase import * >>> from gpaw import GPAW >>> vdw = 'vdW-DF' >>> atoms = ... >>> calc = GPAW(xc=vdw, ...) >>> atoms.set_calculator(calc) >>> e = atoms.get_potential_energy() Perturbative vdW-DF calculations (non-selfconsistent) -------------------------------------------------------- >>> from gpaw import GPAW >>> xc = 'vdW-DF' >>> calc = GPAW('input.gpw') >>> GGA_energy = calc.get_potential_energy() >>> vdWDF_diff = calc.get_xc_difference(xc) >>> vdWDF_energy = GGA_energy + vdWDF_diff In the above examples, other vdW-DF type functionals can be used by substituting 'vdW-DF2', 'optPBE-vdW', 'optB88-vdW', or 'C09-vdW' for 'vdW-DF'. Non-default FFT parameters for vdW-DF calculations ----------------------------------------------------- A number of parameters determine the spline interpolation of the vdW-DF nonlocal kernel. These may be assigned non-default values if the vdW-DF base class is explicitly initialized with new settings. The example below redefines the number of interpolating cubic splines (Nalpha) used in a vdW-DF2 calculation. >>> from ase import * >>> from gpaw import GPAW >>> from gpaw.xc.vdw import VDWFunctional >>> vdw = VDWFunctional('vdW-DF2', Nalpha=24) >>> atoms = ... >>> calc = GPAW(xc=vdw, ...) >>> atoms.set_calculator(calc) >>> e = atoms.get_potential_energy() Real-space method vdW-DF ------------------------------------ It is also possible to use the much slower real-space method for non-selfconsistent evaluations of the nonlocal correlation energy, which might make sense for (very) small systems. To use the real-space method one must import a class and set a few parameters: >>> from gpaw.xc.vdw import VDWFunctional >>> vdw = VDWFunctional('vdW-DF', fft=False, nspins=1, ncut=0.0005) where nspins=1 is for spin-paired systems and nspins=2 is used for spin-polarized calculations. A cutoff, ncut, defines how small a density must be in order not to be included in the 6D integral. BEEF-vdW functional =================== The BEEF-vdW density functional uses the vdW-DF2 nonlocal correlation energy and potential. It is implemented selfconistently in GPAW. Furthermore, the BEEF-vdW constructions allows the user to calculate an estimate of the error to be expected on the quantity calculated selfconsistently with BEEF-vdW (i.e. an error estimate on relative energies, not on total energies). This estimate stems from non-selfconsistently applying an ensemble of XC functionals to BEEF-vdW electron densities. The ensemble error estimate is then computed from the variance of the ensemble predictions of the quantity of interest. Below is an example which calculates the BEEF-vdW binding energy of molecular H2 (E_bind), as well as an ensemble estimate of the binding energy error (dE_bind) >>> from ase import * >>> from gpaw import GPAW >>> from ase.dft.bee import BEEFEnsemble >>> xc = 'BEEF-vdW' >>> h2 = Atoms('H2',[[0.,0.,0.],[0.,0.,0.75]]) >>> h2.center(vacuum=3) >>> cell = h2.get_cell() >>> calc = GPAW(xc=xc) >>> h2.set_calculator(calc) >>> e_h2 = h2.get_potential_energy() >>> ens = BEEFEnsemble(calc) >>> de_h2 = ens.get_ensemble_energies() >>> del h2, calc, ens >>> h = Atoms('H') >>> h.set_cell(cell) >>> h.center() >>> calc = GPAW(xc=xc) >>> h.set_calculator(calc) >>> e_h = h.get_potential_energy() >>> ens = BEEFEnsemble(calc) >>> de_h = ens.get_ensemble_energies() >>> E_bind = 2*e_h - e_h2 >>> dE_bind = 2*de_h[:] - de_h2[:] >>> dE_bind = dE_bind.std() Note that the BEEFEnsemble module has recently been moved from GPAW to the ASE package. The default number of ensemble XC functionals is 2000, for which well-converged error estimates should be ensured. Therefore, "de_h2" and "de_h" in the example are both arrays of 2000 perturbations of a BEEF-vdW total energy. The syntax "ens.get_ensemble_energies(N)" changes this number to N. The calculator object input to the BEEFEnsemble class could of course stem from a restarted GPAW calculation. It is very important to calculate the ensemble statistics correctly. Computing the standard deviation of each array of total energy perturbations makes little sense, only the standard deviation of the relative energy perturbations should be used for the BEEF-vdW ensemble error estimates on a quantity. .. [#vdW-DF1a] M. Dion, H. Rydberg, E. Schroder, D.C. Langreth, and B. I. Lundqvist, Van der Waals density functional for general geometries, Physical Review Letters, 92, 246401 (2004) .. [#BEEF-vdW] J. Wellendorff, K. T. Lundgaard, A. Mogelhoj, V. Petzold, D. D. Landis, J. K. Norskov, T. Bligard, and K. W. Jacobsen, Physical Review B, 85, 235149 (2012) .. [#vdW-DF1b] M. Dion, H. Rydberg, E. Schroder, D.C. Langreth, and B. I. Lundqvist, Erratum: Van der Waals density functional for general geometries, Physical Review Letters, 95, 109902 (2005) .. [#vdW-DF2] K. Lee, D. E. Murray, L. Kong, B. I. Lundqvist, and D. C. Langreth, Higher-accuracy van der Waals density functional, Physical Review B, 82, 081101 (2010) .. [#vdW-DF-cx] K. Berland and P. Hyldgaard, Exchange functional that tests the robustness of the plasmon description of the van der Waals density functional, Physical Review B 89, 035412 (2014) .. [#opt-vdW] J. Klimes, D. R. Bowler, and A. Michaelides, Chemical accuracy for the van der Waals density functional, Journal of Physics: Condensed Matter, 22, 022201 (2010) .. [#C09-vdW] V. R. Cooper, Van der Waals density functional: An appropriate exchange functional, Physical Review B, 81, 161104(R) (2010) .. [#soler] Guillermo Román-Pérez and José M. Soler, Efficient Implementation of a van der Waals Density Functional: Application to Double-Wall Carbon Nanotubes, Physical Review Letters 103, 096102 (2009) .. [#svdW-DF] T. Thonhauser, S. Zuluaga, C. A. Arter, K. Berland, E. Schröder, and P. Hyldgaard, Spin Signature of Nonlocal Correlation Binding in Metal-Organic Frameworks, Physical Review Letters 115, 136402 (2015) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/vdwcorrection.rst000066400000000000000000000022101316441372200275710ustar00rootroot00000000000000.. _vdwcorrection: ======================== van der Waals correction ======================== A correction on top of the PBE functional has been proposed by Tkachenko and Scheffler [#TS09]_. While nearly all parameters are obtained from ab-initio calculations, the method requires nearly no additional computational cost and performs very well: ============== === ===== ====== ======= ==== . PBE TPSS vdW-DF vdW-DF2 TS09 ============== === ===== ====== ======= ==== Mean deviation 115 154 76 48 15 RMS deviation 108 128 60 42 15 ============== === ===== ====== ======= ==== Error in energies compared to CCSD results of the S26 test set. All values in meV. GPAW calculations were done with h=0.18 and at least 4 A vacuum. The TS09 results are in good agreement to the results obtained with the FHI-aims code [#Hanke11jcc]_. Calculating the S26 test set ============================ As an example of the usage, here the S26 test set is calculated: .. literalinclude:: s22_test.py .. [#TS09] Tkachenko and Scheffler Phys. Rev. Lett. 102 (2009) 073005 .. [#Hanke11jcc] Felix Hanke J. Comp. Chem. 32 (2011) 1424 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/documentation/xc/xc.rst000066400000000000000000000002361316441372200253210ustar00rootroot00000000000000.. _xc: ============== XC Functionals ============== .. toctree:: :maxdepth: 2 functionals exx rpa tpss vdw libvdwxc vdwcorrection gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/000077500000000000000000000000001316441372200226635ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/aluminium/000077500000000000000000000000001316441372200246635ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/aluminium/Al_bcc.py000066400000000000000000000023751316441372200264070ustar00rootroot00000000000000from __future__ import division, print_function from numpy.polynomial import Polynomial import ase.units as u from ase.build import bulk from gpaw import GPAW, PW afcc = 3.985 # Theoretical fcc lattice parameter a = afcc * 2**(-1 / 3) # Assuming the same volume per atom a = afcc * (2 / 3)**0.5 # Assuming the same nearest neighbor distance bcc = bulk('Al', 'bcc', a=a) bcc.calc = GPAW() # Convergence with respect to k-points: bcc.calc.set(mode=PW(300), txt='Al-bcc-k.txt') for k in [4, 6, 8, 10]: bcc.calc.set(kpts=(k, k, k)) print(k, bcc.get_potential_energy()) # Convergence with respect to grid spacing: bcc.calc.set(kpts=(8, 8, 8), txt='Al-bcc-ecut.txt') for ecut in [200, 300, 400, 500]: bcc.calc.set(mode=PW(ecut)) print(ecut, bcc.get_potential_energy()) # Set parameters to reasonably converged values E = [] A = [3.0, 3.1, 3.2, 3.3] for a in A: bcc = bulk('Al', 'bcc', a=a) bcc.calc = GPAW(mode=PW(300), kpts=(8, 8, 8), txt='bulk-bcc-a%.1f.txt' % a) E.append(bcc.get_potential_energy()) p = Polynomial.fit(A, E, 3) a0 = p.deriv(1).roots()[0] B = p.deriv(2)(a0) * 2 / 9 / a0 / u.J * u.m**3 * 1e-9 # GPa print(a0, B) assert abs(a0 - 3.1969) < 0.001 assert abs(B - 77.5) < 0.1 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/aluminium/Al_fcc.py000066400000000000000000000011371316441372200264060ustar00rootroot00000000000000"""Bulk Al(fcc) test""" from __future__ import print_function from ase import Atoms from ase.visualize import view from gpaw import GPAW, PW name = 'Al-fcc' a = 4.05 # fcc lattice parameter b = a / 2 bulk = Atoms('Al', cell=[[0, b, b], [b, 0, b], [b, b, 0]], pbc=True) view(bulk) k = 4 calc = GPAW(mode=PW(300), # cutoff kpts=(k, k, k), # k-points txt=name + '.txt') # output file bulk.set_calculator(calc) energy = bulk.get_potential_energy() calc.write(name + '.gpw') print('Energy:', energy, 'eV') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/aluminium/Al_fcc_modified.py000066400000000000000000000015361316441372200302510ustar00rootroot00000000000000from __future__ import print_function from numpy.polynomial import Polynomial import ase.units as u from ase import Atoms from gpaw import GPAW, PW A = [3.9, 4.0, 4.1, 4.2] E = [] for a in A: name = 'bulk-fcc-%.1f' % a b = a / 2 bulk = Atoms('Al', cell=[[0, b, b], [b, 0, b], [b, b, 0]], pbc=True) k = 4 calc = GPAW(mode=PW(300), # cutoff kpts=(k, k, k), # k-points txt=name + '.txt') # output file bulk.set_calculator(calc) energy = bulk.get_potential_energy() calc.write(name + '.gpw') E.append(energy) p = Polynomial.fit(A, E, 3) a0 = p.deriv(1).roots()[0] B = p.deriv(2)(a0) * 4 / 9 / a0 / u.J * u.m**3 * 1e-9 # GPa print((a0, B)) assert abs(a0 - 3.9924) < 0.001 assert abs(B - 87.22) < 0.1 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/aluminium/Al_fcc_vs_bcc.py000066400000000000000000000015251316441372200277260ustar00rootroot00000000000000"""Compare Al(fcc) and Al(bcc) at two different plane-wave cutoffs and two differens k-point densities.""" from __future__ import print_function from ase.build import bulk from gpaw import GPAW, PW afcc = 3.985 abcc = 3.190 for kdens in [2.0, 3.0]: for ecut in [300, 500]: fcc = bulk('Al', 'fcc', a=afcc) calc = GPAW(mode=PW(ecut), kpts={'density': kdens}, txt='bulk-fcc-%.1f-%.1f.txt' % (ecut, kdens)) fcc.set_calculator(calc) efcc = fcc.get_potential_energy() bcc = bulk('Al', 'bcc', a=abcc) calc = GPAW(mode=PW(ecut), kpts={'density': 4.0}, txt='bulk-bcc-%.1f-%.1f.txt' % (ecut, kdens)) bcc.set_calculator(calc) ebcc = bcc.get_potential_energy() print(kdens, ecut, efcc, ebcc, efcc - ebcc) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/aluminium/aluminium.rst000066400000000000000000000137671316441372200274330ustar00rootroot00000000000000.. _aluminium_exercise: ============= Bulk aluminum ============= We will look at bulk fcc aluminum and make a single energy calculation at the experimental lattice constant `a_0` = 4.05 Å. For the first example, we choose a plane-wave cutoff energy of 300 eV and 4 x 4 x 4 **k**-points. Copy this :download:`Al_fcc.py` to a place in your file area: .. literalinclude:: Al_fcc.py .. highlight:: bash Read the script and try to get an idea of what it will do. Run the script by typing:: $ python3 Al_fcc.py The program will pop up a window showing the bulk structure. Verify that the structure indeed is fcc. Try to identify the closepacked (111) planes. In :program:`ase gui` this is done by choosing :menuselection:`View --> Repeat`. Notice that the program has generated two output files:: Al-fcc.gpw Al-fcc.txt * A tar-file (conventional suffix :file:`.gpw`) containing binary data such as eigenvalues, electron density and wave functions (see :ref:`restart_files`). * An ASCII formatted log file (conventional suffix :file:`.txt`) that monitors the progress of the calculation. Try to take a look at the file :file:`Al-fcc.txt`. Find the number of plane-waves used. You can conveniently monitor some variables by using the :command:`grep` utility. By typing:: $ grep iter Al-fcc.txt you see the progress of the iteration cycles including convergence of wave functions, density and total energy. If the ``txt`` keyword is omitted the log output will be printed directly in the terminal. The binary file contains all information about the calculation. Try typing the following from the Python interpreter: >>> from gpaw import GPAW >>> calc = GPAW('Al-fcc.gpw', txt=None) >>> bulk = calc.get_atoms() >>> print(bulk.get_potential_energy()) -4.12234332252 >>> density = calc.get_pseudo_density() >>> density.shape (9, 9, 9) >>> density.max() 0.42718359271458561 >>> from mayavi import mlab >>> mlab.contour3d(density) >>> mlab.show() Equilibrium lattice properties ============================== We now proceed to calculate some equilibrium lattice properties of bulk Aluminum. * First map out the cohesive curve `E(a)` for Al(fcc), i.e. the total energy as function of lattice constant `a`, around the experimental equilibrium value of `a_0` = 4.05 Å. Get four or more energy points, so that you can make a fit. .. hint:: .. highlight:: python Modify :download:`Al_fcc.py` by adding a for-loop like this:: for a in [3.9, 4.0, 4.1, 4.2]: name = 'bulk-fcc-%.1f' % a and then indent the rest of the code by four spaces (Python uses indentation to group statements together - thus the for-loop will end at the first unindented line). Remove the ``view(bulk)`` line. * Fit the data you have obtained to get `a_0` and the energy curve minimum `E_0=E(a_0)`. From your fit, calculate the bulk modulus .. math:: B = V\frac{d^2 E}{dV^2} = \frac{M}{9a_0}\frac{d^2 E}{da^2}, .. highlight:: bash where *M* is the number of atoms per cubic unit cell: `V=a^3/M` (`M=4` for fcc). Make the fit using your favorite math package (NumPy_) or use :program:`ase gui` like this:: $ ase gui bulk-*.txt Then choose :menuselection:`Tools --> Bulk Modulus`. Another alternative is to use the :class:`Equation of state module ` (see this :ref:`tutorial `). * Compare your results to the experimental values `a_0` = 4.05 Å and `B` = 76 GPa. Mind the units when you calculate the bulk modulus (read about ASE-units :mod:`here `). What are the possible error sources? .. note:: The LDA reference values are: `a_0` = 3.98 Å and `B` = 84.0 GPa - see S. Kurth *et al.*, Int. J. Quant. Chem. **75** 889-909 (1999). .. _NumPy: http://docs.scipy.org/doc/numpy/reference/generated/ numpy.polynomial.polynomial.Polynomial.html #numpy-polynomial-polynomial-polynomial Convergence in number of **k**-points ------------------------------------- Now we will investigate the necessary **k**-point sampling for bulk fcc Aluminum; this is a standard first step in all DFT calculations. * Repeat the calculation above for the equilibrium lattice constant for more dense Brillouin zone samplings (try ``k=6,8,10,...``). .. hint:: You may want to speed up these calculations by running them in parallel. * Estimate the necessary number of **k**-points for achieving an accurate value for the lattice constant. * Do you expect that this **k**-point test is universal for all other Aluminum structures than fcc? What about other chemical elements ? Equilibrium lattice properties for bcc ====================================== * Set up a similar calculation for bcc, in the minimal unit cell. * Make a qualified starting guess on `a_\text{bcc}` from the lattice constant for fcc, that you have determined above. One can either assume that the primitive unit cell volumes of the fcc and bcc structure are the same or that the nearest neighbor distances are the same. Find a guess for `a_\text{bcc}` for both assumptions. Later, you can comment on which assumption gives the guess closer to the right lattice constant. * Check that your structure is right by repeating the unit cell. * Map out the cohesive curve `E(a)` for Al(bcc) and determine `a_\text{bcc}`, using a few points. Is it a good idea to use the same **k**-point setup parameters as for the fcc calculations? Calculate the bulk modulus, as it was done for fcc, and compare the result to the fcc bulk modulus. What would you expect? * Using the lattice constants determined above for fcc and bcc, calculate the fcc/bcc total energies. The total energies that GPAW calculates are relative to isolated atoms (more details here: :ref:`zero_energy`). This exercise is sensitive to the number of **k**-points, make sure that your **k**-point sampling is dense enough. Also make sure your energies are converged with respect to the plane-wave cutoff energy. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/band_structure/000077500000000000000000000000001316441372200257075ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/band_structure/ag.py000066400000000000000000000014371316441372200266550ustar00rootroot00000000000000import numpy as np from ase.build import bulk from gpaw import GPAW # Perform standard ground state calculation (with plane wave basis) ag = bulk('Ag') calc = GPAW(mode='pw', xc='GLLBSC', kpts=(10, 10, 10), txt='Ag_GLLBSC.txt') ag.set_calculator(calc) ag.get_potential_energy() calc.write('Ag_GLLBSC.gpw') ef = calc.get_fermi_level() # Restart from ground state and fix potential: calc = GPAW('Ag_GLLBSC.gpw', nbands=16, basis='dzp', fixdensity=True, symmetry='off', convergence={'bands': 12}) calc.set(kpts={'path': 'WLGXWK', 'npoints': 100}) calc.get_potential_energy() # Plot the band structure band_structure = calc.band_structure() band_structure.plot(filename='Ag.png', emax=20.0, show=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/band_structure/bands.rst000066400000000000000000000015711316441372200275340ustar00rootroot00000000000000.. _band exercise: ============== Band structure ============== Band diagrams are useful analysis tools. Read :ref:`bandstructures` tutorial and try to understand what it does. As a next step, calculate the bandstructure of FCC silver. Here we should be careful with the choice of exchange-correlation functional to get a good description of the d-band, which is generally poorly described within LDA. (Why do you think that is?). Modify the script :download:`bandstructure.py <../../tutorials/bandstructures/bandstructure.py>` so that it will work for Ag instead of Si. .. image:: Ag.png The bandstructure is plotted in the end of the script. Where is the d-band located? Experimentally it's found to be approximately 4 eV below the Fermi- level. Now modify the script so the bandstructure is calculated with the GLLBSC functional. Is the energy position of the d-band improved? gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dcdft/000077500000000000000000000000001316441372200237475ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dcdft/dcdft.rst000066400000000000000000000076431316441372200255770ustar00rootroot00000000000000.. _dcdft_exercise: ========================================================================== DeltaCodesDFT - Comparing Solid State DFT Codes, Basis Sets and Potentials ========================================================================== .. note:: This exercise is currently broken. Please skip it. The webpage https://molmod.ugent.be/deltacodesdft provides a method for measuring the precision of a given calculation method against a chosen reference method (computational or experimental) for parameters of the equation of state (see :ref:`aluminium_exercise`) of elementary solids. When performing any benchmark calculations, especially involving a large number of systems, it is important to be aware of the fact that we, humans tend to do mistakes. Therefore the motto of this exercise is taken from Karl Popper's "All life is problem solving": `the novelty in the scientific approach is that we actively seek to eliminate our attempted solutions `_. In this exercise, in addition to the traditional, error prone method of writing output files generated using separate scripts on disk, we write the results into a database. All calculations are performed using one script, and therefore not only sharing the results with other researches is easy (by granting the access to the database) but also the precise method of performing the calculations should be shared (by presenting the script). Please consult the introduction to the :mod:`ase.db` module for details. You can find out more about "reproducible science" with ASE in the following talks: `Emacs + org-mode + python in reproducible research `_ or `How Python & the iPython notebook can revamp quantum chemical reseach `_. We will compare PBE numbers from GPAW with http://www.wien2k.at/ for K, Ca and Ti. We use default PAW-datasets, a plane-wave cutoff of 340 eV, a **k**-point density of 3.5 Å and a Fermi-Dirac distribution with a 0.1 eV temperature. Copy this :download:`dcdft_gpaw.py` to a place in your file area: .. literalinclude:: dcdft_gpaw.py .. highlight:: bash Read the script and try to understand it. Run the script by typing:: $ python3 dcdft_gpaw.py It should take about 15 minutes to run the script. Note that you can start several instances of the script simultaneously in order to speed things up. The script will generate ``.txt`` files and an SQLite3 database file. Watch the progess as the calculations run:: $ ase db dcdft.db -c +x,time Examine the equation of state (see :ref:`aluminium_exercise`) using :command:`ase gui`:: $ ase gui dcdft.db@name=Ca .. note:: The PBE reference values from https://molmod.ugent.be/deltacodesdft are: ======= ================== ========= element `V` [Å\ `^3`/atom] `B` [GPa] ======= ================== ========= K 73.68 3.6 Ca 42.20 17.1 Ti 17.39 112.2 ======= ================== ========= Extract the results from the database in order to calculate the parameters of the equation of state:: K 73.6852 3.6070 19.7231 Ca 42.5903 24.2170 -13.2987 Ti 17.3542 113.9593 3.5966 and use the script available from https://molmod.ugent.be/deltacodesdft to calculate the Delta factors. * How well do the obtained values agree with the references? Do you think they can be further improved (hint: check out https://wiki.fysik.dtu.dk/gpaw/setups/dcdft.html)? Do you agree with Karl Popper? gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dcdft/dcdft_gpaw.py000066400000000000000000000022671316441372200264320ustar00rootroot00000000000000from time import time import numpy as np import ase.db from ase.test.tasks.dcdft import DeltaCodesDFTCollection as Collection from gpaw import GPAW, PW, FermiDirac c = ase.db.connect('dcdft.db') ecut = 340 kptdensity = 3.5 width = 0.10 collection = Collection() for name in ['K', 'Ca', 'Ti']: atoms = collection[name] cell = atoms.get_cell() # Loop over volumes: for n, x in enumerate(np.linspace(0.98, 1.02, 5)): id = c.reserve(name=name, x=x) if id is None: # This calculation has been or is being done: continue atoms.set_cell(cell * x, scale_atoms=True) atoms.calc = GPAW(txt='%s-%d.txt' % (name, n), mode=PW(ecut), xc='PBE', kpts={'density': kptdensity}, parallel={'band': 1}, idiotproof=False, occupations=FermiDirac(width)) t1 = time() atoms.get_potential_energy() t2 = time() # Write to database: c.write(atoms, name=name, x=x, time=t2 - t1, ecut=ecut, kptdensity=kptdensity, width=width) del c[id] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dcdft/extract.py000066400000000000000000000031771316441372200260030ustar00rootroot00000000000000from __future__ import print_function import sys import numpy as np from numpy.linalg.linalg import LinAlgError from ase.units import kJ import ase.db from ase.test.tasks.dcdft import DeltaCodesDFTCollection as Collection from ase.test.tasks.dcdft import FullEquationOfState as EquationOfState collection = Collection() db = sys.argv[1] c = ase.db.connect(db) def analyse(c, collection): A = [] for name in collection.names: ve = [] # volume, energy pairs for d in c.select(name=name): try: ve.append((abs(np.linalg.det(d.cell)), d.energy)) except AttributeError: ve.append((np.nan, np.nan)) # sort according to volume ves = sorted(ve, key=lambda x: x[0]) # EOS eos = EquationOfState([t[0] for t in ves], [t[1] for t in ves]) try: v, e, B0, B1, R = eos.fit() except (ValueError, TypeError, LinAlgError): (v, e, B0, B1, R) = (np.nan, np.nan, np.nan, np.nan, np.nan) e = e / len(collection[name]) v = v / len(collection[name]) B0 = B0 / kJ * 1.0e24 # GPa A.append((e, v, B0, B1, R)) return np.array(A).T E, V, B0, B1, R = analyse(c, collection) fd = open(db + '_raw.txt', 'w') for name, e, v, b0, b1, r, in zip(collection.names, E, V, B0, B1, R): if not np.isnan(e): print('%2s %8.4f %8.4f %8.4f' % (name, v, b0, b1), file=fd) fd = open(db + '_raw.csv', 'w') for name, e, v, b0, b1, r, in zip(collection.names, E, V, B0, B1, R): if not np.isnan(e): print('%s, %8.4f, %8.4f, %8.4f' % (name, v, b0, b1), file=fd) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dcdft/submit.agts.py000066400000000000000000000003011316441372200265530ustar00rootroot00000000000000def agts(queue): return a = queue.add('dcdft_gpaw.py', ncpus=4, walltime=40) queue.add('testdb.py', deps=a) queue.add('extract.py dcdft.db', deps=a, creates='dcdft.db_raw.txt') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dcdft/testdb.py000066400000000000000000000001171316441372200256050ustar00rootroot00000000000000import os os.system('ase db dcdft.db name=Ca -c +ecut,kpts,width,x,time,iter') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/diffusion/000077500000000000000000000000001316441372200246515ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/diffusion/densitydiff.py000066400000000000000000000010351316441372200275320ustar00rootroot00000000000000import numpy as np from gpaw import restart slab, calc = restart('ontop.gpw', txt=None) AuAl_density = calc.get_pseudo_density() # Remove gold atom and do a clean slab calculation: del slab[-1] slab.get_potential_energy() Al_density = calc.get_pseudo_density() # Remove Al atoms and do a calculation for Au only: slab, calc = restart('ontop.gpw', txt=None) del slab[:-1] calc.set(kpts=None) slab.get_potential_energy() Au_density = calc.get_pseudo_density() diff = AuAl_density - Au_density - Al_density np.save('densitydiff.npy', diff) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/diffusion/diffusion.rst000066400000000000000000000117071316441372200273770ustar00rootroot00000000000000.. _diffusion_exercise: ========================================= Diffusion of gold atom on Al(100) surface ========================================= In this ASE-tutorial: * :ref:`ase:constraints diffusion tutorial` the energy barrier for diffusion of a gold atom on an Al(100) surface is calculated using a semi-empirical EMT potential. In this exercise, we will try to use DFT and GPAW. * Run the script from the ASE-tutorial above and use the graphical representation to get good initial guesses for the height of the gold atom in the initial and transition states (hollow and bridge sites). The PAW setups for both Al and Au are quite smooth, so we can try with a low plane-wave cutoff of 200 eV. For a quick'n'dirty calculation we can do with just a `2 \times 2` sampling of the surface Brillouin zone. Use these parameters for the DFT calculations:: calc = GPAW(mode=PW(200), kpts=(2, 2, 1), xc='PBE') In order to speed up the calculation, use only two frozen Al(100) layers. * Calculate the energy of the initial and final states. Start from this script: :download:`initial.py`. Do we need to apply any constraint to the gold atom? * What is the PBE energy barrier? (Do not repeat the ASE-tutorial with GPAW, but simply relax the gold atom at the transition state and use the total energy differences) * Can both initial and transition state calculations be done with only one **k**-point in the irreducible part of the Brillouin zone? * Try to repeat the EMT calculations with two frozen Al(100) layers. Making Python Tool Boxes ======================== A science project (like the one you are going to make), will often contain some repeated and similar sub tasks like loops over different kind of atoms, structures, parameters etc. As an alternative to a plethora of similar Python scripts, made by *copy+paste*, it is advantageous to put the repeated code into tool boxes. Python supports such tool boxes (in Python called modules): put any Python code into a file :file:`stuff.py` then it may be used as a tool box in other scripts, using the Python command: ``from stuff import thing``, where ``thing`` can be almost anything. When Python sees this line, it runs the file :file:`stuff.py` (only the first time) and makes ``thing`` available. Lets try an example: * In file :file:`stuff.py`, put:: constant = 17 def function(x): return x - 5 * and in file :file:`program.py`, put:: from stuff import constant, function print 'result =', function(constant) * Now run the script :file:`program.py` and watch the output. You can think of ASE and GPAW as big collections of modules, that we use in our scripts. Writing an adsorption script ============================ As a non-trivial example of a Python module, try to write a function: .. function:: aual100(site, height) The *site* argument should be one of the strings that the :func:`ase.build.fcc100` function accepts: ``'ontop'``, ``'hollow'`` or ``'bridge'``. The *height* argument is the height above the Al layer. The function must relax a gold atom at *site*, return the energy and write ``.txt``, ``.traj``, and ``.gpw`` files. Start from :download:`initial.py` and make the relevant changes. * You could have used this functions to calculate the energy barrier above. Use it to calculate the energy in the ontop site:: e_ontop = aual100('ontop', 2.2) * What seems to determine the relative energetic ordering of the three sites? * Suppose now that an Au atom diffuses from one hollow to a neighboring hollow site at the surface. Assuming a prefactor of 10\ :sup:`13`/sec, how often does the diffusion take place at *T* = 100 K, 200 K, 300 K and 500 K. * For biological catalytic processes, a popular rule of thumb is that the rate doubles for every temperature increase of 10 K around room temperature. What activation energy does this correspond to? * Look at the relaxed configurations with the :command:`ase gui` command:: $ ase gui -r 3,3,2 ontop.traj or:: $ ase gui -g 'd(4,-1),F[-1,2]' ontop.traj to plot the force in the *z*-direction on the gold atom as a function of the Au-Al distance. Note that -1 is the index of the last atom in the cell corresponding to the Au atom. Try also *terminal-only-mode*:: $ ase gui -t -g 'd(4,-1),F[-1,2]' ontop.traj Plot density differences ------------------------ It is sometimes useful to look at density changes when studying for instance adsorption reactions. Copy the script :download:`densitydiff.py` to your area. Read it and try to understand what is does. Change the necessary lines to look at one of your slabs with Au adsorbed. The script will write the density difference to a :file:`.npy` file using NumPy's :func:`~numpy.save` function (can be read with :func:`~numpy.load`. Try this:: from mayavi import mlab import numpy as np d = np.load('densitydiff.npy') d2 = np.tile(d, (2, 2, 1)) # repeat 2x2 times in x,y-plane mlab.contour3d(d2) mlab.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/diffusion/initial.py000066400000000000000000000020641316441372200266560ustar00rootroot00000000000000from __future__ import print_function from ase.visualize import view from ase.constraints import FixAtoms from ase.optimize import QuasiNewton from ase.build import fcc100, add_adsorbate from gpaw import GPAW, PW # Initial state: # 2x2-Al(001) surface with 1 layer and an # Au atom adsorbed in a hollow site: slab = fcc100('Al', size=(2, 2, 2)) slab.center(axis=2, vacuum=3.0) add_adsorbate(slab, 'Au', 1.6, 'hollow') # Make sure the structure is correct: view(slab) # Fix the Al atoms: mask = [atom.symbol == 'Al' for atom in slab] print(mask) fixlayer = FixAtoms(mask=mask) slab.set_constraint(fixlayer) # Use GPAW: calc = GPAW(mode=PW(200), kpts=(2, 2, 1), xc='PBE', txt='hollow.txt') slab.set_calculator(calc) qn = QuasiNewton(slab, trajectory='hollow.traj') # Find optimal height. The stopping criterion is: the force on the # Au atom should be less than 0.05 eV/Ang qn.run(fmax=0.05) calc.write('hollow.gpw') # Write gpw output after the minimization print('energy:', slab.get_potential_energy()) print('height:', slab.positions[-1, 2] - slab.positions[0, 2]) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/diffusion/solution.py000066400000000000000000000023541316441372200271030ustar00rootroot00000000000000from ase.constraints import FixAtoms from ase.optimize import QuasiNewton from ase.calculators.emt import EMT from ase.build import fcc100, add_adsorbate from gpaw import GPAW, PW def aual100(site, height, calc=None): slab = fcc100('Al', size=(2, 2, 2)) slab.center(axis=2, vacuum=3.0) add_adsorbate(slab, 'Au', height, site) mask = [atom.symbol == 'Al' for atom in slab] fixlayer = FixAtoms(mask=mask) slab.set_constraint(fixlayer) if calc is None: calc = GPAW(mode=PW(200), kpts=(2, 2, 1), xc='PBE', txt=site + '.txt', eigensolver='rmm-diis', nbands=40) slab.set_calculator(calc) qn = QuasiNewton(slab, trajectory=site + calc.name + '.traj') qn.run(fmax=0.05) if isinstance(calc, GPAW): calc.write(site + '.gpw') return slab.get_potential_energy() e_hollow = aual100('hollow', 1.6) e_bridge = aual100('bridge', 2.0) e_ontop = aual100('ontop', 2.4) assert abs(e_bridge - e_hollow - 0.352) < 0.01 assert abs(e_ontop - e_hollow - 0.711) < 0.01 calc = EMT() e_hollow = aual100('hollow', 1.6, calc) e_bridge = aual100('bridge', 2.0, calc) e_ontop = aual100('ontop', 2.4, calc) assert abs(e_bridge - e_hollow - 0.401) < 0.01 assert abs(e_ontop - e_hollow - 0.745) < 0.01 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dos/000077500000000000000000000000001316441372200234505ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dos/dos.agts.py000066400000000000000000000013331316441372200255440ustar00rootroot00000000000000def agts(queue): queue.add('dos.agts.py', ncpus=1, deps=['../iron/PBE.py', '../wavefunctions/CO.py', '../wannier/si.py', '../aluminium/Al_fcc.py']) if __name__ == '__main__': import os import sys for filename in ['aluminium/Al-fcc.gpw', 'wannier/si.gpw', 'wavefunctions/CO.gpw', 'iron/ferro.gpw', 'iron/anti.gpw', 'iron/non.gpw']: sys.argv = ['', '../' + filename] exec(open('dos.py').read()) if not os.path.islink('ferro.gpw'): os.symlink('../iron/ferro.gpw', 'ferro.gpw') exec(open('pdos.py').read()) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dos/dos.py000066400000000000000000000012741316441372200246130ustar00rootroot00000000000000import sys import matplotlib.pyplot as plt from gpaw import GPAW # The following five lines read a file name and an optional width # from the command line. filename = sys.argv[1] if len(sys.argv) > 2: width = float(sys.argv[2]) else: width = None calc = GPAW(filename, txt=None) try: ef = calc.get_fermi_level() except ValueError: ef = 0 energy, dos = calc.get_dos(spin=0, width=width) plt.plot(energy - ef, dos) if calc.get_number_of_spins() == 2: energy, dos = calc.get_dos(spin=1, width=width) plt.plot(energy - ef, dos) plt.legend(('up', 'down'), loc='upper left') plt.xlabel(r'$\epsilon - \epsilon_F \ \rm{(eV)}$') plt.ylabel('Density of States (1/eV)') plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dos/dos.rst000066400000000000000000000032251316441372200247710ustar00rootroot00000000000000================= Density of states ================= Take a look at the :git:`~doc/exercises/dos/dos.py` program and try to get a rough idea of what it can do for you. Use it to plot the density of states (DOS) for the three Fe configurations from the :ref:`iron_exercise` exercise (on the *x*-axis you have the energy relative to the Fermilevel). * Do the DOS plots integrate to the correct numbers? (i.e. number of bands). * The DOS for the anti-ferromagnetic phase looks a bit like that for the non-magnetic phase - is it magnetic at all?! Calculate the magnetization like this: .. literalinclude:: magnetization.py and :ref:`look at it `. * Calculate the DOS for bulk Aluminum and compare it (qualitatively) to the DOS for the non-magnetic calculation. The DOS for a simple metal has this shape: *g*\ (*E*) ~ *E*\ :sup:`1/2`. Explain the qualitative difference. * Plot also the DOS for bulk Si and the CO molecule. Identify the bandgap between valence and conduction bands for Si and the HOMO-LUMO gap for CO. Make sure that your **k**-point mesh for Si is dense enough to sample the band structure. Projected Density of states (PDOS) ---------------------------------- The projected density of states is useful for for analyzing chemical bonding. There exist several studies where the density projected onto the d states of a given surface atom is used. This short exercise demonstrates how to construct the PDOS of Fe. We will get a feel for the local density of states by plotting the PDOS for the ferro-magnetic Fe crystal. Look at :git:`~doc/exercises/dos/pdos.py`. Use it to plot the s, p, and d-states on one of the Fe atoms. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dos/magnetization.py000066400000000000000000000003611316441372200266730ustar00rootroot00000000000000from ase.io import write from gpaw import GPAW calc = GPAW('anti.gpw') atoms = calc.get_atoms() up = calc.get_pseudo_density(0) down = calc.get_pseudo_density(1) zeta = (up - down) / (up + down) write('magnetization.cube', atoms, data=zeta) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/dos/pdos.py000066400000000000000000000007051316441372200247710ustar00rootroot00000000000000import matplotlib.pyplot as plt from gpaw import GPAW calc = GPAW('ferro.gpw', txt=None) ef = calc.get_fermi_level() # Plot s, p, d projected LDOS: for c in 'spd': energies, ldos = calc.get_orbital_ldos(a=0, spin=0, angular=c, width=0.4) plt.plot(energies - ef, ldos, label=c + '-up') energies, ldos = calc.get_orbital_ldos(a=0, spin=1, angular=c, width=0.4) plt.plot(energies - ef, ldos, label=c + '-down') plt.legend() plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/eels/000077500000000000000000000000001316441372200236135ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/eels/eels.py000066400000000000000000000014061316441372200251160ustar00rootroot00000000000000from gpaw import GPAW from gpaw.response.df import DielectricFunction calc = GPAW('Ag_GLLBSC.gpw') calc.diagonalize_full_hamiltonian(nbands=30) calc.write('Ag_GLLBSC_full.gpw', 'all') # Set up dielectric function: df = DielectricFunction(calc='Ag_GLLBSC_full.gpw', # Ground state input domega0=0.05) # energy grid spacing at omega=0 # Momentum transfer, must be the difference between two kpoints! q_c = [1.0 / 10, 0, 0] df.get_eels_spectrum(q_c=q_c) # a file called 'eels.csv' is generated # Plot spectrum import numpy as np import matplotlib.pyplot as plt data = np.loadtxt('eels.csv', delimiter=',') omega = data[:, 0] eels = data[:, 2] plt.plot(omega, eels) plt.xlabel('Energy (eV)') plt.ylabel('Loss spectrum') plt.xlim(0, 20) plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/eels/eels.rst000066400000000000000000000077411316441372200253060ustar00rootroot00000000000000.. _eels_exercise: ======================================= Electron energy loss spectrum of silver ======================================= Electron energy loss spectroscopy (EELS) is a widely used method to obtain the excitation spectrum of materials. For metallic and semiconducting materials, the energy losses in the range 0-50 eV is primarily due excitations of plasmons, that are collective electronic excitations, corresponding to oscillations in the electron density. For a free-electron metal (Drude metal), the plasmon energy is given by the electron density, n: .. math:: \omega_p = \sqrt{\frac{ne^2}{\epsilon_0 m}}. In GPAW, the EELS can be calculated with the dielectric response module, where it is obtained from the macroscopic dielectric function: .. math:: \mathrm{EELS}(q, \omega) = -\mathrm{Im} \frac{1}{\epsilon_M(q,\omega)}, where q is the momentum transfer. (Se the tutorial :ref:`df_tutorial` for a detailed description of the dielectric response.) Here we will calculate the EELS for bulk silver, where band-structure effects (coupling to inter-band transitions) are seen to have a big impact on the plasmon resonance, which means that the Drude description for the plasmon energy given above is not expected to hold. First restart the ground state calculation with the GLLBSC functional, calculated in the bandstructure exercise :ref:`band exercise` and converge a larger number of bands: .. literalinclude:: eels.py :end-before: # Set up Then we can set up the dielectric function, taking the ground state as input: .. literalinclude:: eels.py :start-after: # Set up :end-before: # Momentum transfer The EELS spectrum is calculated with the :meth:`~gpaw.response.df.DielectricFunction.get_eels_spectrum` method, that takes the momentum transfer q as a parameter. This parameter is restricted to be the difference between two k-points from the ground state calculation. Let's choose the smallest q possible: If you used `N\times N\times N` k-points then that will be ``[1.0 / N, 0, 0]``: .. literalinclude:: eels.py :start-after: # Momentum transfer :end-before: # Plot The calculation (see :download:`eels.py`) takes some time due to a sum over k-points. To speed up the calculation, run it in parallel:: mpirun -np 4 gpaw-python silver_EELS.py The calculation saves the file ``eels.csv`` by default, where the first column is the energy grid, and the second and third columns are the loss spectrum without and with local field corrections respectively. (The local field corrections takes into account that the system responds on the microscopic scale though the perturbation is macroscopic). You can plot the spectrum by like this: .. literalinclude:: eels.py :start-after: # Plot Look at the spectrum, where is the plasmon peak? Compare the result to the experimental plasmon energy `\omega_P \approx 3.9 \mathrm{eV}`. Also compare the result to the Drude value for the plasmon frequency given above. (Hint: For silver there is one valence s electron pr. atom, use this to calculate the free-electron density.) Hopefully you will find that there is large difference between the free electron and the quantum result. The plasmon is damped and shifted down in energy due to coupling to single-particle transitions (inter-band transitions). Here the d-band of silver plays a crucial role, since transitions from here up to the Fermi level defines the onset of inter-band transitions. For example you can calculate the loss spectrum from the LDA ground state result and see what is does to the spectrum. You can also investigate the single-particle spectrum by calculating the dielectric function:: df.get_dielectric_function(q_c=q_c), which saves a file ``df.csv`` (see :meth:`~gpaw.response.df.DielectricFunction.get_dielectric_function`). Try plotting the imaginary part (column 5 in the data file), which corresponds to the single-particle spectrum. Compare this to the loss spectrum to see that the plasmon peak is shifted down just below the single-particle transitions. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/eels/test.py000066400000000000000000000002131316441372200251400ustar00rootroot00000000000000code = open('eels.py').read().replace('Ag_GLLBSC.gpw', '../band_structure/Ag_GLLBSC.gpw') exec(code) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/exercises.rst000066400000000000000000000030761316441372200254150ustar00rootroot00000000000000.. _exercises: ========= Exercises ========= .. note:: **CAMd summer school 2016 participants**, please read this :ref:`page ` before you start working on the exercises. In order to do the exercises, it helps with a little bit of knowledge of ASE_ and Python_. Here are some useful resources: * Some :ref:`faeq`. * The Python_ homepage. * The ASE_ homepage. * ASE's :ref:`ase:what is python` section. .. _Python: http://www.python.org .. _ASE: https://wiki.fysik.dtu.dk/ase The exercises are used in the course `Electronic structure methods in materials physics, chemistry and biology `_. Introductory exercises ====================== Do these first... .. toctree:: :maxdepth: 1 gettingstarted/gettingstarted water/water wavefunctions/wavefunctions Intermediate exercises ====================== .. toctree:: :maxdepth: 1 aluminium/aluminium surface/surface diffusion/diffusion Advanced exercises ================== Pick among them according to your interest. You can also look at the :ref:`tutorials`. * :ref:`Nudged elastic band calculations ` .. toctree:: :maxdepth: 1 stm/stm wannier/wannier dos/dos band_structure/bands vibrations/vibrations iron/iron eels/eels gw/gw rpa/rpa dcdft/dcdft stress/stress lrtddft/lrtddft transport/transport Further information: .. toctree:: :maxdepth: 1 faeq For comments and questions, write to the :ref:`mail list`. You can also search in the mailing list archives on the same page. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/faeq.rst000066400000000000000000000051021316441372200243270ustar00rootroot00000000000000.. _faeq: =================================== Frequently asked exercise questions =================================== .. contents:: .. _iso: Visualizing iso-surfaces ------------------------ Iso-surfaces from data in a cube-file or a gpw-file can be visualized using Mayavi from the command line like shown :mod:`here `. It's a good idea to create a short alias like this:: $ alias iso="python3 -m ase.visualize.mlab -C gpaw" so that you can simply do:: $ iso CO.cube # plot cube file $ iso slab-4.gpw # plot electron density from gpw-file $ iso slab-4.gpw -n 15 # plot wave function from gpw-file $ iso -h # help! .. _xy plot: Making x-y plots ---------------- If you want to plot an x-y plot from data in a csv-file (comma separated values), you can use `gnuplot `_:: $ gnuplot gnuplot> plot "abc.csv" using 1:2 Alternatively, use this little :download:`Python script `: .. literalinclude:: xy.py :: $ python3 /xy.py abc.csv Writing 3-d data to cube files ------------------------------ This can be done from Python using the :func:`ase.io.write` function:: from ase.io import write write('abc.cube', atoms, data=data) Square root ----------- Square roots are calculated like this: ``2**0.5`` or ``sqrt(2)`` (the ``sqrt`` function must first be imported: ``from math import sqrt`` or ``from numpy import sqrt``). Integer division ---------------- In Python, ``/`` is used for both integer- and float divisions. Integer division is only performed if both sides of the operator are integers (you can always force an integer division by using ``//``):: >>> 1 / 3 0 >>> 1 / 3.0 0.33333333333333331 Why does changing one variable change another one? -------------------------------------------------- The = operator in Python is *not* and assignment operator, it is a *naming* operator: It makes a new name for (reference to) the object:: a = [1, 2, 3, 4, 5] # Create a list b = a # New name for list a[2] = 42 print(b) # [1, 2, 42, 4, 5] c = 7 d = c c += 42 # d is still 7, we just did # c = c + 42 # creating a new object 49 and # giving it the name c Saving plots ------------ You can save plots made with matplotlib by pressing the floppy-disk icon in the bottom of the plot, and save as a .png file. You can save a picture of the atoms from ASE's GUI by choosing Save, and then specify a .png file. You can view .png files in the databar with the command ``eog`` ("eye of Gnome"). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gettingstarted/000077500000000000000000000000001316441372200257135ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gettingstarted/gettingstarted.rst000066400000000000000000000126531316441372200315040ustar00rootroot00000000000000Getting started with GPAW ========================= In this exercise we will calculate structures and binding energies for simple molecules. Performing a structure optimization ----------------------------------- A *structure optimization*, also called a *relaxation*, is a series of calculations used to determine the minimum-energy structure of a given system. This involves multiple calculations of the atomic forces `\mathbf F^a = -\tfrac{\partial E}{\partial \mathbf R^a}` with respect to the atomic positions `\mathbf R^a` as the atoms are moved downhill according to an optimization algorithm. The following script uses the :mod:`EMT calculator ` to optimize the structure of :mol:`H_2`. .. literalinclude:: h2.emt.py This is the first ASE script we have seen so far, so a few comments are in order: * At the top is a series of *import statements*. These load the Python modules we are going to use. * An :class:`~ase.Atoms` object is created, specifying an initial (possibly bad) guess for the atomic positions. * An :class:`~ase.calculators.emt.EMT` calculator is created. A *calculator* can evaluate quantities such as energies and forces on a collection of atoms. There are different kinds of calculators, and EMT is a particularly simple one. The calculator is associated with the :class:`~ase.Atoms` object by calling ``atoms.set_calculator(calc)``. * An :mod:`optimizer ` is created and associated with the :class:`~ase.Atoms` object. It is also given an optional argument, ``trajectory``, which specifies the name of a file into which the positions will be saved for each step in the geometry optimization. * Finally the call ``opt.run(fmax=0.05)`` will run the optimization algorithm until all atomic forces are below 0.05 eV per Ångström. **Run the above structure optimization.** This will print the (decreasing) total energy for each iteration until it converges, leaving the file :file:`h2.emt.traj` in the working directory. Use the command :command:`ase gui` to view the trajectory file, showing each step of the optimization. Structure optimization of :mol:`H_2O` with EMT and GPAW ------------------------------------------------------- Adapt the above script as needed and calculate the structure of a :mol:`H_2O` molecule using the EMT calculator. Note that water is not a linear molecule. If you start with a linear molecule, the minimization may not be able to break the symmetry. Be sure to visualize the final configuration to check that it is reasonable. The empirical EMT potential is fast, but not very accurate for molecules in particular. We therefore want to perform this calculation in GPAW instead. GPAW uses real-space grids to represent density and wavefunctions, and the grids exist in a cell. For this reason you must set a cell for the :class:`~ase.Atoms` object. As a coarse value let us use a 6 Ångström cell:: system.set_cell((6.0, 6.0, 6.0)) system.center() The cell must be centered in order to prevent atoms from lying too close to the boundary, as the boundary conditions are zero by default. Instead of importing and using EMT, we now use GPAW:: from gpaw import GPAW ... calc = GPAW() ... Make a copy of your script and adapt it to GPAW, then recalculate the structure of :mol:`H_2O` (make sure to choose a new filename for the trajectory file). During the calculation a lot of text is printed to the terminal. This includes the parameters used in the calculation: Atomic positions, grid spacing, XC functional (GPAW uses LDA by default) and many other properties. For each iteration in the self-consistency cycle one line is printed with the energy and convergence measures. After the calculation the energy contributions, band energies and forces are listed. Use :command:`ase gui` to visualize and compare bond lenghts and bond angles to the EMT result. Bond lengths and angles are shown automatically if you select two or three atoms at a time. Atomization energies -------------------- Now that we know the structure of :mol:`H_2O`, we can calculate other interesting properties like the molecule's atomization energy. The *atomization energy* of a molecule is equal to the total energy of the molecule minus the sum of the energies of each of its constituent *isolated* atoms. For example, the atomization energy of :mol:`H_2` is `E[\mathrm{H}_2] - 2 E[\mathrm H]`. GPAW calculations are by default spin-paired, i.e. the spin-up and spin-down densities are assumed to be equal. As this is not the case for isolated atoms, it will be necessary to instruct GPAW to do something different:: calc = GPAW(hund=True) With the ``hund`` keyword, Hund's rule is applied to initialize the atomic states, and the calculation will be made spin-polarized. Write a script which calculates the total energy of the isolated O and H atoms, and calculate the atomization energy of :mol:`H_2O`. Exchange and correlation functionals ------------------------------------ So far we have been using GPAW's default parameters. The default exchange-correlation functional is LDA. This is not very accurate, and in particular overestimates atomization energies. You can specify different XC functionals to the calculator using :samp:`GPAW(xc={name})`, where :samp:`{name}` is a string such as ``'LDA'``, ``'PBE'`` or ``'RPBE'``. Calculate the atomization energy of :mol:`H_2O` with LDA and PBE (just reuse the geometry from the LDA optimization, i.e. do not repeat the minimization). gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gettingstarted/h2.emt.py000066400000000000000000000004661316441372200273700ustar00rootroot00000000000000from ase import Atoms from ase.calculators.emt import EMT from ase.optimize import QuasiNewton system = Atoms('H2', positions=[[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) calc = EMT() system.set_calculator(calc) opt = QuasiNewton(system, trajectory='h2.emt.traj') opt.run(fmax=0.05) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gw/000077500000000000000000000000001316441372200233005ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gw/Si_g0w0_ppa.py000066400000000000000000000027661316441372200257350ustar00rootroot00000000000000import numpy as np from ase.parallel import parprint from gpaw.response.g0w0 import G0W0 # We start by setting up a G0W0 calculator object gw = G0W0('Si_gs.gpw', # Path to groundstate gpw file filename='Si_g0w0_ppa', # filename base for output files kpts=None, # List of quasiparticle k-point indices # or None = all k-points bands=(3, 5), # Range of quasiparticle bands - last # index is NOT included ecut=100., # Plane wave basis cut-off energy ppa=True) # Use Plasmon Pole Approximation # Perform the GW calculation. The results, ie. quasiparticle energies, as # well as original Kohn-Sham eigenvalues, occupation numbers, DFT XC and # self-energy contributions and renormalization factors are returned as a # python dictionary object result = gw.calculate() ks_skn = result['eps'] # Get Kohn-Sham eigenvalues ks_cbmin = np.amin(ks_skn[0, :, 1]) # DFT conduction band minimum ks_vbmax = np.amax(ks_skn[0, :, 0]) # DFT valence band maximum ks_gap = ks_cbmin - ks_vbmax # DFT band gap qp_skn = result['qp'] # GW quasiparticle energies qp_cbmin = np.amin(qp_skn[0, :, 1]) # GW conduction band minimum qp_vbmax = np.amax(qp_skn[0, :, 0]) # GW valence band maximum qp_gap = qp_cbmin - qp_vbmax # GW band gap parprint('Kohn-Sham gap = %.3f' % ks_gap) parprint('G0W0 gap = %.3f' % qp_gap) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gw/gw.rst000066400000000000000000000212661316441372200244560ustar00rootroot00000000000000.. _gw exercise: =========================================== G0W0 calculation of the band gap of silicon =========================================== In this exercise we will calculate the band gap of silicon. Go through the :ref:`bandstructures` tutorial first. In that tutorial the band structure of silicon is calculated based on the Kohn-Sham eigenvalues obtained from a DFT calculation. Often one interprets the band structure as electron addition and removal energies and the difference between the conduction band minimum and valence band maximum as the band gap. With the values obtained from DFT this is however not completely correct, because DFT only finds the ground state electron density when the system is neutral. When we add or remove an electron we charge the system and the other electrons redistribute to a new configuration. Thus DFT tends to underestimate the band gap, since it does not take into account the extra energy it requires to squeeze an extra electron into the conduction band and the relieve of energy when we remove an electron from the valence band. * How many valence electron does silicon have? What are the band indices of the valence and conduction bands respectively? Take a look at the band structure of silicon - where are the valence band maximum and conduction band minimum located and what is the band gap obtained from DFT? The GW approximation is a method for calculating the charged states of a system based on a systematic perturbation theory approach. In its simplest version, and the one so far implemented in GPAW, we can use it to find the corrections to the DFT band structure than include the missing screening effect when we add or remove an electron. In this approximation the quasiparticle energy (electron addition/removal energies) of the state `(\mathbf{k}, n)` is given by .. math:: \epsilon^\text{qp}_{n \mathbf{k}} = \epsilon_{n \mathbf{k}} + Z_{n \mathbf{k}} \cdot \text{Re} \left(\Sigma_{n \mathbf{k}}^{\vphantom{\text{XC}}} + \epsilon^{\text{EXX}}_{n \mathbf{k}} - V^{\text{XC}}_{n \mathbf{k}} \right). For more information on the theory of GW, there's a short description in the section: :ref:`gw_theory`. ------------------------ Ground state calculation ------------------------ As GW is a pertubative approach on top of a ground state, lets start by calculating the ground state of Silicon. You can create a script yourself or reuse the one from the band structure calculation. Silicon has in diamond structure with a lattice constant of 5.431 Å. .. note:: Currently the implementation of GW in GPAW does not support magnetic systems, so make sure your ground state calculation is performed without spin polarization. In order to carry out the GW calculation we need the wavefunctions and corresponding energies of both all the occupied and a lot of unoccupied bands. By default, GPAW only calculates the occupied bands, since they are the only ones relevant for the ground state, so you have to specify that you want unoccupied bands as well. This can be done by specifying the parameters ``nbands=XX`` and ``convergence={'bands': 'all'}``, however with the standard iterative eigensolvers it can be hard to converge all the bands. Thus a better way is to first calculate the ground state and the occupied bands and then calculate the unoccupied bands by exact diagonalization of the resulting Hamiltonian. This is done like this: :: calc = GPAW(mode=PW(300), ...) # Note we MUST use plane waves atoms.set_calculator(calc) atoms.get_potential_energy() # Calculate ground state calc.diagonalize_full_hamiltonian() # Does what it says ;) calc.write('my_file.gpw', 'all') # Saves calculator AND wavefunctions Note that in order to use the ``diagonalize_full_hamiltonian()`` method, the calculator has to use a plane wave basis, which is done by specifying ``mode=PW()`` and correctly importing the PW class: ``from gpaw import PW``. It is a good idea to save the calculator with the ``write()`` method and remember to include the wavefunctions by setting the second argument to ``'all'``. - Write a script that calculates the ground state of silicon and all of the unoccupied bands and saves the result. Use a plane wave cut-off of say 200 eV and 4x4x4 k-point sampling that is shifted to include the `\Gamma`-point (this can be done by specifying ``kpts={'size': (4, 4, 4), 'gamma': True}``. Why this k-point sampling? ---------------- G0W0 calculation ---------------- To do a GW calculation is very easy. First we must decide which states we actually want to perform the calculation for. For just finding the band gap we can many times just do with the locations of the conduction band minimum and valence band maximum. However the quasiparticle spectrum might be qualitatively different from the DFT spectrum, so its best to do the calculation for all k-points. Here's a script that does this: .. literalinclude:: Si_g0w0_ppa.py - Try using the above script to calculate the GW band gap. Is it larger than the one from DFT as we would expect? - The G0W0 calculator generates a couple of temporary files and output files. Take a look in the output files (ending in ``.txt``) to see what kind of information that is stored. In the above script we told the GW calculator to use ``ppa=True``, which means that it will use the Plasmon Pole Approximation. In GW we take the full dynamical screening into account and we thus need the dielectric function for the full frequency range. However in the Plasmon Pole Approximation the frequency dependence of the dielectric function is obtained by fitting to a special function that only needs two values to be determined, making the calculation much faster. If we disable the plasmon pole approximation, the dielectric function will be calculated on a frequency grid. - Try doing the same calculation with ``ppa=False`` and notice the time it takes. Are the results much different from the ones obtained with the Plasmon Pole Approximation? ----------- Convergence ----------- As with all other numerical implementations, we have to be careful to check whether the calculations are converged with respect to the various parameters. In GW the most crucial parameters are the density of points that we integrate over: k-points and frequency points, as well as the number of bands included in the band summations and the quality of the wavefunctions, determined by the plane wave cut-off energy. - By default GPAW chooses the number of bands close to the number of plane waves. It is usually not necesarry to include more bands than the size of the plane wave basis used to expand the wavefunctions. Can you give a simple explanation why? The fine features of the dielectric function are often averaged out in the integral over the screened potential, which is why the plasmon pole approximation usually performs well. - Try making the frequency grid denser or coarser by setting the parameter ``domega0`` to something different than its default value, which is ``domega0=0.025``. The calculation time scales linearly with the number of frequency points, so making it half as big doubles the time. Do your results depend a lot on the frequency grid? When can you safely say they are converged? Next, we need to make sure that we have enough plane waves to properly describe the wavefunctions, by adjusting the plane wave cut-off. This, however, does not come for free; The GW calculation scales quadratically in the number of plane waves and since we set the number of bands to the same number, it actually scales as the **third power** of the number of plane waves!!! - Try making a couple of calculations where you change the plane wave cut-off energy from say 25 eV to 150 eV. Just use the default frequency grid. If you wish, you can actually read off the number of plane waves used by looking in the generated log file for the screened potential that ends in ``.w.txt``. Lastly, we also need to make sure that the calculations is converged with respect to the k-point sampling. To do this, one must make new ground state calculations with different k-point samplings to be put into the G0W0 calculator. The calculation of the quasiparticle energy of one state scales quadratically in the number of k-points, but if one want the full band structure there's an extra factor of the number of k-points, so this quickly becomes very heavy! - Make new groundstate calculations with k-point samplings 4x4x4, 6x6x6 and 8x8x8 and so on and find the DFT band gap. When is it safe to say that the DFT band gap is converged? - Perform GW calculations (parallelize over minimum four cpus) for the different k-point samplings (4, 6 and 8 k-points only) and compare the gaps. How big is the variation in the gaps compared to the variation in the DFT result? When do you think the GW band gap is converged? gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/gw/test.py000066400000000000000000000006721316441372200246360ustar00rootroot00000000000000from gpaw import GPAW, PW, FermiDirac from ase.build import bulk si = bulk('Si') si.calc = GPAW(mode=PW(200), kpts={'size': (2, 2, 2), 'gamma': True}, occupations=FermiDirac(0.01)) si.get_potential_energy() si.calc.diagonalize_full_hamiltonian() si.calc.write('Si_gs.gpw', 'all') dct = {} exec(open('Si_g0w0_ppa.py').read(), dct) assert abs(dct['ks_gap'] - 0.404) < 0.01 assert abs(dct['qp_gap'] - 1.138) < 0.01 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/iron/000077500000000000000000000000001316441372200236325ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/iron/PBE.py000066400000000000000000000007361316441372200246200ustar00rootroot00000000000000from __future__ import print_function from gpaw import GPAW print('state LDA PBE') for name in ['ferro', 'anti', 'non']: calc = GPAW(name + '.gpw', txt=None) atoms = calc.get_atoms() eLDA = atoms.get_potential_energy() deltaxc = calc.get_xc_difference('PBE') ePBE = eLDA + deltaxc if name == 'ferro': eLDA0 = eLDA ePBE0 = ePBE eLDA -= eLDA0 ePBE -= ePBE0 print(('%-5s: %7.3f eV %7.3f eV' % (name, eLDA, ePBE))) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/iron/anti.py000066400000000000000000000006311316441372200251370ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW, PW a = 2.87 m = 2.2 fe = Atoms('Fe2', scaled_positions=[(0, 0, 0), (0.5, 0.5, 0.5)], magmoms=[m, -m], cell=(a, a, a), pbc=True) calc = GPAW(mode=PW(350), kpts=(6, 6, 6), txt='anti.txt') fe.set_calculator(calc) e = fe.get_potential_energy() calc.write('anti.gpw') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/iron/ferro.py000066400000000000000000000006321316441372200253220ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW, PW a = 2.87 m = 2.2 fe = Atoms('Fe2', scaled_positions=[(0, 0, 0), (0.5, 0.5, 0.5)], magmoms=[m, m], cell=(a, a, a), pbc=True) calc = GPAW(mode=PW(350), kpts=(6, 6, 6), txt='ferro.txt') fe.set_calculator(calc) e = fe.get_potential_energy() calc.write('ferro.gpw') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/iron/iron.rst000066400000000000000000000052311316441372200253340ustar00rootroot00000000000000.. _iron_exercise: ==================================== Electron spin and magnetic structure ==================================== As an example of spin polarized calculations, we'll study Fe(bcc) in a two-atom unit cell, i.e. a simple cubic Bravais lattice with a basis, where one Fe atom sits at the origin, the other in the middle of the unit cell. We'll stick to the experimental lattice constant *a* = 2.87 Å. The atomic term of iron is [Ar]3d\ :sup:`6`\ 4s\ :sup:`2`, i.e. 8 valence electrons/atom is included in the calculation. * Use Hunds rule (maximum polarization rule) to calculate the magnetic moment of an isolated Fe atom. Draw schematically the one-electron eigenvalues for spin up and down on an energy axis, along with electron populations. * We'll make three calculations for bulk iron: 1) A non-magnetic calculation 2) A ferro-magnetic calculation (aligned atomic moments) 3) An anti ferro-magnetic calculation (antiparallel atomic moments). * How many bands are needed? Assuming the atoms polarize maximally (as the isolated atoms). For metals, always have at least 5 extra bands to allow for uneven filling of states for different **k**-points. * One should *help* a magnetic calculation by providing initial magnetic moments for the atoms using the ``magmoms`` argument to the :class:`~ase.Atoms` constructor or by using the :meth:`~ase.Atoms.set_initial_magnetic_moments` method of the :class:`~ase.Atoms` object. This is necessary to find magnetic states. Choose the magnetic moment close to the expected/desired magnetic state of your system (the experimental value is 2.22 per atom). The initial magnetic moment is relaxed during the self consistency cycles. Note that for a spin polarized calculation, each iteration step takes twice the time compared to a spin paired calculation. * For each of the three magnetic phases ferro, antiferro and nonmagnetic, write down sensible guesses for initial magnetic moment parameters: magnetic moment for each of the two atoms in the unit cell. Start with this script: :download:`ferro.py`. Compare the energies of the three magnetic phases: * Experimentally, the ferromagnetic phase is most stable. Is this reproduced for LDA and GGA? Instead of repeating the three calculations using PBE, you can estimate the PBE numbers from the LDA densities you already have. This is done in this script: :download:`PBE.py`. * Compare the calculated magnetic moment for the ferromagnetic phase with the experimental value. You can find the calculated value in the text output, or by using the :meth:`~gpaw.calculator.GPAW.get_magnetic_moments` method of the calculator object. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/iron/non.py000066400000000000000000000005731316441372200250030ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW, PW a = 2.87 m = 2.2 fe = Atoms('Fe2', scaled_positions=[(0, 0, 0), (0.5, 0.5, 0.5)], cell=(a, a, a), pbc=True) calc = GPAW(mode=PW(350), kpts=(6, 6, 6), txt='non.txt') fe.set_calculator(calc) e = fe.get_potential_energy() calc.write('non.gpw') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/000077500000000000000000000000001316441372200243265ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/Na2TDDFT.py000066400000000000000000000005341316441372200261100ustar00rootroot00000000000000from gpaw import GPAW from ase import Atoms from gpaw.lrtddft import LrTDDFT molecule = Atoms('Na2', positions=((0.0, 0.0, 0.0), (3.12, 0.0, 0.0))) molecule.center(vacuum=4.0) calc = GPAW(xc='PBE', setups={'Na': '1'}, h=0.25) molecule.set_calculator(calc) molecule.get_potential_energy() lr = LrTDDFT(calc, xc='LDA') lr.write('Omega_Na2.gz') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/ground_state.py000066400000000000000000000013711316441372200274000ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW # Sodium dimer, Na2 d = 1.5 atoms = Atoms(symbols='Na2', positions=[(0, 0, d), (0, 0, -d)], pbc=False) # For real calculations use larger vacuum (e.g. 6) atoms.center(vacuum=4.0) calc = GPAW(nbands=1, h=0.35, setups={'Na': '1'}, txt='Na2_gs.txt') atoms.set_calculator(calc) e = atoms.get_potential_energy() # Calculate also unoccupied states with the fixed density # unoccupied states converge often better with cg calc.set(nbands=20, convergence={'bands': 20}, eigensolver='cg', fixdensity=True) e = atoms.get_potential_energy() # write the wave functions to a file calc.write('na2_gs_unocc.gpw', 'all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/lrtddft.rst000066400000000000000000000036051316441372200265270ustar00rootroot00000000000000.. _exercise_lrtddft: ========================================= Calculation of optical spectra with TDDFT ========================================= In this exercise we calculate optical spectrum of Na2 molecule using linear response time-dependent density functional theory (see also :ref:`lrtddft`). We start with a normal ground state calculation: .. literalinclude:: Na2TDDFT.py .. highlight:: python Once the ground state calculation with unoccupied states is finished, the last part of the script performs a linear response TDDFT calculation. As the construction of the Omega matrix is computationally the most intensive part it is sometimes convenient to perform diagonalisation and construction of spectrum in separate calculations:: lr = LrTDDFT(filename='Omega_Na2.gz') lr.diagonalize() lr.write('excitations_Na2.gz') and:: from gpaw.lrtddft import LrTDDFT, photoabsorption_spectrum lr = LrTDDFT(filename='excitations_Na2.gz') photoabsorption_spectrum(lr, 'Na2_spectrum.dat', e_min=0.0, e_max=10) The number of electron-hole pairs used in the calculation can be controlled with ``istart`` and ``jend`` options of LrTDDFT:: LrTDDFT(calc, istart=0, jend=10) By default only singlet-singlet transitions are calculated, singlet-triplet transitions can be calculated by giving the ``nspins`` parameter:: LrTDDFT(calc, istart=0, jend=10, nspins=2) 1. Check how the results vary with the number of unoccupied states in the calculation (``jend`` parameter). 2. Calculate also singlet-triplet transitions. Why do they not show up in the spectrum? 3. Check how the results vary with the empty space around the molecule. 4. Try to calculate optical spectrum also with the :ref:`timepropagation` approach and see how the results compare to linear response calculation. Note that the :ref:`timepropagation` examples deal with Be2, you can of course modify it to use Na2 instead. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/part2.py000066400000000000000000000004031316441372200257250ustar00rootroot00000000000000from gpaw.lrtddft import LrTDDFT, photoabsorption_spectrum lr = LrTDDFT(filename='Omega_Na2.gz') lr.diagonalize() lr.write('excitations_Na2.gz') lr = LrTDDFT(filename='excitations_Na2.gz') photoabsorption_spectrum(lr, 'Na2_spectrum.dat', e_min=0.0, e_max=10) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/spectrum.py000066400000000000000000000006711316441372200265460ustar00rootroot00000000000000from gpaw import restart from gpaw.lrtddft import LrTDDFT, photoabsorption_spectrum atoms, calc = restart('na2_gs_unocc.gpw') # Calculate the omega matrix lr = LrTDDFT(calc, xc='LDA', jend=5) # Use only 5 unoccupied states # Save the omega matrix lr.write('Omega_Na2.gz') # Diagonalize the matrix lr.diagonalize() # Analyse 5 lowest excitations lr.analyse(range(5)) photoabsorption_spectrum(lr, 'Na2_spectrum.dat', e_min=0.0, e_max=10) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/lrtddft/submit.agts.py000066400000000000000000000003631316441372200271420ustar00rootroot00000000000000def agts(queue): calc1 = queue.add('Na2TDDFT.py', ncpus=2, walltime=60) queue.add('part2.py', deps=calc1) gs = queue.add('ground_state.py', ncpus=8) queue.add('spectrum.py', deps=gs) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/octopus_run.py000066400000000000000000000006051316441372200256160ustar00rootroot00000000000000#!/usr/bin/env python label = 'oscillator' from os import environ octopus = environ['OCTOPUS_SCRIPT'] locals = {'label': label} exec(open(octopus).read(), {}, locals) exitcode = locals['exitcode'] if exitcode != 0: raise RuntimeError(('Octopus exited with exit code: %d. ' + 'Check %s.log for more information.') % (exitcode, label)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/000077500000000000000000000000001316441372200234455ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/atom/000077500000000000000000000000001316441372200244055ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/atom/si.atom.pbe+exx.py000066400000000000000000000025421316441372200277010ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW, FermiDirac, Mixer from gpaw.wavefunctions.pw import PW from gpaw.xc.exx import EXX from ase.parallel import paropen # This calculation is too heavy to run as an exercise!! myresults = paropen('si.atom.pbe_and_exx_energies.txt', 'a') # Plane wave cutoff pwcutoff = 400.0 # Do the isolated calculation for L in [6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]: isolated_silicon = Atoms( symbols=['Si'], positions=[[0.5 * L, 0.5 * L, 0.5 * L]], cell=([L, 0, 0], [0, L, 0], [0, 0, L]), pbc=(1, 1, 1)) isolated_calc = GPAW( mode=PW(pwcutoff, force_complex_dtype=True), xc='PBE', txt='si_isolated_pbe.txt', occupations=FermiDirac(0.01, fixmagmom=True), spinpol=True, hund=True, convergence={'density': 1.e-6}, mixer=Mixer(beta=0.05, nmaxold=5, weight=50.0)) isolated_silicon.set_calculator(isolated_calc) e0_isolated_pbe = isolated_silicon.get_potential_energy() isolated_calc.write('si.pbe+exx.isolated.gpw', mode='all') # Now the exact exchange exx = EXX('si.pbe+exx.isolated.gpw', txt='si_isolated_exx.txt') exx.calculate() si_isolated_exx = exx.get_total_energy() s = str(L) s += ' ' s += str(e0_isolated_pbe) s += ' ' s += str(si_isolated_exx) s += '\n' myresults.write(s) si.atom.pbe_and_exx_energies.txt000066400000000000000000000004621316441372200325770ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/atom# Box_side_length(A) PBE_total_energy(eV) PBE+EXX_total_energy(eV) 6.0 -0.664402266578 9.88627820237 7.0 -0.778484948334 9.79998115788 8.0 -0.82500272946 9.76744817185 9.0 -0.841856681349 9.75715732758 10.0 -0.848092042293 9.75399390142 11.0 -0.850367362642 9.75296805021 12.0 -0.85109735188 9.75265131464 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/atom/si.atom.rpa.py000066400000000000000000000003161316441372200271120ustar00rootroot00000000000000from gpaw.xc.rpa import RPACorrelation #This calculation is too heavy to run as an exercise!! rpa1 = RPACorrelation('si.rpa.isolated.gpw', txt='si.atom.rpa_output.txt') E1_i = rpa1.calculate(ecut=400.0) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/atom/si.atom.rpa_init_pbe.py000066400000000000000000000016261316441372200307700ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW, FermiDirac, Mixer from gpaw.wavefunctions.pw import PW # This calculation is too heavy to run as an exercise!! # Plane wave cutoff pwcutoff = 400.0 # box length for isolated atom L = 8.0 # Do the isolated calculation isolated_silicon = Atoms( symbols=['Si'], positions=[[0.5 * L, 0.5 * L, 0.5 * L]], cell=([L, 0, 0], [0, L, 0], [0, 0, L]), pbc=(1, 1, 1)) isolated_calc = GPAW( mode=PW(pwcutoff, force_complex_dtype=True), xc='PBE', txt='si_isolated_rpa.init_pbe.txt', occupations=FermiDirac(0.01, fixmagmom=True), spinpol=True, hund=True, convergence={'density': 1.e-6}, mixer=Mixer(beta=0.05, nmaxold=5, weight=50.0)) isolated_silicon.set_calculator(isolated_calc) isolated_silicon.get_potential_energy() isolated_calc.diagonalize_full_hamiltonian() # ouch isolated_calc.write('si.rpa.isolated.gpw', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/atom/si.atom.rpa_output.txt000066400000000000000000000037251316441372200307300ustar00rootroot00000000000000---------------------------------------------------------- Non-self-consistent RPA correlation energy ---------------------------------------------------------- Started at: Fri Aug 15 17:47:53 2014 Atoms : Si Ground state XC functional : PBE Valence electrons : 4 Number of bands : 9315 Number of spins : 2 Number of k-points : 1 Number of irreducible k-points : 1 Number of q-points : 1 Number of irreducible q-points : 1 q: [0.0000 0.0000 0.0000] - weight: 1.000 ---------------------------------------------------------- ---------------------------------------------------------- Analytical coupling constant integration Frequencies Gauss-Legendre integration with 16 frequency points Transformed from [0,oo] to [0,1] using e^[-aw^(1/B)] Highest frequency point at 800.0 eV and B=2.0 Parallelization Total number of CPUs : 4 Frequency decomposition : 1 K-point/band decomposition : 4 Response function bands : Equal to number of plane waves Plane wave cutoffs (eV) : 131 163 204 256 320 400 # 0 - 17:49:35 q = [0.000 0.000 0.000] E_cut = 131 eV / Bands = 1743: E_c(q) = -4.322/-4.291/-4.291 eV E_cut = 163 eV / Bands = 2469: E_c(q) = -4.395/-4.365/-4.365 eV E_cut = 204 eV / Bands = 3407: E_c(q) = -4.443/-4.413/-4.413 eV E_cut = 256 eV / Bands = 4729: E_c(q) = -4.479/-4.448/-4.448 eV E_cut = 320 eV / Bands = 6667: E_c(q) = -4.506/-4.476/-4.476 eV E_cut = 400 eV / Bands = 9315: E_c(q) = -4.525/-4.495/-4.495 eV ========================================================== Total correlation energy: 131: -4.3015 eV 164: -4.3750 eV 205: -4.4229 eV 256: -4.4585 eV 320: -4.4861 eV 400: -4.5050 eV Extrapolated energies: 131 - 164: -4.560 eV 164 - 205: -4.544 eV 205 - 256: -4.548 eV 256 - 320: -4.556 eV 320 - 400: -4.553 eV Calculation completed at: Sat Aug 16 03:32:40 2014 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/rpa.rst000066400000000000000000000330221316441372200247610ustar00rootroot00000000000000.. _exercise rpa: ============================================ RPA calculation of the cohesive energy of Si ============================================ In this exercise we will use GPAW to calculate the cohesive energy of silicon. When calculating total energies, we shall split the exchange-correlation energy into an "exact" exchange contribution and calculate the remaining correlation energy in the random-phase approximation (RPA). A comprehesive introduction to the RPA can be found in [Ren]_, and you are also advised to look at :ref:`this page `. .. note:: RPA calculations are typically rather time-consuming, so in this exercise we shall cut a few corners! We obtain the cohesive energy `E_\text{coh}` of silicon as .. math:: E_\text{coh} = E_\text{at} - 0.5 E_\text{bulk} where `E_\text{at}` is the total energy of an isolated silicon atom, and `E_\text{bulk}` is the total energy per primitive unit cell of bulk silicon. Do you know where the factor of 0.5 comes from? In DFT, we partition the total energy as .. math:: E_\text{DFT} = E_\text{Kin} + E_\text{ie} + E_\text{ii} + E_\text{Hartree} + E_\text{XC} The purpose of this exercise is to explore different approximations for the exchange-correlation energy, `E_\text{XC}`. PBE cohesive energy - bulk ========================== We start with a generalized-gradient approximation to `E_\text{XC}` using the PBE functional: .. math:: E_\text{XC} = E_\text{PBE} The script :download:`si.pbe.py` calculates the total energy of bulk silicon. The only parameters we need to choose are the plane-wave cutoff (i.e. number of plane waves in our basis set to describe the electron wavefunctions), the k-point sampling of the Brillouin zone, and the lattice parameter of Si. We could calculate the lattice parameter ourselves from first principles, but in order to compare to previous calculations, we instead choose the experimental value of 5.421 Ang [Harl]_. Make sure you understand what the script is doing, and then try running it. Note that the calculation is not very heavy (it should take less than a minute on a single CPU). This reflects the fact that PBE is a (semi)-local functional of the density, and also that even with a high plane-wave cutoff, the small unit cell means we do not end up requiring many plane-waves to describe the system. PBE cohesive energy - atom ========================== To complete the calculation of the cohesive energy, we need the total energy of an isolated Si atom. In contrast to the bulk case, these calculations are expensive even with the PBE functional. The reason is that our calculations use periodic boundary conditions, leading to unphysical interactions between replicas of the isolated atom. We can effectively remove this interaction placing the atom in a cubic unit cell of side length `L`, and increase `L` until the replicas no longer see each other. Unfortunately, the larger the value of `L`, the more plane waves we have, which slows down the calculation considerably. Therefore, for the purpose of this exercise, we shall not actually perform the calculations on the isolated Si atom - instead just provide the numbers as reference data. In the next section a sample script will be given to show how to generate the following numbers: ======== =================== `L(\AA)` `E_\text{PBE}` (eV) ======== =================== 6.0 -0.664402266578 7.0 -0.778484948334 8.0 -0.82500272946 9.0 -0.841856681349 10.0 -0.848092042293 11.0 -0.850367362642 12.0 -0.85109735188 ======== =================== The first column gives the side length (in Angstroms) of the simulation cell containing the isolated atom, and the second gives the total energy in eV. From the above data and your own calculations, calculate the cohesive energy of silicon using the PBE functional to describe exchange-correlation. Compare your result to the value of 4.55 eV reported in [Olsen]_. .. note:: The total energy delivered by GPAW is not an absolute value, but rather given with respect to a reference energy. It turns out that in this case, the reference energies cancel when calculating the cohesive energy, so we can forget about it here. If in doubt, you can look for the line "reference = ... in the GPAW output file. EXX\@PBE cohesive energy - bulk =============================== We now try a different approximation for the exchange-correlation energy, which is .. math:: E_\text{XC} = E_\text{EXX} An expression for the exact exchange energy `E_\text{EXX}` can be found e.g. in equation (9) of [Olsen]_. The main points to note are that: * it is fully nonlocal - to get the energy we must integrate over `\mathbf{r}` and `\mathbf{r}'`, which is expensive. * it requires knowledge of the wavefunctions, not just the density, which again makes it more expensive to compute. * in the formalism used here we calculate `E_\text{EXX}` non-self-consistently; that is, we use one approximation for the exchange-correlation energy (PBE) to obtain the wavefunctions, then use these wavefunctions to construct the exchange energy under a different approximation. As a result, this method is described as EXX\@PBE; had we used LDA to obtain the wavefunctions, we would have EXX\@LDA etc. * How might a self-consistent calculation of the exchange energy compare to the Hartree-Fock method? In order to obtain `E_\text{EXX}` from GPAW, we need to import the ``EXX`` class from ``exx.py`` in our script. The ``calculate`` method performs the calculation of the exchange energy, while the ``get_total_energy`` method returns the total energy of our system with `E_\text{XC}=E_\text{EXX}`. The script :download:`si.pbe+exx.py` calculates the total energy of bulk Si in the EXX\@PBE approximation. The calculation proceeds in two parts - first, a PBE calculation which is identical to that of the previous section. Second, the exchange part. This part is much slower, and it is a good idea to run on a few processors - it takes about 5 minutes on 4 CPUs. The output file ``si.pbe+exx.exx_output.txt`` gives the details of the exchange calculation and a breakdown of the exchange energy in terms of the contributions from the core and valence electrons. However for the purpose of calculating the cohesive energy the quantity returned by the ``get_total_energy`` method and printed in ``si.pbe+exx.results.txt`` is more useful. EXX\@PBE cohesive energy - atom =============================== As before, we also need the energy of the isolated atom. Look at (but don't run!) the script :download:`atom/si.atom.pbe+exx.py`, which returns the following output in ``pbe_and_exx_energies.txt``:: #Box_side_length(A) PBE_total_energy(eV) PBE+EXX_total_energy(eV) 6.0 -0.665810338359 9.88551793188 7.0 -0.779861449204 9.79892076652 8.0 -0.825944184466 9.76642864072 9.0 -0.843144851642 9.75592425952 10.0 -0.849110419847 9.7528049568 11.0 -0.851370368753 9.7518000647 12.0 -0.852243293624 9.75141580104 13.0 -0.852570610869 9.75125973558 Note that :download:`atom/si.atom.pbe+exx.py` also contains some additional tweaking not required for the bulk calculation, most importantly spin-polarization; by Hund's rules, we expect a spin-polarized atom to be more stable than the non-spin-polarized case. You now have enough information to calculate the cohesive energy in the EXX\@PBE approximation. Compare your value to that of 2.82 eV given in [Olsen]_. This number is dramatically different to the experimental value of 4.68 eV, and highlights the danger of neglecting correlation in solids! (RPA+EXX)\@PBE cohesive energy - bulk ===================================== Finally, we calculate `E_\text{XC}` including the correlation energy in the RPA: .. math:: E_\text{XC} = E_\text{EXX} + E_\text{RPA} An expression for `E_\text{RPA}` is given as equation (8) in [Olsen]_. The main ingredient here is the response function `\chi_0`, which is nonlocal, energy dependent and constructed from a sum of an infinite number of unoccupied electronic states. Therefore like GW calculations, RPA calculations are expensive to perform. We also note that, like for exact exchange, we construct `\chi_0` non-self-consistently, here using the wavefunctions and eigenvalues obtained with the PBE functional. The good news however is that compared to exact exchange calculations, the RPA correlation energy tends to converge faster with respect to the number of k-points and also the number of plane waves used to describe `\chi_0`, so we can use a lighter computational setup. Furthermore, there exists an empirical fix to the problem of the unoccupied states which turns out to work rather well (more details below). Like for exact exchange, the first part of our RPA calculation is performed at the PBE level to obtain the ground state density. We then use this density to obtain the wavefunctions both of the occupied and some of the unoccupied states. The script :download:`si.rpa_init_pbe.py` performs this step; note it is essentially identical to :download:`si.pbe.py` apart from the all-important ``diagonalize_full_hamiltonian`` line. However note that we have reduced the k-point grid to a 4x4x4 sampling. Having performed this step (which should take ~1 minute on 4 CPUs) we now calculate the correlation energy using :download:`si.rpa.py`, which imports the ``RPACorrelation`` class from ``rpa.py``. All the computational details are read from the ``bulk.gpw`` file; the only input we need specify is the number of plane waves used to describe `\chi_0`. Here we give a list of values, which means that the correlation energy will be calculated for each plane-wave cutoff (in eV). The reason for this procedure is described below. Note that in principle we also need to specify the number of unoccupied bands used in the construction of `\chi_0` - however here this choice is made by the code, and sets the number of bands to equal the number of plane waves describing `\chi_0`. Now, run :download:`si.rpa.py` (4 minutes, 4 CPUs). Studying the output file ``si.rpa.rpa_output.txt``, we see that the code calculates the contribution from each q point sequentially. In fact by specifying the ``filename`` attribute of the ``RPACorrelation`` object we can generate a restart file which allows GPAW to pick up from an interrupted calculation. Once the contributions from all the q points have been calculated, they are summed together with the appropriate q-point weights to construct the correlation energy. The correlation energy for each plane-wave cutoff is printed near the end of the output file, under ``Total correlation energy``. You should see that changing the plane wave cutoff from 80 to 164 eV changes the correlation energy by over 1 eV. (RPA+EXX)\@PBE cohesive energy - convergence ============================================ In order to converge the correlation energy, we should increase the plane-wave cutoff describing `\chi_0` (and implicitly, the number of empty states). However it is noted in [Harl]_ that for the electron gas, one expects the correlation energy to scale as .. math:: E_\text{RPA}(E_{cut}) = E_\text{RPA}(\infty) + A E_{cut}^{-1.5} where `E_{cut}` is the plane-wave cutoff describing `\chi_0`. Empirically, this expression seems to work beyond the electron gas. Test this expression for silicon by plotting the correlation energy against `E_{cut}^{-1.5}`; the intercept of the straight line should give `E_\text{RPA}(\infty)`. GPAW tries to guess this intercept by extrapolating straight lines between pairs of points, and outputs the result under ``Extrapolated energies``. How do they compare to your result? (RPA+EXX)\@PBE cohesive energy - atom ===================================== The corresponding scripts for the isolated atom are :download:`atom/si.atom.rpa_init_pbe.py` and :download:`atom/si.atom.rpa.py`. Note how, thanks to the large simulation cell, we end up requiring almost 10000 bands for the calculation; that's a lot of effort for a single atom! The reference output file is :download:`atom/si.atom.rpa_output.txt`. Use the data in this output file to obtain the extrapolated correlation energy for the single atom. Combining the correlation energies with the EXX\@PBE calculations of the previous section, you should now be able to calculate the cohesive energy of silicon using exact exchange and the RPA correlation energy. * Compare the result of using the extrapolated correlation energies with that at a fixed cutoff of 164 eV. * Compare your value to that of 4.32 eV given in [Olsen]_ and the experimental value, 4.68 eV. Conclusions =========== After all that work, it seems that the method that gave us the cohesive energy closest to experiment turns out to be the simplest we tried - the generalized-gradient PBE functional. Indeed, according to table VII of [Harl]_, PBE outperforms EXX and RPA for a wide range of materials. The strength of the RPA lies in its ability to describe long-range correlation effects, e.g. in systems exhibiting van der Waals bonds. Unfortunately, the complexity of these systems does not allow us to study them in a quick exercise like this one. Nonetheless the procedure of calculating the total energy employed above is exactly the same when applied to more complicated systems. In order to get a consistent, high-quality description of both long-range and short-range correlation it is desirable to move beyond the RPA - but that's another story... References ========== .. [Ren] Ren et al., J. Mater. Sci. 47, 7447 (2012) .. [Harl] Harl, Schimka and Kresse, Phys. Rev. B 81, 115126 (2010) .. [Olsen] Olsen and Thygesen, Phys. Rev. B 87, 075111 (2013) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/si.pbe+exx.py000066400000000000000000000021641316441372200260020ustar00rootroot00000000000000from ase.build import bulk from gpaw import GPAW, FermiDirac from gpaw.wavefunctions.pw import PW from gpaw.xc.exx import EXX from ase.parallel import paropen resultfile = paropen('si.pbe+exx.results.txt', 'a') # Plane wave cutoff pwcutoff = 400.0 # NxNxN k-point sampling, gamma-centred grid k = 6 # Si lattice constant alat = 5.421 # Do the bulk calculation bulk_crystal = bulk('Si', 'diamond', a=alat) bulk_calc = GPAW(mode=PW(pwcutoff), kpts={'size': (k, k, k), 'gamma': True}, xc='PBE', occupations=FermiDirac(0.01), txt='si.pbe+exx.pbe_output.txt', parallel={'band': 1} ) bulk_crystal.set_calculator(bulk_calc) e0_bulk_pbe = bulk_crystal.get_potential_energy() # Write to file bulk_calc.write('bulk.gpw', mode='all') # Now the exact exchange exx_bulk = EXX('bulk.gpw', txt='si.pbe+exx.exx_output.txt') exx_bulk.calculate() e0_bulk_exx = exx_bulk.get_total_energy() s = str(alat) s += ' ' s += str(k) s += ' ' s += str(pwcutoff) s += ' ' s += str(e0_bulk_pbe) s += ' ' s += str(e0_bulk_exx) s += '\n' resultfile.write(s) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/si.pbe.py000066400000000000000000000012201316441372200251720ustar00rootroot00000000000000from ase.build import bulk from gpaw import GPAW, FermiDirac from gpaw.wavefunctions.pw import PW pwcutoff = 400.0 # Plane wave cutoff k = 6 # NxNxN k-point sampling, gamma-centred grid alat = 5.421 # Si lattice constant # Do the bulk calculation bulk_crystal = bulk('Si', 'diamond', a=alat) bulk_calc = GPAW(mode=PW(pwcutoff), kpts={'size': (k, k, k), 'gamma': True}, xc='PBE', txt='si.pbe_output.txt', parallel={'band': 1}, occupations=FermiDirac(0.01) ) bulk_crystal.set_calculator(bulk_calc) e0_bulk_pbe = bulk_crystal.get_potential_energy() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/si.rpa.py000066400000000000000000000002531316441372200252130ustar00rootroot00000000000000from gpaw.xc.rpa import RPACorrelation rpa1 = RPACorrelation('bulk.all.gpw', txt='si.rpa.rpa_output.txt') E1_i = rpa1.calculate(ecut=[164.0, 140.0, 120.0, 100.0, 80.0]) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/rpa/si.rpa_init_pbe.py000066400000000000000000000016461316441372200270730ustar00rootroot00000000000000from ase.build import bulk from gpaw import GPAW, FermiDirac from gpaw.wavefunctions.pw import PW # Plane wave cutoff pwcutoff = 400.0 # NxNxN k-point sampling k = 4 # Si lattice constant alat = 5.421 # bulk calculation bulk_crystal = bulk('Si', 'diamond', a=alat) bulk_calc = GPAW(mode=PW(pwcutoff), kpts={'size': (k, k, k), 'gamma': True}, # gamma-centred grid xc='PBE', occupations=FermiDirac(0.01), txt='si.rpa.pbe_output.txt', parallel={'band': 1}) bulk_crystal.set_calculator(bulk_calc) e0_bulk_pbe = bulk_crystal.get_potential_energy() # Now we have the density, but only the occupied states; # at this point we diagonalise the full Hamiltonian to get # the empty states as well (expensive) bulk_calc.diagonalize_full_hamiltonian(nbands=200) # the 'all' ensures we write wavefunctions too bulk_calc.write('bulk.all.gpw', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/runall.py000066400000000000000000000027761316441372200245460ustar00rootroot00000000000000import os import sys import pylab n = 1 def show(): global n pylab.savefig('x%d.png' % n) n += 1 pylab.show = show if 0: def view(*args, **kwargs): return import ase ase.view = view os.system('rm -rf test; mkdir test') os.chdir('test') for dir, script in [ ('neb', 'neb1.py'), ('aluminium', 'Al_fcc.py'), ('aluminium', 'Al_fcc_convergence.py'), ('surface', 'Al100.py'), ('surface', 'work_function.py'), ('diffusion', 'initial.py'), ('diffusion', 'solution.py'), ('diffusion', 'densitydiff.py'), ('vibrations', 'h2o.py'), ('vibrations', 'H2O_vib.py'), ('iron', 'ferro.py'), ('iron', 'anti.py'), ('iron', 'non.py'), ('iron', 'PBE.py'), ('band_structure', 'Na_band.py'), ('band_structure', 'plot_band.py'), ('wannier', 'si.py'), ('wannier', 'wannier-si.py'), ('wannier', 'benzene.py'), ('wannier', 'wannier-benzene.py'), ('stm', 'HAl100.py'), ('wavefunctions', 'CO.py'), ('dos', 'pdos.py'), ('lrtddft', 'ground_state.py'), ('transport', 'pt_h2_tb_transport.py'), ('transport', 'pt_h2_lcao.py'), ('transport', 'pt_h2_lcao_transport.py')]: exec(open('../' + dir + '/' + script).read(), {'k': 6, 'N': 5}) for dir, script, args in [ ('stm', 'stm.py', ['HAl100.gpw']), ('dos', 'dos.py', ['Al-fcc.gpw', 'si.gpw', 'CO.gpw', 'ferro.gpw', 'anti.gpw', 'non.gpw'])]: for arg in args: sys.argv = ['', arg] exec(open('../' + dir + '/' + script).read()) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stm/000077500000000000000000000000001316441372200234665ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stm/HAl100.py000066400000000000000000000007711316441372200247320ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW a = 4.0 b = a / 2**0.5 L = 11.0 # Set up 2-layer 2x2 (100) Al-slab: slab = Atoms('Al2', positions=[(0, 0, 0), (b / 2, b / 2, -a / 2)], cell=(b, b, L), pbc=True) slab *= (2, 2, 1) if True: # Add adsorbate: slab += Atoms('H', [(b, b, 1.55)]) slab.center(axis=2) calc = GPAW(mode='pw', kpts=(4, 4, 1)) slab.set_calculator(calc) slab.get_potential_energy() calc.write('HAl100.gpw', 'all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stm/stm.agts.py000066400000000000000000000003211316441372200255740ustar00rootroot00000000000000def agts(queue): job = queue.add('HAl100.py') queue.add('stm.agts.py', ncpus=1, deps=[job]) if __name__ == '__main__': import sys sys.argv = ['', 'HAl100.gpw'] exec(open('stm.py').read()) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stm/stm.py000066400000000000000000000010411316441372200246370ustar00rootroot00000000000000from __future__ import print_function from sys import argv import matplotlib.pyplot as plt from ase.dft import STM from gpaw import restart filename = argv[1] z0 = 8 bias = 1.0 atoms, calc = restart(filename, txt=None) stm = STM(atoms, symmetries=[0, 1, 2]) c = stm.get_averaged_current(bias, z0) print('Average current at z=%f: %f' % (z0, c)) # Get 2d array of constant current heights: x, y, h = stm.scan(bias, c) print('Min: %.2f Ang, Max: %.2f Ang' % (h.min(), h.max())) plt.contourf(x, y, h, 40) plt.hot() plt.colorbar() plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stm/stm.rst000066400000000000000000000015641316441372200250310ustar00rootroot00000000000000=============== STM simulations =============== Scanning Tunneling Microscopy (STM) is a widely used experimental technique. STM maps out a convolution of the geometric and electronic structure of a given surface and it is often difficult if not impossiple to intrepret STM images without the aid of theoretical tools. We will use GPAW to simulate an STM image. Start by doing an Al(100) surface with hydrogen adsorbed in the ontop site: :git:`~doc/exercises/stm/HAl100.py`. This will produce a :file:`gpw` file containing the wave functions that are needed for calculating local density of states. The STM image can be calculated with the :git:`~doc/exercises/stm/stm.py` script:: $ python3 stm.py HAl100.gpw Try the following: * clean slab without hydrogen * different number of layers * different number of **k**-points * different current * negative bias (positive tip) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stress/000077500000000000000000000000001316441372200242065ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stress/con_pw.py000066400000000000000000000011441316441372200260450ustar00rootroot00000000000000from __future__ import print_function from ase import Atoms from ase.build import bulk from gpaw import GPAW from gpaw import PW cell = bulk('Si', 'fcc', a=5.421).get_cell() a = Atoms('Si2', cell=cell, pbc=True, scaled_positions=((0, 0, 0), (0.25, 0.25, 0.25))) for x in [100, 200, 300, 400, 500, 600, 700, 800]: # for x in [0.24, 0.22, 0.20, 0.18, 0.16, 0.14, 0.12, 0.1]: calc = GPAW(mode=PW(x), # h=x, xc='PBE', kpts=(4, 4, 4), txt='convergence_%s.txt' % x) a.set_calculator(calc) print(x, a.get_potential_energy()) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stress/stress.py000066400000000000000000000015711316441372200261070ustar00rootroot00000000000000from __future__ import print_function from ase import Atoms from ase.build import bulk from ase.optimize.bfgs import BFGS from ase.constraints import UnitCellFilter from gpaw import GPAW from gpaw import PW import numpy as np cell = bulk('Si', 'fcc', a=6.0).get_cell() # Experimental Lattice constant is a=5.421 A a = Atoms('Si2', cell=cell, pbc=True, scaled_positions=((0, 0, 0), (0.25, 0.25, 0.25))) calc = GPAW(xc='PBE', mode=PW(400), # mode=PW(400, cell=a.get_cell()), # fix no of planewaves! kpts=(4, 4, 4), # convergence={'eigenstates': 1.e-10}, # converge tightly! txt='stress.txt') a.set_calculator(calc) uf = UnitCellFilter(a) relax = BFGS(uf) relax.run(fmax=0.05) # Consider much tighter fmax! a = np.dot(a.get_cell()[0], a.get_cell()[0])**0.5 * 2**0.5 print('Relaxed lattice parameter: a = %s A' % a) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/stress/stress.rst000066400000000000000000000067101316441372200262670ustar00rootroot00000000000000.. _stress: ========================================================== Plane wave mode and Stress tensor ========================================================== The major advantage of running DFT calculations on a real space grid, is a very efficient parallelization scheme when dealing with large systems. However, for small systems it is often faster to use a plane wave basis set instead. In this case all quantities are represented by their Fourier transforms on the periodic super cell and periodic boundary conditions are required. In grid mode, the key convergence parameter is the grid spacing `h`, whereas in planewave mode the corresponding parameter is `E_{cut}=G_{cut}^2/2` (in atomic units). `G_{cut}` determines the maximum size of reciprocal lattice vectors to be included in the plane wave expansion. Converging the plane wave cutoff ------------------------------------- As a simple example we perform a calculation on bulk Si using the plane wave basis. The following script tests the convergence of the total energy with respect to the cutoff parameter `E_{cut}`. .. literalinclude:: con_pw.py Note that we use a rather rough k-point sampling and the default Fermi smearing of 0.1 eV. These parameters should of course be converged, but for now we will just keep them fixed in order to speed up the calculations. At `E_{cut}` = 400 eV, the total energy is seen to be converged to within 5 meV. Now edit the script such that the calculation is performed in grid mode with various values of the grid spacing (comment out the lines :samp:`for x in [100, ...` and :samp:`mode=PW(x)` and uncomment the lines :samp:`for h in [0.24, ...` and :samp:`h=x`). What grid spacing is needed in order to converge the total energy to within 5 meV? What is the timing of this calculation compared to the one at 400 eV in plane wave mode? Compare the number of grid points and plane waves used in these two calculations respectively (look in the output file 'convergence_400.txt' and the corresponding one for the grid calculation.) You can see how long a calculation took by looking at the times recorded in the .txt file. Optimizing the unit cell ------------------------ **Warning**: due to difficulties in optimizing cell and positions simultaneously :class:`ase.constraints.UnitCellFilter` may produce incorrect results. Always verify obtained structures by means of performing separate cell (see :class:`ase.constraints.StrainFilter`) and positions optimizations (see :mod:`ase.optimize`). Consider much more tighter fmax than the one used in this tutorial! In the :ref:`aluminium_exercise` exercise the lattice constant of bulk Al was found by calculating the total energy at various lattice distances. A nice feature e of the plane wave mode is that it allows a simple implementation of the stress tensor, which can be used to optimize unit unit cells of periodic systems directly. The following script performs such an optimization for bulk Si. .. literalinclude:: stress.py The calculation uses 12 iterations to find the optimal lattice constant and the relaxation can be viewed with the command line tool :program:`ase`: .. highlight:: bash :: $ ase gui stress.txt Since we know the experimental lattice constant, we could probably have calculated the PBE lattice constant faster by fitting a parabola to five points in the vicinity of the expermental lattice constant. However, for complicated unit cells with more than one lattice parameter, the stress tensor becomes a highly valuable tool. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/submit.agts.py000066400000000000000000000031671316441372200255040ustar00rootroot00000000000000def agts(queue): queue.add('water/h2o.py', ncpus=1) queue.add('wavefunctions/CO.py', ncpus=8) queue.add('aluminium/Al_fcc.py', ncpus=2) queue.add('aluminium/Al_bcc.py', ncpus=2) queue.add('aluminium/Al_fcc_vs_bcc.py', ncpus=2) queue.add('aluminium/Al_fcc_modified.py', ncpus=2) queue.add('diffusion/initial.py', ncpus=2) sol = queue.add('diffusion/solution.py', ncpus=2) queue.add('diffusion/densitydiff.py', deps=[sol]) si = queue.add('wannier/si.py', ncpus=8) queue.add('wannier/wannier-si.py', deps=[si]) benzene = queue.add('wannier/benzene.py', ncpus=8) queue.add('wannier/wannier-benzene.py', deps=[benzene]) band = queue.add('band_structure/ag.py', ncpus=1, creates='Ag.png') h2o = queue.add('vibrations/h2o.py', ncpus=8) h2ovib = queue.add('vibrations/H2O_vib.py', ncpus=8, deps=[h2o]) queue.add('vibrations/H2O_vib_2.py', ncpus=4, deps=[h2ovib]) ferro = queue.add('iron/ferro.py', ncpus=4) anti = queue.add('iron/anti.py', ncpus=4) non = queue.add('iron/non.py', ncpus=2) queue.add('iron/PBE.py', deps=[ferro, anti, non]) queue.add('eels/test.py', deps=band) queue.add('gw/test.py') rpa_si_exxgs = queue.add('rpa/si.pbe.py') queue.add('rpa/si.pbe+exx.py', deps=rpa_si_exxgs, ncpus=4) rpa_si_rpags = queue.add('rpa/si.rpa_init_pbe.py') queue.add('rpa/si.rpa.py', deps=rpa_si_rpags, ncpus=4) queue.add('stress/con_pw.py', ncpus=1) queue.add('stress/stress.py', ncpus=1) queue.add('transport/pt_h2_tb_transport.py') t1 = queue.add('transport/pt_h2_lcao_manual.py') queue.add('transport/pt_h2_lcao_transport.py', deps=t1) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/000077500000000000000000000000001316441372200243135ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/Al100.py000066400000000000000000000006271316441372200254470ustar00rootroot00000000000000from gpaw import GPAW from ase.build import fcc100 def energy(N, k, a=4.05): fcc = fcc100('Al', (1, 1, N), a=a, vacuum=7.5) fcc.center(axis=2) calc = GPAW(nbands=N * 3, kpts=(k, k, 1), h=0.25, txt='slab-%d.txt' % N) fcc.set_calculator(calc) e = fcc.get_potential_energy() calc.write('slab-%d.gpw' % N) return e e = energy(N, k) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/build_bcc.py000066400000000000000000000015271316441372200266000ustar00rootroot00000000000000"""Module for building atomic structures""" from ase import Atom, Atoms def bcc100(symbol, a, layers, L): """Build a bcc(100) surface symbol: chemical symbol ('H', 'Li', ...) a : lattice constant layers: number of layers L : height of unit cell""" a = float(a) # Distance between layers: z = a / 2 assert L > layers * z, 'Unit cell too small!' # Start with an empty Atoms object with an orthorhombic unit cell: atoms = Atoms(pbc=(True, True, False), cell=(a, a, L)) # Fill in the atoms: for n in range(layers): position = [a / 2 * (n % 2), a / 2 * (n % 2), n * z] atoms.append(Atom(symbol, position)) atoms.center(axis=2) return atoms if __name__ == '__main__': bcc = bcc100('Al', 4.0, 4, 15.0) from ase.visualize import view view(bcc * (4, 4, 2)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/build_fcc.py000066400000000000000000000017761316441372200266120ustar00rootroot00000000000000"""Module for building atomic structures""" from math import sqrt from ase import Atoms, Atom from ase.visualize import view def fcc100(symbol, a, layers, L): """Build an fcc(100) surface Parameters ---------- symbol: string Chemical symbol ('H', 'Li', ...). a: float Lattice constant. layers: int Number of layers. L: float Height of unit cell. """ # Distance between atoms: d = a / sqrt(2) # Distance between layers: z = a / 2. assert L > layers * z, 'Unit cell too small!' # Start with an empty Atoms object: atoms = Atoms(cell=(d, d, L), pbc=(True, True, False)) # Fill in the atoms: for n in range(layers): position = [d / 2 * (n % 2), d / 2 * (n % 2), n * z] atoms.append(Atom(symbol, position)) atoms.center(axis=2) return atoms if __name__ == '__main__': fcc = fcc100('Al', 4.0, 4, 15.0) view(fcc * (4, 4, 2)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/surface.agts.py000066400000000000000000000002751316441372200272560ustar00rootroot00000000000000def agts(queue): al = queue.add('surface.agts.py') queue.add('work_function.py', ncpus=1, deps=[al]) if __name__ == '__main__': exec(open('Al100.py').read(), {'k': 6, 'N': 5}) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/surface.rst000066400000000000000000000064271316441372200265060ustar00rootroot00000000000000=============================== Setting up an aluminium surface =============================== In this exercise, we build an Al(100) surface. For this surface, we calculate the surface energy and other properties. Fcc Surfaces ============ A real fcc surface has a large number of atomic layers, but most surface properties are well reproduced by a slab with just 2 - 20 layers, depending on the material and what properties you are looking for. The most important cubic surfaces are (100), (110), and (111). For face centered cubic, (111) has the most compact atomic arrangement, whereas (110) is most open. Here we'll focus on (100). * What is the coordination number *Z* (number of nearest neighbors) of an fcc(100) surface atom? What is it for a bulk atom? Start the Python interpreter and try this:: from ase.visualize import view from ase.build import fcc100 s = fcc100('Al', (1, 1, 5)) view(s, repeat=(4, 4, 1)) Read more here: :func:`ase.build.fcc100`. * Answer the same questions for the (111) surface. Aluminum fcc(100) surface energetics ==================================== One surface property is the surface tension `\sigma` defined implicitly via: .. math:: E_N = 2A\sigma + NE_B where `E_N` is the total energy of a slab with `N` layers, `A` the area of the surface unit cell (the factor 2 because the slab has two surfaces), and finally `E_B` is the total energy per bulk atom. The limit `N \rightarrow \infty` corresponds to the macroscopic crystal termination. Estimate the surface tension using an expression from the simplest Effective Medium Theory (EMT) description: .. math:: A\sigma \simeq [1 - (Z/Z_0)^{1/2}] E_{coh} where `Z` and `Z_0` are the coordination numbers (number of nearest neighbors) of a surface and a bulk atom, respectively, and `A` is the surface area per surface atom, and `E_{coh} = E_{atom}-E_B > 0` is the cohesive energy per bulk atom. For Aluminium we have `E_{coh}` = 3.34 eV. * Derive the following equation: .. math:: \sigma = \frac{NE_{N-1} - (N-1)E_N}{2A} * The script :git:`~doc/exercises/surface/Al100.py` defines an ``energy()`` function for calculating `E_N`. Use it to calculate `\sigma` for `N` = 5. Use a two-dimensional Monkhorst-Pack **k**-point sampling (``kpts=(k, k, 1)``) that matches the size of your unit cell. .. hint:: A rule of thumb for choosing the initial **k**-point sampling is, that the product, *ka*, between the number of **k**-points, *k*, in any direction, and the length of the basis vector in this direction, *a*, should be: * *ka* ~ 30 Å, for *d* band metals * *ka* ~ 25 Å, for simple metals * *ka* ~ 20 Å, for semiconductors * *ka* ~ 15 Å, for insulators Remember that convergence in this parameter should always be checked. * How well is the EMT estimate satisfied? .. note:: The experimental value of `\sigma` is 54 meV/Å\ :sup:`2`. However, this was obtained from the curvature of an aluminium drop and is more likely to represent the value for a closepacked Al(111) surface. Work function ============= Run the :git:`~doc/exercises/surface/work_function.py` script and estimate the work function for a Al(100) surface (this script does not run in parallel). A typical experimental value for the work function of the Al(100) surface is 4.20 eV. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/surface_tension.py000066400000000000000000000010001316441372200300430ustar00rootroot00000000000000from __future__ import print_function from gpaw.io.array import load_array N, E = load_array('e6x6.dat', transpose=True) A = 4.05**2 / 2 Ecoh = 3.34 sigma_emt = (1 - (8 / 12.)**.5) * Ecoh / A sigma_dft = (N[1:] * E[:-1] - N[:-1] * E[1:]) / (2 * A) print('EMT: %4.1f meV/A**2' % (sigma_emt * 1000)) for n, s in zip(N[1:], sigma_dft): print(' %i %6.1f meV/A**2' % (n, s * 1000)) # EMT: 74.7 meV/A**2 # 2 77.2 meV/A**2 # 3 115.2 meV/A**2 # 4 60.1 meV/A**2 # 5 43.4 meV/A**2 # 6 101.3 meV/A**2 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/surface/work_function.py000066400000000000000000000014351316441372200275570ustar00rootroot00000000000000from __future__ import print_function import numpy as np import pylab as plt from gpaw import GPAW # Read in the 5-layer slab: calc = GPAW('slab-5.gpw', txt=None) slab = calc.get_atoms() # Get the height of the unit cell: L = slab.get_cell()[2, 2] # Get the effective potential on a 3D grid: v = calc.get_effective_potential() nx, ny, nz = v.shape z = np.linspace(0, L, nz, endpoint=False) efermi = calc.get_fermi_level() # Calculate xy averaged potential: vz = v.mean(axis=0).mean(axis=0) print('Work function: %.2f eV' % (vz.max() - efermi)) plt.plot(z, vz, label='xy averaged effective potential') plt.plot([0, L], [efermi, efermi], label='Fermi level') plt.ylabel('Potential / V') plt.xlabel('z / Angstrom') plt.legend(loc=0) # plt.savefig('workfunction.png', format='png') plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/transport/000077500000000000000000000000001316441372200247175ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/transport/pt_h2.py000066400000000000000000000012251316441372200263050ustar00rootroot00000000000000# creates: pt_h2.png from ase import Atoms from ase.io import write a = 2.41 # Pt binding length b = 0.90 # H2 binding length c = 1.70 # Pt-H binding length L = 7.00 # width of unit cell # Setup the Atoms for the scattering region. atoms = Atoms('Pt5H2Pt5', cell=[3 * a + b + 2 * c, L, L], pbc=True) atoms.positions[:5, 0] = [(i - 2.5) * a for i in range(5)] atoms.positions[-5:, 0] = [(i - 2.5) * a + b + 2 * c for i in range(4, 9)] atoms.positions[5:7, 0] = [1.5 * a + c, 1.5 * a + c + b] atoms.positions[:, 1:] = L / 2. write('pt_h2.pov', atoms, show_unit_cell=2, transparent=False, display=False, run_povray=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/transport/pt_h2_lcao_manual.py000066400000000000000000000056151316441372200306470ustar00rootroot00000000000000#!/usr/bin/env python """Transport exersice This file should do the same as pt_h2_lcao.py, but extracts the Hamiltonians manually instead of using gpawtransport, which currently does not work """ from ase import Atoms from gpaw import GPAW, Mixer, FermiDirac from gpaw.lcao.tools import remove_pbc, get_lcao_hamiltonian, get_lead_lcao_hamiltonian import pickle as pickle a = 2.41 # Pt binding length b = 0.90 # H2 binding length c = 1.70 # Pt-H binding length L = 7.00 # width of unit cell ##################### # Scattering region # ##################### # Setup the Atoms for the scattering region. atoms = Atoms('Pt5H2Pt5', pbc=(1, 0, 0), cell=[9 * a + b + 2 * c, L, L]) atoms.positions[:5, 0] = [i * a for i in range(5)] atoms.positions[-5:, 0] = [i * a + b + 2 * c for i in range(4, 9)] atoms.positions[5:7, 0] = [4 * a + c, 4 * a + c + b] atoms.positions[:, 1:] = L / 2. # Attach a GPAW calculator calc = GPAW(h=0.3, xc='PBE', basis='szp(dzp)', occupations=FermiDirac(width=0.1), kpts=(1, 1, 1), mode='lcao', txt='pt_h2_lcao_scat.txt', mixer=Mixer(0.1, 5, weight=100.0), symmetry={'point_group': False, 'time_reversal': False}) atoms.set_calculator(calc) atoms.get_potential_energy() # Converge everything! Ef = atoms.calc.get_fermi_level() H_skMM, S_kMM = get_lcao_hamiltonian(calc) # Only use first kpt, spin, as there are no more H, S = H_skMM[0, 0], S_kMM[0] H -= Ef * S remove_pbc(atoms, H, S, 0) # Dump the Hamiltonian and Scattering matrix to a pickle file pickle.dump((H.astype(complex), S.astype(complex)), open('scat_hs.pickle', 'wb'), 2) ######################## # Left principal layer # ######################## # Use four Pt atoms in the lead, so only take those from before atoms = atoms[:4].copy() atoms.set_cell([4 * a, L, L]) # Attach a GPAW calculator calc = GPAW(h=0.3, xc='PBE', basis='szp(dzp)', occupations=FermiDirac(width=0.1), kpts=(4, 1, 1), # More kpts needed as the x-direction is shorter mode='lcao', txt='pt_h2_lcao_llead.txt', mixer=Mixer(0.1, 5, weight=100.0), symmetry={'point_group': False, 'time_reversal': False}) atoms.set_calculator(calc) atoms.get_potential_energy() # Converge everything! Ef = atoms.calc.get_fermi_level() ibz2d_k, weight2d_k, H_skMM, S_kMM = get_lead_lcao_hamiltonian(calc) # Only use first kpt, spin, as there are no more H, S = H_skMM[0, 0], S_kMM[0] H -= Ef * S # Dump the Hamiltonian and Scattering matrix to a pickle file pickle.dump((H, S), open('lead1_hs.pickle', 'wb'), 2) ######################### # Right principal layer # ######################### # This is identical to the left prinicpal layer so we don't have to do anything # Just dump the same Hamiltonian and Scattering matrix to a pickle file pickle.dump((H, S), open('lead2_hs.pickle', 'wb'), 2) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/transport/pt_h2_lcao_transport.py000066400000000000000000000052651316441372200314270ustar00rootroot00000000000000from __future__ import print_function from ase.transport.calculators import TransportCalculator import numpy as np import pickle import pylab # Principal layer size # Uncomment this line if going back to gpawtransport again # pl = 4 * 9 # 9 is the number of bf per Pt atom (basis=szp), see below # Read in the hamiltonians h, s = pickle.load(open('scat_hs.pickle', 'rb')) # Uncomment this line if going back to gpawtransport again # h, s = h[pl:-pl, pl:-pl], s[pl:-pl, pl:-pl] h1, s1 = pickle.load(open('lead1_hs.pickle', 'rb')) h2, s2 = pickle.load(open('lead2_hs.pickle', 'rb')) tcalc = TransportCalculator(h=h, h1=h1, h2=h2, # hamiltonian matrices s=s, s1=s1, s2=s2, # overlap matrices align_bf=1) # align the Fermi levels # Calculate the conductance (the energy zero corresponds to the Fermi level) tcalc.set(energies=[0.0]) G = tcalc.get_transmission()[0] print('Conductance: %.2f 2e^2/h' % G) # Determine the basis functions of the two Hydrogen atoms and subdiagonalize Pt_N = 5 # Number of Pt atoms on each side in the scattering region Pt_nbf = 15 # number of bf per Pt atom (basis=szp) H_nbf = 4 # number of bf per H atom (basis=szp) bf_H1 = Pt_nbf * Pt_N bfs = range(bf_H1, bf_H1 + 2 * H_nbf) h_rot, s_rot, eps_n, vec_jn = tcalc.subdiagonalize_bfs(bfs) for n in range(len(eps_n)): print("bf %i corresponds to the eigenvalue %.2f eV" % (bfs[n], eps_n[n])) # Switch to the rotated basis set tcalc.set(h=h_rot, s=s_rot) # plot the transmission function tcalc.set(energies=np.arange(-8, 4, 0.1)) T = tcalc.get_transmission() pylab.plot(tcalc.energies, T) pylab.title('Transmission function') pylab.show() # ... and the projected density of states (pdos) of the H2 molecular orbitals tcalc.set(pdos=bfs) pdos_ne = tcalc.get_pdos() pylab.plot(tcalc.energies, pdos_ne[0], label='bonding') pylab.plot(tcalc.energies, pdos_ne[1], label='anti-bonding') pylab.title('Projected density of states') pylab.legend() pylab.show() # Cut the coupling to the anti-bonding orbital. print('Cutting the coupling to the renormalized molecular state at %.2f eV' % ( eps_n[1])) h_rot_cut, s_rot_cut = tcalc.cutcoupling_bfs([bfs[1]]) tcalc.set(h=h_rot_cut, s=s_rot_cut) pylab.plot(tcalc.energies, tcalc.get_transmission()) pylab.title('Transmission without anti-bonding orbital') pylab.show() # Cut the coupling to the bonding-orbital. print('Cutting the coupling to the renormalized molecular state at %.2f eV' % ( eps_n[0])) tcalc.set(h=h_rot, s=s_rot) h_rot_cut, s_rot_cut = tcalc.cutcoupling_bfs([bfs[0]]) tcalc.set(h=h_rot_cut, s=s_rot_cut) pylab.plot(tcalc.energies, tcalc.get_transmission()) pylab.title('Transmission without bonding orbital') pylab.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/transport/pt_h2_tb_transport.py000066400000000000000000000035671316441372200311210ustar00rootroot00000000000000from __future__ import print_function import numpy as np from ase.transport.calculators import TransportCalculator import pylab # onsite energies 0.0, nearest neighbor hopping -1.0, and # second nearest neighbor hopping 0.2 H_lead = np.array([[0., -1., 0.2, 0.], [-1., 0., -1., 0.2], [0.2, -1., 0., -1.], [0., 0.2, -1., 0.]]) H_scat = np.zeros((6, 6)) # Principal layers on either side of S H_scat[:2, :2] = H_scat[-2:, -2:] = H_lead[:2, :2] # Scattering region (hydrogen molecule) - onsite 0.0 and hopping -0.8 H_scat[2:4, 2:4] = [[0.0, -0.8], [-0.8, 0.0]] # coupling to the leads - nearest neighbor only H_scat[1, 2] = H_scat[2, 1] = H_scat[3, 4] = H_scat[4, 3] = 0.2 tcalc = TransportCalculator(h=H_scat, # Scattering Hamiltonian h1=H_lead, # Lead 1 (left) h2=H_lead, # Lead 2 (right) energies=np.arange(-3, 3, 0.02)) T_e = tcalc.get_transmission() pylab.plot(tcalc.energies, T_e) pylab.title('Transmission function') pylab.show() tcalc.set(pdos=[2, 3]) pdos_ne = tcalc.get_pdos() pylab.plot(tcalc.energies, pdos_ne[0], ':') pylab.plot(tcalc.energies, pdos_ne[1], '--') pylab.title('Projected density of states') pylab.show() h_rot, s_rot, eps_n, vec_nn = tcalc.subdiagonalize_bfs([2, 3]) tcalc.set(h=h_rot, s=s_rot) # Set the rotated matrices for n in range(2): print("eigenvalue, eigenvector:", eps_n[n], ',', vec_nn[:, n]) pdos_rot_ne = tcalc.get_pdos() pylab.plot(tcalc.energies, pdos_rot_ne[0], ':') pylab.plot(tcalc.energies, pdos_rot_ne[1], '--') pylab.title('Projected density of states (rotated)') pylab.show() h_cut, s_cut = tcalc.cutcoupling_bfs([2]) tcalc.set(h=h_cut, s=s_cut) T_cut_bonding_e = tcalc.get_transmission() pylab.plot(tcalc.energies, T_cut_bonding_e) pylab.title('Transmission (bonding orbital cut)') pylab.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/transport/transport.rst000066400000000000000000000172731316441372200275170ustar00rootroot00000000000000.. _transport_exercise: ================== Electron transport ================== This exercise shows how to use the ase transport module for performing electron transport calculations in nanoscale contacts. :class:`~ase.transport.calculators.TransportCalculator` is used to calculate transmission functions at two different levels, namely: * Tight-binding (TB) description: parametrize the system using tight-binding model. * DFT description: extract realistic description of the system using the GPAW DFT-LCAO mode. First-time users of the ASE transport module, should start by reading the methodology in the :mod:`ASE manual `. Recent experiments suggests that a hydrogen molecule trapped between metal electrodes has a conductance close to the quantum unit of conductance (`1G_0=2e^2/h`). As a manageable model for this system, we consider a hydrogen molecule sandwiched between semi-infinite one dimensional Pt leads as shown in the figure below . . . |setup| . . . .. |setup| image:: pt_h2.png :align: middle This is the system considered in the rest of the exercise. Tight-binding description ========================= In this part of the exercise, we illustrate the use of the ASE transport module, by means of a simple tight-binding (TB) model for the Pt-H2-Pt system, with only one TB site per atom. The script can be found here: :download:`pt_h2_tb_transport.py`. Below we will walk through the script. As explained in the :mod:`ASE manual `, we need need to define a principal layer, and a scattering region. To be able to describe second nearest neighbor hopping, we choose a principal layer of two Pt atoms. The scattering region is chosen minimal: i.e. the molecule plus one principal layer on each side, as marked with a square on the figure above. To describe both the principal layer and the coupling between such layers (which is also the coupling from the leads into the scattering region), we define a lead Hamiltonian consisting of two principal layers + coupling: .. math:: H_\text{lead} = \begin{pmatrix} H_L & V \\ V^\dagger & H_{L} \end{pmatrix} Assuming an onsite energy equal to the fermi energy, a nearest neighbor hopping energy of -1, and second nearest neighbor hopping of 0.2, the lead Hamiltonian may be constructed like this:: import numpy as np H_lead = np.array([[ 0. , -1. , 0.2, 0. ], [-1. , 0. , -1. , 0.2], [ 0.2, -1. , 0. , -1. ], [ 0. , 0.2, -1. , 0. ]]) Next, the Hamiltonian for the scattering region should be constructed. Assuming the Hydrogen molecule can be described by the Hamiltonian: .. math:: H_\text{mol} = \begin{pmatrix} 0 & -0.8 \\ -0.8 & 0 \end{pmatrix} and that the molecule only couples to the nearest Pt atom, with a hopping energy of 0.2: Write down the explicit scattering Hamiltonian (it is a `6 \times 6` matrix). You are now ready to initialize the ``TransportCalculator``:: from ase.transport.calculators import TransportCalculator tcalc = TransportCalculator(h=H_scat, # Scattering Hamiltonian h1=H_lead, # Lead 1 (left) h2=H_lead, # Lead 2 (right) pl=2) # principal layer size To calculate the transmission function; first select an energy grid for the transmission, then run ``tcalc.get_transmission()``:: tcalc.set(energies=py.arange(-3, 3, 0.02)) T_e = tcalc.get_transmission() Try to plot the transmission function (e.g. using ``pylab.plot(tcalc.energies, T_e)``). The projected density of states (pdos) for the two hydrogen TB sites can be calculated using:: tcalc.set(pdos=[0, 1]) pdos_ne = tcalc.get_pdos() Note that all indices in ``TransportCalculator`` refers to the scattering region minus the mandatory principal layer on each side. Why do you think the pdos of each the hydrogen TB sites has two peaks? To investigate the system you can try to diagonalize the subspace spanned by the hydrogen TB sites:: h_rot, s_rot, eps_n, vec_nn = tcalc.subdiagonalize_bfs([0, 1]) tcalc.set(h=h_rot, s=s_rot) # Set the rotated matrices ``eps_n[i]`` and ``vec_nn[:,i]`` contains the i'th eigenvalue and eigenvector of the hydrogen molecule. Try to calculate the pdos again. What happpened? You can try to remove the coupling to the bonding state and calculate the calculate the transmission function:: tcalc.cutcupling_bfs([0]) T_cut_bonding_e = tcalc.get_transmission() You may now understand the transport behavior of the simple model system. The transmission peak at -0.8 eV and 0.8 eV are due to the bonding and antibonding states of the TB described hydrogen molecule. DFT description =============== We now continue to explore the Pt-H2-Pt system using a more realistic desciption derived from ab-initio calculations. The functions ``gpaw.lcao.tools.get_lcao_hamiltonian`` and ``gpaw.lcao.tools.get_lead_lcao_hamiltonian`` (in gpaw.lcao.tools) allows you to construct such a Hamiltonian within DFT in terms of pseudo atomic orbitals. Since real potential decay much slower than in our TB model, we increase the principal layers to 4 Pt atoms, and the scattering region to 5 Pt atoms on either side. To obtain the matrices for the scattering region and the leads using DFT and pseudo atomic orbitals using a szp basis set run this :download:`pt_h2_lcao_manual.py`: .. literalinclude:: pt_h2_lcao_manual.py You should now have the files scat_hs.pickle, lead1_hs.pickle and lead2_hs.pickle in your directory. You are now ready to initialize the ``TransportCalculator``: The script can be found here: :download:`pt_h2_lcao_transport.py`. Below we will work through the script. The pickle files can be loaded and used in the ``TransportCalculator``:: from ase.transport.calculators import TransportCalculator import pickle #Read in the hamiltonians h, s = pickle.load(open('scat_hs.pickle', 'rb')) h1, s1 = pickle.load(open('lead1_hs.pickle', 'rb')) h2, s2 = pickle.load(open('lead2_hs.pickle', 'rb')) tcalc = TransportCalculator(h=h, h1=h1, h2=h2, # hamiltonian matrices s=s, s1=s1, s2=s2, # overlap matrices align_bf=1) # align the Fermi levels In SZP there are 4 basis functions per H atom, and 9 per Pt atom. Does the size of the different matrices match your expectations? What is the conductance? Does it agree with the experimental value? We will now try to investigate transport properties in more detail. Try to subdiagonalize the molecular subspace:: Pt_N = 5 Pt_nbf = 9 # number of bf per Pt atom (basis=szp) H_nbf = 4 # number of bf per H atom (basis=szp) bf_H1 = Pt_nbf * Pt_N bfs = range(bf_H1, bf_H1 + 2 * H_nbf) h_rot, s_rot, eps_n, vec_jn = tcalc.subdiagonalize_bfs(bfs) for n in range(len(eps_n)): print 'bf %i correpsonds to the eigenvalue %.2f eV' % (bfs[n],eps_n[n]) Argue that ``vec_jn[:,0]`` and ``vec_jn[:,1]`` corresponds to the bonding and anti-bonding molecular hydrogen orbitals, respectively. What is the calculated band-gap of the hydrogen-molecule? Switch to the rotated basis set (``tcalc.set(h=h_rot, s=s_rot)``) then plot the transmission function end the projected density of states of the renormalized molecular orbitals in an energy range of say -8 to 4 eV. Which orbital do you think is responsible for the high conductance? Try to cut the relevant orbitals from the basis set, as we did for the TB model. The TransportCalculator class ----------------------------- .. autoclass:: ase.transport.calculators.TransportCalculator gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/vibrations/000077500000000000000000000000001316441372200250435ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/vibrations/H2O_vib.py000066400000000000000000000005471316441372200266530ustar00rootroot00000000000000"""Calculate the vibrational modes of a H2O molecule.""" from ase.vibrations import Vibrations from gpaw import GPAW h2o = GPAW('h2o.gpw', txt=None).get_atoms() # Create vibration calculator vib = Vibrations(h2o) vib.run() vib.summary(method='frederiksen') # Make trajectory files to visualize normal modes: for mode in range(9): vib.write_mode(mode) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/vibrations/H2O_vib_2.py000066400000000000000000000006201316441372200270640ustar00rootroot00000000000000import os from ase.vibrations import Vibrations from gpaw import GPAW from gpaw.mpi import world h2o = GPAW('h2o.gpw', txt=None).get_atoms() # Test restart: vib = Vibrations(h2o) vib.run() vib.summary(method='frederiksen') # Remove a displacement file and redo it: if world.rank == 0: os.remove('vib.1z-.pckl') world.barrier() vib = Vibrations(h2o) vib.run() vib.summary(method='frederiksen') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/vibrations/h2o.py000066400000000000000000000006771316441372200261170ustar00rootroot00000000000000from math import cos, sin, pi from ase import Atoms from ase.optimize import QuasiNewton from gpaw import GPAW # Water molecule: d = 0.9575 t = pi / 180 * 104.51 H2O = Atoms('H2O', positions=[(0, 0, 0), (d, 0, 0), (d * cos(t), d * sin(t), 0)]) H2O.center(vacuum=3.5) calc = GPAW(h=0.2, txt='h2o.txt') H2O.set_calculator(calc) QuasiNewton(H2O).run(fmax=0.05) calc.write('h2o.gpw') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/vibrations/vibH2O.py000066400000000000000000000013471316441372200265130ustar00rootroot00000000000000from math import cos, sin, pi from ase import Atoms from ase.optimize import QuasiNewton from ase.vibrations import Vibrations from gpaw import GPAW # Water molecule: d = 0.9575 t = pi / 180 * 104.51 H2O = Atoms('H2O', positions=[(0, 0, 0), (d, 0, 0), (d * cos(t), d * sin(t), 0)]) H2O.center(vacuum=3.5) calc = GPAW(h=0.2, txt='h2o.txt', mode='lcao', basis='dzp') H2O.set_calculator(calc) QuasiNewton(H2O).run(fmax=0.05) """Calculate the vibrational modes of a H2O molecule.""" # Create vibration calculator vib = Vibrations(H2O) vib.run() vib.summary(method='frederiksen') # Make trajectory files to visualize normal modes: for mode in range(9): vib.write_mode(mode) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/vibrations/vibrations.rst000066400000000000000000000034541316441372200277630ustar00rootroot00000000000000================================================ Vibrational modes of the H\ :sub:`2`\ O molecule ================================================ Density functional theory can be used to calculate vibrational frequencies of molecules, e.g. either in the gas phase or on a surface. These results can be compared to experimental output, e.g. from IR-spectroscopy, and they can be used to figure out how a molecule is bound to the surface. In this example we will calculate the vibrational frequencies for a water molecule. * For a simple molecule, like CO, there is only one stretching mode. How would you calculate the vibrational frequency of this mode? * For a general molecule with N atoms, how many modes are there? How many of them are vibrational modes? How would you do a calculation for the vibrational modes? Describe in detail which steps have to be performed. * Read the script below and try to understand what it does. .. literalinclude:: vibH2O.py .. highlight:: bash * Run the script and look at the output frequencies. Compare them to literature values, which are 1595cm\ :sup:`-1` for the bending mode, 3657cm\ :sup:`-1` for the symmetric stretching mode and 3756cm\ :sup:`-1` for the anti-symmetric stretching mode. How good is the accuracy and what are possible error sources? * Now we want to look at the modes to see how the atoms move. For this we use the files :file:`vib.{?}.traj` where :file:`{?}` is the number of the mode counted in the order they are printed out. You can look at these trajectories with the :command:`ase gui` command - click :guilabel:`Play` to play the movie. Do they look like you expected and what would you have expected (you may have learned something about symmetry groups at one point)? Did you assign the modes correctly in the previous question? gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/000077500000000000000000000000001316441372200243265ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/benzene.py000066400000000000000000000014411316441372200263260ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW # Benzene ring: benzene = Atoms(symbols='C6H6', positions=[ ( 0.000000, 1.395248, 0.000000), ( 1.208320, 0.697624, 0.000000), ( 1.208320, -0.697624, 0.000000), ( 0.000000, -1.395248, 0.000000), (-1.208320, -0.697624, 0.000000), (-1.208320, 0.697624, 0.000000), ( 0.000000, 2.482360, 0.000000), ( 2.149787, 1.241180, 0.000000), ( 2.149787, -1.241180, 0.000000), ( 0.000000, -2.482360, 0.000000), (-2.149787, -1.241180, 0.000000), (-2.149787, 1.241180, 0.000000)]) benzene.center(vacuum=2.5) calc = GPAW(nbands=15, h=0.2, xc='PBE', txt='benzene.txt') benzene.set_calculator(calc) benzene.get_potential_energy() calc.write('benzene.gpw', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/locfun.py000066400000000000000000000022051316441372200261650ustar00rootroot00000000000000from __future__ import print_function from numpy import around from gpaw import GPAW from gpaw.wannier import LocFun calc = GPAW('CO.gpw', txt=None) locfun = LocFun() locfun.localize(calc, M=8, ortho=True, verbose=True) print(around(locfun.U_nn, 1)) # non ortho # O_s O_py O_pz O_px C_s C_py C_pz C_px # s1 [[-0.9 0. 0.4 0. -0.5 0. -0.5 0. ] # s2 [ 0.5 0. 0.8 0. -0.6 0. -0.2 0. ] # pi [ 0. -0.4 0. 0.7 0. -0.3 0. 0.5] # pi [ 0. -0.7 0. -0.4 0. -0.5 0. -0.3] # s3 [ 0. 0. 0.4 0. 0.6 0. -0.8 0. ] # pi* [ 0. -0.2 0. -0.5 0. 0.2 0. 0.8] # pi* [ 0. -0.5 0. 0.2 0. 0.8 0. -0.2] # s4 [-0.2 0. -0.1 0. -0.2 -0. 0.2 0. ]] # ortho # O_s O_py O_pz O_px C_s C_py C_pz C_px # s1 [[-0.7 0. 0.1 0. -0.5 0. -0.4 0. ] # s2 [ 0.5 0. 0.7 0. -0.5 0. -0.1 0. ] # pi [ 0. -0.4 0. 0.7 0. -0.3 0. 0.5] # pi [ 0. -0.7 0. -0.4 0. -0.5 0. -0.3] # s3 [-0.1 0. 0.5 0. 0.7 0. -0.5 0. ] # pi* [ 0. -0.2 0. -0.5 0. 0.2 0. 0.8] # pi* [ 0. -0.5 0. 0.2 0. 0.8 0. -0.2] # s4 [-0.5 0. 0.5 0. 0.2 0. 0.7 0. ]] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/si.py000066400000000000000000000007151316441372200253160ustar00rootroot00000000000000from ase import Atoms from gpaw import GPAW a = 5.475 b = a / 2 si = Atoms(symbols='Si4', positions=[(0, 0, 0), (0, b, b), (b, 0, b), (b, b, 0)], cell=(a, a, a), pbc=True) si += si si.positions[4:] += a / 4 calc = GPAW(nbands=16, h=0.25, txt='si.txt') si.set_calculator(calc) si.get_potential_energy() calc.write('si.gpw', mode='all') gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/wannier-benzene.py000066400000000000000000000011301316441372200277620ustar00rootroot00000000000000from ase import Atoms from ase.io import write from ase.visualize import view from gpaw import restart from gpaw.wannier import Wannier atoms, calc = restart('benzene.gpw') homo = calc.get_pseudo_wave_function(band=14) write('homo.cube', atoms, data=homo) # Initialize the Wannier class w = Wannier(calc) w.localize() centers = w.get_centers() view(atoms + Atoms(symbols='X15', positions=centers)) # Find the index of the center with the lowest y-coordinate: nsigma = centers[:, 1].argmin() sigma = w.get_function(calc, nsigma) write('benzene.xyz', atoms) write('sigma.cube', atoms, data=sigma) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/wannier-co.py000066400000000000000000000006271316441372200267470ustar00rootroot00000000000000from ase import Atoms from ase.build import molecule from ase.visualize import view from gpaw import GPAW from gpaw.wannier import Wannier calc = GPAW(nbands=5) atoms = molecule('CO') atoms.center(vacuum=3.) atoms.set_calculator(calc) atoms.get_potential_energy() # Initialize the Wannier class w = Wannier(calc) w.localize() centers = w.get_centers() view(atoms + Atoms(symbols='X5', positions=centers)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/wannier-h2o.py000066400000000000000000000006321316441372200270320ustar00rootroot00000000000000from ase.build import molecule from ase.visualize import view from ase import Atoms from gpaw import GPAW from gpaw.wannier import Wannier calc = GPAW(nbands=4) atoms = molecule('H2O') atoms.center(vacuum=3.) atoms.set_calculator(calc) atoms.get_potential_energy() # Initialize the Wannier class w = Wannier(calc) w.localize() centers = w.get_centers() view(atoms + Atoms(symbols='X4', positions=centers)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/wannier-si.py000066400000000000000000000004511316441372200267540ustar00rootroot00000000000000from ase import Atoms from ase.visualize import view from gpaw import GPAW from gpaw.wannier import Wannier calc = GPAW('si.gpw') atoms = calc.get_atoms() w = Wannier(calc) w.localize() centers = w.get_centers() watoms = atoms + Atoms(symbols='X16', positions=centers) view(watoms * (2, 2, 2)) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wannier/wannier.rst000066400000000000000000000047001316441372200265240ustar00rootroot00000000000000.. _wannier: ================= Wannier Functions ================= In order to get a feel for chemical bonds in molecules and solids, we can transform the Kohn-Sham orbitals into a set of maximally localized Wannier functions. We have cheated a little bit and prepared a file for bulk silicon and a Benzene molecule so that you only have to concentrate on the wannier analysis of the molecules. Start by running :git:`~doc/exercises/wannier/si.py` and make sure you agree with the way the diamond structure is set up. The resulting :file:`.gpw` file is used as input to :git:`~doc/exercises/wannier/wannier-si.py` which transforms the Kohn-Sham orbitals to maximally localized wannier functions and plot the atoms along with the centers of the wannier functions. Note that the wannier centers are treated as "X" atoms which are plotted as small red spheres. How many covalent bonds do you expect in a unit cell with 8 tetravalent Silicon atoms? The script :git:`~doc/exercises/wannier/benzene.py` produces a :file:`.gpw` that can be used as input to create wannier functions. Convince yourself that the chosen number of bands matches the number of occupied orbitals in the molecule. How many covalent bonds do you expect in Benzene? Look at :git:`~doc/exercises/wannier/wannier-benzene.py` and figure out what it does. Run it and look at the graphical representation. Note in particular the alternating single/double bonds between the carbon atoms. What happens if also you include one or two unoccupied bands? The script also produces two :file:`.cube` files. One contains the wavefunction of the Highest Occupied Molecular Orbital (HOMO) and the other contains a wannier function centered between a Carbon and a Hydrogen atom. Study these with :program:`VMD` and determine which type of orbitals they represent (`\sigma` or `\pi`). Now repeat the wannier function analysis on the following molecules * H2O : use your own files from the vibrational exercise, but make sure the number of bands is equal to the number of occupied orbitals. * CO : use your own :file:`.gpw` file from the wavefunction exercise. Is it a single, double or triple bond? or study your own favorite molecule. .. hint:: To be able to see the Wannier centers, it might be necessary to decrease the atomic radii, so the spheres don't overlap. With :program:`ase gui` this can be done by choosing :menuselection:`View --> Settings`, and then decrease the scaling factor of the covalent radii. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/water/000077500000000000000000000000001316441372200240055ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/water/h2o.py000066400000000000000000000012371316441372200250520ustar00rootroot00000000000000from __future__ import print_function from ase.build import molecule from gpaw import GPAW a = 8.0 h = 0.2 energies = {} resultfile = open('results-%.2f.txt' % h, 'w') for name in ['H2O', 'H', 'O']: system = molecule(name) system.set_cell((a, a, a)) system.center() calc = GPAW(h=h, txt='gpaw-%s-%.2f.txt' % (name, h)) if name == 'H' or name == 'O': calc.set(hund=True) system.set_calculator(calc) energy = system.get_potential_energy() energies[name] = energy print(name, energy, file=resultfile) e_atomization = energies['H2O'] - 2 * energies['H'] - energies['O'] print(e_atomization, file=resultfile) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/water/water.rst000066400000000000000000000156601316441372200256710ustar00rootroot00000000000000=========================== Basics of GPAW calculations =========================== Atomization energy revisited ============================ The below script calculates the total energies of :mol:`H_2O`, H and O. .. literalinclude:: h2o.py Read the script and try to understand what it does. A few notes: * In most languages it is common to declare loops with integer counters. In Python, a ``for`` loop always loops over elements of an *iterable* (in this case a list of the strings ``H2O``, ``H`` and ``O``). You can loop over integers, if desired, using ``for x in range(17):``. * The code in loops, if-statements and other code blocks is indented. The loop or if-statement stops when the lines are no longer indented. Thus, *indentation determines control flow*. * In this case we conveniently load the geometry from the G2 database of small molecules, using the :func:`~ase.build.molecule` function from ASE. * By setting the ``txt`` parameter, we specify a file where GPAW will save the calculation log. * The expression ``'results-%.2f.txt' % h`` inserts the value of ``h`` in place of the *substitution code* ``%.2f`` (floating point number with 2 decimals). Thus the result file name evaluates to ``results-0.20.txt``. Similarly, ``'gpaw-%s-%.2f.txt' % (name, h)`` evaluates to ``gpaw-H2O-0.20.txt`` in the first loop iteration (``%s`` is a substitution code for a string). * The call to ``open`` opens a file. The parameter ``'w'`` signifies that the file is opened in write mode (deleting any previous file with that name!). The calculated energies are written to this file using a print statement. We could have chosen to just print the parameter as in the last exercise, but file handling will come in handy below. Run the script. You can monitor the progress by opening one of the log files (e.g. ``gpaw.H2O.txt``). The command :samp:`tail -f {filename}` can be used to view the output in real-time. The calculated atomization energy can be found in the ``results-0.20.txt`` file. Parallelization =============== To speed things up, let us run the script using some more CPUs. The actual GPAW calculation is coded to make proper use of these extra CPUs, while the rest of the script (everything except ``calc.get_potential_energy()``) is actually going to be run independently by each CPU. This matters little except when writing to files. Each CPU will attempt to write to the same file, probably at the same time, producing garbled data. We must therefore make sure that only one process writes. ASE provides the handy :func:`~ase.parallel.paropen` function for just that:: from ase.parallel import paropen ... resultfile = paropen('results-%.2f.txt' % h, 'w') Apply the above modifications to the script and run it in parallel e.g. on four CPUs:: $ mpirun -np 4 gpaw-python script.py Verify by checking the log file that GPAW is actually using multiple CPUs. The log file should reveal that the :mol:`H_2O` calculation uses domain-decomposed with four domains, while the two atomic calculations should parallelize over the two spins and two domains. .. _convergence_checks: Convergence checks ================== It is essential that the calculations use a sufficiently fine grid spacing, and that the cell is sufficiently large not to affect the result. For this reason, convergence with respect to these parameters should generally be checked. For now we shall only bother to check the grid spacings. Modify the above script to include a loop over different grid spacings. For :ref:`technical reasons `, GPAW will always use a number of grid points divisible by four along each direction. Use a loop structure like:: for symbol in [...]: ... for ngridpoints in [24, 28, ...]: h = a / ngridpoints calc.set(h=h) energy = system.get_potential_energy() ... The ``set`` method can be used to change the parameters of a calculator without creating a new one. Make sure that the numbers of grid points are chosen to cover `0.15`, which uses linear combinations of pre-calculated atomic orbitals to represent the wavefunctions. LCAO calculations are much faster for most systems, but also less precise. Performing an LCAO calculation requires setting the ``mode`` and normally a ``basis``:: calc = GPAW(..., mode='lcao', basis='dzp', ...) Here ``dzp`` ("double-zeta polarized") means two basis functions per valence state plus a polarization function - a function corresponding to the lowest unoccupied angular-momentum state on the atom. This will use the standard basis sets distributed with GPAW. You can pick out a smaller basis set using the special syntax ``basis='sz(dzp)'``. This will pick out only one function per valence state ("single-zeta"), making the calculation even faster but less precise. Calculate the atomization energy of :mol:`H_2O` using different basis sets. Instead of looping over grid spacing, use a loop over basis keywords:: for basis in ['sz(dzp)', 'szp(dzp)', 'dzp']: ... calc = GPAW(mode='lcao', basis=basis, ...) Compare the calculated energies to those calculated in grid mode. Do the energies deviate a lot? What about the atomization energy? Is the energy variational with respect to the quality of the basis? LCAO calculations do not in fact produce very precise binding energies (although these can be improved considerably by manually generating optimized basis functions) - however the method is well suited to calculate geometries, and for applications that require a small basis set, such as electron transport calculations. Plane-wave calculations ======================= For systems with small unit-cells, it can be much faster to expand the wave-functions in :ref:`plane-waves `. Try running a calculation for a water molecule with a plane-wave cutoff of 350 eV using this:: from gpaw import GPAW, PW calc = GPAW(mode=PW(350), ...) Try to look at the text output and see if you can find the number of plane-waves used. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wavefunctions/000077500000000000000000000000001316441372200255565ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wavefunctions/CO.py000066400000000000000000000010621316441372200264300ustar00rootroot00000000000000from ase.io import write from gpaw import GPAW, Mixer from ase.build import molecule CO = molecule('CO') CO.set_cell((6., 6., 6.)) CO.center() calc = GPAW(h=0.2, nbands=8, mixer=Mixer(beta=0.1, nmaxold=5, weight=50.0), txt='CO.txt') CO.set_calculator(calc) CO.get_potential_energy() # Write wave functions to gpw file calc.write('CO.gpw', mode='all') # Generate cube-files of the orbitals. for n in range(calc.get_number_of_bands()): wf = calc.get_pseudo_wave_function(band=n) write('CO%d.cube' % n, CO, data=wf) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wavefunctions/O.py000066400000000000000000000011431316441372200263250ustar00rootroot00000000000000from ase import Atoms from ase.io import write from gpaw import GPAW # Oxygen atom: atom = Atoms('O', cell=[6, 6, 6], pbc=False) atom.center() calc = GPAW(h=0.2, hund=True, # assigns the atom its correct magnetic moment txt='O.txt') atom.set_calculator(calc) atom.get_potential_energy() # Write wave functions to gpw file: calc.write('O.gpw', mode='all') # Generate cube-files of the orbitals: for spin in [0, 1]: for n in range(calc.get_number_of_bands()): wf = calc.get_pseudo_wave_function(band=n, spin=spin) write('O.%d.%d.cube' % (spin, n), atom, data=wf) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/wavefunctions/wavefunctions.rst000066400000000000000000000073441316441372200312130ustar00rootroot00000000000000========================================================== Kohn-Sham wavefunctions of the oxygen atom and CO molecule ========================================================== In this section we will look at the Kohn-Sham wavefunctions of the O atom and CO molecule and compare them to results from molecular orbital theory. * The first script :download:`O.py` sets up an oxygen atom in a cubic supercell with non-periodic boundary conditions and calculates the total energy. A couple of extra bands (i.e. Kohn-Sham states) are included in the calculation: .. literalinclude:: O.py .. highlight:: bash * Towards the end, a :file:`.gpw` file is written with the Kohn-Sham wavefunctions by ``calc.write('O.gpw', mode='all')`` and also some cube files containing individual orbatals are written. * Run the script and check the text-output file. What are the occupation numbers for the free oxygen atom? * The orbitals can be visualized using Mayavi_ and its :func:`mayavi.mlab.contour3d` function and the GPAW-calculators :meth:`~gpaw.calculator.GPAW.get_pseudo_wave_function` method. Reload the gpw-file and look at one of the orbitals like this:: from gpaw import GPAW from mayavi import mlab calc = GPAW('O.gpw', txt=None) lumo = calc.get_pseudo_wave_function(band=2, spin=1) mlab.contour3d(lumo) mlab.show() For an alternative way of viewing the orbitals, see :ref:`iso`. Can you identify the highest occupied state and the lowest unoccupied state? How do your wavefunctions compare to atomic s- and p-orbitals? * Make a script where a CO molecule is placed in the center of a cubic unit cell with non-periodic boundary conditions, e.g. of 6 Å. For more accurate calculations, the cell should definitely be bigger, but for reasons of speed, we use this cell here. A grid spacing of around 0.20 Å will suffice. Include a couple of unoccupied bands in the calculation (what is the number of valence electrons in CO?). You can quickly create the Atoms object with the CO molecule by:: from ase.build import molecule CO = molecule('CO') This will create a CO molecule with an approximately correct bond length and the correct magnetic moments on each atom. Then relax the CO molecule to its minimum energy position. Write the relaxation to a trajectory file and the final results to a :file:`.gpw` file. The wavefunctions are not written to the :file:`.gpw` file by default, but can again be saved by writing :samp:`{calc}.write('CO.gpw', mode='all')`, where :samp:`{calc}` is the calculator object. Assuming you use :samp:`opt = QuasiNewton(..., trajectory='CO.traj')`, the trajectory can be viewed by:: $ ase gui CO.traj Try looking at the file while the optimization is running and mark the two atoms to see the bond length. * As this is a calculation of a molecule, one should get integer occupation numbers - check this in the text output. What electronic temperature was used and what is the significance of this? * Plot the Kohn-Sham wavefunctions of the different wavefunctions of the CO molecule like you did for the oxygen atom. * Can you identify the highest occupied state and the lowest unoccupied state? How does your wavefunctions compare to a molecular orbital picture? Try to Identify `\sigma` and `\pi` orbitals. Which wavefunctions are bonding and which are antibonding? .. hint:: You might find it useful to look at the molecular orbital diagram below, taken from `The Chemogenesis Web Book`_. .. figure:: co_bonding.jpg :align: center .. _Mayavi: http://docs.enthought.com/mayavi/mayavi/index.html .. _The Chemogenesis Web Book: http://www.meta-synthesis.com/webbook/ 39_diatomics/diatomics.html#CO gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/exercises/xy.py000066400000000000000000000003221316441372200236720ustar00rootroot00000000000000import sys import numpy as np import matplotlib.pyplot as plt for filename in sys.argv[1:]: a = np.loadtxt(filename, delimiter=',').T x = a[0] for y in a[1:]: plt.plot(x, y, '-') plt.show() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/ext.py000066400000000000000000000007561316441372200220530ustar00rootroot00000000000000from ase.utils.sphinx import mol_role from ase.utils.sphinx import git_role_tmpl from ase.utils.sphinx import create_png_files def git_role(role, rawtext, text, lineno, inliner, options={}, content=[]): return git_role_tmpl('https://gitlab.com/gpaw/gpaw/blob/master/', role, rawtext, text, lineno, inliner, options, content) def setup(app): app.add_role('mol', mol_role) app.add_role('git', git_role) create_png_files() gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/faq.rst000066400000000000000000000103611316441372200221730ustar00rootroot00000000000000.. _faq: ========================== Frequently Asked Questions ========================== General ======= Citation: how should I cite GPAW? --------------------------------- If you find GPAW useful in your research please cite the original reference: | J. J. Mortensen, L. B. Hansen , and K. W. Jacobsen | `Real-space grid implementation of the projector augmented wave method`__ | Physical Review B, Vol. **71**, 035109, 2005 __ http://dx.doi.org/10.1103/PhysRevB.71.035109 and the major GPAW review: | J. Enkovaara, C. Rostgaard, J. J. Mortensen et al. | `Electronic structure calculations with GPAW: a real-space implementation of the projector augmented-wave method`__ | J. Phys.: Condens. Matter **22**, 253202 (2010) __ http://stacks.iop.org/0953-8984/22/253202 together with ASE citation (see :ref:`ase:cite`). If you are using the time-dependent DFT part of the code, please cite also: | M. Walter, H. Häkkinen, L. Lehtovaara, M. Puska, J. Enkovaara, C. Rostgaard and J. J. Mortensen | `Time-dependent density-functional theory in the projector augmented-wave method`__ | Journal of Chemical Physics, Vol. **128**, 244101, 2008 __ http://link.aip.org/link/?JCP/128/244101 If you use the :ref:`localized basis set `, please cite also: | A. H. Larsen, M. Vanin, J. J. Mortensen, K. S. Thygesen, and K. W. Jacobsen | `Localized atomic basis set in the projector augmented wave method`__ | Physical Review B, Vol. **80**, 195112, 2009 __ http://dx.doi.org/10.1103/PhysRevB.80.195112 If you use the :ref:`df_tutorial`, please cite also: | Jun Yan, Jens. J. Mortensen, Karsten W. Jacobsen, and Kristian S. Thygesen | `Linear density response function in the projector augmented wave method: Applications to solids, surfaces, and interfaces`__ | Physical Review B Vol. **83**, 245122, 2011 __ http://link.aps.org/doi/10.1103/PhysRevB.83.245122 If you use the :ref:`gw tutorial`, please cite also: | F. Hüser, T. Olsen, and K. S. Thygesen | `Quasiparticle GW calculations for solids, molecules, and two-dimensional materials`__ | Physical Review B Vol. **87**, 235132, 2013 __ http://link.aps.org/doi/10.1103/PhysRevB.87.235132 If you use the :ref:`continuum_solvent_model`, please cite also: | A. Held and M. Walter | `Simplified continuum solvent model with a smooth cavity based on volumetric data`__ | The Journal of Chemical Physics Vol. **141**, 174108, 2014 __ http://dx.doi.org/10.1063/1.4900838 BibTex (:git:`doc/GPAW.bib`): .. literalinclude:: GPAW.bib How do you pronounce GPAW? -------------------------- In English: "geepaw" with a long "a". In Danish: Først bogstavet "g", derefter "pav": "g-pav". In Finnish: supisuomalaisittain "kee-pav". In Polish: "gyeh" jak `"Gie"rek `_, "pav" jak `paw `_: "gyeh-pav". Compiling the C-code ==================== For architecture dependent settings see the :ref:`platforms and architectures` page. Compilation of the C part failed:: [~]$ python2.4 setup.py build_ext building '_gpaw' extension pgcc -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m64 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.4 -c c/localized_functions.c -o build/temp.linux-x86_64-2.4/c/localized_functions.o -Wall -std=c99 pgcc-Warning-Unknown switch: -fno-strict-aliasing PGC-S-0040-Illegal use of symbol, _Complex (/usr/include/bits/cmathcalls.h: 54) You are probably using another compiler, than was used for compiling python. Undefine the environment variables CC, CFLAGS and LDFLAGS with:: # sh/bash users: unset CC; unset CFLAGS; unset LDFLAGS # csh/tcsh users: unsetenv CC; unsetenv CFLAGS; unsetenv LDFLAGS and try again. Calculation does not converge ============================= Consult the :ref:`convergence` page. Poisson solver did not converge! ================================ If you are doing a spin-polarized calculation for an isolated molecule, then you should set the Fermi temperature to a low value. You can also try to set the number of grid points to be divisible by 8. Consult the :ref:`poisson_performance` page. Tests fail! =========== Please report the failing test as described on :ref:`run the tests`. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/images.py000066400000000000000000000124471316441372200225200ustar00rootroot00000000000000""" TODO: 1. we should find a good way in which to store files elsewhere than static 2. currently the files that are not generated by weekly tests are copied from srcpath. This needs to be documented. Make sure that downloaded files are copied to build dir on build This must (probably) be done *after* compilation because otherwise dirs may not exist. """ from __future__ import print_function try: from urllib2 import urlopen, HTTPError except ImportError: from urllib.request import urlopen from urllib.error import HTTPError import os srcpath = 'http://wiki.fysik.dtu.dk/gpaw-files' agtspath = 'http://wiki.fysik.dtu.dk' def get(path, names, target=None, source=None): """Get files from web-server. Returns True if something new was fetched.""" if target is None: target = path if source is None: source = srcpath got_something = False for name in names: src = os.path.join(source, path, name) dst = os.path.join(target, name) if not os.path.isfile(dst): print(dst, end=' ') try: data = urlopen(src).read() sink = open(dst, 'wb') sink.write(data) sink.close() print('OK') got_something = True except HTTPError: print('HTTP Error!') return got_something literature = """ askhl_10302_report.pdf mortensen_gpaw-dev.pdf rostgaard_master.pdf askhl_master.pdf mortensen_mini2003talk.pdf marco_master.pdf mortensen_paw.pdf ss14.pdf """.split() get('doc/literature', literature, 'documentation') # Note: bz-all.png is used both in an exercise and a tutorial. Therefore # we put it in the common dir so far, rather than any of the two places get('.', ['bz-all.png'], 'static') get('exercises/wavefunctions', ['co_bonding.jpg']) get('tutorials/H2', ['ensemble.png']) get('.', ['2sigma.png', 'co_wavefunctions.png'], 'documentation') get('exercises/lrtddft', ['spectrum.png']) get('documentation/xc', 'g2test_pbe0.png g2test_pbe.png results.png'.split()) get('performance', 'dacapoperf.png goldwire.png gridperf.png'.split(), 'static') get('tutorials/xas', ['h2o_xas_3.png', 'h2o_xas_4.png', 'xas_illustration.png', 'xas_h2o_convergence.png']) get('bgp', ['bgp_mapping_intranode.png', 'bgp_mapping1.png', 'bgp_mapping2.png'], 'platforms/BGP') # workshop 2013 and 2016 photos: get('workshop13', ['workshop13_01_33-1.jpg'], 'static') get('workshop16', ['gpaw2016-photo.jpg'], 'static') # files from agtspath scf_conv_eval_stuff = """ scf_g2_1_pbe0_fd_calculator_steps.png scf_g2_1_pbe0_fd_energy.csv scf_dcdft_pbe_pw_calculator_steps.png scf_dcdft_pbe_pw_energy.csv """.split() get('agts-files', scf_conv_eval_stuff, target='documentation/scf_conv_eval', source=agtspath) # Warning: for the moment dcdft runs are not run (files are static)! dcdft_pbe_aims_stuff = """ dcdft_aims.tight.01.16.db.csv dcdft_aims.tight.01.16.db_raw.csv dcdft_aims.tight.01.16.db_Delta.txt """.split() get('agts-files', dcdft_pbe_aims_stuff, target='setups', source=agtspath) # Warning: for the moment dcdft runs are not run (files are static)! dcdft_pbe_gpaw_pw_stuff = """ dcdft_pbe_gpaw_pw.csv dcdft_pbe_gpaw_pw_raw.csv dcdft_pbe_gpaw_pw_Delta.txt """.split() get('agts-files', dcdft_pbe_gpaw_pw_stuff, target='setups', source=agtspath) # Warning: for the moment dcdft runs are not run (files are static)! dcdft_pbe_jacapo_stuff = """ dcdft_pbe_jacapo.csv dcdft_pbe_jacapo_raw.csv dcdft_pbe_jacapo_Delta.txt """.split() get('agts-files', dcdft_pbe_jacapo_stuff, target='setups', source=agtspath) # Warning: for the moment dcdft runs are not run (files are static)! dcdft_pbe_abinit_fhi_stuff = """ dcdft_pbe_abinit_fhi.csv dcdft_pbe_abinit_fhi_raw.csv dcdft_pbe_abinit_fhi_Delta.txt """.split() get('agts-files', dcdft_pbe_abinit_fhi_stuff, target='setups', source=agtspath) g2_1_stuff = """ pbe_gpaw_nrel_ea_vs.csv pbe_gpaw_nrel_ea_vs.png pbe_gpaw_nrel_opt_ea_vs.csv pbe_gpaw_nrel_opt_distance_vs.csv pbe_nwchem_def2_qzvppd_opt_ea_vs.csv pbe_nwchem_def2_qzvppd_opt_distance_vs.csv """.split() get('agts-files', g2_1_stuff, target='setups', source=agtspath) get('tutorials/wannier90', ['GaAs.png', 'Cu.png', 'Fe.png']) get('agts-files', ['datasets.json'], 'setups', source=agtspath) # Carlsberg foundation figure: get('.', ['carlsberg.png']) get('static', ['NOMAD_Logo_supported_by.png']) def setup(app): # Get png files and other stuff from the AGTS scripts that run # every weekend: from gpaw.test.big.agts import AGTSQueue queue = AGTSQueue() queue.collect() names = set() for job in queue.jobs: if not job.creates: continue for name in job.creates: if name in names: raise RuntimeError( 'The name {0!r} is used in more than one place!' .format(name)) names.add(name) # the files are saved by the weekly tests under agtspath/agts-files # now we are copying them back to their original run directories path = os.path.join(job.dir, name) if os.path.isfile(path): continue print(path, 'copied from', agtspath) get('agts-files', [name], job.dir, source=agtspath) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/index.rst000066400000000000000000000134401316441372200225340ustar00rootroot00000000000000=============================================================== GPAW: DFT and beyond within the projector-augmented wave method =============================================================== GPAW is a density-functional theory (DFT) Python_ code based on the projector-augmented wave (:ref:`PAW `) method and the atomic simulation environment (ASE_). The wave functions can be described with: * Plane-waves (:ref:`pw `) * Real-space uniform grids, multigrid methods and the finite-difference approximation (:ref:`fd `) * Atom-centered basis-functions (:ref:`lcao `) >>> # H2-molecule example: >>> from ase import Atoms >>> from gpaw import GPAW, PW >>> h2 = Atoms('H2', [(0, 0, 0), (0, 0, 0.74)]) >>> h2.center(vacuum=2.5) >>> h2.cell array([[ 5. , 0. , 0. ], [ 0. , 5. , 0. ], [ 0. , 0. , 5.74]]) >>> h2.positions array([[ 2.5 , 2.5 , 2.5 ], [ 2.5 , 2.5 , 3.24]]) >>> h2.set_calculator(GPAW(xc='PBE', mode=PW(300), txt='h2.txt')) >>> h2.get_potential_energy() -6.6237575005960494 >>> h2.get_forces() array([[ 9.37566400e-14, 4.40256983e-14, -6.44750360e-01], [ -9.98454736e-14, 4.37862132e-14, 6.44750360e-01]]) .. _Python: http://www.python.org .. _ASE: https://wiki.fysik.dtu.dk/ase .. _news: News ==== * :ref:`GPAW version 1.3.0 ` released (02 October 2017). * Supported by NOMAD_ (Mar 1 2017) .. image:: static/NOMAD_Logo_supported_by.png :width: 100 px :target: NOMAD_ * Code-sprints moved to first Tuesday of every month (Feb 17 2017) * :ref:`GPAW version 1.2 ` released (Feb 7 2017) * It has been decided to have monthly GPAW/ASE code-sprints at DTU in Lyngby. The sprints will be the first Wednesday of every month starting December 7, 2016 (Nov 11 2016) * Slides from the talks at :ref:`workshop16` are now available (Sep 5 2016) * :ref:`GPAW version 1.1 ` released (Jun 22 2016) * :ref:`GPAW version 1.0 ` released (Mar 18 2016) * Web-page now use the `Read the Docs Sphinx Theme `_ (Mar 18 2016) * :ref:`GPAW version 0.11 ` released (Jul 22 2015) * :ref:`GPAW version 0.10 ` released (Apr 8 2014) * GPAW is part of the `PRACE Unified European Application Benchmark Suite`_ (October 17 2013) * May 21-23, 2013: :ref:`GPAW workshop ` at the Technical University of Denmark (Feb 8 2013) * Prof. Häkkinen has received `18 million CPU hour grant`_ for GPAW based research project (Nov 20 2012) * A new :ref:`setups` bundle released (Oct 26 2012) * :ref:`GPAW version 0.9 ` released (March 7 2012) * :ref:`GPAW version 0.8 ` released (May 25 2011) * GPAW is part of benchmark suite for `CSC's supercomputer procurement`_ (Apr 19 2011) * New features: Calculation of the linear :ref:`dielectric response ` of an extended system (RPA and ALDA kernels) and calculation of :ref:`rpa` (Mar 18 2011) * Massively parallel GPAW calculations presented at `PyCon 2011`_. See William Scullin's talk here: `Python for High Performance Computing`_ (Mar 12 2011) * :ref:`GPAW version 0.7.2 ` released (Aug 13 2010) * :ref:`GPAW version 0.7 ` released (Apr 23 2010) * GPAW is `\Psi_k` `scientific highlight of the month`_ (Apr 3 2010) * A third GPAW code sprint was successfully hosted at CAMD (Oct 20 2009) * :ref:`GPAW version 0.6 ` released (Oct 9 2009) * `QuantumWise `_ adds GPAW-support to `Virtual NanoLab`_ (Sep 8 2009) * Join the new IRC channel ``#gpaw`` on FreeNode (Jul 15 2009) * :ref:`GPAW version 0.5 ` released (Apr 1 2009) * A new :ref:`setups` bundle released (Mar 27 2009) * A second GPAW code sprint was successfully hosted at CAMD (Mar 20 2009) * :ref:`GPAW version 0.4 ` released (Nov 13 2008) * The :ref:`exercises` are finally ready for use in the `CAMd summer school 2008`_ (Aug 15 2008) * This site is now powered by Sphinx_ (Jul 31 2008) * GPAW is now based on numpy_ instead of of Numeric (Jan 22 2008) * :ref:`GPAW version 0.3 ` released (Dec 19 2007) * CSC_ is organizing a `GPAW course`_: "Electronic structure calculations with GPAW" (Dec 11 2007) * The `code sprint 2007`_ was successfully finished (Nov 16 2007) * The source code is now in the hands of SVN and Trac_ (Okt 22 2007) * A GPAW Sprint will be held on November 16 in Lyngby (Okt 18 2007) * Work on atomic basis-sets begun (Sep 25 2007) .. _numpy: http://numpy.scipy.org/ .. _CSC: http://www.csc.fi .. _GPAW course: http://www.csc.fi/english/csc/courses/archive/gpaw-2008-01 .. _Trac: https://trac.fysik.dtu.dk/projects/gpaw .. _Sphinx: http://www.sphinx-doc.org .. _CAMd summer school 2008: http://www.camd.dtu.dk/English/Events/CAMD_Summer_School_2008/Programme.aspx .. _code sprint 2007: http://www.dtu.dk/Nyheder/Nyt_fra_Institutterne.aspx?guid={38B92D63-FB09-4DFA-A074-504146A2D678} .. _Virtual NanoLab: http://www.quantumwise.com/products/12-products/28-atk-se-200906#GPAW .. _scientific highlight of the month: http://www.psi-k.org/newsletters/News_98/Highlight_98.pdf .. _pycon 2011: http://us.pycon.org/2011/schedule/presentations/226/ .. _Python for High Performance Computing: http://pycon.blip.tv/file/4881240/ .. _CSC's supercomputer procurement: http://www.csc.fi/english/pages/hpc2011 .. _18 million CPU hour grant: http://www.prace-ri.eu/PRACE-5thRegular-Call .. _PRACE Unified European Application Benchmark Suite: http://www.prace-ri.eu/ueabs .. _NOMAD: http://repository.nomad-coe.eu/ .. toctree:: algorithms install documentation/documentation tutorials/tutorials exercises/exercises setups/setups releasenotes contact faq devel/devel summerschools/summerschools workshops/workshops bugs gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/install.rst000066400000000000000000000230521316441372200230730ustar00rootroot00000000000000.. _installation: ============ Installation ============ .. toctree:: :hidden: troubleshooting platforms/platforms GPAW relies on the Python library *atomic simulation environment* (ASE_), so you need to :ref:`install ASE ` first. GPAW itself is written mostly in the Python programming language, but there are also some C-code used for: * performance critical parts * allowing Python to talk to external numerical libraries (BLAS_, LAPACK_, LibXC_, MPI_ and ScaLAPACK_) So, in order to make GPAW work, you need to compile some C-code. For serial calculations, you will need to build a dynamically linked library (``_gpaw.so``) that the standard Python interpreter can load. For parallel calculations, you need to build a new Python interpreter (``gpaw-python``) that has MPI_ functionality built in. There are several ways to install GPAW: * On a lucky day it's as simple as ``pip3 install -U gpaw`` as described :ref:`below `. * Alternatively, you can :ref:`download ` the source code, edit :git:`customize.py` to tell the install script which libraries you want to link to and where they can be found (see :ref:`customizing installation`) and then install with a ``python3 setup.py install --user`` as described :ref:`here `. * There may be a package for your Linux distribution that you can use (named ``gpaw``). * If you are a developer that need to change the code you should look at this description: :ref:`developer installation`. .. seealso:: * Using :ref:`homebrew` on MacOSX. * Tips and tricks for installation on many :ref:`platforms and architectures`. * :ref:`troubleshooting`. * Important :ref:`envvars`. * In case of trouble: :ref:`Our mail list and IRC channel `. Requirements ============ * Python_ 2.7-3.5 * NumPy_ 1.6.1 or later (base N-dimensional array package) * ASE_ 3.15.0 or later (atomic simulation environment) * a C-compiler * LibXC_ 2.0.1 or later * BLAS_ and LAPACK_ libraries Optional, but highly recommended: * SciPy_ 0.7 or later (library for scientific computing, requirered for some features) * an MPI_ library (required for parallel calculations) * FFTW_ (for increased performance) * BLACS_ and ScaLAPACK_ .. _Python: http://www.python.org/ .. _NumPy: http://docs.scipy.org/doc/numpy/reference/ .. _SciPy: http://docs.scipy.org/doc/scipy/reference/ .. _LibXC: http://www.tddft.org/programs/octopus/wiki/index.php/Libxc .. _MPI: http://www.mpi-forum.org/ .. _BLAS: http://www.netlib.org/blas/ .. _BLACS: http://www.netlib.org/blacs/ .. _LAPACK: http://www.netlib.org/lapack/ .. _ScaLAPACK: http://www.netlib.org/scalapack/ .. _PyPI: https://pypi.org/project/gpaw .. _PIP: https://pip.pypa.io/en/stable/ .. _ASE: https://wiki.fysik.dtu.dk/ase .. _FFTW: http://www.fftw.org/ .. _installation using pip: Installation using ``pip`` ========================== .. highlight:: bash The simplest way to install GPAW is using pip_ and the GPAW package from the Python package index (PyPI_):: $ pip3 install --upgrade --user gpaw This will compile and install GPAW (both ``_gpaw.so`` and all the Python files) in your ``~/.local/lib/pythonX.Y/site-packages`` folder where Python can automatically find it. The ``pip3`` command will also place the command line tool :command:`gpaw` in the ``~/.local/bin`` folder, so make sure you have that in your :envvar:`PATH` environment variable. If you have an ``mpicc`` command on your system then there will also be a ``gpaw-python`` executable in ``~/.local/bin``. Check that you have installed everything in the correct places:: $ gpaw info To check the compiled parallel features (like ScaLAPACK), you need to run:: $ gpaw-python $(which gpaw) info Install PAW datasets ==================== Install the datasets into the folder ```` using this command:: $ gpaw install-data See :ref:`installation of paw datasets` for more details. Now you should be ready to use GPAW, but before you start, please run the tests as described below. .. index:: test .. _run the tests: Run the tests ============= Make sure that everything works by running the test suite:: $ gpaw test This will take a couple of hours. You can speed it up by using more than one core:: $ gpaw test -j 4 Please report errors to the ``gpaw-developers`` mailing list so that we can fix them (see :ref:`mail list`). If tests pass, and the parallel version is built, test the parallel code:: $ gpaw -P 4 test or equivalently:: $ mpiexec -np 4 gpaw-python `which gpaw` test .. _download: Getting the source code ======================= Sou can get the source from a tar-file or from Git: :Tar-file: You can get the source as a tar-file for the latest stable release (gpaw-1.3.0.tar.gz_) or the latest development snapshot (``_). Unpack and make a soft link:: $ tar -xf gpaw-1.3.0.tar.gz $ ln -s gpaw-1.3.0 gpaw Here is a `list of tarballs `__. :Git clone: Alternatively, you can get the source for the latest stable release from https://gitlab.com/gpaw/gpaw like this:: $ git clone -b 1.3.0 https://gitlab.com/gpaw/gpaw.git or if you want the development version:: $ git clone https://gitlab.com/gpaw/gpaw.git Add ``~/gpaw`` to your :envvar:`PYTHONPATH` environment variable and add ``~/gpaw/tools`` to :envvar:`PATH` (assuming ``~/gpaw`` is where your GPAW folder is). .. note:: We also have Git tags for older stable versions of GPAW. See the :ref:`releasenotes` for which tags are available. Also the dates of older releases can be found there. .. _gpaw-1.3.0.tar.gz: https://pypi.org/packages/source/g/gpaw/gpaw-1.3.0.tar.gz .. _customizing installation: Customizing installation ======================== The install script does its best when trying to guess proper libraries and commands to build GPAW. However, if the standard procedure fails or user wants to override default values it is possible to customize the setup with :git:`customize.py` file which is located in the GPAW base directory. As an example, :git:`customize.py` might contain the following lines:: libraries = ['myblas', 'mylapack'] library_dirs = ['path_to_myblas'] Now, GPAW would be built with "``-Lpath_to_myblas -lmyblas -lmylapack``" linker flags. Look at the file :git:`customize.py` itself for more possible options. :ref:`platforms and architectures` provides examples of :file:`customize.py` for different platforms. After editing :git:`customize.py`, follow the instructions for the :ref:`developer installation`. .. _install with distutils: Install with setup.py ===================== If you have the source code, you can use the install script (:git:`setup.py`) to compile and install the code:: $ python3 setup.py install --user .. _parallel installation: Parallel installation ===================== By default, setup looks if :program:`mpicc` is available, and if setup finds one, a parallel version is build. If the setup does not find mpicc, a user can specify one in the :git:`customize.py` file. Additionally a user may want to enable ScaLAPACK, setting in :git:`customize.py`:: scalapack = True and, in this case, provide BLACS/ScaLAPACK ``libraries`` and ``library_dirs`` as described in :ref:`customizing installation`. Instructions for running parallel calculations can be found in the :ref:`user manual `. Libxc Installation ------------------ If you OS does not have a LibXC_ package you can use then you can download and install LibXC_ as described `here `_. A few extra tips: * Libxc installation requires both a C compiler and a fortran compiler. * We've tried intel and gnu compilers and haven't noticed much of a performance difference. Use whatever is easiest. * Libxc shared libraries can be built with the "--enable-shared" option to configure. This might be slightly preferred because it reduces memory footprints for executables. * Typically when building GPAW one has to modify customize.py in a manner similar to the following:: library_dirs += ['/my/path/to/libxc/2.0.2/install/lib'] include_dirs += ['/my/path/to/libxc/2.0.2/install/include'] or if you don't want to modify your customize.py, you can add these lines to your .bashrc:: export C_INCLUDE_PATH=/my/path/to/libxc/2.0.2/install/include export LIBRARY_PATH=/my/path/to/libxc/2.0.2/install/lib export LD_LIBRARY_PATH=/my/path/to/libxc/2.0.2/install/lib Example:: wget http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.0.2.tar.gz -O libxc-2.0.2.tar.gz tar -xf libxc-2.0.2.tar.gz cd libxc-2.0.2 ./configure --enable-shared --prefix=$HOME/xc make make install # add these to your .bashrc: export C_INCLUDE_PATH=~/xc/include export LIBRARY_PATH=~/xc/lib export LD_LIBRARY_PATH=~/xc/lib .. _envvars: Environment variables ===================== .. envvar:: PATH Colon-separated paths where programs can be found. .. envvar:: PYTHONPATH Colon-separated paths where Python modules can be found. .. envvar:: OMP_NUM_THREADS Currently should be set to 1. .. envvar:: GPAW_SETUP_PATH Comma-separated paths to folders containing the PAW datasets. Set these permanently in your :file:`~/.bashrc` file:: $ export PYTHONPATH=~/gpaw:$PYTHONPATH $ export PATH=~gpaw/tools:$PATH or your :file:`~/.cshrc` file:: $ setenv PYTHONPATH ${HOME}/gpaw:${PYTHONPATH} $ setenv PATH ${HOME}/gpaw/tools:${PATH} gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/000077500000000000000000000000001316441372200227005ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/AIX/000077500000000000000000000000001316441372200233215ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/AIX/ibmsc.rst000066400000000000000000000007471316441372200251600ustar00rootroot00000000000000.. _ibmcsc: ============ ibmsc.csc.fi ============ Here you find information about the the system ``_. Debug like this:: p690m ~/gpaw/demo> dbx /p/bin/python2.3 Type 'help' for help. reading symbolic information ...warning: no source compiled with -g (dbx) run Python 2.3.4 (#4, May 28 2004, 15:30:35) [C] on aix5 Type "help", "copyright", "credits" or "license" for more information. >>> import grr gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/AIX/jump.rst000066400000000000000000000012771316441372200250350ustar00rootroot00000000000000.. _jump: ================== jump.fz-juelich.de ================== Here you find information about the the system ``_. The only way we found to compile numpy is using python2.3 and numpy-1.0.4. The next version numpy-1.1.0 did not work unfortunately. In addition the usage of the generic IBM lapack/blas in numpy does not work, hence one has to use site.cfg:: : diff site.cfg site.cfg.example 58,60c58,60 < [DEFAULT] < library_dirs = < include_dirs = --- > #[DEFAULT] > #library_dirs = /usr/local/lib > #include_dirs = /usr/local/include With his change numpy compiles and the installation of ASE and gpaw does not cause problems. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/AIX/seaborg.rst000066400000000000000000000015721316441372200255020ustar00rootroot00000000000000.. _seaborg: ================= seaborg.nersc.gov ================= Here you find information about the the system ``_. We need to use the mpi-enabled compiler ``mpcc`` and we should link to LAPACK before ESSL. Make sure LAPACK is added:: $ module add lapack and use this customize.py:: from os import environ mpicompiler = 'mpcc' libraries = ['f'] extra_link_args += [environ['LAPACK'], '-lessl'] The Numeric Python extension is not installed on NERSC, so we should install it. Get the Numeric-24.2 and do this:: $ wget http://downloads.sourceforge.net/numpy/Numeric-24.2.tar.gz $ gunzip -c Numeric-24.2.tar.gz | tar xf - $ cd Numeric-24.2 $ python setup.py install --home=$HOME and put the :file:`$HOME/lib/python/Numeric` directory in your :envvar:`PYTHONPATH`. Now we are ready to :ref:`compile GPAW ` gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/000077500000000000000000000000001316441372200233105ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/Makefile.ramdisk000066400000000000000000000010431316441372200263770ustar00rootroot00000000000000PROFILE=gpaw BGPHOME=unknown BGPBASE=/bgsys/drivers/ppcfloor BGP_LINUX_OS_PATH=/bgsys/linux/1.4.120091014 .PHONY: all clean install ramdisk all: @echo "Make Targets" @echo " install - copy ramdisk into kernel location" @echo " ramdisk - builds the ramdisk" @echo " clean - removes targets" install: cp ramdisk /bgsys/argonne-utils/profiles/$(PROFILE)/ramdisk chgrp bgpadmin /bgsys/argonne-utils/profiles/$(PROFILE)/ramdisk ramdisk: $(BGPBASE)/build-ramdisk --runos $(BGP_LINUX_OS_PATH) --addtree fs clean: rm -f ramdisk gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/bgp_gcc.py000066400000000000000000000025111316441372200252450ustar00rootroot00000000000000#!/usr/bin/env python """bgp_gcc.py is a wrapper for the BGP gcc compiler, converting/removing incompatible gcc args. """ from __future__ import print_function import sys from subprocess import call from glob import glob args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O2":"", "-O1":""} fragile_files = ["test.c"] non_c99files = glob('c/libxc/src/*.c') cmd = "" opt = 1 for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: opt = 2 if t in non_c99files: opt = 3 if t in args2change: cmd += args2change[t] else: cmd += arg flags_list = {1: "-g -O3 -std=c99 -fPIC", 2: "-g -O2 -std=c99 -fPIC", 3: "-g -O3 -fPIC", } flags = flags_list[opt] cmd = "mpicc %s %s"%(flags, cmd) print("\nexecmd: %s\n"%cmd) call(cmd, shell=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/bgp_gcc_linker.py000077500000000000000000000026001316441372200266130ustar00rootroot00000000000000#!/usr/bin/env python """bgp_gcc.py is a wrapper for the BGP gcc compiler, converting/removing incompatible gcc args. """ from __future__ import print_function import sys from subprocess import call from glob import glob args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O2":"", "-O1":""} fragile_files = ["test.c"] non_c99files = glob('c/libxc/src/*.c') cmd = "" opt = 1 for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: opt = 2 if t in non_c99files: opt = 3 if t in args2change: cmd += args2change[t] else: cmd += arg flags_list = {1: "-g -O3 -std=c99 -fPIC", 2: "-g -O2 -std=c99 -fPIC", 3: "-g -O3 -fPIC", } flags = flags_list[opt] cmd = "/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc %s %s"%(flags, cmd) print("\nexecmd: %s\n"%cmd) call(cmd, shell=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/bgp_xlc.py000077500000000000000000000033711316441372200253070ustar00rootroot00000000000000#!/usr/bin/env python """bgp_xlc.py is a wrapper for the BGP xlc compiler, converting/removing incompatible gcc args. """ from __future__ import print_function import sys from subprocess import call from glob import glob args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"-qlanglvl=extc99", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"-qmkshrobj", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O2":"", "-O1":"", "-fwrapv":""} fragile_files = ["test.c"] qhot_files = ["c/blas.c", "c/utilities.c","c/lfc.c","c/localized_functions.c"] non_c99files = glob('c/libxc/src/*.c') cmd = "" opt = 1 for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: opt = 2 if t in non_c99files: opt = 3 if t in qhot_files: opt = 4 if t in args2change: cmd += args2change[t] else: cmd += arg flags_list = {1: "-g -O3 -qlanglvl=extc99 -qflag=w:w -qpic", 2: "-g -O3 -qstrict -qlanglvl=extc99 -qflag=w:w -qpic", 3: "-g -O3 -qflag=w:w -qpic", 4: "-g -O3 -qhot -qlanglvl=extc99 -qflag=w:w -qpic", } flags = flags_list[opt] # make sure this matches the version of the XL compiler in bgp_xlc_linker.py # as well as the libraries in customize_surveyor_xlc.py cmd = "mpixlc_r %s %s"%(flags, cmd) print("\nexecmd: %s\n"%cmd) call(cmd, shell=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/bgp_xlc_linker.py000077500000000000000000000034301316441372200266470ustar00rootroot00000000000000#!/usr/bin/env python """bgp_xlc.py is a wrapper for the BGP xlc compiler, converting/removing incompatible gcc args. """ from __future__ import print_function import sys from subprocess import call from glob import glob args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"-qlanglvl=extc99", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"-qmkshrobj", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O2":"", "-O1":"", "-fwrapv":""} fragile_files = ["test.c"] qhot_files = ["c/blas.c", "c/utilities.c","c/lfc.c","c/localized_functions.c"] non_c99files = glob('c/libxc/src/*.c') cmd = "" opt = 1 for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: opt = 2 if t in non_c99files: opt = 3 if t in qhot_files: opt = 4 if t in args2change: cmd += args2change[t] else: cmd += arg flags_list = {1: "-g -O3 -qlanglvl=extc99 -qflag=w:w -qpic", 2: "-g -O3 -qstrict -qlanglvl=extc99 -qflag=w:w -qpic", 3: "-g -O3 -qflag=w:w -qpic", 4: "-g -O3 -qhot -qlanglvl=extc99 -qflag=w:w -qpic", } flags = flags_list[opt] # make sure this matches the version of the XL compiler in bgp_xlc.py # as well as the libraries in customize_surveyor_xlc.py cmd = "/soft/apps/ibmcmp-aug2011/vac/bg/9.0/bin/bgxlc_r %s %s"%(flags, cmd) print("\nexecmd: %s\n"%cmd) call(cmd, shell=True) building_with_gcc_on_surveyor.rst000066400000000000000000000300571316441372200321060ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP.. _building_with_gcc_on_surveyor: ========================== Building with gcc compiler ========================== NumPy ===== If you do not wish to build NumPy for yourself, you can use one of the following versions:: /soft/apps/python/python-2.6-cnk-gcc/numpy-1.2.1/lib/python2.6/site-packages /soft/apps/python/python-2.6-cnk-gcc/numpy-1.3.0/lib/python2.6/site-packages Choose your version of NumPy accordingly. NumPy 1.3.0 officially supports Python 2.6, NumPy 1.2.1 is available as a fall back for use with Python 2.6. **We highly recommend that you use the pre-built NumPy 1.3.0 rather than building your own.** The **0.3** version of gpaw uses Numeric ``_. Get the Numeric-24.2 (**only** if you want to run the **0.3** version of gpaw) and do this:: $ wget http://downloads.sourceforge.net/numpy/Numeric-24.2.tar.gz $ gunzip -c Numeric-24.2.tar.gz | tar xf - $ cd Numeric-24.2 $ /bgsys/drivers/ppcfloor/gnu-linux/bin/python setup.py install --root=$HOME/Numeric-24.2-1 The latest version of gpaw uses numpy ``_. To build an optimized numpy for the compute nodes, based on ``goto`` blas, save the :git:`numpy-1.0.4-gnu.py.patch.powerpc-bgp-linux-gfortran` patch file (modifications required to get powerpc-bgp-linux-gfortran instead of gfortran compiler), the :git:`numpy-1.0.4-system_info.py.patch.lapack_bgp_goto_esslbg` patch file (lapack section configured to use ``lapack_bgp`` and blas section to use ``goto``, ``cblas_bgp``, and ``esslbg``), and the :git:`numpy-1.0.4-site.cfg.lapack_bgp_goto_esslbg` file (contains paths to ``lapack_bgp``, ``goto``, ``esslbg`` , ``cblas_bgp``, and xlf* related libraries). **Note** that ``lapack_bgp`` and ``cblas_bgp`` are not available on ``surveyor/intrepid``, to build use instructions from ``_. Python requires all libraries to have names like ``liblapack_bgp.a``, so please make the required links for ``lapack_bgp.a``, and ``cblas_bgp.a``. Moreover numpy requires that ``lapack_bgp``, ``goto``, ``esslbg``, and ``cblas_bgp`` reside in the same directory, so choose a directory and edit ``numpy-1.0.4-site.cfg.lapack_bgp_goto_esslbg`` to reflect your installation path (in this example /home/dulak/from_Nils_Smeds/CBLAS_goto/lib/bgp). Include the directory containing cblas.h in include_dirs. Change the locations of the libraries to be used in the makefiles: /soft/apps/LIBGOTO and /opt/ibmcmp/lib/bg. **Warning** : If NumPy built using these libraries fails with errors of kind "R_PPC_REL24 relocation at 0xa3d664fc for symbol sqrt" - please add ``-qpic`` to compile options for both ``lapack_bgp`` and ``cblas_bgp``. After building ``lapack_bgp`` and ``cblas_bgp``, get numpy-1.0.4 and do this:: $ wget http://downloads.sourceforge.net/numpy/numpy-1.0.4.tar.gz $ gunzip -c numpy-1.0.4.tar.gz | tar xf - $ mv numpy-1.0.4 numpy-1.0.4.optimized; cd numpy-1.0.4.optimized $ patch -p1 < ../numpy-1.0.4-gnu.py.patch.powerpc-bgp-linux-gfortran $ patch -p1 < ../numpy-1.0.4-system_info.py.patch.lapack_bgp_goto_esslbg $ cp ../numpy-1.0.4-site.cfg.lapack_bgp_goto_esslbg site.cfg $ ldpath=/bgsys/drivers/ppcfloor/gnu-linux/lib $ ldflags="-Wl,--allow-multiple-definition -L/opt/ibmcmp/xlmass/bg/4.4/bglib" $ root=$HOME/numpy-1.0.4-1.optimized $ p=/bgsys/drivers/ppcfloor/gnu-linux/bin/python $ c="\"/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc -DNO_APPEND_FORTRAN -L/opt/ibmcmp/xlmass/bg/4.4/bglib\"" $ MATHLIB="mass" LDFLAGS="$ldflags" LD_LIBRARY_PATH="$ldpath" CC="$c" $p setup.py install --root="$root" NumPy built in this way does contain the :file:`$root/bgsys/drivers/ppcfloor/gnu-linux/lib/python2.5/site-packages/numpy/core/_dotblas.so` , and running the following python script results in better time than the standard version of numpy (~156 vs. ~329 sec) for ``numpy.dot`` operation (:download:`numpy_dot.py`): .. literalinclude:: numpy_dot.py To build standard numpy, save the :download:`numpy-1.0.4-gnu.py.patch` patch file (modifications required to get mpif77 instead of gfortran compiler), get and numpy-1.0.4 and do this:: $ wget http://downloads.sourceforge.net/numpy/numpy-1.0.4.tar.gz $ gunzip -c numpy-1.0.4.tar.gz | tar xf - $ cd numpy-1.0.4 $ patch -p1 < ../numpy-1.0.4-gnu.py.patch $ ldpath=/bgsys/drivers/ppcfloor/gnu-linux/lib $ root=$HOME/numpy-1.0.4-1 $ p=/bgsys/drivers/ppcfloor/gnu-linux/bin/python $ c="\"mpicc\"" $ LD_LIBRARY_PATH="$ldpath" CC="$c" $p setup.py install --root="$root" The instructions for standard numpy also work for NumPy 1.2.1 and NumPy 1.3.0. Build python-nose:: $ wget http://python-nose.googlecode.com/files/nose-0.11.0.tar.gz $ tar zxf nose-0.11.0.tar.gz $ cd nose-0.11.0 $ p=/bgsys/drivers/ppcfloor/gnu-linux/bin/python $ $p setup.py install --root=${HOME}/python-nose-0.11.0-1 2>&1 | tee install.log GPAW ==== Step 1 ====== Download all the necessary packages: * :ref:`ASE ` * :ref:`GPAW ` * :ref:`PAW datasets ` Step 2 ====== Add the following environment variables .. literalinclude:: surveyor.softenvrc to your own :file:`.softenvrc` and type:: resoft to update your environment in the main login terminal. Step 3 ====== This step is obsolete with revision 6116. Because the ``popen3`` function is missing, you will need to remove all the contents of the :file:`gpaw/version.py` file after ``ase_required_svnversion =``. The same holds for :file:`ase/version.py` in the ase installation! Suggestions how to skip the ``popen3`` testing in :file:`gpaw/version.py` on BG/P are welcome! Step 4 ====== A number of the GPAW source files in ``gpaw/c`` directory are built using the ``distutils`` module which makes it difficult to control the flags which are passed to the gnu compiler. A workaround is to use the following python script: :git:`bgp_gcc.py`. Additionally, it is desirable to static link as many libraries as possible. This requires bypassing the mpi wrapper to the compiler using another python script :git:`bgp_gcc_linker.py`. Lastly, we must use these work arounds in conjunction with two configures files :git:`customize_surveyor_gcc.py` and :git:`config_surveyor.py`, the latter requires renaming to ``config.py`` in the top level directory. .. literalinclude:: bgp_gcc.py .. literalinclude:: bgp_gcc_linker.py .. literalinclude:: customize_surveyor_gcc.py Download these scripts into the top level GPAW directory:: export GPAW_TRUNK=http://svn.fysik.dtu.dk/projects/gpaw/trunk wget --no-check-certificate ${GPAW_TRUNK}/doc/platforms/BGP/bgp_gcc.py chmod u+x bgp_gcc.py wget --no-check-certificate ${GPAW_TRUNK}/doc/platforms/BGP/bgp_gcc_linker.py chmod u+x bgp_gcc_linker.py wget --no-check-certificate ${GPAW_TRUNK}/doc/platforms/BGP/customize_surveyor_gcc.py wget --no-check-certificate ${GPAW_TRUNK}/doc/platforms/BGP/config_surveyor.py mv config_surveyor.py config.py Finally, we build GPAW by typing:: /bgsys/drivers/ppcfloor/gnu-linux/bin/python setup.py build_ext --ignore-numpy --customize=customize_surveyor_gcc.py 2>&1 | tee build_ext.log If an optimized version of NumPy is in your $PYTHONPATH you may need append "--ignore-numpy". Additional BG/P specific hacks =============================== A FLOPS (floating point per second) counter and a number of other hardware counters can be enabled with the macro:: define_macros += [('GPAW_HPM',1)] This hpm library is available on the BG/P machines at Argonne National Laboratory. It will produce two files for each core: ``hpm_flops.$rank`` and ``hpm_data.$rank``. The latter one contains a number of additional hardware counters. There are four cores per chip and data for only two of the four cores can be collected simultaneously. This is set through an environment variable which is passed to Cobalt with the *--env* flag. *BGP_COUNTER_MODE=0* specifies core 1 and 2, while *BGP_COUNTER_MODE=1* specifies core 3 and 4. A mapfile for the ranks can be generated by adding another macro to customize.py:: define_macros += [('GPAW_MAP',1)] Submitting jobs ================== This is an example submission script :git:`surveyor.sh` for use with the Cobalt scheduler: .. literalinclude:: surveyor.sh Users should read the :ref:`parallel_runs` page and the :ref:`bgp_performance` page. Running from ramdisk ====================== There are two I/O bottlenecks present when running GPAW at scale: 1) loading .py(c) and 2) loading .so. For jobs requiring 8192 vn nodes or larger, the initialization time was measured at 40+ minutes. A work-around developed for the BlueGene/P system at Argonne National Laboratory was to install GPAW and all supporting libraries on a ramdisk. The supporting libraries include:: Python 2.6 NumPy 1.3.0 ASE GPAW The ramdisk utility provided IBM has some weird quirks that one should be aware of: 1) files cannot be installed in the root of the ramdisk, everything should go in a directory like ``/gpaw`` 2) empty directories and their child directores are not recognized properly; the solution is to create a zero-size file, e.g. ``touch README``, in each empty directory. 3) symbolic links are not supported The top-level directory/file structure should look something like this:: $HOME/bgpramdisk/Makefile $HOME/bgpramdisk/fs $HOME/bgpramdisk/fs/gpaw $HOME/bgpramdisk/fs/gpaw/README $HOME/bgpramdisk/fs/gpaw/lib $HOME/bgpramdisk/fs/gpaw/V1R4M2 An example Makefile is provided :git:`Makefile.ramdisk`, note that BGP_LINUX_OS_PATH version will be a function of the OS driver. The group and installation directory will be provided by the BlueGene/P sys admin. Copy all the supporting libraries unto the ramdisk. For simplicity, we install the Python packages into the site-packages directory which is automatically searched by the Python Intrepreter:: cp -r /bgsys/driver/ppcfloor/gnu/linux/lib/python2.6 $HOME/bgpramdisk/fs/gpaw/lib/ cp -r /soft/apps/python/python-2.6-cnk-gcc/numpy-1.3.0/lib/site-packages/numpy $HOME/bgpramdisk/fs/gpaw/lib/python2.6/site-packages/ cp -r $HOME/gpaw-/gpaw $HOME/bgpramdisk/fs/gpaw/lib/python2.6/site-packages/ cp -r $HOME/ase-/ase $HOME/bgpramdisk/fs/gpaw/python2.6/lib/site-packages/ Make sure that all these libraries are byte compiled. Python 2.6 and NumPy 1.3.0 should already be byte compiled, but it is likely that ASE and GPAW won't be. ``cd`` into their respective directories on the ramdisk and type:: /bgsys/drivers/ppcfloor/gnu-linux/bin/python -m compileall . In order to save space on the ramdisk, delete the ``*.py``, but keep the ``*.pyc.``:: find -name "*.py" -exec rm -rf {} \; The MPI shared libraries can also installed on the ramdisk so they will seamlessly work with the TAU Performance System, but static libraries can be used instead:: cp /bgsys/drivers/ppcfloor/comm/default/lib/libmpich.cnk.so.1.1 $HOME/bgpramdisk/fs/gpaw/V1R4M2/ cp /bgsys/drivers/ppcfloor/comm/sys/lib/libdcmfcoll.cnk.so $HOME/bgpramdisk/fs/gpaw/V1R4M2/ cp /bgsys/drivers/ppcfloor/comm/sys/lib/libdcmf.cnk.so $HOME/bgpramdisk/fs/gpaw/V1R4M2/ cp /bgsys/drivers/ppcfloor/runtime/SPI/libSPI.cna.so $HOME/bgpramdisk/fs/gpaw/V1R4M2/ TAU profiling also requires some additional files for automatic and manual instrumentation:: cp /soft/apps/tau/tau-2.19.2/bgp/lib/ltau.py $HOME/bgpramdisk/fs/gpaw/tau-2.19.2/ cp /soft/apps/tau/tau-2.19.2/bgp/lib/tau.py $HOME/bgpramdisk/fs/gpaw/tau-2.19.2/ cp /soft/apps/tau/tau-2.19.2/bgp/lib/ibTAUsh-phase-bgptimers-gnu-mpi-python-pdt.so $HOME/bgpramdisk/fs/gpaw/tau-2.19.2/ cp /soft/apps/tau/tau-2.19.2/bgp/lib/ibTAUsh-phase-bgptimers-gnu-mpi-python-pdt.so $HOME/bgpramdisk/fs/gpaw/tau-2.19.2/ctau_impl.so cp /soft/apps/tau/tau-2.19.2/bgp/lib/ibTAUsh-phase-bgptimers-gnu-mpi-python-pdt.so $HOME/bgpramdisk/fs/gpaw/tau-2.19.2/pytau.so Lastly, there will be some changes to the environment variables in your submission script:: PYTHONHOME=/gpaw LD_LIBRARY_PATH=/lib:/gpaw/V1R4M2 PYTHONPATH should be empty unless you have installed another software package on the ramdisk. In any case, it should not point to any physical diskspace building_with_xlc_on_surveyor.rst000066400000000000000000000015001316441372200321270ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP.. _building_with_xlc_on_surveyor: ========================== Building with xlc compiler ========================== NumPy ======= We currently do not know how to build NumPy with xlc on BG/P. GPAW ==== A performance improvement of 25% has been observed using xlc over gcc for medium-size systems where DGEMM does not dominate the wall-clock time. For large-systems, NBANDS > 5000, there is is little performance improvement since DGEMM makes up a large fraction of the wall-clock time. Proceed as in the :ref:`building_with_gcc_on_surveyor`, but use the following :git:`bgp_xlc.py` file: .. literalinclude:: bgp_xlc.py Finally, change the lines in :git:`customize_surveyor_gcc.py` accordingly:: mpicompiler = "bgp_xlc.py" compiler = "bgp_xlc.py" mpilinker = "bgp_xlc_linker.py" Everything else should be the same. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/config_surveyor.py000066400000000000000000000430601316441372200271100ustar00rootroot00000000000000# Copyright (C) 2006 CSC-Scientific Computing Ltd. # Please see the accompanying LICENSE file for further information. from __future__ import print_function import os import sys import re import distutils.util from distutils.version import LooseVersion from distutils.sysconfig import get_config_var, get_config_vars from distutils.command.config import config from glob import glob from os.path import join from stat import ST_MTIME def check_packages(packages, msg, include_ase, import_numpy): """Check the python version and required extra packages If ASE is not installed, the `packages` list is extended with the ASE modules if they are found.""" if sys.version_info < (2, 3, 0, 'final', 0): raise SystemExit('Python 2.3.1 or later is required!') if import_numpy: try: import numpy except ImportError: raise SystemExit('numpy is not installed!') else: msg += ['* numpy is not installed.', ' "include_dirs" in your customize.py must point to "numpy/core/include".'] if not include_ase: if import_numpy: try: import ase except ImportError: import_ase = True else: import_ase = False else: import_ase = False if include_ase or import_ase: # Find ASE directories: # include_ase works in case: # cd gpaw # top-level gpaw source directory # tar zxf ~/python-ase-3.1.0.846.tar.gz # ln -s python-ase-3.1.0.846/ase . ase_root = 'ase' if include_ase: assert os.path.isdir(ase_root), ase_root+': No such file or directory' ase = [] for root, dirs, files in os.walk(ase_root): if 'CVS' in dirs: dirs.remove('CVS') if '.svn' in dirs: dirs.remove('.svn') if '__init__.py' in files: ase.append(root.replace('/', '.')) if len(ase) == 0: msg += ['* ASE is not installed! You may be able to install', " gpaw, but you can't use it without ASE!"] else: packages += ase def find_file(arg, dir, files): #looks if the first element of the list arg is contained in the list files # and if so, appends dir to to arg. To be used with the os.path.walk if arg[0] in files: arg.append(dir) def get_system_config(define_macros, undef_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, msg, import_numpy): undef_macros += ['NDEBUG'] if import_numpy: import numpy include_dirs += [numpy.get_include()] include_dirs += ['c/libxc'] machine = os.uname()[4] if machine == 'sun4u': # _ # |_ | ||\ | # _||_|| \| # extra_compile_args += ['-Kpic', '-fast'] # Suppress warning from -fast (-xarch=native): f = open('cc-test.c', 'w') f.write('int main(){}\n') f.close() stderr = os.popen3('cc cc-test.c -fast')[2].read() arch = re.findall('-xarch=(\S+)', stderr) os.remove('cc-test.c') if len(arch) > 0: extra_compile_args += ['-xarch=%s' % arch[-1]] # We need the -Bstatic before the -lsunperf and -lfsu: # http://forum.java.sun.com/thread.jspa?threadID=5072537&messageID=9265782 extra_link_args += ['-Bstatic', '-lsunperf', '-lfsu', '-Bdynamic'] cc_version = os.popen3('cc -V')[2].readline().split()[3] if LooseVersion(cc_version) > '5.6': libraries.append('mtsk') else: extra_link_args.append('-lmtsk') #define_macros.append(('NO_C99_COMPLEX', '1')) msg += ['* Using SUN high performance library'] elif sys.platform in ['aix5', 'aix6']: # # o|_ _ _ # ||_)| | | # extra_compile_args += ['-qlanglvl=stdc99'] # setting memory limit is necessary on aix5 if sys.platform == 'aix5': extra_link_args += ['-bmaxdata:0x80000000', '-bmaxstack:0x80000000'] libraries += ['f', 'lapack', 'essl'] define_macros.append(('GPAW_AIX', '1')) elif machine == 'x86_64': # _ # \/|_||_ |_ |_| # /\|_||_| _ |_| | # extra_compile_args += ['-Wall', '-std=c99'] # Look for ACML libraries: acml = glob('/opt/acml*/g*64/lib') if len(acml) > 0: library_dirs += [acml[-1]] libraries += ['acml'] if acml[-1].find('gfortran') != -1: libraries.append('gfortran') if acml[-1].find('gnu') != -1: libraries.append('g2c') extra_link_args += ['-Wl,-rpath=' + acml[-1]] msg += ['* Using ACML library'] else: atlas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libatlas.a')) != []: atlas = True break if atlas: libraries += ['lapack', 'atlas', 'blas'] library_dirs += [dir] msg += ['* Using ATLAS library'] else: libraries += ['blas', 'lapack'] msg += ['* Using standard lapack'] elif machine =='ia64': # _ _ # |_ | o # _||_|| # extra_compile_args += ['-Wall', '-std=c99'] libraries += ['mkl','mkl_lapack64'] elif machine == 'i686': # _ # o|_ |_||_ # ||_||_||_| # extra_compile_args += ['-Wall', '-std=c99'] if 'MKL_ROOT' in os.environ: mklbasedir = [os.environ['MKL_ROOT']] else: mklbasedir = glob('/opt/intel/mkl*') libs = ['libmkl_ia32.a'] if mklbasedir != []: os.path.walk(mklbasedir[0],find_file, libs) libs.pop(0) if libs != []: libs.sort() libraries += ['mkl_lapack', 'mkl_ia32', 'guide', 'pthread', 'mkl']#, 'mkl_def'] library_dirs += libs msg += ['* Using MKL library: %s' % library_dirs[-1]] #extra_link_args += ['-Wl,-rpath=' + library_dirs[-1]] else: atlas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libatlas.a')) != []: atlas = True break if atlas: libraries += ['lapack', 'atlas', 'blas'] library_dirs += [dir] msg += ['* Using ATLAS library'] else: libraries += ['blas', 'lapack'] msg += ['* Using standard lapack'] # add libg2c if available g2c=False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libg2c.so')) != []: g2c=True break if glob(join(dir, 'libg2c.a')) != []: g2c=True break if g2c: libraries += ['g2c'] elif sys.platform == 'darwin': extra_compile_args += ['-Wall', '-std=c99'] include_dirs += ['/usr/include/malloc'] if glob('/System/Library/Frameworks/vecLib.framework') != []: extra_link_args += ['-framework vecLib'] msg += ['* Using vecLib'] else: libraries += ['blas', 'lapack'] msg += ['* Using standard lapack'] return msg def get_parallel_config(mpi_libraries,mpi_library_dirs,mpi_include_dirs, mpi_runtime_library_dirs,mpi_define_macros): globals = {} exec(open('gpaw/mpi/config.py').read(), globals) mpi = globals['get_mpi_implementation']() if mpi == '': mpicompiler = None elif mpi == 'sun': mpi_include_dirs += ['/opt/SUNWhpc/include'] mpi_libraries += ['mpi'] mpi_library_dirs += ['/opt/SUNWhpc/lib'] mpi_runtime_library_dirs += ['/opt/SUNWhpc/lib'] mpicompiler = get_config_var('CC') elif mpi == 'poe': mpicompiler = 'mpcc_r' else: #Try to use mpicc mpicompiler = 'mpicc' return mpicompiler def get_scalapack_config(define_macros): # check ScaLapack settings define_macros.append(('GPAW_WITH_SL', '1')) def get_hdf5_config(define_macros): # check ScaLapack settings define_macros.append(('GPAW_WITH_HDF5', '1')) def mtime(path, name, mtimes): """Return modification time. The modification time of a source file is returned. If one of its dependencies is newer, the mtime of that file is returned. This function fails if two include files with the same name are present in different directories.""" include = re.compile('^#\s*include "(\S+)"', re.MULTILINE) if name in mtimes: return mtimes[name] t = os.stat(os.path.join(path, name))[ST_MTIME] for name2 in include.findall(open(os.path.join(path, name)).read()): path2, name22 = os.path.split(name2) if name22 != name: t = max(t, mtime(os.path.join(path, path2), name22, mtimes)) mtimes[name] = t return t def check_dependencies(sources): # Distutils does not do deep dependencies correctly. We take care of # that here so that "python setup.py build_ext" always does the right # thing! mtimes = {} # modification times # Remove object files if any dependencies have changed: plat = distutils.util.get_platform() + '-' + sys.version[0:3] remove = False for source in sources: path, name = os.path.split(source) t = mtime(path + '/', name, mtimes) o = 'build/temp.%s/%s.o' % (plat, source[:-2]) # object file if os.path.exists(o) and t > os.stat(o)[ST_MTIME]: print('removing', o) os.remove(o) remove = True so = 'build/lib.%s/_gpaw.so' % plat if os.path.exists(so) and remove: # Remove shared object C-extension: # print 'removing', so os.remove(so) def test_configuration(): raise NotImplementedError def write_configuration(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, mpicompiler, mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): # Write the compilation configuration into a file try: out = open('configuration.log', 'w') except IOError as x: print(x) return print("Current configuration", file=out) print("libraries", libraries, file=out) print("library_dirs", library_dirs, file=out) print("include_dirs", include_dirs, file=out) print("define_macros", define_macros, file=out) print("extra_link_args", extra_link_args, file=out) print("extra_compile_args", extra_compile_args, file=out) print("runtime_library_dirs", runtime_library_dirs, file=out) print("extra_objects", extra_objects, file=out) if mpicompiler is not None: print(file=out) print("Parallel configuration", file=out) print("mpicompiler", mpicompiler, file=out) print("mpi_libraries", mpi_libraries, file=out) print("mpi_library_dirs", mpi_library_dirs, file=out) print("mpi_include_dirs", mpi_include_dirs, file=out) print("mpi_define_macros", mpi_define_macros, file=out) print("mpi_runtime_library_dirs", mpi_runtime_library_dirs, file=out) out.close() def build_interpreter(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, mpicompiler, mpilinker, mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): #Build custom interpreter which is used for parallel calculations cfgDict = get_config_vars() plat = distutils.util.get_platform() + '-' + sys.version[0:3] cfiles = glob('c/[a-zA-Z_]*.c') + ['c/bmgs/bmgs.c'] cfiles += glob('c/libxc/src/*.c') cfiles2remove = ['c/libxc/src/test.c', 'c/libxc/src/xc_f.c', 'c/libxc/src/work_gga_x.c', 'c/libxc/src/work_lda.c' ] for c2r in glob('c/libxc/src/funcs_*.c'): cfiles2remove.append(c2r) for c2r in cfiles2remove: cfiles.remove(c2r) sources = ['c/bc.c', 'c/localized_functions.c', 'c/mpi.c', 'c/_gpaw.c', 'c/operators.c', 'c/transformers.c', 'c/blacs.c', 'c/utilities.c', 'c/hdf5.c'] objects = ' '.join(['build/temp.%s/' % plat + x[:-1] + 'o' for x in cfiles]) if not os.path.isdir('build/bin.%s/' % plat): os.makedirs('build/bin.%s/' % plat) exefile = 'build/bin.%s/' % plat + '/gpaw-python' # if you want static linked MPI libraries, uncomment the line below libraries += mpi_libraries library_dirs += mpi_library_dirs define_macros += mpi_define_macros include_dirs += mpi_include_dirs runtime_library_dirs += mpi_runtime_library_dirs define_macros.append(('PARALLEL', '1')) define_macros.append(('GPAW_INTERPRETER', '1')) macros = ' '.join(['-D%s=%s' % x for x in define_macros if x[0].strip()]) include_dirs.append(cfgDict['INCLUDEPY']) include_dirs.append(cfgDict['CONFINCLUDEPY']) includes = ' '.join(['-I' + incdir for incdir in include_dirs]) library_dirs.append(cfgDict['LIBPL']) lib_dirs = ' '.join(['-L' + lib for lib in library_dirs]) libs = ' '.join(['-l' + lib for lib in libraries if lib.strip()]) # BlueGene/P can statically link everything except # python, runtime and pthread library libs += ' -Wl,-dy' libs += ' -lpython%s ' % cfgDict['VERSION'] # if you want dynamic linked MPI libraries, uncomment the line below # only really needed for TAU profiling # libs += ' '.join(['-l' + lib for lib in mpi_libraries]) libs += ' -lrt -lpthread' # libs = ' '.join([libs, cfgDict['LIBS'], cfgDict['LIBM']]) #Hack taken from distutils to determine option for runtime_libary_dirs if sys.platform[:6] == 'darwin': # MacOSX's linker doesn't understand the -R flag at all runtime_lib_option = '-L' elif sys.platform[:5] == 'hp-ux': runtime_lib_option = '+s -L' elif os.popen('mpicc --showme 2> /dev/null', 'r').read()[:3] == 'gcc': runtime_lib_option = '-Wl,-R' elif os.popen('mpicc -show 2> /dev/null', 'r').read()[:3] == 'gcc': runtime_lib_option = '-Wl,-R' else: runtime_lib_option = '-R' runtime_libs = ' '.join([ runtime_lib_option + lib for lib in runtime_library_dirs]) extra_link_args.append(cfgDict['LDFLAGS']) if sys.platform in ['aix5', 'aix6']: extra_link_args.append(cfgDict['LINKFORSHARED'].replace('Modules', cfgDict['LIBPL'])) elif sys.platform == 'darwin': pass else: extra_link_args.append(cfgDict['LINKFORSHARED']) if ('IO_WRAPPERS', 1) in define_macros: extra_link_args += ['-Wl,-wrap,fread', '-Wl,-wrap,_IO_getc', '-Wl,-wrap,getc_unlocked', '-Wl,-wrap,fgets', '-Wl,-wrap,ungetc', '-Wl,-wrap,feof', '-Wl,-wrap,ferror', '-Wl,-wrap,fflush', '-Wl,-wrap,fseek', '-Wl,-wrap,rewind', # '-Wl,-wrap,fileno', '-Wl,-wrap,flockfile', '-Wl,-wrap,funlockfile', '-Wl,-wrap,clearerr', '-Wl,-wrap,fgetpos', '-Wl,-wrap,fsetpos', '-Wl,-wrap,setbuf', '-Wl,-wrap,setvbuf', '-Wl,-wrap,ftell', '-Wl,-wrap,fstat', '-Wl,-wrap,fstat64', '-Wl,-wrap,fgetc', # '-Wl,-wrap,fputc', # '-Wl,-wrap,fputs', # '-Wl,-wrap,fwrite', # '-Wl,-wrap,_IO_putc', '-Wl,-wrap,fopen', '-Wl,-wrap,fopen64', '-Wl,-wrap,fclose', ] # Compile the parallel sources for src in sources: obj = 'build/temp.%s/' % plat + src[:-1] + 'o' cmd = ('%s %s %s %s -o %s -c %s ' ) % \ (mpicompiler, macros, ' '.join(extra_compile_args), includes, obj, src) print(cmd) if '--dry-run' not in sys.argv: error=os.system(cmd) if error != 0: msg = ['* compiling FAILED! Only serial version of code will work.'] break # Link the custom interpreter cmd = ('%s -o %s %s %s %s %s %s %s' ) % \ (mpilinker, exefile, objects, ' '.join(extra_objects), lib_dirs, libs, runtime_libs, ' '.join(extra_link_args)) msg = ['* Building a custom interpreter'] print(cmd) if '--dry-run' not in sys.argv: error=os.system(cmd) if error != 0: msg += ['* linking FAILED! Only serial version of code will work.'] return error, msg gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/customize_rbgc.py000066400000000000000000000024671316441372200267120ustar00rootroot00000000000000scalapack = True extra_compile_args += [ '-O3' ] libraries = [ 'gfortran', 'lapack_bgp', 'scalapack', 'blacs', 'lapack_bgp', 'goto', 'xlf90_r', 'xlopt', 'xl', 'xlfmath', 'xlsmp' ] library_dirs = [ '/home/mdulak/blas-lapack-lib', '/home/mdulak/blacs-dev', '/home/mdulak/SCALAPACK', '/opt/ibmcmp/xlf/bg/11.1/bglib', '/opt/ibmcmp/xlsmp/bg/1.7/bglib', '/bgsys/drivers/ppcfloor/gnu-linux/lib' ] gpfsdir = '/gpfs/fs2/frontend-13/mdulak' python_site = 'bgsys/drivers/ppcfloor/gnu-linux' include_dirs += [gpfsdir+'/Numeric-24.2-1/'+python_site+'/include/python2.5', gpfsdir+'/numpy-1.0.4-1.optimized/'+python_site+'/lib/python2.5/site-packages/numpy/core/include'] extra_compile_args += ['-std=c99'] define_macros += [('GPAW_AIX', '1')] define_macros += [('GPAW_BGP', '1')] define_macros += [('GPAW_NO_UNDERSCORE_BLAS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_LAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_BLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_SCALAPACK', '1')] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/customize_surveyor_gcc.py000066400000000000000000000050741316441372200305040ustar00rootroot00000000000000define_macros += [('GPAW_NO_UNDERSCORE_BLAS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_LAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_BLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_SCALAPACK', '1')] define_macros += [('GPAW_ASYNC',1)] define_macros += [('GPAW_MPI2',1)] # define_macros += [('GPAW_MR3',1)] # requires experimental ScaLAPACK # uncomment two lines below for FLOP rate measurement # define_macros += [('GPAW_HPM',1)] # define_macros += [('GPAW_PERFORMANCE_REPORT',1)] define_macros += [('GPAW_MPI_DEBUG',1)] # debugging # define_macros += [('GPAW_OMP',1)] # not really working hdf5 = True scalapack = True # If you are using threading, you probably # need to change the following library: # xlomp_ser -> xlsmp # # DO NOT INTERCHANGE THE ORDER OF LAPACK # & ESSL, LAPACK SHOULD BE LINKED FIRST. # # Goto BLAS is broken on BG/P. It should not be used. # libraries = [ # 'scalapackmr3', 'scalapack', 'blacsCinit_MPI-BGP-0', 'blacs_MPI-BGP-0', 'lapack_bgp', 'esslbg', 'hdf5', 'xlf90_r', 'xlopt', 'xl', 'xlfmath', 'xlomp_ser', # 'hpm', ] # make sure XL library_dirs below match XL compiler version # (e.g. aug2010, jan2011) used in mpilinker variable library_dirs = [ '/soft/apps/SCALAPACK-dev-r98', '/soft/apps/LAPACK', '/soft/apps/ESSL-4.4.1-1/lib', '/soft/apps/ibmcmp-aug2011/xlf/bg/11.1/bglib', '/soft/apps/ibmcmp-aug2011/xlsmp/bg/1.7/bglib', '/bgsys/drivers/ppcfloor/gnu-linux/lib', # '/soft/apps/UPC/lib', '/soft/apps/hdf5-1.8.0/lib', ] include_dirs += [ '/soft/apps/python/python-2.6-cnk-gcc/numpy-1.3.0/lib/python2.6/site-packages/numpy/core/include', '/soft/apps/hdf5-1.8.0/include' ] # TAU library below needed for automatic instrumentation only mpi_libraries = [ # 'TAU', 'mpich.cnk', 'opa', 'dcmf.cnk', 'dcmfcoll.cnk', 'SPI.cna', ] mpi_library_dirs = [ '/soft/apps/tau/tau-2.19.2/bgp/lib/bindings-bgptimers-gnu-mpi-python-pdt', '/bgsys/drivers/ppcfloor/comm/default/lib', '/bgsys/drivers/ppcfloor/comm/sys/lib', '/bgsys/drivers/ppcfloor/runtime/SPI', ] extra_link_args += ['-Wl,-export-dynamic'] # make symbols in *.a visible to *.so, needed for TAU compiler = "bgp_gcc.py" mpicompiler = "bgp_gcc.py" mpilinker = "bgp_gcc_linker.py" gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/gpaw-script.llrun000066400000000000000000000032041316441372200266250ustar00rootroot00000000000000#!/bin/bash # @ job_type = bluegene # @ requirements = (Machine == "$(host)") # @ class = medium # @ job_name = $(user).$(host) # @ comment = "LoadLeveler llrun script" # @ error = $(job_name).$(jobid).err # @ output = $(job_name).$(jobid).out # @ wall_clock_limit = 00:30:00 # @ notification = always # @ notify_user = # @ bg_connection = prefer_torus # @ bg_size = 32 # @ queue dir=/gpfs/fs2/frontend-13/$USER home=$dir prog=${home}/gpaw/build/bin.linux-ppc64-2.5/gpaw-python #prog=/bgsys/drivers/ppcfloor/gnu-linux/bin/python args="${home}/gpaw/test/CH4.py --sl_diagonalize=2,2,2" ldpath="${ldpath}:/bgsys/opt/ibmcmp/lib/bg" ldpath="${ldpath}:/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib" ldpath="${ldpath}:/bgsys/drivers/ppcfloor/gnu-linux/lib" pythonpath=":${home}/Numeric-24.2-1/bgsys/drivers/ppcfloor/gnu-linux/lib/python2.5/site-packages/Numeric" pythonpath="${pythonpath}:${home}/numpy-1.0.4-1.optimized/bgsys/drivers/ppcfloor/gnu-linux/lib/python2.5/site-packages" pythonpath="${pythonpath}:${home}/gpaw" pythonpath="${pythonpath}:${home}/ase3k:" export LD_LIBRARY_PATH=\"$ldpath\" export PYTHONPATH=\"$pythonpath\" export GPAW_SETUP_PATH="${home}/gpaw-setups-0.4.2039" export OMP_NUM_THREADS=1 mpirun=/bgsys/drivers/ppcfloor/bin/mpirun runargs="-np 32" runargs="$runargs -cwd $PWD" runargs="$runargs -exp_env LD_LIBRARY_PATH -exp_env PYTHONPATH -exp_env GPAW_SETUP_PATH -exp_env OMP_NUM_THREADS" runargs="$runargs -mode SMP" runargs="$runargs -verbose 1" echo "Hello. This is `hostname` at `date` `pwd`" echo "$mpirun $runargs $prog $args" /usr/bin/time $mpirun $runargs $prog $args echo "Program completed at `date` with exit code $?." gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/intrepid-ramdisk.sh000077500000000000000000000031141316441372200271140ustar00rootroot00000000000000type=Au_bulk6x6x6 cwd=`pwd` acct=Gpaw queue=prod time=45 nodes=8192 mode=vn # uncomment below for mapfile # mapfile=BGMAP_8x8x4x16 # 1024 nodes # mapping=$mapfile mapping=ZYXT input=${type}.py scratch=/intrepid-fs0/users/${USER}/persistent install=/gpfs/home/${USER} setups=/soft/apps/gpaw-setups-0.6.6300 gpawversion=7800 sharelibs=/lib:/gpaw/V1R4M2 job=${type}_${nodes}_${mode}_${mapping}_r${gpawversion} taulibs=/gpaw/tau-2.19.2 bin=gpaw-python kernel=gpaw rm -rf $scratch/$job mkdir $scratch/$job cp $input $scratch/$job cp $mapfile $scratch/$job # cp $pos $scratch/$job cd $scratch/$job # Many of the values for the DMCF variables below are defaults # pristine qsub --kernel $kernel -A $acct -n $nodes -t $time -q $queue --mode $mode --env DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONHOME=/gpaw:LD_LIBRARY_PATH=$sharelibs ${install}/gpaw-r${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${type}.py --domain-decomposition=8,8,4 --state-parallelization=16 # TAU manual instrumentation # qsub --kernel $kernel -A $acct -n $nodes -t $time -q $queue --mode $mode --env TAU_VERBOSE=1:TAU_CALLPATH=0:TAU_CALLPATH_DEPTH=10:TAU_COMM_MATRIX=0:TAU_TRACK_MESSAGE=0:TAU_THROTTLE=0:TAU_COMPENSATE=1:TAU_METRICS=BGPTIMERS:DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONHOME=/gpaw:PYTHONPATH=${taulibs}:LD_LIBRARY_PATH=$sharelibs:${taulibs} ${install}/gpaw-r${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${type}.py --domain-decomposition=8,8,16 --state-parallelization=32 gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/jugene.rst000066400000000000000000000056721316441372200253310ustar00rootroot00000000000000.. _jugene: ==================== jugene.fz-juelich.de ==================== Here you find information about the system ``_. Numpy needs to be build with powerpc-bgp-linux-gfortran instead of gfortran compiler, so in order to build numpy specify the environment variable F90:: $ export F90=/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin/gfortran After that, numpy can be installed to $HOME/python as:: $ ldpath=/bgsys/drivers/ppcfloor/gnu-linux/lib $ p=/bgsys/drivers/ppcfloor/gnu-linux/bin/python $ LD_LIBRARY_PATH="$ldpath" $p setup.py install --home=$HOME/python In order to build GPAW, use the following customize.py:: scalapack = True libraries = [ 'scalapack', 'blacsCinit', 'blacsF77init', 'blacs', 'lapack', 'esslbg', 'xl', 'xlopt', 'xlf90_r', 'xlfmath', 'pthread', 'xlomp_ser', ] library_dirs = [ '/bgsys/local/lib/', '/opt/ibmcmp/xlf/bg/11.1/lib', '/opt/ibmcmp/xlsmp/bg/1.7/lib', '/bgsys/drivers/ppcfloor/gnu-linux/lib' ] extra_compile_args += ['-std=c99'] define_macros += [('GPAW_AIX', '1')] define_macros += [('GPAW_BGP', '1')] define_macros += [('GPAW_NO_UNDERSCORE_BLAS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_LAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_BLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_SCALAPACK', '1')] Because of missing ``popen3`` function you need to remove all the contents of the :file:`gpaw/version.py` file after ``version = '0.4'``. The same holds for :file:`ase/version.py` in the ase installation! Suggestions how to skip the ``popen3`` testing in :file:`gpaw/version.py` on BGP are welcome! Here is an example of batch job script:: #!/bin/bash # @ job_name = hello # @ output = $(job_name).o$(jobid) # @ error = $(job_name).e$(jobid) # @ wall_clock_limit = 00:12:00 # @ notification = never # @ notify_user = my_email@csc.fi # @ job_type = bluegene # @ bg_size = 1 # @ queue home=/homea/prace/prace025 prog=${home}/python/bin/gpaw-python args="${home}/test-gpaw/CH4.py" mpirun=/bgsys/drivers/ppcfloor/bin/mpirun ldpath="/bgsys/local/lib/ibmcmp/lib/bglib" pythonpath="${home}/python/lib/python/" gpaw_setups="${home}/gpaw-setups-0.4.2039" runargs="-np 4" runargs="$runargs -cwd $PWD" runargs="$runargs -mode SMP" runargs="$runargs -env LD_LIBRARY_PATH=$ldpath -env PYTHONPATH=$pythonpath -envGPAW_SETUP_PATH=$gpaw_setups" echo "Hello. This is `hostname` at `date` `pwd`" echo "$mpirun $runargs -exe $prog $args" /usr/bin/time $mpirun $runargs -exe $prog -args $args echo "Program completed at `date` with exit code $?." The batch jobs are submitted with ``llsubmit``:: $ llsubmit job_file gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/numpy-1.0.4-gnu.py.patch000066400000000000000000000031521316441372200273560ustar00rootroot00000000000000--- numpy-1.0.4.orig/numpy/distutils/fcompiler/gnu.py 2007-11-07 16:05:14.000000000 -0600 +++ numpy-1.0.4/numpy/distutils/fcompiler/gnu.py 2008-04-15 03:48:07.936557992 -0500 @@ -22,7 +22,7 @@ return None m = re.match(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string) if m: - return ('gfortran', m.group(1)) + return ('mpif77', m.group(1)) m = re.match(r'GNU Fortran.*?([0-9-.]+)', version_string) if m: v = m.group(1) @@ -32,7 +32,7 @@ else: # at some point in the 4.x series, the ' 95' was dropped # from the version string - return ('gfortran', v) + return ('mpif77', v) def version_match(self, version_string): v = self.gnu_version_match(version_string) @@ -278,12 +278,12 @@ class Gnu95FCompiler(GnuFCompiler): compiler_type = 'gnu95' - compiler_aliases = ('gfortran',) + compiler_aliases = ('mpif77',) description = 'GNU Fortran 95 compiler' def version_match(self, version_string): v = self.gnu_version_match(version_string) - if not v or v[0] != 'gfortran': + if not v or v[0] != 'mpif77': return None return v[1] @@ -295,7 +295,7 @@ # GNU Fortran 95 (GCC) 4.2.0 20060218 (experimental) # GNU Fortran (GCC) 4.3.0 20070316 (experimental) - possible_executables = ['gfortran', 'f95'] + possible_executables = ['mpif77', 'f95'] executables = { 'version_cmd' : ["", "--version"], 'compiler_f77' : [None, "-Wall", "-ffixed-form", numpy-1.0.4-gnu.py.patch.powerpc-bgp-linux-gfortran000066400000000000000000000036141316441372200345030ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP--- numpy-1.0.4.orig/numpy/distutils/fcompiler/gnu.py 2007-11-07 16:05:14.000000000 -0600 +++ numpy-1.0.4/numpy/distutils/fcompiler/gnu.py 2008-04-15 03:48:07.936557992 -0500 @@ -22,7 +22,7 @@ return None m = re.match(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string) if m: - return ('gfortran', m.group(1)) + return ('/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gfortran', m.group(1)) m = re.match(r'GNU Fortran.*?([0-9-.]+)', version_string) if m: v = m.group(1) @@ -32,7 +32,7 @@ else: # at some point in the 4.x series, the ' 95' was dropped # from the version string - return ('gfortran', v) + return ('/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gfortran', v) def version_match(self, version_string): v = self.gnu_version_match(version_string) @@ -278,12 +278,12 @@ class Gnu95FCompiler(GnuFCompiler): compiler_type = 'gnu95' - compiler_aliases = ('gfortran',) + compiler_aliases = ('/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gfortran',) description = 'GNU Fortran 95 compiler' def version_match(self, version_string): v = self.gnu_version_match(version_string) - if not v or v[0] != 'gfortran': + if not v or v[0] != '/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gfortran': return None return v[1] @@ -295,7 +295,7 @@ # GNU Fortran 95 (GCC) 4.2.0 20060218 (experimental) # GNU Fortran (GCC) 4.3.0 20070316 (experimental) - possible_executables = ['gfortran', 'f95'] + possible_executables = ['/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gfortran', 'f95'] executables = { 'version_cmd' : ["", "--version"], 'compiler_f77' : [None, "-Wall", "-ffixed-form", numpy-1.0.4-site.cfg.lapack_bgp_esslbg000066400000000000000000000007501316441372200321050ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP[DEFAULT] library_dirs = /opt/ibmmath/essl/4.3/lib:/soft/apps/ESSL-4.4/lib:/soft/apps/ESSL-4.3/lib:/home/dulak/from_Nils_Smeds/LAPACK:/home/dulak/from_Nils_Smeds/CBLAS/lib/bgp:/opt/ibmcmp/xlf/bg/11.1/bglib:/opt/ibmcmp/xlmass/bg/4.4/bglib:/opt/ibmcmp/xlsmp/bg/1.7/bglib include_dirs = /opt/ibmmath/essl/4.3/include:/soft/apps/ESSL-4.4/include:/soft/apps/ESSL-4.3/include:/home/dulak/from_Nils_Smeds/CBLAS/src libraries = mass, xl, xlopt, xlf90_r, xlfmath, xlsmp search_static_first = true numpy-1.0.4-site.cfg.lapack_bgp_goto_esslbg000066400000000000000000000007211316441372200331330ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP[DEFAULT] library_dirs = /opt/ibmmath/essl/4.3/lib:/soft/apps/ESSL-4.3/lib:/soft/apps/LIBGOTO:/home/dulak/from_Nils_Smeds/LAPACK:/home/dulak/from_Nils_Smeds/CBLAS_goto/lib/bgp:/opt/ibmcmp/xlf/bg/11.1/bglib:/opt/ibmcmp/xlmass/bg/4.4/bglib:/opt/ibmcmp/xlsmp/bg/1.7/bglib include_dirs = /opt/ibmmath/essl/4.3/include:/soft/apps/ESSL-4.3/include:/home/dulak/from_Nils_Smeds/CBLAS_goto/src libraries = mass, xl, xlopt, xlf90_r, xlfmath, xlsmp search_static_first = true numpy-1.0.4-system_info.py.patch.lapack_bgp_esslbg000066400000000000000000000021011316441372200344570ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP--- numpy-1.0.4.orig/numpy/distutils/system_info.py 2007-11-07 16:05:15.000000000 -0600 +++ numpy-1.0.4/numpy/distutils/system_info.py 2008-10-01 12:55:17.678310718 -0500 @@ -760,7 +760,7 @@ class mkl_info(system_info): section = 'mkl' dir_env_var = 'MKL' - _lib_mkl = ['mkl','vml','guide'] + _lib_mkl = ['esslbg','cblas_bgp'] def get_mkl_rootdir(self): mklroot = os.environ.get('MKLROOT',None) @@ -840,7 +840,7 @@ if sys.platform == 'win32': lapack_libs = self.get_libs('lapack_libs',['mkl_lapack']) else: - lapack_libs = self.get_libs('lapack_libs',['mkl_lapack32','mkl_lapack64']) + lapack_libs = self.get_libs('lapack_libs',['lapack_bgp']) info = {'libraries': lapack_libs} dict_append(info,**mkl) @@ -852,7 +852,7 @@ class atlas_info(system_info): section = 'atlas' dir_env_var = 'ATLAS' - _lib_names = ['f77blas','cblas'] + _lib_names = ['lapack_bgp'] if sys.platform[:7]=='freebsd': _lib_atlas = ['atlas_r'] _lib_lapack = ['alapack_r'] numpy-1.0.4-system_info.py.patch.lapack_bgp_goto_esslbg000066400000000000000000000021101316441372200355070ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP--- numpy-1.0.4.orig/numpy/distutils/system_info.py 2007-11-07 16:05:15.000000000 -0600 +++ numpy-1.0.4/numpy/distutils/system_info.py 2008-10-01 12:55:17.678310718 -0500 @@ -760,7 +760,7 @@ class mkl_info(system_info): section = 'mkl' dir_env_var = 'MKL' - _lib_mkl = ['mkl','vml','guide'] + _lib_mkl = ['goto','cblas_bgp','esslbg'] def get_mkl_rootdir(self): mklroot = os.environ.get('MKLROOT',None) @@ -840,7 +840,7 @@ if sys.platform == 'win32': lapack_libs = self.get_libs('lapack_libs',['mkl_lapack']) else: - lapack_libs = self.get_libs('lapack_libs',['mkl_lapack32','mkl_lapack64']) + lapack_libs = self.get_libs('lapack_libs',['lapack_bgp']) info = {'libraries': lapack_libs} dict_append(info,**mkl) @@ -852,7 +852,7 @@ class atlas_info(system_info): section = 'atlas' dir_env_var = 'ATLAS' - _lib_names = ['f77blas','cblas'] + _lib_names = ['lapack_bgp'] if sys.platform[:7]=='freebsd': _lib_atlas = ['atlas_r'] _lib_lapack = ['alapack_r'] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/numpy.llrun000066400000000000000000000024311316441372200255360ustar00rootroot00000000000000#!/bin/bash # @ job_type = bluegene # @ requirements = (Machine == "$(host)") # @ class = medium # @ job_name = $(user).$(host) # @ comment = "LoadLeveler llrun script" # @ error = $(job_name).$(jobid).err # @ output = $(job_name).$(jobid).out # @ wall_clock_limit = 00:15:00 # @ notification = always # @ notify_user = # @ bg_connection = prefer_torus # @ bg_size = 32 # @ queue dir="/gpfs/fs2/frontend-13/${USER}" home=$dir prog=/bgsys/drivers/ppcfloor/gnu-linux/bin/python args=${dir}/numpy_dot.py ldpath="${ldpath}:/bgsys/opt/ibmcmp/lib/bg" ldpath="${ldpath}:/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib" ldpath="${ldpath}:/bgsys/drivers/ppcfloor/gnu-linux/lib" pythonpath=":${home}/numpy-1.0.4-1.optimized/bgsys/drivers/ppcfloor/gnu-linux/lib/python2.5/site-packages:" export LD_LIBRARY_PATH=\"$ldpath\" export PYTHONPATH=\"$pythonpath\" export OMP_NUM_THREADS=1 mpirun=/bgsys/drivers/ppcfloor/bin/mpirun runargs="-np 1" runargs="$runargs -cwd $PWD" runargs="$runargs -exp_env LD_LIBRARY_PATH -exp_env PYTHONPATH -exp_env OMP_NUM_THREADS" runargs="$runargs -mode SMP" runargs="$runargs -verbose 2" echo "Hello. This is `hostname` at `date` `pwd`" echo "$mpirun $runargs $prog $args" /usr/bin/time $mpirun $runargs $prog $args echo "Program completed at `date` with exit code $?." gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/numpy_dot.py000066400000000000000000000007651316441372200257100ustar00rootroot00000000000000from __future__ import print_function num_string = "numpy" #num_string = "Numeric" if num_string == "numpy": import numpy as num elif num_string == "Numeric": import Numeric as num print(num.__file__) from time import time import random N = 1700 A = num.array(num.ones((N,N))) Al = A.tolist() for item in Al: for n,value in enumerate(item): if (n % 2) == 0: item[n] = random.random() Anew = num.array(Al) t = time() num.dot(Anew, Anew) print(num_string, time()-t) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/performance.rst000066400000000000000000000241231316441372200263450ustar00rootroot00000000000000.. _bgp_performance: ============================== Maximizing performance on BG/P ============================== Begin by reading up on the GPAW parallelization strategies (:ref:`parallel_runs`) and the `BG/P architecture `_. In particular, :ref:`band_parallelization` will be needed to scale your calculation to large number of cores. The BG/P systems at the `Argonne Leadership Computing Facility `_ uses Cobalt for scheduling and it will be referred to frequently below. Other schedulers should have similar functionality. There are four key aspects that require careful considerations: 1) Choosing a parallelization strategy. #) Selecting the correct partition size (number of nodes) and mapping. #) Choosing an appropriate value of ``buffer_size``. The use of ``nblocks`` is no longer recommended. #) Setting the appropriate DCMF environmental variables. In the sections that follow, we aim to cultivate an understanding of how to choose these parameters. Parallelization Strategy ==================================== Parallelization options are specified at the ``gpaw-python`` command line. Domain decomposition with ``--domain-decomposition=Nx,Ny,Nz`` and band parallelization with ``--state-parallelization=B``. Additionally, the ``parallel`` keyword is also available. The smallest calculation that can benefit from band/state parallelization is *nbands = 1000*. If you are using fewer bands, you are possibly *not* in need of a leadership class computing facility. Note that only :ref:`RMM-DIIS` eigensolver is compatible with band parallelization. Furthermore, the RMM-DIIS eigensolver requires some unoccupied bands in order to converge properly. Recommend range is:: spinpol=False nbands = valence electrons/2*[1.0 - 1.2] spinpol=True nbands = max(up valence electrons, down valence electrons)*[1.0 - 1.2] It was empirically determined that you need to have *nbands/B > 256* for reasonable performance. It is also possible use smaller groups, *nbands/B < 256*, but this may require large domains. It is *required* that *nbands/B* be integer-divisible. The best values for B =2, 4, 8, 16, 32, 64, and 128. Obviously, the number of total cores must equal:: Nx*Ny*Nz*B The parallelization strategy will require careful consideration of the partition size and mapping. And, obviously, also memory! Partition size and Mapping ======================================== The BG/P partition dimensions (Px, Py, Pz, T) for Surveyor and Intrepid at the Argonne Leadership Computing Facility are `available here `_, where T represents the number of MPI tasks per node (not whether a torus network is available). The number of cores per node which execute MPI tasks is specified by the Cobalt flag:: --mode={smp,dual,vn} Hence, the possible values of T are:: T = 1 for smp T = 2 for dual T = 4 for vn Note that there are 4 cores per node and 2 GB per node on BG/P. As GPAW is presently an MPI-only code, vn mode is preferred since all cores will perform computational work. It is essential to think of the BG/P network as a 4-dimensional object with 3 spatial dimensions and a T-dimension. For optimum scalability it would seem necessary to maximize the locality of two distinct communications patterns arising in the canonical O(N^3) DFT algorithm: 1) H*Psi products #) parallel matrix multiplies. However, it turns out that this is *not* necessary. The mesh network can handle small messages rather efficiently such that the time to send a small message to a nearest-neighbor node versus a node half-way across the machine is comparable. Hence, it is only necessary to optimize the mapping for the communication arising from the parallel matrix multiply which is a simple 1D systolic communication pattern. Here we show the examples of different mappings on a 512-node BG/P partition. Band groups are colored coded. *(Left)* Inefficient mapping for four groups of bands (B = 4). This mapping leads to contention on network links in the z-direction. *(Right)* Efficient mapping for eight groups of bands (B=8). Correct mapping maximizes scalability and single-core peak performance. |mapping1| |mapping2| .. |mapping1| image:: bgp_mapping1.png :width: 40 % .. |mapping2| image:: bgp_mapping2.png :width: 40 % For the mapping on the *(Right)* above image, there are two communication patterns (and hence mappings) that are worth distinguishing. |intranode| .. |intranode| image:: bgp_mapping_intranode.png :width: 60 % The boxes in these images represent a node and the numbers inside the box repesent the distinct cores in the node (four for BG/P). Intuitively, the communication pattern of the *(Left)* image should lead to less network contention than the *(Right)*. However, this is not the case due to lack of optimization in the intranode implementation of MPI. The performance of these communications patterns is presently identical, though this may change in future version of the BG/P implementation of MPI. Mapping is accomplished by the Cobalt flag:: --env=BG_MAPPING= where ** can be one of the canonical BG/P mappings (permutations of XYZT with T at the beginning or end) or a mapfile. Lastly, it is important to note that GPAW orders the MPI tasks as follows:: Z, Y, X, bands, kpoints, and spins. A list of mappings is provided below. Note that this list is not exhaustive. The contraint on the mapping comes from the value of *B*; only *one* of these constraints must be true: 1) The last dimension in the canonical BG/P mapping equals the value of *B*. #) For canonical BG/P mappings which end in T, the product of T and the last cartesian dimension in the mapping equals *B*. #) If a canonical mapping is not immediately suitable, the keyword ``order`` in the ``parallel`` dictionary can be used to rectify the problem. See the documentation on :ref:`parallel_runs`. B = 2 -------- Simply set the following variables in your submission script:: mode = dual mapping = any canonical mapping ending with a T the constraint on the domain-decomposition is simply:: Nx*Ny*Nz = Px*Py*Pz B = 4 -------- Similar to the *B=2* case, but with:: mode = vn B = 8, 16, 32, 64, or 128 -------------------------- This is left as an exercises to the user. Setting the value of buffer_size ================================ Use ``buffer_size=2048``. Refer to :ref:`manual_parallel` for more information about the ``buffer_size`` keyword. Larger values require increasing the default value of DCMF_RECFIFO. For those interested in more technical details, continue reading this section. The computation of the hamiltonian and overlap matrix elements, as well as the computation of the new wavefunctions, is accomplished by a hand-coded parallel matrix-multiply ``hs_operators.py`` employing a 1D systolic ring algorithm. Under the *original* implementation of the matrix-multiply algorithm, it was necessary to select appropriate values for the number of blocks ``nblocks``:: from gpaw.hs_operators import MatrixOperator MatrixOperator.nblocks = K MatrixOperator.async = True (default) where the ``B`` groups of bands are further divided into ``K`` blocks. It was also required that *nbands/B/K* be integer-divisible. The value of ``K`` should be chosen so that 2 MB of wavefunctions are interchanged. The special cases of B=2, 4 as described above permit the use blocks of wavefunctions larger than 2 MB to be interchanged since there is only intranode communication. The size of the wavefunction being interchanged is given by:: gpts = (Gx, Gy, Gz) size of wavefunction block in MB = (Gx/Nx, Gy/Ny, Gz/Nz)*(nbands/B/K)*8/1024^2 The constraints on the value of nbands are: 1) ``nbands/B`` must be integer divisible #) ``nbands/B/K`` must be integer divisible. #) size of wavefunction block ~ 2 MB #) ``nbands`` must be sufficient largely so that the RMM-DIIS eigensolver converges The second constraint above is no longer applicable as of SVN version 7520. Important DCMF environment variables =============================================== `DCMF `_ is one of the lower layers in the BG/P implementation of MPI software stack. To understand th DCMF environment variables in greater detail, please read the appropriate sections of the IBM System Blue Gene Solution: `Blue Gene/P Application Development `_ DCMF_EAGER and DCMF_RECFIFO ----------------------------------- Communication and computation is overlapped to the extent allowed by the hardware by using non-blocking sends (Isend) and receives (Irecv). It will be also be necessary to pass to Cobalt:: --env=DCMF_EAGER=8388608 which corresponds to the larger size message that can be overlapped (8 MB). Note that the number is specified in bytes and not megabytes. This is larger than the target 2 MB size, but we keep this for historical reasons since it is possible to use larger blocks of wavefunctions in the case of *smp* or *dual* mode. This is also equal to the default size of the DCMF_RECFIFO. If the following warning is obtained,:: A DMA unit reception FIFO is full. Automatic recovery occurs for this event, but performance might be improved by increasing the FIFO size the default value of the DCMF_RECFIFO should be increased:: --env=DCMF_RECFIFO= DCMF_REUSE_STORAGE ------------------------- If you receive allocation error on MPI_Allreduce, please add the following environment variables:: --env=DCMF_REDUCE_REUSE_STORAGE=N:DCMF_ALLREDUCE_REUSE_STORAGE=N:DCMF_REDUCE=RECT It is very likely that your calculation is low on memory. Simply try using more nodes. DCMF_ALLTOALL_PREMALLOC ------------------------------- HDF5 uses MPI_Alltoall which can consume a significant amount of memory. The default behavior for MPI collectives on Blue Gene/P is to not release memory between calls due to peformance reasons. We recommend setting this environment variable to overide the default behavior:: --env DCMF_ALLTOALL_PREMALLOC=N: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/rbgc.rst000066400000000000000000000123751316441372200247670ustar00rootroot00000000000000.. _rbgc: ======================= bcssh.rochester.ibm.com ======================= Instructions below are valid for ``frontend-13`` and the filesystem :file:`/gpfs/fs2/frontend-13`. The latest version of gpaw uses numpy ``_. To build an optimized (consider to build based on ``goto`` blas to achieve the best performance see :ref:`building_with_gcc_on_surveyor`) numpy, save the :download:`numpy-1.0.4-gnu.py.patch.powerpc-bgp-linux-gfortran` patch file (modifications required to get powerpc-bgp-linux-gfortran instead of gfortran compiler), the :download:`numpy-1.0.4-system_info.py.patch.lapack_bgp_esslbg` patch file (lapack section configured to use ``lapack_bgp`` and blas section to use ``esslbg`` and ``cblas_bgp``), and the :download:`numpy-1.0.4-site.cfg.lapack_bgp_esslbg` file (contains paths to ``lapack_bgp``, ``esslbg`` , ``cblas_bgp``, and xlf* related libraries). **Note** that ``lapack_bgp`` and ``cblas_bgp`` are not available on ``frontend-13``, to build use instructions from ``_. Python requires all librairies to have names like ``liblapack_bgp.a``, so please make the required links for ``lapack_bgp.a`` and ``cblas_bgp.a``. Moreover numpy requires that ``lapack_bgp``, ``esslbg``, and ``cblas_bgp`` reside in the same directory, so choose a directory and edit ``numpy-1.0.4-site.cfg.lapack_bgp_esslbg`` to reflect your installation path (in this example /home/dulak/from_Nils_Smeds/CBLAS/lib/bgp). Include the directory containing cblas.h in include_dirs. These instructions are valid also for Surveyor/Intrepid with the following locations of the libraries to be used in the makefiles: /soft/apps/ESSL-4.4/lib and /opt/ibmcmp/lib/bg. **Warning** - if numpy built using these libraries fails with errors of kind "R_PPC_REL24 relocation at 0xa3d664fc for symbol sqrt" - please add ``-qpic`` to compile options for both ``lapack_bgp`` and ``cblas_bgp``. After bulding ``lapack_bgp`` and ``cblas_bgp``, get numpy-1.0.4 and do this:: $ wget http://downloads.sourceforge.net/numpy/numpy-1.0.4.tar.gz $ gunzip -c numpy-1.0.4.tar.gz | tar xf - $ mv numpy-1.0.4 numpy-1.0.4.optimized; cd numpy-1.0.4.optimized $ patch -p1 < ../numpy-1.0.4-gnu.py.patch.powerpc-bgp-linux-gfortran $ patch -p1 < ../numpy-1.0.4-system_info.py.patch.lapack_bgp_esslbg $ cp ../numpy-1.0.4-site.cfg.lapack_bgp_esslbg site.cfg $ ldpath=/bgsys/drivers/ppcfloor/gnu-linux/lib $ mkdir /gpfs/fs2/frontend-13/$USER $ root=/gpfs/fs2/frontend-13/$USER/numpy-1.0.4-1.optimized $ p=/bgsys/drivers/ppcfloor/gnu-linux/bin/python $ c="\"/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc -DNO_APPEND_FORTRAN\"" $ LD_LIBRARY_PATH="$ldpath" CC="$c" $p setup.py install --root="$root" Numpy built in this way does contain the :file:`$root/bgsys/drivers/ppcfloor/gnu-linux/lib/python2.5/site-packages/numpy/core/_dotblas.so` , but running the following python script (save it as :file:`/gpfs/fs2/frontend-13/$USER/numpy_dot.py`) results in the same time as for the standard version of numpy (~329 sec) for ``numpy.dot`` operation (:download:`numpy_dot.py`): .. literalinclude:: numpy_dot.py Use the following command to submit this job ``cd /gpfs/fs2/frontend-13/$USER; llsubmit numpy.llrun``, with the following :download:`numpy.llrun` file: .. literalinclude:: numpy.llrun **Note** the colon before and after the string when setting pythonpath! Here is how you build the standard numpy:: $ gunzip -c numpy-1.0.4.tar.gz | tar xf - $ cd numpy-1.0.4 $ patch -p1 < ../numpy-1.0.4-gnu.py.patch.powerpc-bgp-linux-gfortran $ ldpath=/bgsys/drivers/ppcfloor/gnu-linux/lib $ mkdir /gpfs/fs2/frontend-13/$USER $ root=/gpfs/fs2/frontend-13/$USER/numpy-1.0.4-1 $ p=/bgsys/drivers/ppcfloor/gnu-linux/bin/python $ c="\"/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc\"" $ LD_LIBRARY_PATH="$ldpath" CC="$c" $p setup.py install --root="$root" Build GPAW (``PYTHONPATH=/gpfs/fs2/frontend-13/mdulak/numpy-1.0.4-1.optimized/bgsys/drivers/ppcfloor/gnu-linux/lib/python2.5/site-packages LD_LIBRARY_PATH="$ldpath" $p setup.py build_ext --do-not-force-inclusion-of-numpy``) in :file:`/gpfs/fs2/frontend-13/$USER/gpaw` (you need to install the ase also somewhere below :file:`/gpfs/fs2/frontend-13/$USER`!) with this :download:`customize_rbgc.py` file: .. literalinclude:: customize_rbgc.py Because of missing ``popen3`` function you need to remove all the contents of the :file:`gpaw/version.py` file after ``version = '0.4'``. The same holds for :file:`ase/version.py` in the ase installation! Suggestions how to skip the ``popen3`` testing in :file:`gpaw/version.py` on BGP are welcome! Note that only files located below :file:`/gpfs/fs2/frontend-13` are accesible to the compute nodes (even python scripts!). A gpaw script :file:`/gpfs/fs2/frontend-13/$USER/gpaw/test/CH4.py` can be submitted to 32 CPUs in the single mode (SMP) for 30 minutes using `LoadLeveler `_ like this:: cd /gpfs/fs2/frontend-13/$USER llsubmit gpaw-script.llrun where :download:`gpaw-script.llrun` looks like this: .. literalinclude:: gpaw-script.llrun Absolute paths are important! It's convenient to customize as described on the :ref:`parallel_runs` page. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/surveyor-regtest.sh000077500000000000000000000046731316441372200272320ustar00rootroot00000000000000type=test cwd=`pwd` acct=Gpaw queue=default time=60 nodes=4 mode=smp mapping=ZYXT # uncomment below for mapfile # mapfile=BGMAP_128_4x4x4x8 # mapping=$mapfile job=${type}_${nodes}_${mode}_${mapping} input=${type}.py tau=wrapper.py scratch=/pvfs-surveyor/${USER} install=/gpfs/home/${USER} setups=/soft/apps/gpaw-setups-0.6.6300 aseversion= gpawversion= sharelibs=/lib:/bgsys/drivers/ppcfloor/comm/default/lib:/bgsys/drivers/ppcfloor/comm/sys/lib:/bgsys/drivers/ppcfloor/runtime/SPI taulibs=/soft/apps/tau/tau-2.19.2/bgp/lib/bindings-bgptimers-gnu-mpi-python-pdt bin=gpaw-python rm -rf $scratch/$job mkdir $scratch/$job cp ${install}/gpaw${gpawversion}/gpaw/test/*.py $scratch/$job # copy mapfile # cp $mapfile $scratch/$job # copy tau wrapper script # cp $tau $scratch/$job cd $scratch/$job # pristine, regression tests run in four batches qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONPATH=${install}/gpaw${gpawversion}:${install}/ase${aseversion}:${taulibs}:$PYTHONPATH:LD_LIBRARY_PATH=${taulibs}:${sharelibs} ${install}/gpaw${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${input} --range=ase3k_version.py,td_na2.py qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONPATH=${install}/gpaw${gpawversion}:${install}/ase${aseversion}:${taulibs}:$PYTHONPATH:LD_LIBRARY_PATH=${taulibs}:${sharelibs} ${install}/gpaw${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${input} --range=ldos.py,exx.py qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONPATH=${install}/gpaw${gpawversion}:${install}/ase${aseversion}:${taulibs}:$PYTHONPATH:LD_LIBRARY_PATH=${taulibs}:${sharelibs} ${install}/gpaw${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${input} --range=h2o_dks.py,lrtddft3.py qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONPATH=${install}/gpaw${gpawversion}:${install}/ase${aseversion}:${taulibs}:$PYTHONPATH:LD_LIBRARY_PATH=${taulibs}:${sharelibs} ${install}/gpaw${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${input} --range=AA_exx_enthalpy.py,aluminum_testcell.py gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/surveyor.rst000066400000000000000000000005401316441372200257370ustar00rootroot00000000000000.. _surveyor: ===================== surveyor.alcf.anl.gov ===================== Here you find information about the the system ``_. Please refer to following sections: .. toctree:: :maxdepth: 2 building_with_gcc_on_surveyor building_with_xlc_on_surveyor using_TAU_on_surveyor gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/surveyor.sh000077500000000000000000000034701316441372200255510ustar00rootroot00000000000000type=Au_bulk3x3x3 cwd=`pwd` acct=Gpaw queue=default time=60 nodes=64 mode=vn mapping=ZYXT # uncomment below for mapfile # mapfile=BGMAP_128_4x4x4x8 # mapping=$mapfile job=${type}_${nodes}_${mode}_${mapping} input=${type}.py tau=wrapper.py scratch=/pvfs-surveyor/${USER} install=/gpfs/home/${USER} setups=/soft/apps/gpaw-setups-0.6.6300 aseversion= gpawversion= sharelibs=/lib:/bgsys/drivers/ppcfloor/comm/default/lib:/bgsys/drivers/ppcfloor/comm/sys/lib:/bgsys/drivers/ppcfloor/runtime/SPI taulibs=/soft/apps/tau/tau-2.19.2/bgp/lib/bindings-bgptimers-gnu-mpi-python-pdt bin=gpaw-python rm -rf $scratch/$job mkdir $scratch/$job cp $input $scratch/$job # copy mapfile # cp $mapfile $scratch/$job # copy tau wrapper script # cp $tau $scratch/$job cd $scratch/$job # pristine qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONPATH=${install}/gpaw${gpawversion}:${install}/ase${aseversion}:${taulibs}:$PYTHONPATH:LD_LIBRARY_PATH=${taulibs}:${sharelibs} ${install}/gpaw${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${input} --domain-decomposition=4,4,4 --state-parallelization=2 --sl_default=2,2,64 # TAU automatic profiling # qsub -A $acct -n $nodes -t $time -q $queue --mode $mode --env TAU_VERBOSE=1:TAU_CALLPATH=0:TAU_CALLPATH_DEPTH=10:TAU_COMM_MATRIX=0:TAU_TRACK_MESSAGE=0:TAU_THROTTLE=0:TAU_COMPENSATE=1:TAU_METRICS=BGPTIMERS:DCMF_EAGER=8388608:BG_MAPPING=$mapping:MPIRUN_ENABLE_TTY_REPORTING=0:OMP_NUM_THREADS=1:GPAW_SETUP_PATH=$setups:PYTHONPATH=${install}/gpaw${gpawversion}:${install}/ase${aseversion}:${taulibs}:$PYTHONPATH:LD_LIBRARY_PATH=${taulibs}:${sharelibs} ${install}/gpaw${gpawversion}/build/bin.linux-ppc64-2.6/${bin} ${tau} --domain-decomposition=4,4,4 --state-parallelization=2 --sl_default=2,2,64gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/surveyor.softenvrc000066400000000000000000000006511316441372200271430ustar00rootroot00000000000000# # This is your SoftEnv configuration run control file. # # It is used to tell SoftEnv how to customize your environment by # setting up variables such as PATH and MANPATH. To learn more # about this file, do a "man softenv". # +mpiwrappers @default # NumPy Standard PYTHONPATH += /soft/apps/python/python-2.6-cnk-gcc/numpy-1.3.0/lib/python2.6/site-packages LD_LIBRARY_PATH += /bgsys/drivers/ppcfloor/gnu-linux/lib gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGP/using_TAU_on_surveyor.rst000066400000000000000000000076561316441372200303700ustar00rootroot00000000000000.. _using_TAU_on_surveyor: ===================== Using TAU on surveyor ===================== Start by reading the `main profiling page `_ Do **not** using the customize.py from the above page, following the instructions found on this page instead. The following mostly applies to automatic instrumentation using the TAU compiler scripts. Overhead with the TAU for automatic instrumentation has been measured at about 20% for the `b256H2O.py `_. Use manual instrumentation if this overhead is unacceptable or you might need to add more functions to the existing selective instrumentation file `select.tau `_ The version of TAU at ALCF is updated frequently, please check: ``_ We first described the case of automatically instrumentation with the GCC and XLC compilers. Automatic Instrumentation ============================ The instructions below are for using source-based automatic instrumentation with TAU. It is well tested with the GCC compiler. It should also work with XLC compiler, but is untested. Add the following lines to you ``.softenvrc``:: TAUARCHITECTURE = bgp TAUVERSION = 2.19.2 TAU_MAKEFILE = /soft/apps/tau/tau-$TAUVERSION/bgp/lib/Makefile.tau-bgptimers-gnu-mpi-python-pdt TAU_OPTIONS = '-optVerbose -optShared -optTauSelectFile=select.tau \ -optTau="-rn Py_RETURN_NONE -i/soft/apps/tau/tau-'$TAUVERSION'/include/TAU_PYTHON_FIX.h"' PATH += /soft/apps/tau/tau-$TAUVERSION/$TAUARCHITECTURE/bin The bindings are located in ``/soft/apps/tau/tau/tau-$TAUVERSION/bgp/lib/``. This particular TAU library binding supports BGP timers (a low-level timer with minimal overhead), MPI, GNU compiler, and Python. This is the recommended library binding for flat profiles. You will need to change one line in your :git:`bgp_gcc.py`:: cmd = "tau_cc.sh %s %s"%(flags, cmd) It is recommend that dynamic linking be used for the MPI libraries instead of static linking, see the comments in :git:`configure_surveyor.py` Additionally, the TAU library must be linked manually. See the comments in :git:`customize_surveyor.py` Manual Instrumentation ============================= It is straightforward to swap the default Python timers with those provided by TAU and make subclass of the default GPAW calculator:: from gpaw.utilities.timing import TAUTimer class MyGPAW(GPAW): timer_class = TAUTimer calc = MyGPAW(...) Run time environment variables ================================ Please see: ``_. Here are the recommended run time environment variables that should be passed to Cobalt via qsub:: TAU_VERBOSE=1:TAU_THROTTLE=0:TAU_COMPENSATE=1:TAU_METRICS=BGPTIMERS TAU_COMPENSATE seems to cause problems with manual instrumentation, so do not set it to 0 which means off. In any case, it should not be particularly relevant unless you have manual timers on a frequently accessed lightweight functions. Submitting jobs ================== Modification to the submission script for use with TAU are show in the example submission script :git:`surveyor.sh` If you are doing manual instrumentation, simply pass the actual input file to ``gpaw-python`` instead. For automatic instrumentation, you need to ``wrapper.py`` instead:: import tau def OurMain(): import CH4; tau.run('OurMain()') TAU run will then produce ``profile.*`` files that can be merged into the default TAU's ``ppk`` format using the command issued from the directory where the ``profile.*`` files reside:: paraprof --pack CH4.ppk The actual analysis can be made on a different machine, by transferring the ``CH4.ppk`` file from ``surveyor``, installing TAU, and launching:: paraprof CH4.ppk gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/000077500000000000000000000000001316441372200233115ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/bgq_xlc.py000077500000000000000000000031441316441372200253070ustar00rootroot00000000000000#!/usr/bin/env python """bgp_xlc.py is a wrapper for the BGP xlc compiler, converting/removing incompatible gcc args. """ from __future__ import print_function import sys from subprocess import call from glob import glob args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"-qlanglvl=extc99", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"-qmkshrobj", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O2":"", "-O1":"", "-fwrapv":""} fragile_files = ["test.c"] qhot_files = ["c/blas.c", "c/utilities.c","c/lfc.c","c/localized_functions.c"] non_c99files = glob('c/libxc/src/*.c') cmd = "" opt = 1 for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: opt = 2 if t in non_c99files: opt = 3 if t in qhot_files: opt = 4 if t in args2change: cmd += args2change[t] else: cmd += arg flags_list = {1: "-g -O3 -qlanglvl=extc99 -qflag=w:w", 2: "-g -O3 -qlanglvl=extc99 -qflag=w:w", 3: "-g -O3 -qflag=w:w ", 4: "-g -O3 -qnohot -qsimd=noauto -qlanglvl=extc99 -qflag=w:w", } flags = flags_list[opt] cmd = "mpixlc_r %s %s"%(flags, cmd) print("\nexecmd: %s\n"%cmd) call(cmd, shell=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/bgq_xlc_linker.py000077500000000000000000000031251316441372200266520ustar00rootroot00000000000000#!/usr/bin/env python """bgp_xlc.py is a wrapper for the BGP xlc compiler, converting/removing incompatible gcc args. """ from __future__ import print_function import sys from subprocess import call from glob import glob args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"-qlanglvl=extc99", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"-qmkshrobj", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O2":"", "-O1":"", "-fwrapv":""} fragile_files = ["test.c"] qhot_files = ["c/blas.c", "c/utilities.c","c/lfc.c","c/localized_functions.c"] non_c99files = glob('c/libxc/src/*.c') cmd = "" opt = 1 for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: opt = 2 if t in non_c99files: opt = 3 if t in qhot_files: opt = 4 if t in args2change: cmd += args2change[t] else: cmd += arg flags_list = {1: "-g -O3 -qlanglvl=extc99 -qflag=w:w", 2: "-g -O3 -qstrict -qlanglvl=extc99 -qflag=w:w", 3: "-g -O3 -qflag=w:w", 4: "-g -O3 -qlanglvl=extc99 -qflag=w:w", } flags = flags_list[opt] cmd = "bgxlc_r %s %s"%(flags, cmd) print("\nexecmd: %s\n"%cmd) call(cmd, shell=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/build_gpaw.sh000077500000000000000000000011201316441372200257570ustar00rootroot00000000000000#!/bin/bash export ibmcmp_base=/soft/compilers/ibmcmp-nov2012 python=/soft/apps/python/scalable-python-2.6.7-cnk-gcc/bin/python #python=/bgsys/tools/Python-2.6/bin/python echo $python ${python} setup.py clean # manually remove _hdf5.so due to bug in build system rm -f build/lib.linux-ppc64-2.6/_hdf5.so # rm -f build/temp.linux-ppc64-2.6/*.o # compile _gpaw.so # ${python} setup.py build_ext --customize=customize_mira_xlc_serial.py >& build_xlc_serial.log # compile gpaw-python ${python} setup.py build_ext --ignore-numpy --customize=customize_mira_xlc_mpi.py 2>&1 | tee build_xlc_mpi.log gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/build_numpy.sh000077500000000000000000000010021316441372200261700ustar00rootroot00000000000000#!/bin/sh export CC=/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gcc export BASECFLAGS="-fno-strict-aliasing" export LD_LIBRARY_PATH=/bgsys/drivers/ppcfloor/gnu-linux/lib64 export PYTHONHOME=/soft/apps/python/scalable-python-2.6.7-cnk-gcc export PYTHON=${PYTHONHOME}/bin/python # root=/soft/apps/python/scalable-python-2.6.7-cnk-gcc buildir=build rm -rf ${builddir} # ${PYTHON} setup.py install --root="$root" 2>&1 | tee numpy-1.3.0.log.mira ${PYTHON} setup.py install 2>&1 | tee numpy-1.3.0.log.miragpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/build_scalable_python.sh000077500000000000000000000011011316441372200301670ustar00rootroot00000000000000#!/bin/bash export CC=/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-gcc export CXX=/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc64-bgq-linux-g++ export MPICC=mpicc export CCSHARED=-fPIC export LINKFORSHARED='-Xlinker -export-dynamic -dynamic' export MPI_LDFLAGS_SHARED='-Xlinker -export-dynamic -dynamic' ./configure --prefix=/soft/apps/python/scalable-python-2.6.7-cnk-gcc --enable-mpi --disable-ipv6 2>&1 | tee mira-conf make 2>&1 | tee mira-make make mpi 2>&1 | tee mira-make-mpi make install 2>&1 | tee mira-inst make install-mpi 2>&1 | tee mira-inst-mpi gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/config_mira.py000066400000000000000000000433611316441372200261470ustar00rootroot00000000000000# Copyright (C) 2006 CSC-Scientific Computing Ltd. # Please see the accompanying LICENSE file for further information. from __future__ import print_function import os import sys import re import distutils.util from distutils.version import LooseVersion from distutils.sysconfig import get_config_var, get_config_vars from distutils.command.config import config from glob import glob from os.path import join from stat import ST_MTIME def check_packages(packages, msg, include_ase, import_numpy): """Check the python version and required extra packages If ASE is not installed, the `packages` list is extended with the ASE modules if they are found.""" if sys.version_info < (2, 3, 0, 'final', 0): raise SystemExit('Python 2.3.1 or later is required!') if import_numpy: try: import numpy except ImportError: raise SystemExit('numpy is not installed!') else: msg += ['* numpy is not installed.', ' "include_dirs" in your customize.py must point to "numpy/core/include".'] if not include_ase: if import_numpy: try: import ase except ImportError: import_ase = True else: import_ase = False else: import_ase = False if include_ase or import_ase: # Find ASE directories: # include_ase works in case: # cd gpaw # top-level gpaw source directory # tar zxf ~/python-ase-3.1.0.846.tar.gz # ln -s python-ase-3.1.0.846/ase . ase_root = 'ase' if include_ase: assert os.path.isdir(ase_root), ase_root+': No such file or directory' ase = [] for root, dirs, files in os.walk(ase_root): if 'CVS' in dirs: dirs.remove('CVS') if '.svn' in dirs: dirs.remove('.svn') if '__init__.py' in files: ase.append(root.replace('/', '.')) if len(ase) == 0: msg += ['* ASE is not installed! You may be able to install', " gpaw, but you can't use it without ASE!"] else: packages += ase def find_file(arg, dir, files): #looks if the first element of the list arg is contained in the list files # and if so, appends dir to to arg. To be used with the os.path.walk if arg[0] in files: arg.append(dir) def get_system_config(define_macros, undef_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, msg, import_numpy): undef_macros += ['NDEBUG'] if import_numpy: import numpy include_dirs += [numpy.get_include()] include_dirs += ['c/libxc'] machine = os.uname()[4] if machine == 'sun4u': # _ # |_ | ||\ | # _||_|| \| # extra_compile_args += ['-Kpic', '-fast'] # Suppress warning from -fast (-xarch=native): f = open('cc-test.c', 'w') f.write('int main(){}\n') f.close() stderr = os.popen3('cc cc-test.c -fast')[2].read() arch = re.findall('-xarch=(\S+)', stderr) os.remove('cc-test.c') if len(arch) > 0: extra_compile_args += ['-xarch=%s' % arch[-1]] # We need the -Bstatic before the -lsunperf and -lfsu: # http://forum.java.sun.com/thread.jspa?threadID=5072537&messageID=9265782 extra_link_args += ['-Bstatic', '-lsunperf', '-lfsu', '-Bdynamic'] cc_version = os.popen3('cc -V')[2].readline().split()[3] if LooseVersion(cc_version) > '5.6': libraries.append('mtsk') else: extra_link_args.append('-lmtsk') #define_macros.append(('NO_C99_COMPLEX', '1')) msg += ['* Using SUN high performance library'] elif sys.platform in ['aix5', 'aix6']: # # o|_ _ _ # ||_)| | | # extra_compile_args += ['-qlanglvl=stdc99'] # setting memory limit is necessary on aix5 if sys.platform == 'aix5': extra_link_args += ['-bmaxdata:0x80000000', '-bmaxstack:0x80000000'] libraries += ['f', 'lapack', 'essl'] define_macros.append(('GPAW_AIX', '1')) elif machine == 'x86_64': # _ # \/|_||_ |_ |_| # /\|_||_| _ |_| | # extra_compile_args += ['-Wall', '-std=c99'] # Look for ACML libraries: acml = glob('/opt/acml*/g*64/lib') if len(acml) > 0: library_dirs += [acml[-1]] libraries += ['acml'] if acml[-1].find('gfortran') != -1: libraries.append('gfortran') if acml[-1].find('gnu') != -1: libraries.append('g2c') extra_link_args += ['-Wl,-rpath=' + acml[-1]] msg += ['* Using ACML library'] else: atlas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libatlas.a')) != []: atlas = True break if atlas: libraries += ['lapack', 'atlas', 'blas'] library_dirs += [dir] msg += ['* Using ATLAS library'] else: libraries += ['blas', 'lapack'] msg += ['* Using standard lapack'] elif machine =='ia64': # _ _ # |_ | o # _||_|| # extra_compile_args += ['-Wall', '-std=c99'] libraries += ['mkl','mkl_lapack64'] elif machine == 'i686': # _ # o|_ |_||_ # ||_||_||_| # extra_compile_args += ['-Wall', '-std=c99'] if 'MKL_ROOT' in os.environ: mklbasedir = [os.environ['MKL_ROOT']] else: mklbasedir = glob('/opt/intel/mkl*') libs = ['libmkl_ia32.a'] if mklbasedir != []: os.path.walk(mklbasedir[0],find_file, libs) libs.pop(0) if libs != []: libs.sort() libraries += ['mkl_lapack', 'mkl_ia32', 'guide', 'pthread', 'mkl']#, 'mkl_def'] library_dirs += libs msg += ['* Using MKL library: %s' % library_dirs[-1]] #extra_link_args += ['-Wl,-rpath=' + library_dirs[-1]] else: atlas = False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libatlas.a')) != []: atlas = True break if atlas: libraries += ['lapack', 'atlas', 'blas'] library_dirs += [dir] msg += ['* Using ATLAS library'] else: libraries += ['blas', 'lapack'] msg += ['* Using standard lapack'] # add libg2c if available g2c=False for dir in ['/usr/lib', '/usr/local/lib']: if glob(join(dir, 'libg2c.so')) != []: g2c=True break if glob(join(dir, 'libg2c.a')) != []: g2c=True break if g2c: libraries += ['g2c'] elif sys.platform == 'darwin': extra_compile_args += ['-Wall', '-std=c99'] include_dirs += ['/usr/include/malloc'] if glob('/System/Library/Frameworks/vecLib.framework') != []: extra_link_args += ['-framework vecLib'] msg += ['* Using vecLib'] else: libraries += ['blas', 'lapack'] msg += ['* Using standard lapack'] return msg def get_parallel_config(mpi_libraries,mpi_library_dirs,mpi_include_dirs, mpi_runtime_library_dirs,mpi_define_macros): globals = {} exec(open('gpaw/mpi/config.py').read(), globals) mpi = globals['get_mpi_implementation']() if mpi == '': mpicompiler = None elif mpi == 'sun': mpi_include_dirs += ['/opt/SUNWhpc/include'] mpi_libraries += ['mpi'] mpi_library_dirs += ['/opt/SUNWhpc/lib'] mpi_runtime_library_dirs += ['/opt/SUNWhpc/lib'] mpicompiler = get_config_var('CC') elif mpi == 'poe': mpicompiler = 'mpcc_r' else: #Try to use mpicc mpicompiler = 'mpicc' return mpicompiler def get_scalapack_config(define_macros): # check ScaLapack settings define_macros.append(('GPAW_WITH_SL', '1')) def mtime(path, name, mtimes): """Return modification time. The modification time of a source file is returned. If one of its dependencies is newer, the mtime of that file is returned. This function fails if two include files with the same name are present in different directories.""" include = re.compile('^#\s*include "(\S+)"', re.MULTILINE) if name in mtimes: return mtimes[name] t = os.stat(os.path.join(path, name))[ST_MTIME] for name2 in include.findall(open(os.path.join(path, name)).read()): path2, name22 = os.path.split(name2) if name22 != name: t = max(t, mtime(os.path.join(path, path2), name22, mtimes)) mtimes[name] = t return t def check_dependencies(sources): # Distutils does not do deep dependencies correctly. We take care of # that here so that "python setup.py build_ext" always does the right # thing! mtimes = {} # modification times # Remove object files if any dependencies have changed: plat = distutils.util.get_platform() + '-' + sys.version[0:3] remove = False for source in sources: path, name = os.path.split(source) t = mtime(path + '/', name, mtimes) o = 'build/temp.%s/%s.o' % (plat, source[:-2]) # object file if os.path.exists(o) and t > os.stat(o)[ST_MTIME]: print('removing', o) os.remove(o) remove = True so = 'build/lib.%s/_gpaw.so' % plat if os.path.exists(so) and remove: # Remove shared object C-extension: # print 'removing', so os.remove(so) def test_configuration(): raise NotImplementedError def write_configuration(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, mpicompiler, mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): # Write the compilation configuration into a file try: out = open('configuration.log', 'w') except IOError as x: print(x) return print("Current configuration", file=out) print("libraries", libraries, file=out) print("library_dirs", library_dirs, file=out) print("include_dirs", include_dirs, file=out) print("define_macros", define_macros, file=out) print("extra_link_args", extra_link_args, file=out) print("extra_compile_args", extra_compile_args, file=out) print("runtime_library_dirs", runtime_library_dirs, file=out) print("extra_objects", extra_objects, file=out) if mpicompiler is not None: print(file=out) print("Parallel configuration", file=out) print("mpicompiler", mpicompiler, file=out) print("mpi_libraries", mpi_libraries, file=out) print("mpi_library_dirs", mpi_library_dirs, file=out) print("mpi_include_dirs", mpi_include_dirs, file=out) print("mpi_define_macros", mpi_define_macros, file=out) print("mpi_runtime_library_dirs", mpi_runtime_library_dirs, file=out) out.close() def build_interpreter(define_macros, include_dirs, libraries, library_dirs, extra_link_args, extra_compile_args, runtime_library_dirs, extra_objects, mpicompiler, mpilinker, mpi_libraries, mpi_library_dirs, mpi_include_dirs, mpi_runtime_library_dirs, mpi_define_macros): #Build custom interpreter which is used for parallel calculations cfgDict = get_config_vars() plat = distutils.util.get_platform() + '-' + sys.version[0:3] cfiles = glob('c/[a-zA-Z_]*.c') + ['c/bmgs/bmgs.c'] cfiles += glob('c/libxc/src/*.c') if ('HDF5', 1) in define_macros: cfiles += glob('h5py/c/*.c') cfiles += glob('h5py/c/lzf/*.c') cfiles2remove = ['c/libxc/src/test.c', 'c/libxc/src/xc_f.c', 'c/libxc/src/work_gga_x.c', 'c/libxc/src/work_lda.c' ] for c2r in glob('c/libxc/src/funcs_*.c'): cfiles2remove.append(c2r) for c2r in cfiles2remove: cfiles.remove(c2r) sources = ['c/bc.c', 'c/localized_functions.c', 'c/mpi.c', 'c/_gpaw.c', 'c/operators.c', 'c/transformers.c', 'c/compiled_WITH_SL.c', 'c/blacs.c', 'c/utilities.c'] objects = ' '.join(['build/temp.%s/' % plat + x[:-1] + 'o' for x in cfiles]) if not os.path.isdir('build/bin.%s/' % plat): os.makedirs('build/bin.%s/' % plat) exefile = 'build/bin.%s/' % plat + '/gpaw-python' # if you want static linked MPI libraries, uncomment the line below libraries += mpi_libraries library_dirs += mpi_library_dirs define_macros += mpi_define_macros include_dirs += mpi_include_dirs runtime_library_dirs += mpi_runtime_library_dirs define_macros.append(('PARALLEL', '1')) define_macros.append(('GPAW_INTERPRETER', '1')) macros = ' '.join(['-D%s=%s' % x for x in define_macros if x[0].strip()]) include_dirs.append(cfgDict['INCLUDEPY']) include_dirs.append(cfgDict['CONFINCLUDEPY']) includes = ' '.join(['-I' + incdir for incdir in include_dirs]) library_dirs.append(cfgDict['LIBPL']) lib_dirs = ' '.join(['-L' + lib for lib in library_dirs]) libs = ' '.join(['-l' + lib for lib in libraries if lib.strip()]) # BlueGene/P can statically link everything except # python, runtime and pthread library libs += ' -Wl,-dy' libpl = cfgDict['LIBPL'] if glob(libpl + '/libpython*mpi*'): libs += ' -lpython%s_mpi' % cfgDict['VERSION'] else: libs += ' -lpython%s' % cfgDict['VERSION'] # libs += ' -lpython%s ' % cfgDict['VERSION'] # if you want dynamic linked MPI libraries, uncomment the line below # only really needed for TAU profiling # libs += ' '.join(['-l' + lib for lib in mpi_libraries]) libs += ' -lrt -lpthread' libs = ' '.join([libs, cfgDict['LIBS'], cfgDict['LIBM']]) #Hack taken from distutils to determine option for runtime_libary_dirs if sys.platform[:6] == 'darwin': # MacOSX's linker doesn't understand the -R flag at all runtime_lib_option = '-L' elif sys.platform[:5] == 'hp-ux': runtime_lib_option = '+s -L' elif os.popen('mpicc --showme 2> /dev/null', 'r').read()[:3] == 'gcc': runtime_lib_option = '-Wl,-R' elif os.popen('mpicc -show 2> /dev/null', 'r').read()[:3] == 'gcc': runtime_lib_option = '-Wl,-R' else: runtime_lib_option = '-R' runtime_libs = ' '.join([ runtime_lib_option + lib for lib in runtime_library_dirs]) extra_link_args.append(cfgDict['LDFLAGS']) if sys.platform in ['aix5', 'aix6']: extra_link_args.append(cfgDict['LINKFORSHARED'].replace('Modules', cfgDict['LIBPL'])) elif sys.platform == 'darwin': pass else: extra_link_args.append(cfgDict['LINKFORSHARED']) if ('IO_WRAPPERS', 1) in define_macros: extra_link_args += ['-Wl,-wrap,fread', '-Wl,-wrap,_IO_getc', '-Wl,-wrap,getc_unlocked', '-Wl,-wrap,fgets', '-Wl,-wrap,ungetc', '-Wl,-wrap,feof', '-Wl,-wrap,ferror', '-Wl,-wrap,fflush', '-Wl,-wrap,fseek', '-Wl,-wrap,rewind', # '-Wl,-wrap,fileno', '-Wl,-wrap,flockfile', '-Wl,-wrap,funlockfile', '-Wl,-wrap,clearerr', '-Wl,-wrap,fgetpos', '-Wl,-wrap,fsetpos', '-Wl,-wrap,setbuf', '-Wl,-wrap,setvbuf', '-Wl,-wrap,ftell', '-Wl,-wrap,fstat', '-Wl,-wrap,fstat64', '-Wl,-wrap,fgetc', # '-Wl,-wrap,fputc', # '-Wl,-wrap,fputs', # '-Wl,-wrap,fwrite', # '-Wl,-wrap,_IO_putc', '-Wl,-wrap,fopen', '-Wl,-wrap,fopen64', '-Wl,-wrap,fclose', ] # Compile the parallel sources for src in sources: obj = 'build/temp.%s/' % plat + src[:-1] + 'o' cmd = ('%s %s %s %s -o %s -c %s ' ) % \ (mpicompiler, macros, ' '.join(extra_compile_args), includes, obj, src) print(cmd) if '--dry-run' not in sys.argv: error=os.system(cmd) if error != 0: msg = ['* compiling FAILED! Only serial version of code will work.'] break # Link the custom interpreter cmd = ('%s -o %s %s %s %s %s %s %s' ) % \ (mpilinker, exefile, objects, ' '.join(extra_objects), lib_dirs, libs, runtime_libs, ' '.join(extra_link_args)) msg = ['* Building a custom interpreter'] print(cmd) if '--dry-run' not in sys.argv: error=os.system(cmd) if error != 0: msg += ['* linking FAILED! Only serial version of code will work.'] return error, msg gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/customize_mira_xlc_mpi.py000066400000000000000000000062761316441372200304430ustar00rootroot00000000000000define_macros += [('GPAW_NO_UNDERSCORE_BLAS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_LAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [('GPAW_NO_UNDERSCORE_BLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_SCALAPACK', '1')] define_macros += [('GPAW_ASYNC', 1)] define_macros += [('GPAW_MPI2', 1)] # define_macros += [('GPAW_MR3',1)] # requires developmental ScaLAPACK # uncomment two lines below for FLOP rate measurement # define_macros += [('GPAW_HPM',1)] define_macros += [('GPAW_PERFORMANCE_REPORT',1)] # define_macros += [('GPAW_MPI_DEBUG', 1)] # debugging # define_macros += [('GPAW_OMP',1)] # not really working scalapack = True hdf5 = True # If you are using threading, you probably # need to change the following library: # xlomp_ser -> xlsmp # # DO NOT INTERCHANGE THE ORDER OF LAPACK # & ESSL, LAPACK SHOULD BE LINKED FIRST. # # Goto appears to be much faster for general # DGEMM operations, particularly those with: # alpha != 1.0 and beta != 0.0 # # Goto is hand-tuned assembly, it will most # likely always be faster than ESSL-4.x. # NAR: Goto appears to cause core dumps for # some problems, use at your own risk. # Disabling the stackground seems to make # the problem go away, but this is not # recommended. # --env BG_STACKGUARDENABLE=0 #multi threaded libraries = [ 'scalapack', 'lapack', 'esslsmpbg', 'xlf90_r', 'xlopt', 'xl', 'xlfmath', 'xlsmp', ] #single threaded # libraries = [ # 'scalapack', # 'lapack', # 'esslbg', # 'xlf90_r', # 'xlopt', # 'xl', # 'xlfmath', # 'xlomp_ser', # ] import os ibmcmp_base = os.environ['ibmcmp_base'] python_base = '/soft/apps/python/scalable-python-2.6.7-cnk-gcc' library_dirs = [ '/soft/libraries/alcf/current/xl/LAPACK/lib', '/soft/libraries/alcf/current/xl/SCALAPACK/lib', '/soft/libraries/essl/5.1.1-0/lib64', '%s/xlf/bg/14.1/bglib64' % ibmcmp_base, '%s/xlsmp/bg/3.1/bglib64' % ibmcmp_base, # plain vanilla Python # '/bgsys/tools/Python-2.6/lib64', # scalable Python 2.6.7 '%s' % python_base, '/soft/libraries/unsupported/hdf5-1.8.8/lib/', ] # plain vanilla Python # include_dirs += [ # '/soft/apps/python/python-2.6.6-cnk-gcc/bgsys/tools/Python-2.6/lib64/python2.6/site-packages/numpy/core/include' # ] # scalable Python 2.6.7 include_dirs += [ '%s/lib/python2.6/site-packages/numpy/core/include' % python_base, '/soft/libraries/unsupported/hdf5-1.8.8/include/' ] mpi_libraries = [ # 'mpihpm_smp', 'hdf5', 'mpich', 'opa', 'mpl', 'pami', 'SPI', 'SPI_cnk', 'stdc++', # 'bgpm', ] mpi_library_dirs = [ '/bgsys/drivers/ppcfloor/comm/xl.legacy/lib', '/bgsys/drivers/ppcfloor/comm/sys/lib', '/bgsys/drivers/ppcfloor/spi/lib', '/soft/perftools/hpctw', '/soft/perftools/bgpm/lib', ] extra_link_args = ['-Wl,-export-dynamic'] compiler = "./bgq_xlc.py" mpicompiler = "./bgq_xlc.py" mpilinker = "./bgq_xlc_linker.py" gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BGQ/mira.rst000066400000000000000000000041301316441372200247710ustar00rootroot00000000000000.. _mira: ======================= Blue Gene/Q - Mira ======================= The build instructions here are representative of the Blue Gene/Q system at the Argonne Leadership Computing Facility. Users will need to adapt these instructions for specific installations at their respective sites. In addition to the standard libraries needed on other platforms, Scalable Python ``_ is required for running effectively on Blue Gene/Q. A build script for Scalable Python is provided below: .. literalinclude:: build_scalable_python.sh NumPy 1.3.0 or later is recommended. Disutils does not work well on PPC architectures and a compiler must be explicitly specified. A build script for NumPy 1.3.0 is provided below: .. literalinclude:: build_numpy.sh GPAW will build with the XL legacy MPI wrapper script. It is recommeded that you statically link as many libraries as possible into GPAW to avoid potential performance bottlencks in loading shared libraries at scale. This can be done with some modification of the stock GPAW config.py file :download:`config_mira.py`. Lastly, we recommend that GPAW is compiled with both ScaLAPACK (v. 2.0.2 or later) as well as HDF5 support. Here is an example customization file: .. literalinclude:: customize_mira_xlc_mpi.py which requires a number of wrappers for the XL compilers (:download:`bgq_xlc.py` and :download:`bgq_xlc_linker.py`). A build script for GPAW is provided for convenience :download:`build_gpaw.sh`. After all Python modules are installed, they should be byte compiled before running GPAW. This can be accomplished by going to the top level directory for each Python library (Scalable Python, NumPy, ASE, and GPAW) an executing the command:: ${python} -m compileall . where ``${python}`` is the explicit path to the Scalable Python interpreter. Some users have noticed that the Python interpreter may unnecessarily re-compile Python modules. This is problematic at large (>10,000) number of MPI tasks and we recommend that users set the environment variable:: PYTHONDONTBYTECOMPILE=1 in the job submissions script. gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BSD/000077500000000000000000000000001316441372200233105ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/BSD/FreeBSD.rst000066400000000000000000000006511316441372200252560ustar00rootroot00000000000000.. _FreeBSD: ======= FreeBSD ======= Here you find information about the the system ``_. To build gpaw add to the ``gpaw/customize.py``:: compiler='gcc44' extra_compile_args += ['-Wall', '-std=c99'] library_dirs += ['/usr/local/lib'] libraries += ['blas', 'lapack', 'gfortran'] If you want to build a parallel version install mpich2 (net/mpich2). Openmpi does currently not work with gpaw! gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/000077500000000000000000000000001316441372200235765ustar00rootroot00000000000000build_scalable_python_curie.sh000066400000000000000000000010671316441372200315740ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull#!/bin/bash export CC=gcc export CXX=g++ export MPICC=mpicc # export XTPE_LINK_TYPE=dynamic export LINKFORSHARED='-Wl,-export-dynamic -dynamic' export MPI_LINKFORSHARED='-Wl,-export-dynamic -dynamic' install_prefix=/my_prefix/scalable-gnu # Make zlib built-in to the interpreter sed -i -e 's/^#zlib.*/zlib zlibmodule.c -lz/' Modules/Setup.dist ./configure --prefix=$install_prefix --enable-mpi --disable-ipv6 2>&1 | tee log-conf make 2>&1 | tee log-make make install 2>&1 | tee log-inst make mpi 2>&1 | tee log-make-mpi make install-mpi 2>&1 | tee log-inst-mpi gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/curie.rst000066400000000000000000000047241316441372200254460ustar00rootroot00000000000000.. _curie: =========================================================== Curie (BullX cluster, Intel Nehalem, Infiniband QDR, MKL) =========================================================== .. note:: These instructions are up-to-date as of October 2014 Here you find information about the the system http://www-hpc.cea.fr/en/complexe/tgcc-curie.htm For large calculations, it is suggested that one utilizes the Scalable Python interpreter. Small to medium size calculations are fine with standard Python, for these one can use system's default Python (which contains NumPy), thus one can skip directly to LibXC/GPAW instructions. Scalable Python =============== Standard Python interpreter has serious bottleneck in large scale parallel calculations when many MPI tasks perform the same I/O operations during the import statetements. Scalable Python ``_ reduces the import time by having only single MPI task to perform import related I/O operations and using then MPI for broadcasting the data. First, download the source code and switch to GNU environment:: git clone git@gitorious.org:scalable-python/scalable-python.git module switch intel gnu export OMPI_MPICC=gcc Use the following build script (change the installation prefix to a proper one): .. literalinclude:: build_scalable_python_curie.sh Add then ``install_prefix/bin`` to your PATH, and download and install NumPy:: export PATH=install_prefix/bin:$PATH wget http://sourceforge.net/projects/numpy/files/NumPy/1.8.1/numpy-1.8.1.tar.gz tar xzf numpy-1.8.1.tar.gz cd numpy-1.8.1 python setup.py install LibXC ===== Download libxc:: wget http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.2.0.tar.gz Configure and make:: ./configure --prefix=install_prefix CFLAGS=-fPIC make make install GPAW ==== Intel compiler gives a bit better performance for GPAW, so one should switch back to Intel environment after Scalable Python/LibXC installation:: module switch gnu intel unset OMPI_MPICC Furthermore, in order to utilize HDF5 load the module:: module load hdf5/1.8.12_parallel Use the compiler wrapper file :git:`~doc/platforms/Linux/icc.py` .. literalinclude:: icc.py and the following configuration file :download:`customize_curie_icc.py`. .. literalinclude:: customize_curie_icc.py GPAW can now build in a normal way (make sure Scalable Python is in the PATH):: python setup.py install --home=path_to_install_prefix gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/curie_gpu.rst000066400000000000000000000021571316441372200263170ustar00rootroot00000000000000.. _curie_gpu: ==================== curie.ccc.cea.fr GPU ==================== Here you find information about the the system http://www-hpc.cea.fr/en/complexe/tgcc-curie.htm. **Warning**: May 14 2013: rpa-gpu-expt branch fails to compile due to cublasZdgmm missing in cuda-4.2. The system runs Bull Linux. The installation assumes *bash* shell: - packages are installed under ``~/CAMd``:: mkdir ~/CAMd cd ~/CAMd - module files are located under ``~/CAMd/modulefiles``:: mkdir ~/CAMd/modulefiles - download the :download:`customize_curie_gpu.py` file: .. literalinclude:: customize_curie_gpu.py - download packages with :download:`download_curie_gpu.sh`: .. literalinclude:: download_curie_gpu.sh - install packages, deploy modules and test with :download:`install_curie_gpu.sh`: .. literalinclude:: install_curie_gpu.sh **Note** that every time you wish to install a new version of a package, and deploy new module file, better keep the old module file. - submit a test job:: ccc_msub msub_curie_gpu.sh using the following :file:`msub_curie_gpu.sh`: .. literalinclude:: msub_curie_gpu.sh gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/customize_curie_gcc.py000066400000000000000000000007261316441372200302020ustar00rootroot00000000000000import os scalapack = True hdf5 = True mpicompiler = 'mpicc' libraries = [] # MKL flags mkl_flags = os.environ['MKL_SCA_LIBS'] extra_link_args = [mkl_flags] # HDF5 flags include_dirs += [os.environ['HDF5_INC_DIR']] libraries += ['hdf5'] library_dirs += [os.environ['HDF5_LIB_DIR']] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [("GPAW_ASYNC",1)] define_macros += [("GPAW_MPI2",1)] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/customize_curie_gpu.py000066400000000000000000000034641316441372200302430ustar00rootroot00000000000000import os scalapack = True hdf5 = False # ld: /usr/local/phdf5-1.8.5/lib/libhdf5.a(H5.o): relocation R_X86_64_32 against `.rodata.str1.4' can not be used when making a shared object; recompile with -fPIC compiler = 'icc' mpi='/opt/mpi/bullxmpi/1.1.16.5' mkl='/usr/local/Intel_compilers/c/composer_xe_2011_sp1.7.256/mkl/lib/intel64' intel='/usr/local/Intel_compilers/c/composer_xe_2011_sp1.7.256/compiler/lib/intel64' hdf='/usr/local/phdf5-1.8.5' # # cublasZdgmm does not exist in cuda 4.2 # /tmp/ipo_iccjq2M5h1.o: In function `cudgmm': # ipo_out1.c:(.text.hot0001d+0x522b): undefined reference to `cublasZdgmm' # strings /usr/local/cuda-4.2/lib64/libcublas.so | grep "cublasZdgmm" cuda='/usr/local/cuda-4.2' # comment out if no cuda libraries =[ 'cublas', 'cufft', 'cuda', # comment out if no cuda 'cudart', # comment out if no cuda #'mkl_def', 'mkl_scalapack_lp64', 'mkl_intel_lp64', 'mkl_sequential', 'mkl_core', 'mkl_blacs_openmpi_lp64', #'hdf5', 'mpi', ] library_dirs =[ intel, os.path.join(mpi, 'lib'), mkl, os.path.join(cuda, 'lib64'), # comment out if no cuda #os.path.join(hdf, 'lib'), ] include_dirs +=[ os.path.join(mpi, 'include'), os.path.join(cuda, 'include'), # comment out if no cuda #os.path.join(hdf, 'include'), ] extra_link_args =[ '-Wl,-rpath=' + intel + ',-rpath=' + os.path.join(mpi, 'lib') + ',-rpath=' + os.path.join(cuda, 'lib64') + # comment out if no cuda ',-rpath=' + mkl #',-rpath=' + os.path.join(hdf, 'lib') ] extra_compile_args =['-xHOST', '-O3', '-ipo', '-std=c99', '-fPIC', '-Wall'] extra_objects += ['./c/cukernels.o'] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] mpicompiler = os.path.join(mpi, 'bin', 'mpicc') mpilinker = mpicompiler gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/customize_curie_icc.py000066400000000000000000000012141316441372200301750ustar00rootroot00000000000000import os extra_compile_args = ['-std=c99'] compiler = './icc.py' mpicompiler = './icc.py' mpilinker = './icc.py' #libxc library_dirs = ['/ccc/cont005/home/pawp72/enkovaaj/libxc/lib'] include_dirs += ['/ccc/cont005/home/pawp72/enkovaaj/libxc/include'] libraries = ['z', 'xc'] scalapack = True hdf5 = True mkl_flags = os.environ['MKL_SCA_LIBS'] extra_link_args = [mkl_flags] # HDF5 flags include_dirs += [os.environ['HDF5_INCDIR']] libraries += ['hdf5'] library_dirs += [os.environ['HDF5_LIBDIR']] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [("GPAW_ASYNC",1)] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/download_curie_gpu.sh000077500000000000000000000016041316441372200300070ustar00rootroot00000000000000export APPS="readlink -f ~/CAMd" export MODULEFILES="${APPS}/modulefiles" # warning - firewall blocks that, so download on other machine and scp! cd ${APPS} # download packages nose_version=1.1.2 wget http://pypi.python.org/packages/source/n/nose/nose-${nose_version}.tar.gz numpy_version=1.5.1 wget http://downloads.sourceforge.net/numpy/numpy-${numpy_version}.tar.gz scipy_version=0.9.0 wget https://downloads.sourceforge.net/project/scipy/scipy/${scipy_version}/scipy-${scipy_version}.tar.gz ase_version=3.7.0.3168 wget https://wiki.fysik.dtu.dk/ase-files/python-ase-${ase_version}.tar.gz gpaw_version=0.9.0.8965 wget https://wiki.fysik.dtu.dk/gpaw-files/gpaw-${gpaw_version}.tar.gz gpaw_setups_version=0.9.9672 wget http://wiki.fysik.dtu.dk/gpaw-files/gpaw-setups-${gpaw_setups_version}.tar.gz # OK, curie does not allow svn! svn co https://svn.fysik.dtu.dk/projects/gpaw/branches/rpa-gpu-expt gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/icc.py000077500000000000000000000021201316441372200247040ustar00rootroot00000000000000#!/usr/bin/python """icc.py is a wrapper for the Intel compiler, converting/removing incompatible gcc args. """ import sys from subprocess import call args2change = {"-fno-strict-aliasing":"", "-fmessage-length=0":"", "-Wall":"", "-std=c99":"-qlanglvl=extc99", "-fPIC":"", "-g":"", "-D_FORTIFY_SOURCE=2":"", "-DNDEBUG":"", "-UNDEBUG":"", "-pthread":"", "-shared":"-qmkshrobj", "-Xlinker":"", "-export-dynamic":"", "-Wstrict-prototypes":"", "-dynamic":"", "-O3":"", "-O3":"", "-O2":"", "-O1":""} fragile_files = ["test.c"] cmd = "" fragile = False for arg in sys.argv[1:]: cmd += " " t = arg.strip() if t in fragile_files: fragile = True if t in args2change: cmd += args2change[t] else: cmd += arg flags = "-w -O3 -std=c99" cmd = "mpicc %s %s"%(flags, cmd) call(cmd, shell=True) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/install_curie_gpu.sh000077500000000000000000000122321316441372200276450ustar00rootroot00000000000000export APPS=`readlink -f ~/CAMd` export CAMD_MODULEFILES="${APPS}/modulefiles" export GPAW_PLATFORM=`python -c "from distutils import util, sysconfig; print util.get_platform()+'-'+sysconfig.get_python_version()"` export PYTHONVERSION=`python -c "from distutils import sysconfig; print sysconfig.get_python_version()"` # build packages nose_version=1.1.2 tar zxf nose-${nose_version}.tar.gz cd nose-${nose_version} python setup.py install --root=${APPS}/nose-${nose_version}-1 cd .. mkdir -p ${CAMD_MODULEFILES}/nose cat < ${CAMD_MODULEFILES}/nose/${nose_version}-1 #%Module1.0 set apps_path ${APPS} prepend-path PATH \$apps_path/nose-${nose_version}-1/usr/bin prepend-path PYTHONPATH \$apps_path/nose-${nose_version}-1/usr/lib/python${PYTHONVERSION}/site-packages/ unset apps_path EOF numpy_version=1.5.1 tar zxf numpy-${numpy_version}.tar.gz cd numpy-${numpy_version} # atlas on curie is built without -fPIC # /usr/bin/ld: /usr/local/atlas-3.9.72/lib/libcblas.a(cblas_dgemm.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC # and atlas-devel is not installed! # so hack! ln -s /usr/lib64/atlas/libatlas.so.3.0 libatlas.so ln -s /usr/lib64/atlas/libcblas.so.3.0 libcblas.so ln -s /usr/lib64/atlas/libclapack.so.3 libclapack.so ln -s /usr/lib64/atlas/libf77blas.so.3 libf77blas.so ln -s /usr/lib64/atlas/liblapack.so.3 liblapack.so echo "[DEFAULT]" > site.cfg echo "library_dirs = $PWD" >> site.cfg echo "include_dirs = /usr/local/atlas-3.9.72/include" >> site.cfg # avoid "Both g77 and gfortran runtimes linked in lapack_lite !" setting --fcompiler=gnu95 # note that this forces /usr/bin/gfortran to be used python setup.py build --fcompiler=gnu95 2>&1 | tee build.log python setup.py install --root=${APPS}/numpy-${numpy_version}-1 2>&1 | tee install.log cd .. mkdir -p ${CAMD_MODULEFILES}/numpy cat < ${CAMD_MODULEFILES}/numpy/${numpy_version}-1 #%Module1.0 set apps_path ${APPS} prereq nose prepend-path PATH \$apps_path/numpy-${numpy_version}-1/usr/bin prepend-path PYTHONPATH \$apps_path/numpy-${numpy_version}-1/usr/lib64/python${PYTHONVERSION}/site-packages/ unset apps_path EOF # the atlas is missing on the hybrid (only?) nodes so hack again! mkdir atlas && cd atlas cp -p /usr/lib64/atlas/liblapack.so.3 . cp -p /usr/lib64/atlas/libf77blas.so.3 . cp -p /usr/lib64/atlas/libcblas.so.3 . cp -p /usr/lib64/atlas/libatlas.so.3 . cd .. module use $CAMD_MODULEFILES module load nose module load numpy # scipy build needs numpy! scipy_version=0.9.0 tar zxf scipy-${scipy_version}.tar.gz cd scipy-${scipy_version} # avoid g77 - leads to Segmentation faults # note that this forces /usr/bin/gfortran to be used python setup.py build --fcompiler=gnu95 2>&1 | tee build.log python setup.py install --root=${APPS}/scipy-${scipy_version}-1 2>&1 | tee install.log cd .. mkdir -p ${CAMD_MODULEFILES}/scipy cat < ${CAMD_MODULEFILES}/scipy/${scipy_version}-1 #%Module1.0 set apps_path ${APPS} prereq nose prepend-path PATH \$apps_path/scipy-${scipy_version}-1/usr/bin prepend-path PYTHONPATH \$apps_path/scipy-${scipy_version}-1/usr/lib64/python${PYTHONVERSION}/site-packages/ unset apps_path EOF ase_version=3.7.0.3168 tar zxf python-ase-${ase_version}.tar.gz mkdir -p ${CAMD_MODULEFILES}/python-ase cat < ${CAMD_MODULEFILES}/python-ase/${ase_version}-1 #%Module1.0 set apps_path ${APPS} prereq numpy prepend-path PATH \$apps_path/python-ase-${ase_version}/tools prepend-path PYTHONPATH \$apps_path/python-ase-${ase_version}/ unset apps_path EOF gpaw_setups_version=0.9.9672 tar zxf gpaw-setups-${gpaw_setups_version}.tar.gz mkdir -p ${CAMD_MODULEFILES}/gpaw-setups cat < ${CAMD_MODULEFILES}/gpaw-setups/${gpaw_setups_version}-1 #%Module1.0 set apps_path ${APPS} prepend-path GPAW_SETUP_PATH \$apps_path/gpaw-setups-${gpaw_setups_version} unset apps_path EOF gpaw_version=0.9.0.8965 tar zxf gpaw-${gpaw_version}.tar.gz mkdir -p ${CAMD_MODULEFILES}/gpaw cat < ${CAMD_MODULEFILES}/gpaw/${gpaw_version}-1 #%Module1.0 set apps_path ${APPS} prereq python-ase prereq gpaw-setups prepend-path PATH \$apps_path/gpaw-${gpaw_version}/tools prepend-path PATH \$apps_path/gpaw-${gpaw_version}/build/bin.${GPAW_PLATFORM} prepend-path PYTHONPATH \$apps_path/gpaw-${gpaw_version}/ prepend-path PYTHONPATH \$apps_path/gpaw-${gpaw_version}/build/lib.${GPAW_PLATFORM} setenv OMP_NUM_THREADS 1 unset apps_path EOF module load nose module load numpy module load scipy # test numpy and scipy python -c "import numpy; numpy.test()" python -c "import scipy; scipy.test()" # test ase module load python-ase mkdir -p testase cd testase testase.py --no-display 2>&1 | tee testase.log cd .. # build gpaw cd gpaw-${gpaw_version} module load cuda # if on rpa-gpu-expt branch rm -f c/cukernels.o cd c nvcc -arch sm_20 -c cukernels.cu -Xcompiler -fPIC cd .. # wget https://svn.fysik.dtu.dk/projects/gpaw/trunk/config.py # fixed in trunk python setup.py build_ext --customize=../customize_curie_gpu.py --remove-default-flags 2>&1 | tee build_ext.log cd .. module load gpaw-setups module load gpaw gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Bull/msub_curie_gpu.sh000077500000000000000000000010171316441372200271440ustar00rootroot00000000000000#/bin/sh #MSUB -n 8 # number of tasks #MSUB -T 4600 # time #MSUB -q hybrid # use hybrid for GPU #MSUB -A paxxxx set -x cd ${BRIDGE_MSUB_PWD} module use ${HOME}/CAMd/modulefiles module load nose # blas/lapack/atlas missing export LD_LIBRARY_PATH=${HOME}/CAMd/atlas:${LD_LIBRARY_PATH} module load numpy module load scipy module load python-ase module load gpaw-setups/0.8.7929-1 #module load gpaw-setups/0.9.9672-1 module load gpaw #ccc_mprun gpaw-python gpaw-0.9.0.8965/gpaw/test/2Al.py ccc_mprun gpaw-python `which gpaw-test` gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/000077500000000000000000000000001316441372200235765ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/Setup_jaguar000066400000000000000000000427721316441372200261660ustar00rootroot00000000000000# -*- makefile -*- # The file Setup is used by the makesetup script to construct the files # Makefile and config.c, from Makefile.pre and config.c.in, # respectively. The file Setup itself is initially copied from # Setup.dist; once it exists it will not be overwritten, so you can edit # Setup to your heart's content. Note that Makefile.pre is created # from Makefile.pre.in by the toplevel configure script. # (VPATH notes: Setup and Makefile.pre are in the build directory, as # are Makefile and config.c; the *.in and *.dist files are in the source # directory.) # Each line in this file describes one or more optional modules. # Modules enabled here will not be compiled by the setup.py script, # so the file can be used to override setup.py's behavior. # Lines have the following structure: # # ... [ ...] [ ...] [ ...] # # is anything ending in .c (.C, .cc, .c++ are C++ files) # is anything starting with -I, -D, -U or -C # is anything ending in .a or beginning with -l or -L # is anything else but should be a valid Python # identifier (letters, digits, underscores, beginning with non-digit) # # (As the makesetup script changes, it may recognize some other # arguments as well, e.g. *.so and *.sl as libraries. See the big # case statement in the makesetup script.) # # Lines can also have the form # # = # # which defines a Make variable definition inserted into Makefile.in # # Finally, if a line contains just the word "*shared*" (without the # quotes but with the stars), then the following modules will not be # built statically. The build process works like this: # # 1. Build all modules that are declared as static in Modules/Setup, # combine them into libpythonxy.a, combine that into python. # 2. Build all modules that are listed as shared in Modules/Setup. # 3. Invoke setup.py. That builds all modules that # a) are not builtin, and # b) are not listed in Modules/Setup, and # c) can be build on the target # # Therefore, modules declared to be shared will not be # included in the config.c file, nor in the list of objects to be # added to the library archive, and their linker options won't be # added to the linker options. Rules to create their .o files and # their shared libraries will still be added to the Makefile, and # their names will be collected in the Make variable SHAREDMODS. This # is used to build modules as shared libraries. (They can be # installed using "make sharedinstall", which is implied by the # toplevel "make install" target.) (For compatibility, # *noconfig* has the same effect as *shared*.) # # In addition, *static* explicitly declares the following modules to # be static. Lines containing "*static*" and "*shared*" may thus # alternate throughout this file. # NOTE: As a standard policy, as many modules as can be supported by a # platform should be present. The distribution comes with all modules # enabled that are supported by most platforms and don't require you # to ftp sources from elsewhere. # Some special rules to define PYTHONPATH. # Edit the definitions below to indicate which options you are using. # Don't add any whitespace or comments! # Directories where library files get installed. # DESTLIB is for Python modules; MACHDESTLIB for shared libraries. DESTLIB=$(LIBDEST) MACHDESTLIB=$(BINLIBDEST) # NOTE: all the paths are now relative to the prefix that is computed # at run time! # Standard path -- don't edit. # No leading colon since this is the first entry. # Empty since this is now just the runtime prefix. DESTPATH= # Site specific path components -- should begin with : if non-empty SITEPATH= # Standard path components for test modules TESTPATH= # Path components for machine- or system-dependent modules and shared libraries MACHDEPPATH=:plat-$(MACHDEP) EXTRAMACHDEPPATH= # Path component for the Tkinter-related modules # The TKPATH variable is always enabled, to save you the effort. TKPATH=:lib-tk COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH) PYTHONPATH=$(COREPYTHONPATH) # The modules listed here can't be built as shared libraries for # various reasons; therefore they are listed here instead of in the # normal order. # This only contains the minimal set of modules required to run the # setup.py script in the root of the Python source tree. posix posixmodule.c # posix (UNIX) system calls errno errnomodule.c # posix (UNIX) errno values pwd pwdmodule.c # this is needed to find out the user's home dir # if $HOME is not set _sre _sre.c # Fredrik Lundh's new regular expressions _codecs _codecsmodule.c # access to the builtin codecs and codec registry # The zipimport module is always imported at startup. Having it as a # builtin module avoids some bootstrapping problems and reduces overhead. zipimport zipimport.c # The rest of the modules listed in this file are all commented out by # default. Usually they can be detected and built as dynamically # loaded modules by the new setup.py script added in Python 2.1. If # you're on a platform that doesn't support dynamic loading, want to # compile modules statically into the Python binary, or need to # specify some odd set of compiler switches, you can uncomment the # appropriate lines below. # ====================================================================== # The Python symtable module depends on .h files that setup.py doesn't track _symtable symtablemodule.c # The SGI specific GL module: GLHACK=-Dclear=__GLclear #gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11 # Pure module. Cannot be linked dynamically. # -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE #WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE #PURE_INCLS=-I/usr/local/include #PURE_STUBLIBS=-L/usr/local/lib -lpurify_stubs -lquantify_stubs #pure puremodule.c $(WHICH_PURE_PRODUCTS) $(PURE_INCLS) $(PURE_STUBLIBS) # Uncommenting the following line tells makesetup that all following # modules are to be built as shared libraries (see above for more # detail; also note that *static* reverses this effect): #*shared* # GNU readline. Unlike previous Python incarnations, GNU readline is # now incorporated in an optional module, configured in the Setup file # instead of by a configure script switch. You may have to insert a # -L option pointing to the directory where libreadline.* lives, # and you may have to change -ltermcap to -ltermlib or perhaps remove # it, depending on your system -- see the GNU readline instructions. # It's okay for this to be a shared library, too. readline readline.c -L/usr/lib64/termcap -lreadline -ltermcap # Modules that should always be present (non UNIX dependent): array arraymodule.c # array objects cmath cmathmodule.c # -lm # complex math library functions math mathmodule.c # -lm # math library functions, e.g. sin() _struct _struct.c # binary structure packing/unpacking time timemodule.c # -lm # time operations and variables operator operator.c # operator.add() and similar goodies _weakref _weakref.c # basic weak reference support _testcapi _testcapimodule.c # Python C API test module _random _randommodule.c # Random number generator collections collectionsmodule.c # Container types itertools itertoolsmodule.c # Functions creating iterators for efficient looping strop stropmodule.c # String manipulations unicodedata unicodedata.c # static Unicode character database # access to ISO C locale support #_locale _localemodule.c # -lintl # Modules with some UNIX dependencies -- on by default: # (If you have a really backward UNIX, select and socket may not be # supported...) #fcntl fcntlmodule.c # fcntl(2) and ioctl(2) #spwd spwdmodule.c # spwd(3) #grp grpmodule.c # grp(3) #select selectmodule.c # select(2); not on ancient System V # Memory-mapped files (also works on Win32). mmap mmapmodule.c # CSV file helper #_csv _csv.c # Socket module helper for socket(2) #_socket socketmodule.c # Socket module helper for SSL support; you must comment out the other # socket line above, and possibly edit the SSL variable: #SSL=/usr/local/ssl #_ssl _ssl.c \ # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ # -L$(SSL)/lib -lssl -lcrypto # The crypt module is now disabled by default because it breaks builds # on many systems (where -lcrypt is needed), e.g. Linux (I believe). # # First, look at Setup.config; configure may have set this for you. #crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems # Some more UNIX dependent modules -- off by default, since these # are not supported by all UNIX systems: #nis nismodule.c -lnsl # Sun yellow pages -- not everywhere #termios termios.c # Steen Lumholt's termios module resource resource.c # Jeremy Hylton's rlimit interface # Multimedia modules -- off by default. # These don't work for 64-bit platforms!!! # #993173 says audioop works on 64-bit platforms, though. # These represent audio samples or images as strings: #audioop audioop.c # Operations on audio samples #imageop imageop.c # Operations on images #rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably) # Note that the _md5 and _sha modules are normally only built if the # system does not have the OpenSSL libs containing an optimized version. # The _md5 module implements the RSA Data Security, Inc. MD5 # Message-Digest Algorithm, described in RFC 1321. The necessary files # md5.c and md5.h are included here. _md5 md5module.c md5.c # The _sha module implements the SHA checksum algorithm. # (NIST's Secure Hash Algorithm.) _sha shamodule.c _sha256 sha256module.c _sha512 sha512module.c # SGI IRIX specific modules -- off by default. # These module work on any SGI machine: # *** gl must be enabled higher up in this file *** #fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager #sgi sgimodule.c # sgi.nap() and a few more # This module requires the header file # /usr/people/4Dgifts/iristools/include/izoom.h: #imgfile imgfile.c -limage -lgutil -lgl -lm # Image Processing Utilities # These modules require the Multimedia Development Option (I think): #al almodule.c -laudio # Audio Library #cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library #cl clmodule.c -lcl -lawareaudio # Compression Library #sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video # The FORMS library, by Mark Overmars, implements user interface # components such as dialogs and buttons using SGI's GL and FM # libraries. You must ftp the FORMS library separately from # ftp://ftp.cs.ruu.nl/pub/SGI/FORMS. It was tested with FORMS 2.2a. # NOTE: if you want to be able to use FORMS and curses simultaneously # (or both link them statically into the same binary), you must # compile all of FORMS with the cc option "-Dclear=__GLclear". # The FORMS variable must point to the FORMS subdirectory of the forms # toplevel directory: #FORMS=/ufs/guido/src/forms/FORMS #fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl # SunOS specific modules -- off by default: #sunaudiodev sunaudiodev.c # A Linux specific module -- off by default; this may also work on # some *BSDs. #linuxaudiodev linuxaudiodev.c # George Neville-Neil's timing module: #timing timingmodule.c # The _tkinter module. # # The command for _tkinter is long and site specific. Please # uncomment and/or edit those parts as indicated. If you don't have a # specific extension (e.g. Tix or BLT), leave the corresponding line # commented out. (Leave the trailing backslashes in! If you # experience strange errors, you may want to join all uncommented # lines and remove the backslashes -- the backslash interpretation is # done by the shell's "read" command and it may not be implemented on # every system. # *** Always uncomment this (leave the leading underscore in!): # _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: # -L/usr/local/lib \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: # -I/usr/local/include \ # *** Uncomment and edit to reflect where your X11 header files are: # -I/usr/X11R6/include \ # *** Or uncomment this for Solaris: # -I/usr/openwin/include \ # *** Uncomment and edit for Tix extension only: # -DWITH_TIX -ltix8.1.8.2 \ # *** Uncomment and edit for BLT extension only: # -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ # *** Uncomment and edit for PIL (TkImaging) extension only: # (See http://www.pythonware.com/products/pil/ for more info) # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ # *** Uncomment and edit for TOGL extension only: # -DWITH_TOGL togl.c \ # *** Uncomment and edit to reflect your Tcl/Tk versions: # -ltk8.2 -ltcl8.2 \ # *** Uncomment and edit to reflect where your X11 libraries are: # -L/usr/X11R6/lib \ # *** Or uncomment this for Solaris: # -L/usr/openwin/lib \ # *** Uncomment these for TOGL extension only: # -lGL -lGLU -lXext -lXmu \ # *** Uncomment for AIX: # -lld \ # *** Always uncomment this; X11 libraries to link with: # -lX11 # Lance Ellinghaus's syslog module #syslog syslogmodule.c # syslog daemon interface # Curses support, requring the System V version of curses, often # provided by the ncurses library. e.g. on Linux, link with -lncurses # instead of -lcurses). # # First, look at Setup.config; configure may have set this for you. #_curses _cursesmodule.c -lcurses -ltermcap # Wrapper for the panel library that's part of ncurses and SYSV curses. #_curses_panel _curses_panel.c -lpanel -lncurses # Generic (SunOS / SVR4) dynamic loading module. # This is not needed for dynamic loading of Python modules -- # it is a highly experimental and dangerous device for calling # *arbitrary* C functions in *arbitrary* shared libraries: #dl dlmodule.c # Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on # your machine, though none are defined by default because of library # dependencies. The Python module anydbm.py provides an # implementation independent wrapper for these; dumbdbm.py provides # similar functionality (but slower of course) implemented in Python. # The standard Unix dbm module has been moved to Setup.config so that # it will be compiled as a shared library by default. Compiling it as # a built-in module causes conflicts with the pybsddb3 module since it # creates a static dependency on an out-of-date version of db.so. # # First, look at Setup.config; configure may have set this for you. #dbm dbmmodule.c # dbm(3) may require -lndbm or similar # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: # # First, look at Setup.config; configure may have set this for you. #gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm # Sleepycat Berkeley DB interface. # # This requires the Sleepycat DB code, see http://www.sleepycat.com/ # The earliest supported version of that library is 3.0, the latest # supported version is 4.0 (4.1 is specifically not supported, as that # changes the semantics of transactional databases). A list of available # releases can be found at # # http://www.sleepycat.com/update/index.html # # Edit the variables DB and DBLIBVERto point to the db top directory # and the subdirectory of PORT where you built it. #DB=/usr/local/BerkeleyDB.4.0 #DBLIBVER=4.0 #DBINC=$(DB)/include #DBLIB=$(DB)/lib #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) # Historical Berkeley DB 1.85 # # This module is deprecated; the 1.85 version of the Berkeley DB library has # bugs that can cause data corruption. If you can, use later versions of the # library instead, available from . #DB=/depot/sundry/src/berkeley-db/db.1.85 #DBPORT=$(DB)/PORT/irix.5.3 #bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a # Helper module for various ascii-encoders binascii binascii.c # Fred Drake's interface to the Python parser #parser parsermodule.c # cStringIO and cPickle cStringIO cStringIO.c cPickle cPickle.c # Lee Busby's SIGFPE modules. # The library to link fpectl with is platform specific. # Choose *one* of the options below for fpectl: # For SGI IRIX (tested on 5.3): #fpectl fpectlmodule.c -lfpe # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): # (Without the compiler you don't have -lsunmath.) #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm # For other systems: see instructions in fpectlmodule.c. #fpectl fpectlmodule.c ... # Test module for fpectl. No extra libraries needed. #fpetest fpetestmodule.c # Andrew Kuchling's zlib module. # This require zlib 1.1.3 (or later). # See http://www.gzip.org/zlib/ zlib zlibmodule.c -I$(ZLIB_DIR)/include -L$(ZLIB_DIR)/lib -lz # Interface to the Expat XML parser # # Expat was written by James Clark and is now maintained by a group of # developers on SourceForge; see www.libexpat.org for more # information. The pyexpat module was written by Paul Prescod after a # prototype by Jack Jansen. Source of Expat 1.95.2 is included in # Modules/expat/. Usage of a system shared libexpat.so/expat.dll is # not advised. # # More information on Expat can be found at www.libexpat.org. # #EXPAT_DIR=/usr/local/src/expat-1.95.2 pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat # Hye-Shik Chang's CJKCodecs # multibytecodec is required for all the other CJK codec modules #_multibytecodec cjkcodecs/multibytecodec.c #_codecs_cn cjkcodecs/_codecs_cn.c #_codecs_hk cjkcodecs/_codecs_hk.c #_codecs_iso2022 cjkcodecs/_codecs_iso2022.c #_codecs_jp cjkcodecs/_codecs_jp.c #_codecs_kr cjkcodecs/_codecs_kr.c #_codecs_tw cjkcodecs/_codecs_tw.c # Example -- included for reference only: # xx xxmodule.c # Another example -- the 'xxsubtype' module shows C-level subtyping in action xxsubtype xxsubtype.c #Numpy: gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/Setup_louhi000066400000000000000000000442431316441372200260300ustar00rootroot00000000000000# -*- makefile -*- # The file Setup is used by the makesetup script to construct the files # Makefile and config.c, from Makefile.pre and config.c.in, # respectively. The file Setup itself is initially copied from # Setup.dist; once it exists it will not be overwritten, so you can edit # Setup to your heart's content. Note that Makefile.pre is created # from Makefile.pre.in by the toplevel configure script. # (VPATH notes: Setup and Makefile.pre are in the build directory, as # are Makefile and config.c; the *.in and *.dist files are in the source # directory.) # Each line in this file describes one or more optional modules. # Modules enabled here will not be compiled by the setup.py script, # so the file can be used to override setup.py's behavior. # Lines have the following structure: # # ... [ ...] [ ...] [ ...] # # is anything ending in .c (.C, .cc, .c++ are C++ files) # is anything starting with -I, -D, -U or -C # is anything ending in .a or beginning with -l or -L # is anything else but should be a valid Python # identifier (letters, digits, underscores, beginning with non-digit) # # (As the makesetup script changes, it may recognize some other # arguments as well, e.g. *.so and *.sl as libraries. See the big # case statement in the makesetup script.) # # Lines can also have the form # # = # # which defines a Make variable definition inserted into Makefile.in # # Finally, if a line contains just the word "*shared*" (without the # quotes but with the stars), then the following modules will not be # built statically. The build process works like this: # # 1. Build all modules that are declared as static in Modules/Setup, # combine them into libpythonxy.a, combine that into python. # 2. Build all modules that are listed as shared in Modules/Setup. # 3. Invoke setup.py. That builds all modules that # a) are not builtin, and # b) are not listed in Modules/Setup, and # c) can be build on the target # # Therefore, modules declared to be shared will not be # included in the config.c file, nor in the list of objects to be # added to the library archive, and their linker options won't be # added to the linker options. Rules to create their .o files and # their shared libraries will still be added to the Makefile, and # their names will be collected in the Make variable SHAREDMODS. This # is used to build modules as shared libraries. (They can be # installed using "make sharedinstall", which is implied by the # toplevel "make install" target.) (For compatibility, # *noconfig* has the same effect as *shared*.) # # In addition, *static* explicitly declares the following modules to # be static. Lines containing "*static*" and "*shared*" may thus # alternate throughout this file. # NOTE: As a standard policy, as many modules as can be supported by a # platform should be present. The distribution comes with all modules # enabled that are supported by most platforms and don't require you # to ftp sources from elsewhere. # Some special rules to define PYTHONPATH. # Edit the definitions below to indicate which options you are using. # Don't add any whitespace or comments! # Directories where library files get installed. # DESTLIB is for Python modules; MACHDESTLIB for shared libraries. DESTLIB=$(LIBDEST) MACHDESTLIB=$(BINLIBDEST) # NOTE: all the paths are now relative to the prefix that is computed # at run time! # Standard path -- don't edit. # No leading colon since this is the first entry. # Empty since this is now just the runtime prefix. DESTPATH= # Site specific path components -- should begin with : if non-empty SITEPATH= # Standard path components for test modules TESTPATH= # Path components for machine- or system-dependent modules and shared libraries MACHDEPPATH=:plat-$(MACHDEP) EXTRAMACHDEPPATH= # Path component for the Tkinter-related modules # The TKPATH variable is always enabled, to save you the effort. TKPATH=:lib-tk COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH) PYTHONPATH=$(COREPYTHONPATH) # The modules listed here can't be built as shared libraries for # various reasons; therefore they are listed here instead of in the # normal order. # This only contains the minimal set of modules required to run the # setup.py script in the root of the Python source tree. posix posixmodule.c # posix (UNIX) system calls errno errnomodule.c # posix (UNIX) errno values pwd pwdmodule.c # this is needed to find out the user's home dir # if $HOME is not set _sre _sre.c # Fredrik Lundh's new regular expressions _codecs _codecsmodule.c # access to the builtin codecs and codec registry # The zipimport module is always imported at startup. Having it as a # builtin module avoids some bootstrapping problems and reduces overhead. zipimport zipimport.c # The rest of the modules listed in this file are all commented out by # default. Usually they can be detected and built as dynamically # loaded modules by the new setup.py script added in Python 2.1. If # you're on a platform that doesn't support dynamic loading, want to # compile modules statically into the Python binary, or need to # specify some odd set of compiler switches, you can uncomment the # appropriate lines below. # ====================================================================== # The Python symtable module depends on .h files that setup.py doesn't track _symtable symtablemodule.c # The SGI specific GL module: GLHACK=-Dclear=__GLclear #gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11 # Pure module. Cannot be linked dynamically. # -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE #WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE #PURE_INCLS=-I/usr/local/include #PURE_STUBLIBS=-L/usr/local/lib -lpurify_stubs -lquantify_stubs #pure puremodule.c $(WHICH_PURE_PRODUCTS) $(PURE_INCLS) $(PURE_STUBLIBS) # Uncommenting the following line tells makesetup that all following # modules are to be built as shared libraries (see above for more # detail; also note that *static* reverses this effect): #*shared* # GNU readline. Unlike previous Python incarnations, GNU readline is # now incorporated in an optional module, configured in the Setup file # instead of by a configure script switch. You may have to insert a # -L option pointing to the directory where libreadline.* lives, # and you may have to change -ltermcap to -ltermlib or perhaps remove # it, depending on your system -- see the GNU readline instructions. # It's okay for this to be a shared library, too. # readline readline.c -lreadline -L/usr/lib64/termcap -ltermcap # Modules that should always be present (non UNIX dependent): array arraymodule.c # array objects cmath cmathmodule.c # -lm # complex math library functions math mathmodule.c # -lm # math library functions, e.g. sin() _struct _struct.c # binary structure packing/unpacking time timemodule.c # -lm # time operations and variables operator operator.c # operator.add() and similar goodies _weakref _weakref.c # basic weak reference support _testcapi _testcapimodule.c # Python C API test module _random _randommodule.c # Random number generator collections collectionsmodule.c # Container types itertools itertoolsmodule.c # Functions creating iterators for efficient looping strop stropmodule.c # String manipulations unicodedata unicodedata.c # static Unicode character database # access to ISO C locale support #_locale _localemodule.c # -lintl # Modules with some UNIX dependencies -- on by default: # (If you have a really backward UNIX, select and socket may not be # supported...) #fcntl fcntlmodule.c # fcntl(2) and ioctl(2) #spwd spwdmodule.c # spwd(3) #grp grpmodule.c # grp(3) #select selectmodule.c # select(2); not on ancient System V # Memory-mapped files (also works on Win32). mmap mmapmodule.c # CSV file helper #_csv _csv.c # Socket module helper for socket(2) #_socket socketmodule.c # Socket module helper for SSL support; you must comment out the other # socket line above, and possibly edit the SSL variable: #SSL=/usr/local/ssl #_ssl _ssl.c \ # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ # -L$(SSL)/lib -lssl -lcrypto # The crypt module is now disabled by default because it breaks builds # on many systems (where -lcrypt is needed), e.g. Linux (I believe). # # First, look at Setup.config; configure may have set this for you. #crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems # Some more UNIX dependent modules -- off by default, since these # are not supported by all UNIX systems: #nis nismodule.c -lnsl # Sun yellow pages -- not everywhere #termios termios.c # Steen Lumholt's termios module resource resource.c # Jeremy Hylton's rlimit interface # Multimedia modules -- off by default. # These don't work for 64-bit platforms!!! # #993173 says audioop works on 64-bit platforms, though. # These represent audio samples or images as strings: #audioop audioop.c # Operations on audio samples #imageop imageop.c # Operations on images #rgbimg rgbimgmodule.c # Read SGI RGB image files (but coded portably) # Note that the _md5 and _sha modules are normally only built if the # system does not have the OpenSSL libs containing an optimized version. # The _md5 module implements the RSA Data Security, Inc. MD5 # Message-Digest Algorithm, described in RFC 1321. The necessary files # md5.c and md5.h are included here. _md5 md5module.c md5.c # The _sha module implements the SHA checksum algorithm. # (NIST's Secure Hash Algorithm.) _sha shamodule.c _sha256 sha256module.c _sha512 sha512module.c # SGI IRIX specific modules -- off by default. # These module work on any SGI machine: # *** gl must be enabled higher up in this file *** #fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager #sgi sgimodule.c # sgi.nap() and a few more # This module requires the header file # /usr/people/4Dgifts/iristools/include/izoom.h: #imgfile imgfile.c -limage -lgutil -lgl -lm # Image Processing Utilities # These modules require the Multimedia Development Option (I think): #al almodule.c -laudio # Audio Library #cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library #cl clmodule.c -lcl -lawareaudio # Compression Library #sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video # The FORMS library, by Mark Overmars, implements user interface # components such as dialogs and buttons using SGI's GL and FM # libraries. You must ftp the FORMS library separately from # ftp://ftp.cs.ruu.nl/pub/SGI/FORMS. It was tested with FORMS 2.2a. # NOTE: if you want to be able to use FORMS and curses simultaneously # (or both link them statically into the same binary), you must # compile all of FORMS with the cc option "-Dclear=__GLclear". # The FORMS variable must point to the FORMS subdirectory of the forms # toplevel directory: #FORMS=/ufs/guido/src/forms/FORMS #fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl # SunOS specific modules -- off by default: #sunaudiodev sunaudiodev.c # A Linux specific module -- off by default; this may also work on # some *BSDs. #linuxaudiodev linuxaudiodev.c # George Neville-Neil's timing module: #timing timingmodule.c # The _tkinter module. # # The command for _tkinter is long and site specific. Please # uncomment and/or edit those parts as indicated. If you don't have a # specific extension (e.g. Tix or BLT), leave the corresponding line # commented out. (Leave the trailing backslashes in! If you # experience strange errors, you may want to join all uncommented # lines and remove the backslashes -- the backslash interpretation is # done by the shell's "read" command and it may not be implemented on # every system. # *** Always uncomment this (leave the leading underscore in!): # _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: # -L/usr/local/lib \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: # -I/usr/local/include \ # *** Uncomment and edit to reflect where your X11 header files are: # -I/usr/X11R6/include \ # *** Or uncomment this for Solaris: # -I/usr/openwin/include \ # *** Uncomment and edit for Tix extension only: # -DWITH_TIX -ltix8.1.8.2 \ # *** Uncomment and edit for BLT extension only: # -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ # *** Uncomment and edit for PIL (TkImaging) extension only: # (See http://www.pythonware.com/products/pil/ for more info) # -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \ # *** Uncomment and edit for TOGL extension only: # -DWITH_TOGL togl.c \ # *** Uncomment and edit to reflect your Tcl/Tk versions: # -ltk8.2 -ltcl8.2 \ # *** Uncomment and edit to reflect where your X11 libraries are: # -L/usr/X11R6/lib \ # *** Or uncomment this for Solaris: # -L/usr/openwin/lib \ # *** Uncomment these for TOGL extension only: # -lGL -lGLU -lXext -lXmu \ # *** Uncomment for AIX: # -lld \ # *** Always uncomment this; X11 libraries to link with: # -lX11 # Lance Ellinghaus's syslog module #syslog syslogmodule.c # syslog daemon interface # Curses support, requring the System V version of curses, often # provided by the ncurses library. e.g. on Linux, link with -lncurses # instead of -lcurses). # # First, look at Setup.config; configure may have set this for you. #_curses _cursesmodule.c -lcurses -ltermcap # Wrapper for the panel library that's part of ncurses and SYSV curses. #_curses_panel _curses_panel.c -lpanel -lncurses # Generic (SunOS / SVR4) dynamic loading module. # This is not needed for dynamic loading of Python modules -- # it is a highly experimental and dangerous device for calling # *arbitrary* C functions in *arbitrary* shared libraries: #dl dlmodule.c # Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on # your machine, though none are defined by default because of library # dependencies. The Python module anydbm.py provides an # implementation independent wrapper for these; dumbdbm.py provides # similar functionality (but slower of course) implemented in Python. # The standard Unix dbm module has been moved to Setup.config so that # it will be compiled as a shared library by default. Compiling it as # a built-in module causes conflicts with the pybsddb3 module since it # creates a static dependency on an out-of-date version of db.so. # # First, look at Setup.config; configure may have set this for you. #dbm dbmmodule.c # dbm(3) may require -lndbm or similar # Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm: # # First, look at Setup.config; configure may have set this for you. #gdbm gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm # Sleepycat Berkeley DB interface. # # This requires the Sleepycat DB code, see http://www.sleepycat.com/ # The earliest supported version of that library is 3.0, the latest # supported version is 4.0 (4.1 is specifically not supported, as that # changes the semantics of transactional databases). A list of available # releases can be found at # # http://www.sleepycat.com/update/index.html # # Edit the variables DB and DBLIBVERto point to the db top directory # and the subdirectory of PORT where you built it. #DB=/usr/local/BerkeleyDB.4.0 #DBLIBVER=4.0 #DBINC=$(DB)/include #DBLIB=$(DB)/lib #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) # Historical Berkeley DB 1.85 # # This module is deprecated; the 1.85 version of the Berkeley DB library has # bugs that can cause data corruption. If you can, use later versions of the # library instead, available from . #DB=/depot/sundry/src/berkeley-db/db.1.85 #DBPORT=$(DB)/PORT/irix.5.3 #bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a # Helper module for various ascii-encoders binascii binascii.c # Fred Drake's interface to the Python parser #parser parsermodule.c # cStringIO and cPickle cStringIO cStringIO.c cPickle cPickle.c # Lee Busby's SIGFPE modules. # The library to link fpectl with is platform specific. # Choose *one* of the options below for fpectl: # For SGI IRIX (tested on 5.3): #fpectl fpectlmodule.c -lfpe # For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2): # (Without the compiler you don't have -lsunmath.) #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm # For other systems: see instructions in fpectlmodule.c. #fpectl fpectlmodule.c ... # Test module for fpectl. No extra libraries needed. #fpetest fpetestmodule.c # Andrew Kuchling's zlib module. # This require zlib 1.1.3 (or later). # See http://www.gzip.org/zlib/ ZLIB=$/HOME}/mika_proj/zlib-1.2.3 zlib zlibmodule.c -I$(ZLIB) -L$(ZLIB) -lz # Interface to the Expat XML parser # # Expat was written by James Clark and is now maintained by a group of # developers on SourceForge; see www.libexpat.org for more # information. The pyexpat module was written by Paul Prescod after a # prototype by Jack Jansen. Source of Expat 1.95.2 is included in # Modules/expat/. Usage of a system shared libexpat.so/expat.dll is # not advised. # # More information on Expat can be found at www.libexpat.org. # EXPAT_DIR=${HOME}/mika_proj/lib/expat pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/include -L$(EXPAT_DIR)/lib -lexpat # Hye-Shik Chang's CJKCodecs # multibytecodec is required for all the other CJK codec modules #_multibytecodec cjkcodecs/multibytecodec.c #_codecs_cn cjkcodecs/_codecs_cn.c #_codecs_hk cjkcodecs/_codecs_hk.c #_codecs_iso2022 cjkcodecs/_codecs_iso2022.c #_codecs_jp cjkcodecs/_codecs_jp.c #_codecs_kr cjkcodecs/_codecs_kr.c #_codecs_tw cjkcodecs/_codecs_tw.c # Example -- included for reference only: # xx xxmodule.c # Another example -- the 'xxsubtype' module shows C-level subtyping in action xxsubtype xxsubtype.c #Numpy: NUMPY=${HOME}/mika_proj/numpy-1.0.4/ multiarray $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/core/multiarray.a umath $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/core/umath.a _sort $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/core/_sort.a scalarmath $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/core/scalarmath.a _compiled_base $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/lib/_compiled_base.a _capi $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/numarray/_capi.a fftpack_lite $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/fft/fftpack_lite.a lapack_lite $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/linalg/lapack_lite.a mtrand $(NUMPY)/build/lib.linux-x86_64-2.5/numpy/random/mtrand.a gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/build_gcc.sh000066400000000000000000000011021316441372200260370ustar00rootroot00000000000000#!/bin/bash -x export CC=cc export CXX=g++ export MPICC=cc export LINKFORSHARED='-Wl,-export-dynamic -dynamic' export MPI_LINKFORSHARED='-Wl,-export-dynamic -dynamic' install_dir='/some_path/scalable-python-gcc' ./configure --prefix=$install_dir --enable-mpi --disable-ipv6 2>&1 | tee loki-conf module swap craype-interlagos craype-istanbul module list make 2>&1 | tee log-make make install 2>&1 | tee log-inst make clean module swap craype-istanbul craype-interlagos make mpi 2>&1 | tee log-make-mpi cp ${install_dir}/bin/python . make install-mpi 2>&1 | tee log-inst-mpi gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/build_scalable_python.sh000066400000000000000000000011321316441372200304550ustar00rootroot00000000000000#!/bin/bash export CC=cc export CXX=g++ export MPICC=cc # export XTPE_LINK_TYPE=dynamic export LINKFORSHARED='-Wl,-export-dynamic -dynamic' export MPI_LINKFORSHARED='-Wl,-export-dynamic -dynamic' install_prefix=/appl/opt/python/scalable-gnu # Make zlib built-in to the interpreter sed -i -e 's/^#zlib.*/zlib zlibmodule.c -I\/usr\/include -L\/usr\/lib64 -lz/' Modules/Setup.dist ./configure --prefix=$install_prefix --enable-mpi --disable-ipv6 2>&1 | tee log-conf make 2>&1 | tee log-make make install 2>&1 | tee log-inst make mpi 2>&1 | tee log-make-mpi make install-mpi 2>&1 | tee log-inst-mpi gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/customize_hermit.py000066400000000000000000000010641316441372200275430ustar00rootroot00000000000000extra_compile_args = ['-std=c99', '-O3'] #, '-O0'] compiler = 'cc' mpicompiler = 'cc' mpilinker= 'cc' libraries = ['acml'] extra_link_args += ['-dynamic'] include_dirs += ['/usr/lib64/python2.6/site-packages/numpy/core/include'] # include_dirs += ['/path_in_workspace/lib/python/numpy/core/include/'] scalapack = True hdf5 = True define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [("GPAW_ASYNC",1)] define_macros += [("GPAW_MPI2",1)] define_macros += [("GPAW_PERFORMANCE_REPORT",1)] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/customize_jaguar.py000066400000000000000000000017421316441372200275270ustar00rootroot00000000000000scalapack = True compiler = 'cc' mpicompiler = compiler mpilinker = mpicompiler extra_compile_args += [ '-O3', '-funroll-all-loops', '-fPIC', ] libraries= [] dir_base = '/autofs/na1_home/farberow/sw/xt5/' acml_base = '/opt/acml/4.1.0/gfortran64/lib/' numpy_base = dir_base+'numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/' extra_link_args = [ '-L/usr/lib64 -lreadline -lncurses', numpy_base+'core/multiarray.a', numpy_base+'core/_sort.a', numpy_base+'core/scalarmath.a', numpy_base+'core/umath.a', numpy_base+'lib/_compiled_base.a', numpy_base+'numarray/_capi.a', numpy_base+'fft/fftpack_lite.a', numpy_base+'linalg/lapack_lite.a', numpy_base+'random/mtrand.a', '-L'+dir_base+'zlib-1.2.3-1/lib -lz', '-L'+dir_base+'expat-2.0.1-1/lib -lexpat', '-L'+acml_base+' -lacml', ] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [('NO_SOCKET', '1')] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/customize_louhi.py000066400000000000000000000005551316441372200273770ustar00rootroot00000000000000#User provided customizations for the gpaw setup compiler = 'cc' mpicompiler = 'cc' mpilinker= 'cc' extra_compile_args = ['-std=c99'] libraries = [] scalapack = True hdf5 = True define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [("GPAW_ASYNC",1)] define_macros += [("GPAW_MPI2",1)] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/customize_nersc_cori.py000066400000000000000000000010471316441372200304020ustar00rootroot00000000000000compiler = 'cc' mpicompiler = 'cc' mpilinker = 'cc' scalapack=True hdf5=True libxc='/usr/common/software/libxc/2.1.3' include_dirs += [libxc+'/include'] extra_link_args += [libxc+'/lib/libxc.a'] extra_compile_args += ['-O2'] if 'xc' in libraries: libraries.remove('xc') # these are in the cray wrapper if 'blas' in libraries: libraries.remove('blas') if 'lapack' in libraries: libraries.remove('lapack') if scalapack: define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/customize_sisu.py000066400000000000000000000007701316441372200272410ustar00rootroot00000000000000extra_compile_args = ['-std=c99', '-O3'] compiler = 'cc' mpicompiler = 'cc' mpilinker= 'cc' # edit library and include paths for libxc include_dirs += ['/homeappl/home/jenkovaa/libxc/sisu/gcc/include'] library_dirs = ['/homeappl/home/jenkovaa/libxc/sisu/gcc/lib'] libraries = ['z', 'xc'] scalapack = True hdf5 = True define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] define_macros += [("GPAW_ASYNC",1)] define_macros += [("GPAW_MPI2",1)] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/dynload_redstorm.c000066400000000000000000000010331316441372200273100ustar00rootroot00000000000000 /* This module provides the simulation of dynamic loading in Red Storm */ #include "Python.h" #include "importdl.h" const struct filedescr _PyImport_DynLoadFiletab[] = { {".a", "rb", C_EXTENSION}, {0, 0} }; extern struct _inittab _PyImport_Inittab[]; dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { struct _inittab *tab = _PyImport_Inittab; while (tab->name && strcmp(shortname, tab->name)) tab++; return tab->initfunc; } gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/hermit.rst000066400000000000000000000073051316441372200256250ustar00rootroot00000000000000.. _hermit: ============================ hermit.hww.de (Cray XE6) ============================ Here you find information about the the system ``_. .. note:: These instructions are up-to-date as of November 18th 2013. Scalable Python =============== As the Hermit system is intedend for simulations with thousands of CPU cores, a special Python interpreter is used here. The scalable Python reduces the import time by performing all import related I/O operations with a single CPU core and uses MPI for broadcasting the data. As a limitation, all the MPI tasks have to perform the same **import** statements. As HLRS does not allow general internet access on compute system, e.g. version control repositories cannot be accessed directly (it is possible to setup ssh tunnel for some services). Here, we download the scalable Python first to to a local machine and use then scp for copying it to Hermit:: git clone git@gitorious.org:scalable-python/scalable-python.git scalable-python-src scp -r scalable-python-src username@hermit1.hww.de: We will build scalable Python with GNU compilers (other compilers can be used for actual GPAW build), so start by changing the default programming environment on Hermit:: module swap PrgEnv-cray PrgEnv-gnu Due to cross-compile environment in Cray XE6, a normal Python interpreter is build for the front-end nodes and the MPI-enabled one for the compute nodes. The build can be accomplished by the following ``build_gcc`` script .. literalinclude:: build_gcc.sh Python packages can now be built on the front-end node with ``/some_path/scalable-python-gcc/bin/python``. NumPy ===== As the performance of the HOME filesystem is not very good, we install all the other components than the pure Python to a disk within the workspace mechanism of HLRS (with disadvantage that the workspaces expire and have to be manually reallocated). Otherwise, no special tricks are needed for installing NumPy:: /some_path/scalable-python-gcc/bin/python setup.py install --home=/path_in_workspace GPAW ==== On Hermit, Intel compiler together with ACML library seemed to give best performance for GPAW, in addition HDF5 will be used for parallel I/O. Thus, load the followgin modules:: module swap PrgEnv-gnu PrgEnv-intel module load acml module load hdf5-parallel The compilation is relatively straightforward, however, as we build NumPy for compute nodes it does not work in front-end, and one has to specify NumPy include dirs in ``customize.py`` and provide ``--ignore-numpy`` flag when building. The system NumPy headers seem to work fine, but safer option is to use headers of own NumPy installation .. literalinclude:: customize_hermit.py Buid with:: /some_path/scalable-python-gcc/bin/python setup.py install --home=/path_in_workspace --ignore-numpy Creating a module ================= Users can define their own modules for making it easier to setup environment variables. First, create (or edit) a file ``.modulerc`` in the home directory:: #%Module1.0 ## append-path MODULEPATH $HOME/modules Now, custom modules can be put to the ``modules`` directory, e.g. GPAW module in file ``modules/gpaw``:: #%Module1.0 set prog_root "/root_folder_of_gpaw_installation" # Change PrgEnv to intel set confl_prgenvs [list "PrgEnv-cray" "PrgEnv-gnu"] foreach prgenv $confl_prgenvs { if { [ is-loaded $prgenv] } { module swap $prgenv PrgEnv-intel } } setenv GPAW_SETUP_PATH "$prog_root/gpaw-setups-0.8.7929" prepend-path PYTHONPATH "$prog_root/lib/python" prepend-path PATH "$prog_root/bin/" Now, GPAW paths can be set as:: module load gpaw gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/jaguar.rst000066400000000000000000000205311316441372200256020ustar00rootroot00000000000000.. _jaguar: ================== jaguar (Cray XT5) ================== Here you find information about the the system http://www.nccs.gov/computing-resources/jaguar/. The current operating system in Cray XT4/XT5 compute nodes, Compute Linux Environment (CLE) has some limitations, most notably it does not support shared libraries. In order to use python in CLE some modifications to the standard python are needed. Instructions below assume **tcsh**. The installations process of python and numpy can be performed with the script :download:`make_python_numpy`:: ./make_python_numpy |& tee all.log whose details are given below. **Note**: One may want to change the installation paths in the beginning of *make_python_numpy*. Set the correct C compiler and flags, e.g.:: module swap PrgEnv-pgi PrgEnv-gnu setenv CC cc setenv CXX CC setenv OPT '-O3 -funroll-all-loops' The following modules are loaded:: module avail Currently Loaded Modulefiles: 1) modules/3.1.6 2) DefApps 3) torque/2.2.0-snap.200707311754 4) moab/5.2.4 5) xtpe-quadcore 6) MySQL/5.0.45 7) xt-service/2.1.50HD 8) xt-libc/2.1.50HD 9) xt-os/2.1.50HD 10) xt-boot/2.1.50HD 11) xt-lustre-ss/2.1.50HD.PS04.lus.1.6.5.steve.8103_1.6.5 12) xtpe-target-cnl 13) Base-opts/2.1.50HD 14) PrgEnv-gnu/2.1.50HD 15) xt-asyncpe/2.3 16) xt-pe/2.1.50HD 17) xt-mpt/3.1.0 18) xt-libsci/10.3.1 19) fftw/3.1.1 20) gcc/4.2.0.quadcore The recommended place for user's applications is under ``$HOME``:: cd mkdir -p sw/xt5 cd sw/xt5 set sw_home=~/sw/xt5 wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2 wget http://sunet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz wget http://www.zlib.net/zlib-1.2.3.tar.bz2 tar jxf Python-2.5.4.tar.bz2 tar zxf expat-2.0.1.tar.gz tar jxf zlib-1.2.3.tar.bz2 wget http://python-nose.googlecode.com/files/nose-0.11.0.tar.gz tar zxf nose-0.11.0.tar.gz wget http://dfn.dl.sourceforge.net/sourceforge/numpy/numpy-1.2.1.tar.gz tar zxf numpy-1.2.1.tar.gz Before installing a special python, expat_ and zlib_ which are needed by GPAW, but which are not included in the python distribution. The installation is based on instructions from http://yt.enzotools.org/wiki/CrayXT5Installation. .. _expat: http://expat.sourceforge.net/ .. _zlib: http://www.zlib.net/ Install expat:: cd ${sw_home} setenv EXPAT_DIR ${sw_home}/expat-2.0.1-1 cd expat-2.0.1 ./configure --disable-shared --prefix=${EXPAT_DIR} make make install Install zlib:: cd ${sw_home} setenv ZLIB_DIR ${sw_home}/zlib-1.2.3-1 cd zlib-1.2.3 ./configure --prefix=${ZLIB_DIR} make # ignore error: /usr/lib/../lib64/libc.a: could not read symbols: Bad value make install Next, one can proceed with the actual python installation. The following instructions are tested with python 2.5.4: - enter the python source directory:: cd ${sw_home} setenv PYTHON_DIR ${sw_home}/Python-2.5.4-1 cd Python-2.5.4 - create a special dynamic loader for correct resolution of namespaces:: wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/platforms/Cray/dynload_redstorm.c -O Python/dynload_jaguar.c - run :file:`configure`:: ./configure --prefix=${PYTHON_DIR} SO=.a DYNLOADFILE=dynload_jaguar.o MACHDEP=jaguar --host=x86_64-unknown-linux-gnu --disable-sockets --disable-ssl --enable-static --disable-shared | tee config.log - in order to use ``distutils`` append the :file:`Lib/distutils/unixccompiler.py` file, so that static libraries are created instead of shared ones:: wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/platforms/Cray/linkforshared.py cat Lib/distutils/unixccompiler.py linkforshared.py > unixccompiler.py mv unixccompiler.py Lib/distutils - specify which modules will be statically linked in to the python interpreter by editing :file:`Modules/Setup`:: mv Modules/Setup Modules/Setup.orig wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/platforms/Cray/Setup_jaguar -O Modules/Setup touch Modules/Setup **Note**: sha modules are required by numpy, so the following lines should be present in Modules/Setup:: _sha shamodule.c _sha256 sha256module.c _sha512 sha512module.c - modify :file:`Lib/locale.py` as described at ``_ (is it really needed?), - build and install:: make | tee make.log # ignore errors like: # *** WARNING: renaming "_ctypes" since importing it failed: dynamic module does not define init function (init_ctypes) make install | tee make_install.log - build numpy:: cd ${sw_home} cd numpy-1.2.1 ${PYTHON_DIR}/bin/python setup.py install | tee install.log **Note**: numpy 1.3.0 gives:: # ImportError: No module named select - append numpy to pythons's :file:`Modules/Setup`:: cd ${sw_home}/Python-2.5.4 cat ../numpy-1.2.1/install.log | grep Append | cut -d ":" -f 2 | sed -n 's/ *//p' > append cat Modules/Setup append > Setup mv Setup Modules example output:: cat append multiarray /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/core/multiarray.a umath /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/core/umath.a _sort /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/core/_sort.a scalarmath /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/core/scalarmath.a _compiled_base /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/lib/_compiled_base.a _capi /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/numarray/_capi.a fftpack_lite /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/fft/fftpack_lite.a lapack_lite /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/linalg/lapack_lite.a mtrand /autofs/na1_home/farberow/sw/xt5/numpy-1.2.1/build/lib.linux-x86_64-2.5/numpy/random/mtrand.a - rebuild python:: make | tee make2.log make install | tee make_install2.log On jaguar only */tmp/work/$USER* filesystem is available for batch jobs. **Note**: that this space is cleaning periodically http://www.nccs.gov/computing-resources/jaguar/file-systems/. Test python/numpy:: cp -r ${PYTHON_DIR} /tmp/work/$USER cp -r ${sw_home}/nose-0.11.0 /tmp/work/$USER cd /tmp/work/$USER cat < ./numpyTest.py import numpy from numpy.core.multiarray import dot b = numpy.ones(13, numpy.complex) d = dot(b, b) print 'Hello' numpy.test() EOF cat < ./numpyTest.pbs #!/bin/bash #PBS -l walltime=00:10:00,size=8 #PBS -N numpyTest #PBS -A XXXXXX #PBS -j oe export PYTHONHOME=/tmp/work/$USER/Python-2.5.4-1 export PYTHONPATH=/tmp/work/$USER/nose-0.11.0 cd /tmp/work/$USER env | grep PYTHON env | grep LD_LIBRARY_PATH aprun -n1 ${PYTHONHOME}/bin/python -v ./numpyTest.py EOF qsub numpyTest.pbs Install ase/gpaw-setups (**Note**: use the latest releases):: cd ${sw_home} wget --no-check-certificate https://wiki.fysik.dtu.dk/ase-files/python-ase-3.1.0.846.tar.gz tar zxf python-ase-3.1.0.846.tar.gz wget --no-check-certificate http://wiki.fysik.dtu.dk/gpaw-files/gpaw-setups-0.5.3574.tar.gz tar zxf gpaw-setups-0.5.3574.tar.gz cp -r python-ase-3.1.0.846 gpaw-setups-0.5.3574 /tmp/work/$USER cd /tmp/work/$USER ln -s python-ase-3.1.0.846 ase Install gpaw (**Note**: instructions valid from the **5232** release):: cd ${sw_home} wget --no-check-certificate https://wiki.fysik.dtu.dk/gpaw/gpaw-0.7.5232.tar.gz tar zxf gpaw-0.7.5232.tar.gz cd gpaw-0.7.5232 wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/platforms/Cray/customize_jaguar.py -O customize.py ${PYTHON_DIR}/bin/python setup.py build_ext | tee build_ext.log cp -r ${sw_home}/gpaw-0.7.5232 /tmp/work/$USER cd /tmp/work/$USER ln -s gpaw-0.7.5232 gpaw Test gpaw:: cd /tmp/work/$USER cat < ./gpawTest.pbs #!/bin/bash #PBS -l walltime=00:40:00,size=8 #PBS -N gpawTest #PBS -A XXXXXX #PBS -j oe export PYTHONHOME=/tmp/work/$USER/Python-2.5.4-1 export GPAW_SETUP_PATH=/tmp/work/$USER/gpaw-setups-0.5.3574 export PYTHONPATH=/tmp/work/$USER/gpaw:/tmp/work/$USER/ase cd /tmp/work/$USER/gpaw/gpaw/test env | grep PYTHON env | grep LD_LIBRARY_PATH aprun -n4 /tmp/work/$USER/gpaw/build/bin.linux-x86_64-2.5/gpaw-python -v ./test.py EOF qsub gpawTest.pbs gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/linkforshared.py000066400000000000000000000023231316441372200270030ustar00rootroot00000000000000def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None): if output_dir is None: (output_dir, output_filename) = os.path.split(output_filename) output_fullname = os.path.join(output_dir, output_filename) output_fullname = os.path.abspath(output_fullname) linkline = "%s %s" % (output_filename[:-2], output_fullname) for l in library_dirs: linkline += " -L" + l for l in libraries: linkline += " -l" + l old_fmt = self.static_lib_format self.static_lib_format = "%s%.0s" self.create_static_lib(objects, output_filename, output_dir, debug, target_lang) self.static_lib_format = old_fmt print("Append to Setup: ", linkline) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/louhi.rst000066400000000000000000000070171316441372200254550ustar00rootroot00000000000000.. _louhi: ============================ louhi.csc.fi (Cray XT4/XT5) ============================ Here you find information about the the system ``_. .. note:: These instructions are up-to-date as of August 28th 2012. GPAW ==== The recent operating system releases for Cray XT4/5 (CLE 2.2 UP01 and later) supports dynamic libraries which simplifies GPAW installation significantly. These instructions for GPAW installation use Python 2.6.5 compiled with GNU compiler suite, see the end of this page for instructions for compiling Python. First, load the Python module and set ``XTPE_LINK_TYPE`` environment variable for dynamic linking:: module load python module load hdf5-parallel setenv XTPE_LINK_TYPE dynamic GPAW can now be build with a minimal ``customize.py`` .. literalinclude:: customize_louhi.py Currently, there is a small bug in the Cray libraries which results in failure when trying to build the ``_gpaw.so`` library. As the library is not really needed in parallel calculations, the problem can be circumvented by creating the file after running the setup.py script:: python setup.py build_ext ... touch build/lib.linux-x86_64-2.6/_gpaw.so python setup.py install --home=... Python and Numpy ================ Python can be compiled with PGI compiler as follows:: setenv XTPE_LINK_TYPE dynamic ./configure --prefix=path_to_install CC=cc CXX=cc OPT=-fastsse LINKFORSHARED=-Wl,--export-dynamic make install In order to use optimized BLAS with Numpy one has to first build a CBLAS which is linked with Cray's optimized BLAS routines. First, download the CBLAS source from netlib:: wget http://www.netlib.org/blas/blast-forum/cblas.tgz tar -xzf cblas.tgz Change to the CBLAS directory and copy ``Makefile.LINUX`` to ``Makefile.in``. Add correct compiler commands and paths to ``Makefile.in``:: ... PLAT = louhi #----------------------------------------------------------------------------- # Libraries and includs #----------------------------------------------------------------------------- BLLIB = CBDIR = $(HOME)/CBLAS CBLIBDIR = $(CBDIR)/lib/$(PLAT) CBLIB = $(CBLIBDIR)/libcblas.a #----------------------------------------------------------------------------- # Compilers #----------------------------------------------------------------------------- CC = cc FC = ftn LOADER = $(FC) #----------------------------------------------------------------------------- # Flags for Compilers #----------------------------------------------------------------------------- CFLAGS = -O3 -DADD_ -fPIC FFLAGS = -O3 -fPIC ... Finally, build CBLAS:: make alllib You are now ready to build Numpy with the newly created CBLAS library. The standard Numpy tries to use only the ATLAS BLAS, and in order to use different BLAS one has to manually edit the file ``numpy/core/setup.py``. Comment out an if statement as follows:: def get_dotblas_sources(ext, build_dir): if blas_info: # if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): # return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. return ext.depends[:1] Then, add the correct libraries and paths to the file ``site.cfg``:: [blas] blas_libs = cblas library_dirs = /home/csc/jenkovaa/CBLAS/lib/louhi [lapack] lapack_libs = sci library_dirs = /opt/xt-libsci/10.3.8/pgi/lib Now, one should be able to build Numpy as usual:: python setup.py install gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/make_python_numpy000077500000000000000000000045651316441372200273040ustar00rootroot00000000000000#!/bin/csh module swap PrgEnv-pgi PrgEnv-gnu setenv CC cc setenv CXX CC setenv OPT '-O3 -funroll-all-loops' # edit the installation paths if necessary mkdir -p sw/xt5 cd sw/xt5 set sw_home=`pwd` setenv EXPAT_DIR ${sw_home}/expat-2.0.1-1 setenv ZLIB_DIR ${sw_home}/zlib-1.2.3-1 setenv PYTHON_DIR ${sw_home}/Python-2.5.4-1 wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2 wget http://sunet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz wget http://www.zlib.net/zlib-1.2.3.tar.bz2 tar jxf Python-2.5.4.tar.bz2 tar zxf expat-2.0.1.tar.gz tar jxf zlib-1.2.3.tar.bz2 wget http://python-nose.googlecode.com/files/nose-0.11.0.tar.gz tar zxf nose-0.11.0.tar.gz wget http://dfn.dl.sourceforge.net/sourceforge/numpy/numpy-1.2.1.tar.gz tar zxf numpy-1.2.1.tar.gz cd ${sw_home} echo "Making Expat" cd expat-2.0.1 ./configure --disable-shared --prefix=${EXPAT_DIR} make make install cd ${sw_home} echo "Making Zlib" cd zlib-1.2.3 ./configure --prefix=${ZLIB_DIR} make # ignore error: /usr/lib/../lib64/libc.a: could not read symbols: Bad value make install cd ${sw_home} echo "Making Python" cd Python-2.5.4 wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/install/Cray/dynload_redstorm.c -O Python/dynload_jaguar.c ./configure --prefix=${PYTHON_DIR} SO=.a DYNLOADFILE=dynload_jaguar.o MACHDEP=jaguar --host=x86_64-unknown-linux-gnu --disable-sockets --disable-ssl --enable-static --disable-shared | tee config.log wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/install/Cray/linkforshared.py cat Lib/distutils/unixccompiler.py linkforshared.py > unixccompiler.py mv -f unixccompiler.py Lib/distutils mv -f Modules/Setup Modules/Setup.orig wget --no-check-certificate http://svn.fysik.dtu.dk/projects/gpaw/trunk/doc/install/Cray/Setup_jaguar -O Modules/Setup touch Modules/Setup make | tee make.log # ignore errors like: # *** WARNING: renaming "_ctypes" since importing it failed: dynamic module does not define init function (init_ctypes) make install | tee make_install.log cd ${sw_home} echo "Making Numpy" cd numpy-1.2.1 ${PYTHON_DIR}/bin/python setup.py install | tee install.log cd ${sw_home}/Python-2.5.4 echo "Remaking Python" cat ../numpy-1.2.1/install.log | grep Append | cut -d ":" -f 2 | sed -n 's/ *//p' > append cat Modules/Setup append > Setup mv -f Setup Modules make | tee make2.log make install | tee make_install2.log gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/nersc_cori.rst000066400000000000000000000023051316441372200264560ustar00rootroot00000000000000.. _nersc_cori: ===================== cori.nersc.gov (XC40) ===================== .. note:: These instructions are up-to-date as of January 2017. GPAW ==== At NERSC it is recommened to install GPAW on Cori with Anaconda python. For massivly parallel applications it is recommened to use `Shifter `_. GPAW can be built with a minimal ``customize.py`` .. literalinclude:: customize_nersc_cori.py Load the GNU programming environment and set Cray environment for dynamic linking:: export CRAYPE_LINK_TYPE=dynamic module rm PrgEnv-intel module load PrgEnv-gnu module load cray-hdf5-parallel module load python/2.7-anaconda Install ASE with pip while the Anaconda python module is loaded:: pip install ase --user Build and install GPAW:: python setup.py build_ext python setup.py install --user To setup the environment:: export PATH=$HOME/.local/cori/2.7-anaconda/bin:$PATH export OMP_NUM_THREADS=1 export PYTHONHOME=/global/common/cori/software/python/2.7-anaconda Then the test suite can be run from a batch script or interactive session with:: srun -n 8 -c 2 --cpu_bind=cores gpaw-python `which gpaw` test gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/sisu.rst000066400000000000000000000046421316441372200253210ustar00rootroot00000000000000.. _sisu: ============================ sisu.csc.fi (Cray XC30) ============================ .. note:: These instructions are up-to-date as of July 2014. GPAW ==== These instructions for GPAW installation use the Scalable Python interpreter which reduces drastically the import time in massively parallel calculations. See the end of this document for installation instructions for Scalable Python. First, the serial version of code is built with serial HDF5 library, e.g. for analysis purposes in the front-end:: module load scalable-python module load cray-hdf5 GPAW can be build with a minimal ``customize.py`` (edit the correct paths for libxc) .. literalinclude:: customize_sisu.py Then build the code (no installation at this point yet) with the setup.py script:: python setup.py build_ext The build of parallel gpaw-python interpreter fails at this point with an error like:: build/temp.linux-x86_64-2.6/c/hdf5.o: In function 'h5p_set_fapl_mpio': hdf5.c:(.text+0x1bad): undefined reference to 'H5Pset_fapl_mpio' Next, switch to the parallel version of HDF5 library and do build and install:: module switch cray-hdf5 cray-hdf5-parallel python setup.py install --home=path_to_install_prefix LibXC ===== Download libxc:: wget http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.2.0.tar.gz Configure and make (use GNU environment):: ./configure --prefix=install_prefix CC=cc CFLAGS=-fPIC make make install Scalable Python =============== Standard Python interpreter has serious bottleneck in large scale parallel calculations when many MPI tasks perform the same I/O operations during the import statetements. Scalable Python ``_ reduces the import time by having only single MPI task to perform import related I/O operations and using then MPI for broadcasting the data. First, download the source code and switch to GNU environment:: git clone git@gitorious.org:scalable-python/scalable-python.git module switch PrgEnv-cray PrgEnv-gnu Use the following build script (change the installation prefix to a proper one): .. literalinclude:: build_scalable_python.sh Add then ``install_prefix/bin`` to your PATH, and download and install NumPy:: export PATH=install_prefix/bin:$PATH wget http://sourceforge.net/projects/numpy/files/NumPy/1.8.1/numpy-1.8.1.tar.gz tar xzf numpy-1.8.1.tar.gz cd numpy-1.8.1 python setup.py install gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Cray/unixccompiler.py000066400000000000000000000345431316441372200270420ustar00rootroot00000000000000"""distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library search directories specified with -Ldir * compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o * link static library handled by 'ar' command (possibly with 'ranlib') * link shared library handled by 'cc -shared' """ from __future__ import print_function __revision__ = "$Id: unixccompiler.py 54954 2007-04-25 06:42:41Z neal.norwitz $" import os, sys from types import StringType, NoneType from copy import copy from distutils import sysconfig from distutils.dep_util import newer from distutils.ccompiler import \ CCompiler, gen_preprocess_options, gen_lib_options from distutils.errors import \ DistutilsExecError, CompileError, LibError, LinkError from distutils import log # XXX Things not currently handled: # * optimization/debug/warning flags; we just use whatever's in Python's # Makefile and live with it. Is this adequate? If not, we might # have to have a bunch of subclasses GNUCCompiler, SGICCompiler, # SunCCompiler, and I suspect down that road lies madness. # * even if we don't know a warning flag from an optimization flag, # we need some way for outsiders to feed preprocessor/compiler/linker # flags in to us -- eg. a sysadmin might want to mandate certain flags # via a site config file, or a user might want to set something for # compiling this module distribution only via the setup.py command # line, whatever. As long as these options come from something on the # current system, they can be as system-dependent as they like, and we # should just happily stuff them into the preprocessor/compiler/linker # options and carry on. def _darwin_compiler_fixup(compiler_so, cc_args): """ This function will strip '-isysroot PATH' and '-arch ARCH' from the compile flags if the user has specified one them in extra_compile_flags. This is needed because '-arch ARCH' adds another architecture to the build, without a way to remove an architecture. Furthermore GCC will barf if multiple '-isysroot' arguments are present. """ stripArch = stripSysroot = 0 compiler_so = list(compiler_so) kernel_version = os.uname()[2] # 8.4.3 major_version = int(kernel_version.split('.')[0]) if major_version < 8: # OSX before 10.4.0, these don't support -arch and -isysroot at # all. stripArch = stripSysroot = True else: stripArch = '-arch' in cc_args stripSysroot = '-isysroot' in cc_args if stripArch: while True: try: index = compiler_so.index('-arch') # Strip this argument and the next one: del compiler_so[index:index+2] except ValueError: break if stripSysroot: try: index = compiler_so.index('-isysroot') # Strip this argument and the next one: del compiler_so[index:index+2] except ValueError: pass # Check if the SDK that is used during compilation actually exists, # the universal build requires the usage of a universal SDK and not all # users have that installed by default. sysroot = None if '-isysroot' in cc_args: idx = cc_args.index('-isysroot') sysroot = cc_args[idx+1] elif '-isysroot' in compiler_so: idx = compiler_so.index('-isysroot') sysroot = compiler_so[idx+1] if sysroot and not os.path.isdir(sysroot): log.warn("Compiling with an SDK that doesn't seem to exist: %s", sysroot) log.warn("Please check your Xcode installation") return compiler_so class UnixCCompiler(CCompiler): compiler_type = 'unix' # These are used by CCompiler in two places: the constructor sets # instance attributes 'preprocessor', 'compiler', etc. from them, and # 'set_executable()' allows any of these to be set. The defaults here # are pretty generic; they will probably have to be set by an outsider # (eg. using information discovered by the sysconfig about building # Python extensions). executables = {'preprocessor' : None, 'compiler' : ["cc"], 'compiler_so' : ["cc"], 'compiler_cxx' : ["cc"], 'linker_so' : ["cc", "-shared"], 'linker_exe' : ["cc"], 'archiver' : ["ar", "-cr"], 'ranlib' : None, } if sys.platform[:6] == "darwin": executables['ranlib'] = ["ranlib"] # Needed for the filename generation methods provided by the base # class, CCompiler. NB. whoever instantiates/uses a particular # UnixCCompiler instance should set 'shared_lib_ext' -- we set a # reasonable common default here, but it's not necessarily used on all # Unices! src_extensions = [".c",".C",".cc",".cxx",".cpp",".m"] obj_extension = ".o" static_lib_extension = ".a" shared_lib_extension = ".so" dylib_lib_extension = ".dylib" static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" if sys.platform == "cygwin": exe_extension = ".exe" def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): ignore, macros, include_dirs = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: raise CompileError(msg) def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): compiler_so = self.compiler_so if sys.platform == 'darwin': compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) try: self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) except DistutilsExecError as msg: raise CompileError(msg) def create_static_lib(self, objects, output_libname, output_dir=None, debug=0, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) output_filename = \ self.library_filename(output_libname, output_dir=output_dir) if self._need_link(objects, output_filename): self.mkpath(os.path.dirname(output_filename)) self.spawn(self.archiver + [output_filename] + objects + self.objects) # Not many Unices required ranlib anymore -- SunOS 4.x is, I # think the only major Unix that does. Maybe we need some # platform intelligence here to skip ranlib if it's not # needed -- or maybe Python's configure script took care of # it for us, hence the check for leading colon. if self.ranlib: try: self.spawn(self.ranlib + [output_filename]) except DistutilsExecError as msg: raise LibError(msg) else: log.debug("skipping %s (up-to-date)", output_filename) def link(self, target_desc, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) libraries, library_dirs, runtime_library_dirs = \ self._fix_lib_args(libraries, library_dirs, runtime_library_dirs) lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs, libraries) if type(output_dir) not in (StringType, NoneType): raise TypeError("'output_dir' must be a string or None") if output_dir is not None: output_filename = os.path.join(output_dir, output_filename) if self._need_link(objects, output_filename): ld_args = (objects + self.objects + lib_opts + ['-o', output_filename]) if debug: ld_args[:0] = ['-g'] if extra_preargs: ld_args[:0] = extra_preargs if extra_postargs: ld_args.extend(extra_postargs) self.mkpath(os.path.dirname(output_filename)) try: if target_desc == CCompiler.EXECUTABLE: linker = self.linker_exe[:] else: linker = self.linker_so[:] if target_lang == "c++" and self.compiler_cxx: # skip over environment variable settings if /usr/bin/env # is used to set up the linker's environment. # This is needed on OSX. Note: this assumes that the # normal and C++ compiler have the same environment # settings. i = 0 if os.path.basename(linker[0]) == "env": i = 1 while '=' in linker[i]: i = i + 1 linker[i] = self.compiler_cxx[i] if sys.platform == 'darwin': linker = _darwin_compiler_fixup(linker, ld_args) self.spawn(linker + ld_args) except DistutilsExecError as msg: raise LinkError(msg) else: log.debug("skipping %s (up-to-date)", output_filename) # -- Miscellaneous methods ----------------------------------------- # These are all used by the 'gen_lib_options() function, in # ccompiler.py. def library_dir_option(self, dir): return "-L" + dir def runtime_library_dir_option(self, dir): # XXX Hackish, at the very least. See Python bug #445902: # http://sourceforge.net/tracker/index.php # ?func=detail&aid=445902&group_id=5470&atid=105470 # Linkers on different platforms need different options to # specify that directories need to be added to the list of # directories searched for dependencies when a dynamic library # is sought. GCC has to be told to pass the -R option through # to the linker, whereas other compilers just know this. # Other compilers may need something slightly different. At # this time, there's no way to determine this information from # the configuration data stored in the Python installation, so # we use this hack. compiler = os.path.basename(sysconfig.get_config_var("CC")) if sys.platform[:6] == "darwin": # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir elif sys.platform[:5] == "hp-ux": return "+s -L" + dir elif sys.platform[:7] == "irix646" or sys.platform[:6] == "osf1V5": return ["-rpath", dir] elif compiler[:3] == "gcc" or compiler[:3] == "g++": return "-Wl,-R" + dir else: return "-R" + dir def library_option(self, lib): return "-l" + lib def find_library_file(self, dirs, lib, debug=0): shared_f = self.library_filename(lib, lib_type='shared') dylib_f = self.library_filename(lib, lib_type='dylib') static_f = self.library_filename(lib, lib_type='static') for dir in dirs: shared = os.path.join(dir, shared_f) dylib = os.path.join(dir, dylib_f) static = os.path.join(dir, static_f) # We're second-guessing the linker here, with not much hard # data to go on: GCC seems to prefer the shared library, so I'm # assuming that *all* Unix C compilers do. And of course I'm # ignoring even GCC's "-static" option. So sue me. if os.path.exists(dylib): return dylib elif os.path.exists(shared): return shared elif os.path.exists(static): return static # Oops, didn't find it in *any* of 'dirs' return None def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None): if output_dir is None: (output_dir, output_filename) = os.path.split(output_filename) output_fullname = os.path.join(output_dir, output_filename) output_fullname = os.path.abspath(output_fullname) linkline = "%s %s" % (output_filename[:-2], output_fullname) for l in library_dirs: linkline += " -L" + l for l in libraries: linkline += " -l" + l old_fmt = self.static_lib_format self.static_lib_format = "%s%.0s" self.create_static_lib(objects, output_filename, output_dir, debug, target_lang) self.static_lib_format = old_fmt print("Append to Setup: ", linkline) gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/HP/000077500000000000000000000000001316441372200232075ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/HP/xc.rst000066400000000000000000000006741316441372200243620ustar00rootroot00000000000000======================= xc2.rz.uni-karlsruhe.de ======================= Here you find information about the the system ``_. The installation works using ``gcc``:: module load gcc/4.1.2/default and numpy-1.0.4 (site.cfg was not used). The installation of gpaw requires to modify customize.py to:: libraries = ['acml', 'gfortran'] library_dirs = ['/software/all/acml/acml4.0/gfortran64/lib'] gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/000077500000000000000000000000001316441372200237775ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/CentOS.rst000066400000000000000000000044231316441372200256670ustar00rootroot00000000000000.. _CentOS: ====== CentOS ====== Here you find information about the the system http://www.centos.org/. .. _PGO_gcc_EL5: Profile guided optimization =========================== Example how describes how to use `profile guided optimization `_ to compile GPAW with gcc version **4.3.0** on CentOS 5.3: - starting at :ref:`developer installation`, modify :file:`customize.py` so ``extra_compile_args`` reads:: opt_string = '-fprofile-generate' extra_compile_args =['-std=c99', opt_string] - moreover, ``mpicompiler`` must be set, and ``mpilinker`` read:: mpilinker = mpicompiler+' '+opt_string - build GPAW's :ref:`c_extension` as described at :ref:`developer installation`. This will create ``*.gcno`` files in the :file:`./build/temp.-/c/` directory. - perform a test run using :file:`gpaw-python`. This will create ``*.gcda`` files in the :file:`./build/temp.-python-version/c/` directory. - remove object files and :file:`_gpaw.so` (example for **linux-i686** platform, python **2.4**):: find build/temp.linux-i686-2.4/ -name "*.o" | xargs rm rm -f build/lib.linux-i686-2.4/_gpaw.so - change :file:`customize.py` so ``opt_string`` reads:: opt_string = '-fprofile-use' and rebuild GPAW's :ref:`c_extension`. System wide installation with yum ================================= **Warning**: this section is outdated! The steps described below require root access and assume bash shell: - `configure fys yum repository `_ - on EL/CentOS 6 i386 or x86_64, as root: - install gpaw and dependencies:: yum -y install --enablerepo=fys_el campos-gpaw - install optional packages:: yum -y install --enablerepo=fys_el scipy ScientificPython - on EL/CentOS 5 i386 or x86_64, as root: - install gpaw and dependencies:: yum -y install --enablerepo=fys_el,epel,atrpms campos-gpaw - install optional packages:: yum -y install --enablerepo=fys_el,epel,atrpms scipy ScientificPython .. note:: There are no new releases of fys packages after "End of Regular Life Cycle" of CentOS releases: see https://access.redhat.com/support/policy/updates/errata/ gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Fedora.rst000066400000000000000000000014201316441372200257260ustar00rootroot00000000000000.. _Fedora: ====== Fedora ====== Here you find information about the the system ``_. System wide installation with yum ================================= **Warning**: this section is outdated! The steps described below require root access and assume bash shell: - `configure fys yum repository `_ - on Fedora 12 or newer i386 or x86_64, as root: - install gpaw and dependencies:: yum -y install --enablerepo=fys_fc campos-gpaw - install optional packages:: yum -y install scipy ScientificPython .. note:: There are no new releases of fys packages for "Old Unsupported Releases" of Fedora: see http://fedoraproject.org/wiki/Releases gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Niflheim/000077500000000000000000000000001316441372200255325ustar00rootroot00000000000000gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Niflheim/Niflheim.rst000066400000000000000000000023621316441372200300220ustar00rootroot00000000000000.. _Niflheim: ======== Niflheim ======== Information about the Niflheim cluster can be found at ``_. .. highlight:: bash Installing GPAW on all three architectures ========================================== Here, we install the development versions of ASE and GPAW in ``~/ase`` and ``~/gpaw``. First, make sure you have this in your ``~/.bashrc``: .. literalinclude:: gpaw.sh Now, get the source code for ASE and GPAW:: $ cd $ rm -rf gpaw ase $ git clone https://gitlab.com/ase/ase.git $ git clone https://gitlab.com/gpaw/gpaw.git and compile GPAW's C-extension using the :download:`compile.sh` script:: $ cd gpaw $ sh doc/platforms/Linux/Niflheim/compile.sh Submit jobs to the queue with:: $ gpaw sbatch -- -p xeon8 -N 2 -n 16 my-script.py Type ``gpaw sbatch -h`` for help. Using more than one version of GPAW =================================== Here we install an additional version of GPAW for, say, production runs:: $ cd $ mkdir production $ cd production $ git clone https://gitlab.com/gpaw/gpaw.git $ cd gpaw $ git checkout 1.0.1 $ sh doc/platforms/Linux/Niflheim/compile.sh Now you can submit jobs that use this production version with:: ??? gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Niflheim/compile.sh000077500000000000000000000004721316441372200275240ustar00rootroot00000000000000#!/bin/sh nh=doc/platforms/Linux/Niflheim rm -rf build cmd="cd $PWD && python setup.py --remove-default-flags build_ext" ssh sylg "$cmd --customize=$nh/el7.py > broadwell-el7.log 2>&1" ssh thul "$cmd --customize=$nh/el7.py > sandybridge-el7.log 2>&1" ssh fjorm "$cmd --customize=$nh/el7.py > nehalem-el7.log 2>&1" gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Niflheim/dl160g6.py000066400000000000000000000037511316441372200271750ustar00rootroot00000000000000nodetype = 'dl160g6' scalapack = True compiler = 'gcc' libraries =[ 'gfortran', 'scalapack', 'mpiblacs', 'mpiblacsCinit', 'acml', 'acml_mv', 'hdf5', 'xc', 'mpi', 'mpi_f77'] library_dirs = [ '/home/opt/el6/' + nodetype + '/openmpi-1.6.3-' + nodetype + '-tm-gfortran-1/lib', '/home/opt/el6/' + nodetype + '/blacs-1.1-' + nodetype + '-tm-gfortran-openmpi-1.6.3-1/lib', '/home/opt/el6/' + nodetype + '/scalapack-2.0.2-' + nodetype + '-tm-gfortran-openmpi-1.6.3-acml-4.4.0-1/lib', '/home/opt/common/acml-gfortran-64bit-4.4.0/lib', '/home/opt/el6/' + nodetype + '/hdf5-1.8.10-' + nodetype + '-tm-gfortran-openmpi-1.6.3-1/lib', '/home/opt/el6/' + nodetype + '/libxc-12045-' + nodetype + '-gfortran-1/lib'] include_dirs += [ '/home/opt/el6/' + nodetype + '/openmpi-1.6.3-' + nodetype + '-tm-gfortran-1/include', '/home/opt/el6/' + nodetype + '/hdf5-1.8.10-' + nodetype + '-tm-gfortran-openmpi-1.6.3-1/include', '/home/opt/el6/' + nodetype + '/libxc-12045-' + nodetype + '-gfortran-1/include'] extra_link_args = [ '-Wl,-rpath=/home/opt/el6/' + nodetype + '/openmpi-1.6.3-' + nodetype + '-tm-gfortran-1/lib' ',-rpath=/home/opt/el6/' + nodetype + '/blacs-1.1-' + nodetype + '-tm-gfortran-openmpi-1.6.3-1/lib' ',-rpath=/home/opt/el6/' + nodetype + '/scalapack-2.0.2-' + nodetype + '-tm-gfortran-openmpi-1.6.3-acml-4.4.0-1/lib' ',-rpath=/home/opt/common/acml-gfortran-64bit-4.4.0/lib' ',-rpath=/home/opt/el6/' + nodetype + '/hdf5-1.8.10-' + nodetype + '-tm-gfortran-openmpi-1.6.3-1/lib' ',-rpath=/home/opt/el6/' + nodetype + '/libxc-12045-' + nodetype + '-gfortran-1/lib'] extra_compile_args = ['-O3', '-std=c99', '-fPIC', '-Wall', '-Wno-unknown-pragmas'] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1')] define_macros += [('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] mpicompiler = '/home/opt/el6/' + nodetype + '/openmpi-1.6.3-' + nodetype + '-tm-gfortran-1/bin/mpicc' mpilinker = mpicompiler platform_id = nodetype + '-el6' hdf5 = True gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Niflheim/el7.py000066400000000000000000000006321316441372200265740ustar00rootroot00000000000000import os scalapack = True libraries = ['readline', 'gfortran', 'scalapack', 'openblas', 'xc'] extra_compile_args = ['-O2', '-std=c99', '-fPIC', '-Wall', '-Wno-unknown-pragmas'] define_macros += [('GPAW_NO_UNDERSCORE_CBLACS', '1'), ('GPAW_NO_UNDERSCORE_CSCALAPACK', '1')] platform_id = os.environ['CPU_ARCH'] + '-el7' gpaw-1.3.0-82cebebc037510d876f90d9f8d533fd021f751f5/doc/platforms/Linux/Niflheim/gpaw-qsub.py000077500000000000000000000130361316441372200300200ustar00rootroot00000000000000#!/usr/bin/env python # Emacs: treat this as -*- python -*- import os import sys from optparse import OptionParser, IndentedHelpFormatter import subprocess class Formatter(IndentedHelpFormatter): """Nicer epilog.""" def format_epilog(self, epilog): return '\n' + '\n'.join(self._format_text(section) for section in epilog) + '\n' def main(): description = """Submits a GPAW Python script to the TORQUE queue.""" parser = OptionParser( usage='usage: %prog [OPTIONS]