CFG/AtomEye Utilities

Utilities to use with CFG/AtomEye

xtal | NT | mul | voronoirize | annotate_atomic_strain | vcut | scut | p2c | c2p | perturb_x | linear_path | iniT
VASP | Gaussian | Dacapo

xtal: crystal maker

Figuring out the crystallography to jump-start your simulation is always a hassle. The primitive-cell specification is simple enough, but very often you would like to rotate the observer to another frame (for example in order to obtain a larger but orthogonal supercell), and then it is no longer trivial to figure out which atom is where. xtal makes your life easier: you only need to specify the primitive cell, and then you tell what is the origin and the three edge vectors (in the old frame) of the new supercell, and voila! xtal even replicates the new supercell if you want.

xtal reads from the standard input. You should first edit a script (self-explanatory) such as Bcc | bCC | FCC, and then run

xtal < Bcc
where you redirect the edited script to the standard input stream.

If everything works out, you should see

% xtal < Bcc
Number of atoms in the new unit cell = 6
Fe   0.000000000000   0.000000000000   0.000000000000
Fe   0.666666666667   0.000000000000   0.333333333333
Fe   0.333333333333   0.000000000000   0.666666666667
Fe   0.333333333333   0.500000000000   0.166666666667
Fe   0.000000000000   0.500000000000   0.500000000000
Fe   0.666666666667   0.500000000000   0.833333333333
saved on "Bcc.cfg".

All the input and output atom coordinates are reduced coordinates. You can now visualize the result Bcc.cfg by running AtomEye:

A Bcc.cfg
Remember that if your supercell is too small, AtomEye will automatically replicate it for better visualization. But the CFG file itself is of your ordered size.

NT: nanotube maker

NT creates a straight single-wall carbon nanotube of arbitrary chirality. You should first edit a script (self-explanatory) such as input, and then run

NT < input
where you redirect the edited script to the standard input stream.

If everything works out, you should see

% NT < input
T = 1 -1
R = 1 0
The final configuration is saved on "7x7x1.cfg".

All the input and output atom coordinates are reduced coordinates. You can now visualize the result 7x7x1.cfg by running AtomEye:

A 7x7x1.cfg
Remember that if your supercell is too small, AtomEye will automatically replicate it for better visualization. But the CFG file itself is of your ordered size.

mul: multiply a configuration

Purpose: make nc0 x nc1 x nc2 stacked copies of a configuration.
Usage: mul in_file nc0 nc1 nc2 out_file

Very often one would like to have a (much) bigger version of the configuration one has now. For example,

% mul FCC.cfg 10 10 10 FCC10x10x10.cfg
Loading "FCC.cfg"...

Guessing file format of "FCC.cfg":
should be Ju Li's CFG format.

Loading configuration from "FCC.cfg":
32 atoms found.. reallocating memory

    | 7.2      0        0        |   | 7.2      0        0        |  
H = | 0        7.2      0        | = | 0        7.2      0        | A
    | 0        0        7.2      |   | 0        0        7.2      |  

supercell volume = 373.248 = 373.248 A^3
avg. atomic volume = 11.664 = 11.664 A^3
atomic number density = 0.0857338820301783 = 0.0857338820301783 A^-3
avg. mass density = 9.04669015864521 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu     63.546       32   100.00%   100.00%
---------------------------------------------

10 x 10 x 10 x "FCC.cfg" -> "FCC10x10x10.cfg".
would replicate FCC.cfg 10 times in all three directions, resulting in a configuration FCC10x10x10.cfg 1,000 times larger than the original.

voronoirize: make nanocrystals with the Voronoi procedure

Purpose: build grains by Voronoi site-rotation and cut.
Usage: voronoirize in_file fcc,bcc,random n0 n1 n2 out_file

The Voronoi construction is a popular scheme to create nanocrystals. One first put down seeds in the supercell. Associated with each seed is a rotation matrix - one imagines that a copy of the original configuration (infinitely replicated) is rotated about the seed, then cut out by the Voronoi polygon around this seed and finally pasted together. The seed can take ordered "superlattice sites" such fcc arrangement, in which case grains of rhombic dodecahedron shape of random orientations will be created; or bcc arrangement, in which case grains of truncated octahedron shape of random orientations will be created; or random sites, if you would like to roll the dice. For example,

% voronoirize FCC10x10x10.cfg bcc 2 2 2 FCC10x10x10-voronoirized.cfg
Loading "FCC10x10x10.cfg"...

Guessing file format of "FCC10x10x10.cfg":
should be Ju Li's CFG format.

Loading configuration from "FCC10x10x10.cfg":
32000 atoms found.. reallocating memory

    | 72        0        0        |   | 72        0        0        |  
H = | 0        72        0        | = | 0        72        0        | A
    | 0        0        72        |   | 0        0        72        |  

supercell volume = 373248 = 373248 A^3
avg. atomic volume = 11.664 = 11.664 A^3
atomic number density = 0.0857338820301783 = 0.0857338820301783 A^-3
avg. mass density = 9.04669015864522 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu     63.546    32000   100.00%   100.00%
---------------------------------------------

Cut against all images = YES;

Grain 0 (0-15) centered at (0.125 0.125 0.125) added,
    |  0.899628  -0.270165   0.343047 | 
R = |  0.436045   0.597432  -0.673008 |.
    | -0.023124   0.75504    0.65527  | 
 
Grain 1 (0-15) centered at (0.375 0.375 0.375) added,
    |  0.08042   0.157397   0.984255 | 
R = |  0.790044  0.592012  -0.159223 |.
    | -0.607752  0.79041   -0.076741 | 
 
Grain 2 (0-15) centered at (0.125 0.125 0.625) added,
    | -0.263297  -0.22933   -0.93706  | 
R = |  0.877928   0.345679  -0.331282 |.
    |  0.399895  -0.909898   0.110319 | 
 
