Thursday, March 29, 2012

Find non-zero size files in Linux

http://www.unix.com/unix-dummies-questions-answers/25514-how-find-files-not-empty.html

You can use the find command to find non-zero length files:

find path -type f ! -size 0

In most UNIX implementations, the -size expression can also be used to search for file sizes of exactly N bytes (-size Nc), greater-than N bytes (-size +Nc), and less-than N bytes (-size -Nc).

The confusing thing is that the numeric following -size is, by default, 512-byte blocks not a byte count. The numeric must be followed by a 'c' for that. The following command will find files less than 2KB:

find . -type f -size -2048c -print

Conversely, for files greater than 2KB:

find . -type f -size +2048c -print

One note, the 512-byte block count does not directly translate into bytes. It's a long story. You can display a file's block usage with, under Solaris, ls -s. Stick to byte counts.

Oh, yes, one more thing, you can search for a specific range by using multiple -size expressions as long as they can all be satisfied by a single file. For example, locate files larger than 2KB and less than 8KB (inclusive):

find . -type f -size +2047c -size -8193c

Making VMD detect improperly named atoms

mol reanalyze does the job.
More here; http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/19657.html

Wednesday, March 28, 2012

List of webpages that have come handy

http://ubuntugeeknerd.blogspot.com/2010/01/you-have-not-chosen-to-trust-thawte.html

For a better solution, try this:
sudo ln -s /etc/ssl/certs/Thawte_Premium_Server_CA.pem /usr/lib/ICAClient/keystore/cacerts/

Useful when you get this error;
" Citrix SSL Error 61: You have not chosen to trust “Thawte Server CA”".

Tuesday, March 27, 2012

NAMD sample scripts

http://www.ks.uiuc.edu/Research/namd/2.7/ug/node64.html

This file demonstrates the analysis of a DCD trajectory file using NAMD. The file pair.pdb contains the definition of pair interaction groups; NAMD will compute the interaction energy and force between these groups for each frame in the DCD file. It is assumed that coordinate frames were written every 1000 timesteps. See Sec. 12.1 for more about pair interaction calculations.

# initial config
coordinates     alanin.pdb
temperature     0

# output params
outputname      /tmp/alanin-analyze
binaryoutput    no

# integrator params
timestep        1.0

# force field params
structure       alanin.psf
parameters      alanin.params
exclude         scaled1-4
1-4scaling      1.0
switching       on
switchdist      8.0
cutoff          12.0
pairlistdist    13.5
stepspercycle   20
 
# Atoms in group 1 have a 1 in the B column; group 2 has a 2.
pairInteraction  on
pairInteractionFile pair.pdb
pairInteractionCol B
pairInteractionGroup1 1
pairInteractionGroup2 2

# First frame saved was frame 1000.
set ts 1000

coorfile open dcd /tmp/alanin.dcd

# Read all frames until nonzero is returned.
while { ![coorfile read] } {
  # Set firstTimestep so our energy output has the correct TS.
  firstTimestep $ts
  # Compute energies and forces, but don't try to move the atoms.
  run 0
  incr ts 1000
}
coorfile close

Monday, March 5, 2012

Drawing arrows in Gimp

Gimp (Gnu image manipulation program) is an open source image editor/manipulator that I use regularly to edit images and add text. I often need to add arrows to images and for some strange reason Gimp does not have an arrow button by default. But thanks to
http://registry.gimp.org/node/20269 there is now an easy way to accomplish that. For my purposes, I found these values ideal;
I could have learned a lot by simply reading the asterisk which says that negative values indicate fractions. For example a value of -2 indicates that the length of wings is 1/2 of the length of arrow. A value of -8 for brush thickness indicates that the brush is 1/8th of the length of arrow. For very long arrows one should select very low negative values (-100 or -200) to get reasonable looking arrows.