SAMBA-ilum 1.0.0.528__tar.gz → 1.0.0.529__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/PKG-INFO +1 -1
  2. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/SAMBA_ilum.egg-info/PKG-INFO +1 -1
  3. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/SAMBA_ilum.egg-info/SOURCES.txt +0 -1
  4. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/__main__.py +1 -1
  5. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/HeteroStructure_Generator.py +22 -13
  6. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/setup.py +1 -1
  7. samba_ilum-1.0.0.528/samba_ilum/src/data-base_json_fix.py +0 -880
  8. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/LICENSE.txt +0 -0
  9. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/README.md +0 -0
  10. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/SAMBA_ilum.egg-info/dependency_links.txt +0 -0
  11. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/SAMBA_ilum.egg-info/entry_points.txt +0 -0
  12. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/SAMBA_ilum.egg-info/requires.txt +0 -0
  13. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/SAMBA_ilum.egg-info/top_level.txt +0 -0
  14. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/__init__.py +0 -0
  15. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/BZ_2D.py +0 -0
  16. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/Hubbard_U_values.txt +0 -0
  17. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_a-scan +0 -0
  18. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_bader +0 -0
  19. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_bader.SO +0 -0
  20. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_bands +0 -0
  21. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_bands.SO +0 -0
  22. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_dos +0 -0
  23. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_dos.SO +0 -0
  24. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_relax +0 -0
  25. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_scf +0 -0
  26. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_scf.SO +0 -0
  27. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_xy-scan +0 -0
  28. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_xyz-scan +0 -0
  29. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/INCAR_z-scan +0 -0
  30. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/SAMBA_HeteroStructure.input +0 -0
  31. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/SAMBA_WorkFlow.input +0 -0
  32. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.bands +0 -0
  33. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.chgcar +0 -0
  34. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.dos +0 -0
  35. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.location +0 -0
  36. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.locpot +0 -0
  37. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.orbitals +0 -0
  38. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.spin +0 -0
  39. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/INPUTS/vdw_kernel.bindat +0 -0
  40. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/_info_pseudo.py +0 -0
  41. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/a-scan.py +0 -0
  42. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/a-scan_analysis.py +0 -0
  43. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/bader +0 -0
  44. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/bader_poscar.py +0 -0
  45. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/bader_update.py +0 -0
  46. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/cell_check.py +0 -0
  47. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/charge_transfer.py +0 -0
  48. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/chgsum.pl +0 -0
  49. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/contcar_update.py +0 -0
  50. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/data-base_json.py +0 -0
  51. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/data-base_union.py +0 -0
  52. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/energy_scan.py +0 -0
  53. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/hubbard_correction.py +0 -0
  54. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/job.py +0 -0
  55. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/kpoints.py +0 -0
  56. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/lattice_plot3d.py +0 -0
  57. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/make_files.py +0 -0
  58. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/output.py +0 -0
  59. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/potcar.py +0 -0
  60. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/vdW_DF.py +0 -0
  61. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/xy-scan.py +0 -0
  62. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/xy-scan_analysis.py +0 -0
  63. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/xyz-scan.py +0 -0
  64. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/xyz-scan_analysis.py +0 -0
  65. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/z-scan.py +0 -0
  66. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/samba_ilum/src/z-scan_analysis.py +0 -0
  67. {samba_ilum-1.0.0.528 → samba_ilum-1.0.0.529}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SAMBA_ilum
3
- Version: 1.0.0.528
3
+ Version: 1.0.0.529
4
4
  Summary: ...
5
5
  Author: Augusto de Lelis Araujo
6
6
  Author-email: augusto-lelis@outlook.com
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SAMBA_ilum
3
- Version: 1.0.0.528
3
+ Version: 1.0.0.529
4
4
  Summary: ...
5
5
  Author: Augusto de Lelis Araujo
6
6
  Author-email: augusto-lelis@outlook.com
@@ -23,7 +23,6 @@ samba_ilum/src/charge_transfer.py
23
23
  samba_ilum/src/chgsum.pl
24
24
  samba_ilum/src/contcar_update.py
25
25
  samba_ilum/src/data-base_json.py
26
- samba_ilum/src/data-base_json_fix.py
27
26
  samba_ilum/src/data-base_union.py
28
27
  samba_ilum/src/energy_scan.py
29
28
  samba_ilum/src/hubbard_correction.py
@@ -16,7 +16,7 @@ dir_samba = os.path.dirname(os.path.realpath(__file__))
16
16
  print(f'{dir_samba}')
17
17
  #--------------------
18
18
 
19
- version = '1.0.0.528'
19
+ version = '1.0.0.529'
20
20
 
21
21
  print(" ")
22
22
  print("=============================================================")
@@ -1974,6 +1974,23 @@ for i in range(len(files)):
1974
1974
  #-------------------------
1975
1975
  VTemp1 = VTemp[-1].split()
1976
1976
  #-------------------------
1977
+ pulo = n_Lattice +4
1978
+ tag1_str = VTemp1[pulo + 1]; tag1 = [float(x) for x in tag1_str.split('_')] # mismatch_areas_12_21
1979
+ tag2_str = VTemp1[pulo + 5]; tag2 = [float(x) for x in tag2_str.split('_')] # var_areas
1980
+ tag3_str = VTemp1[pulo + 9]; tag3 = [float(x) for x in tag3_str.split('_')] # var_vectors
1981
+ tag4_str = VTemp1[pulo + 13]; tag4 = [float(x) for x in tag4_str.split('_')] # mismatch_angles_12_21
1982
+ tag5_str = VTemp1[pulo + 17]; tag5 = [float(x) for x in tag5_str.split('_')] # var_angles
1983
+ tag6_str = VTemp1[pulo + 21]; tag6 = [float(x) for x in tag6_str.split('_')] # rotation_angle
1984
+ tag7_str = VTemp1[pulo + 25]; tag7 = [float(x) for x in tag7_str.split('_')] # MSCell_1
1985
+ tag8_str = VTemp1[pulo + 29]; tag8 = [float(x) for x in tag8_str.split('_')] # MSCell_2
1986
+ tag9_str = VTemp1[pulo + 33]; tag9 = [float(x) for x in tag9_str.split('_')] # MDeform_1
1987
+ tag10_str = VTemp1[pulo + 37]; tag10 = [float(x) for x in tag10_str.split('_')] # MDeform_2
1988
+ #---------------------------------------------------------------------------------------------
1989
+ data_hash = [tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10]
1990
+ #------------------------------------------------------------------------
1991
+ new_id = hashlib.sha1(json.dumps(data_hash, separators=(',', ':')).encode('utf-8')).hexdigest()[:8]
1992
+ #--------------------------------------------------------------------------------------------------
1993
+
1977
1994
 
1978
1995
  #-------------------------------------------------------
1979
1996
  VTemp = poscar.readline()
