0
0

POSCARからneighbors listの作成(ログ)

Last updated at Posted at 2023-11-28

目標設定

各原子について,ある距離以内の隣接原子がリスト化されたテキストファイルPOSCAR.nnlistを作成する.

流れ

  1. poscar2nnlistをビルドする.
  2. neighbors listを作成したいPOSCARファイル一覧のパスを取得する.
    1. のPOSCARファイルからPOSCAR.nnlistファイルを作成する.

スクリプトの説明

  • setup_poscar2nnlist.sh
    :poscar2nnlistを環境に合わせてビルドするシェルスクリプト.
  • get_C_O_existed_poscar_path_list.sh
    :元素種C, Oを含むPOSCARファイル(フォルダ)のリストを得るスクリプト.
    入力:
    出力:
  • mk_nnlist_by_poscar2nnlist.py
    :poscar2nnlistとPOSCARファイルからPOSCAR.nnlistを作成するスクリプト.
    • 準備:poscar2nnlist
    • 入力:POSCARのパスのリスト,(Neighobrsとして設定する)距離.
    • 出力:POSCAR.nnlist
      • 出力先:各POSCARのあるディレクトリのサブディレクトリ

1. の詳細ログ

pwd

/mnt/ssd_elecom_black_c2c_480G/scripts

sudo git clone https://github.com/k-morii-toridai/scripts_mk_nnlist.git
cd scripts_mk_nnlist
ls -CF

mk_nnlist_by_poscar2nnlist.py* neib_code.zip* old/ sample_mk_nnlist_by_poscar2nnlist.py.txt* setup_poscar2nnlist.sh*

sudo ./setup_poscar2nnlist.sh

gfortranは既にインストールされています。最新版にアップグレードします。
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Reading package lists... Done
E: Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease is not valid yet (invalid for another 14h 16min 15s). Updates for this repository will not be applied.
E: Release file for http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease is not valid yet (invalid for another 14h 15min 30s). Updates for this repository will not be applied.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gfortran is already the newest version (4:11.2.0-1ubuntu1).
Calculating upgrade... Done
The following packages have been kept back:
ubuntu-advantage-tools
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Archive: neib_code.zip
inflating: neib_code/ABW.cif
inflating: neib_code/m_ftox.f90
inflating: neib_code/neib.f90
inflating: neib_code/sample_code
inflating: neib_code/test_poscar2nnlist.sh

ls -CF

mk_nnlist_by_poscar2nnlist.py* neib_code/ neib_code.zip* old/ sample_mk_nnlist_by_poscar2nnlist.py.txt* setup_poscar2nnlist.sh*

poscar2nnlistがビルドできているか確かめる.:

cd neib_code/
ls -CF

ABW.cif* m_ftox.f90* m_ftox.mod* neib.f90* neib.mod* poscar2nnlist* sample_code* test_poscar2nnlist.sh*

./test_poscar2nnlist.sh

cif2cellは既にインストールされています。
***Warning : Site occupancies not found, assuming all occupancies = 1.
4 8 !nsite
readin type 1 Si 4
readin type 2 O 8
direct !postype
9.8729999999999993 ! unit (angstrom)
1 Si 0.942100 0.849300 0.801400
2 Si 0.743500 0.150700 0.198600
3 Si 0.057900 0.150700 0.198600
4 Si 0.256500 0.849300 0.801400
5 O 0.147700 0.897700 0.704600
6 O 0.852300 0.102300 0.295400
7 O 0.810000 0.500000 0.000000
8 O 0.810000 0.000000 0.000000
9 O 0.190000 0.000000 0.000000
10 O 0.190000 0.500000 0.000000
11 O 0.000000 0.000000 0.500000
12 O 0.500000 0.000000 0.500000
10.000000 !rmax (angstrom)
1.000000 0.000000 0.000000 !plat(:,1)
0.000000 0.532158 0.000000 !plat(:,2)
0.500000 0.266079 0.444141 !plat(:,3)
12 !natom
1.342800 0.665198 0.355934 pos atomid= 1 Si !Atom position: cartetian
0.842800 0.133040 0.088206 pos atomid= 2 Si !Atom position: cartetian
0.157200 0.133040 0.088206 pos atomid= 3 Si !Atom position: cartetian
0.657200 0.665198 0.355934 pos atomid= 4 Si !Atom position: cartetian
0.500000 0.665198 0.312941 pos atomid= 5 O !Atom position: cartetian
1.000000 0.133040 0.131199 pos atomid= 6 O !Atom position: cartetian
0.810000 0.266079 0.000000 pos atomid= 7 O !Atom position: cartetian
0.810000 0.000000 0.000000 pos atomid= 8 O !Atom position: cartetian
0.190000 0.000000 0.000000 pos atomid= 9 O !Atom position: cartetian
0.190000 0.266079 0.000000 pos atomid= 10 O !Atom position: cartetian
0.250000 0.133040 0.222070 pos atomid= 11 O !Atom position: cartetian
0.750000 0.133040 0.222070 pos atomid= 12 O !Atom position: cartetian
OK! Wrote POSCAR.nnlist

これより,poscar2nnlistがインストールできていることが確認できた.

2. の詳細ログ

ここでは,元素種C, Oを含むPOSCARファイルのパスのリストを取得する.

pwd

/mnt/ssd_elecom_black_c2c_480G/scripts/scripts_mk_nnlist

Githubからローカルにソースコードをダウンロード.:

sudo git clone https://github.com/k-morii-toridai/scripts_get_C_O_existed_poscar_abs_path_list.git

Cloning into 'scripts_get_C_O_existed_poscar_abs_path_list'...
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 31 (delta 13), reused 24 (delta 6), pack-reused 0
Receiving objects: 100% (31/31), 1.68 MiB | 1.83 MiB/s, done.
Resolving deltas: 100% (13/13), done.

cd scripts_get_C_O_existed_poscar_abs_path_list/
ls -CF

get_C_O_existed_poscar_path_list.py* get_poscar_existed_path_list.py* sample_get_poscar_existed_path_list.py.txt*
get_C_O_existed_poscar_path_list.sh* old/

cat get_C_O_existed_poscar_path_list.sh

#!/bin/bash

# POSCARファイルが存在するパスの一覧を取得(:第2引数を環境ごとのcif/ディレクトリのパスに書き換える)
python3 get_poscar_existed_path_list.py /mnt/ssd_elecom_black_c2c_480G/cif
# 元素種C, Oを含むPOSCARファイルが存在するパスを取得
python3 get_C_O_existed_poscar_path_list.py

get_C_O_existed_poscar_path_list.shの4行目の第2引数は,環境に合わせてcif/というディレクトリのパスを指定するように書き換える.その後,実行.:

time ./get_C_O_existed_poscar_path_list.sh

len(poscar_folder_path_list): 507142
Now getting poscar folder sub path list!!!
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 507142/507142 [08:01<00:00, 1053.78it/s]
len(poscar_existed_file_path_list): 308325
Both poscar_existed_file_path_list and poscar_existed_folder_path_list were saved as .npy
len(poscar_abs_path_list_loaded): 308325
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 308325/308325 [11:42<00:00, 438.64it/s]
len(C_O_existed_poscar_file_path_list): 205733
C_O_existed-poscar file, and folder path list were saved as .npy!!!

real 20m31.316s
user 10m3.979s
sys 35m7.691s

ls -CF

C_O_existed_poscar_file_path_list.npy* get_C_O_existed_poscar_path_list.sh* poscar_existed_file_path_list.npy*
C_O_existed_poscar_folder_path_list.npy* get_poscar_existed_path_list.py* poscar_existed_folder_path_list.npy*
get_C_O_existed_poscar_path_list.py* old/ sample_get_poscar_existed_path_list.py.txt*

3. の詳細ログ

cd ..
pwd

/mnt/ssd_elecom_black_c2c_480G/scripts/scripts_mk_nnlist

cat sample_mk_nnlist_by_poscar2nnlist.py.txt

#how to use this commnad:
python3 mk_nnlist_by_poscar2nnlist.py

#example:
python3 mk_nnlist_by_poscar2nnlist.py ./scripts_get_C_O_existed_poscar_abs_path_list/C_O_existed_poscar_folder_path_list.npy

スクリプト実行後,Neighobrsとして設定する距離が聞かれるので,数値を入力する.ただし,単位はÅである.ここでは,1.7Åとした.

time python3 mk_nnlist_by_poscar2nnlist.py ./scripts_get_C_O_existed_poscar_abs_path_list/C_O_existed_poscar_folder_path_list.npy

Now loading poscar_folder_path_list from .npy file...
poscar_folder_path_list was loaded from .npy file!!!
len(poscar_folder_path_list): 205733
Input a number which is poscar2nnlist's second arg. :nearest neighbors distance(Å) you want to catch: 1.7
Now poscar2nnlist is making POSCAR.nnlist from POSCAR!!!
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 205733/205733 [1:41:48<00:00, 33.68it/s]
it took 6108.624674320221sec.

real 102m6.445s
user 160m19.476s
sys 63m23.575s

確認のため,ディレクトリ構造を表示する.:

pwd

/mnt/ssd_elecom_black_c2c_480G/cif/1/00/00/1000000

 tree
.
|-- POSCAR
|-- cif2cell_log.txt
`-- nnlist_1.7
    |-- POSCAR.nnlist
    `-- poscar2nnlist_log.txt

1 directory, 4 files

各POSCARファイルが存在するディレクトリのサブディレクトリにnnlist_1.7/というディレクトリが作成され,
内部にPOSCAR.nnlistファイルが保存されているのが確認できる.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0