tools
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tools [2014/01/25 14:41] – 92.30.34.169 | tools [2023/10/10 07:43] – [Various script repositories from cp2k users and developers] glebreton | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== CP2K Tools ====== | + | ~~NOCACHE~~ |
- | ===== Plugin | + | ====== Tools for simplifying your life with CP2K ====== |
- | {{ : | + | ===== 3rd party software that interacts with CP2K ===== |
- | Syntax highlighting for CP2K input files can be enabled with the (g)vim editor using the vim plugin file [[http:// | + | <nspages tools -h1 -simpleList -textPages="" |
+ | ===== Basis sets and potentials ===== | ||
- | < | + | * [[https://htmlpreview.github.io/? |
- | wget http://manual.cp2k.org/trunk/cp2k.vim | + | * [[https://github.com/cp2k/cp2k-data/blob/ |
- | mkdir -p ~/.vim/syntax | + | |
- | mv cp2k.vim ~/.vim/syntax | + | |
- | </code> | + | |
- | In addition create a file with the name filetype.vim in the ~/.vim folder containing the following lines | + | ===== Various script repositories from cp2k users and developers |
- | + | ||
- | < | + | |
- | if exists(" | + | |
- | | + | |
- | endif | + | |
- | augroup filetypedetect | + | |
- | au! BufNewFile, | + | |
- | augroup END | + | |
- | </ | + | |
- | which causes that all files with the name extension " | + | |
- | + | ||
- | === Syntax folding | + | |
- | + | ||
- | The syntax folding based on the CP2K input line indentation is supported by default. The following Vim editor commands might be useful for large CP2K input files: | + | |
- | * za :: Toggle the folding of the current fold level | + | |
- | * zA :: Toggle the folding of all fold levels recursively | + | |
- | * zM :: Close all folds in the current buffer | + | |
- | * zR :: Open all folds in the current buffer | + | |
- | + | ||
- | === Automatic indenting === | + | |
- | + | ||
- | An automatic indenting of the CP2K input lines while typing in insert mode is activated by default. The number of blanks used for the indentation can be defined in the ~/.vimrc file by | + | |
- | < | + | |
- | au FileType | + | |
- | </ | + | |
- | which changes the indentation only for the specified file type cp2k, whereas | + | |
- | < | + | |
- | set shiftwidth=1 tabstop=1 | + | |
- | </ | + | |
- | will change the indentation for all file types and buffers. | + | |
- | + | ||
- | The indentation can also be changed at any time during a Vim editing session by | + | |
- | < | + | |
- | :set shiftwidth=2 tabstop=2 | + | |
- | </ | + | |
- | Likewise, the automatic indenting can be switched off by setting | + | |
- | < | + | |
- | :set shiftwidth=0 tabstop=0 | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Plugin for the GNU EMACS editor ===== | + | |
- | + | ||
- | {{: | + | |
- | + | ||
- | cp2k-mode.el provides a major mode in emacs for editing CP2K input | + | |
- | files. It has been tested on emacs 2.1, 2.3 and 2.4. | + | |
- | + | ||
- | === Functionalities === | + | |
- | + | ||
- | == Recognises and font-locks == | + | |
- | + | ||
- | * the full CP2K input preprocessor syntax | + | |
- | * the sections and subsections | + | |
- | * the keywords | + | |
- | * the comment lines | + | |
- | * Indents lines according to the CP2K input syntax using <tab> key | + | |
- | + | ||
- | == New interactive functions == | + | |
- | + | ||
- | * cp2k-indent-line :: indents the line according to CP2K input syntax. | + | |
- | * cp2k-beginning-of-block :: goes to the beginning of the subsection, marks the current cursor position. | + | |
- | * cp2k-end-of-block :: goes to the ending of the subsection, marks the current cursor position. | + | |
- | + | ||
- | == Key Bindings == | + | |
- | + | ||
- | * < | + | |
- | * C-j :: newline-and-indent | + | |
- | * C-c ; :: comment-region | + | |
- | * C-M-a :: cp2k-beginning-of-block | + | |
- | * C-M-e :: cp2k-end-of-block | + | |
- | + | ||
- | === How to Obtain === | + | |
- | + | ||
- | cp2k-mode.el can be found in | + | |
- | < | + | |
- | cp2k/ | + | |
- | </ | + | |
- | directory of cp2k package, with SVN revision 13496 or above. | + | |
- | + | ||
- | === Installation === | + | |
- | + | ||
- | You need to put cp2k-mode.el in one of your local emacs lisp directories, | + | |
- | + | ||
- | == Adding to emacs' | + | |
- | + | ||
- | If you have never installed any packages manually before, and do not know the search path of your emacs installation, | + | |
- | < | + | |
- | ~/ | + | |
- | </ | + | |
- | This is the usual place where the local/user defined emacs lisp files are installed. Move cp2k-mode.el to ~/ | + | |
- | + | ||
- | Then, add the following to your .emacs file (which should be in your home directory, and if it does not exist, create one): | + | |
- | < | + | |
- | (add-to-list ' | + | |
- | </ | + | |
- | This tells emacs to add ~/ | + | |
- | + | ||
- | == Tell emacs to load cp2k-mode.el at startup == | + | |
- | + | ||
- | Once cp2k-mode.el is in the search path, we need to tell emacs to load it at start up, this is done by adding | + | |
- | < | + | |
- | (require ' | + | |
- | </ | + | |
- | to your .emacs file. | + | |
- | + | ||
- | == Tell emacs to recognise *.inp automatically as a cp2k input file == | + | |
- | + | ||
- | Add | + | |
- | < | + | |
- | (add-to-list ' | + | |
- | </ | + | |
- | to your .emacs file. | + | |
- | + | ||
- | === Universal Code Folding Based on Indentation === | + | |
- | + | ||
- | Although cp2k-mode.el does not provide a function for folding/ | + | |
- | + | ||
- | Put the following elisp code in your .emacs | + | |
- | < | + | |
- | (defun toggle-folding-based-on-indentation () | + | |
- | " | + | |
- | (interactive) | + | |
- | (save-excursion | + | |
- | (back-to-indentation) | + | |
- | (set-selective-display | + | |
- | | + | |
- | (1+ (current-column)))))) | + | |
- | </ | + | |
- | This simple code utilises the '' | + | |
- | < | + | |
- | (global-set-key (kbd " | + | |
- | </ | + | |
- | This folds and unfolds //all// subsections in a '' | + | |
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// |
tools.txt · Last modified: 2023/11/10 11:42 by krack