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 47
  • Win 20
  • OS X 10
  • Linux 17
Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3
Windows 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 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
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.