forked from comp-chem/cp2k-c
Compare commits
No commits in common. "old_version_a1ba2989f" and "main" have entirely different histories.
old_versio
...
main
11 changed files with 0 additions and 3729 deletions
312
.gitignore
vendored
312
.gitignore
vendored
|
|
@ -1,312 +0,0 @@
|
|||
# base directory structure
|
||||
/exe/
|
||||
/lib/
|
||||
/obj/
|
||||
/bin/
|
||||
/doxygen/
|
||||
/regtesting/
|
||||
/install/
|
||||
|
||||
# ignore local arch files not meant to be shared
|
||||
/arch/local*
|
||||
|
||||
# ensure people are not accidentally committing an old .svnignore when copying their stuff
|
||||
.svnignore
|
||||
|
||||
# allow folks to create a .clang-format to hide their personal style settings
|
||||
.clang-format
|
||||
|
||||
# Created by https://www.gitignore.io/api/python,fortran,c,c++,cuda,emacs,vim
|
||||
|
||||
### C ###
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
### C++ ###
|
||||
# Prerequisites
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
|
||||
# Precompiled Headers
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
|
||||
# Executables
|
||||
|
||||
### CUDA ###
|
||||
*.i
|
||||
*.ii
|
||||
*.gpu
|
||||
*.ptx
|
||||
*.cubin
|
||||
*.fatbin
|
||||
|
||||
### Emacs ###
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
### VS Code ###
|
||||
.vscode
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
|
||||
# projectiles files
|
||||
.projectile
|
||||
|
||||
# directory configuration
|
||||
.dir-locals.el
|
||||
|
||||
### Fortran ###
|
||||
# Prerequisites
|
||||
|
||||
# Compiled Object files
|
||||
|
||||
# Precompiled Headers
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
|
||||
# Fortran module files
|
||||
|
||||
# Compiled Static libraries
|
||||
|
||||
# Executables
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
### Python Patch ###
|
||||
.venv/
|
||||
|
||||
### Python.VirtualEnv Stack ###
|
||||
# Virtualenv
|
||||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
||||
[Bb]in
|
||||
[Ii]nclude
|
||||
[Ll]ib
|
||||
[Ll]ib64
|
||||
[Ll]ocal
|
||||
[Ss]cripts
|
||||
pyvenv.cfg
|
||||
pip-selfcheck.json
|
||||
|
||||
### Vim ###
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
# Auto-generated tag files
|
||||
tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
|
||||
# End of https://www.gitignore.io/api/python,fortran,c,c++,cuda,emacs,vim
|
||||
339
LICENSE
339
LICENSE
|
|
@ -1,339 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
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
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
cp2k-c
|
||||
Copyright (C) 2022 Adam Parler
|
||||
|
||||
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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision 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, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This 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.
|
||||
150
Makefile
150
Makefile
|
|
@ -1,150 +0,0 @@
|
|||
.SUFFIXES: .dep .o .cu .c
|
||||
SHELL = /bin/sh
|
||||
|
||||
CP2KHOME := $(PWD)/..
|
||||
ARCH := $(shell $(CP2KHOME)/tools/get_arch_code)
|
||||
LIB1 = cp2k_base_lib
|
||||
LIB2 = cp2k_fft_lib
|
||||
LIBCP2K = cp2k_lib
|
||||
export VERSION=sopt
|
||||
export WHAT =_progr
|
||||
|
||||
### Dependent variables ###
|
||||
|
||||
ARCHDIR = $(CP2KHOME)/arch
|
||||
DOCDIR = $(CP2KHOME)/doc
|
||||
MAINEXEDIR = $(CP2KHOME)/exe
|
||||
MAINLIBDIR = $(CP2KHOME)/lib
|
||||
MAINOBJDIR = $(CP2KHOME)/obj
|
||||
PRETTYOBJDIR = $(CP2KHOME)/obj/prettified
|
||||
TOOLDIR = $(OBJDIR)/tools
|
||||
TOOLSRC = $(CP2KHOME)/tools
|
||||
SRCDIR = $(CP2KHOME)/src
|
||||
SRCDIRS = $(SRCDIR):$(SRCDIR)/lib:$(TOOLSRC)/metadyn:$(CP2KHOME)/cuda_tools
|
||||
MAKEFILE = $(CP2KHOME)/makefiles/Makefile
|
||||
MACHINEDEFS = $(ARCHDIR)/$(ARCH).$(VERSION)
|
||||
PROG = $(EXEDIR)/cp2k.$(VERSION)
|
||||
CP2KSHELL = $(EXEDIR)/cp2k_shell.$(VERSION)
|
||||
FES = $(EXEDIR)/fes.$(VERSION)
|
||||
EXEDIR = $(MAINEXEDIR)/$(ARCH)
|
||||
LIBDIR = $(MAINLIBDIR)/$(ARCH)
|
||||
OBJDIR = $(MAINOBJDIR)/$(ARCH)
|
||||
OBJECTDEFS = $(SRCDIR)/OBJECTDEFS
|
||||
LIBOBJECTDEFS= $(SRCDIR)/lib/OBJECTDEFS
|
||||
LIBNVOBJECTDEFS= $(CP2KHOME)/cuda_tools/NVOBJECTDEFS
|
||||
LIB1_ARCHIVE = $(LIBDIR)/$(VERSION)/lib$(LIB1).a
|
||||
LIB2_ARCHIVE = $(LIBDIR)/$(VERSION)/lib$(LIB2).a
|
||||
LIB_CP2K_ARCHIVE = $(LIBDIR)/$(VERSION)/lib$(LIBCP2K).a
|
||||
SRCENTRY = $(wildcard $(SRCDIR)/CVS/Entr*)
|
||||
FESOBJECTDEFS = $(TOOLSRC)/metadyn/OBJECTDEFS
|
||||
DOXYGENDIR = $(DOCDIR)/doxygen
|
||||
|
||||
### Definition of the multiple targets ###
|
||||
#
|
||||
VERSION_TARGETS = sopt sdbg popt pdbg ssmp psmp
|
||||
#
|
||||
# uses an ugly trick, these are disguised as file names, the directory (@D) part
|
||||
# is used as a version, the file (@F) part is used as the target.
|
||||
#
|
||||
LIB_TARGETS = $(addsuffix /lib ,$(VERSION_TARGETS))
|
||||
ALL_TARGETS = $(addsuffix /all ,$(VERSION_TARGETS))
|
||||
CLEAN_TARGETS = $(addsuffix /clean ,$(VERSION_TARGETS)) $(addsuffix /realclean
|
||||
,$(VERSION_TARGETS))
|
||||
|
||||
.PHONY : _all libs _progr _lib build clean realclean distclean $(CLEAN_TARGETS)\
|
||||
$(ALL_TARGETS) $(LIB_TARGETS) $(VERSION_TARGETS) fes dirs deptool
|
||||
|
||||
### Master rules ###
|
||||
build: dirs deptool
|
||||
$(MAKE) -C $(SRCDIR) -f $(MAKEFILE) all.dep
|
||||
$(MAKE) -C $(SRCDIR)/lib -f $(MAKEFILE) lib.dep
|
||||
$(MAKE) -C $(OBJDIR)/$(VERSION) -f $(MAKEFILE) $(WHAT)
|
||||
|
||||
fes: dirs deptool
|
||||
$(MAKE) -C $(TOOLSRC)/metadyn/ -f $(MAKEFILE) fes.dep
|
||||
$(MAKE) -C $(OBJDIR)/$(VERSION) -f $(MAKEFILE) VERSION=$(VERSION) $(FES)
|
||||
|
||||
dirs:
|
||||
@mkdir -p $(EXEDIR)
|
||||
@mkdir -p $(LIBDIR)/$(VERSION)
|
||||
@mkdir -p $(TOOLDIR)
|
||||
@mkdir -p $(OBJDIR)/$(VERSION)
|
||||
@mkdir -p $(PRETTYOBJDIR)
|
||||
|
||||
realpretty: prettyclean pretty
|
||||
|
||||
pretty: dirs
|
||||
$(MAKE) -C $(SRCDIR) -f $(MAKEFILE) _pretty
|
||||
|
||||
deptool: dirs
|
||||
$(MAKE) -C $(TOOLDIR) -f $(MAKEFILE) makedepf90
|
||||
|
||||
libs:
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$(VERSION) WHAT=_lib build
|
||||
all:
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$(VERSION) WHAT=_all build
|
||||
progr:
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$(VERSION) WHAT=_progr build
|
||||
cpshell:
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$(VERSION) WHAT=_cpshell build
|
||||
|
||||
#
|
||||
# on a parallel build only one task should go a build the deptool
|
||||
#
|
||||
$(VERSION_TARGETS): dirs deptool
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$@ build
|
||||
|
||||
$(CLEAN_TARGETS):
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$(@D) $(@F)
|
||||
|
||||
$(ALL_TARGETS) $(LIB_TARGETS):
|
||||
$(MAKE) -f $(MAKEFILE) VERSION=$(@D) WHAT=_$(@F) build
|
||||
#
|
||||
# here we try to include all the objects that might need considering
|
||||
#
|
||||
|
||||
include $(OBJECTDEFS)
|
||||
include $(LIBOBJECTDEFS)
|
||||
include $(FESOBJECTDEFS)
|
||||
include $(MACHINEDEFS)
|
||||
include $(LIBNVOBJECTDEFS)
|
||||
|
||||
OBJECTS = $(OBJECTS_GENERIC) $(OBJECTS_ARCHITECTURE)
|
||||
FESOBJS = $(FESOBJ) $(OBJECTS_ARCHITECTURE)
|
||||
|
||||
# Cuda specific instructions
|
||||
ifneq ($(NVCC),)
|
||||
LIBNV_ARCHIVE= $(LIBDIR)/$(VERSION)/libcp2k_cuda.a
|
||||
endif
|
||||
|
||||
# Define the whole bunch of libraries needed
|
||||
ALL_LIB = $(LIB_CP2K_ARCHIVE) $(LIB2_ARCHIVE) $(LIB1_ARCHIVE) $(LIBNV_ARCHIVE)
|
||||
|
||||
#
|
||||
# some practical variables for the build.
|
||||
# note that the last cvs entry is not necessarily the most recent
|
||||
#
|
||||
ifeq ($(CPPSHELL),)
|
||||
CPPSHELL := -D__COMPILE_ARCH="\"$(ARCH)\""\
|
||||
-D__COMPILE_DATE="\"$(shell date)\""\
|
||||
-D__COMPILE_HOST="\"$(shell hostname)\""\
|
||||
-D__COMPILE_LASTCVS="\"$(shell tail -n1 $(SRCDIR)/CVS/Entries)\""
|
||||
endif
|
||||
|
||||
ifneq ($(CPP),)
|
||||
#
|
||||
# always add the SRCDIR to the include path (-I here might not be portable)
|
||||
#
|
||||
CPPFLAGS += $(CPPSHELL) -I$(SRCDIR)
|
||||
else
|
||||
FCFLAGS += $(CPPSHELL)
|
||||
endif
|
||||
|
||||
|
||||
### Slave rules ###
|
||||
vpath %.h $(SRCDIRS)
|
||||
vpath %.c $(SRCDIRS)
|
||||
vpath %.cpp $(SRCDIRS)
|
||||
vpath %.dep $(OBJDIR)/$(VERSION)
|
||||
vpath %.pretty $(PRETTYOBJDIR)
|
||||
vpath %.cu $(SRCDIRS)
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
# cp2k_to_c
|
||||
|
||||
Converting CP2K from fortran to C/C++
|
||||
|
|
@ -1,533 +0,0 @@
|
|||
/*--------------------------------------------------------------------------------------------------
|
||||
CP2K: A general program to perform molecular dynamics simulations
|
||||
Copyright 2000-2023 CP2K developers group <https://cp2k.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Contains ADMM methods which only require the density matrix
|
||||
\par History
|
||||
11.2014 created [Ole Schuett]
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
|
||||
#include "./base/base_uses.h"
|
||||
|
||||
class admm_dm_methods {
|
||||
|
||||
public:
|
||||
void admm_dm_calc_rho_aux(struct qs_environment_type);
|
||||
void admm_dm_merge_ks_matrix(struct qs_environment_type);
|
||||
|
||||
private:
|
||||
char *moduleN = "admm_dm_methods";
|
||||
|
||||
};
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Entry methods: Calculates auxiliary density matrix from primary one.
|
||||
\param qs_env ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::admm_dm_calc_rho_aux(struct qs_environment_type *qs_env)
|
||||
{
|
||||
|
||||
char *routineN = "admm_dm_calc_rho_aux";
|
||||
|
||||
int handle;
|
||||
struct admm_dm_type *admm_dm;
|
||||
|
||||
NULLIFY (admm_dm);
|
||||
timeset(routineN, handle);
|
||||
get_admm_env(qs_env.admm_env, admm_dm=admm_dm);
|
||||
|
||||
SELECT CASE (admm_dm.method)
|
||||
CASE (do_admm_basis_projection)
|
||||
CALL map_dm_projection(qs_env)
|
||||
|
||||
CASE (do_admm_blocked_projection)
|
||||
CALL map_dm_blocked(qs_env)
|
||||
|
||||
CASE DEFAULT
|
||||
CPABORT("admm_dm_calc_rho_aux: unknown method")
|
||||
END SELECT
|
||||
|
||||
if (admm_dm.purify) purify_mcweeny(qs_env);
|
||||
|
||||
update_rho_aux(qs_env);
|
||||
|
||||
timestop(handle);
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Entry methods: Merges auxiliary Kohn-Sham matrix into primary one.
|
||||
\param qs_env ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::admm_dm_merge_ks_matrix(struct qs_environment_type *qs_env)
|
||||
{
|
||||
char *routineN = "admm_dm_merge_ks_matrix";
|
||||
|
||||
int handle;
|
||||
struct admm_dm_type *admm_dm;
|
||||
struct dbcsr_p_type *matrix_ks_merge;
|
||||
|
||||
timeset(routineN, handle);
|
||||
NULLIFY (admm_dm, matrix_ks_merge);
|
||||
|
||||
get_admm_env(qs_env.dmm_env, admm_dm=admm_dm);
|
||||
|
||||
IF (admm_dm.purify) THEN
|
||||
CALL revert_purify_mcweeny(qs_env, matrix_ks_merge)
|
||||
ELSE
|
||||
CALL get_admm_env(qs_env.admm_env, matrix_ks_aux_fit=matrix_ks_merge)
|
||||
END IF
|
||||
|
||||
SELECT CASE (admm_dm.method)
|
||||
CASE (do_admm_basis_projection)
|
||||
CALL merge_dm_projection(qs_env, matrix_ks_merge)
|
||||
|
||||
CASE (do_admm_blocked_projection)
|
||||
CALL merge_dm_blocked(qs_env, matrix_ks_merge)
|
||||
|
||||
CASE DEFAULT
|
||||
CPABORT("admm_dm_merge_ks_matrix: unknown method")
|
||||
END SELECT
|
||||
|
||||
IF (admm_dm.purify) &
|
||||
CALL dbcsr_deallocate_matrix_set(matrix_ks_merge)
|
||||
|
||||
CALL timestop(handle)
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Calculates auxiliary density matrix via basis projection.
|
||||
\param qs_env ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::map_dm_projection(qs_env)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
INTEGER :: ispin
|
||||
LOGICAL :: s_mstruct_changed
|
||||
REAL(KIND=dp) :: threshold
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s_aux, matrix_s_mixed, rho_ao, &
|
||||
rho_ao_aux
|
||||
TYPE(dbcsr_type) :: matrix_s_aux_inv, matrix_tmp
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(qs_rho_type), POINTER :: rho, rho_aux
|
||||
|
||||
NULLIFY (dft_control, admm_dm, matrix_s_aux, matrix_s_mixed, rho, rho_aux)
|
||||
NULLIFY (rho_ao, rho_ao_aux)
|
||||
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control, s_mstruct_changed=s_mstruct_changed,
|
||||
rho=rho)
|
||||
CALL get_admm_env(qs_env.admm_env, matrix_s_aux_fit=matrix_s_aux, rho_aux_fit=rho_aux, &
|
||||
matrix_s_aux_fit_vs_orb=matrix_s_mixed, admm_dm=admm_dm)
|
||||
|
||||
CALL qs_rho_get(rho, rho_ao=rho_ao)
|
||||
CALL qs_rho_get(rho_aux, rho_ao=rho_ao_aux)
|
||||
|
||||
IF (s_mstruct_changed) THEN
|
||||
! Calculate A = S_aux^(-1) * S_mixed
|
||||
CALL dbcsr_create(matrix_s_aux_inv, template=matrix_s_aux[0].matrix, matrix_type="N")
|
||||
threshold = MAX(admm_dm.eps_filter, 1.0e-12_dp)
|
||||
CALL invert_Hotelling(matrix_s_aux_inv, matrix_s_aux[0].matrix, threshold)
|
||||
|
||||
IF (.NOT. ASSOCIATED(admm_dm.matrix_A)) THEN
|
||||
ALLOCATE (admm_dm.matrix_A)
|
||||
CALL dbcsr_create(admm_dm.matrix_A, template=matrix_s_mixed[0].matrix, matrix_type="N")
|
||||
END IF
|
||||
CALL dbcsr_multiply("N", "N", 1.0_dp, matrix_s_aux_inv, matrix_s_mixed[0].matrix, &
|
||||
0.0_dp, admm_dm.matrix_A)
|
||||
CALL dbcsr_release(matrix_s_aux_inv)
|
||||
END IF
|
||||
|
||||
! Calculate P_aux = A * P * A^T
|
||||
CALL dbcsr_create(matrix_tmp, template=admm_dm.matrix_A)
|
||||
DO ispin = 1, dft_control.nspins
|
||||
CALL dbcsr_multiply("N", "N", 1.0_dp, admm_dm.matrix_A, rho_ao(ispin).matrix, &
|
||||
0.0_dp, matrix_tmp)
|
||||
CALL dbcsr_multiply("N", "T", 1.0_dp, matrix_tmp, admm_dm.matrix_A, &
|
||||
0.0_dp, rho_ao_aux(ispin).matrix)
|
||||
END DO
|
||||
CALL dbcsr_release(matrix_tmp);
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Calculates auxiliary density matrix via blocking.
|
||||
\param qs_env ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::map_dm_blocked(qs_env)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
INTEGER :: blk, iatom, ispin, jatom
|
||||
LOGICAL :: found
|
||||
REAL(dp), DIMENSION(:, :), POINTER :: sparse_block, sparse_block_aux
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_iterator_type) :: iter
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_ao, rho_ao_aux
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(qs_rho_type), POINTER :: rho, rho_aux
|
||||
|
||||
NULLIFY (dft_control, admm_dm, rho, rho_aux, rho_ao, rho_ao_aux)
|
||||
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control, rho=rho)
|
||||
CALL get_admm_env(qs_env.admm_env, rho_aux_fit=rho_aux, admm_dm=admm_dm)
|
||||
|
||||
CALL qs_rho_get(rho, rho_ao=rho_ao)
|
||||
CALL qs_rho_get(rho_aux, rho_ao=rho_ao_aux)
|
||||
|
||||
! ** set blocked density matrix to 0
|
||||
DO ispin = 1, dft_control.nspins
|
||||
CALL dbcsr_set(rho_ao_aux(ispin).matrix, 0.0_dp)
|
||||
! ** now loop through the list and copy corresponding blocks
|
||||
CALL dbcsr_iterator_start(iter, rho_ao(ispin).matrix)
|
||||
DO WHILE (dbcsr_iterator_blocks_left(iter))
|
||||
CALL dbcsr_iterator_next_block(iter, iatom, jatom, sparse_block, blk)
|
||||
IF (admm_dm.block_map(iatom, jatom) == 1) THEN
|
||||
CALL dbcsr_get_block_p(rho_ao_aux(ispin).matrix, &
|
||||
row=iatom, col=jatom, BLOCK=sparse_block_aux, found=found)
|
||||
IF (found) &
|
||||
sparse_block_aux = sparse_block
|
||||
END IF
|
||||
END DO
|
||||
CALL dbcsr_iterator_stop(iter)
|
||||
END DO
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Call calculate_rho_elec() for auxiliary density
|
||||
\param qs_env ...
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::update_rho_aux(qs_env)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
INTEGER :: ispin
|
||||
REAL(KIND=dp), DIMENSION(:), POINTER :: tot_rho_r_aux
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: rho_ao_aux
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(pw_type), DIMENSION(:), POINTER :: rho_g_aux, rho_r_aux
|
||||
TYPE(qs_ks_env_type), POINTER :: ks_env
|
||||
TYPE(qs_rho_type), POINTER :: rho_aux
|
||||
TYPE(task_list_type), POINTER :: task_list_aux_fit
|
||||
|
||||
NULLIFY (dft_control, admm_dm, rho_aux, rho_ao_aux, rho_r_aux, rho_g_aux, tot_rho_r_aux, &
|
||||
task_list_aux_fit, ks_env)
|
||||
|
||||
CALL get_qs_env(qs_env, ks_env=ks_env, dft_control=dft_control)
|
||||
CALL get_admm_env(qs_env.admm_env, task_list_aux_fit=task_list_aux_fit, rho_aux_fit=rho_aux,
|
||||
&
|
||||
admm_dm=admm_dm)
|
||||
|
||||
CALL qs_rho_get(rho_aux, &
|
||||
rho_ao=rho_ao_aux, &
|
||||
rho_r=rho_r_aux, &
|
||||
rho_g=rho_g_aux, &
|
||||
tot_rho_r=tot_rho_r_aux)
|
||||
|
||||
DO ispin = 1, dft_control.nspins
|
||||
CALL calculate_rho_elec(ks_env=ks_env, &
|
||||
matrix_p=rho_ao_aux(ispin).matrix, &
|
||||
rho=rho_r_aux(ispin), &
|
||||
rho_gspace=rho_g_aux(ispin), &
|
||||
total_rho=tot_rho_r_aux(ispin), &
|
||||
soft_valid=.FALSE., &
|
||||
basis_type="AUX_FIT", &
|
||||
task_list_external=task_list_aux_fit)
|
||||
END DO
|
||||
|
||||
CALL qs_rho_set(rho_aux, rho_r_valid=.TRUE., rho_g_valid=.TRUE.)
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Merges auxiliary Kohn-Sham matrix via basis projection.
|
||||
\param qs_env ...
|
||||
\param matrix_ks_merge Input: The KS matrix to be merged
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::merge_dm_projection(qs_env, matrix_ks_merge)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks_merge
|
||||
|
||||
INTEGER :: ispin
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
|
||||
TYPE(dbcsr_type) :: matrix_tmp
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
|
||||
NULLIFY (admm_dm, dft_control, matrix_ks)
|
||||
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control, matrix_ks=matrix_ks)
|
||||
CALL get_admm_env(qs_env.admm_env, admm_dm=admm_dm)
|
||||
|
||||
! Calculate K += A^T * K_aux * A
|
||||
CALL dbcsr_create(matrix_tmp, template=admm_dm.matrix_A, matrix_type="N")
|
||||
|
||||
DO ispin = 1, dft_control.nspins
|
||||
CALL dbcsr_multiply("N", "N", 1.0_dp, matrix_ks_merge(ispin).matrix, admm_dm.matrix_A, &
|
||||
0.0_dp, matrix_tmp)
|
||||
CALL dbcsr_multiply("T", "N", 1.0_dp, admm_dm.matrix_A, matrix_tmp, &
|
||||
1.0_dp, matrix_ks(ispin).matrix)
|
||||
END DO
|
||||
|
||||
CALL dbcsr_release(matrix_tmp)
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Merges auxiliary Kohn-Sham matrix via blocking.
|
||||
\param qs_env ...
|
||||
\param matrix_ks_merge Input: The KS matrix to be merged
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::merge_dm_blocked(qs_env, matrix_ks_merge)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks_merge
|
||||
|
||||
INTEGER :: blk, iatom, ispin, jatom
|
||||
REAL(dp), DIMENSION(:, :), POINTER :: sparse_block
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_iterator_type) :: iter
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
|
||||
NULLIFY (admm_dm, dft_control, matrix_ks)
|
||||
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control, matrix_ks=matrix_ks)
|
||||
CALL get_admm_env(qs_env.admm_env, admm_dm=admm_dm)
|
||||
|
||||
DO ispin = 1, dft_control.nspins
|
||||
CALL dbcsr_iterator_start(iter, matrix_ks_merge(ispin).matrix)
|
||||
DO WHILE (dbcsr_iterator_blocks_left(iter))
|
||||
CALL dbcsr_iterator_next_block(iter, iatom, jatom, sparse_block, blk)
|
||||
IF (admm_dm.block_map(iatom, jatom) == 0) &
|
||||
sparse_block = 0.0_dp
|
||||
END DO
|
||||
CALL dbcsr_iterator_stop(iter)
|
||||
CALL dbcsr_add(matrix_ks(ispin).matrix, matrix_ks_merge(ispin).matrix, 1.0_dp, 1.0_dp)
|
||||
END DO
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Apply McWeeny purification to auxiliary density matrix
|
||||
\param qs_env ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::purify_mcweeny(qs_env)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'purify_mcweeny'
|
||||
|
||||
INTEGER :: handle, ispin, istep, nspins, unit_nr
|
||||
REAL(KIND=dp) :: frob_norm
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s_aux_fit, rho_ao_aux
|
||||
TYPE(dbcsr_type) :: matrix_ps, matrix_psp, matrix_test
|
||||
TYPE(dbcsr_type), POINTER :: matrix_p, matrix_s
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(mcweeny_history_type), POINTER :: history, new_hist_entry
|
||||
TYPE(qs_rho_type), POINTER :: rho_aux_fit
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
NULLIFY (dft_control, admm_dm, matrix_s_aux_fit, rho_aux_fit, new_hist_entry, &
|
||||
matrix_p, matrix_s, rho_ao_aux)
|
||||
|
||||
unit_nr = cp_logger_get_default_unit_nr()
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control)
|
||||
CALL get_admm_env(qs_env.admm_env, matrix_s_aux_fit=matrix_s_aux_fit, &
|
||||
rho_aux_fit=rho_aux_fit, admm_dm=admm_dm)
|
||||
|
||||
CALL qs_rho_get(rho_aux_fit, rho_ao=rho_ao_aux)
|
||||
|
||||
matrix_p => rho_ao_aux[0].matrix
|
||||
CALL dbcsr_create(matrix_PS, template=matrix_p, matrix_type="N")
|
||||
CALL dbcsr_create(matrix_PSP, template=matrix_p, matrix_type="S")
|
||||
CALL dbcsr_create(matrix_test, template=matrix_p, matrix_type="S")
|
||||
|
||||
nspins = dft_control.nspins
|
||||
DO ispin = 1, nspins
|
||||
matrix_p => rho_ao_aux(ispin).matrix
|
||||
matrix_s => matrix_s_aux_fit[0].matrix
|
||||
history => admm_dm.mcweeny_history(ispin).p
|
||||
IF (ASSOCIATED(history)) CPABORT("purify_dm_mcweeny: history already associated")
|
||||
IF (nspins == 1) CALL dbcsr_scale(matrix_p, 0.5_dp)
|
||||
|
||||
DO istep = 1, admm_dm.mcweeny_max_steps
|
||||
! allocate new element in linked list
|
||||
ALLOCATE (new_hist_entry)
|
||||
new_hist_entry.next => history
|
||||
history => new_hist_entry
|
||||
history.count = istep
|
||||
NULLIFY (new_hist_entry)
|
||||
CALL dbcsr_create(history.m, template=matrix_p, matrix_type="N")
|
||||
CALL dbcsr_copy(history.m, matrix_p, name="P from McWeeny")
|
||||
|
||||
! calc PS and PSP
|
||||
CALL dbcsr_multiply("N", "N", 1.0_dp, matrix_p, matrix_s, &
|
||||
0.0_dp, matrix_ps)
|
||||
|
||||
CALL dbcsr_multiply("N", "N", 1.0_dp, matrix_ps, matrix_p, &
|
||||
0.0_dp, matrix_psp)
|
||||
|
||||
!test convergence
|
||||
CALL dbcsr_copy(matrix_test, matrix_psp)
|
||||
CALL dbcsr_add(matrix_test, matrix_p, 1.0_dp, -1.0_dp)
|
||||
frob_norm = dbcsr_frobenius_norm(matrix_test)
|
||||
IF (unit_nr > 0) WRITE (unit_nr, '(t3,a,i5,a,f16.8)') "McWeeny-Step", istep, &
|
||||
": Deviation of idempotency", frob_norm
|
||||
IF (frob_norm < 1000_dp*admm_dm.eps_filter .AND. istep > 1) EXIT
|
||||
|
||||
! build next P matrix
|
||||
CALL dbcsr_copy(matrix_p, matrix_PSP, name="P from McWeeny")
|
||||
CALL dbcsr_multiply("N", "N", -2.0_dp, matrix_PS, matrix_PSP, &
|
||||
3.0_dp, matrix_p)
|
||||
END DO
|
||||
admm_dm.mcweeny_history(ispin).p => history
|
||||
IF (nspins == 1) CALL dbcsr_scale(matrix_p, 2.0_dp)
|
||||
END DO
|
||||
|
||||
! clean up
|
||||
CALL dbcsr_release(matrix_PS)
|
||||
CALL dbcsr_release(matrix_PSP)
|
||||
CALL dbcsr_release(matrix_test)
|
||||
CALL timestop(handle)
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Prepare auxiliary KS-matrix for merge using reverse McWeeny
|
||||
\param qs_env ...
|
||||
\param matrix_ks_merge Output: The KS matrix for the merge
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::revert_purify_mcweeny(qs_env, matrix_ks_merge)
|
||||
{
|
||||
TYPE(qs_environment_type), POINTER :: qs_env
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks_merge
|
||||
|
||||
CHARACTER(LEN=*), PARAMETER :: routineN = 'revert_purify_mcweeny'
|
||||
|
||||
INTEGER :: handle, ispin, nspins, unit_nr
|
||||
TYPE(admm_dm_type), POINTER :: admm_dm
|
||||
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_ks, matrix_ks_aux_fit, &
|
||||
matrix_s_aux_fit, &
|
||||
matrix_s_aux_fit_vs_orb
|
||||
TYPE(dbcsr_type), POINTER :: matrix_k
|
||||
TYPE(dft_control_type), POINTER :: dft_control
|
||||
TYPE(mcweeny_history_type), POINTER :: history_curr, history_next
|
||||
|
||||
CALL timeset(routineN, handle)
|
||||
unit_nr = cp_logger_get_default_unit_nr()
|
||||
NULLIFY (admm_dm, dft_control, matrix_ks, matrix_ks_aux_fit, &
|
||||
matrix_s_aux_fit, matrix_s_aux_fit_vs_orb, &
|
||||
history_next, history_curr, matrix_k)
|
||||
|
||||
CALL get_qs_env(qs_env, dft_control=dft_control, matrix_ks=matrix_ks)
|
||||
CALL get_admm_env(qs_env.admm_env, matrix_s_aux_fit=matrix_s_aux_fit, admm_dm=admm_dm, &
|
||||
matrix_s_aux_fit_vs_orb=matrix_s_aux_fit_vs_orb,
|
||||
matrix_ks_aux_fit=matrix_ks_aux_fit)
|
||||
|
||||
nspins = dft_control.nspins
|
||||
ALLOCATE (matrix_ks_merge(nspins))
|
||||
|
||||
DO ispin = 1, nspins
|
||||
ALLOCATE (matrix_ks_merge(ispin).matrix)
|
||||
matrix_k => matrix_ks_merge(ispin).matrix
|
||||
CALL dbcsr_copy(matrix_k, matrix_ks_aux_fit(ispin).matrix, name="K")
|
||||
history_curr => admm_dm.mcweeny_history(ispin).p
|
||||
NULLIFY (admm_dm.mcweeny_history(ispin).p)
|
||||
|
||||
! reverse McWeeny iteration
|
||||
DO WHILE (ASSOCIATED(history_curr))
|
||||
IF (unit_nr > 0) WRITE (unit_nr, '(t3,a,i5)') "Reverse McWeeny-Step ", history_curr.count
|
||||
CALL reverse_mcweeny_step(matrix_k=matrix_k, &
|
||||
matrix_s=matrix_s_aux_fit[0].matrix, &
|
||||
matrix_p=history_curr.m)
|
||||
CALL dbcsr_release(history_curr.m)
|
||||
history_next => history_curr.next
|
||||
DEALLOCATE (history_curr)
|
||||
history_curr => history_next
|
||||
NULLIFY (history_next)
|
||||
END DO
|
||||
|
||||
END DO
|
||||
|
||||
! clean up
|
||||
timestop(handle);
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Multiply matrix_k with partial derivative of McWeeny by reversing it.
|
||||
\param matrix_k ...
|
||||
\param matrix_s ...
|
||||
\param matrix_p ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
void admm_dm_methods::reverse_mcweeny_step(matrix_k, matrix_s, matrix_p)
|
||||
{
|
||||
TYPE(dbcsr_type) :: matrix_k, matrix_s, matrix_p
|
||||
|
||||
char *routineN = "reverse_mcweeny_step";
|
||||
|
||||
int handle;
|
||||
TYPE(dbcsr_type) :: matrix_ps, matrix_sp, matrix_sum, &
|
||||
matrix_tmp
|
||||
|
||||
timeset(routineN, handle);
|
||||
dbcsr_create(matrix_ps, template=matrix_p, matrix_type="N");
|
||||
dbcsr_create(matrix_sp, template=matrix_p, matrix_type="N");
|
||||
dbcsr_create(matrix_tmp, template=matrix_p, matrix_type="N");
|
||||
dbcsr_create(matrix_sum, template=matrix_p, matrix_type="N");
|
||||
|
||||
dbcsr_multiply("N", "N", 1.0_dp, matrix_p, matrix_s,
|
||||
0.0_dp, matrix_ps);
|
||||
dbcsr_multiply("N", "N", 1.0_dp, matrix_s, matrix_p,
|
||||
0.0_dp, matrix_sp);
|
||||
|
||||
// TODO: can we exploid more symmetry?
|
||||
dbcsr_multiply("N", "N", 3.0_dp, matrix_k, matrix_ps,
|
||||
0.0_dp, matrix_sum);
|
||||
dbcsr_multiply("N", "N", 3.0_dp, matrix_sp, matrix_k,
|
||||
1.0_dp, matrix_sum);
|
||||
|
||||
// matrix_tmp = KPS
|
||||
dbcsr_multiply("N", "N", 1.0_dp, matrix_k, matrix_ps,
|
||||
0.0_dp, matrix_tmp);
|
||||
dbcsr_multiply("N", "N", -2.0_dp, matrix_tmp, matrix_ps,
|
||||
1.0_dp, matrix_sum);
|
||||
dbcsr_multiply("N", "N", -2.0_dp, matrix_sp, matrix_tmp,
|
||||
1.0_dp, matrix_sum);
|
||||
|
||||
// matrix_tmp = SPK
|
||||
dbcsr_multiply("N", "N", 1.0_dp, matrix_sp, matrix_k,
|
||||
0.0_dp, matrix_tmp);
|
||||
dbcsr_multiply("N", "N", -2.0_dp, matrix_sp, matrix_tmp,
|
||||
1.0_dp, matrix_sum);
|
||||
|
||||
// overwrite matrix_k
|
||||
dbcsr_copy(matrix_k, matrix_sum, name="K from reverse McWeeny");
|
||||
|
||||
// clean up
|
||||
dbcsr_release(matrix_sum);
|
||||
dbcsr_release(matrix_tmp);
|
||||
dbcsr_release(matrix_ps);
|
||||
dbcsr_release(matrix_sp);
|
||||
timestop(handle);
|
||||
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef _BASE_H
|
||||
#define _BASE_H
|
||||
|
||||
#define default_string_length 80
|
||||
#define default_path_length 1024
|
||||
const int max_line_length = 2*default_path_length;
|
||||
|
||||
#endif
|
||||
|
|
@ -1,256 +0,0 @@
|
|||
/*--------------------------------------------------------------------------------------------------
|
||||
CP2K: A general program to perform molecular dynamics simulations
|
||||
Copyright 2000-2023 CP2K developers group <https://cp2k.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Central dispatch for basic hooks
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
class base_hooks {
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
// API
|
||||
void cp_abort();
|
||||
void cp_warn();
|
||||
void cp_hint();
|
||||
void timeset();
|
||||
void timestop();
|
||||
void cp_abort_hook();
|
||||
void cp_warn_hook();
|
||||
void cp_hint_hook();
|
||||
void timeset_hook();
|
||||
void timestop_hook();
|
||||
void cp__a();
|
||||
void cp__b();
|
||||
void cp__w();
|
||||
void cp__h();
|
||||
void cp__l();
|
||||
|
||||
// this interface (with subroutines in it) must to be defined right before
|
||||
// the regular subroutines/functions - otherwise prettify.py will screw up.
|
||||
INTERFACE
|
||||
SUBROUTINE cp_abort_interface(location, message)
|
||||
CHARACTER(len=*), INTENT(in) :: location, message
|
||||
|
||||
END SUBROUTINE cp_abort_interface
|
||||
|
||||
SUBROUTINE cp_warn_interface(location, message)
|
||||
CHARACTER(len=*), INTENT(in) :: location, message
|
||||
|
||||
END SUBROUTINE cp_warn_interface
|
||||
|
||||
SUBROUTINE cp_hint_interface(location, message)
|
||||
CHARACTER(len=*), INTENT(in) :: location, message
|
||||
|
||||
END SUBROUTINE cp_hint_interface
|
||||
|
||||
SUBROUTINE timeset_interface(routineN, handle)
|
||||
CHARACTER(LEN=*), INTENT(IN) :: routineN
|
||||
INTEGER, INTENT(OUT) :: handle
|
||||
|
||||
END SUBROUTINE timeset_interface
|
||||
|
||||
SUBROUTINE timestop_interface(handle)
|
||||
INTEGER, INTENT(IN) :: handle
|
||||
|
||||
END SUBROUTINE timestop_interface
|
||||
END INTERFACE
|
||||
|
||||
PROCEDURE(cp_abort_interface), POINTER :: cp_abort_hook => Null()
|
||||
PROCEDURE(cp_warn_interface), POINTER :: cp_warn_hook => Null()
|
||||
PROCEDURE(cp_hint_interface), POINTER :: cp_hint_hook => Null()
|
||||
PROCEDURE(timeset_interface), POINTER :: timeset_hook => Null()
|
||||
PROCEDURE(timestop_interface), POINTER :: timestop_hook => Null()
|
||||
|
||||
}
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief Terminate the program
|
||||
!> \param location ...
|
||||
!> \param message ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp_abort(location, message)
|
||||
CHARACTER(len=*), INTENT(in) :: location, message
|
||||
|
||||
IF (ASSOCIATED(cp_abort_hook)) THEN
|
||||
CALL cp_abort_hook(location, message)
|
||||
ELSE
|
||||
WRITE (default_output_unit, *) "ABORT in "//TRIM(location)//" "//TRIM(message)
|
||||
CALL m_flush(default_output_unit)
|
||||
CALL m_abort()
|
||||
END IF
|
||||
! compiler hint
|
||||
STOP "Never return from here"
|
||||
END SUBROUTINE cp_abort
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief Issue a warning
|
||||
!> \param location ...
|
||||
!> \param message ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp_warn(location, message)
|
||||
CHARACTER(len=*), INTENT(in) :: location, message
|
||||
|
||||
IF (ASSOCIATED(cp_warn_hook)) THEN
|
||||
CALL cp_warn_hook(location, message)
|
||||
ELSE
|
||||
WRITE (default_output_unit, *) "WARNING in "//TRIM(location)//" "//TRIM(message)
|
||||
CALL m_flush(default_output_unit)
|
||||
END IF
|
||||
END SUBROUTINE cp_warn
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief Issue a hint
|
||||
!> \param location ...
|
||||
!> \param message ...
|
||||
!> \author Hans Pabst
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp_hint(location, message)
|
||||
CHARACTER(len=*), INTENT(in) :: location, message
|
||||
|
||||
IF (ASSOCIATED(cp_hint_hook)) THEN
|
||||
CALL cp_hint_hook(location, message)
|
||||
ELSE
|
||||
WRITE (default_output_unit, *) "HINT in "//TRIM(location)//" "//TRIM(message)
|
||||
CALL m_flush(default_output_unit)
|
||||
END IF
|
||||
END SUBROUTINE cp_hint
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief Start timer
|
||||
!> \param routineN ...
|
||||
!> \param handle ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE timeset(routineN, handle)
|
||||
CHARACTER(LEN=*), INTENT(IN) :: routineN
|
||||
INTEGER, INTENT(OUT) :: handle
|
||||
|
||||
IF (ASSOCIATED(timeset_hook)) THEN
|
||||
CALL timeset_hook(routineN, handle)
|
||||
ELSE
|
||||
handle = -1
|
||||
END IF
|
||||
END SUBROUTINE timeset
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief Stop timer
|
||||
!> \param handle ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE timestop(handle)
|
||||
INTEGER, INTENT(IN) :: handle
|
||||
|
||||
IF (ASSOCIATED(timestop_hook)) THEN
|
||||
CALL timestop_hook(handle)
|
||||
ELSE
|
||||
IF (handle /= -1) &
|
||||
CALL cp_abort(cp__l("base_hooks.F", __LINE__), "Got wrong handle")
|
||||
END IF
|
||||
END SUBROUTINE timestop
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief CPASSERT handler
|
||||
!> \param filename ...
|
||||
!> \param lineNr ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp__a(filename, lineNr)
|
||||
CHARACTER(len=*), INTENT(in) :: filename
|
||||
INTEGER, INTENT(in) :: lineNr
|
||||
|
||||
CALL cp_abort(location=cp__l(filename, lineNr), message="CPASSERT failed")
|
||||
! compiler hint
|
||||
STOP "Never return from here"
|
||||
END SUBROUTINE cp__a
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief CPABORT handler
|
||||
!> \param filename ...
|
||||
!> \param lineNr ...
|
||||
!> \param message ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp__b(filename, lineNr, message)
|
||||
CHARACTER(len=*), INTENT(in) :: filename
|
||||
INTEGER, INTENT(in) :: lineNr
|
||||
CHARACTER(len=*), INTENT(in) :: message
|
||||
|
||||
CALL cp_abort(location=cp__l(filename, lineNr), message=message)
|
||||
! compiler hint
|
||||
STOP "Never return from here"
|
||||
END SUBROUTINE cp__b
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief CPWARN handler
|
||||
!> \param filename ...
|
||||
!> \param lineNr ...
|
||||
!> \param message ...
|
||||
!> \author Ole Schuett
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp__w(filename, lineNr, message)
|
||||
CHARACTER(len=*), INTENT(in) :: filename
|
||||
INTEGER, INTENT(in) :: lineNr
|
||||
CHARACTER(len=*), INTENT(in) :: message
|
||||
|
||||
CALL cp_warn(location=cp__l(filename, lineNr), message=message)
|
||||
END SUBROUTINE cp__w
|
||||
|
||||
!
|
||||
**************************************************************************************************
|
||||
!> \brief CPHINT handler
|
||||
!> \param filename ...
|
||||
!> \param lineNr ...
|
||||
!> \param message ...
|
||||
!> \author Hans Pabst
|
||||
!
|
||||
**************************************************************************************************
|
||||
SUBROUTINE cp__h(filename, lineNr, message)
|
||||
CHARACTER(len=*), INTENT(in) :: filename
|
||||
INTEGER, INTENT(in) :: lineNr
|
||||
CHARACTER(len=*), INTENT(in) :: message
|
||||
|
||||
CALL cp_hint(location=cp__l(filename, lineNr), message=message)
|
||||
END SUBROUTINE cp__h
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Helper routine to assemble __LOCATION__
|
||||
\param filename ...
|
||||
\param lineNr ...
|
||||
\return ...
|
||||
\author Ole Schuett
|
||||
***************************************************************************************************/
|
||||
char* cp__l(char *filename, int lineNr)
|
||||
{
|
||||
char *location;
|
||||
|
||||
char lineNr_str[15];
|
||||
|
||||
WRITE (lineNr_str, FMT='(I10)') lineNr
|
||||
location = TRIM(filename)//":"//TRIM(ADJUSTL(lineNr_str))
|
||||
|
||||
return location;
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
#ifndef _BASE_USES_H
|
||||
#define _BASE_USES_H
|
||||
|
||||
// Basic use statements and preprocessor macros
|
||||
// should be included in the use statements
|
||||
|
||||
int cp__a, cp__b, cp__w, cp__h, cp__l, cp_abort, cp_warn, cp_hint, timeset, timestop;
|
||||
|
||||
#if defined(__OFFLOAD_CUDA) || defined(__OFFLOAD_HIP)
|
||||
#define __OFFLOAD
|
||||
#endif
|
||||
|
||||
// Check for OpenMP early on - ideally before the compiler fails with a cryptic message.
|
||||
#if !defined(_OPENMP)
|
||||
"OpenMP is required. Please add the corresponding flag (eg. -fopenmp for GFortran) to your
|
||||
Fortran compiler flags."
|
||||
#endif
|
||||
|
||||
// Dangerous: Full path can be arbitrarily long and might overflow Fortran line.
|
||||
#if !defined(__SHORT_FILE__)
|
||||
#define __SHORT_FILE__ __FILE__
|
||||
#endif
|
||||
|
||||
#define __LOCATION__ cp__l(__SHORT_FILE__,__LINE__)
|
||||
#define CPWARN(msg) CALL cp__w(__SHORT_FILE__,__LINE__,msg)
|
||||
#define CPABORT(msg) CALL cp__b(__SHORT_FILE__,__LINE__,msg)
|
||||
// In contrast to CPWARN, the warning counter is not increased
|
||||
#define CPHINT(msg) CALL cp__h(__SHORT_FILE__,__LINE__,msg)
|
||||
|
||||
// CPASSERT can be elided if NDEBUG is defined.
|
||||
#if defined(NDEBUG)
|
||||
# define CPASSERT(cond)
|
||||
#else
|
||||
# define CPASSERT(cond) IF(.NOT.(cond))CALL cp__a(__SHORT_FILE__,__LINE__)
|
||||
#endif
|
||||
|
||||
// The MARK_USED macro can be used to mark an argument/variable as used. It is intended to make
|
||||
// it possible to switch on -Werror=unused-dummy-argument, but deal elegantly with, e.g.,
|
||||
// library wrapper routines that take arguments only used if the library is linked in.
|
||||
// This code should be valid for any Fortran variable, is always standard conforming,
|
||||
// and will be optimized away completely by the compiler
|
||||
#define MARK_USED(foo) IF(.FALSE.)THEN; DO ; IF(SIZE(SHAPE(foo))==-1) EXIT ; END DO ; ENDIF
|
||||
|
||||
// Calculate version number from 2 or 3 components. Can be used for comparison, e.g.,
|
||||
// CPVERSION3(4, 9, 0) <= CPVERSION3(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
||||
// CPVERSION(8, 0) <= CPVERSION(__GNUC__, __GNUC_MINOR__)
|
||||
#define CPVERSION2(MAJOR, MINOR) ((MAJOR) * 10000 + (MINOR) * 100)
|
||||
#define CPVERSION3(MAJOR, MINOR, UPDATE) (CPVERSION2(MAJOR, MINOR) + (UPDATE))
|
||||
#define CPVERSION CPVERSION2
|
||||
|
||||
// gfortran before 8.3 complains about internal symbols not being specified in
|
||||
// any data clause when using DEFAULT(NONE) and OOP procedures are called from
|
||||
// within the parallel region.
|
||||
#if __GNUC__ < 8 || (__GNUC__ == 8 && (__GNUC_MINOR__ < 3))
|
||||
#define OMP_DEFAULT_NONE_WITH_OOP SHARED
|
||||
#else
|
||||
#define OMP_DEFAULT_NONE_WITH_OOP NONE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/*------------------------------------------------------------------------------------------------
|
||||
CP2K: A general program to perform molecular dynamics simulations
|
||||
Copyright 2000-2023 CP2K developers group <https://cp2k.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
class kinds {
|
||||
|
||||
public:
|
||||
/***************************************************************************************************
|
||||
\brief Print informations about the used data types.
|
||||
\param iw ...
|
||||
\par History
|
||||
Adapted by JGH for Cp2k
|
||||
\author Matthias Krack
|
||||
***************************************************************************************************/
|
||||
void print_kind_info(int iw)
|
||||
{
|
||||
|
||||
WRITE (iw, '( /, T2, A )') 'DATA TYPE INFORMATION:'
|
||||
|
||||
WRITE (iw, '( /,T2,A,T79,A,2(/,T2,A,T75,I6),3(/,T2,A,T67,E14.8) )') &
|
||||
'REAL: Data type name:', 'dp', ' Kind value:', KIND(0.0_dp), &
|
||||
' Precision:', PRECISION(0.0_dp), &
|
||||
' Smallest non-negligible quantity relative to 1:', &
|
||||
EPSILON(0.0_dp), &
|
||||
' Smallest positive number:', TINY(0.0_dp), &
|
||||
' Largest representable number:', HUGE(0.0_dp)
|
||||
WRITE (iw, '( /,T2,A,T79,A,2(/,T2,A,T75,I6),3(/,T2,A,T67,E14.8) )') &
|
||||
' Data type name:', 'sp', ' Kind value:', KIND(0.0_sp), &
|
||||
' Precision:', PRECISION(0.0_sp), &
|
||||
' Smallest non-negligible quantity relative to 1:', &
|
||||
EPSILON(0.0_sp), &
|
||||
' Smallest positive number:', TINY(0.0_sp), &
|
||||
' Largest representable number:', HUGE(0.0_sp)
|
||||
WRITE (iw, '( /,T2,A,T72,A,4(/,T2,A,T61,I20) )') &
|
||||
'INTEGER: Data type name:', '(default)', ' Kind value:', &
|
||||
KIND(0), &
|
||||
' Bit size:', BIT_SIZE(0), &
|
||||
' Largest representable number:', HUGE(0)
|
||||
WRITE (iw, '( /,T2,A,T72,A,/,T2,A,T75,I6,/ )') &
|
||||
'LOGICAL: Data type name:', '(default)', &
|
||||
' Kind value:', KIND(.TRUE.)
|
||||
WRITE (iw, '( /,T2,A,T72,A,/,T2,A,T75,I6,/ )') &
|
||||
'CHARACTER: Data type name:', '(default)', &
|
||||
' Kind value:', KIND('C')
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,341 +0,0 @@
|
|||
/*--------------------------------------------------------------------------------------------------
|
||||
CP2K: A general program to perform molecular dynamics simulations
|
||||
Copyright 2000-2023 CP2K developers group <https://cp2k.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief some minimal info about CP2K, including its version and license
|
||||
\par History
|
||||
- created (2007-09, Joost VandeVondele)
|
||||
- moved into this module information related to runtime:pid, user_name,
|
||||
host_name, cwd, datx (2009-06, Teodoro Laino)
|
||||
\author Joost VandeVondele
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "./base/base.h"
|
||||
|
||||
class cp2k_info {
|
||||
|
||||
private:
|
||||
char *moduleN = "cp2k_info";
|
||||
|
||||
public:
|
||||
void cp2k_flags();
|
||||
void print_cp2k_license();
|
||||
void get_runtime_info();
|
||||
void write_restart_header();
|
||||
int cp2k_version, cp2k_year, cp2k_home;
|
||||
int compile_arch, compile_date, compile_host, compile_revision;
|
||||
|
||||
#if defined(__COMPILE_REVISION)
|
||||
char *compile_revision = __COMPILE_REVISION;
|
||||
#else
|
||||
char *compile_revision = "unknown";
|
||||
#endif
|
||||
|
||||
char *cp2k_version = "CP2K version 2023.2 (Development Version)";
|
||||
char *cp2k_year = "2023";
|
||||
char *cp2k_home = "https://www.cp2k.org/";
|
||||
|
||||
// compile time information
|
||||
#if defined(__COMPILE_ARCH)
|
||||
char *compile_arch = __COMPILE_ARCH;
|
||||
#else
|
||||
char *compile_arch = "unknown: -D__COMPILE_ARCH=?";
|
||||
#endif
|
||||
|
||||
#if defined(__COMPILE_DATE)
|
||||
char *compile_date = __COMPILE_DATE;
|
||||
#else
|
||||
char *compile_date = "unknown: -D__COMPILE_DATE=?";
|
||||
#endif
|
||||
|
||||
#if defined(__COMPILE_HOST)
|
||||
char *compile_host = __COMPILE_HOST;
|
||||
#else
|
||||
char *compile_host = "unknown: -D__COMPILE_HOST=?";
|
||||
#endif
|
||||
|
||||
// Local runtime informations
|
||||
char r_datx[26];
|
||||
char r_cwd[default_path_length];
|
||||
char r_host_name[default_string_length], r_user_name[default_string_length];
|
||||
int r_pid;
|
||||
|
||||
|
||||
};
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief list all compile time options that influence the capabilities of cp2k.
|
||||
All new flags should be added here (and be unique grep-able)
|
||||
\return ...
|
||||
***************************************************************************************************/
|
||||
char* cp2k_info::cp2k_flags()
|
||||
{
|
||||
char flags[10*default_string_length];
|
||||
|
||||
char tmp_str[default_string_length];
|
||||
|
||||
std::strncpy(flags,"cp2kflags:", sizeof(flags));
|
||||
|
||||
// Ensure that tmp_str is used to silence compiler warnings
|
||||
std::strncpy(tmp_str, "", sizeof(tmp_str);
|
||||
flags = TRIM(flags)//TRIM(tmp_str)
|
||||
|
||||
#if defined(NDEBUG);
|
||||
flags = TRIM(flags)//" ndebug"
|
||||
#endif
|
||||
flags = TRIM(flags)//" omp"
|
||||
#if defined(__LIBINT)
|
||||
flags = TRIM(flags)//" libint"
|
||||
#endif
|
||||
#if defined(__FFTW3)
|
||||
flags = TRIM(flags)//" fftw3"
|
||||
#endif
|
||||
#if defined(__FFTW3_MKL)
|
||||
flags = TRIM(flags)//" fftw3_mkl"
|
||||
#endif
|
||||
#if defined(__LIBXC)
|
||||
flags = TRIM(flags)//" libxc"
|
||||
#endif
|
||||
#if defined(__LIBPEXSI)
|
||||
flags = TRIM(flags)//" pexsi"
|
||||
#endif
|
||||
#if defined(__ELPA)
|
||||
flags = TRIM(flags)//" elpa"
|
||||
#endif
|
||||
#if defined(__ELPA_NVIDIA_GPU)
|
||||
flags = TRIM(flags)//" elpa_nvidia_gpu"
|
||||
#endif
|
||||
#if defined(__ELPA_AMD_GPU)
|
||||
flags = TRIM(flags)//" elpa_amd_gpu"
|
||||
#endif
|
||||
#if defined(__ELPA_INTEL_GPU)
|
||||
flags = TRIM(flags)//" elpa_intel_gpu"
|
||||
#endif
|
||||
#if defined(__parallel)
|
||||
flags = TRIM(flags)//" parallel"
|
||||
#endif
|
||||
#if defined(__MPI_F08)
|
||||
flags = TRIM(flags)//" mpi_f08"
|
||||
#endif
|
||||
#if defined(__SCALAPACK)
|
||||
flags = TRIM(flags)//" scalapack"
|
||||
#endif
|
||||
#if defined(__COSMA)
|
||||
flags = TRIM(flags)//" cosma"
|
||||
#endif
|
||||
|
||||
#if defined(__QUIP)
|
||||
flags = TRIM(flags)//" quip"
|
||||
#endif
|
||||
|
||||
#if defined(__HAS_PATCHED_CUFFT_70)
|
||||
flags = TRIM(flags)//" patched_cufft_70"
|
||||
#endif
|
||||
|
||||
#if defined(__PW_FPGA)
|
||||
flags = TRIM(flags)//" pw_fpga"
|
||||
#endif
|
||||
#if defined(__PW_FPGA_SP)
|
||||
flags = TRIM(flags)//" pw_fpga_sp"
|
||||
#endif
|
||||
|
||||
#if defined(__LIBXSMM)
|
||||
flags = TRIM(flags)//" xsmm"
|
||||
#endif
|
||||
|
||||
#if defined(__CRAY_PM_ACCEL_ENERGY)
|
||||
flags = TRIM(flags)//" cray_pm_accel_energy"
|
||||
#endif
|
||||
#if defined(__CRAY_PM_ENERGY)
|
||||
flags = TRIM(flags)//" cray_pm_energy"
|
||||
#endif
|
||||
#if defined(__CRAY_PM_FAKE_ENERGY)
|
||||
flags = TRIM(flags)//" cray_pm_fake_energy"
|
||||
#endif
|
||||
#if defined(__DBCSR_ACC)
|
||||
flags = TRIM(flags)//" dbcsr_acc"
|
||||
#endif
|
||||
#if defined(__MAX_CONTR)
|
||||
CALL integer_to_string(__MAX_CONTR, tmp_str)
|
||||
flags = TRIM(flags)//" max_contr="//TRIM(tmp_str)
|
||||
#endif
|
||||
#if defined(__NO_SOCKETS)
|
||||
flags = TRIM(flags)//" no_sockets"
|
||||
#endif
|
||||
#if defined(__NO_MPI_THREAD_SUPPORT_CHECK)
|
||||
flags = TRIM(flags)//" no_mpi_thread_support_check"
|
||||
#endif
|
||||
#if defined(__NO_STATM_ACCESS)
|
||||
flags = TRIM(flags)//" no_statm_access"
|
||||
#endif
|
||||
#if defined(__MINGW)
|
||||
flags = TRIM(flags)//" mingw"
|
||||
#endif
|
||||
#if defined(__PW_CUDA_NO_HOSTALLOC)
|
||||
flags = TRIM(flags)//" pw_cuda_no_hostalloc"
|
||||
#endif
|
||||
#if defined(__STATM_RESIDENT)
|
||||
flags = TRIM(flags)//" statm_resident"
|
||||
#endif
|
||||
#if defined(__STATM_TOTAL)
|
||||
flags = TRIM(flags)//" statm_total"
|
||||
#endif
|
||||
#if defined(__PLUMED2)
|
||||
flags = TRIM(flags)//" plumed2"
|
||||
#endif
|
||||
#if defined(__HAS_IEEE_EXCEPTIONS)
|
||||
flags = TRIM(flags)//" has_ieee_exceptions"
|
||||
#endif
|
||||
#if defined(__NO_ABORT)
|
||||
flags = TRIM(flags)//" no_abort"
|
||||
#endif
|
||||
#if defined(__SPGLIB)
|
||||
flags = TRIM(flags)//" spglib"
|
||||
#endif
|
||||
#if defined(__ACCELERATE)
|
||||
flags = TRIM(flags)//" accelerate"
|
||||
#endif
|
||||
#if defined(__MKL)
|
||||
flags = TRIM(flags)//" mkl"
|
||||
#endif
|
||||
#if defined(__SIRIUS)
|
||||
flags = TRIM(flags)//" sirius"
|
||||
#endif
|
||||
#if defined(__CHECK_DIAG)
|
||||
flags = TRIM(flags)//" check_diag"
|
||||
#endif
|
||||
#if defined(__LIBVORI)
|
||||
flags = TRIM(flags)//" libvori"
|
||||
flags = TRIM(flags)//" libbqb"
|
||||
#endif
|
||||
#if defined(__LIBMAXWELL)
|
||||
flags = TRIM(flags)//" libmaxwell"
|
||||
#endif
|
||||
#if defined(__LIBTORCH)
|
||||
flags = TRIM(flags)//" libtorch"
|
||||
#endif
|
||||
#if defined(__OFFLOAD_CUDA)
|
||||
flags = TRIM(flags)//" offload_cuda"
|
||||
#endif
|
||||
#if defined(__OFFLOAD_HIP)
|
||||
flags = TRIM(flags)//" offload_hip"
|
||||
#endif
|
||||
#if defined(__NO_OFFLOAD_GRID)
|
||||
flags = TRIM(flags)//" no_offload_grid"
|
||||
#endif
|
||||
#if defined(__NO_OFFLOAD_DBM)
|
||||
flags = TRIM(flags)//" no_offload_dbm"
|
||||
#endif
|
||||
#if defined(__NO_OFFLOAD_PW)
|
||||
flags = TRIM(flags)//" no_offload_pw"
|
||||
#endif
|
||||
#if defined(__OFFLOAD_PROFILING)
|
||||
flags = TRIM(flags)//" offload_profiling"
|
||||
#endif
|
||||
|
||||
#if defined(__SPLA) && defined(__OFFLOAD_GEMM)
|
||||
flags = TRIM(flags)//" spla_gemm_offloading"
|
||||
#endif
|
||||
|
||||
#if defined(__CUSOLVERMP)
|
||||
flags = TRIM(flags)//" cusolvermp"
|
||||
#endif
|
||||
|
||||
#if defined(__LIBVDWXC)
|
||||
flags = TRIM(flags)//" libvdwxc"
|
||||
#endif
|
||||
|
||||
#if defined(__HDF5)
|
||||
flags = TRIM(flags)//" hdf5"
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief ...
|
||||
\param iunit ...
|
||||
***************************************************************************************************/
|
||||
void cp2k_info::print_cp2k_license(int iunit)
|
||||
{
|
||||
|
||||
WRITE (UNIT=iunit, FMT="(T2,A)") &
|
||||
"******************************************************************************", &
|
||||
"* *", &
|
||||
"* CP2K: A general program to perform molecular dynamics simulations *", &
|
||||
"* Copyright (C) 2000-2023 CP2K developer group <https://www.cp2k.org/> *", &
|
||||
"* *", &
|
||||
"* 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, see <https://www.gnu.org/licenses/>. *", &
|
||||
"* *", &
|
||||
"******************************************************************************";
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief ...
|
||||
***************************************************************************************************/
|
||||
void cp2k_info::get_runtime_info()
|
||||
{
|
||||
r_datx = "";
|
||||
r_cwd = "";
|
||||
r_host_name = "";
|
||||
r_user_name = "";
|
||||
r_pid = -1;
|
||||
|
||||
m_getpid(r_pid)
|
||||
CALL m_getlog(r_user_name)
|
||||
CALL m_hostnm(r_host_name)
|
||||
CALL m_datum(r_datx)
|
||||
CALL m_getcwd(r_cwd)
|
||||
|
||||
}
|
||||
|
||||
/***************************************************************************************************
|
||||
\brief Writes the header for the restart file
|
||||
\param iunit ...
|
||||
\par History
|
||||
01.2008 [created] - Split from write_restart
|
||||
\author Teodoro Laino - University of Zurich - 01.2008
|
||||
***************************************************************************************************/
|
||||
void cp2k_info::write_restart_header(int iunit)
|
||||
{
|
||||
char cwd[256], datx[256];
|
||||
|
||||
m_datum(datx);
|
||||
m_getcwd(cwd);
|
||||
|
||||
WRITE (UNIT=iunit, FMT="(T2,A)") "# Version information for this restart file "
|
||||
WRITE (UNIT=iunit, FMT="(T2,A)") "# current date "//TRIM(datx)
|
||||
WRITE (UNIT=iunit, FMT="(T2,A)") "# current working dir "//TRIM(cwd)
|
||||
|
||||
WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
|
||||
"# Program compiled at", &
|
||||
ADJUSTR(compile_date(1:MIN(50, LEN(compile_date))))
|
||||
WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
|
||||
"# Program compiled on", &
|
||||
ADJUSTR(compile_host(1:MIN(50, LEN(compile_host))))
|
||||
WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
|
||||
"# Program compiled for", &
|
||||
ADJUSTR(compile_arch(1:MIN(50, LEN(compile_arch))))
|
||||
WRITE (UNIT=iunit, FMT="(T2,A,T31,A50)") &
|
||||
"# Source code revision number", &
|
||||
ADJUSTR(compile_revision)
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue