Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
rictjo
impetuous
提交
50f83997
I
impetuous
项目概览
rictjo
/
impetuous
10 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
impetuous
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
50f83997
编写于
8月 21, 2021
作者:
rictjo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm red
上级
c7b1be2d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
43 deletion
+0
-43
src/impetuous/clustering.py
src/impetuous/clustering.py
+0
-43
未找到文件。
src/impetuous/clustering.py
浏览文件 @
50f83997
...
...
@@ -628,58 +628,15 @@ else :
R2
[
i
][
j
]
=
np
.
sum
((
P
[
i
]
-
Q
[
j
])
**
2
)
return
(
R2
)
def
select_from_distance_matrix
(
boolean_list
,
distance_matrix
):
return
(
np
.
array
(
[
d
[
boolean_list
]
for
d
in
distance_matrix
[
boolean_list
]]
)
)
def
calculate_rdf
(
particles_i
=
None
,
particles_o
=
None
,
nbins
=
100
,
distance_matrix
=
None
,
bInGroup
=
None
,
bNotInGroup
=
None
,
n_dimensions
=
3
,
xformat
=
"%.3f"
,
bLiquidState
=
True
,
constant
=
4.0
/
3.0
)
:
import
operator
crit1
=
particles_i
is
None
and
particles_o
is
None
crit2
=
bInGroup
is
None
and
distance_matrix
is
None
and
bNotInGroup
is
None
if
not
crit2
:
particles_i
=
distance_matrix_to_absolute_coordinates
(
\
select_from_distance_matrix
(
bInGroup
,
distance_matrix
)
,
n_dimensions
=
n_dimensions
)
particles_o
=
distance_matrix_to_absolute_coordinates
(
\
select_from_distance_matrix
(
bNotInGroup
,
distance_matrix
)
,
n_dimensions
=
n_dimensions
)
else
:
particles_i
=
particles_i
.
T
particles_o
=
particles_o
.
T
if
operator
.
xor
(
not
crit1
,
not
crit2
)
:
rdf_p
=
pd
.
DataFrame
(
exclusive_pdist
(
particles_i
.
T
,
particles_o
.
T
)
).
apply
(
np
.
sqrt
).
values
.
reshape
(
-
1
)
rmax
=
np
.
max
(
rdf_p
)
Y_
,
X
=
np
.
histogram
(
rdf_p
,
bins
=
nbins
)
X_
=
0.5
*
(
X
[
1
:]
+
X
[:
1
])
bUse
=
[
x
<
rmax
/
2.0
for
x
in
X_
]
rd
=
X_
norm
=
len
(
rdf_p
)
if
bLiquidState
:
norm
=
constant
*
np
.
pi
*
(
(
X_
+
np
.
diff
(
X
)
)
**
n_dimensions
-
X_
**
n_dimensions
)
*
len
(
rdf_p
)
dd
=
Y_
/
norm
rd
=
[
r
for
r
,
b
in
zip
(
rd
,
bUse
)
if
b
]
dd
=
[
y
for
y
,
b
in
zip
(
dd
,
bUse
)
if
b
]
bar_source
=
{
'density_values'
:
dd
,
'density_ids'
:[
xformat
%
(
d
)
for
d
in
rd
]
}
return
(
bar_source
,
rdf_p
)
else
:
print
(
"""calculate_rdf ( particles_i=None , particles_o=None , Nbins=100 ,
distance_martix = None, bInGroup = None, bNotInGroup = None ,
n_dimensions = 3 , xformat="%.3f" , bLiquidState=True, constant=4.0/3.0 )"""
)
exit
(
1
)
def
diar
(
n
):
if
n
>
1
:
return
(
np
.
sqrt
(
n
)
*
diar
(
n
-
1
)
)
else
:
return
(
1.
)
def
calculate_rdf
(
particles_i
=
None
,
particles_o
=
None
,
nbins
=
100
,
distance_matrix
=
None
,
bInGroup
=
None
,
bNotInGroup
=
None
,
n_dimensions
=
3
,
xformat
=
"%.3f"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录