ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

cp​2k-syntax

by nholmber ST3

CP2K input file syntax highlighting for SublimeText 3

Details

Installs

  • Total 431
  • Win 256
  • Mac 95
  • Linux 80
Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

cp2k-syntax

Comprehensive syntax highlighting for CP2K input files in Sublime Text 3.

CP2K is a freely available program package to perform atomistic simulations of solid state, liquid, molecular, periodic, material, crystal, and biological systems.

alt text

Color scheme in the example figure is base16-railscasts

Features

  • Syntax highlighting based on the .sublime-syntax format requiring a recent version of Sublime Text 3 (minimum build number 3084)
  • Standalone python linter which parses the input file and compares it to the XML input description of CP2K
  • Snippets for commonly used control sequences

Installation

The simplest way to install this package is via Package Control. Alternatively, you can clone this repository.

Installation via Package Control

  1. Make sure you have a working python interpreter (supported versions =>2.5 and 3.x).
  2. If not already installed, install Package Control for Sublime Text 3.
  3. Install SublimeLinter.
  4. Install this package via Package Control
    1. Open the Command Palette (ctrl+shift+p on Linux/Windows)
    2. Type install and select Package Control: Install Package
    3. Type cp2k and select cp2k-syntax

Installation via Git

  1. Make sure you have all the prerequisites listed above.
  2. Open a terminal and create a working directory for this repository.
  3. Move to the directory you created in the previous step and clone the repository git clone https://github.com/nholmber/cp2k-syntax
  4. Create a folder for this package in your local Sublime Text Packages/User directory.
  5. Recursively copy (cp -r *) all files related to this package into the folder you created in the previous step.

Usage and configuration

By default, files ending in .inp, .inc, and .restart are recognized as CP2K input files and syntax highlighting should be applied to these files automatically. If for some reason the automatic detection does not work or you wish to enable highlighting for a different file extension, you need to take the following steps

  1. Open the file for which you wish to enable syntax highlighting.
  2. Navigate to View -> Syntax -> Open all with current extension as ... -> CP2K Input

The output of the linter is parsed and displayed on screen by the SublimeLinter package. To customize the linting view and other settings, please take a look at the documentation of SublimeLinter.

The linter recognizes allowed keyword names by parsing the XML input description of CP2K. A sample XML file sample-xml/cp2k_input.xml is provided for CP2K version 3.0 and the linter by default uses this file. If you are using a different version of CP2K, you can replace the default XML file with your own file by following these steps

  1. Create an XML input description for your version of CP2K.
  2. Place the generated cp2k_input.xml in any directory.
  3. Configure the linter to use the generated file.
    1. Open the Command Palette (ctrl+shift+p on Linux/Windows)
    2. Type preferences sub and select Preferences: SublimeLinter Settings -- User
    3. Scroll down the settings until you find cp2klint settings (under linters).
    4. Replace the default manualfile with your own XML file including a full path and filename for the file.

Contributing

If you find bug in the linter or syntax highlighting, please open a new issue in the issue tracker and include a minimal input file for reproducing the bug. You can also contribute directly by forking the project and posting a pull request. Check the issue tracker for known issues and nice-to-have unimplemented features.