18 January 2012

53. GROMACS -- carbon dioxide in water. Example

I'm new to GROMACS, so don't follow what I've done blindly.

To get started you need a .top and a .gro file. The .gro file is not dissimilar to a .pdb file and contains xyz coordinates and atom names. The .gro format is inflxible in that specific numbers of chars are dedicated to each field -- if that's Greek to you, then take this advice: don't edit it by hand. If you do, only substitute x number of characters with the same number of characters.

The .top file contains information about the atoms in each molecule and defines their properties, including partial charges, Lennar-Jones or Buckingham params, constraints etc.

 Making the .top file is probably the most challenging step when you are new to GROMACS. Once you've done it a few times it becomes easy, although perhaps somewhat tedious at times. Using a zmat file as your starting point may help (we'll do that here)

For each 'experiment' you need an .mdp file. The .mdp file defines what methods are used during the run, the type of experiment, cutoffs, etc.

In the example I use the gromacs binaries I compiled in an earlier post. To avoid confusion I'll use the double-precision (_dd) binaries the entire time. If you are using the debian gromacs binaries, use _d instead.

To start you need co2.gro, step1.top, em.mdp, eq.mdp, eq2.mdp and production.mdp. The rest of the files are generated

Comments are added to gromacs files by adding a ; in front.

Summary of commands that we'll be using after we have our .gro and .top files:

genbox_dd -cp co2.gro -o step1.gro -cs /usr/local/gromacs/share/gromacs/top/spc216.gro -p step1.top
# energy minimisation
grompp_dd -f em.mdp -po step3.mdp -p step1.top -pp step2.top -c step1.gro -o step3.tpr
mdrun_dd -v -s step3.tpr -o step4.trr -x step4.xtc -cpo step4.cpt -c step4.gro -e step4.edr -g step4.log
# equilibration step 1
grompp_dd -f eq.mdp -po step6.mdp -p step2.top -pp step6.top -c step4.gro -o step6.tpr
mdrun_dd -v -s step6.tpr -o step7.trr -x step7.xtc -cpo step7.cpt -c step7.gro -e step7.edr -g step7.log
# equilibration step 2
grompp_dd -f eq2.mdp -po step8.mdp -p step6.top -pp step8.top -c step7.gro -o step8.tpr
mdrun_dd -v -s step8.tpr -o step9.trr -x step9.xtc -cpo step9.cpt -c step9.gro -e step9.edr -g step9.log
# production run
grompp_dd -f production.mdp -po step10.mdp -p step8.top -pp step10.top -c step9.gro -o step10.tpr
mdrun_dd -v -s step10.tpr -o step11.trr -x step11.xtc -cpo step11.cpt -c step11.gro -e step11.edr -g step11.log 


START HERE
If at any point you get annoying fatal errors, your first thought should be 'formatting'. I don't know how faithful blogspot is towards tabs etc. Google -- if you're listening: please allow the upload of simple ascii files! Oh, and while we're at it -- if I'm emailing text files with unix line endings, don't effing change them to windows line endings! Ehum...so...


1. Making a .gro file
I first made an .xyz file using avogadro and optimised it using the built-in MM engine.

co2.xyz:

3

C         -5.06401        3.32301        1.92535
O         -4.89871        1.97004        1.81668
O         -5.22923        4.67528        2.03397