Grain 3 (0-15) centered at (0.375 0.375 0.875) added,
    |  0.844978   0.315317   0.431957 | 
R = | -0.324421   0.944329  -0.054716 |.
    | -0.425162  -0.093902   0.900233 | 
 
Grain 4 (0-15) centered at (0.125 0.625 0.125) added,
    |  0.034185  0.299946  -0.953343 | 
R = | -0.907102  0.409726   0.096384 |.
    |  0.41952   0.861485   0.286089 | 
 
Grain 5 (0-15) centered at (0.375 0.875 0.375) added,
    |  0.430351  -0.712014  -0.554828 | 
R = |  0.041853  -0.598257   0.800211 |.
    | -0.901691  -0.367593  -0.227661 | 
 
Grain 6 (0-15) centered at (0.125 0.625 0.625) added,
    |  0.863977   0.271448  0.424099 | 
R = | -0.356298   0.924717  0.133979 |.
    | -0.355803  -0.266861  0.89565  | 
 
Grain 7 (0-15) centered at (0.375 0.875 0.875) added,
    |  0.086778   0.912573   0.399601 | 
R = | -0.730578   0.330994  -0.597242 |.
    | -0.677292  -0.240112   0.695429 | 
 
Grain 8 (0-15) centered at (0.625 0.125 0.125) added,
    |  0.57182   0.264766   0.77648  | 
R = |  0.09932   0.917185  -0.385886 |.
    | -0.814345  0.297778   0.498168 | 
 
Grain 9 (0-15) centered at (0.875 0.375 0.375) added,
    |  0.99697   -0.017069   0.075888 | 
R = |  0.021073   0.99841   -0.052283 |.
    | -0.074875   0.053724   0.995745 | 
 
Grain 10 (0-15) centered at (0.625 0.125 0.625) added,
    |  0.695638  0.044949   0.716985 | 
R = |  0.715579  0.044895  -0.697088 |.
    | -0.063522  0.99798   -0.000934 | 
 
Grain 11 (0-15) centered at (0.875 0.375 0.875) added,
    | -0.588762  -0.368065  0.719644 | 
R = |  0.807976  -0.242529  0.536987 |.
    | -0.023112   0.897612  0.440179 | 
 
Grain 12 (0-15) centered at (0.625 0.625 0.125) added,
    | -0.193565   0.025646  -0.980752 | 
R = |  0.927742   0.329929  -0.174475 |.
    |  0.319104  -0.943657  -0.087656 | 
 
Grain 13 (0-15) centered at (0.875 0.875 0.375) added,
    |  0.512092  0.856365   0.066332 | 
R = | -0.738837  0.478562  -0.474445 |.
    | -0.438042  0.193951   0.877783 | 
 
Grain 14 (0-15) centered at (0.625 0.625 0.625) added,
    |  0.776483  0.028737   0.629482 | 
R = |  0.098555  0.981127  -0.166361 |.
    | -0.622383  0.191215   0.758997 | 
 
Grain 15 (0-15) centered at (0.875 0.875 0.875) added,
    | -0.280061   0.112143  -0.95341  | 
R = | -0.730221  -0.669591   0.135741 |.
    | -0.623172   0.734215   0.269415 | 
 
There are total of 16 grains, 32003 atoms (100.009%).

------------- Chemical Species Report -----------
Idx Type  Z  Avg.Mass   Count  Abundance  Wt.Pct.
 0   Cu  29   63.546    32003   100.00%  100.00%
-------------------------------------------------

Create neighborlist with the following parameters:
pairwise saving = YES,  track_dx = NO
pbc[0] = YES,  pbc[1] = YES,  pbc[2] = YES,  
Strain Session min_shrinkage = 1,
All Atom Tether max_atom_displacement = 0 (reduced),
-> COMPRESSED disposable atom-atom list
with Rlist_ij = Rcut_ij;

rlist = | 2.11746 | (reduced)
 
MAX(rlist) = 2.11746  ->  bin thicknesses should >= 2.11746
since H thicknesses = ( 72  72  72 )
-> 34 x 34 x 34 = 39304 bins.
bin-bin list created.

Compressed bin-bin list: 39304 entries, 4402052 bytes allocated,
max=27, min=27, avg=27.00, std.dev.=0.00 (0.0%).

On average, there are 0.81 atoms per bin,
but we will offer space of 3 for each.
bin-atom list created.

Uncompressed bin-atom list: 39304 entries, 786084 bytes allocated,
max=4, min=0, avg=0.81 (27.1%), std.dev.=0.53 (17.6%).

After pairwise/own_pair saving,
likely MAX(neighbor) = ( 13 ) atoms,
atom-atom list created.

Uncompressed atom-atom list: 32003 entries, 1920184 bytes allocated,
max=4, min=0, avg=0.13 (1.0%), std.dev.=0.38 (2.9%).

Compressed atom-atom list: 32003 entries, 144028 bytes allocated,
max=4, min=0, avg=0.13, std.dev.=0.38 (303.8%).

All bin-related allocations freed.
Then, 3036 (9.48661%) GB atoms are removed randomly
for bond ratio < 0.828427 -> now np = 28967 (90.5219%).

bcc 2 x 2 x 2 Voronoi superlattice -> "FCC10x10x10-voronoirized.cfg".
would divvy up FCC10x10x10.cfg into 16 truncated octahedron grains pieced together, FCC10x10x10-voronoirized.cfg, which can then be visualized by
A FCC10x10x10-voronoirized.cfg
Pressing 'k' (coordination number coloring) would allow one to clearly see the grain boundaries.

Note that a freshly voronoirized configuration such as FCC10x10x10-voronoirized.cfg is usually not yet ready for prime time! A medium "compress-and-bake" procedure is recommended to relax at least the atrociously mis-coordinated grain boundary atoms.


annotate_atomic_strain: calculate atomic strain tensor

Purpose: compute atomic strain and save as auxiliary properties.

Usage: annotate_atomic_strain ref_cfg cur_cfg (sav_cfg=cur_cfg)
       annotate_atomic_strain ref_cfg cur_cfg sav_cfg

The concept of atomic strain is very appealing [a formal citation is F. Shimizu, S. Ogata and J. Li, "Theory of Shear Banding in Metallic Glasses and Molecular Dynamics Calculations," Materials Transactions 48 (2007) 2923-2927]. A minimum requirement on any such measure is that in the limit of homogeneous deformation, the atomic strain should coalesce to the traditional macroscopic strain. Computing the full atomic strain tensor usually requires two configurations, a reference configuration and a current configuration. For example,

% annotate_atomic_strain reference.cfg current.cfg annotated.cfg

Loading reference configuration "reference.cfg"...

Guessing file format of "reference.cfg":
should be Ju Li's CFG format.

Loading configuration from "reference.cfg":
9400 atoms found.. reallocating memory

    | 88.5491   0        0        |    | 88.5491   0        0        |   
H = | 0        117.714    0        | = | 0        117.714    0        | A
    | 0        0        12.781    |    | 0        0        12.781    |   

supercell volume = 133222.354188329 = 133222.354188329 A^3
avg. atomic volume = 14.1725908710989 = 14.1725908710989 A^3
atomic number density = 0.0705587291057154 = 0.0705587291057154 A^-3
avg. mass density = 0.117165502279556 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu      1.000     9400   100.00%   100.00%
---------------------------------------------

Loading current configuration "current.cfg"...

Guessing file format of "current.cfg":
should be Ju Li's CFG format.

Loading configuration from "current.cfg":
9400 atoms found.. reallocating memory

    | 88.5491   8.85491  0        |    | 88.5491   8.85491  0        |   
H = | 0        117.714    0        | = | 0        117.714    0        | A
    | 2.5562   0        12.781    |    | 2.5562   0        12.781    |   

supercell volume = 133222.354188329 = 133222.354188329 A^3
avg. atomic volume = 14.1725908710989 = 14.1725908710989 A^3
atomic number density = 0.0705587291057154 = 0.0705587291057154 A^-3
avg. mass density = 0.117165502279556 g/cm^3

...

"current.cfg" / "reference.cfg" -> "annotated.cfg".
would compare the present configuration current.cfg with a reference configuration reference.cfg, calculate the atomic strain, and save them as auxiliary properties in annotated.cfg. For this to work, current.cfg must have exactly the same set of atoms and the same order as reference.cfg (such two configurations are called isoatomic).

This functionality is now also integrated in the main AtomEye viewer.


vcut: planar cut using Cartesian-space normal

Purpose: cut configuration beyond (and including)
(S0,S1,S2) in the direction dx[] = ds[] * H[][].
Usage: vcut in_file S0 S1 S2 ds0 ds1 ds2 out_file under_pbc

One often would like to get rid of some atoms in a configuration. The simplest request is to remove those atoms above a certain flat plane. In vcut, the plane is specified by a real-space normal dx[], i.e., those atoms with

(x[]-X0[]) dx[]^T = (s[]-S0[]) H dx[]^T = (s[]-S0[]) HH^T ds[]^T  > 0
will be removed, where H is the supercell matrix. For example,
% vcut FCC10x10x10.cfg 0.5 0.5 0.5 1 1 1 FCC10x10x10-cut.cfg 1
Loading "FCC10x10x10.cfg" (assuming PBC)...

s0 = (0.5 0.5 0.5), ds = (1 1 1) cut -> "FCC10x10x10-cut.cfg".
np_old = 32000, np = 16300
creates a (111) facet that passes through the supercell center (plus some others!) in FCC10x10x10-cut.cfg. The 'under_pbc' flag (0 or 1) specifies whether vcut should fold the atoms into the supercell (make s[] in [0,1)) and then cut, or cut first and then fold.

scut: planar cut using s-space normal

Purpose: scut configuration beyond (and including)
(S0,S1,S2) in the direction ds[].
Usage: scut in_file S0 S1 S2 ds0 ds1 ds2 out_file under_pbc

scut is very similar to vcut, except the cutting plane is specified by a s-space normal ds[], i.e., those atoms with

(s[]-S0[]) ds[]^T  > 0
will be removed. This removal criterion is independent of the supercell H-matrix.

One example of how scut may be useful is to consider how to create a stretched surface. We first elongate the pre-cut configuration by editing the

Transform(1,1) = 1
line in FCC10x10x10.cfg, by issuing the command
sed -e 's/^Transform(1,1) = .*/Transform(1,1) = 1.2/' FCC10x10x10.cfg > FCC10x10x10-stretched.cfg
If we look at FCC10x10x10-stretched.cfg using AtomEye, it is visibly deformed. Then, we do
% scut FCC10x10x10-stretched.cfg 0.5 0.5 0.5 1 1 1 FCC10x10x10-stretched-cut.cfg 1
Loading "FCC10x10x10-stretched.cfg" (assuming PBC)...

s0 = (0.5 0.5 0.5), ds = (1 1 1) cut -> "FCC10x10x10-stretched-cut.cfg".
np_old = 32000, np_new = 16300
and we get FCC10x10x10-stretched-cut.cfg, with a smooth stretched (111) surface. Try as you may, it is not very easy to carve a smooth facet out of FCC10x10x10-stretched.cfg using vcut!

p2c: convert PDB configuration to CFG format

PDB may be a great format to store protein configurations, but for hard materials one often needs spatial resolution better than 0.001 A! p2c is a utility to convert your old PDB configurations (DNA.pdb) to the CFG format (DNA.cfg):

% p2c DNA.pdb DNA.cfg
"DNA.pdb" converted -> "DNA.cfg".
Since AtomEye does not yet have a GUI builder, it may be easier to use commercial software to build and/or place some molecules interactively, save as PDB, and then use p2c to convert to CFG. One can then use the suite of tools we offer, including the interface to VASP.

