[LAMMPS] Visualizing log file

(About how to use Pizza.py, please refers to previous post of How to use Pizza.py for LAMMPS or the official Pizza.py Toolkit page.

Instead of asking pizza.py to get all the "Temp", "TotEng" .. by typing in each variable, and then do g.plot (a lot of repetitive keyboard work!), there's a much faster way to visualize the thermo-type data. It allows us to quickly view the trend of properties, and get an idea of the equilibrium status of the simulation.

This can be done directly on the shell or through pizza.py. Below is to do it in pizza.py:
$   python -i /home/pizza/src/pizza.py
First entering the pizza.py interactive interface. In the pizza.py interface, asking pizza to run the logview.py script:
Pizza.py (9 Feb 2012), a toolkit written in Python
type ? for help, CTRL-D to quit
Loading tools ...
>@run logview.py gnu log*
Executing file: /home/pizza/scripts/logview.py
200000
read 10001 log entries

Note that there's a "@" sign before run. When Pizza.py was installed, the path to where the scripts are stored was also established (/home/pizza/scripts/). The third argument gnu is to use Gnuplot to generate the graphs. Thus in this case, Gnuplot has to be installed in the machine as well. Last argument is the file name(s) where the thermo data are stored. It can be log* or can be multiple files, i.e. log.1 log.2 ..., etc.

After loading the data, a panel containing the output thermo data appears (left hand size panel below).
By toggling the display options, the corresponding property vs. step will show up. The graph can be saved by first switch on the select toggle next to the property (turning into red), and hit print as. We can also change the file name from "tmp" to a more informative one, such as "Press". The saved graph will be in .eps format and locate at where you activate pizza.py.

[awk] using shell variable

Shell variable can be ported into awk command by using "-v" flag:
#!/bin/bash
var=100
awk -v var=$var '{print $1*var}' file.dat
An important note here is that within the awk command, calling the var does not require the '$' sign.

If there are more than one shell variable to call, use -v again and put space in between:
awk -v var=$var -v var2=$var2 '{print $1*var, var2}' file.dat
This will print $1*$var and $var2.

How to converge ecut and kpoint in a DFT calculation?

Finding the energy cutoff and k-point is like the fundamental of doing DFT calculations. However there doesn't seem to be an universal way to do it. I found on the quantum-espresso forum a very informative and thorough explanation. Thank Stefano for a such detailed post. Below is my notes on the procedures:

1. First test ecutwfc and ecutrho

Ecutwfc and ecutrho are properties related to the Fourier components that are needed to describe the wavefunctions and the density of the system. The convergence depends on the highest Fourier components. Each pseudopotential has a required cutoff: the upperbound. The cutoff needed for a system containing several species is the highest among those needed for each element.

- Increasing ecutwfc value while fixing ecutrho = 4*ecutwfc. Perform total energy (if possibly, force and stress) convergence tests until satisfactory stability is reached[1].

2. Fix the ecutrho from Step 1, and reduce ecutwfc. See how much ecutwfc can be reduced without deteriorating the convergence.

3. Fix ecutwfc from step 2 and ecutrho from step 1, identify appropriate k-point.

- This one is tricker because convergence with respect to k-points is a property of the band structure. There is a big difference between convergence in a band insulator and in a metal.

(I don't quite understand this part, but it seems like in an insulator, the k-point convergence is rather simple comparing to a metal. In an insulator, bands are completely occupied or empty across the Brillouin zone and charge density can be written in terms of wannier functions that are exponentially localized in real space. As a result, the convergence with respect to the density of point in the different directions in the Brillouin zone should be exponentially fast and quick. On the other hand, metals require much denser set of k points in order to locate accurately the Fermi surface. This induces that a smearing width smoothing the integral to be performed.... )

[1] Satisfactory stability is typically ~0.05 eV/atom for energy, and 10meV/A for forces. (Or ~1 mry/atom and 1.e04 ry/au in atomic units)

[Mac] Set double-sided printing as default

I recently migrated from Windows to OSX. As a kinda-happy windows user for 20+ years, I was interested in knowing what's the charisma of Apple products.

--- Above is a totally unrelated preface ----------

In the System preference, there's no option to set duplex printing as default. Instead, Apple uses the Common Unix Printing System (CUPS) to manage the network printers. To access the printer settings, open a internet browser and go to http://127.0.0.1:631/printer. From the web-based interface, click on the name of the printer you want to set duplex printing. Two drop down menus here will allow you to do maintenance and administration tasks to this printer.



To set duplex printing, choose "Set Default Options" under the administration drop down menu. Click the "General" tab, and the Duplex setting will then show up. Choose 2-Sided, Long-Edge Binding (if you usually print the portrait orientation), and click on "Set Default Options".

The two-sided block should be always checked when you are trying to print. If not, try to restart the computer to clear memory of the printer settings in the applications.

Do more with the printer and the CUPS: http://127.0.0.1:631/admin