I edited the file to
1. Add a title card (not important)
2. give the atoms specific names (the names aren't important -- but they should match those used in .top). I decided to call the carbon CO and the Oxygens OC since the C is bonded to O and the Os are bonded to C. The names must be 1-5 characters long.

co2_edited.xyz:

3
CAR
CO         -5.06401        3.32301        1.92535
OC         -4.89871        1.97004        1.81668
OC         -5.22923        4.67528        2.03397

Next, we make our .gro file and set the box size to 2 by 2 by 2 nanometres:
editconf_dd -f co2_edited.xyz -o co2.gro -box 2 2 2 -label CAR -resnr 1
co2.gro:

CAR
    3
    1 ???    CO    1   1.000   1.000   1.000
    1 ???    OC    2   1.017   0.865   0.989
    1 ???    OC    3   0.983   1.135   1.011
   2.00000   2.00000   2.00000
I opened co2.gro in vim and did 
:%s/???/CAR/g
the saved using 
:wq

co2.gro:
CAR
    3
    1 CAR    CO    1   1.000   1.000   1.000
    1 CAR    OC    2   1.017   0.865   0.989
    1 CAR    OC    3   0.983   1.135   1.011
   2.00000   2.00000   2.00000

This is our starting .gro file.


2. Making our .top file
I first made a zmat file since it contains angles and bond lengths. CO2 is a simple enough molecule that this isn't necessary, but it's good to have a standard approach.

If you haven't yet installed babel, then do so:
sudo apt-get install openbabel

Generate the zmat file:
babel co2.xyz co2.gzmat

co2.gzmat:
 CAR
0  1
Co
Xx  1  r2
Xx  1  r3  2  a3
Variables:
r2= 1.3674
r3= 1.3666
a3= 179.97

For an explanation of the zmat format, look here.

OK, time to create our .top file

Open a new file and call it step1.top

First create directive headers to outline the file -- we will have to types of molecules -- CAR (CO2) -- and SOL (water), so we have two sets of [molecultypes] (+ [atoms], [constraints] etc.):
[defaults]
[atomtypes]
[moleculetype]
[atoms]
[constraints]
[exclusions]
[angles]
[dihedrals]
[moleculetype]
[atoms]
[constraints]
[exclusions]
[system]
[molecules]


The order of the different directive is (sadly) important. 

OK, time to add information to the different sections -- let's start with the easy ones:

[defaults]:
[defaults]
; nbfunc comb-rule gen-pairs fudgeLJ fudgeQQ
1 1 yes 1.0 1.0

This is a standard directive when you roll your own simulation independent of predefined forcefields. nbfunc=1 means we're using Lennard-Jones c6/c12 parameters.

[system]:
[system]
sparkling water

[system] is basically like a title-card

[molecules]:
[molecules]
CAR      1
SOL      1

OK, time to define our carbon dioxide molecule:
[moleculetype]:
[moleculetype]
;name nrexcl
CAR    3
CAR is the name and nrexcl=3 tells gromacs to exclude non-bonded interactions between atoms that are no further than 3 bonds away.

For atoms the order should be the same as in the .gro file. Here CO  and the two OC make up a single charge group (all have the same cgnr=1). I got the partial charges from an article -- http://pubs.acs.org/doi/full/10.1021/jp062723w.

The type (e.g. CO) must match that which will later be defined in [atomtypes]. atom (e..g CO) must match that in the .gro file. mass is self-explanatory, as is nr.

[atoms]
[atoms]
;   nr   type  resnr residue  atom   cgnr     charge       mass
1 CO 1 CAR CO 1 0.70         12.0107
2 OC 1 CAR OC 1 -0.35 15.9994
3 OC 1 CAR OC 1 -0.35 15.9994

We will constrain the bond distances -- which we got from the zmat file above (r2 and r3 -- I picked 1.3674 Ångström, which is 0.13674 nm:

[constraints]:
; particles bonded if defined in bonds (1, 5, 6) or constraints
[constraints]
;ai     aj func bond
1 2 1 0.13674
1 3 1 0.13674
[exclusions]:
 [exclusions]
;ai other atoms
1 2 3
2 1 3
3 1 2
Exclusions excludes non-bonded interactions between atom ai and the other atoms listed on the same line. It's probably not necessary in such a small molecule.

[angles]:

[angles]
2 1 3   1 180 1500

There's only one angle -- atom 1 is carbon, so the angle is across O=C=O, or 2=1=3 or, if you prefer, 3=1=2 -- look at atom nr. We know that the angle is 180 degrees, but the zmat data also gave us that. Again, useful for more complex molecules.

Comment out dihedral, since there aren't any. You should be aware of the existence of it though.
[dihedrals]:
;[dihedrals]

Water:
We do the same thing for water, just without explanations. This was copied verbatim from the gromacs manual. Look there for information about [settles]

[ moleculetype ]
; molname nrexcl
SOL 2
[ atoms ]
;   nr   type  resnr residue  atom   cgnr     charge       mass
     1     OW      1    SOL     OW      1    -0.8476   15.99940
     2     HW      1    SOL    HW1      1     0.4238    1.00800
     3     HW      1    SOL    HW2      1     0.4238    1.00800
;[ constraints ]
; ai aj funct length(b0, nm) kb(kJ mol-1 nm-2)
;  1 2 1 0.100 ;  1 3 1 0.100 ;  2 3 1 0.1633
[ settles ]
;ai funct doh dhh
 1 1 0.1 0.1633
[ exclusions ]
1       2       3
2       1       3
3       1       2

We've so far avoided [atomtypes], which is probably the MOST IMPORTANT directive.

[atomtypes]:
[atomtypes]
;type z       mass        pq          ptype    c6                 c12
OC 8 15.9994 -0.35 A 2.5438e-1 2.0478e-4
CO 6 12.0107 0.70 A 5.2044e-2 2.5080e-5
OW 8 15.9994 -0.834 A 0.261710e-2 0.26331e-05
HW 1 1.0080 0.417 A 0.0000000000 0.00000e-00

So how did we get here?
Let's look at the first line:

OC is the atom type which we'll refer to under the [atoms] directives.
8 is the atomic number of oxygen.
15.9994  is the average atomic mass of carbon.
-0.35 is the partial charge. For carbon CO and oxygen OC I got it from http://pubs.acs.org/doi/full/10.1021/jp062723w. However, in the following post from 2011: "The charges from [atoms] are used. The charges in [atomtypes] are never used in any forcefield currently used with GROMACS."
A is the particle type -- A stands for Atom
2.5438e-1 is the Lennard-Jones c6 parameter for the carbon dioxide carbon -- I got it from here which gives epsilon and sigma: c6=4*epsilon*sigma^6
2.0478e-4 is the Lennard-Jones c12 parameter for the carbon dioxide carbon -- I got it from here which gives epsilon and sigma: c12=4*epsilon*sigma^12. (sigma_o=0.305 nm; epsilon_o=79 K; sigma_c=0.280 nm; epsilon_c=27 K)

I got OW and HW from a different source.

Finally, here's our entire step1.top:

[defaults]
1 1 yes 1.0 1.0
;http://pubs.acs.org/doi/full/10.1021/jp062723w
;
[atomtypes]
; sigma_o=0.305 nm; epsilon_o=79 K; sigma_c=0.280; epsilon_c=27
OC 8 15.9994 -0.35 A 2.5438e-1 2.0478e-4
CO 6 12.0107 0.70 A 5.2044e-2 2.5080e-5 OW 8 15.9994 -0.8476 A   0.261710e-2  0.26331e-05
HW 1 1.0080 0.4238 A 0.0000000000 0.00000e-00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [moleculetype]
CAR 3
[atoms]
1 CO 1 CAR CO 1 0.70 12.0107
2 OC 1 CAR OC 1 -0.35 15.9994
3 OC 1 CAR OC 1 -0.35 15.9994
; particles bonded if defined in bonds (1, 5, 6) or constraints
[constraints]
; func bond
1 2 1 0.13674
1 3 1 0.13674
;all non-bonded interactions between atom 1 and the other atoms ignored
[exclusions]
1 2 3
2 1 3
3 1 2
[angles]
2 1 3   1 180 1500
;[dihedrals]
;no dihedrals
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[ moleculetype ]
; molname nrexcl
SOL 2
[ atoms ]
;   nr   type  resnr residue  atom   cgnr     charge       mass
     1     OW      1    SOL     OW      1    -0.8476   15.99940
     2     HW      1    SOL    HW1      1     0.4238    1.00800
     3     HW      1    SOL    HW2      1     0.4238    1.00800
;[ constraints ]
; ai aj funct length(b0, nm) kb(kJ mol-1 nm-2)
;  1 2 1 0.100 ;  1 3 1 0.100 ;  2 3 1 0.1633
[ settles ]
;ai funct doh dhh
 1 1 0.1 0.1633
[ exclusions ]
1       2       3
2       1       3
3       1       2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[system]
fizzy water
[molecules]
CAR 1
SOL               212

3. Add water
We use co2.gro and step1.top as the input. We get our water molecules from /usr/local/gromacs/share/gromacs/top/spc216.gro. We write a new .gro file, step1.gro. It will have our carbon dioxide molecule (CAR) and 212 water molecules (SOL).

genbox_dd -cp co2.gro -o step1.gro -cs /usr/local/gromacs/share/gromacs/top/spc216.gro -p step1.top

Ideally genbox_dd updates step1.top and puts the correct number of SOL molecules under [molecules], but please check.

[..]
Successfully made neighbourlist
nri = 11519, nrj = 660245
Checking Protein-Solvent overlap: tested 92 pairs, removed 9 atoms.
Checking Solvent-Solvent overlap: tested 13414 pairs, removed 540 atoms.
Added 212 molecules
Generated solvent containing 636 atoms in 212 residues
Writing generated configuration to step1.gro
Back Off! I just backed up step1.gro to ./#step1.gro.1#
CAR
Output configuration contains 639 atoms in 213 residues
Volume                 :           8 (nm^3)
Density                :      811.63 (g/l)
Number of SOL molecules:    212
Processing topology
[..]
4. Do energy minimisation (EM):
We first need our em.mdp to tell mdrun what to do. Like all the other .mdp files they originally come from http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin/gmx-tutorials/lysozyme/01_pdb2gmx.html, and have been used with a minimal amount of editing.

em.mdp:

; minim.mdp - used as input into grompp to generate em.tpr
; Parameters describing what to do, when to stop and what to save
integrator = steep ; Algorithm (steep = steepest descent minimization)
emtol = 1000.0   ; Stop minimization when the maximum force < 1000.0 kJ/mol/nm
emstep          = 0.01               ; Energy step size
nsteps = 50000   ; Maximum number of (minimization) steps to perform
; Parameters describing how to find the neighbors of each atom and how to calculate the interactions
nstlist = 1         ; Frequency to update the neighbor list and long range forces
ns_type         = grid ; Method to determine neighbor list (simple, grid)
rlist              = 0.9         ; Cut-off for making neighbor list (short range forces)
coulombtype = PME ; Treatment of long range electrostatic interactions
rcoulomb = 0.9 ; Short-range electrostatic cut-off
rvdw = 0.9 ; Short-range Van der Waals cut-off
pbc          =  xyz         ; Periodic Boundary Conditions (yes/no)
Alright. Let's make our binary .trp file using our step1.top and our step1.gro. We'll use the binary trp file with mdrun in the next step. grompp also output a new top file, step2.top, for us, as well as a new .mdp file, step3.mdp.The latter doesn't matter to us.

grompp_dd -f em.mdp -po step3.mdp -p step1.top -pp step2.top -c step1.gro -o step3.tpr
mdrun_dd -v -s step3.tpr -o step4.trr -x step4.xtc -cpo step4.cpt -c step4.gro -e step4.edr -g step4.log

This step is fast, and we get
Steepest Descents converged to Fmax < 1000 in 36 steps
Potential Energy  = -9.52113394667855e+03
Maximum force     =  5.44327588453194e+02 on atom 1
Norm of force     =  7.44126862763805e+01

5. Equilibration part 1
title = fizzy drink
define = -DPOSRES ; position restrain the protein
; Run parameters
integrator = md ; leap-frog integrator
nsteps = 90000 ; 2 * 50000 = 100 ps
dt = 0.002 ; 2 fs
; Output control
nstxout = 100 ; save coordinates every 0.2 ps
nstvout = 100 ; save velocities every 0.2 ps
; ; no nstxtcout
nstenergy = 100 ; save energies every 0.2 ps
nstlog = 100 ; update log file every 0.2 ps
; Bond parameters
continuation = no ; first dynamics run
constraint_algorithm = lincs ; holonomic constraints
constraints = all-bonds ; all bonds (even heavy atom-H bonds) constrained
lincs_iter = 1 ; accuracy of LINCS
lincs_order = 4 ; also related to accuracy
; Neighborsearching
ns_type = grid ; search neighboring grid cells
nstlist = 5 ; 10 fs
rlist = 0.9 ; short-range neighborlist cutoff (in nm)
rcoulomb = 0.9 ; short-range electrostatic cutoff (in nm)
rvdw = 0.9 ; short-range van der Waals cutoff (in nm)
; Electrostatics
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics
pme_order = 4 ; cubic interpolation
fourierspacing = 0.16 ; grid spacing for FFT
; Temperature coupling is on
tcoupl = V-rescale ; modified Berendsen thermostat
tc-grps = CAR SOL ; two coupling groups - more accurate
tau_t = 0.1 0.1 ; time constant, in ps
ref_t = 300 300 ; reference temperature, one for each group, in K
;;;;;;;;;;;;;;;;;;;;;
; no pressure coupling
;;;;;;;;;;;;;;;;;;;;;;;;;
; Pressure coupling is off
pcoupl = no ; no pressure coupling in NVT
;
;
;
;
; Periodic boundary conditions
pbc = xyz ; 3-D PBC
; Dispersion correction
DispCorr = EnerPres ; account for cut-off vdW scheme
; Velocity generation
gen_vel = yes ; assign velocities from Maxwell distribution
gen_temp = 300 ; temperature for Maxwell distribution
gen_seed = -1 ; generate a random seed
We then run:
grompp_dd -f eq.mdp -po step6.mdp -p step2.top -pp step6.top -c step4.gro -o step6.tpr
mdrun -v -s step6.tpr -o step7.trr -x step7.xtc -cpo step7.cpt -c step7.gro -e step7.edr -g step7.log

which gives
step 90000, remaining runtime:     0 s        
 Average load imbalance: 2.7 %
 Part of the total run time spent waiting due to load imbalance: 1.0 %
 Steps where the load balancing was limited by -rdd, -rcon and/or -dds: X 0 %

Parallel run - timing based on wallclock.
               NODE (s)   Real (s)      (%)
       Time:     27.299     27.299    100.0
               (Mnbf/s)   (GFlops)   (ns/day)  (hour/ns)
Performance:    258.447     15.110    569.700      0.042


See this tutorial for an explanation of the two-step equilibration approach that we're using. I use 90000 steps instead of 10000, and it really doesn't matter at this stage.

6. Equilibration part 2
eq2.mdp:
title = fizzy drink
define = -DPOSRES ; position restrain the protein
; Run parameters
integrator = md ; leap-frog integrator
nsteps = 90000 ; 2 * 50000 = 100 ps
dt = 0.002 ; 2 fs
; Output control
nstxout = 100 ; save coordinates every 0.2 ps
nstvout = 100 ; save velocities every 0.2 ps
; ; no nstxtcout
nstenergy = 100 ; save energies every 0.2 ps
nstlog = 100 ; update log file every 0.2 ps
; Bond parameters
continuation = yes ; <---  Restarting after NVT
constraint_algorithm = lincs ; holonomic constraints
constraints = all-bonds ; all bonds (even heavy atom-H bonds) constrained
lincs_iter = 1 ; accuracy of LINCS
lincs_order = 4 ; also related to accuracy
; Neighborsearching
ns_type = grid ; search neighboring grid cells
nstlist = 5 ; 10 fs
rlist = 0.9 ; short-range neighborlist cutoff (in nm)
rcoulomb = 0.9 ; short-range electrostatic cutoff (in nm)
rvdw = 0.9 ; short-range van der Waals cutoff (in nm)
; Electrostatics
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics
pme_order = 4 ; cubic interpolation
fourierspacing = 0.16 ; grid spacing for FFT
; Temperature coupling is on
tcoupl = V-rescale ; modified Berendsen thermostat
tc-grps = CAR SOL ; two coupling groups - more accurate
tau_t = 0.1 0.1 ; time constant, in ps
ref_t = 300 300 ; reference temperature, one for each group, in K
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; turning on pressure coupling
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; <-- Pressure coupling is on
pcoupl = Parrinello-Rahman ; Pressure coupling on in NPT
pcoupltype = isotropic ; uniform scaling of box vectors
tau_p = 2.0 ; time constant, in ps
ref_p = 1.0 ; reference pressure, in bar
compressibility = 4.5e-5 ; isothermal compressibility of water, bar^-1
; Periodic boundary conditions
pbc = xyz ; 3-D PBC
; Dispersion correction
DispCorr = EnerPres ; account for cut-off vdW scheme
; Velocity generation
gen_vel = no ; <-- Velocity generation is off
;
;


and we run
grompp_dd -f eq2.mdp -po step8.mdp -p step6.top -pp step8.top -c step7.gro -o step8.tpr
mdrun_dd -v -s step8.tpr -o step9.trr -x step9.xtc -cpo step9.cpt -c step9.gro -e step9.edr -g step9.lo

The mdrun takes 43 seconds on an intel i5 with four cores.

7. Production run
production.mdp:
title = fizzy water
; removed define
; Run parameters
integrator = md ; leap-frog integrator
nsteps = 500000 ; 2 * 500000 = 1000 ps, 1 ns
dt = 0.002 ; 2 fs
; Output control
nstxout = 1000 ; save coordinates every 2 ps. Incr by *10
nstvout = 1000 ; save velocities every 2 ps. Incr by *10
nstxtcout = 1000 ; xtc compressed trajectory output every 2 ps. Incr by *10
nstenergy = 1000 ; save energies every 2 ps. Incr by *10
nstlog = 1000 ; update log file every 2 ps. Incr by *10
; Bond parameters
continuation = yes ; <-- Restarting after NPT
constraint_algorithm = lincs ; holonomic constraints
constraints = all-bonds ; all bonds (even heavy atom-H bonds) constrained
lincs_iter = 1 ; accuracy of LINCS
lincs_order = 4 ; also related to accuracy
; Neighborsearching
ns_type = grid ; search neighboring grid cells
nstlist = 5 ; 10 fs
rlist = 0.9 ; short-range neighborlist cutoff (in nm)
rcoulomb = 0.9 ; short-range electrostatic cutoff (in nm)
rvdw = 0.9 ; short-range van der Waals cutoff (in nm)
; Electrostatics
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics
pme_order = 4 ; cubic interpolation
fourierspacing = 0.16 ; grid spacing for FFT
; Temperature coupling is on
tcoupl = V-rescale ; modified Berendsen thermostat
tc-grps = CAR SOL ; two coupling groups - more accurate
tau_t = 0.1 0.1 ; time constant, in ps
ref_t = 300 300 ; reference temperature, one for each group, in K
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; turning on pressure coupling
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; <-- Pressure coupling is on
pcoupl = Parrinello-Rahman ; Pressure coupling on in NPT
pcoupltype = isotropic ; uniform scaling of box vectors
tau_p = 2.0 ; time constant, in ps
ref_p = 1.0 ; reference pressure, in bar
compressibility = 4.5e-5 ; isothermal compressibility of water, bar^-1
; Periodic boundary conditions
pbc = xyz ; 3-D PBC
; Dispersion correction
DispCorr = EnerPres ; account for cut-off vdW scheme
; Velocity generation
gen_vel = no ; <-- Velocity generation is off
;
;

and we run
grompp_dd -f production.mdp -po step10.mdp -p step8.top -pp step10.top -c step9.gro -o step10.tpr
mdrun_dd -v -s step10.tpr -o step11.trr -x step11.xtc -cpo step11.cpt -c step11.gro -e step11.edr -g step11.log 

The last run takes four minutes on four cores.

8. Analysis
Again, this follows  this tutorial almost verbatim:
trjconv -s step10.tpr -f step11.xtc -o step12.xtc -pbc mol 



RMS during production run for CAR/SOL:
g_rms -s step10.tpr -f step12.xtc -o step13_rms.xvg -tu ns




CAR
g_gyrate -s step10.tpr -f step12.xtc -o step14_gyrate.xvg

CAR/SOL:
g_rdf -s step10.tpr -f step11.xtc -o step15_rdf.xvg 

And the video has as usual been compressed to something ugly and useless by blogger:
video


17 January 2012

52. Network (hosts) setting for mpich2 /mpd on debian

I have a switch with three computers attached two it. The ip addresses are static and are 192.168.1.1 (beryllium), 192.168.1.101 (boron), 192.168.1.102 (tantalum)

I use the computers to run nwchem across several nodes. The default /etc/chosts settings cause problems when trying to connect different instances of mpd on different nodes.

e.g.

beryllium: /etc/hosts
127.0.0.1 localhost  beryllium
192.168.1.101 boron
192.168.1.102 tantalum

Won't work, but 
127.0.0.1 localhost
192.168.1.1  beryllium
192.168.1.101 boron
192.168.1.102 tantalum

Will.

See for example:

Using /etc/hosts:
127.0.0.1 localhost  beryllium
192.168.1.101 boron
192.168.1.102 tantalum

me@tantalum:~$ mpdtrace -l
tantalum_51108 (192.168.1.102)

me@beryllium:~$ mpd --ncpus=6 -h 192.168.1.102 -p 51108 &
[2] 26283

me@tantalum:~$ mpdtrace -l
tantalum_51108 (192.168.1.102)
beryllium_38569 (127.0.0.1)

See the ip address (127.0.0.1)? tantalum sees 127.0.0.1, which is it's localhost (i.e. also tantalum). It should point at beryllium (192.168.1.1)

Using /etc/hosts:
127.0.0.1 localhost
192.168.1.1 beryllium
192.168.1.101 boron
192.168.1.102 tantalum


me@tantalum:~$ mpdtrace -l
tantalum_58007 (192.168.1.102)

me@beryllium:~$ mpd --ncpus=6 -h 192.168.1.102 -p 58007 &
[2] 26596

me@tantalum:~$ mpdtrace -l
tantalum_58007 (192.168.1.102)
beryllium_56234 (192.168.1.1)

And now it looks better.

"But /etc/hosts keeps changing on reboot!"
Which is because Network Manager keeps fiddling with it. Look at point 6 here http://verahill.blogspot.com/2012/01/debian-testing-64-wheezy-small-fixes.html

I haven't figured out how to do this via the command line yet.

50. Sharing an internet connection over a network switch on debian

What it does: One computer has two network cards. One card is used to connect to the internet, the other one is connected to a switch making up a local network. Two more computers are connected to the switch. They all share the internet connection of the first computer. All computers on the local network can ssh into each other.

I have to register the MAC address of each computer which I want to connect to the network at work. The reason probably has more to do with cost than security.

I do not use /etc/network/interfaces in this example
Instead we're only using Network Manager, but from the CLI.

The sharing is enabled using Firestarter. You can probably figure out how to use it yourself without reading this rather lengthy post, but I'll leave it all up here in case you want to know the exact configuration.

Since I use apt-cache to cut down on network traffic (http://verahill.blogspot.com/2012/01/debian-testing-64-wheezy-apt-cache.html) I don't feel too bad about surreptitiously putting a few additional units online.

This is my network:

internet ----- eth0 -Beryllium - eth2 --- switch----( eth0-tantalum, eth0-boron)

Or in words --  I have three computers. One, Beryllium, has two network cards, eth0 and eth1. eth0 is connected to the internet (dhcp). eth1 is connected to a gigabit switch (essentially a dumb router -- no dhcp). Two more computers are connect to the same switch -- Tantalum (eth0) and Boron (eth0). Tantalum has local ip address 192.168.1.102 and Boron has ip address 192.168.1.101.

I do have an additional ethernet card on Beryllium, eth1, which we will ignore.

This way of sharing an internet connection relies on firestarter, which has one problem -- it won't (easily) allow two network cards on the same local network i.e. if eth0 is connected to the internet and you want both eth1 and eth2 on the same local network, firestarter won't help you.

I also need to be able to ssh from any computer on the local network to any other computer on the local network. This method allows for that. Same goes for apt-cache and mpich.

To satisfy my paranoia I've replaced a lot of the more incriminating numbers with X's.


Firestarter:
Firestarter is a firewall -- you'd typically use it to restrict traffic, not enable it. But iptables -- the true firewall and traffic shaper of linux -- is a powerful and slightly odd beast, and firestarter provides a gui-friendly way of editing some aspects of it.

Install firestarter on your internet connected computer (here, beryllium):
sudo apt-get install firestarter

Start it:
sudo firestarter

Chances are it will ask you questions about internet connected network device -- which is eth0 -- and local network connected device -- here it's eth2. Also, check Enable internet connection sharing. If it doesn't ask you, go to Edit, Preferences and select Firewall -- Network Settings.

In my case I've set it up for static ip. I would suspect it to be fairly easy to set up dhcp as well.

I don't know how to put TWO network cards from the same computer on the same local network.

In the main firestarter windows, under policy, you might want to add the IP addresses of the computers on the local network under 'Allow connections from host' -- but that depends on your needs. I prefer to expose all ports in order to deal with mpich.

You may also want to edit what services are allowed. Firestarter is fairly simple to use.


Configuration: Beryllium
eth0 is connected to the internet, and is assigned an IP address by the university using dhcp.
eth2 is connect to the switch and I've manually set the IP address to 192.168.1.1 in network manager. You can edit the file (see below) directly.

The gateway for eth2 is set to 192.168.1.1. Subnet mask is 255.255.255.0 which shows up as 24 in the configuration file below (i.e. 192.168.1.1;24;192.168.1.2 would mean IP 192.168.1.1, subnet 255.255.255.0 and gateway 192.168.1.2)

sudo cat /etc/NetworkManager/system-connections/eth0
[802-3-ethernet]
duplex=full
mac-address=XX:XX:XX:XX:XX:XX
[connection]
id=eth0
uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
type=802-3-ethernet
timestamp=1326324509
[ipv6]
method=auto
[ipv4]
method=auto


sudo cat /etc/NetworkManager/system-connections/eth2
[802-3-ethernet]
duplex=full
mac-address=XX:XX:XX:XX:XX:XX
[connection]
id=eth2
uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
type=802-3-ethernet
timestamp=1326690564
[ipv6]
method=auto
[ipv4]
method=manual
addresses1=192.168.1.1;24;192.168.1.1;

Configuration: Tantalum
sudo cat /etc/NetworkManager/system-connections/eth0

[802-3-ethernet]
duplex=full
mac-address=XX:XX:XX:XX:XX:XX
[connection]
id=lan
uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
type=802-3-ethernet
timestamp=1326152420
[ipv6]
method=auto
[ipv4]
method=manual
dns=XXX.XXX.1.99;
addresses1=192.168.1.102;24;192.168.1.1;


Configuration: Boron
sudo cat /etc/NetworkManager/system-connections/eth0

[802-3-ethernet]
duplex=full
mac-address=XX:XX:XX:XX:XX:XX
[connection]
id=lan
uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
type=802-3-ethernet
timestamp=1326152420
[ipv6]
method=auto
[ipv4]
method=manual
dns=XXX.XXX.1.99;
addresses1=192.168.1.101;24;192.168.1.1;

Quick word on apt-cache:
If you follow this guide: http://verahill.blogspot.com/2012/01/debian-testing-64-wheezy-apt-cache.html
and you're running your apt-cache server on 192.168.1.1 in the example above, change your /etc/apt/sources.list so that
deb http://192.168.1.2:3142/ftp.au.debian.org/debian/ testing main contrib non-free
becomes
deb http://192.168.1.2:3142/ftp.au.debian.org/debian/ testing main contrib non-free


49. Gromacs -- hangs on multicore when doing normal mode analysis

Symptom:
when doing
mdrun -s nm.tpr -mtx nm.mtx -v -deffnm nm
on a system with 637 atoms you end up with:
...Finish step 636 out of 637
and it hangs there with all cores running at 100%

Reason:
For some reason the normal mode analysis of at least this particular system won't run on multiple cores.

Solution:
Use an mpi compiled version of mdrun (see previous posts on compiling _dd, _mpi and _ddmpi versions of gromacs) and force the use of ONE core.

mpd --ncpus=4 &
mpdrun -n 1 mdrun_mpi -s nm.tpr -mtx nm.mtx -v -deffm nm

works!

Confirmation
This was confimed by running it on four computers:
64 bit: a six core AMD 64 using a compiled version of gromacs. Hangs.
64 bit: a four core intel i5 using both the debian version and a compiled version of gromacs. Hangs.
64 bit: an older four core intel using a compiled version of gromacs. Hangs.
32 bit: an old single-core laptop using the debian version of gromacs. Works.

Next, three single-core virtual machines were set up -- a stable 32 bit, a testing 32 bit and a testing 64 bit machine, all with the debian version of gromacs (sudo apt-get install gromac). They all worked, as they only had a single core.





12 January 2012

48. nvidia gt520 issues and solutions on debian testing

EDIT: see here for a Linux Mint Debian Edition take on the GT 520 nouveau issue -- http://community.linuxmint.com/tutorial/view/824

EDIT: Someone made a succinct how-to for nvidia driver installation on debian: http://blog.libremath.org/2012/04/07/debian-nvidia-quick-guide/ NOTE: site seems to be down.

--start here --
I recently bought an nvidia gt520 1 GB graphics card. To my surprise it turned out to be a bit of a pain to actually get it working properly.

Sadly, we don't always document all the steps when trying to get something to work, but here's roughly what I remember.

The problem:
I plugged the nvidia gt520 into the pci express slot, connected the vga cable to the vga socket on the new graphics card and started my computer. My setup autostarts gdm3. Everything went fine -- the boot messages were flashing by as per normal, then gdm3 started. And got stuck. I experience two different types of hanging  -- either just a black screen, or a black screen with a single cursor indicator (a single _ in the top left corner).

Logging in remotely (had ssh server running) and looking at top I could see that gdm3 was using up 50+% cpu power. Leaving the system for half an hour didn't allow for any progress.

Also, even when I did ctrl+alt+f1 to bring up tty1 I would be forcibly returned to tty7 over and over again. Trying to fix anything was thus difficult. After doing ctrl+alt+f1 a few times and being thrown around it would stop responding and strange symbols would appear on the screen when trying to use the keyboard.

One last piece of information: my onboard graphics is nvidia as well, but this probably isn't relevant.

Logging in remotely I tried using the excellent smxi / sgfxi scripts (http://smxi.org/) to install the proper graphics drivers. I tried nouveau, debian-nvidia and nvidia-current . I also tried just deleting /etc/X11/xorg.conf and hoping for the best

Diagnosis:
First I made sure gmd wasn't starting anymore so that the computer wouldn't hang and I'd be able to work in peace:
sudo vim /etc/default/grub

CMD_LINUX_DEFAULT="quiet splash"
was changed to
CMD_LINUX_DEFAULT="quiet splash text"
(there may be other things on the same line -- just add text)

Then to make the changes take effect,
sudo update-grub
and reboot

Second I tried unloading any modules

sudo rmmod nouveau
sudo rmmod nvidia

I edited /etc/modules and commented out nvidia, and made sure nouveau was there. I also edited etc/modprobe.d/nvidia-kernel-common.conf and commented out blacklist nouveau.

I then tried installing the nouveu driver a last time
sudo sgfxi -N nouveau
and rebooted
After the reboot had completed dmesg| grep nouv gave me the clue I needed -- the drivers had failed to load! I don't remember what the exact message was, but it was all about failure.


Solution:
(also see first post below)

I removed the xorg.conf
sudo rm /etc/X11/xorg.conf
then
startx
The desktop started! But I found myself in fallback mode -- the graphics acceleration obviously wasn't working -- but that wasn't a surprise since the drivers had failed to load.

I then ran
sudo rmmod nouveau
sudo apt-get install nvidia-kernel-dkms nvidia-settings nvidia-smi nvidia-xconfig
sudo nvidia-xconfig
startx

It worked!

My autogenerated /etc/modprobe.d/nvidia-kernel-common.conf now looks like this again:
alias char-major-195* nvidia

options nvidia NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=44 NVreg_DeviceFileMode=0660
# To enable FastWrites and Sidebus addressing, uncomment these lines
# options nvidia NVreg_EnableAGPSBA=1
# options nvidia NVreg_EnableAGPFW=1

# see #580894
blacklist nouveau

Remember to remove any mention of nouveau in /etc/modules.

You can change your /etc/default/grub back to the way it was again to make gdm start again every time.

Edit: Reading between the lines it seems that Squeeze may not have the proper drivers available for GT520 -- binary installation using smxi might be a good idea in that case: http://forums.debian.net/viewtopic.php?f=17&t=72876

Lengthy output follows:

Here's dmesg | grep nvidia

###############################
[    7.192358] nvidia: module license 'NVIDIA' taints kernel.
[    7.278115] nvidia 0000:02:00.0: PCI INT A -> Link[LNED] -> GSI 18 (level, low) -> IRQ 18
[    7.278122] nvidia 0000:02:00.0: setting latency timer to 64
###############################


Here's lspci -vvnn



###############################


02:00.0 VGA compatible controller [0300]: nVidia Corporation GF119 [GeForce GT 520] [10de:1040] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Giga-byte Technology Device [1458:3520]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 18
Region 0: Memory at df000000 (32-bit, non-prefetchable) [size=16M]
Region 1: Memory at d0000000 (64-bit, prefetchable) [size=128M]
Region 3: Memory at dc000000 (64-bit, prefetchable) [size=32M]
Region 5: I/O ports at ec00 [size=128]
[virtual] Expansion ROM at def80000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nvidia

###############################


Here's lshw -C display (run as user)
###############################
WARNING: you should run this program as super-user.

  *-display            
       description: VGA compatible controller
       product: GF119 [GeForce GT 520]
       vendor: nVidia Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:18 memory:df000000-dfffffff memory:d0000000-d7ffffff memory:dc000000-ddffffff ioport:ec00(size=128) memory:def80000-deffffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
###############################


And here's the xorg.conf:


###############################


# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 290.10  (pbuilder@cake)  Wed Nov 23 11:33:47 UTC 2011

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubS


###############################



Links to this page:
http://community.linuxmint.com/tutorial/view/824

11 January 2012

47. A step on the way to compiling the omnibook apci drivers on debian testing

First, see here:
http://sourceforge.net/projects/omnibook/
http://home.comcast.net/~rickrich1/toshiba-1115-s103/omnibook.txt

I have an old toshiba satellite a205 which has a fan that turns on at 50 degrees and turns off at 45 degrees. It's a much too narrow range, so the fan is starting up every two minutes or so -- having it turn off at 40 degrees would probably make more sense. To this effect I wanted to see if I could get apci fan support.

In the end I don't seem to have succeeded, but here's what I did manage to do, and what happened:

Go:
Install build-essential and the kernel headers for your kernel

git clone git://omnibook.git.sourceforge.net/gitroot/omnibook/omnibook
cd omnibook/

vim polling.c
comment out lines 128:
//        cancel_rearming_delayed_workqueue(omnibook_wq, &omnibook_poll_work);

and 191 using // :
//            cancel_rearming_delayed_workqueue(omnibook_wq, &omnibook_poll_work);

Run:
sudo make load

Read through doc/INSTALL, then


WARNING:
Some say that loading with the wrong ectype can be bad for you computer. My guess is that things will be fine as long as you don't put the computer on heavy load while trying the method below out so that you don't risk burning anything.

OK, time to try the shotgun approach:
var=1 && sudo rmmod omnibook && sudo modprobe omnibook ectype=$var && ls /proc/omnibook

Do this with values of var from 1-16. See which one gives the 'best' support. For me most things showed up for all ectypes between 1 and 10, but only ectype=1 show fan_policy

Next do cat /proc/omnibook/fan , cat /proc/omnibook/display, cat /proc/omnibook/battery etc. to see whether the settings seem to correspond to reality.

ectypes
I can't find the original document which details the different ectypes and the corresponding laptop models. Your best guess is to do like I did above (just trying randomly) or to google for omnibook and ectype and see which model is closer to yours.

Making omnibook load on boot:
vim /etc/modules
add a line saying
omnibook

and the create a file called omnibook.conf under /etc/modprobe.d
In /etc/modprobe.d/omnibook.conf you put a single line:
options modprobe ectype=12

cat /proc/omnibook/fan_policy gives

Fan off temperature:         0 C
Fan on temperature:          0 C
Fan level 2 temperature:     0 C
Fan level 3 temperature:     0 C
Fan level 4 temperature:     0 C
Fan level 5 temperature:     0 C
Fan level 6 temperature:    10 C
Fan level 7 temperature:    108 C
Minimal temperature to set: 25 C
Maximal temperature to set: 95 C

Those are the same values as in fan_policy.c (in the source code we downloaded). It seems that the way to change the values is that you should recompile, which is easy enough but also a bit scary. Haven't played with it yet.


Here's tree /proc/omnibook :

/proc/omnibook
├── ac
├── battery
├── blank
├── display
├── dmi
├── fan
├── fan_policy
├── hotkeys
├── lcd
├── temperature
├── touchpad
└── version

0 directories, 12 files



Here's the dmesg | grep omni output:

[    8.792966] omnibook: Driver version 2.20090707-trunk.
[    8.792969] omnibook: Forced load with EC type 1.
[    8.793055] omnibook: Feature range f86be5c0 - f86beac0
[    8.793058] omnibook: Testing feature ac at address f86be5c0
[    8.793060] omnibook: Begin table match of ac feature.
[    8.793063] omnibook: Attempting backend ec init.
[    8.793066] omnibook: Returning table entry nr 0.
[    8.793068] omnibook: Match succeeded: continuing with ac.
[    8.793072] omnibook: Testing feature battery at address f86be600
[    8.793075] omnibook: Begin table match of battery feature.
[    8.793077] omnibook: Attempting backend ec init.
[    8.793079] omnibook: Returning table entry nr 0.
[    8.793082] omnibook: Match succeeded: continuing with battery.
[    8.793086] omnibook: Testing feature blank at address f86be640
[    8.793088] omnibook: Begin table match of blank feature.
[    8.793090] omnibook: Attempting backend i8042 init.
[    8.793093] omnibook: Returning table entry nr 1.
[    8.793095] omnibook: Match succeeded: continuing with blank.
[    8.793098] omnibook: LCD backlight turn off at console blanking is enabled.
[    8.793102] omnibook: Testing feature bluetooth at address f86be680
[    8.793105] omnibook: Testing feature cooling at address f86be6c0
[    8.793107] omnibook: Testing feature display at address f86be700
[    8.793110] omnibook: Begin table match of display feature.
[    8.793112] omnibook: Attempting backend ec init.
[    8.793114] omnibook: Returning table entry nr 2.
[    8.793116] omnibook: Match succeeded: continuing with display.
[    8.795163] omnibook: Testing feature dock at address f86be740
[    8.795166] omnibook: Testing feature dump at address f86be780
[    8.795168] omnibook: Testing feature fan at address f86be7c0
[    8.795171] omnibook: Begin table match of fan feature.
[    8.795173] omnibook: Attempting backend ec init.
[    8.795176] omnibook: Returning table entry nr 0.
[    8.795178] omnibook: Match succeeded: continuing with fan.
[    8.795182] omnibook: Testing feature fan_policy at address f86be800
[    8.795184] omnibook: Begin table match of fan_policy feature.
[    8.795187] omnibook: Attempting backend ec init.
[    8.795189] omnibook: Returning table entry nr 0.
[    8.795191] omnibook: Match succeeded: continuing with fan_policy.
[    8.795195] omnibook: Testing feature hotkeys at address f86be840
[    8.795197] omnibook: Begin table match of hotkeys feature.
[    8.795200] omnibook: Attempting backend i8042 init.
[    8.795202] omnibook: Returning table entry nr 0.
[    8.795204] omnibook: Match succeeded: continuing with hotkeys.
[    8.795207] omnibook: Enabling all hotkeys.
[    8.799296] omnibook: Testing feature dmi at address f86be880
[    8.799300] omnibook: dmi feature has no backend table, io_op not initialized.
[    8.799304] omnibook: Testing feature version at address f86be8c0
[    8.799307] omnibook: version feature has no backend table, io_op not initialized.
[    8.799311] omnibook: Testing feature lcd at address f86be900
[    8.799314] omnibook: Begin table match of lcd feature.
[    8.799317] omnibook: Attempting backend ec init.
[    8.799319] omnibook: Returning table entry nr 2.
[    8.799322] omnibook: Match succeeded: continuing with lcd.
[    8.799326] omnibook: Testing feature muteled at address f86be940
[    8.799329] omnibook: Testing feature key_polling at address f86be980
[    8.799332] omnibook: Testing feature temperature at address f86be9c0
[    8.799334] omnibook: Begin table match of temperature feature.
[    8.799337] omnibook: Attempting backend ec init.
[    8.799339] omnibook: Returning table entry nr 0.
[    8.799341] omnibook: Match succeeded: continuing with temperature.
[    8.799347] omnibook: Testing feature touchpad at address f86bea00
[    8.799350] omnibook: Begin table match of touchpad feature.
[    8.799352] omnibook: Attempting backend i8042 init.
[    8.799355] omnibook: Returning table entry nr 0.
[    8.799357] omnibook: Match succeeded: continuing with touchpad.
[    8.799361] omnibook: Testing feature wifi at address f86bea40
[    8.799363] omnibook: Testing feature throttling at address f86bea80
[    8.799366] omnibook: Enabled features: ac battery blank display fan fan_policy hotkeys dmi version lcd temperature touchpad.

46. A VERY rough approach to "benchmarking" gromacs (unscientific) on debian

Here's a comparison between different hardware and binaries which were built as described in http://verahill.blogspot.com/2012/01/debian-testing-64-wheezy-compiling.html

The simulation in question is a 100,000 step 100 ps simulation of a carbonate ion in water. Check back later for more details.

grompp -f carbonate.mdp -c carbonate.pdb -p carbonate.top -o carbonate.tpr
time mdrun -v -deffnm carbonate



Conclusions: 1) Double precision is slower by 25-35 % than single precision. 2) On a single machine there's no gain in using mpi. 3) Sadly, it appears that  intel i5-2400 X4 3.1GHz is more expensive than AMD Phenom II X6 3.1GHz for a reason.



Machines:
Be -- Phenom II X6, 8Gb RAM.
B --   Athlon X3 3.1 GHz 3 core, 4Gb RAM
Ta -- Optiplex 990 (i5 2400 3.1 GHz 4 core, 8Gb RAM). This machine was running a full gnome3/gnome-shell desktop at the same time as the tests were carried out. Take the results with a grain of salt.

Using mdrun (no mpi, single precision)
-------------------------------
Run   Be (6)     Ta (4)   B ( 3)
-------------------------------
1       1m27s    1m1s    1m48s
2       1m28s    1m1s    1m46s
3       1m35s    1m1s    1m47s
4       1m32s    1m1s    1m47s
5       1m33s    1m1s    1m47s


Using mdrun_dd (no mpi, double precision)
-------------------------------
Run   Be (6)     Ta (4)   B ( 3)
-------------------------------
1       1m49s    1m15s    2m25s
2       1m47s    1m15s    2m26s
3       1m51s    1m15s    2m26s
4       1m59s    1m15s    2m24s
5       1m58s    1m15s    2m26s



Using mdrun_mpi (mpi, single precision)

Machine: Be (Phenom II X6, 8Gb RAM).
(5 cores doesn't work)
---------------------------------
Cores/Run:   1            2      
---------------------------------
1                  4m11s   4m13s
2                  2m12s   2m15s
3                  1m46s   1m43s
4                  1m31s   1m31s
5                  ----------------
6                  1m28s   1m35s

Machine: Ta (Optiplex 990 (i5 3.1 GHz 4 core, 8Gb RAM).
---------------------------------
Cores/Run:   1            2           3
--------------------------------
1                  3m20s   3m20s   3m20s
2                  1m39s   1m38s   1m40s
3                  1m12s   1m13s   1m12s
4                  1m01s   1m01s   1m00s


Machine: Athlon X3 3.1 GHz 3 core, 4Gb RAM.
---------------------------------
Cores/Run:   1            2           3
--------------------------------
1                  4m32s   4m33s   4m36s
2                  2m28s   2m28s   2m27s
3                  1m49s   1m50s   1m49s

Using mdrun_ddmpi (mpi, double precision):

Machine: Phenom II X6, 8Gb RAM.
---------------------------------
Cores/Run:   1            2    
---------------------------------
1                  5m23s   5m25s
2                  2m56s   2m54s
3                  2m11s   2m11s
4                  1m56s   1m57s
5                  -----------------
6                  1m51s   1m52s

Machine: Optiplex 990 (i5 3.1 GHz 4 core, 8Gb RAM).
---------------------------------
Cores/Run:   1            2           3
--------------------------------
1                  4m14s   4m13s   4m13s
2                  2m09s   2m09s   2m10s
3                  1m33s   1m33s   1m33s
4                  1m16s   1m16s   1m16s


Machine: Athlon X3 3.1 GHz 3 core, 4Gb RAM.
---------------------------------
Cores/Run:   1            2           3
--------------------------------
1                  5m01s   5m52s   5m50s
2                  3m17s   3m17s   3m18s
3                  2m31s   2m31s   2m31s



10 January 2012

45. Compiling gromacs with mpich2 ver 1.2 on debian testing

If you are using mpich2 1.2.1.1-5 -- read the ** comment. Otherwise don't worry.
** In my example I've used mpich2 ver 1.2.1.1-5 -- install mpich2 and libmpich2-dev version 1.2.1.1-5 according to http://verahill.blogspot.com/2012/01/debian-testing-64-wheezy-nwhchem.html -- do everything in between "Edit these two files.." and "exitif you want the same system as I've used. **

Start here:
This is basically a condensed and annotated version of http://www.gromacs.org/Downloads/Installation_Instructions

Have a look at
http://www.gromacs.org/Downloads
to see what file to download

Also, you may want to do
sudo apt-get install build-essential gfortran fftw3

Next, use the console:

mkdir ~/tmp
cd ~/tmp

wget ftp://ftp.gromacs.org/pub/gromacs/gromacs-4.5.5.tar.gz

tar -xvf gromacs-4.5.5.tar.gz

aptitude search fftw
I have libfftw3-3 so I'll pull libfftw3-dev
sudo apt-get install libfftw3-dev

cd gromacs-4.5.5/

create buildconf.sh and put the following in it to build four different versions of gromacs L
(without mpi and single precision, with mpi and single precision (_mpi), without mpi and double precision (_dd), with mpi and double precision (_ddmpi)).
Change N in make -jN to equal the number of cores+1, in my case six cores => N=7, so -j7.
##########################
./configure --with-fft=fftw3
make -j7
sudo make install
 ./configure --with-fft=fftw3 --enable-mpi --program-suffix=_mpi 
make -j7 mdrun
sudo make install

make distclean

./configure --with-fft=fftw3 --disable-float --program-suffix=_dd
make -j7
sudo make install
 ./configure --with-fft=fftw3 --enable-mpi --disable-float --program-suffix=_ddmpi 
make -j7 mdrun
sudo make install
##########################

Then run
sh buildconf.sh

Next, in ~/.bashrc put

PATH=$PATH:/usr/local/gromacs/bin

or, to install for everyone, put the above line in /etc/profile (and then do source /etc/profile)

Then run
source ~/.bashrc

You can download a test set from http://www.gromacs.org/Downloads/Test-Set
Currently the newest one is ftp://ftp.gromacs.org/pub/tests/gmxtest-4.0.4.tgz

Or using git, if you have that installed:
git clone git://git.gromacs.org/regressiontests.git

09 January 2012

44. Apt-cache server on LAN on debian

Apt-caching allows you to share updates between different computers and, what is more important, allows you to update a machine that is not directly connected to the internet, but which can access a computer which is.

I've added almost nothing new to this post: http://ubuntuforums.org/showthread.php?t=564301

Ergo, all glory to 'coolen'. My only contribution, and a very small one at that, is showing a solution for a system, with a switch rather than a router.

Anyway, here's my reproduction of the prescribed method. I've changed almost nothing. The main purposes for reproducing the approach here are 1) so that I can remember it myself and 2) so that other people get independent verification that the method does indeed work.

The server ip address in the example is set to 192.168.1.2.

On server:
sudo apt-get install apt-cacher-ng
sudo vim /etc/services (or sudo nano, gksu gedit etc.)

(I had a whole lot of stuff in my /etc/services)

Add
apt-cacher   3142/tcp    #apt-cacher-ng service
apt-cacher   3142/udp   #apt-cacher-ng service

'coolen' adds AUTOSTART=1 to /etc/default/apt-cacher-ng
As far as I understand that's not necessary.

sudo /etc/init.d/apt-cacher-ng start

Make sure that your firewall is not blocking connections to port 3142 (e.g. configure gufw).

On client:

With ROUTER
To turn on:
sudo vim /etc/apt/apt.conf.d/01proxy
Acquire::http::Proxy "http://192.168.1.2:3142";

Do sudo apt-get update and you're done


(If you want to go back to the default repos, turn off  by changing to
Aquire::http::Proxy "http://";)


With SWITCH
(I basically looked at https://help.ubuntu.com/community/Apt-Cacher-Server)

sudo vim /etc/apt/sources.list

If your sources.list file currently looks like this:
deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free
deb ftp://ftp.au.debian.org/debian/ stable main contrib non-free
deb ftp://ftp.au.debian.org/debian/ unstable main contrib non-free

change it so that it looks like this:

deb http://192.168.1.2:3142/ftp.au.debian.org/debian/ testing main contrib non-free
deb http://192.168.1.2:3142/ftp.au.debian.org/debian/ stable main contrib non-free
deb http://192.168.1.2:3142/ftp.au.debian.org/debian/ unstable main contrib non-free


Do sudo apt-get update and you're done.

43. nwchem revisited. Install on new debian machine

Here's a streamlined version of compiling and setting up nwchem with mpich2 support on a virgin debian testing (wheezy) 64 bit computer. I'm working on a build guide for nwchem 6.1 -- currently it builds fine but all jobs end with a Segmentation Violation error and exits with status 11.

Start by running
sudo apt-get install build-essential  gfortran
Edit these two files (the preferences one will most likely not exist)
/etc/apt/sources.list

deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free
deb ftp://ftp.au.debian.org/debian/ stable main contrib non-free
deb ftp://ftp.au.debian.org/debian/ unstable main contrib non-free

/etc/apt/preferences

 Package: *
Pin: release a=testing
Pin-Priority: 990

Package: *
Pin: release a=unstable
Pin-Priority: -10

Package: *
Pin: release a=stable
Pin-Priority: 10

IMPORTANT: the pin-priority for stable must be positive (here +10), or it won't work.

Run
sudo apt-get install mpich2=1.2.1.1-5 libmpich2-dev=1.2.1.1-5

Set the Pin-priority to -10 for stable again.

sudo su
echo "mpich2 hold"|dpkg --set-selections
echo "libmpich2-dev hold"|dpkg --set-selections
mkdir ~/nwchem
cd ~/nwchem
touch buildconf.sh
chmod +x buildconf.sh

(EDIT 21/02/2012: I accidentally put a bad csh-formatted buildconf.sh file at the beginning. Then I put an incomplete bash version. It should work now.)

In buildconf.sh put
export LARGE_FILES=TRUE
export TCGRSH=/usr/local/bin/ssh
export NWCHEM_TOP=/home/myhome/nwchem/nwchem-6.0
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES=all
export USE_MPI=y
export USE_MPIF=y
export MPI_LOC=/usr
export MPI_INCLUDE=$MPI_LOC/include/mpich2

cd $NWCHEM_TOP/src
make clean
make nwchem_config
make FC=gfortran

Then download the source code for nwchem

wget http://www.nwchem-sw.org/images/Nwchem-6.0.tar.gz
tar -xvf Nwchem-6.0.tar.gz

To start building:
./buildconf.sh

Once it's built:
echo "PATH=$PATH:/home/myname/nwchem/nwchem-6.0/bin/LINUX64" >> ~/.bashrc
source ~/.bashrc

Prepare mpd
echo "MPD_SECRETWORD=jibberjabber" >> ~/.mpd.conf
chmod 600 ~/.mpd.conf
mpd --ncpus=3 &

Prepare for a test-run
touch nwchem.nw
Put the following in the nwchem.nw file:

start benzene 

geometry units angstroms
C  0.100  1.396  0.000
C  1.209  0.698  0.000
C  1.209 -0.698  0.000
C  0.000 -1.396  0.000
C -1.209 -0.698  0.000
C -1.209  0.698  0.000
H  0.000  2.479  0.000
H  2.147  1.240  0.000
H  2.147 -1.240  0.000
H  0.000 -2.479  0.000
H -2.147 -1.240  0.000
H -2.147  1.240  0.000
end
basis
 H library sto-3g
 c library sto-3g
end
dft
    xc b3lyp
end
task dft optimize

Launch the job:
mpdrun -n 2 nwchem nwchem.nw

And you should be ready to go


Edit: 12/02/2012 It looks like version of nwchem currently in SID is built with mpi support: http://packages.debian.org/sid/nwchem . I haven't checked it out.

42. Installing gnome-shell extensions and icon theme on debian


FOR GNOME/GNOME-SHELL 3.4 see this as well: http://verahill.blogspot.com.au/2012/06/gnome-34-frippery-extensions-in-debian.html

Here are a few quick fixes to make Gnome 3/gnome-shell work and look a bit better:

An example of my desktop as it looks today (April 201) is shown below:
My desktop, in response to a comment below..

And here a rough indication of what is done with the gnome-shell extensions below:
From top left, clockwise: applications menu, panel favourites (with faenza icons), move-clock, bottom panel and static workspaces. The information on the right hand side is done via conky.


Index:
1. gnome-shell extensions
2. Getting maximize, minimize and close back
3. prettier icon theme --faenza
4. Using conky instead of gnome applets to monitor computer


1. gnome-shell extensions
NOTE: download the .tgz file to your home folder e.g. /home/me/ or the files won't go to the right place on tar -xvf

The Gnome-shell Frippery extensions ("for grumpy old sticks in the mud") are what you're looking for: http://intgat.tigress.co.uk/rmy/extensions/index.html

a) For gnome/gnome-shell 3.0:
In /home/me/
wget http://intgat.tigress.co.uk/rmy/extensions/gnome-shell-frippery-0.2.8.tgz
tar -xvf gnome-shell-frippery-0.2.8.tgz

That's it! The extensions will only be installed for the user doing the untar-ing.

b) For gnome-shell 3.2:
UPDATE: 1/2/2012 -- Wheezy upgraded to gnome-shell 3.2.2.1 on 31/1/2012. Here's how to get a useful desktop environment again:

Either:
Use iceweasel/firefox, and visit the following pages:
https://extensions.gnome.org/extension/13/applications-menu/
https://extensions.gnome.org/extension/3/bottom-panel/
https://extensions.gnome.org/extension/12/static-workspaces/
https://extensions.gnome.org/extension/2/move-clock/
https://extensions.gnome.org/extension/4/panel-favorites/
https://extensions.gnome.org/extension/14/shut-down-menu/

All of the frippery extensions are listed here:
https://extensions.gnome.org/accounts/profile/rmyorston

Install the extensions by settting on the slider icon to ON.


OR:
In /home/me/ (replacing 'me' with your username)

wget http://intgat.tigress.co.uk/rmy/extensions/gnome-shell-frippery-0.3.6.tgz
tar -xvf gnome-shell-frippery-0.3.6.tgz

IF the shell extensions don't show up -- make sure that they are in /home/me/.local/share/gnome-shell/extensions/ -- if not you may want to extract and put the files there manually.

Either way, once you installed using firefox or in the terminal:
Log in and out of gnome-shell -- alt+f2 + r only enabled the applications-menu, bottom-panel and static workspaces, but the other extensions wouldn't work. This is based on a case of installing the extensions immediately after dist-upgrading to install gnome-shell v 3.2.2.1

You can now open gnome-tweak-tool (install it as shown below under "2. Getting max/min/close back") -- in the gnome-shell activities/launchers window or whatever they call it it shows up as Advanced Settings or start it using alt+f2 or terminal (gnome-tweak-tool). Click on Shell Extensions, and enable everything.

OR open firefox/iceweasel and go to https://extensions.gnome.org/local/ to enable/disable extensions.


Note:
The extensions.gnome.org versions of Frippery's Shutdown menu, move clock and panel favourites wouldn't work with 3.2 on a first try, nor would the extensions downloaded by wget and untared -- logging in and out of gnome-shell solved that.

Trying to find something on the extensions.gnome.org website is at the moment hopeless - hopefully they'll implement a useful search function soon.




2. Getting maximize, minimize and close back
Install gnome-tweak-tool
sudo apt-get install gnome-tweak-tool

Start it. Go to Shell. Under 'arrangement of buttons on title bar' select all.




3. prettier icon theme --faenza
I've never been a fan of the default icon themes for gnome. I used the linux lex icons (http://linuxlex.cz/en/?option=com_phocadownload&view=file&id=2:linuxlex-8-icon-theme&Itemid=350) for gnome 2.x/compiz

In my opinion the blockier icons in faenza work better with gnome3/gnome-shell than the fancy linux lex icons.

So...
Install the gnome-tweak-tool
sudo apt-get install gnome-tweak-tool

To get faenza
mkdir ~/tmp
cd ~/tmp
wget http://www.deviantart.com/download/173323228/faenza_icons_by_tiheum-d2v6x24.zip
unzip faenza_icons_by_tiheum-d2v6x24.zip
./INSTALL
cd ~/.icons
mkdir faenza
mv * faenza/

Now start gnome-tweak-tool. Under Interface  --> Icon Theme -- select faenza
Do alt+f2 and type r, hit enter to restart.


4. Using conky instead of gnome applets to monitor computer
conky is a lot more flexible and capable than any single gnome-applet. But then conky doesn't sit quietly on a panel but is instead overlaid on top of you desktop.

To install
sudo apt-get install conky

Edit configuration file
sudo vim /etc/conky/conky.conf

Here's a sample conky.conf
-------------------------

alignment top_right
double_buffer yes
background yes
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=12
gap_x 20
gap_y 60
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
own_window_type desktop
own_window_transparent yes
stippled_borders 0
update_interval 1.5
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no

TEXT 
${execi 60 acpi |gawk '{print $3,$4,$5}'|sed 's/\,/\t/g'}
${addr eth0}/${addr wlan0}
$hr
${color grey}Uptime:$color $uptime
CPU:$alignc $cpu%
$alignc $color ${cpugraph 15,200 ffff00 ff0000 -l -t}  
RAM:$alignc $mem/$memmax
$alignc$color ${memgraph 15,200 ffff00 ff0000 -t}
I/O:$alignc $diskio_read/$diskio_write
$alignc$color ${diskiograph 15,200 ffff00 ff0000 -t}
${color grey}Frequency (in GHz):$color
${freq_g 1} ${freq_g freq_g2}
$color CPU: $alignr${acpitemp}°C 
$color Fan(rpm): $alignr${execi 1.5 sensors|grep fan1|cut -c12-18} 
#${color grey}CPU Usage: ${cpubar 10,100 ffffff ff0000 -l -t} $cpu%
${cpugraph cpu1 15,100 ffff00 ff0000 -t} ${cpugraph cpu2 15,100 ffff00 ff0000 -t}
$hr
${color grey}File systems:
 / $color${fs_used /}/${fs_size /}
 /home $color${fs_used /home}/${fs_size /home}
${color grey}eth0 ${color red} ${upspeed eth0}/${color green} ${downspeed eth0} ${color grey}
${color grey} ${upspeedgraph eth0 15,100 550000 ff0000 -l -t} ${color grey} ${downspeedgraph eth0 15,100 0000ff 00ff00 -l -t} ${color grey}
${color grey}wlan0 ${color red} ${upspeed wlan0}/${color green} ${downspeed wlan0} ${color grey}
${color grey} ${upspeedgraph wlan0 15,100 550000 ff0000 -l -t} ${color grey} ${downspeedgraph wlan0 15,100 0000ff 00ff00 -l -t} ${color grey}
$hr
${color grey}Name CPU%   MEM%
${color} ${top name 1} ${top cpu 1} ${top mem 1}
${color} ${top name 2} ${top cpu 2} ${top mem 2}
${color} ${top name 3} ${top cpu 3} ${top mem 3}
$hr
${font Arial:bold:size=12}${color Tan1}WORLD TIME ${color DarkSlateGray}

$font${color}San Francisco ${execi 60 ping -c 1 berkeley.edu | grep icmp_req |gawk '{print $8}'| cut -c6- } ms$alignr${tztime America/Los_Angeles %H:%M}


$font${color}Melbourne ${execi 60 ping -c 1 rmit.edu.au | grep icmp_req |gawk '{print $8}'| cut -c6- } ms$alignr${tztime Australia/Melbourne %H:%M}



-----

You can get more information about available objects here: http://conky.sourceforge.net/variables.html

To make conky start up every time you start your computer, start gnome-session-properties, and add conky. That works most of the time but is the old gnome 2.3 way of doing things. Here's a post on gnome-shell specifically and how to add start-up applications: http://linuxandfriends.com/2011/06/01/how-to-add-startup-programs-in-gnome-3/

08 January 2012

41. Chinese character and input support on debian testing

Update: You should also install support for gtk and gtk3:
sudo apt-get install ibus-gtk3 ibus-gtk
in order to be able to use it with e.g. thunderbird.

Original post:
Here's how to set up Chinese (simplified) support in Gnome 3 /gnome-shell and the terminal (bash).

First install the fonts:
sudo apt-get install fonts-arphic-*

Next. add Chinese via locales:
sudo dpkg-reconfigure locales

Select
zh_CN.UTF-8

(For traditional characters choose zh_HK, zh_SG or zh_TW)

As default language English is probably a good idea
In my case it's en_AU.UTF-8

Edit ~/.bashrc and add the following lines:
LANGUAGE=zh_CN.UTF-8
LANG=zh_CN.UTF-8

Run
source .bashrc

Install ibus:
sudo apt-get install ibus-pinyin 
This pulls another 18 packages with it

Start ibus-daemon in terminal
An icon in the notification tray still appear
Right-click, choose Preferences (P)
Click on the second tab (input methods)
Select an input method -> Chinese -> Pinyin

You should now be able to choose between regular (latin) input and Chinese characters using Ctrl+Space.

To make ibus-daemon start with gnome, run
gnome-session-properties
and add
ibus-daemon

And you're more or less done.

Sogou is a popular pinyin database on the Windows platform -- but afaik it's not available for Linux. On Linux, it seems that the ibus-pinyin-db-open-phrase database is the default ibus database used to guess what characters you intend to type, but you can also install and select either ibus-googlepinyin or ibus-pinyin-db-android. After installation you need to select the database by going to preferences in the ibus daemon and selecting it as input method. Not being Chinese I can't tell whether sogou, google pinyin and android pinyin are comparable.

Sogou does however work with Google Chrome/Chromium on linux -- go to Preferences/Extensions -- Get More Extensions, and install the Sogou Cloud Pinyin Extension for Chrome.


04 January 2012

40. Getting started with GNUCash

I've both recently relocated and started my own research group, so keeping track of money has become important -- it's difficult to get an overview of your economy in the beginning in a new country, and you better keep track of your research grants because the University WIL screw it up.

As someone with nil background in finance getting to grips with GnuCash has taken some time.

I've got two databases -- one for my personal finances, and one for my grants. I'll only show how to set up a database for personal finances here.

For most of the steps there isn't much to say...
Choose the simplest type of account -- Checkbook.

You now have four main types of accounts: Assets, Equity, Expenses and Income. The assets accounts has a sub-account called  Checking Account.


Double-click on the Checking account, put the current amount of money in your account under Deposit, and select Equity:Opening Balance under Transfer.


You now have money to spend.

Time to customise the set-up. Create an new account -- select placeholder, income and New Top Level Account. We're calling it John Doe.

(You'll find that only top level accounts can be all types of accounts. Some accounts can only be income/expenses, while other types (e.g. Bank) can't be either of those.)

 Next, create a series of accounts and select either income or expenses depending on type:


 If you have cash in your wallet you can put that cash as the opening balance of a cash account under current assets -- put the current amount of money in your account under Deposit, and select Equity:Opening Balance under Transfer. Make main expenses and income accounts under your name. Add specific sub-accounts.

Note how it says Imbalance: 3,000 (the amount added to income/salary). Transfer that money (income/salary) to your checking account:


 Then you get:

 We can move money from the checking account to cash (i.e. ATM withdrawal), pay by cash etc.

Here's the double-entry aspect of GnuCash -- every transaction shows up twice:

Here's another overview of the accounts:


Anyway, at this point it's fairly easy to start exploring and setting up more complex accounts.








Essentially, GnuCash SEEMS to be powerful, but for some reason I can't bring myself to read the documentation. Maybe it's the way it's written, maybe it's the topic at hand (few scientists relish the dirty world of money...or so we like to think), or maybe it's just me. Regardless, it's a piece of software you SHOULD learn how to use if you need to keep track of spending -- as most scientists do.


03 January 2012

39. Opinion -- little annoyances regarding opinions about linux

I spend far too much time browsing the web, and I do often end up on linux-related sites. A fair number of sites are still dedicated to converting windows/osx users or helping new Linux users. In particular the latter aim is noble, of course.

At time it does get a bit tiring reading the comments sections though -- and that goes for both Linux advocates and their detractors.

Quotes collected from the web are given within "".

As an aside, most linux users, but perhaps not most windows and OSX users, are well aware of the difference between Learn-ability and Usability. A program may well be easy to LEARN how to use ('intuitive') but it may be a pain in the arse to actually USE. Most linux CLI tools require a bit of extra effort to learn, but once learned, are eminently usable.

0. Fewer than 1% use Linux or Ubuntu/Mint/X is the most popular distro
According to my blog, 55% of all visitors use linux (Win 40%, OSX 2%). This blog, given it's content has a positive bias towards Linux users.

According to my professional university homepage (I'm a chemist, not a Comp. Sci. person) about 11% use Linux, while 74% use Windows and 12% use OSX. My homepage, by virtue of being strictly related to my field of research, is biased towards users who are professional chemists.

So what to do?
For starters, what does 'use' mean? Do we only mean as a primary Desktop OS? Or do we include servers? Or even indirect use, such as visiting websites run on linux servers and using devices with embedded linux? These problems also apply to deciding which is the most popular distribution -- do we count embedded? Server installations? Or only Desktop usage?

The problem is compounded by the problem of measuring usage, regardless of definition. For commercial OS one might use the number of licenses sold as an indication, but that won't work for a Free OS. Same goes for number of downloads. Repo access sounds like a good idea, but in addition to most major universities (+ companies and kind individuals) running mirrors, a fair number of us use apt-cache to cut down on both our and server traffic. And what about people who, like me, have a large number of computers which they use each day (desktop at home for watching tv, laptop at home for work, desktop at work for...work, three desktops at work for number crunching, router at home with busybox/tomato)

There would of course also be the practical issue of compiling all the stats, so this approach isn't used today.

So...for OS share 'Net applications' statistics is often used, see discussion e.g. here. Website stat, however, do not adequately distinguish between Number of Users and Number of Visits. The selection of reporting sites also influences the results.

Still, the problem is even greater when it comes to crowning the reigning distro. Most of the time distrowatch data is quoted, and it really makes absolutely no sense. I use only linux, and I visit distrowatch less than once per year -- because why would I? I use Debian, I'm happy with Debian, and I have no longer any time to explore other distros without a bloody good reason, and even if I did, distrowatch wouldn't be the place I'd go looking for information. I really wish articles would stop quoting distrowatch data.

1. The year of the Linux Desktop/Focus on mobile devices
"That's why I feel it's more important to focus on how Linux performs in growth areas like mobile devices than on a desktop that's increasingly less relevant for content consumption."

This is, if not a meme, then at least a standing joke. However, there's still this idea that Linux NEEDS to become a big player on the desktop and that it has so far failed to achieve this. Alternative, Linux NEEDS to focus on mobile devices where they can grab a large market share.

Well, guess what -- for a lot of people every year is the year of the linux desktop -- we're using linux as our only, or primary, OS.

Also, there isn't a NEED for linux to become anything.

What most linux users feel is probably that rather than necessarily converting everyone to some flavour of linux, it would be nice of non-linux users would stop forcing proprietary formats on everyone.

At my current job people insist on emailing .docx files for some reason. This
   1.  more-or-less forces Windows users to upgrade their office versions (which is the real reason behind changing the file format)
   2. pisses off anyone who isn't using office --- such as linux users. A guess-timate would be that 80% of the documents emailed contain so little formatting that a plain ascii file would have been enough. For the rest, pdf would work just fine since editing isn't required.

Really, you can use office if YOU want to, but don't 1. pretend that it's superior to latex because you can click on things or 2. force it on other people.

2. 'obscure' terminal commands
"Look it's 2009. The public doesn't want to type in commands. GUI's have been around for how long? It's obvious by the success of Windows that users want an easier experience."

They are only 'obscure' if you are dead-set against learning what they do. There is no difference between typing in a command and looking through a graphical menu. You still need to be willing to dedicate at least a modicum of effort towards learning.

And guess what? There's a reason why the terminal/command line/cli is still around. In fact there are several. For a starter, it's a faster, easier and more convenient method once you've made a bit of effort of learning how to use the standard *NIX tools such as gawk, sed, vim etc. Not everyone uses their computer for data processing, or even work, and that's fine -- some people live their lives in the browser and won't benefit much from using the terminal (but they really shouldn't complain about its existence either).

Also, the idea of 'getting rid of the terminal' as one sees sometimes show s a complete lack of understanding of how a linux system works. GNOME/KDE/Xmonad/XFCE/LXDE etc. are just shells, interfaces on top of the linux kernel. They are like thin sheets of ice covering a deep sea -- most of the action is to be found underneath.

And that's a GOOD thing -- in windows there's little reward for making the effort to learn new things. In Linux, you can learn as little or as much as you want -- you'll get rewarded for any effort to learn that you make.

3. 'Too much' choice
"Fragmentation: 1% of the market split into 100+ distros. Divided they fall."

In the beginning I fretted a lot about choosing the 'right' distro -- after all you don't want to waste your time learning something that's obsolete or not as useful as the next thing around. As it turns out, there's little difference between different distros.

Well, the differences are there there, but they are typically down to philosophy, package management or number of packages in the repos.

I feel more at home using apt-get/aptitude than yum, but since a fair number of users use a graphical package manager, this really doesn't matter much.

Other than that, most distros are the same, and are derived from four or five main distros (the Debian and Fedora/Red Hat families probably being the largest ones). So, instead of 100+ distros you have 3-4 distros which are really not that different.

The differences between windows 2000 through Windows 7 are larger than the differences between any of the linux distros.

4. No drivers/hardware support
"The real killer with linux is using peripherals. Drivers suck if they exist at all."
To date I've only had one piece of hardware which didn't work immediately -- my Diamond ATI Wonder HD 750 USB TV card. And I blame ATI for that, not 'linux'.

5. No games means Linux sucks
"I gave Linux a shot. Despite the irritating little problems I encountered I tried. And then my nephew wanted to play a game and it became all too clear--Linux has no chance."

This is true. But are we discussing a system for casual gaming or are we talking about a computer OS? I'd hate to write articles or do modelling on XBOX or Playstation. If gaming is what you are after, then by all means, find a system where you can do it. Whether a publisher releases a game for a particular platform has little to do with the superiority of that platform and all to do with market share.


Anyway, people can use what they want -- what irks me is when they pretend they'd use Linux if only...and then some half-baked, poorly informed 'reason' is presented.

Use or Do Not Use -- but make no excuses.

38. How to install and/or compile wine on debian testing


UPDATE: See here for Wine 1.5.27 using a chroot
http://verahill.blogspot.com.au/2013/04/376-wine-1527-on-debian-i386-chroot.html


UPDATE: there are plenty of more up-to-date guides on this blog. See e.g. here for how to build v 1.5.6. Obviously, the instructions below are still valid, and will give you a working version of wine.


Original post:
Quite some time ago Wine was removed from Debian Testing/Wheezy. If you already had wine installed, this may not have caused any significant problems, but it did cause inconvenience when setting up a new computer.

There are three fairly easy ways of installing wine in Debian testing.

Update: See here for version 1.4-rc4: http://verahill.blogspot.com.au/2012/02/debian-testing-wheezy-64-compiling-wine.html

1. The simplest approach -- Using the Stable version of wine 
Simply add the stable repo to your /etc/apt/sources. list (add -- don't replace your testing repo)

i.e. if you sources.list looks like this:

deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free


then add a line so that it looks like this:
deb ftp://ftp.au.debian.org/debian/ testing main contrib non-free
deb ftp://ftp.au.debian.org/debian/ stable main contrib non-free

Running

sudo apt-get update

followed by

aptitude search wine

should hopefully show wine, wine-bin etc. The current version in the Debian stable repos is 1.0.1-3.1.

You can now install wine by

sudo apt-get install wine


2. The ever so slightly more complex approach -- installing version 1.3.32-0.1
If you want a newer version -- and I'd say that you would since the debian wine packages are OLD -- you can at the moment pull .deb packages from http://dev.carbon-project.org/debian/wine-unstable/

Don't let the 'unstable' fool you -- these are NOT the packages in the debian SID/unstable repos.

Also, pay heed to the following text on the page above: "The amount of traffic this little sub-page generates is quite respectable. If you think this service helpful and want to help cover some of the attached costs, please donate a few Euros". Whether you donate or not, do not download the same packages over and over again.

Download all the .deb files (in my case for amd64) using the following command:

wget -r -l1 --no-parent -A amd64.deb http://dev.carbon-project.org/debian/wine-unstable/

This is an example of using something akin to wildcards in wget.

cd dev.carbon-project.org/debian/wine-unstable

sudo dpkg -i *.deb

You'll see a number of errors being reported and the packages will be left unconfigured -- this is due to missing dependencies. That's easy to fix though:

sudo apt-get -f install

The missing dependencies will now be pulled in and the installation finalised. It's as easy as that!

3. Building your own -- version 1.3.35
It's not as hard as it may look -- I'm not in the habit of compiling my own packages, and chances are that you aren't either, so I'll show the entire process.

Download the source
wget http://prdownloads.sourceforge.net/wine/wine-1.3.35.tar.bz2

Unpack:
tar -xvf wine-1.3.35.tar.bz2

You may have to
sudo apt-get install bzip2 
before running the tar command above if it complains about missing bzip2 etc.

Change to the directory where the files were unzipped
cd wine-1.3.35

Time to start trying to build -- the errors I get may not be the errors you get. The approach to solving them is the same though.

First we need a whole lot of packages:

sudo apt-get install bison flex gcc libc6-dev libfontconfig-dev libfreetype6-dev libglu-dev libgsm1-dev libice-dev libjpeg-dev libldap-dev libmpg123-dev libncurses5-dev libopenal-dev libpng-dev libsm-dev libssl-dev libusb-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxml2-dev libxrandr-dev libxrender-dev libxslt-dev libxt-dev libxxf86vm-dev make libcapi20-dev liblcms-dev libsane-dev libhal-dev libdbus-1-dev valgrind prelink libcups2-dev

sudo apt-get install lib32v4l-dev lib32ncurses5-dev lib32asound2-dev lib32z-dev ia32-libs-dev

Now start:
./configure

which gives**


configure: OpenCL 32-bit development files not found, OpenCL won't be supported.
configure: gstreamer-0.10 base plugins 32-bit development files not found, gstreamer support disabled
configure: OSS sound system found but too old (OSSv4 needed), OSS won't be supported.
configure: libgsm 32-bit development files not found, gsm 06.10 codec won't be supported.

configure: Finished.  Do 'make' to compile Wine.




Good enough for me. 

make

Building will take a good 20-30 minutes.

Finally, 'install' the binaries in their proper locations

sudo make install

The first time you start a program in wine you'll be asked to install the gecko engine, which you can go ahead and do.

** I initially had some problems -- one of them being


checking for X... no
configure: error: X 32-bit development files not found. Wine will be built without X support, which probably isn't what you want. You will need to install 32-bit development packages of Xlib/Xfree86 at the very least. Use the --without-x option if you really want this.

This was solved by installing ia32-libs-dev