c2p: convert CFG configuration to PDB format

Once in a while you need to use a commercial software, and they understand PDB. So you need to covert your CFG configuration (FCC10x10x10.cfg):

% c2p FCC10x10x10.cfg FCC10x10x10.pdb
"FCC10x10x10.cfg" converted -> "FCC10x10x10.pdb".
To check the conversion result (FCC10x10x10.pdb), you may use AtomEye, as well as RasMol.

perturb_x: spatially perturb a configuration

Purpose: perturb each atom in Cartesian directions [A] by uniformly
distributed random amplitude (-x_amplitude[i]/2, x_amplitude[i]/2).
The center of mass is kept fixed.

Usage: perturb_x in_fname 0.1 out_fname (shake in x)
       perturb_x in_fname 0.1 0.06 out_fname (shake in x,y)
       perturb_x in_fname 0 0.06 0.1 out_fname (shake in y,z)

Sometimes one would like to know whether a high-symmetry configuration is a shallow metastable state, or maybe even unstable. An easy way to check is to perturb the configuration, put it in a static energy minimizer, and see if it relaxes back to the high-symmetry state. perturb_x does this random shaking. For example,

% perturb_x FCC.cfg 0 0.06 0.1 FCC-perturbed.cfg
Loading "FCC.cfg"...

Guessing file format of "FCC.cfg":
should be Ju Li's CFG format.

Loading configuration from "FCC.cfg":
32 atoms found.. reallocating memory

    | 7.2      0        0        |   | 7.2      0        0        |  
H = | 0        7.2      0        | = | 0        7.2      0        | A
    | 0        0        7.2      |   | 0        0        7.2      |  

supercell volume = 373.248 = 373.248 A^3
avg. atomic volume = 11.664 = 11.664 A^3
atomic number density = 0.0857338820301783 = 0.0857338820301783 A^-3
avg. mass density = 9.04669015864521 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu     63.546       32   100.00%   100.00%
---------------------------------------------

Shake each atom in x by <|0| A, y by <|0.03| A, z by <|0.05| A:
"FCC.cfg" -> "FCC-perturbed.cfg".
would shake FCC.cfg into FCC-perturbed.cfg. The reason we use uniform random distribution instead of (say) Gaussian distribution is that the latter is unbounded and potentially may (albeit with small probability) create point defects out of a perfect crystal.

linear_path: generate a sequence of atomistic configurations that linearly interpolate between start and finish.

Usage: linear_path start_fname finish_fname total_nodes
       linear_path start_fname finish_fname total_nodes saveto

Chain-of-states methods such as the nudged elastic band (NEB) algorithm work on a sequence of isoatomic configurations. Just like in the design of the CFG file format for a single configuration, it is worthwhile to pause and think about what is a scientific system for naming and editing chain-of-states configurations. It is decided that the UNIX file system convention, with its glob pathname pattern expansion and command-line operations, provides the most natural and easy-to-use system. A chain is represented by a UNIX glob pattern, such as '/tmp/node*.cfg'. The order of the chain is defined by what 'ls -l /tmp/node*.cfg' will give:

% ls -l /tmp/node*.cfg
-rw-r--r--  1 lij li 23936 Oct 31 19:30 /tmp/node000.cfg
-rw-r--r--  1 lij li 26436 Oct 31 19:30 /tmp/node001.cfg
-rw-r--r--  1 lij li 26438 Oct 31 19:30 /tmp/node002.cfg
-rw-r--r--  1 lij li 26435 Oct 31 19:30 /tmp/node003.cfg
-rw-r--r--  1 lij li 26421 Oct 31 19:30 /tmp/node004.cfg
-rw-r--r--  1 lij li 26369 Oct 31 19:30 /tmp/node005.cfg
-rw-r--r--  1 lij li 26388 Oct 31 19:30 /tmp/node006.cfg
-rw-r--r--  1 lij li 26407 Oct 31 19:30 /tmp/node007.cfg
-rw-r--r--  1 lij li 26395 Oct 31 19:31 /tmp/node008.cfg
-rw-r--r--  1 lij li 23889 Oct 31 19:31 /tmp/node009.cfg

To remove some nodes, we can do:

% rm /tmp/node00[0-4].cfg

To add chain-of-states nodes, it almost always comes down to adding some nodes between two existing nodes. linear_path does this interpolation between two existing configurations. For example,

% linear_path start.cfg finish.cfg 10 node#.cfg
Loading start.cfg:
Loading configuration from "start.cfg":
499 atoms found.. reallocating memory

    | 18.075    0        0        |   | 18.075    0        0        |  
H = | 0        18.075    0        | = | 0        18.075    0        | A
    | 0        0        18.075    |   | 0        0        18.075    |  

supercell volume = 5905.20455127355 = 5905.20455127355 A^3
avg. atomic volume = 11.8340772570612 = 11.8340772570612 A^3
atomic number density = 0.0845017299006828 = 0.0845017299006828 A^-3
avg. mass density = 8.91667273402962 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu     63.546      499   100.00%   100.00%
---------------------------------------------

Loading finish.cfg ...
Loading configuration from "finish.cfg":
499 atoms found.. reallocating memory

    | 18.075    0        0        |   | 18.075    0        0        |  
H = | 0        18.075    0        | = | 0        18.075    0        | A
    | 0        0        18.075    |   | 0        0        18.075    |  

supercell volume = 5905.20455127355 = 5905.20455127355 A^3
avg. atomic volume = 11.8340772570612 = 11.8340772570612 A^3
atomic number density = 0.0845017299006828 = 0.0845017299006828 A^-3
avg. mass density = 8.91667273402962 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu     63.546      499   100.00%   100.00%
---------------------------------------------

