mathjax-yard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/.yardopts +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +18 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/README_ja.md +77 -0
- data/docs/atom.md +121 -0
- data/docs/potential2.md +103 -0
- data/exe/mathjax-yard +5 -0
- data/lib/mathjax-yard.rb +177 -0
- data/lib/mathjax-yard/version.rb +3 -0
- data/mathjax-yard.gemspec +34 -0
- data/mathjax.yml +30 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6d8b65552dc840ff630b6a324a147116de9ceeb6
|
4
|
+
data.tar.gz: 6e43bb51651c7bd13a80fbbac93152da3405a121
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b9112d32f727de7efed3a5a3fdf1b8823f18ed3d4f63f6f212b6752d1463b1513a89897ee780eb882761d38de357d894a3a8c7375c8c50ea00bd3e76be6e48a
|
7
|
+
data.tar.gz: 1ec1e8fcd6d5541aa33d5d296c9d44985fe6a4b6fc09667a8db43c17ce6a7d6a7c0bef1c9d7ffebf10628a7764fc78c30a1f1af2fc9d190356b9c8aa17f76716
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at shigeto_nishitani@me.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Shigeto R. Nishitani
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# MathJaxYard
|
2
|
+
|
3
|
+
mathjax-yard is a mathjax extension for markdown in yard.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'mathjax-yard'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install mathjax-yard
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
mathjax-yard is intended to be a command line tool, using in Rakefile as follows.
|
24
|
+
|
25
|
+
```
|
26
|
+
desc "make documents by yard"
|
27
|
+
task :yard do
|
28
|
+
system('mathjax-yard')
|
29
|
+
YARD::Rake::YardocTask.new
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "make documents with yardmath"
|
33
|
+
task :mathjax do
|
34
|
+
system('mathjax-yard --post')
|
35
|
+
end
|
36
|
+
```
|
37
|
+
mathjax-yard search ./*/*.md and replace '$...$' or '$$...$$' to $MATHJAX**$ tags, and make 'mathjax.yml' for storing these relations. After the normal YARD operation has done, 'mathjax-yard --post' replacement will be done on 'doc/file.*.html'. The yard options are
|
38
|
+
|
39
|
+
```
|
40
|
+
-t mathjax -p templates
|
41
|
+
-
|
42
|
+
spec/*.md
|
43
|
+
```
|
44
|
+
|
45
|
+
The mathjax layout should be included in yard layout.
|
46
|
+
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec mathjax-yard` to use the gem in this directory, ignoring other installed copies of this gem.
|
51
|
+
|
52
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mathjax-yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
57
|
+
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require 'yard'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
desc "make documents by yard"
|
10
|
+
task :yard do
|
11
|
+
system('mathjax-yard')
|
12
|
+
YARD::Rake::YardocTask.new
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "make documents with yardmath"
|
16
|
+
task :mathjax do
|
17
|
+
system('mathjax-yard --post')
|
18
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mathjax/yard"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/docs/README_ja.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# MathJaxYard
|
2
|
+
|
3
|
+
mathjax-yardはyardによるmarkdown変換においてmathjaxを使えるようにする拡張機能です.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'mathjax-yard'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install mathjax-yard
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
mathjax-yardはcommand line toolとしての使用を意図して作られています.例えば,Rakefileでの使用例は次の通りです.
|
24
|
+
|
25
|
+
```
|
26
|
+
desc "make documents by yard"
|
27
|
+
task :yard do
|
28
|
+
system('mathjax-yard')
|
29
|
+
YARD::Rake::YardocTask.new
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "make documents with yardmath"
|
33
|
+
task :mathjax do
|
34
|
+
system('mathjax-yard --post')
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
yardのデフォルトでの動作をなぞって,動作するように作られています.
|
39
|
+
* mathjax-yardは./*/*.mdを探索し,それらの中に'$...$'あるいは'$$...$$'があると$MATHJAX**$というタグに付け替え,
|
40
|
+
* *.md.backとしたファイルに元ファイルのバックアップを取り,*.mdにタグ付け替えした内容を保存します.
|
41
|
+
*また,同時に, 'mathjax.yml'にそれらのhash関係をyaml形式で保存します.
|
42
|
+
* 通常のrake yardで変換したのち,
|
43
|
+
* 'mathjax-yard --post'によって,'doc/file.*.html'に残されたtagを元に戻します.
|
44
|
+
* また同時に,backファイルを元に戻します.
|
45
|
+
|
46
|
+
yardのoptionは,.yardoptsに
|
47
|
+
|
48
|
+
```
|
49
|
+
-t mathjax -p templates
|
50
|
+
-
|
51
|
+
spec/*.md
|
52
|
+
```
|
53
|
+
|
54
|
+
としています.また,htmlのhead部分にmathjaxのscriptを埋め込んだlayoutを用意しています.
|
55
|
+
|
56
|
+
```csh
|
57
|
+
bob% bundle exec exe/mathjax-yard --help
|
58
|
+
Usage: yardmath [options] [DIRECTORY]
|
59
|
+
-v, --version show program Version.
|
60
|
+
-r, --revert revert mjx file to orig file.
|
61
|
+
-p, --post post operation.
|
62
|
+
```
|
63
|
+
|
64
|
+
## Development
|
65
|
+
|
66
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec mathjax-yard` to use the gem in this directory, ignoring other installed copies of this gem.
|
67
|
+
|
68
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
69
|
+
|
70
|
+
## Contributing
|
71
|
+
|
72
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mathjax-yard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
73
|
+
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/docs/atom.md
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# 概要
|
2
|
+
# EAM
|
3
|
+
EAM(Embedded atom method)は1980年代以降に,盛んに使われるようになった経験的原子間ポテンシャルである.
|
4
|
+
|
5
|
+
## エネルギー表記
|
6
|
+
EAMは原子$i$のエネルギーを
|
7
|
+
|
8
|
+
$$
|
9
|
+
E_i = \sum_j\phi \left( r_j \right) + f(\rho)
|
10
|
+
$$
|
11
|
+
|
12
|
+
と表記する.右辺第1項は単なる2体間の相互作用を表わす.
|
13
|
+
右辺第2項が多体項と呼ばれるEAMに特徴的な項である.
|
14
|
+
この工夫によって原子空孔を初め多くの金属物性を
|
15
|
+
うまく表現することが可能となった.詳しくは西谷・赤本参照.
|
16
|
+
|
17
|
+
さて,$r_j$はこの場合原子$j$との距離を意味しており,$E_i$は原子$i$の周りの原子との和によって求まる.多体項は,一般的に
|
18
|
+
|
19
|
+
$$
|
20
|
+
f(\rho) =\sqrt{\rho}=\sqrt{\sum_j h^2 \left( r_j \right) }
|
21
|
+
$$
|
22
|
+
|
23
|
+
によって求められる.$\rho$は強結合(tight binding)理論の2次モーメント近似と捉えると,電子密度を表わすとされている.
|
24
|
+
|
25
|
+
## 具体例
|
26
|
+
### for phi(r0)=-3.39, Ev=0.8, p=3.0 at r0=2.8577
|
27
|
+
```maple
|
28
|
+
|
29
|
+
A0,B0,P,POQ,Q:=69.1378255, 12.47431958,
|
30
|
+
2.148157653, 2.893854749, 0.7423170267;
|
31
|
+
|
32
|
+
-3.39*32;
|
33
|
+
-108.48
|
34
|
+
```
|
35
|
+
```
|
36
|
+
n:=12;
|
37
|
+
ene:=r->n*A0*exp(-P*r);
|
38
|
+
h:=r->B0*exp(-Q*r);
|
39
|
+
rho:=r->12*h(r)^2;
|
40
|
+
plot(ene(r)-sqrt(rho(r)),r=2..4);
|
41
|
+
```
|
42
|
+
![](eam_ev_plot.gif)
|
43
|
+
```
|
44
|
+
r0:=fsolve(diff(ene(r)-sqrt(rho(r)),r),r=3);
|
45
|
+
2.857701344
|
46
|
+
evalf(subs(r=r0,ene(r)-sqrt(rho(r))));
|
47
|
+
-3.390000002
|
48
|
+
```
|
49
|
+
```math
|
50
|
+
E_i = \sum _ j\phi \left( r_{{j}} \right) + \h \left( r_{{j}} \right)
|
51
|
+
```
|
52
|
+
|
53
|
+
# LJ
|
54
|
+
LJ(Lennard-Jones)はもっとも簡単な2体のポテンシャル.
|
55
|
+
|
56
|
+
## エネルギー表記
|
57
|
+
|
58
|
+
## 具体例
|
59
|
+
```maple
|
60
|
+
A0:=1.587401051*0.7071067812/2.857701314;
|
61
|
+
E0:=-1*4.0/12.0;
|
62
|
+
|
63
|
+
A:=18.19007708;
|
64
|
+
B:=89.22765864;
|
65
|
+
phi:=r-> 12*(-A*(1/r**3)+B*(1/r**5));
|
66
|
+
r0:=fsolve(diff(phi(r),r),r=3);
|
67
|
+
2.859281101
|
68
|
+
phi(r0);
|
69
|
+
-3.735125644
|
70
|
+
```
|
71
|
+
|
72
|
+
![](lj_ev_plot.gif)
|
73
|
+
|
74
|
+
# EAM fitting
|
75
|
+
|
76
|
+
EAM potentialの種々の構築手法を詳解する.
|
77
|
+
## background
|
78
|
+
MCにおいて$NPT$一定の計算がうまくいっていない.
|
79
|
+
- 覚埜式の$E-V$プロットをすると小体積でのエネルギの上がりが低い.
|
80
|
+
- $T=0.1$[eV]で融けているよう
|
81
|
+
なので,もう少し精密にEAMポテンシャルを構築してみる.
|
82
|
+
|
83
|
+
## poq fixed
|
84
|
+
|
85
|
+
EAM potentialにおいて単原子空孔の生成エネルギ$E_v$は
|
86
|
+
|
87
|
+
$$
|
88
|
+
E_v = -\frac{E_c}{2} \frac{2-poq}{1-poq}
|
89
|
+
$$
|
90
|
+
|
91
|
+
の関係がある.したがって,
|
92
|
+
```maple
|
93
|
+
Ev:=0.8;
|
94
|
+
Ec:=3.39;
|
95
|
+
eq1:=Ev=Ec/2*(2-poq)/(1-poq);
|
96
|
+
solve(eq1,poq);
|
97
|
+
2.893854749
|
98
|
+
```
|
99
|
+
|
100
|
+
さらにこの値を使ってポテンシャルのパラメータを求めるのは以下の通り.ここで,$q$を設定している.
|
101
|
+
|
102
|
+
```
|
103
|
+
phi:=r->12.0*A*exp(-p*r)-sqrt(12.0*(B*exp(-q*r))^2);
|
104
|
+
poq:=2.893854749;
|
105
|
+
q:=3.00*0.2474390089;
|
106
|
+
a0:=8.0828/2;
|
107
|
+
r0:=evalf(a0*sqrt(2)/2.0); #2.857701345
|
108
|
+
eq1:=phi(r0)=-3.39;
|
109
|
+
s2:=solve(eq1,A);
|
110
|
+
p:=poq*q; #2.148157653
|
111
|
+
eq2:=subs(r=r0,diff(phi(r),r));
|
112
|
+
#plot(subs(A=s2,eq2),B=0..20);
|
113
|
+
b0:=fsolve(subs(A=s2,eq2),B=10);
|
114
|
+
a0:=subs(B=b0,s2);
|
115
|
+
phi0:=unapply(subs({A=a0,B=b0},phi(r)),r);
|
116
|
+
plot(phi0(r),r=2..5);
|
117
|
+
phi0(r0);
|
118
|
+
a0,b0,p,poq,q;
|
119
|
+
#69.1378255, 12.47431958, 2.148157653, 2.893854749, 0.7423170267
|
120
|
+
```
|
121
|
+
![](eam_ev.png)
|
data/docs/potential2.md
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# lj0
|
2
|
+
標準的なLennard-Jonesポテンシャルの表式
|
3
|
+
|
4
|
+
$$ F(s)=\int_{0}^{\infty}f(t)e^{-st}dt $$
|
5
|
+
|
6
|
+
```
|
7
|
+
bob% cat POTCAR
|
8
|
+
---
|
9
|
+
:type: lj0
|
10
|
+
:element: Al
|
11
|
+
:a0: 1.587401051*0.7071067812/2.857701314;
|
12
|
+
:e0: -1*4.0/12.0;
|
13
|
+
:a: 18.19007708
|
14
|
+
:b: 89.22765864
|
15
|
+
:p: 3.0
|
16
|
+
:q: 5.0
|
17
|
+
:cut_off: 4.0*0.8
|
18
|
+
:energy: -a*(1/r**p)+b*(1/r**q)
|
19
|
+
:dedr: (p*a/r**(p+1.0))-(q*b/r**(q+1.0))
|
20
|
+
```
|
21
|
+
# lj_jindo
|
22
|
+
神藤先生あるいはVu Van Huangが使っていたLennard-Jonesポテンシャルの表式.
|
23
|
+
```ruby
|
24
|
+
bob% cat POTCAR_jindo_Cu
|
25
|
+
---
|
26
|
+
:type: lj_jindo
|
27
|
+
:element: Cu
|
28
|
+
:d0: 4125.70
|
29
|
+
:n: 9.00
|
30
|
+
:m: 5.50
|
31
|
+
:r0: 2.5487e-8
|
32
|
+
:alat: 3.6153e-8
|
33
|
+
:atom_mass: 63.5460/6.023e23
|
34
|
+
:energy: d0*((r/r0)^(-n)*m-(r/r0)^(-m)*n)/(m-n)
|
35
|
+
:dedr: d0*m*n*((r/r0)^(-m)-(r/r0)^(-n))/(r*(m-n))
|
36
|
+
```
|
37
|
+
```
|
38
|
+
Cu
|
39
|
+
d0 := 4125.70;
|
40
|
+
vn := 9.00;
|
41
|
+
vm := 5.50;
|
42
|
+
r0 := 2.5487e-8;
|
43
|
+
rh:=r0/rr;
|
44
|
+
dedr:=unapply(-d0*vm*vn / ((vn-vm)*rr) * (rh**vn - rh**vm),rr);
|
45
|
+
eq1:=int(dedr(r),r);
|
46
|
+
func:=unapply(eq1,rr);
|
47
|
+
r1:=2.5487*10^(-8)*0.8;
|
48
|
+
r2:=2.5487*10^(-8)*1.5;
|
49
|
+
plot(8.617385e-05*func(r),r=r1..r2);
|
50
|
+
```
|
51
|
+
```ruby
|
52
|
+
dedr:=unapply(-d0*vm*vn / ((vn-vm)*rr) * (rh**vn - rh**vm),rr);
|
53
|
+
eq1:=int(dedr(r),r);
|
54
|
+
-{ 1.821482757\times 10^{-38}} r{-5.5}+
|
55
|
+
{ 2.942122564\times 10^{-65}} r^{-9}
|
56
|
+
```
|
57
|
+
```ruby
|
58
|
+
rh:=r0/rr;
|
59
|
+
dedr:=normal(expand(d0*vm*vn / ((vn-vm)*rr) * (rh**vn - rh**vm)));
|
60
|
+
eq1:=simplify(int(dedr,rr));
|
61
|
+
```
|
62
|
+
|
63
|
+
$$
|
64
|
+
|
65
|
+
r_1=r/r_0
|
66
|
+
|
67
|
+
\frac{ d_0 \left( r_1^{-n}m- r_1^{-m} n \right) }{ -n + m }
|
68
|
+
$$
|
69
|
+
|
70
|
+
# ポテンシャル選択機構
|
71
|
+
module LJに記述
|
72
|
+
```ruby
|
73
|
+
def select(file='POTCAR')
|
74
|
+
# p src = YAML.load_file(ARGV[0])
|
75
|
+
p src = YAML.load_file(file)
|
76
|
+
@@potential=case src[:type]
|
77
|
+
when 'lj0'
|
78
|
+
LJ0.new(src)
|
79
|
+
when 'lj_jindo'
|
80
|
+
LJ_Jindo.new(src)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
```
|
84
|
+
- 委譲による選択
|
85
|
+
- pseudovasp.rbにLJ.select('POTCAR')がある.
|
86
|
+
- LJ0あるいはLJ_Jindoをclassとして用意.
|
87
|
+
- POTCARへのYAMLでの記述
|
88
|
+
- クラス変数によるクラス共通の変数定義
|
89
|
+
|
90
|
+
EAMとの統一を考えたが,energy, forceのmethodの選択を
|
91
|
+
どっかでしないとダメで,その綺麗なやり方が思いつかず,
|
92
|
+
そのままにした.
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
class EAMAtom < Atom
|
96
|
+
include EAM
|
97
|
+
end
|
98
|
+
|
99
|
+
class LJAtom < Atom
|
100
|
+
include LJ
|
101
|
+
end
|
102
|
+
```
|
103
|
+
となっており,ほぼ元どおり.
|
data/exe/mathjax-yard
ADDED
data/lib/mathjax-yard.rb
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
require "mathjax-yard/version"
|
2
|
+
require 'optparse'
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
|
7
|
+
module MathJaxYard
|
8
|
+
# Your code goes here...
|
9
|
+
class Command
|
10
|
+
def self.run(argv=[])
|
11
|
+
new(argv).execute
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(argv=[])
|
15
|
+
@argv = argv
|
16
|
+
@eq_data=Hash.new
|
17
|
+
@eq_number =0
|
18
|
+
@revert = false
|
19
|
+
end
|
20
|
+
|
21
|
+
def execute
|
22
|
+
# @argv << '--help' if @argv.size==0
|
23
|
+
command_parser = OptionParser.new do |opt|
|
24
|
+
opt.on('-v', '--version','show program Version.') { |v|
|
25
|
+
opt.version = Yardmath::VERSION
|
26
|
+
puts opt.ver
|
27
|
+
exit
|
28
|
+
}
|
29
|
+
opt.on('-r', '--revert','revert mjx file to orig file.') {
|
30
|
+
directory = @argv[0]==nil ? 'lib/../*/*.md.back' : @argv[0]
|
31
|
+
revert(directory)
|
32
|
+
exit
|
33
|
+
}
|
34
|
+
opt.on('-p', '--post','post operation.') {
|
35
|
+
post_operation
|
36
|
+
directory = @argv[0]==nil ? 'lib/../*/*.md.back' : @argv[0]
|
37
|
+
revert(directory)
|
38
|
+
exit
|
39
|
+
}
|
40
|
+
end
|
41
|
+
command_parser.banner = "Usage: yardmath [options] [DIRECTORY]"
|
42
|
+
command_parser.parse!(@argv)
|
43
|
+
directory = @argv[0]==nil ? 'lib/../*/*.md' : @argv[0]
|
44
|
+
convert(directory)
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_operation
|
49
|
+
file = File.open("./mathjax.yml",'r')
|
50
|
+
src = file.read
|
51
|
+
p data = YAML.load(src)
|
52
|
+
data.each_pair{|file, tags|
|
53
|
+
File.basename(file).scan(/(.+)\.md/)
|
54
|
+
p basename = $1
|
55
|
+
target = "./doc/file.#{basename}.html"
|
56
|
+
file = File.open(target,'r')
|
57
|
+
src = file.read
|
58
|
+
file.close
|
59
|
+
tags.each_pair{|tag,eq|
|
60
|
+
src.gsub!(tag,eq)
|
61
|
+
}
|
62
|
+
file = File.open(target,'w')
|
63
|
+
file.print(src)
|
64
|
+
file.close
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
def revert(directory)
|
69
|
+
files = Dir.glob(directory)
|
70
|
+
files.each{|file|
|
71
|
+
p b_file = file
|
72
|
+
file.scan(/(.+).back$/)
|
73
|
+
p t_file = $1
|
74
|
+
FileUtils.mv(b_file,t_file)
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
def convert(directory)
|
79
|
+
files = Dir.glob(directory)
|
80
|
+
files.each{|file|
|
81
|
+
@eq_data[file] = Hash.new
|
82
|
+
lines = File.readlines(file)
|
83
|
+
output = mk_tags(lines,file)
|
84
|
+
if @eq_data[file].size ==0
|
85
|
+
@eq_data.delete(file)
|
86
|
+
else
|
87
|
+
write_output_on_target(file,output)
|
88
|
+
# write_output_on_backup(file,output,'.mjx')
|
89
|
+
end
|
90
|
+
}
|
91
|
+
save_yaml(@eq_data,"mathjax.yml")
|
92
|
+
end
|
93
|
+
|
94
|
+
def write_output_on_backup(file,output,extention='.mjx')
|
95
|
+
file.scan(/(.+)\.md/)
|
96
|
+
p basename = $1
|
97
|
+
b_file = File.open(basename+extention+'.md','w')
|
98
|
+
b_file.print output
|
99
|
+
b_file.close
|
100
|
+
end
|
101
|
+
|
102
|
+
def write_output_on_target(file,output)
|
103
|
+
b_file = file+'.back'
|
104
|
+
FileUtils.mv(file,b_file)
|
105
|
+
t_file = File.open(file,'w')
|
106
|
+
t_file.print output
|
107
|
+
t_file.close
|
108
|
+
end
|
109
|
+
|
110
|
+
def save_yaml(data,file)
|
111
|
+
print yaml_data=YAML.dump(data)
|
112
|
+
math_file = File.open(file,'w')
|
113
|
+
math_file.print(yaml_data)
|
114
|
+
math_file.close
|
115
|
+
end
|
116
|
+
|
117
|
+
def mk_tags(lines,file_name)
|
118
|
+
@in_eq_block = false
|
119
|
+
output,stored_eq="",""
|
120
|
+
lines.each{|line|
|
121
|
+
if @in_eq_block #inside in eq block
|
122
|
+
if line =~/^\$\$/ #closing
|
123
|
+
stored_eq << "$"
|
124
|
+
output << store_eq_data(stored_eq,file_name)
|
125
|
+
stored_eq=""
|
126
|
+
@in_eq_block = !@in_eq_block
|
127
|
+
else #normal op. in eq block
|
128
|
+
p stored_eq << line
|
129
|
+
end
|
130
|
+
else #outside eq block
|
131
|
+
if line =~ /\$(.+)\$/ #normal op. in line eq.
|
132
|
+
p converted =check_multiple_match($1,file_name)
|
133
|
+
output << $`+converted+$'
|
134
|
+
elsif line =~/^\$\$/ # opening in eq block
|
135
|
+
p line
|
136
|
+
@in_eq_block = !@in_eq_block
|
137
|
+
stored_eq << "$"
|
138
|
+
else #normal op (no eq)
|
139
|
+
output << line
|
140
|
+
end
|
141
|
+
end
|
142
|
+
}
|
143
|
+
return output
|
144
|
+
end
|
145
|
+
|
146
|
+
def store_eq_data(equation,file_name)
|
147
|
+
@eq_number+=1
|
148
|
+
tag="$MATHJAX#{@eq_number}$"
|
149
|
+
@eq_data[file_name][tag] = "$#{equation}$"
|
150
|
+
return tag
|
151
|
+
end
|
152
|
+
|
153
|
+
def check_multiple_match(line,file)
|
154
|
+
if !line.include?('$') or
|
155
|
+
(line=~/^\$(.+)\$$/) then
|
156
|
+
return store_eq_data(line,file)
|
157
|
+
end
|
158
|
+
inline_eq = true
|
159
|
+
equation,text="",""
|
160
|
+
line.each_char{|char|
|
161
|
+
if char == '$'
|
162
|
+
if inline_eq then
|
163
|
+
text << store_eq_data(equation,file)
|
164
|
+
equation = ""
|
165
|
+
else
|
166
|
+
end
|
167
|
+
inline_eq = !inline_eq
|
168
|
+
else
|
169
|
+
inline_eq ? equation << char : text << char
|
170
|
+
end
|
171
|
+
}
|
172
|
+
text << store_eq_data(equation,file)
|
173
|
+
return text
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mathjax-yard/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mathjax-yard"
|
8
|
+
spec.version = MathJaxYard::VERSION
|
9
|
+
spec.authors = ["Shigeto R. Nishitani"]
|
10
|
+
spec.email = ["shigeto_nishitani@me.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{mathjax-yard provides mathjax extention to yard.}
|
13
|
+
spec.description = %q{mathjax-yard provides mathjax extention to yard.}
|
14
|
+
spec.homepage = "http://nishitani0.kwansei.ac.jp/Open/mathjax-yad"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
34
|
+
end
|
data/mathjax.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
lib/../docs/atom.md:
|
3
|
+
"$MATHJAX1$": "$i$"
|
4
|
+
"$MATHJAX2$": |-
|
5
|
+
$$E_i = \sum_j\phi \left( r_j \right) + f(\rho)
|
6
|
+
$$
|
7
|
+
"$MATHJAX3$": "$r_j$"
|
8
|
+
"$MATHJAX4$": "$j$"
|
9
|
+
"$MATHJAX5$": "$E_i$"
|
10
|
+
"$MATHJAX6$": "$i$"
|
11
|
+
"$MATHJAX7$": |-
|
12
|
+
$$f(\rho) =\sqrt{\rho}=\sqrt{\sum_j h^2 \left( r_j \right) }
|
13
|
+
$$
|
14
|
+
"$MATHJAX8$": "$\\rho$"
|
15
|
+
"$MATHJAX9$": "$NPT$"
|
16
|
+
"$MATHJAX10$": "$E-V$"
|
17
|
+
"$MATHJAX11$": "$T=0.1$"
|
18
|
+
"$MATHJAX12$": "$E_v$"
|
19
|
+
"$MATHJAX13$": |-
|
20
|
+
$$E_v = -\frac{E_c}{2} \frac{2-poq}{1-poq}
|
21
|
+
$$
|
22
|
+
"$MATHJAX14$": "$q$"
|
23
|
+
lib/../docs/potential2.md:
|
24
|
+
"$MATHJAX15$": "$$ F(s)=\\int_{0}^{\\infty}f(t)e^{-st}dt $$"
|
25
|
+
"$MATHJAX16$": |-
|
26
|
+
$$
|
27
|
+
r_1=r/r_0
|
28
|
+
|
29
|
+
\frac{ d_0 \left( r_1^{-n}m- r_1^{-m} n \right) }{ -n + m }
|
30
|
+
$$
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mathjax-yard
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shigeto R. Nishitani
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
description: mathjax-yard provides mathjax extention to yard.
|
70
|
+
email:
|
71
|
+
- shigeto_nishitani@me.com
|
72
|
+
executables:
|
73
|
+
- mathjax-yard
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- ".yardopts"
|
81
|
+
- CODE_OF_CONDUCT.md
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- bin/console
|
87
|
+
- bin/setup
|
88
|
+
- docs/README_ja.md
|
89
|
+
- docs/atom.md
|
90
|
+
- docs/potential2.md
|
91
|
+
- exe/mathjax-yard
|
92
|
+
- lib/mathjax-yard.rb
|
93
|
+
- lib/mathjax-yard/version.rb
|
94
|
+
- mathjax-yard.gemspec
|
95
|
+
- mathjax.yml
|
96
|
+
homepage: http://nishitani0.kwansei.ac.jp/Open/mathjax-yad
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.5.1
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: mathjax-yard provides mathjax extention to yard.
|
120
|
+
test_files: []
|
121
|
+
has_rdoc:
|