@@ -1992,22 +2009,17 @@ for i in range(len(files)):
1992
2009
  poscar.close()
1993
2010
  #-------------
1994
2011
 
1995
- #-------------------------------------------------------------
1996
- if ((i+1) < 10): number = '000' + str(i+1)
1997
- if ((i+1) >= 10 and (i+1) < 100): number = '00' + str(i+1)
1998
- if ((i+1) >= 100 and (i+1) < 1000): number = '0' + str(i+1)
1999
- if ((i+1) >= 1000): number = '' + str(i+1)
2000
- #-------------------------------------------------------------
2001
2012
 
2002
2013
  #-------------------------------------
2003
2014
  current_name = diret2 + files[i]
2004
2015
  if (n_Lattice == 2):
2005
- new_name = diret2 + n_ion + '_' + var_area + '_' + rotation_angle + '_' + str(VTemp1[-1]) + '+' + number + '.vasp'
2016
+ new_name = diret2 + n_ion + '_' + var_area + '_' + rotation_angle + '_' + str(VTemp1[-1]) + '+' + new_id + '.vasp'
2006
2017
  if (n_Lattice == 3):
2007
- new_name = diret2 + n_ion + '_' + var_area + '_' + rotation_angle + '_'+ str(VTemp1[-1]) + '+' + number + '.vasp'
2018
+ new_name = diret2 + n_ion + '_' + var_area + '_' + rotation_angle + '_'+ str(VTemp1[-1]) + '+' + new_id + '.vasp'
2008
2019
  os.rename(current_name, new_name)
2009
2020
  #--------------------------------
2010
2021
 
2022
+
2011
2023
  #---------------------------
2012
2024
  poscar = open(new_name, "r")
2013
2025
  VTemp = poscar.readline().split()
@@ -2022,11 +2034,8 @@ for i in range(len(files)):
2022
2034
  #=-------------------------------------------------------
2023
2035
  with open(new_name, 'r') as file: line = file.readlines()
2024
2036
  #=-------------------------------------------------------
