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 428
  • Win 255
  • Mac 93
  • Linux 80
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 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7
Windows 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0
Mac 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.