加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Percolation Cluster.py 890 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nick Crump 提交于 2015-06-01 21:22 . computational physics
"""
Created on Sun Oct 27 17:50:45 2013
"""
# Percolation Cluster
"""
This generates a percolation cluster lattice.
"""
import numpy as np
import matplotlib.pyplot as plt
import ClusterGrowth as cluster
# call function for Percolation growth model
#-------------------------------------------------------------------
# initial conditions
N = 50
p = 0.6
# call function
Ox,Oy,Px,Py = cluster.Percolation(N, p)
stack = np.column_stack((Ox,Oy))
#np.savetxt('PercolationCluster_'+str(N)+'n'+str(p)+'p.txt',stack,fmt='%i')
# set marker size from derived visual scaling
msize = int(128325*(N**-2.179))
# plot Percolation growth cluster
plt.scatter(Ox,Oy,s=msize,marker='s',c='b',edgecolor='k')
plt.scatter(Px,Py,s=msize,marker='s',c='none',edgecolor='k')
plt.xlabel('x')
plt.ylabel('y')
plt.xlim(-1.0,N)
plt.ylim(-1.0,N)
#-------------------------------------------------------------------
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化