2025
- if (nion < 9): nnion = '0' + str(nion)
2026
- if (nion > 9): nnion = str(nion)
2027
- #-------------------------------
2028
- line[0] = t_VTemp + '_' + str(nnion) + 'atoms' + '+' + number + '\n'
2029
- #------------------------------------------------------------------
2037
+ line[0] = t_VTemp + '+' + new_id + '\n'
2038
+ #--------------------------------------
2030
2039
  """
2031
2040
  for ii in range(nion):
2032
2041
  VTemp = line[8+ii].split()
@@ -6,7 +6,7 @@ import json
6
6
 
7
7
  setup(
8
8
  name = "SAMBA_ilum",
9
- version = "1.0.0.528",
9
+ version = "1.0.0.529",
10
10
  entry_points={'console_scripts': ['samba_ilum = samba_ilum:main']},
11
11
  description = "...",
12
12
  author = "Augusto de Lelis Araujo",
@@ -1,880 +0,0 @@
1
- # SAMBA_ilum Copyright (C) 2025 - Closed source
2
-
3
- from pymatgen.io.vasp import Poscar
4
- from pymatgen.core import Structure
5
- from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
6
- #--------------------------------------------------------
7
- import numpy as np
8
- import shutil
9
- import json
10
- import uuid
11
- import sys
12
- import os
13
-
14
-
15
- pseudo_type = 'PAW_PBE'
16
- exchange_correlation_functional = 'GGA'
17
- vdW = 'optB86b'
18
-
19
-
20
- # replace_type_pseudo
21
- # replace_type_XC
22
- # replace_type_vdW
23
-
24
-
25
- # =========================================
26
- # Checking files to be read: ==============
27
- # =========================================
28
- l_file = 'null'; l_file_SO = 'null'
29
- if os.path.isfile('output/info_scf.txt'): l_file = 'info_scf.txt'
30
- if os.path.isfile('output/info_bands.txt'): l_file = 'info_bands.txt'
31
- if os.path.isfile('output/info_scf_SO.txt'): l_file_SO = 'info_scf_SO.txt'
32
- if os.path.isfile('output/info_bands_SO.txt'): l_file_SO = 'info_bands_SO.txt'
33
- if (l_file == 'null' and l_file_SO == 'null'): sys.exit(0)
34
-
35
-
36
- #==========================================================
37
- # Extracting the k-path for the Band Structure plot =======
38
- #==========================================================
39
- kpoints_file = []
40
- kpath = []
41
- kpath_label = []
42
- #---------------
43
- if os.path.isdir('output/Bandas'): dir_kpath = 'bands'
44
- if os.path.isdir('output/Bandas_SO'): dir_kpath = 'bands.SO'
45
- #-----------------------------------------------------------------------------
46
- if os.path.isfile(dir_kpath + '/' + 'KPOINTS'): kpoints_file.append('KPOINTS')
47
- #--------------------------------------------------------------------------------------
48
- nkpoints = len([file for file in os.listdir(dir_kpath) if file.startswith("KPOINTS.")])
49
- for i in range(nkpoints):
50
- file = 'KPOINTS.' + str(i+1)
51
- if os.path.isfile(dir_kpath + '/' + file): kpoints_file.append(file)
52
- #---------------------------------
53
- for i in range(len(kpoints_file)):
54
- #-----------------------------
55
- with open(dir_kpath + '/' + kpoints_file[i], 'r') as file: lines = file.readlines()
56
- #----------------------------------------------------------------------------------
57
- if (len(kpoints_file) == 1):
58
- for j in range(len(lines)):
59
- if (j > 3 and len(lines[j]) > 1):
60
- line = lines[j].split()
61
- line[3] = line[3].replace('!', '').replace('#1', 'Gamma').replace('#', '')
62
- kpath.append([round(float(line[0]), 15), round(float(line[1]), 15), round(float(line[2]), 15)])
63
- kpath_label.append(line[3])
64
- #--------------------------------------
65
- if (len(kpoints_file) > 1):
66
- for j in range(len(lines)):
67
- if (i == 0 and j > 3 and len(lines[j]) > 1):
68
- line = lines[j].split()
69
- line[3] = line[3].replace('!', '').replace('#1', 'Gamma').replace('#', '')
70
- kpath.append([round(float(line[0]), 15), round(float(line[1]), 15), round(float(line[2]), 15)])
71
- kpath_label.append([line[3]])
72
- if (i > 0 and j > 4 and len(lines[j]) > 1):
73
- line = lines[j].split()
74
- line[3] = line[3].replace('!', '').replace('#1', 'Gamma').replace('#', '')
75
- kpath.append([round(float(line[0]), 15), round(float(line[1]), 15), round(float(line[2]), 15)])
76
- #-------------------------------------------------------------
77
- # Removing adjacent and repeated elements from the k-path list
78
- #-------------------------------------------------------------
79
- i = 0
80
- while i < (len(kpath) -1):
81
- if kpath[i] == kpath[i +1]: del kpath[i +1]
82
- if kpath_label[i] == kpath_label[i +1]: del kpath_label[i +1]
83
- else: i += 1 # Avança para o próximo par de elementos
84
-
85
-
86
- # ===================================================
87
- # Starting tags with empty values "--" ==============
88
- # ===================================================
89
- area_perc_mismatch = '--'; perc_area_change = '--'; perc_mod_vectors_change = '--';
90
- angle_perc_mismatch = '--'; perc_angle_change = '--'; rotation_angle = '--';
91
- supercell_matrix = '--'; deformation_matrix = '--'; strain_matrix = '--'
92
- shift_plane = '--'
93
-
94
- # =============================================================
95
- # Extracting Configuration Information from Heterostructure ===
96
- # =============================================================
97
- if os.path.isfile('output/POSCAR.info'):
98
- #---------------------------------------
99
- poscar = open('output/POSCAR.info', "r")
100
- for i in range(7): VTemp = poscar.readline().split()
101
- poscar.close()
102
- nni = 0
103
- for i in range(len(VTemp)): nni += int(VTemp[i])
104
- if (nni < 9): ni = '0' + str(nni)
105
- if (nni > 9): ni = str(nni)
106
- #---------------------------------------
107
- poscar = open('output/POSCAR.info', "r")
108
- VTemp = poscar.readline().split()
109
- param = float(poscar.readline())
110
- poscar.close()
111
- #------------------------
112
- if (VTemp[0] == 'SAMBA'):
113
- #----------------------------------------------------------------
114
- l_materials = VTemp[1].replace('+', ' ').replace('_', '').split()
115
- n_materials = len(l_materials)
116
- #------------------------------------------
117
- r_ions_materials = []; nions_materials = []
118
- nion = 0; passo = 0
119
- #-----------------------------
120
- for m in range(n_materials):
121
- r_ions_materials.append( str(1 + nion) + ':')
122
- nion += int(VTemp[m+2])
123
- r_ions_materials[m] += str(nion)
124
- nions_materials.append(int(VTemp[m+2]))
125
- #------------------------------------------
126
- id_materials = []
127
- #--------------------
128
-
129
-
130
- if (n_materials > 1):
131
- #----------------------------------------------------------------------
132
- area_perc_mismatch = []; angle_perc_mismatch = []; rotation_angle = []
133
- perc_area_change = []; perc_mod_vectors_change = []; perc_angle_change = []
134
- supercell_matrix = []; deformation_matrix = []; strain_matrix = []
135
- shift_plane = []
136
- #---------------------
137
- passo = n_materials +1
138
- passo += 4
139
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
140
- area_perc_mismatch.append([round(float(temp1[0]), 15), round(float(temp1[1]), 15)])
141
- if (n_materials == 3):
142
- area_perc_mismatch.append([round(float(temp1[2]), 15), round(float(temp1[3]), 15)])
143
- #-------------------------------------------------
144
- passo += 4
145
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
146
- for ii in range(len(temp1)): perc_area_change.append(round(float(temp1[ii]), 15))
147
- #--------------------------------------------------------------
148
- passo += 4
149
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
150
- perc_mod_vectors_change.append([round(float(temp1[0]), 15), round(float(temp1[1]), 15)])
151
- perc_mod_vectors_change.append([round(float(temp1[2]), 15), round(float(temp1[3]), 15)])
152
- if (n_materials == 3):
153
- perc_mod_vectors_change.append([round(float(temp1[4]), 15), round(float(temp1[5]), 15)])
154
- #------------------------------------------------------
155
- passo += 4
156
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
157
- angle_perc_mismatch.append([round(float(temp1[0]), 15), round(float(temp1[1]), 15)])
158
- if (n_materials == 3):
159
- angle_perc_mismatch.append([round(float(temp1[2]), 15), round(float(temp1[3]), 15)])
160
- #--------------------------------------------------
161
- passo += 4
162
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
163
- for ii in range(len(temp1)): perc_angle_change.append(round(float(temp1[ii]), 15))
164
- #---------------------------------------------------------------
165
- passo += 4
166
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
167
- for ii in range(len(temp1)): rotation_angle.append(round(float(temp1[ii]), 15))
168
- #------------------------------------------------------------
169
- for i in range(n_materials):
170
- passo += 4
171
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
172
- supercell_matrix.append([[int(temp1[0]), int(temp1[1])], [int(temp1[2]), int(temp1[3])]])
173
- # supercell_matrix.append([[round(float(temp1[0]), 15), round(float(temp1[1]), 15)], [round(float(temp1[2]), 15), round(float(temp1[3]), 15)]])
174
- #------------------------------------------------------------------------
175
- for i in range(n_materials):
176
- passo += 4
177
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
178
- deformation_matrix.append([[round(float(temp1[0]), 15), round(float(temp1[1]), 15)], [round(float(temp1[2]), 15), round(float(temp1[3]), 15)]])
179
- #--------------------------------------------------------------------------
180
- for i in range(n_materials):
181
- passo += 4
182
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
183
- strain_matrix.append([[round(float(temp1[0]), 15), round(float(temp1[1]), 15)], [round(float(temp1[2]), 15), round(float(temp1[3]), 15)]])
184
- #---------------------------------------------------------------------
185
- passo += 4
186
- temp1 = str(VTemp[passo]).replace('_', ' ').split()
187
- for ii in range(len(temp1)): shift_plane.append(round(float(temp1[ii]), 15))
188
- #---------------------------------------------------------
189
- passo += 1
190
- for i in range(n_materials):
191
- id_materials.append(str(VTemp[-n_materials -1 +i]))
192
- #--------------------------------------------
193
- temp_id = VTemp[-1].replace('_', ' ').split()
194
- if (len(temp_id) > 1): estequiometria = temp_id[0]
195
- #-------------------------------------------------
196
- temp_id = VTemp[-1].replace("+"," + ").split()
197
- id_code = ''
198
- #---------------------
199
- if (n_materials == 1):
200
- if (len(temp_id) == 1): id_code = VTemp[-1] + '_' + str(ni) + 'atoms'
201
- if (len(temp_id) > 1): id_code = VTemp[-1]
202
- #---------------------------------------------
203
- if (n_materials > 1):
204
- if (len(temp_id) >= 3):
205
- if (temp_id[-3][-5:] == 'atoms'): id_code = VTemp[-1]
206
- if (temp_id[-3][-5:] != 'atoms'):
207
- temp_id[-3] = temp_id[-3] + '_' + str(ni) + 'atoms'
208
- for i in range(len(temp_id)): id_code += str(temp_id[i])
209
- #-------------------------------------------------------
210
- if (n_materials == 1): id_materials.append(str(id_code))
211
- #-------------------------------------------------------
212
- if (VTemp[0] != 'SAMBA'): exit()
213
- #-------------------------------
214
-
215
-
216
- # =============================================================
217
- # Extracting Configuration Information from Heterostructure ===
218
- # =============================================================
219
- poscar = open('output/POSCAR.info', "r")
220
- VTemp = poscar.readline().split()
221
- materials = VTemp[1].replace('+', ' ').split()
222
- #---------------------------------------------
223
- t_ions_materials = []
224
- for i in range(len(materials)):
225
- ions_vector = []
226
- mat_temp = materials[i].replace('_', ' ').split()
227
- for j in range(len(mat_temp)):
228
- ions_vector.append(str(mat_temp[j]))
229
- t_ions_materials.append(ions_vector)
230
- #-------------------------------------------
231
- for i in range(6): VTemp = poscar.readline().split()
232
- t_nions_materials = []; number = -1
233
- for i in range(len(materials)):
234
- nions_vector = []
235
- mat_temp = materials[i].replace('_', ' ').split()
236
- for j in range(len(mat_temp)):
237
- number += 1
238
- nions_vector.append(int(VTemp[number]))
239
- t_nions_materials.append(nions_vector)
240
- #-------------
241
- poscar.close()
242
- #-------------
243
-
244
-
245
- # =====================================================
246
- # Extracting the positions of ions from the Lattice ===
247
- # =====================================================
248
- poscar = open('output/CONTCAR', "r")
249
- for i in range(5): VTemp = poscar.readline()
250
- type_ions = poscar.readline().split()
251
- type_ions_n = poscar.readline().split()
252
- poscar.readline()
253
- coord_ions = []
254
- rotulo_ions = []
255
- for i in range(len(type_ions)):
256
- for j in range(int(type_ions_n[i])):
257
- VTemp = poscar.readline().split()
258
- coord_ions.append([ round(float(VTemp[0]), 15), round(float(VTemp[1]), 15), round(float(VTemp[2]), 15) ])
259
- rotulo_ions.append(type_ions[i])
260
- poscar.close()
261
-
262
-
263
- # ========================================================
264
- # Extracting thicknesses and separating materials ========
265
- # ========================================================
266
- thickness = []; temp_z = []; z_separation = []
267
- #----------------------------------------------
268
- poscar = open('output/POSCAR.info', "r")
269
- for i in range(8): VTemp = poscar.readline()
270
- for i in range(nion):
271
- VTemp = poscar.readline().split()
272
- temp_z.append(float(VTemp[2]))
273
- total_thickness = (max(temp_z) -min(temp_z))*param
274
- total_thickness = round(total_thickness, 15)
275
- poscar.close()
276
- #---------------------------------------------------------
277
- if (n_materials == 1): thickness.append( total_thickness )
278
- #---------------------------------------------------------
279
- if (n_materials > 1):
280
- poscar = open('output/POSCAR.info', "r")
281
- for i in range(8): VTemp = poscar.readline()
282
- for i in range(n_materials):
283
- temp_z = []
284
- for j in range(int(nions_materials[i])):
285
- VTemp = poscar.readline().split()
286
- temp_z.append(float(VTemp[2]))
287
- temp_t = (max(temp_z) -min(temp_z))*param
288
- thickness.append(round(temp_t, 15))
289
- #---------------------------------------
290
- if (i > 0):
291
- temp_sep = (min(temp_z) -temp_max)*param
292
- z_separation.append(round(temp_sep, 15))
293
- temp_max = max(temp_z)
294
- #---------------------
295
- poscar.close()
296
- #----------------
297
-
298
-
299
- # =================================================
300
- # Extracting Binding Energy =======================
301
- # =================================================
302
- e_binding = '--'
303
- if os.path.isfile('output/z-scan/info_z-scan.dat'):
304
- #--------------------------------------------------
305
- zscan = open('output/z-scan/info_z-scan.dat', "r")
306
- #--------------------------------------------------
307
- for i in range(5): VTemp = zscan.readline().split()
308
- e_binding = float(VTemp[2])
309
- #-------------
310
- zscan.close()
311
-
312
- # -------------------------------------
313
- # Updating Binding Energy -------------
314
- # -------------------------------------
315
- file_oszicar = 'relax/OSZICAR'
316
- file_oszicar_f = 'relax/OSZICAR_frozen'
317
- #--------------------------------------
318
- if os.path.isfile(file_oszicar):
319
- if os.path.isfile(file_oszicar_f):
320
- #------------------------------------
321
- with open(file_oszicar, 'r') as file:
322
- lines = file.readlines()
323
- last_line = lines[-1].split()
324
- energ_r = float(last_line[2])
325
- #--------------------------------------
326
- with open(file_oszicar_f, 'r') as file:
327
- lines = file.readlines()
328
- last_line = lines[-1].split()
329
- energ_f = float(last_line[2])
330
- #-------------------------------
331
- e_binding += (energ_f - energ_r)
332
-
333
-
334
- # =================================================
335
- # Extracting Slide Energy =========================
336
- # =================================================
337
- e_slide = '--'
338
- if os.path.isfile('output/xy-scan/info_xy-scan.dat'):
339
- #----------------------------------------------------
340
- xyscan = open('output/xy-scan/info_xy-scan.dat', "r")
341
- #----------------------------------------------------
342
- for i in range(6): VTemp = xyscan.readline().split()
343
- e_slide = round(float(VTemp[2]), 15)
344
- #-------------
345
- xyscan.close()
346
-
347
-
348
- # ==========================================
349
- # Splitting the POSCAR file ================
350
- # ==========================================
351
-
352
- if (n_materials > 1):
353
-
354
- #---------------------------------------
355
- poscar = open('output/POSCAR.info', 'r')
356
- #---------------------------------------
357
- VTemp = poscar.readline().split()
358
- label_materials = VTemp[1].replace('+', ' ').split()
359
- n_Lattice = len(label_materials); nion = 0
360
- range_ion_Lattice = []; ntype_ions = ['']*n_Lattice
361
- #--------------------------------------------------
362
- for m in range(n_Lattice):
363
- range_ion_Lattice.append( str(1 + nion) + ' ')
364
- nion += int(VTemp[m+2])
365
- range_ion_Lattice[m] += str(nion)
366
- #----------------------------------------------------
367
- for m in range(6): VTemp = poscar.readline().split()
368
- #----------------------------------------------------
369
- poscar.close()
370
- #-------------
371
- for m in range(n_Lattice):
372
- contador = 0
373
- for n in range(len(VTemp)):
374
- contador += int(VTemp[n])
375
- range_ion = range_ion_Lattice[m].split()
376
- ion_i = int(range_ion[0]); ion_f = int(range_ion[1])
377
- if (contador >= ion_i and contador <= ion_f):
378
- ntype_ions[m] += str(VTemp[n]) + ' '
379
-
380
- for m in range(n_Lattice):
381
- #---------------------------------------
382
- poscar = open('output/POSCAR.info', 'r')
383
- poscar_new = open('output/POSCAR.material_' + str(m+1), 'w')
384
- #-----------------------------------------------------------
385
- VTemp = poscar.readline()
386
- poscar_new.write(f'POSCAR \n')
387
- #-----------------------------
388
- for n in range(4):
389
- VTemp = poscar.readline()
390
- poscar_new.write(f'{VTemp}')
391
- #-------------------------------
392
- VTemp = poscar.readline()
393
- temp = label_materials[m].replace('_', ' ')
394
- poscar_new.write(f'{temp} \n')
395
- #-----------------------------
396
- VTemp = poscar.readline()
397
- poscar_new.write(f'{ntype_ions[m]} \n')
398
- #--------------------------------------
399
- VTemp = poscar.readline()
400
- poscar_new.write(f'direct \n')
401
- #---------------------------------------
402
- range_ion = range_ion_Lattice[m].split()
403
- ion_i = int(range_ion[0]); ion_f = int(range_ion[1])
404
- #----------------------------------------------------
405
- for n in range(1,(nion+1)):
406
- VTemp = poscar.readline()
407
- if (n >= ion_i and n <= ion_f): poscar_new.write(f'{VTemp}')
408
- #----------------------------------------------------------------
409
- poscar.close()
410
- poscar_new.close()
411
- #-----------------
412
-
413
-
414
- # ===============================================
415
- # Building the .json file =======================
416
- # ===============================================
417
-
418
- #-----------------------------------------------------
419
- # Initializing the JSON file with an empty dictionary:
420
- #-----------------------------------------------------
421
- with open('output/info.json', 'w') as file_json:
422
- json.dump({}, file_json)
423
-
424
- # ===============================================
425
- # Updating .json file information ===============
426
- # ===============================================
427
-
428
- for n in range(2):
429
-
430
-
431
- #-------
432
- crit = 1
433
- #-----------
434
- if (n == 0):
435
- file = l_file
436
- if (file == 'null'): crit = 0
437
- #-----------
438
- if (n == 1):
439
- file = l_file_SO
440
- if (file == 'null'): crit = 0
441
- #---------
442
-
443
-
444
- if (crit == 1):
445
- # ===================================================
446
- # Starting tags with empty values "--" ==============
447
- # ===================================================
448
- loop = 0
449
- #-------
450
- id = '--'; id_monolayers = '--'
451
- label = '--'; label_materials = '--'; formula = '--'
452
- nlayers = '--'; nions = '--'; nions_monolayers = '--'; range_ions_materials = '--'
453
- type_ions_materials = '--'; type_nions_materials = '--'
454
- lattice_type = '--'; point_group = []; point_group_schoenflies = []; space_group = []; space_group_number = []; inversion_symmetry = []
455
- param_a = '--'; a1 = '--'; a2 = '--'; a3 = '--'; param_b = '--'; b1 = '--'; b2 = '--'; b3 = '--'
456
- module_a1_a2_a3 = '--'; module_b1_b2_b3 = '--'; angle_a1a2_a1a3_a2a3 = '--'; angle_b1b2_b1b3_b2b3 = '--'
457
- cell_area = '--'; cell_vol = '--'; zb_area = '--'; zb_volume = '--'
458
- direct_coord_ions = '--'; label_ions = '--'; k_path = '--'
459
- #----------------------------------------------------------------------------------------------------------
460
- e_vbm = '--'; e_cbm = '--'; e_fermi = '--'; e_vacuum = '--'; work_function = '--'; total_energy = '--'
461
- tk_vbm = '--'; tk_cbm = '--'; k_vbm = '--'; k_cbm = '--'
462
- nk = '--'; nb = '--'; ne = '--'; ne_valence = '--'; vbm = '--'; cbm = '--'; charge_transfer = []; charge_transfer_SO = []
463
- gap = '--'; type_gap = '--'; k_vbm = []; k_cbm = []; lorbit = '--'; ispin = '--'
464
- #------------------------------------------------------------------------------------
465
- non_collinear = '--'; spin_orbit = '--'; lorbit = '--'; ispin = '--'
466
- #----------------------------------------------------------------------
467
-
468
-
469
- # ========================================= ????????????????????????????????????????????????????????????????????????????????????????????????????????????
470
- # Extracting the vacuum level: ============ ?????????????????????????????? Only makes sense for 2D systems confined in Z ???????????????????????????????
471
- # ========================================= ????????????????????????????????????????????????????????????????????????????????????????????????????????????
472
- l_pot = 'null'; l_pot_SO = 'null'
473
- #-----------------------------------------------------------
474
- if os.path.isfile('output/Potencial_bands/Potencial_Z.dat'): l_pot = 'output/Potencial_bands/Potencial_Z.dat'
475
- if os.path.isfile('output/Potencial_scf/Potencial_Z.dat'): l_pot = 'output/Potencial_scf/Potencial_Z.dat'
476
- if os.path.isfile('output/Potencial_bands_SO/Potencial_Z.dat'): l_pot_SO = 'output/Potencial_bands_SO/Potencial_Z.dat'
477
- if os.path.isfile('output/Potencial_scf_SO/Potencial_Z.dat'): l_pot_SO = 'output/Potencial_scf_SO/Potencial_Z.dat'
478
- #------------------------------------------------------------
479
- if (l_pot != 'null'):
480
- file0 = np.loadtxt(l_pot)
481
- file0.shape
482
- #-----------------
483
- date_e = file0[:,1]
484
- e_vacuum = max(date_e)
485
- #------------------------
486
- if (l_pot_SO != 'null'):
487
- file1 = np.loadtxt(l_pot_SO)
488
- file1.shape
489
- #-----------------
490
- date_e = file1[:,1]
491
- e_vacuum = max(date_e)
492
-
493
-
494
- # ===========================================
495
- # Extracting data from VASProcar output =====
496
- # ===========================================
497
- with open('output/' + file, "r") as info: lines = info.readlines()
498
- #-----------------------------------------------------------------
499
- for i in range(len(lines)):
500
- VTemp = lines[i].replace('(', ' ( ').replace(')', ' ) ').replace(';', '').replace(',', '').split()
501
- if (len(VTemp) > 0):
502
- #----------------------------------------
503
- if (VTemp[0] == 'LNONCOLLINEAR'): non_collinear = str(VTemp[2])
504
- #----------------------------------------
505
- elif (VTemp[0] == 'LSORBIT'): spin_orbit = str(VTemp[2])
506
- #----------------------------------------
507
- elif (VTemp[0] == 'nº' or VTemp[0] == 'nº'):
508
- if (VTemp[1] == 'k-points'): nk = int(VTemp[3])
509
- if (VTemp[5] == 'bands'): nb = int(VTemp[7])
510
- if (VTemp[1] == 'ions'): ni = int(VTemp[3])
511
- if (VTemp[5] == 'electrons'): ne = round(float(VTemp[7]), 15)
512
- #--------------------------------------------------------------------
513
- elif (VTemp[0] == 'LORBIT'):
514
- lorbit = int(VTemp[2])
515
- if (VTemp[3] == 'ISPIN'): ispin = int(VTemp[5])
516
- #----------------------------------------
517
- elif (VTemp[0] == 'Last'): vbm = int(VTemp[4])
518
- #----------------------------------------
519
- elif (VTemp[0] == 'First'): cbm = vbm +1
520
- #----------------------------------------
521
- elif (VTemp[0] == 'Valence'):
522
- e_vbm = round(float(VTemp[7]), 15)
523
- tk_vbm = int(VTemp[11])
524
- #----------------------------------------
525
- elif (VTemp[0] == 'Conduction'):
526
- e_cbm = round(float(VTemp[7]), 15)
527
- tk_cbm = int(VTemp[11])
528
- #----------------------------------------
529
- elif (VTemp[0] == 'GAP'):
530
- type_gap = str(VTemp[2])
531
- gap = round(float(VTemp[5]), 15)
532
- #----------------------------------------
533
- elif (VTemp[0] == 'Fermi'): e_fermi = round(float(VTemp[3]), 15)
534
- #----------------------------------------
535
- elif (VTemp[0] == 'free'):
536
- total_energy = round(float(VTemp[4]), 15)
537
- # e_per_ion = round(float(total_energy)/ni, 15)
538
- #--------------------------------------------------------
539
- elif (VTemp[0] == 'Volume_cell'): Volume_cell = round(float(VTemp[2]), 15)
540
- #----------------------------------------
541
- elif (VTemp[0] == 'Param.'): param = float(VTemp[2])
542
- #----------------------------------------
543
- elif (VTemp[0] == 'A1'):
544
- a1 = [round(float(VTemp[4])*param, 15), round(float(VTemp[5])*param, 15), round(float(VTemp[6])*param, 15)]
545
- A1 = np.array([float(VTemp[4]), float(VTemp[5]), float(VTemp[6])])*param; module_a1_a2_a3 = []; module_a1_a2_a3.append(round(np.linalg.norm(A1), 15))
546
- elif (VTemp[0] == 'A2'):
547
- a2 = [round(float(VTemp[4])*param, 15), round(float(VTemp[5])*param, 15), round(float(VTemp[6])*param, 15)]
548
- A2 = np.array([float(VTemp[4]), float(VTemp[5]), float(VTemp[6])])*param; module_a1_a2_a3.append(round(np.linalg.norm(A2), 15))
549
- elif (VTemp[0] == 'A3'):
550
- a3 = [round(float(VTemp[4])*param, 15), round(float(VTemp[5])*param, 15), round(float(VTemp[6])*param, 15)]
551
- A3 = np.array([float(VTemp[4]), float(VTemp[5]), float(VTemp[6])])*param; module_a1_a2_a3.append(round(np.linalg.norm(A3), 15))
552
- #-------------------------------------------------------
553
- angle_a1a2_a1a3_a2a3 = []
554
- angle_a1a2_a1a3_a2a3.append(round(np.degrees(np.arccos(np.dot(A1,A2) / (np.linalg.norm(A1) * np.linalg.norm(A2)))), 15))
555
- angle_a1a2_a1a3_a2a3.append(round(np.degrees(np.arccos(np.dot(A1,A3) / (np.linalg.norm(A1) * np.linalg.norm(A3)))), 15))
556
- angle_a1a2_a1a3_a2a3.append(round(np.degrees(np.arccos(np.dot(A2,A3) / (np.linalg.norm(A2) * np.linalg.norm(A3)))), 15))
557
- #----------------------------------------
558
- elif (VTemp[0] == '2pi/Param.'): fator_rec = float(VTemp[2])
559
- #----------------------------------------
560
- elif (VTemp[0] == 'B1'):
561
- b1 = [round(float(VTemp[4])*fator_rec, 15), round(float(VTemp[5])*fator_rec, 15), round(float(VTemp[6])*fator_rec, 15)]
562
- B1 = np.array([float(VTemp[4]), float(VTemp[5]), float(VTemp[6])])*fator_rec; module_b1_b2_b3 = []; module_b1_b2_b3.append(round(np.linalg.norm(B1), 15))
563
- elif (VTemp[0] == 'B2'):
564
- b2 = [round(float(VTemp[4])*fator_rec, 15), round(float(VTemp[5])*fator_rec, 15), round(float(VTemp[6])*fator_rec, 15)]
565
- B2 = np.array([float(VTemp[4]), float(VTemp[5]), float(VTemp[6])])*fator_rec; module_b1_b2_b3.append(round(np.linalg.norm(B2), 15))
566
- elif (VTemp[0] == 'B3'):
567
- b3 = [round(float(VTemp[4])*fator_rec, 15), round(float(VTemp[5])*fator_rec, 15), round(float(VTemp[6])*fator_rec, 15)]
568
- B3 = np.array([float(VTemp[4]), float(VTemp[5]), float(VTemp[6])])*fator_rec; module_b1_b2_b3.append(round(np.linalg.norm(B3), 15))
569
- #-------------------------------------------------------
570
- angle_b1b2_b1b3_b2b3 = []
571
- angle_b1b2_b1b3_b2b3.append(round(np.degrees(np.arccos(np.dot(B1,B2) / (np.linalg.norm(B1) * np.linalg.norm(B2)))), 15))
572
- angle_b1b2_b1b3_b2b3.append(round(np.degrees(np.arccos(np.dot(B1,B3) / (np.linalg.norm(B1) * np.linalg.norm(B3)))), 15))
573
- angle_b1b2_b1b3_b2b3.append(round(np.degrees(np.arccos(np.dot(B2,B3) / (np.linalg.norm(B2) * np.linalg.norm(B3)))), 15))
574
- #----------------------------------------
575
- elif (VTemp[0] == 'Volume_ZB'): vol_zb = VTemp[2]
576
- #----------------------------------------
577
- elif (VTemp[0] == 'k-points'): loop = i+3
578
-
579
-
580
-
581
- if (tk_vbm != '--' and tk_cbm != '--'):
582
- # ===========================================
583
- # Finding the band gap k-points =============
584
- # ===========================================
585
- if (file == 'info_bands.txt' or file == 'info_bands_SO.txt'):
586
- if (n == 0): info = open('output/info_bands.txt', "r")
587
- if (n == 1): info = open('output/info_bands_SO.txt', "r")
588
- #-----------
589
- test = 'nao'
590
- #-----------
591
- while (test == 'nao'):
592
- #--------------------------------
593
- VTemp = info.readline().split()
594
- #-----------------------------------------------------------
595
- if (len(VTemp) > 0 and VTemp[0] == 'k-points'): test = 'sim'
596
- #-----------------------------------------------------------
597
- for nn in range(2): VTemp = info.readline()
598
- for nn in range(1,(nk+1)):
599
- VTemp = info.readline().split()
600
- if (nn == int(tk_vbm)): k_vbm = [round(float(VTemp[1]), 15), round(float(VTemp[2]), 15), round(float(VTemp[3]), 15)]
601
- if (nn == int(tk_cbm)): k_cbm = [round(float(VTemp[1]), 15), round(float(VTemp[2]), 15), round(float(VTemp[3]), 15)]
602
-
603
-
604
- # =================================================================
605
- # Searching for values ​​for the Transfer of Bader's Charge =========
606
- # =================================================================
607
- if (n_materials > 1):
608
- #===========
609
- if (n == 0):
610
- if os.path.isfile('output/Charge_transfer/Bader_charge_transfer.dat'):
611
- file_bader = 'output/Charge_transfer/Bader_charge_transfer.dat'
612
- #----------------------------
613
- bader = open(file_bader, "r")
614
- for nn in range(4): VTemp = bader.readline()
615
- for mn in range(len(t_ions_materials)):
616
- vector_bader = []
617
- VTemp = bader.readline()
618
- VTemp = bader.readline().split()
619
- vector_bader.append(round(float(VTemp[2]), 15))
620
- for mm in range(len(t_ions_materials[mn])):
621
- VTemp = bader.readline().split()
622
- vector_bader.append(round(float(VTemp[3]), 15))
623
- charge_transfer.append(vector_bader)
624
- #===========
625
- if (n == 1):
626
- if os.path.isfile('output/Charge_transfer_SO/Bader_charge_transfer.dat'):
627
- file_bader = 'output/Charge_transfer_SO/Bader_charge_transfer.dat'
628
- #----------------------------
629
- bader = open(file_bader, "r")
630
- for nn in range(4): VTemp = bader.readline()
631
- for mn in range(len(t_ions_materials)):
632
- vector_bader = []
633
- VTemp = bader.readline()
634
- VTemp = bader.readline().split()
635
- vector_bader.append(round(float(VTemp[2]), 15))
636
- for mm in range(len(t_ions_materials[mn])):
637
- VTemp = bader.readline().split()
638
- vector_bader.append(round(float(VTemp[3]), 15))
639
- charge_transfer_SO.append(vector_bader)
640
-
641
-
642
- """
643
- # ===========================================================
644
- # Obtaining and organizing k-point information ==============
645
- # ===========================================================
646
- if (file == 'info_bands.txt' or file == 'info_bands_SO.txt'):
647
- #---------------------------------
648
- info = open('output/' + file, "r")
649
- #---------------------------------
650
- if (loop != 0):
651
- #-----------------------------------------------------
652
- k_points_direct = []; k_points_cart = []; k_path = []
653
- #---------------------------------------------
654
- for i in range(loop): VTemp = info.readline()
655
- for i in range(nk):
656
- VTemp = info.readline().split()
657
- k_points_direct.append([VTemp[1], VTemp[2], VTemp[3]])
658
- k_points_cart.append([VTemp[4], VTemp[5], VTemp[6]])
659
- k_path.append(VTemp[7])
660
- print(k_path)
661
- #-----------
662
- info.close()
663
- """
664
-
665
-
666
- # =========================================================
667
- # Obtaining lattice symmetries ============================
668
- # =========================================================
669
-
670
- #--------------------------------------------------------------------
671
- # Hermann-Mauguin Mapping Dictionary for Schoenflies ----------------
672
- #--------------------------------------------------------------------
673
- schoenflies = {"1": "C1", "-1": "Ci", "2": "C2", "m": "Cs", "2/m": "C2h", "222": "D2", "mm2": "C2v", "mmm": "D2h", "4": "C4", "-4": "S4", "4/m": "C4h",
674
- "422": "D4", "4mm": "C4v", "-42m": "D2d", "4/mmm": "D4h", "3": "C3", "-3": "C3i", "32": "D3", "3m": "C3v", "-3m": "D3d", "6": "C6", "-6": "C3h",
675
- "6/m": "C6h", "622": "D6", "6mm": "C6v", "-6m2": "D3h", "6/mmm": "D6h", "23": "T", "m-3": "Th", "432": "O", "-43m": "Td", "m-3m": "Oh"}
676
- #--------------------------------------------------------------------
677
- if (n_materials == 1): passo = 1
678
- if (n_materials > 1): passo = n_materials +1
679
- #--------------------------------------------
680
- for i in range(passo):
681
- #-----------------
682
- if (i == 0): structure = Poscar.from_file('output/POSCAR.info').structure
683
- if (i > 0): structure = Poscar.from_file('output/POSCAR.material_' + str(i)).structure
684
- analyzer = SpacegroupAnalyzer(structure)
685
- #----------------------------------------------------
686
- point_group.append(analyzer.get_point_group_symbol())
687
- space_group.append(analyzer.get_space_group_symbol())
688
- space_group_number.append(analyzer.get_space_group_number())
689
- inversion_symmetry.append(analyzer.is_laue())
690
- if (i == 0): lattice_type = analyzer.get_lattice_type()
691
- point_group_schoenflies.append(schoenflies.get(point_group[0], "Desconhecido"))
692
- #------------------------------------------------------------------------------
693
- # if (i > 0): os.remove('output/POSCAR.material_' + str(i)) # ERROR !!!!!!!!!!!
694
-
695
-
696
- #======================================================
697
- # Obtaining the area in the XY plane of the lattice ===
698
- #======================================================
699
- V1 = np.array([A1[0], A1[1]])
700
- V2 = np.array([A2[0], A2[1]])
701
- #----------------------------
702
- # Cell area in the XY plane
703
- Area_cell = round(np.linalg.norm(np.cross(V1, V2)), 15)
704
- #------------------------------------------------------
705
-
706
-
707
- #===================================================
708
- # Obtaining the area in the KxKy plane of the ZB ===
709
- #===================================================
710
- V1 = np.array([B1[0], B1[1]])
711
- V2 = np.array([B2[0], B2[1]])
712
- #----------------------------
713
- # Area of ​​ZB in the KxKy plane
714
- Area_ZB = round(np.linalg.norm(np.cross(V1, V2)), 15)
715
- #----------------------------------------------------
716
-
717
-
718
- # ===========================================
719
- # Creating the Dictionary ===================
720
- # ===========================================
721
-
722
- dados0 = {
723
- "id": id_code,
724
- "number_layers": n_materials,
725
- "id_layers": id_materials,
726
- "formula": estequiometria,
727
- "type_ions_layers": t_ions_materials,
728
- "number_ions_layers": nions_materials,
729
- "number_type_ions_layers": t_nions_materials,
730
- "range_ions_layers": r_ions_materials,
731
- "number_ions": ni,
732
- # ---------------------------------------------------------------------
733
- "area_perc_mismatch": area_perc_mismatch if n_materials > 1 else None,
734
- "perc_area_change": perc_area_change if n_materials > 1 else None,
735
- "perc_mod_vectors_change": perc_mod_vectors_change if n_materials > 1 else None,
736
- "angle_perc_mismatch": angle_perc_mismatch if n_materials > 1 else None,
737
- "perc_angle_change": perc_angle_change if n_materials > 1 else None,
738
- "rotation_angle": rotation_angle if n_materials > 1 else None,
739
- "supercell_matrix": supercell_matrix if n_materials > 1 else None,
740
- "deformation_matrix": deformation_matrix if n_materials > 1 else None,
741
- "strain_matrix": strain_matrix if n_materials > 1 else None,
742
- # "structural_optimization": 'DFT', # 'none', 'DFT', 'ML', 'ML/DFT'
743
- "shift_plane": shift_plane if n_materials > 1 else None,
744
- "z_separation": z_separation if n_materials > 1 else None,
745
- "thickness": thickness,
746
- "total_thickness": total_thickness,
747
- # ---------------------------------------------------------------------
748
- "lattice_type": lattice_type,
749
- "point_group": point_group,
750
- # "point_group_schoenflies": point_group_schoenflies,
751
- "space_group": space_group,
752
- "space_group_number": space_group_number,
753
- "inversion_symmetry": inversion_symmetry,
754
- "pseudo_type": pseudo_type,
755
- "exchange_correlation_functional": exchange_correlation_functional,
756
- "vdW": vdW,
757
- "non_collinear": non_collinear,
758
- "spin_orbit": spin_orbit,
759
- # "param_a": param,
760
- "a1": a1,
761
- "a2": a2,
762
- "a3": a3,
763
- "module_a1_a2_a3": module_a1_a2_a3,
764
- "angle_a1a2_a1a3_a2a3": angle_a1a2_a1a3_a2a3,
765
- "cell_area": Area_cell,
766
- # "cell_vol": Volume_cell,
767
- # "param_b": fator_rec,
768
- "b1": b1,
769
- "b2": b2,
770
- "b3": b3,
771
- "module_b1_b2_b3": module_b1_b2_b3,
772
- "angle_b1b2_b1b3_b2b3": angle_b1b2_b1b3_b2b3,
773
- "zb_area": Area_ZB,
774
- # "zb_volume": vol_zb,
775
- "direct_coord_ions": coord_ions,
776
- "label_ions": rotulo_ions,
777
- "kpath": kpath,
778
- "kpath_label": kpath_label,
779
- }
780
-
781
-
782
- if (n == 0):
783
- #---------
784
- dados1 = {
785
- "lorbit": lorbit,
786
- "ispin": ispin,
787
- "nk": nk,
788
- "nb": nb,
789
- "ne": ne,
790
- "gap": gap,
791
- "e_vbm": e_vbm,
792
- "e_cbm": e_cbm,
793
- "vbm": vbm,
794
- "cbm": cbm,
795
- "type_gap": type_gap,
796
- "k_vbm": k_vbm,
797
- "k_cbm": k_cbm,
798
- "e_fermi": e_fermi,
799
- "e_vacuum": e_vacuum,
800
- # "work_function": work_function,
801
- "total_energy": total_energy,
802
- "e_per_ion": round(float(total_energy)/ni, 15),
803
- "e_per_area": round(float(total_energy)/float(Area_cell), 15),
804
- "e_binding": e_binding if n_materials > 1 else None,
805
- "e_slide": e_slide if n_materials > 1 else None,
806
- "charge_transfer": charge_transfer if n_materials > 1 else None,
807
- }
808
-
809
-
810
- if (n == 1):
811
- #---------
812
- dados1 = {
813
- "lorbit_SO": lorbit,
814
- "ispin_SO": ispin,
815
- "nk_SO": nk,
816
- "nb_SO": nb,
817
- "ne_SO": ne,
818
- "gap_SO": gap,
819
- "e_vbm_SO": e_vbm,
820
- "e_cbm_SO": e_cbm,
821
- "vbm_SO": vbm,
822
- "cbm_SO": cbm,
823
- "type_gap_SO": type_gap,
824
- "k_vbm_SO": k_vbm,
825
- "k_cbm_SO": k_cbm,
826
- "e_fermi_SO": e_fermi,
827
- "e_vacuum_SO": e_vacuum,
828
- # "work_function_SO": work_function,
829
- "total_energy_SO": total_energy,
830
- "e_per_ion_SO": round(float(total_energy)/ni, 15),
831
- "e_per_area_SO": round(float(total_energy)/float(Area_cell), 15),
832
- "charge_transfer_SO": charge_transfer_SO if n_materials > 1 else None,
833
- }
834
-
835
-
836
- # ==================================================
837
- # Inserting the information into the .json file ====
838
- # ==================================================
839
- with open('output/info.json', 'r') as file: data = json.load(file) # Loading the current contents of the info.json file
840
- data.update(dados0) # Updating the dictionary with new information
841
- with open('output/info.json', 'w') as file: json.dump(data, file, indent=4) # Saving updated content to the info.json file
842
- #----------------------
843
- with open('output/info.json', 'r') as file: data = json.load(file) # Loading the current contents of the info.json file
844
- data.update(dados1) # Updating the dictionary with new information
845
- with open('output/info.json', 'w') as file: json.dump(data, file, indent=4) # Saving updated content to the info.json file
846
-
847
-
848
- #===============================================================
849
- # Updating POSCAR and CONTCAR files ============================
850
- #===============================================================
851
- with open('output/POSCAR', 'r') as file: line = file.readlines()
852
- tline = line[0].split()
853
- #--------------------
854
- replace_line = tline[0] + ' ' + tline[1] + ' '
855
- for i in range(n_materials): replace_line += tline[2 +i] + ' '
856
- replace_line += tline[-1] + '\n'
857
- #------------------------------
858
- line[0] = replace_line
859
- with open('output/POSCAR', 'w') as file: file.writelines(line)
860
- #================================================================
861
- with open('output/CONTCAR', 'r') as file: line = file.readlines()
862
- line[0] = replace_line
863
- with open('output/CONTCAR', 'w') as file: file.writelines(line)
864
- #==============================================================
865
-
866
-
867
- """
868
- # ===============================================
869
- # Opening and reading the .json database ========
870
- # ===============================================
871
- with open('output/info.json', "r") as file_json: date = json.load(file_json)
872
- #------------------------------------------------
873
- print(" ")
874
- print("=========================")
875
- print("Data from info.json file:")
876
- print("=========================")
877
- print(" ")
878
- for chave, valor in date.items(): print(f"{chave}: {valor}")
879
- """
880
-
File without changes
File without changes