mathjax-yard 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.yardopts +1 -1
- data/Rakefile +1 -0
- data/doc/MathJaxYard.html +141 -0
- data/doc/MathJaxYard/Command.html +1017 -0
- data/doc/_index.html +149 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.Home.html +86 -0
- data/doc/file.README.html +144 -0
- data/doc/file.README_ja.html +162 -0
- data/doc/file.atom.html +211 -0
- data/doc/file.potential2.html +196 -0
- data/doc/file_list.html +72 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +144 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +129 -0
- data/doc/top-level-namespace.html +158 -0
- data/lib/mathjax-yard.rb +48 -61
- data/lib/mathjax-yard/script.rb +20 -0
- data/lib/mathjax-yard/version.rb +1 -1
- data/mathjax-yard.gemspec +3 -1
- data/mathjax.yml +3 -3
- data/mathjax.yml.bk +28 -0
- metadata +40 -7
- data/docs/README_ja.md +0 -77
- data/docs/atom.md +0 -121
- data/docs/potential2.md +0 -103
data/lib/mathjax-yard.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require "mathjax-yard/version"
|
2
|
+
require "mathjax-yard/script"
|
2
3
|
require 'optparse'
|
3
4
|
require 'yaml'
|
4
5
|
require 'fileutils'
|
5
|
-
|
6
|
+
require 'systemu'
|
6
7
|
|
7
8
|
module MathJaxYard
|
8
|
-
# Your code goes here...
|
9
9
|
class Command
|
10
10
|
def self.run(argv=[])
|
11
11
|
new(argv).execute
|
@@ -19,7 +19,6 @@ module MathJaxYard
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def execute
|
22
|
-
# @argv << '--help' if @argv.size==0
|
23
22
|
command_parser = OptionParser.new do |opt|
|
24
23
|
opt.on('-v', '--version','show program Version.') { |v|
|
25
24
|
opt.version = Yardmath::VERSION
|
@@ -37,6 +36,10 @@ module MathJaxYard
|
|
37
36
|
revert(directory)
|
38
37
|
exit
|
39
38
|
}
|
39
|
+
opt.on('-i', '--init','initiation for mathjax extension on yard layout.') {
|
40
|
+
init_yard()
|
41
|
+
exit
|
42
|
+
}
|
40
43
|
end
|
41
44
|
command_parser.banner = "Usage: yardmath [options] [DIRECTORY]"
|
42
45
|
command_parser.parse!(@argv)
|
@@ -45,23 +48,44 @@ module MathJaxYard
|
|
45
48
|
exit
|
46
49
|
end
|
47
50
|
|
51
|
+
def init_yard()
|
52
|
+
target_dir=get_yard_layout_dir()
|
53
|
+
FileUtils.cd(target_dir){
|
54
|
+
tmp_dir='mathjax' # 'math2'
|
55
|
+
FileUtils.cp_r('default',tmp_dir)
|
56
|
+
modify_layout("#{tmp_dir}/layout/html/layout.erb")
|
57
|
+
modify_layout("#{tmp_dir}/onefile/html/layout.erb")
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_yard_layout_dir()
|
62
|
+
status, stdout, stderr = systemu('gem env | grep INSTALLATION ')
|
63
|
+
p inst_dir= stdout.split("\n")[0].split(': ')[1]
|
64
|
+
status, stdout, stderr = systemu('yard -v')
|
65
|
+
p yard_num= stdout.split(' ')[0]+'-'+stdout.split(' ')[1]
|
66
|
+
p target_dir = File.join(inst_dir,'gems',yard_num,"templates")
|
67
|
+
return target_dir
|
68
|
+
end
|
69
|
+
|
70
|
+
def modify_layout(file_name)
|
71
|
+
p file_name
|
72
|
+
src=Ffile.read(file_name)
|
73
|
+
src.gsub!(ORIGINAL,MATH_SCRIPT+ORIGINAL)
|
74
|
+
File.write(file_name,src)
|
75
|
+
end
|
76
|
+
|
48
77
|
def post_operation
|
49
|
-
|
50
|
-
src = file.read
|
78
|
+
src = File.read("./mathjax.yml")
|
51
79
|
p data = YAML.load(src)
|
52
80
|
data.each_pair{|file, tags|
|
53
81
|
File.basename(file).scan(/(.+)\.md/)
|
54
82
|
p basename = $1
|
55
83
|
target = "./doc/file.#{basename}.html"
|
56
|
-
|
57
|
-
src = file.read
|
58
|
-
file.close
|
84
|
+
src = File.read(target)
|
59
85
|
tags.each_pair{|tag,eq|
|
60
86
|
src.gsub!(tag,eq)
|
61
87
|
}
|
62
|
-
|
63
|
-
file.print(src)
|
64
|
-
file.close
|
88
|
+
File.write(target,src)
|
65
89
|
}
|
66
90
|
end
|
67
91
|
|
@@ -85,33 +109,15 @@ module MathJaxYard
|
|
85
109
|
@eq_data.delete(file)
|
86
110
|
else
|
87
111
|
write_output_on_target(file,output)
|
88
|
-
# write_output_on_backup(file,output,'.mjx')
|
89
112
|
end
|
90
113
|
}
|
91
|
-
|
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
|
114
|
+
File.write("mathjax.yml",YAML.dump(@eq_data))
|
100
115
|
end
|
101
116
|
|
102
117
|
def write_output_on_target(file,output)
|
103
118
|
b_file = file+'.back'
|
104
119
|
FileUtils.mv(file,b_file)
|
105
|
-
|
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
|
120
|
+
File.write(file,output)
|
115
121
|
end
|
116
122
|
|
117
123
|
def mk_tags(lines,file_name)
|
@@ -121,18 +127,22 @@ module MathJaxYard
|
|
121
127
|
if @in_eq_block #inside in eq block
|
122
128
|
if line =~/^\$\$/ #closing
|
123
129
|
stored_eq << "$"
|
124
|
-
output << store_eq_data(stored_eq,file_name)
|
130
|
+
output << store_eq_data("$#{stored_eq}$",file_name)
|
125
131
|
stored_eq=""
|
126
132
|
@in_eq_block = !@in_eq_block
|
127
133
|
else #normal op. in eq block
|
128
134
|
p stored_eq << line
|
129
135
|
end
|
130
136
|
else #outside eq block
|
131
|
-
|
132
|
-
|
133
|
-
output <<
|
134
|
-
|
135
|
-
|
137
|
+
case line
|
138
|
+
when /\\\$(.*?)\\\$/
|
139
|
+
output << line # tryed to change $$ but failed.
|
140
|
+
when /\$(.+?)\$/
|
141
|
+
line.gsub!(/\$(.+?)\$/){|equation|
|
142
|
+
store_eq_data(equation,file_name)
|
143
|
+
}
|
144
|
+
output << line
|
145
|
+
when /^\$\$/ # opening in eq block
|
136
146
|
@in_eq_block = !@in_eq_block
|
137
147
|
stored_eq << "$"
|
138
148
|
else #normal op (no eq)
|
@@ -146,32 +156,9 @@ module MathJaxYard
|
|
146
156
|
def store_eq_data(equation,file_name)
|
147
157
|
@eq_number+=1
|
148
158
|
tag="$MATHJAX#{@eq_number}$"
|
149
|
-
@eq_data[file_name][tag] =
|
159
|
+
@eq_data[file_name][tag] = equation
|
150
160
|
return tag
|
151
161
|
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
162
|
end
|
176
163
|
end
|
177
164
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
MATH_SCRIPT= <<EOS
|
2
|
+
<script type="text/x-mathjax-config">
|
3
|
+
MathJax.Hub.Config({
|
4
|
+
tex2jax:{
|
5
|
+
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
6
|
+
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
|
7
|
+
}
|
8
|
+
});
|
9
|
+
</script>
|
10
|
+
<script type="text/javascript"
|
11
|
+
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AM\
|
12
|
+
S_HTML">
|
13
|
+
</script>
|
14
|
+
<meta http-equiv="X-UA-Compatible" CONTENT="IE=EmulateIE7" />
|
15
|
+
EOS
|
16
|
+
|
17
|
+
ORIGINAL = <<EOS
|
18
|
+
<%= erb(:headers) %>
|
19
|
+
</head>
|
20
|
+
EOS
|
data/lib/mathjax-yard/version.rb
CHANGED
data/mathjax-yard.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{mathjax-yard provides mathjax extention to yard.}
|
13
13
|
spec.description = %q{mathjax-yard provides mathjax extention to yard.}
|
14
|
-
spec.homepage = "
|
14
|
+
spec.homepage = "https://github.com/daddygongon/mathjax-yard"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
@@ -27,8 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
+
spec.required_ruby_version = ">= 2.0.0"
|
30
31
|
spec.add_development_dependency "bundler", "~> 1.11"
|
31
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
33
34
|
spec.add_development_dependency "yard", "~> 0.8"
|
35
|
+
spec.add_runtime_dependency "systemu"
|
34
36
|
end
|
data/mathjax.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
---
|
2
|
-
lib/../
|
2
|
+
lib/../mathjax-yard.wiki/atom.md:
|
3
3
|
"$MATHJAX1$": "$i$"
|
4
4
|
"$MATHJAX2$": |-
|
5
5
|
$$E_i = \sum_j\phi \left( r_j \right) + f(\rho)
|
@@ -20,8 +20,8 @@ lib/../docs/atom.md:
|
|
20
20
|
$$E_v = -\frac{E_c}{2} \frac{2-poq}{1-poq}
|
21
21
|
$$
|
22
22
|
"$MATHJAX14$": "$q$"
|
23
|
-
lib/../
|
24
|
-
"$MATHJAX15$": "$$ F(s)=\\int_{0}^{\\infty}f(t)e^{-st}dt
|
23
|
+
lib/../mathjax-yard.wiki/potential2.md:
|
24
|
+
"$MATHJAX15$": "$$ F(s)=\\int_{0}^{\\infty}f(t)e^{-st}dt $"
|
25
25
|
"$MATHJAX16$": |-
|
26
26
|
$$
|
27
27
|
r_1=r/r_0
|
data/mathjax.yml.bk
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
lib/../mathjax-yard.wiki/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/../mathjax-yard.wiki/potential2.md:
|
24
|
+
"$MATHJAX15$": "$$ F(s)=\\int_{0}^{\\infty}f(t)e^{-st}dt $"
|
25
|
+
"$MATHJAX16$": |-
|
26
|
+
$$r_1=r/r_0 \\
|
27
|
+
\frac{ d_0 \left( r_1^{-n}m- r_1^{-m} n \right) }{ -n + m }
|
28
|
+
$$
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mathjax-yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: systemu
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: mathjax-yard provides mathjax extention to yard.
|
70
84
|
email:
|
71
85
|
- shigeto_nishitani@me.com
|
@@ -85,15 +99,34 @@ files:
|
|
85
99
|
- Rakefile
|
86
100
|
- bin/console
|
87
101
|
- bin/setup
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
102
|
+
- doc/MathJaxYard.html
|
103
|
+
- doc/MathJaxYard/Command.html
|
104
|
+
- doc/_index.html
|
105
|
+
- doc/class_list.html
|
106
|
+
- doc/css/common.css
|
107
|
+
- doc/css/full_list.css
|
108
|
+
- doc/css/style.css
|
109
|
+
- doc/file.Home.html
|
110
|
+
- doc/file.README.html
|
111
|
+
- doc/file.README_ja.html
|
112
|
+
- doc/file.atom.html
|
113
|
+
- doc/file.potential2.html
|
114
|
+
- doc/file_list.html
|
115
|
+
- doc/frames.html
|
116
|
+
- doc/index.html
|
117
|
+
- doc/js/app.js
|
118
|
+
- doc/js/full_list.js
|
119
|
+
- doc/js/jquery.js
|
120
|
+
- doc/method_list.html
|
121
|
+
- doc/top-level-namespace.html
|
91
122
|
- exe/mathjax-yard
|
92
123
|
- lib/mathjax-yard.rb
|
124
|
+
- lib/mathjax-yard/script.rb
|
93
125
|
- lib/mathjax-yard/version.rb
|
94
126
|
- mathjax-yard.gemspec
|
95
127
|
- mathjax.yml
|
96
|
-
|
128
|
+
- mathjax.yml.bk
|
129
|
+
homepage: https://github.com/daddygongon/mathjax-yard
|
97
130
|
licenses:
|
98
131
|
- MIT
|
99
132
|
metadata: {}
|
@@ -105,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
138
|
requirements:
|
106
139
|
- - ">="
|
107
140
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
141
|
+
version: 2.0.0
|
109
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
143
|
requirements:
|
111
144
|
- - ">="
|
data/docs/README_ja.md
DELETED
@@ -1,77 +0,0 @@
|
|
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
DELETED
@@ -1,121 +0,0 @@
|
|
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)
|