Showing posts with label vi. Show all posts
Showing posts with label vi. Show all posts

28 February 2013

347. Minor ECCE oddity when pasting basis sets from BSE: lines longer than 254 chars wreak havoc

Using lines longer than 254 chars when editing nwchem input in ECCE leads to the rest of the input being dropped.

I discovered this when pasting basis sets from bse.pnl.gov. If you paste something which has a line longer than 254 chars, such as the one starting with # H He and ending with valence below (345 chars), everything that comes after that line will be dropped.
# Def2-SVP EMSL Basis Set Exchange Library 2/27/13 8:08 PM # Elements References # -------- ---------- # H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe Cs Ba La Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn : F. Weigend and R. Ahlrichs, Phys. Chem. Chem. Phys., Balanced basis sets of split valence, triple zeta valence and quadruple zeta valence # quality for H to Rn: Design and assessment of accuracy 7, 3297 (2005). # BASIS "ao basis" PRINT #BASIS SET: (4s,1p) -> [2s,1p] H S 13.0107010 0.19682158E-01 1.9622572 0.13796524 0.44453796 0.47831935 H S 0.12194962 1.0000000 H P 0.8000000 1.0000000 #BASIS SET: (7s,4p,1d) -> [3s,2p,1d] O S 2266.1767785 -0.53431809926E-02 340.87010191 -0.39890039230E-01 77.363135167 -0.17853911985 21.479644940 -0.46427684959 6.6589433124 -0.44309745172 O S 0.80975975668 1.0000000 O S 0.25530772234 1.0000000 [..]

To reproduce, set up a calculation. In the editor, click on 'Final Edit'. Now paste your basis set. Save and exit (it's vi/m, so that means using :wq). 

Everything seems to be fine

Now, either select the job and hit Ctrl+I to see the input, or open the editor and click on 'Final Edit' again.

Nothing below the line immediately preceding the long line will be saved. It's not a visualisation issue either -- if you launch the job and do ctrl+o to see what NWChem received as input, it mirrors what you see as input.

Pasting anything other than that overly long line works fine.




A more artificial example would be to try to save this
a
b
abcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyz1234
d
e

which works, vs this:
a
b
abcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyz12345
d
e

which doesn't. There's a difference of one character.

26 February 2013

345. Replacing gEdit with Kate

For some reason I can't get gEdit to auto-spellcheck as I type anymore. There's simply no option to do it. Funnily enough, my favourite editor vim does it without any issues -- but while I like vim and use it for most of my data processing, I prefer to edit e.g. html in gEdit. Habit, I suppose.

Anyway, while gEdit is great for everything else, it's given me an excuse to familiarise myself a bit more with Kate which I take is the KDE counterpart to gEdit. A counterpart that's on steroids like a lot of KDE applications (that's not necessarily a good thing -- see e.g. vim vs emacs -- but each to their own)

Another cool thing with kate is that you can run it in a vim compatibility mode. (Sure, there's also gVim for the real deal, but gVIM looks ugly on my computer and I'm a shallow person.)

1. Installation
sudo apt-get install kate

2. Associations
Edit ~/.local/share/applications/defaults.list
 text/plain=kate.desktop
 text/x-python=kate.desktop
 text/x-sql=kate.desktop
 text/html=kate.desktop
 text/dat=kate.desktop
 text/xml=kate.desktop

You can associate kate with as many formats are you want this way.

Create ~/.local/share/applications/kate.desktop
[Desktop Entry]
Name=kate
Comment=kate text editor
Exec=/usr/bin/kate
Type=Application
Categories=Office;Accessories;
Set dynamic word wrap, enable vim, override

3. Desktop
In gnome, either navigate through your menu to 'Main Menu' (under 'system tools') or, if you're running a stock gnome 3 without a menu, go to the overview mode (what you end up with when you put the mouse in the top left corner) and type in main menu.

Either way, go to accessories and tick the box next to Kate.

4. Set up kate
Start kate, go to settings, configure kate and set your defaults:
Enable vi mode

Set up automatic spell check

Activate Dynamic Word Wrap

And enjoy: