msg-byu / enumlib

Derivative structure enumeration library
MIT License
59 stars 34 forks source link

How to match elements to a created structure #121

Closed yanwenliao closed 1 month ago

yanwenliao commented 7 months ago

Below is a POSCAR file of a structure that I exported through "python makeStr.py" Nb str #: 1 1.000 0.000000000 6.641040000 0.000000000 0.000000000 0.000000000 6.641040000 6.641040000 0.000000000 0.000000000 2 14
Direct 0.000000000 0.000000000 0.000000000 0.000000000 0.500000000 0.000000000 0.500000000 0.000000000 0.000000000 0.500000000 0.500000000 0.000000000 0.000000000 0.000000000 0.500000000 0.000000000 0.500000000 0.500000000 0.500000000 0.000000000 0.500000000 0.500000000 0.500000000 0.500000000 0.250000000 0.250000000 0.250000000 0.250000000 0.750000000 0.250000000 0.750000000 0.250000000 0.250000000 0.750000000 0.750000000 0.250000000 0.250000000 0.250000000 0.750000000 0.250000000 0.750000000 0.750000000 0.750000000 0.250000000 0.750000000 0.750000000 0.750000000 0.750000000

But how do I export with attaching the elements Nb and U as shown in line 6 Nb str #: 1 1.000 0.000000000 6.641040000 0.000000000 0.000000000 0.000000000 6.641040000 6.641040000 0.000000000 0.000000000 Nb U 2 14
Direct 0.000000000 0.000000000 0.000000000 0.000000000 0.500000000 0.000000000 0.500000000 0.000000000 0.000000000 0.500000000 0.500000000 0.000000000 0.000000000 0.000000000 0.500000000 0.000000000 0.500000000 0.500000000 0.500000000 0.000000000 0.500000000 0.500000000 0.500000000 0.500000000 0.250000000 0.250000000 0.250000000 0.250000000 0.750000000 0.250000000 0.750000000 0.250000000 0.250000000 0.750000000 0.750000000 0.250000000 0.250000000 0.250000000 0.750000000 0.250000000 0.750000000 0.750000000 0.750000000 0.250000000 0.750000000 0.750000000 0.750000000 0.750000000

I tried add "-elements Nb U" after "python makeStr.py " like " python makeStr.py -elements Nb U 1 -flags ",but it didn't work. 1710852959303

YangZihangYNU commented 6 months ago

I have the same problem............

yanwenliao commented 6 months ago

I wrote it directly in the bash script:

infile=struct_enum.in.ex5 outfile=struct_enum.out

运行

../../src/enum.x $infile

提取struct_enum.out文件的结构类型总数

last_line=$(tail -n 1 $outfile) total=$(echo $last_line | awk '{print $1}' | tr -d ' ')

生成poscar

python makeStr.py 1 $total -flags

更改poscar细节并且移动到poscar文件夹

for ((j=1; j<=$total; j++)); do filename="vasp.$j" sed -i '6i Nb U' "$filename" mv "$filename" poscar/"$j.vasp" done

yanwenliao commented 6 months ago

I wrote it directly in the bash script:

infile=struct_enum.in.ex5 outfile=struct_enum.out

运行

../../src/enum.x $infile

提取struct_enum.out文件的结构类型总数

last_line=$(tail -n 1 $outfile) total=$(echo $last_line | awk '{print $1}' | tr -d ' ')

生成poscar

python makeStr.py 1 $total -flags

更改poscar细节并且移动到poscar文件夹

for ((j=1; j<=$total; j++)); do filename="vasp.$j" sed -i '6i Nb U' "$filename" mv "$filename" poscar/"$j.vasp" done

此外,为了实现连续置换,我是在16个原子里置换别的原子,从1置换到16,下面是脚本的完整内容:

!/bin/bash

mkdir  poscar

atoms=16

infile=struct_enum.in.ex5

outfile=struct_enum.out

for ((i=1; i<=$atoms; i++)); do

更改输入文件倒数一二行

    sed -i "$(($(wc -l < $infile) - 1))s/.*/$i $i $atoms/" $infile

    sed -i "$(($(wc -l < $infile)))s/.*/$(($atoms-$i)) $(($atoms-$i)) $atoms/" $infile

运行  

    ../../src/enum.x $infile

提取struct_enum.out文件的结构类型总数

last_line=$(tail -n 1 $outfile)

total=$(echo $last_line | awk '{print $1}' | tr -d ' ')

生成poscar

python makeStr.py 1 $total -flags

更改poscar细节并且移动到poscar文件夹

 for ((j=1; j<=$total; j++)); do

 filename="vasp.$j"

 sed -i '6i Nb U' "$filename" 

 mv "$filename" poscar/"$i-$j.vasp"

 done

#

done

在命令行直接输入: “bash 脚本名” 就可以了

------------------ 原始邮件 ------------------ 发件人: "msg-byu/enumlib" @.>; 发送时间: 2024年3月26日(星期二) 下午4:21 @.>; @.**@.>; 主题: Re: [msg-byu/enumlib] How to match elements to a created structure (Issue #121)

I have the same problem............

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>