Saving node000.cfg ...
Saving node001.cfg ...
Saving node002.cfg ...
Saving node003.cfg ...
Saving node004.cfg ...
Saving node005.cfg ...
Saving node006.cfg ...
Saving node007.cfg ...
Saving node008.cfg ...
Saving node009.cfg ...
adds 8 nodes between start.cfg (same as node000.cfg) and finish.cfg (same as node009.cfg). Here we use '#' as a wild card to represent the node number in the output file pathname pattern, similar to the usage of '*'. To make the order right, it is advisable to use an additional '.' for the new nodes. For example, if we would like to add 4 nodes between node007.cfg and node008.cfg, we should
% cd /tmp
% linear_path node007.cfg node008.cfg 6
% ls -l node*
-rw-r--r--  1 lij li 26369 Oct 31 19:46 node005.cfg
-rw-r--r--  1 lij li 26388 Oct 31 19:46 node006.cfg
-rw-r--r--  1 lij li 26407 Oct 31 19:46 node007.cfg
-rw-r--r--  1 lij li 26407 Oct 31 19:47 node007.cfg.00
-rw-r--r--  1 lij li 26447 Oct 31 19:47 node007.cfg.01
-rw-r--r--  1 lij li 26438 Oct 31 19:47 node007.cfg.02
-rw-r--r--  1 lij li 26391 Oct 31 19:47 node007.cfg.03
-rw-r--r--  1 lij li 26465 Oct 31 19:47 node007.cfg.04
-rw-r--r--  1 lij li 26395 Oct 31 19:47 node007.cfg.05
-rw-r--r--  1 lij li 26395 Oct 31 19:46 node008.cfg
-rw-r--r--  1 lij li 23889 Oct 31 19:46 node009.cfg
% rm node007.cfg.00 node007.cfg.05

iniT: assign kinetic energy

Purpose: assign kinetic energy to configuration.
Usage: iniT in_file T_in_K out_file

This is similar to perturb_x, but in a slightly more MD friendly way. For example,

% iniT FCC4x4x4.cfg 300 FCC4x4x4-300K.cfg
Loading "FCC4x4x4.cfg"...

Guessing file format of "FCC4x4x4.cfg":
should be Ju Li's CFG format.

Loading configuration from "FCC4x4x4.cfg":
2048 atoms found.. reallocating memory

    | 28.8      0        0        |   | 28.8      0        0        |  
H = | 0        28.8      0        | = | 0        28.8      0        | A
    | 0        0        28.8      |   | 0        0        28.8      |  

supercell volume = 23887.872 = 23887.872 A^3
avg. atomic volume = 11.664 = 11.664 A^3
atomic number density = 0.0857338820301783 = 0.0857338820301783 A^-3
avg. mass density = 9.04669015864521 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Cu     63.546     2048   100.00%   100.00%
---------------------------------------------

Tmd = 300 [K] -> "FCC4x4x4-300K.cfg".
would give atoms in FCC4x4x4.cfg (which is originally 0K) random velocities according to the Maxwellian distribution at 300K, and save in FCC4x4x4-300K.cfg. Note that if FCC4x4x4.cfg is perfect crystal (which it is), then performing NVE MD simulation using FCC4x4x4-300K.cfg as the initial configuration for a while is likely going to give you a crystal at 150K, since half of the kinetic energy is going to be transferred to the potential energy in harmonic phonon theory.

VASP utilities:

cfg2vasp | vasp2cfg | vasp2out | vasp2dos | fullrun | chg2xsf


Overview

VASP is a powerful density functional theory (DFT) code. To start running, VASP requires 4 files in the directory: POTCAR, POSCAR, KPOINTS and INCAR. Creating 4 files from scratch is a bit daunting for beginners. cfg2vasp automates this by generating the 4 files with default options, if you have a valid CFG file. (One for four, not bad!) By a valid CFG file, we mean that you have visualized it using AtomEye, say in the coordination-number coloring mode, and everything seems to make sense.

You then issue the command

vasp_4.6_serial_p4
or, if your calculation is gamma-point only (KPOINTS file not read here),
vasp_4.6_gamma_serial_p4
in the same directory, where '4.6' is the version number, and 'p4' is the architecture (Pentium 4) for the optimized VASP binary.

When VASP finishes, a whole bunch of files will be left in the directory, but the most important one is an ASCII file called OUTCAR. It saves all the intermediate atomic coordinates (if you perform ionic relaxation), forces on the atoms, stresses, and total energies. These are what AtomEye handles best, so another utility, vasp2out, is written to parse OUTCAR into multiple CFG files. One can then fire up AtomEye to browse through the relaxation steps (forces on atoms are saved as auxiliary properties), and make movies easily.

We have also written other utilities that have nothing to do with AtomEye directly. For instance, shell script vasp2dos parses the DOSCAR file to plot the density of states (DOS) in PostScript. The spin-polarized version is called vasp2dos2. We also give an example shell script fullrun that calculates the cohesive energy curve of a crystalline phase. Finally, a program chg2xsf that converts CHGCAR to something that can be visualized by XCrySDen is provided as well.


cfg2vasp: prepare a default input deck for VASP

Purpose: create POSCAR
                POTCAR
                KPOINTS (if not in ./)
                INCAR   (if not in ./)
files for Vienna Ab-initio Simulation Package calculation.

Usage: cfg2vasp cfg_fname PREC[Low|Med|High] kspacingxA
        (potdir=/usr/local/VASP/potpaw_GGA/elements)

   or, cfg2vasp cfg_fname PREC[Low|Med|High] kspacingxA potdir
        (e.g. /usr/local/VASP/potpaw/elements)
