Qbox Implemention of Magnetic Field: Difference between revisions
| (7 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
=== How wave function is distributed among processors === |
=== How wave function is distributed among processors === |
||
https://wiki.alcf.anl.gov/index.php/Qbox#Performance_Notes |
|||
* Fourier space (sphere) |
* Fourier space (sphere) |
||
* Real space (cube) |
* Real space (cube) |
||
=== How Fourier transform is performed === |
=== How Fourier transform is performed === |
||
| Line 25: | Line 26: | ||
a directory named ./Qbox with the sources will be created in the current directory. |
a directory named ./Qbox with the sources will be created in the current directory. |
||
Revision history is available at https://micro.stanford.edu/viewvc/Qbox/ |
|||
=== How wave function is distributed among processors === |
=== How wave function is distributed among processors === |
||
| Line 52: | Line 55: | ||
* Removed ESSL and internal-FFT portions in FourierTransform::bwd and ::fwd |
* Removed ESSL and internal-FFT portions in FourierTransform::bwd and ::fwd |
||
= Code Style = |
|||
Some new files were created to implement the magnetic portion, the style can be enforced by applying this command |
|||
indent \ |
|||
-i8 -l160 \ |
|||
--braces-on-if-line \ |
|||
--braces-on-struct-decl-line \ |
|||
--cuddle-do-while --cuddle-else \ |
|||
--no-blank-lines-after-declarations --no-blank-lines-after-procedures \ |
|||
--dont-break-function-decl-args \ |
|||
--no-space-after-function-call-names --no-space-after-parentheses \ |
|||
--dont-break-procedure-type \ |
|||
--no-space-after-for --no-space-after-if --no-space-after-while \ |
|||
--dont-space-special-semicolon qbox.hpp |
|||
GNU Indent doesn't work perfectly with C++, it gets confused but comment ending in parenthesis and with angle brackets in templates. An alternative is to use [http://www.faqs.org/docs/Linux-HOWTO/C-C++Beautifier-HOWTO.html bcpp] |
|||
cp qbox.hpp.save qbox.hpp && \ |
|||
~/usr/bin/bcpp -bcl -cc 80 -t -tbcl -nbbi qbox.hpp qbox.hpp.bcpp && \ |
|||
mv -f qbox.hpp.bcpp qbox.hpp |
|||
Which respect almost perfectly the desired style (except that curly brackets appear in new lines), plus inline comments are moved to column 80. |
|||
A third alternative that work flawlessly for C++ is [http://astyle.sourceforge.net/astyle.html astyle]: |
|||
~/usr/bin-hera/astyle \ |
|||
--brackets=attach \ |
|||
--indent=tab --indent-col1-comments \ |
|||
--unpad-paren \ |
|||
--delete-empty-lines \ |
|||
--add-brackets \ |
|||
--keep-one-line-statements \ |
|||
--convert-tabs \ |
|||
--align-pointer=type qbox.hpp |
|||
Which also gives (for me) a perfect style, except that curly brackets have a space before them and comments are not aligned to column 80. |
|||
The advantage of GNU Indent over the other two is that GNU Indent is installed by default in most systems. |
|||
To make the file VI and Emacs friendly, add the following [http://en.wikibooks.org/wiki/Learning_the_vi_editor/Details#Modelines modelines] at the end of the file |
|||
... file here |
|||
// Editor modelines - http://www.wireshark.org/tools/modelines.html |
|||
// Local variables: |
|||
// c-basic-offset: 4 |
|||
// tab-width: 4 |
|||
// indent-tabs-mode: t |
|||
// truncate-lines: 1 |
|||
// End: |
|||
/* vim:set ft=cpp ts=4 sw=4 sts=4 nowrap: cindent: */ |
|||
In this way Emacs, VI and gedit will open the code in a manner that can be nicely viewed and edited compatible with the style. |
|||
Latest revision as of 09:58, 27 April 2010
Qbox implementation without magnetic field
How wave function is distributed among processors
https://wiki.alcf.anl.gov/index.php/Qbox#Performance_Notes
- Fourier space (sphere)
- Real space (cube)
How Fourier transform is performed
Qbox implementation with magnetic field
Retrive current working version
To retrieve the current implementation version of Qbox (within the Magnetic project), do
cd ~/prj svn co --username USERNAME https://micro.stanford.edu/svn/Qbox
a directory named ./Qbox with the sources will be created in the current directory.
Revision history is available at https://micro.stanford.edu/viewvc/Qbox/
How wave function is distributed among processors
- Fourier space (cube)
- Real space (cube)
How Fourier transform is performed
real, intermediate, reciprocal spaces
Dumping the Hartree potential
Sometimes it is useful to obtain the self consistent Hartree potential, either to do a calculation on top of it or to have an intuition of the effective potential that electrons are subjected to.
Log of major changes
- Removed non-FFTW macro code in 'FourierTransform.C' to clean up the code.
- Removed ESSL and internal-FFT portions in FourierTransform::bwd and ::fwd
Code Style
Some new files were created to implement the magnetic portion, the style can be enforced by applying this command
indent \ -i8 -l160 \ --braces-on-if-line \ --braces-on-struct-decl-line \ --cuddle-do-while --cuddle-else \ --no-blank-lines-after-declarations --no-blank-lines-after-procedures \ --dont-break-function-decl-args \ --no-space-after-function-call-names --no-space-after-parentheses \ --dont-break-procedure-type \ --no-space-after-for --no-space-after-if --no-space-after-while \ --dont-space-special-semicolon qbox.hpp
GNU Indent doesn't work perfectly with C++, it gets confused but comment ending in parenthesis and with angle brackets in templates. An alternative is to use bcpp
cp qbox.hpp.save qbox.hpp && \ ~/usr/bin/bcpp -bcl -cc 80 -t -tbcl -nbbi qbox.hpp qbox.hpp.bcpp && \ mv -f qbox.hpp.bcpp qbox.hpp
Which respect almost perfectly the desired style (except that curly brackets appear in new lines), plus inline comments are moved to column 80.
A third alternative that work flawlessly for C++ is astyle:
~/usr/bin-hera/astyle \ --brackets=attach \ --indent=tab --indent-col1-comments \ --unpad-paren \ --delete-empty-lines \ --add-brackets \ --keep-one-line-statements \ --convert-tabs \ --align-pointer=type qbox.hpp
Which also gives (for me) a perfect style, except that curly brackets have a space before them and comments are not aligned to column 80.
The advantage of GNU Indent over the other two is that GNU Indent is installed by default in most systems.
To make the file VI and Emacs friendly, add the following modelines at the end of the file
... file here // Editor modelines - http://www.wireshark.org/tools/modelines.html // Local variables: // c-basic-offset: 4 // tab-width: 4 // indent-tabs-mode: t // truncate-lines: 1 // End: /* vim:set ft=cpp ts=4 sw=4 sts=4 nowrap: cindent: */
In this way Emacs, VI and gedit will open the code in a manner that can be nicely viewed and edited compatible with the style.