Patterned substrate: dump sites andread sites

1. dump_sites command

为了生成sites text,需要先用lattice, region, create_box, create_sites commands to generate lattice sites, 方便起见也可以不用set command. For this style, a filename with the “*” wildcard must be used so that a different file is written for each snapshot.
This style of dump command will not write “Sites” or “Neighbors” sections to the sites file.
(见后面的text格式) Only values
When using the sites file to continue a simulation, it is assumed that the restart script will define the sites and their neighbors in an alternate way, e.g. via the “create_box” and “create_sites” commands.

dump brick sites 5e12 island_sq.dump.* id i1 i2 x y z

然后我们看一下dump出来的sites file

Site file written by dump sites brick command at time: 0 0

3 dimension
131072 sites
id i1 i2 x y z values
0 64 xlo xhi
0 64 ylo yhi
0 32 zlo zhi

Values

1 3 2 0 0 0 
2 3 2 1 0 0 

第一行的comments will be neglected. 这也就是说,我们修改过的sites文件第一行也得空出来,加不加#没有关系。As noted priorly, only “Values” section is dumped. header第三行的comment表明了what each colomn in the values section refers to.

2. Modify the sites

首先把数据以外的所有内容删掉,用以下python script进行修改

import math
PI = math.pi
WAVELEN = 24
from math import cos
with open('template.txt') as f1:
    lines = f1.readlines()
for i in range(0,len(lines)):
    values = lines[i].split()
    id   = values[0]
    site = int(values[1])
    i2   = int(values[2])
    x    = int(values[3])
    y    = int(values[4])
    z    = int(values[5])
    if z <= 6 + max(4*cos(2*PI*x/WAVELEN)*cos(2*PI*y/WAVELEN), -2):
        site = 2  # occupied sites
        i2 = 3    # GB materials
        if z <= 4:
            i2 = 2
    
    if z < 2:
        site = 3
    if z > 30:
        site = 3
    
    lines[i] = id+' '+str(site)+' '+str(i2)+'\n'
    
with open('template2.txt', 'w') as f2:
    f2.writelines(lines)

当然output file “template2.txt” 一开始只有data。 **需要在开头空一行,加上Section keywords “Values”, 再空一行。**注意,输出文件只需要 ID 和 persite values, “Sites” "Neighbors"信息仍然需要 create_sites 与 create_box 去生成。

3. Read_sites

在这里插入图片描述
read_sites command以上是和原来完全一样的,注意把所有set command内容disable掉,所有per-site values我们都已经通过脚本修改完了。
最后附上我 first attempt parameters
在这里插入图片描述
主要参考的例子为
https://spparks.sandia.gov/tutorial/html/bluequartz.synthetic/intro.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值