The above mnemonic information is displayed if one types 'cfg2vasp' without any trailing arguments. To run, cfg2vasp requires just three mandatory arguments. The first is the CFG file name, which you should have already visualized using AtomEye and everything (coordination number, bond length, bond angle, no cracks as you shift the config, etc.) seem OK. The second argument is the precision level of the VASP calculation, which you must select from 'Low', 'Med' or 'High'. The third argument is the k-point sampling spacing, in A^-1. The Monkhorst-Pack grid n_1 x n_2 x n_3 will be chosen by cfg2vasp such that |G_i| / n_i is less than the third argument (G_i is the reciprocal vector of the supercell) for all i=1..3. In other words, kspacingxA specifies the minimum wavelength that the longest Bloch wave must exceed in all three supercell directions. For high-accuracy calculations, kspacingxA should be around 0.2, but it can be as coarse as 0.5. For example, kspacingxA=0.3 would lead to a 7x7x7 Monkhorst-Pack grid for a 2-atom Si primitive cell calculation, which is a reasonable k-point grid. Using a constant kspacingxA gives size-consistent error; that is to say, using kspacingxA=0.2 would give approximately the same level of k-sampling accuracy for a small cell as for a large cell.

The fourth argument is optional. If it is not specified, cfg2vasp would look for pseudopotential files under the '/usr/local/VASP/potpaw_GGA/elements' directory. Which is to say that by default, PAW and PW91-GGA potentials will be used for all atoms. If one would like to use another set of pseudopotentials, or if they are in a different directory, then you should specify the top pseudopotential directory you would like to use as the fourth argument.

As an example, we have a stretched and randomly perturbed silicon configuration in Si-stretched-perturbed.cfg, and we would like to run VASP to relax it.

% rm KPOINTS INCAR 
% cfg2vasp Si-stretched-perturbed.cfg Med 0.3 /usr/local/VASP/potpaw/elements
Loading "Si-stretched-perturbed.cfg"...

Guessing file format of "Si-stretched-perturbed.cfg":
should be Ju Li's CFG format.

Loading configuration from "Si-stretched-perturbed.cfg":
2 atoms found.. reallocating memory

    | 4.224327 0        0        |   | 4.224327 0        0        |  
H = | 2.112163 3.325795 0        | = | 2.112163 3.325795 0        | A
    | 2.112163 1.108598 3.135589 |   | 2.112163 1.108598 3.135589 |  

supercell volume = 44.052656447525 = 44.052656447525 A^3
avg. atomic volume = 22.0263282237625 = 22.0263282237625 A^3
atomic number density = 0.045400213319312 = 0.045400213319312 A^-3
avg. mass density = 2.11733249281878 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Si     28.085        2   100.00%   100.00%
---------------------------------------------

------------- Chemical Species Report -----------
Idx Type  Z  Avg.Mass   Count  Abundance  Wt.Pct.
 0   Si  14   28.085        2   100.00%  100.00%
-------------------------------------------------

"Si-stretched-perturbed.cfg" -> "POSCAR";
2 Si atoms:
"/usr/local/VASP/potpaw/elements/Si/POTCAR" -> "POTCAR";
k-spacing lengths < 0.3/A -> 7 x 7 x 7 -> "KPOINTS";
PREC = Med -> "INCAR";

The reason we remove KPOINTS and INCAR first is because cfg2vasp would not overwrite these two files if they are already in the directory. By default, the INCAR file thus generated uses ISIF=2, which means to relax the ions, but not the supercell volume or shape. If you would like to relax the supercell or add other options, you need to manually edit the INCAR file correspondingly. All cfg2vasp does is to provide you a reasonable INCAR template to start with.

Finally there is a csh script called generate, which is a wrapper around cfg2vasp, that may come in handy. The command section

cat <<EOF >> INCAR
ENCUT  = 358.2
ENAUG  = 550.0
EOF
in generate is needed if we want to calculate adsorption or reaction energies involving multiple species, where several different calculations need to be carried out.

vasp2cfg:

Purpose: convert VASP POSCAR + POTCAR to Ju Li's configuration format.
see http://alum.mit.edu/www/liju99/Graphics/A/ for details.

Usage: vasp2cfg cfg_fname
        (POSCAR, POTCAR in ./)

   or, vasp2cfg POSCAR_fname cfg_fname
        (POTCAR in ./)

   or, vasp2cfg POTCAR_fname POSCAR_fname cfg_fname
This utility does the opposite to cfg2vasp. If you have POSCAR and POTCAR ready, it can convert the geometries to the CFG format so you can view with AtomEye. For instance:
% vasp2cfg result.cfg 
Loading configuration from file "POSCAR":
configuration name = "Si-stretched-perturbed.cfg"
num_species = 1, np = 2;
Loading species designation from file "POTCAR":
2 Si atoms assigned;
"POTCAR" + "POSCAR" -> "result.cfg".
would give result.cfg based on POSCAR and POTCAR in the directory.

vasp2out: parse VASP OUTCAR

Purpose: parse VASP OUTCAR (energy, cell geom., stress)
and save intermediate configurations w/ force-on-atoms
in Ju Li's Extended CFG format. The original INCAR, POSCAR,
POTCAR, KPOINTS inputs and DOSCAR, OUTCAR outputs will also
be copied for preservation.

Usage: vasp2out [output_directory]
For example, suppose we have run
vasp_4.6_serial_p4
in a directory that contains the 4 files: POTCAR, POSCAR, KPOINTS and INCAR. We then run,
% vasp2out

Loading configuration from file "POSCAR":
configuration name = "Si-stretched-perturbed.cfg"
num_species = 1, np = 2;
Loading species designation from file "POTCAR":
2 Si atoms assigned;

------------- Chemical Species Report -----------
Idx Type  Z  Avg.Mass   Count  Abundance  Wt.Pct.
 0   Si  14   28.085        2   100.00%  100.00%
-------------------------------------------------

step = 0, pote = -11.610111 eV
stress = 14.46 8.29 3.375 0.193 -0.071 0.196 GPa
     | 4.224327  0         0        |     
H0 = | 2.112163  3.325795  0        | [A];
     | 2.112163  1.108598  3.135589 |     
total force norm = 1.4e+00, max force on one atom = 9.7e-01 eV/A
OUTCAR -> "out/v00000.cfg"

