動作環境
Xeon E5-2620 v4 (8コア) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 とその-devel
mpich.x86_64 3.1-5.el6とその-devel
gcc version 4.4.7 (とgfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.1を使用。
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
Python 3.6.0 on virtualenv
GAMESS version:20 Apr 2017(R1)
Intel Math Kernel Library version 12
量子化学計算のGAMESS
http://www.msg.ameslab.gov/gamess/index.html
計算はできるようになってきたが、出力ファイルが読みにくい。
1300行近くあるテキストファイルの中を探していくことになりそうだ。
タイトルだけでもMarkdown形式にして、必要な項目がすぐに見つかるような仕組みがあれば良いように思う。
Markdownのヘッダタグをつけるbash scriptを用意するのがいいかもしれない。
対象項目
exam01.logの例
- ECHO OF THE FIRST FEW INPUT CARDS
- BASIS OPTIONS
- RUN TITLE
- INTERNUCLEAR DISTANCES (ANGS.)
- ATOMIC BASIS SET
- $CONTRL OPTIONS
- $SYSTEM OPTIONS
- PROPERTIES INPUT
- INTEGRAL TRANSFORMATION OPTIONS
- INTEGRAL INPUT OPTIONS
- THE POINT GROUP IS CNV, NAXIS= 2, ORDER= 4
- STATIONARY POINT LOCATION RUN
- 1 ELECTRON INTEGRALS
- GUESS OPTIONS
- AO INTEGRAL TECHNOLOGY
- 2 ELECTRON INTEGRALS
- RHF SCF CALCULATION
- DENSITY CONVERGED
- EIGENVECTORS
- PROPERTY VALUES FOR THE RHF SELF-CONSISTENT FIELD WAVEFUNCTION
- ENERGY COMPONENTS
- MULLIKEN AND LOWDIN POPULATION ANALYSES
- BOND ORDER AND VALENCE ANALYSIS
- ELECTROSTATIC MOMENTS
- GRADIENT OF THE ENERGY
- GRADIENT (HARTREE/BOHR)
- INTERNUCLEAR DISTANCES (ANGS.)
- RHF SCF CALCULATION
- DENSITY CONVERGED
- MOLECULAR ORBITALS
- PROPERTY VALUES FOR THE RHF SELF-CONSISTENT FIELD WAVEFUNCTION
- ENERGY COMPONENTS
- MULLIKEN AND LOWDIN POPULATION ANALYSES
- ELECTROSTATIC MOMENTS
- CPU timing information for all processes
処理案
- 上記の文字列の前の空白(tabではない)を消す
- 空白の数は項目によって異なる
- ヘッダ記号(
###
)を付ける
v0.2
code
CODE_170829/toMarkdown_170829.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import subprocess
import sys
'''
v0.2 Aug. 29, 2017
- set GAMESS output strings to [targets]
v0.1 Aug. 29, 2017
- can replace sample strings (e.g., "A B C", "D E F", and "G H I")
'''
# On Python 2.6.6
# coding rule:PEP8
# { Configuration----
# Set strings lists for GAMESS output
targets = ("ECHO OF THE FIRST FEW INPUT CARDS",
"BASIS OPTIONS",
"RUN TITLE",
"INTERNUCLEAR DISTANCES (ANGS.)",
"ATOMIC BASIS SET",
"$CONTRL OPTIONS",
"$SYSTEM OPTIONS",
"PROPERTIES INPUT",
"INTEGRAL TRANSFORMATION OPTIONS",
"INTEGRAL INPUT OPTIONS",
"THE POINT GROUP IS ",
"STATIONARY POINT LOCATION RUN",
"1 ELECTRON INTEGRALS",
"GUESS OPTIONS",
"AO INTEGRAL TECHNOLOGY",
"2 ELECTRON INTEGRALS",
"RHF SCF CALCULATION",
"DENSITY CONVERGED",
"EIGENVECTORS",
"PROPERTY VALUES FOR THE RHF SELF-CONSISTENT FIELD WAVEFUNCTION",
"ENERGY COMPONENTS",
"MULLIKEN AND LOWDIN POPULATION ANALYSES",
"BOND ORDER AND VALENCE ANALYSIS",
"ELECTROSTATIC MOMENTS",
"GRADIENT OF THE ENERGY",
"GRADIENT (HARTREE/BOHR)",
"MOLECULAR ORBITALS",
"CPU timing information for all processes"
)
# } Configuration----
if len(sys.argv) < 3:
print('ERROR: invalid runtime parameter')
print('\ntype:')
print('python %s [input file] [output file]' % sys.argv[0])
sys.exit()
IN_FILE = sys.argv[1]
OUT_FILE = sys.argv[2]
WRK_FILE = 'wrk.md'
for elem in targets:
# 1. replace
cmd = "sed 's/ *%s/###%s/g' %s > %s" % (
elem, elem, IN_FILE, WRK_FILE)
# print(cmd) # for debug
subprocess.call(cmd, shell=True)
# 2. move
# because (sed 's/A/B/g' in > in) will delete [in] file
cmd = 'mv %s %s' % (WRK_FILE, OUT_FILE)
subprocess.call(cmd, shell=True)
# sys.exit() # for debug
IN_FILE = OUT_FILE
変換例
項目ごとのジャンプはしやすくなった。
Markdownの解釈によって、読みにくい部分もある。