add coeffploter.py and gr2sq.py

This commit is contained in:
大窪 貴洋
2022-08-31 19:05:22 +09:00
parent baa8342e12
commit 9d446f1d61
3 changed files with 2754 additions and 0 deletions
+516
View File
@@ -0,0 +1,516 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-08-31 水 19:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>dump2sq</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="大窪 貴洋" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js"></script>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.add("code-highlighted");
target.classList.add("code-highlighted");
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.remove("code-highlighted");
target.classList.remove("code-highlighted");
}
}
/*]]>*///-->
// @license-end
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content">
<h1 class="title">dump2sq</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org76c8c19">はじめに</a></li>
<li><a href="#org3646915">入力ファイル</a>
<ul>
<li><a href="#org29f6517">LAMMPS</a></li>
<li><a href="#org8b634bb">XYZ</a></li>
</ul>
</li>
<li><a href="#org39f07e8">出力ファイル</a>
<ul>
<li><a href="#orgd46ce4e">積算配位数</a></li>
<li><a href="#org0c47f5e">動径分布関数</a></li>
<li><a href="#org3650f5e">構造因子</a></li>
<li><a href="#org5ea7d6f">原子散乱因子と中性子散乱長</a></li>
</ul>
</li>
<li><a href="#org34fb617">インストール</a></li>
<li><a href="#org0e462aa">使い方</a></li>
<li><a href="#org5bf6dd9">misc</a>
<ul>
<li><a href="#org8da4ec6">coeffploter.py</a></li>
<li><a href="#orgbc8b4dc">gr2sq.py</a></li>
</ul>
</li>
</ul>
</div>
</div>
<p>
<br />
</p>
<div id="outline-container-org76c8c19" class="outline-2">
<h2 id="org76c8c19">はじめに</h2>
<div class="outline-text-2" id="text-org76c8c19">
<p>
複数の時間ステップからなる時間ステップの構造データから、動径分布関数
\(g(r)\) 、積算配位数 \(CN(r)\) 、構造因子 \(S(Q)\) を計算するプログラムです。
Triclinicなセルでも計算できます。原子ペア毎の\(S(Q)\) を計算した後、原子
散乱因子または中性子散乱長を使って、X-rayと中性子回折実験的で観測され
る \(S(Q)\) を計算します。\(g(r)\) は、セルサイズ \(L/2\) を超えても計算でき
ます。\(L/2\sqrt{3}\) まで確保しても良さそうです。産総研の土田さんにアド
バイスいただきました。
</p>
<p>
<a href="https://www.cmu.edu/biolphys/deserno/pdf/gr_periodic.pdf">https://www.cmu.edu/biolphys/deserno/pdf/gr_periodic.pdf</a>
</p>
<p>
1ステップ毎に\(g(r)\) と\(S(Q)\) を計算して最後に時間平均しています。よっ
て、NPT計算でセルサイズが変わったとしても問題なく計算できます。計算コ
ストのほとんどは、原子間距離の計算です。
</p>
</div>
</div>
<div id="outline-container-org3646915" class="outline-2">
<h2 id="org3646915">入力ファイル</h2>
<div class="outline-text-2" id="text-org3646915">
<p>
拡張子で入力ファイルのformatを判断しています。
</p>
</div>
<div id="outline-container-org29f6517" class="outline-3">
<h3 id="org29f6517">LAMMPS</h3>
<div class="outline-text-3" id="text-org29f6517">
<p>
dumpコマンドで生成したファイルで、拡張子は.trajectryです。1ス
テップ目で原子のならび決めて、2ステップ目以降は、同じ原子の並びとし
て計算しています。時間ステップで原子の並びが変わると、正しい結果に
ならないので注意してください。データの並びを決め打ちしています。そ
のため、以下のようにdumpとdump_modifyで元素記号の出力し、idでsortし
ておく必要があります。
</p>
<pre class="example" id="orged3296d">
dump 1 all custom 10 hoge.lammpstrj id type element x y z
dump_modify 1 element Si O sort id
</pre>
</div>
</div>
<div id="outline-container-org8b634bb" class="outline-3">
<h3 id="org8b634bb">XYZ</h3>
<div class="outline-text-3" id="text-org8b634bb">
<p>
xyz形式で、拡張子は.xyzまたは.10です。す。1行目に原子数、2行目に
Step数と、格子定数を記述しておきます。alpha, beta, gammaがない場合
は、90, 90, 90とします。3行目以降にデータがならびます。2ステップ目
以降も同じ形式でデータを並べます。
</p>
<pre class="example" id="org6a56237">
420
Step 225837 18.4116484 18.4116484 18.4116484 90 90 90
Si 10.560073 17.438902 6.614775
O 17.812448 0.110128 0.3462461
.
.
.
</pre>
</div>
</div>
</div>
<div id="outline-container-org39f07e8" class="outline-2">
<h2 id="org39f07e8">出力ファイル</h2>
<div class="outline-text-2" id="text-org39f07e8">
<p>
4つのファイルに拡張子を追加して出力します。basenameは、指定しなけれ
ば、インプットファイルと同じになります。
</p>
</div>
<div id="outline-container-orgd46ce4e" class="outline-3">
<h3 id="orgd46ce4e">積算配位数</h3>
<div class="outline-text-3" id="text-orgd46ce4e">
<p>
拡張子はcnです。原子ペア毎の \(CN(r)\) が保存されています。
</p>
</div>
</div>
<div id="outline-container-org0c47f5e" class="outline-3">
<h3 id="org0c47f5e">動径分布関数</h3>
<div class="outline-text-3" id="text-org0c47f5e">
<p>
拡張子はgrです。原子ペア毎の \(g(r)\) と全原子 \(G(r)\) が保存されています。
</p>
</div>
</div>
<div id="outline-container-org3650f5e" class="outline-3">
<h3 id="org3650f5e">構造因子</h3>
<div class="outline-text-3" id="text-org3650f5e">
<p>
拡張子はsqです。原子ペア毎の \(S(Q)\) とX線と中性子で観測される \(S(Q)\) が保存されています。
</p>
</div>
</div>
<div id="outline-container-org5ea7d6f" class="outline-3">
<h3 id="org5ea7d6f">原子散乱因子と中性子散乱長</h3>
<div class="outline-text-3" id="text-org5ea7d6f">
<p>
拡張子はcoeffです。中性子散乱長と原子散乱因子を出力します。原子散乱
因子は、<a href="https://www.szfki.hu/~nphys/rmc++/downloads.html">xcoeff.f</a>から抽出しています。中性子散乱長は、<a href="https://www.ncnr.nist.gov/resources/n-lengths/">NIST</a>のデータを
参照しています。
</p>
</div>
</div>
</div>
<div id="outline-container-org34fb617" class="outline-2">
<h2 id="org34fb617">インストール</h2>
<div class="outline-text-2" id="text-org34fb617">
<p>
プログラムはCで作成しています。Cのコンパイラを準備してmakeしてください。
ダウンロードして単にmakeしてください。
</p>
<p>
<a href="dump2sq-1.0.tar.gz">dump2sq-1.0.tar.gz</a>
</p>
<pre class="example" id="org33a749e">
make
</pre>
</div>
</div>
<div id="outline-container-org0e462aa" class="outline-2">
<h2 id="org0e462aa">使い方</h2>
<div class="outline-text-2" id="text-org0e462aa">
<p>
並列計算のために、環境変数をセットしてスレッド数を指定しておく。
</p>
<pre class="example" id="orgbb8d7d8">
export OMP_NUM_THREADS=4
</pre>
<p>
example以下のglass.lammpstrjを引数で渡して実行してみます。
</p>
<pre class="example" id="org51289f7">
dump2sq example/glass.lammpstrj
</pre>
<p>
デフォルトで、\(g(r)\) を計算する\(r\) の最大値は、もっとも小さいセル長
さの半分としています。プログラムが実行されると、次のように出力されて、
4つのファイルが出力されます。
</p>
<pre class="example" id="org70a2314">
basename: example/glass
Maximum cell length = 17.284100
Rmax = 8.642050
Start Gr and Sq calculation...
Calculation 0 steps...
Calculation 10 steps...
Calculation 20 steps...
Calculation 30 steps...
Calculation 40 steps...
Calculation 50 steps...
Calculation 60 steps...
Calculation 70 steps...
Calculation 80 steps...
Calculation 90 steps...
Total: 99 steps
example/glass.coeff was generated.
example/glass.cn was generated.
example/glass.gr was generated.
example/glass.sq was generated.
</pre>
<p>
\(g(r)\) の\(r\) ステップや最大値、\(Q\) の範囲をコマンドラインで指定できます。詳細
は、ヘルプを参照してください。ヘルプで表示される[ ]の値はデフォルト
値です。GRmaxは、セルサイズを超えても計算できますが、物理的な意味は
ないでしょう。
</p>
<pre class="example" id="org289f362">
./dump2sq -h
usage: dump2sq [options] inputfile
inputfile format
LAMMPS: *.lammpstrj
FEMTECK: *.10
options:
-h --help show this help message
--SQmin=%f Q minimum [0.2]
--SQmax=%f Q maximum [30]
--SQdel=%d Q delta [0.02]
--GRmin=%f r minimum [0.025]
-r --GRmax=%f r maximum [L(minium cell length)*0.5]
-s --GRdel=%d r delta [0.05]
-o --output=%s Output basename [basename]
</pre>
</div>
</div>
<div id="outline-container-org5bf6dd9" class="outline-2">
<h2 id="org5bf6dd9">misc</h2>
<div class="outline-text-2" id="text-org5bf6dd9">
</div>
<div id="outline-container-org8da4ec6" class="outline-3">
<h3 id="org8da4ec6">coeffploter.py</h3>
<div class="outline-text-3" id="text-org8da4ec6">
<p>
元素を指定して、原子散乱因子と中性子散乱長をプロットする。
</p>
</div>
</div>
<div id="outline-container-orgbc8b4dc" class="outline-3">
<h3 id="orgbc8b4dc">gr2sq.py</h3>
<div class="outline-text-3" id="text-orgbc8b4dc">
<p>
Qの刻みを変えて再計算するために、dump2sqで生成したgrファイルからS(Q)を計算しなおす。結晶のパターンを計算するために、\(2\theta\) で\(Q\) を指定して計算することもできる。
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: 大窪 貴洋</p>
<p class="date">Created: 2022-08-31 水 19:04</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>