step = 1, pote = -11.660164 eV
stress = 15.152 5.835 5.107 -0.004 0.929 -0.003 GPa
total force norm = 2.2e-01, max force on one atom = 1.6e-01 eV/A
OUTCAR -> "out/v00001.cfg"

step = 2, pote = -11.660533 eV
stress = 15.157 5.671 5.152 -0.003 0.975 -0.002 GPa
total force norm = 1.9e-01, max force on one atom = 1.4e-01 eV/A
OUTCAR -> "out/v00002.cfg"

step = 3, pote = -11.661571 eV
stress = 15.338 5.418 4.795 -0.006 1.063 -0.004 GPa
total force norm = 3.0e-02, max force on one atom = 2.1e-02 eV/A
OUTCAR -> "out/v00003.cfg"

step = 4, pote = -11.661566 eV
stress = 15.426 5.419 4.751 -0.005 1.09 -0.003 GPa
total force norm = 2.8e-02, max force on one atom = 2.0e-02 eV/A
OUTCAR -> "out/v00004.cfg"

VASP run completed successfully.
The above screen output contains concise summary of the most important data contained in OUTCAR. The six stress components after 'stress =' are sigma11, sigma22, sigma33, sigma23, sigma13, sigma12, in Voigt order. A copy of the screen output is archived in results.txt of out/, as well as the intermediate configurations "v00000.cfg", "v00001.cfg", ..., "v00004.cfg". We can then use AtomEye to follow the entire relaxation sequence:
cd out/
A v00000.cfg
by pressing 'Delete'/'Insert' keys, or pressing 'y' to animate the whole sequence. Forces on atoms can be interrogated by right-clicking on the particular atom, as well as directly seen as auxiliary properties.

vasp2dos: plot VASP density of states

The DOSCAR file stores the electronic density of states (DOS) of all ionic relaxation steps (concatenated). The vasp2dos utility parses the DOSCAR file, and then plots them in Encapsulated PostScript format using gnuplot. The spectrum is shifted so that the Fermi level is always at 0 in the plot. This utility is based on the original ksh scripts of Steven C. Erwin.

To run, you must download the three csh scripts to your runpath, and then in the directory where your DOSCAR file is, type

 
% vasp2dos
Step 0, efermi = -2.00767326, total DOS -> DOS/00000/dos.out
Step 1, efermi = -1.87266202, total DOS -> DOS/00001/dos.out
Step 2, efermi = -1.98073133, total DOS -> DOS/00002/dos.out

The outputs will be stored in the DOS/ directory.

If you run a spin-polarized calculation, then you need to download and run vasp2dos2 instead. The results are shown here.


fullrun: calculate cohesive energy curve

This is where everything is pulled together in one script, to calculate the cohesive energy of beta-SiC! To run, you only need to write a template configuration file called template.cfg, which you should check with AtomEye. Then, you change one or two parameter in fullrun, most likely LatticeConstantRef value, which is the roughly estimated equilibrium lattice constant of the crystal, in Angstrom. Then, just type
fullrun
and the computed energy vs. lattice constant results will be stored in a file called coh.out. Matlab scripts can then used to interpolate the data and calculate the equilibrium lattice constant and bulk modulus.

chg2xsf: convert CHGCAR to XCrySDen XSF format

Purpose: convert VASP CHGCAR to XCrySDen XSF format:
see http://www.xcrysden.org/doc/XSF.html for details.

Usage: chg2xsf xsf_fname
        (CHGCAR, POTCAR in ./)

   or, chg2xsf CHGCAR_fname xsf_fname
        (POTCAR in ./)

   or, chg2xsf POTCAR_fname CHGCAR_fname xsf_fname
For example, running chg2xsf in the directory gives:
% chg2xsf demo.xsf
Loading configuration from file "CHGCAR":
configuration name = "run.cfg"
num_species = 3, np = 19;
Loading species designation from file "POTCAR":
16 Pt atoms assigned;
1  O atoms assigned;
2  H atoms assigned;
"POTCAR" + "CHGCAR" -> "demo.xsf".
chg2xsf works even when CHGCAR is compressed by gzip / bzip2. If you are really lazy like me, then you may also like a C shell script chg to view CHGCAR directly.

Gaussian utilities: fch2cfg | fch2cube

Gaussian is a standard quantum chemistry code. To start a run, you need an input .com file. The main output is a .log file. GaussView, Molden, gOpenMol and XCrySDen are softwares that can work with Gaussian. Gaussian itself provides a suite of tools such as cubegen that facilitates this process. However, the "syntax" to work with Gaussian output can be a bit quirky, so we have come up with a set of painless one-liners.

Before we introduce the post-processing tools, here is a shell script gaussian03 that makes running Gaussian easier:

gaussian03 test000.com
Note that the input file test000.com has a keyword
# formcheck
in it, which generates the Formatted Checkpoint file test000.fch. fch2cfg can then convert this .fch file to a CFG file, with bounding box information about the .fch file. The shell script fch2cube can then pick out the desired orbitals from the .fch file easily.

fch2cfg: convert Gaussian fch file to CFG format

Purpose: convert Gaussian FChk file to Ju Li's config file.

Usage: fch2cfg FChk_fname [cfg_fname] [padding0 padding1 padding2]
        (default padding = 4 Angstrom)
Since Gaussian by default does not adopt periodic boundary condition, i.e. it studies molecular clusters, one needs to specify in what box should we contain the cluster in the CFG file. By default, we will use an orthorhombic box whose edges are |xmax-xmin|+4 , |ymax-ymin|+4 and |zmax-zmin|+4 Angstroms, where xmax,xmin,ymax,ymin,zmax,zmin are the extreme x,y,z coordinates among all atoms, in Angstroms. This default 4 Angstrom padding can be changed on the command line. For example,
% fch2cfg test000.fch test000.cfg 5. 5. 5.
Loading "test000.fch" ...
configuration name = "Gaussian Test Job 00 Water with archiving"
3 atoms found.. reallocating memory

