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 397
  • Win 233
  • Mac 88
  • Linux 76
Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14
Windows 0 0 0 0 0 0 1 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 0 0 0 2 0 0 0 0 1 0
Mac 0 0 0 0 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 0 0 0 0 0 0 0 0 1 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 1 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.