------------- Chemical Species Report -----------
Idx Type  Z  Avg.Mass   Count  Abundance  Wt.Pct.
 0    O   8   15.999        1    33.33%   88.81%
 1    H   1    1.008        2    66.67%   11.19%
-------------------------------------------------

"test000.fch" -> "test000.cfg"
The output test000.cfg file contains in its comment lines information about xmax,xmin,ymax,ymin,zmax,zmin, which is useful for fch2cube later. To make visualization using AtomEye easier, the center of mass of the molecular clusters is shifted to the box center in the CFG file.

fch2cube: derive Gaussian orbitals in cub format from fch file

Purpose: extract MOs from Gaussian FChk file.
 
Usage: % fch2cube FChk_fname start_MO [end_MO] [grid_spacing_in_A]
 
For example
% fch2cube /usr/local/gOpenMol/data/Gaussian/2p.fch h-2 l+2 0.3
% fch2cube /usr/local/gOpenMol/data/Gaussian/2p.fch l+3
 
symbols 'h' stands for HOMO, 'l' stands for LUMO.
Molecular orbitals, especially those around HOMO and LUMO, are fun to watch! For instance,
% fch2cube test000.fch h-1 l+1 0.2
 
Number_of_electrons = 10
homo = 5
orbitals = 4 : 7
 
Loading "test000.fch" ...
configuration name = "Gaussian Test Job 00 Water with archiving"
3 atoms found.. reallocating memory

------------- Chemical Species Report -----------
Idx Type  Z  Avg.Mass   Count  Abundance  Wt.Pct.
 0    O   8   15.999        1    33.33%   88.81%
 1    H   1    1.008        2    66.67%   11.19%
-------------------------------------------------

"test000.fch" -> "test000.cfg"
 
xmin = -0.000000000000000
xmax = -0.000000000000000
ymin = -0.783836409071210
ymax = 0.783836409071210
zmin = -0.443404832124133
zmax = 0.110851207898739
 
30 x 37 x 37 grid:
running cubegen for MO 7=lumo+1
running cubegen for MO 6=lumo
running cubegen for MO 5=homo
running cubegen for MO 4=homo-1
generates test000.4=homo-1.cub, test000.5=homo.cub, test000.6=lumo.cub and test000.7=lumo+1.cub files, which can viewed with GaussView or XCrySDen. Especially, shell scripts xc and xcc facilitate the viewing of .cub file with XCrySDen.

Dacapo utilities: cfg2dacapo

Dacapo is an open-source planewave DFT code. To start a run, you need a Python script.

cfg2dacapo: prepare a default Python script for Dacapo

Purpose: create template python script for CAMPOS/Dacapo DFT calculation.

Usage: cfg2dacapo cfg_fname kspacingxA
        (potdir=/usr/local/dacapo/DACAPOPATH)

   or, cfg2dacapo cfg_fname kspacingxA potdir
        (e.g. ~/dacapo/DACAPOPATH)
The above mnemonic information is displayed if one types 'cfg2dacapo' without any trailing arguments. To run, cfg2dacapo requires just two mandatory arguments. The first is the CFG file name, which you should have already visualized using AtomEye and everything (coordination number, bond length, bond angle, no cracks as you shift the config, etc.) seem OK. The second argument is the k-point sampling spacing, in A^-1. The Monkhorst-Pack grid n_1 x n_2 x n_3 will be then chosen by cfg2dacapo such that |G_i| / n_i is less than the third argument (G_i is the reciprocal vector of the supercell) for all i=1..3. In other words, kspacingxA specifies the minimum wavelength that the longest Bloch wave must exceed in all three supercell directions. For high-accuracy calculations, kspacingxA should be around 0.2, but it can be as coarse as 0.5. For example, kspacingxA=0.3 would lead to a 7x7x7 Monkhorst-Pack grid for a 2-atom Si primitive cell calculation, which is a reasonable k-point grid. Using a constant kspacingxA gives size-consistent error; that is to say, using kspacingxA=0.2 would give approximately the same level of k-sampling accuracy for a small cell as for a large cell.

The third argument is optional. If it is not specified, cfg2dacapo would look for pseudopotential files under the '/usr/local/dacapo/DACAPOPATH' directory. If one would like to use another set of pseudopotentials, or if they are in a different directory, then you should specify the top pseudopotential directory you would like to use as the third argument.

As an example, we have a stretched and randomly perturbed silicon configuration in Si.cfg, and we would like to run Dacapo to relax it.

% cfg2dacapo Si.cfg 0.3

Loading "Si.cfg"...

Guessing file format of "Si.cfg":
should be Ju Li's CFG format.

Loading configuration from "Si.cfg":
2 atoms found.. reallocating memory

    | 4.224327 0        0        |   | 4.224327 0        0        |  
H = | 2.112163 3.325795 0        | = | 2.112163 3.325795 0        | A
    | 2.112163 1.108598 3.135589 |   | 2.112163 1.108598 3.135589 |  

supercell volume = 44.052656447525 = 44.052656447525 A^3
avg. atomic volume = 22.0263282237625 = 22.0263282237625 A^3
atomic number density = 0.045400213319312 = 0.045400213319312 A^-3
avg. mass density = 2.11733249281878 g/cm^3

-------------- Species Summary --------------
Type  Mass[amu]   Count  Abundance  Wt. Pct.
 Si     28.085        2   100.00%   100.00%
---------------------------------------------

------------- Chemical Species Report -----------
Idx Type  Z  Avg.Mass   Count  Abundance  Wt.Pct.
 0   Si  14   28.085        2   100.00%  100.00%
-------------------------------------------------

"Si.cfg" -> "Si.py"

One then needs to inspect Si.py, and modify if necessary (especially, check if the pseudopotential potential files are what are intended). One then simply types
% Si.py
to run.
If you have problem using the tools or have new tool ideas, please let me know. Email: [email protected], phone: 614-292-9743.
Free Web Counter
Site Counter