SAMBA-ilum 1.0.0.487__tar.gz → 1.0.0.489__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.487 → samba_ilum-1.0.0.489}/PKG-INFO +1 -1
  2. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/SAMBA_ilum.egg-info/PKG-INFO +1 -1
  3. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/__main__.py +2 -2
  4. samba_ilum-1.0.0.487/samba_ilum/src/HeteroStructure_Generator.py → samba_ilum-1.0.0.489/samba_ilum/src/HeteroStructure_Generator_OLD_2.py +373 -317
  5. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/setup.py +1 -1
  6. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/LICENSE.txt +0 -0
  7. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/README.md +0 -0
  8. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/SAMBA_ilum.egg-info/SOURCES.txt +0 -0
  9. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/SAMBA_ilum.egg-info/dependency_links.txt +0 -0
  10. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/SAMBA_ilum.egg-info/entry_points.txt +0 -0
  11. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/SAMBA_ilum.egg-info/requires.txt +0 -0
  12. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/SAMBA_ilum.egg-info/top_level.txt +0 -0
  13. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/__init__.py +0 -0
  14. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/BZ_2D.py +0 -0
  15. /samba_ilum-1.0.0.487/samba_ilum/src/HeteroStructure_Generator_OLD_2.py → /samba_ilum-1.0.0.489/samba_ilum/src/HeteroStructure_Generator.py +0 -0
  16. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/HeteroStructure_Generator_OLD_1.py +0 -0
  17. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_a-scan +0 -0
  18. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_bader +0 -0
  19. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_bader.SO +0 -0
  20. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_bands +0 -0
  21. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_bands.SO +0 -0
  22. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_dos +0 -0
  23. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_dos.SO +0 -0
  24. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_relax +0 -0
  25. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_scf +0 -0
  26. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_scf.SO +0 -0
  27. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_xy-scan +0 -0
  28. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_xyz-scan +0 -0
  29. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/INCAR_z-scan +0 -0
  30. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/SAMBA_HeteroStructure.input +0 -0
  31. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/SAMBA_WorkFlow.input +0 -0
  32. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.bands +0 -0
  33. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.chgcar +0 -0
  34. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.dos +0 -0
  35. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.location +0 -0
  36. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.locpot +0 -0
  37. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.orbitals +0 -0
  38. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.spin +0 -0
  39. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/INPUTS/vdw_kernel.bindat +0 -0
  40. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/_info_pseudo.py +0 -0
  41. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/a-scan.py +0 -0
  42. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/a-scan_analysis.py +0 -0
  43. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/bader +0 -0
  44. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/bader_poscar.py +0 -0
  45. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/bader_update.py +0 -0
  46. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/charge_transfer.py +0 -0
  47. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/chgsum.pl +0 -0
  48. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/contcar_update.py +0 -0
  49. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/data-base_json.py +0 -0
  50. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/data-base_union.py +0 -0
  51. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/energy_scan.py +0 -0
  52. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/hubbard_correction.py +0 -0
  53. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/job.py +0 -0
  54. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/kpoints.py +0 -0
  55. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/lattice_plot3d.py +0 -0
  56. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/make_files.py +0 -0
  57. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/output.py +0 -0
  58. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/potcar.py +0 -0
  59. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/rotation_axis_check.py +0 -0
  60. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/vdW_DF.py +0 -0
  61. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/xy-scan.py +0 -0
  62. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/xy-scan_analysis.py +0 -0
  63. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/xyz-scan.py +0 -0
  64. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/xyz-scan_analysis.py +0 -0
  65. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/z-scan.py +0 -0
  66. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/samba_ilum/src/z-scan_analysis.py +0 -0
  67. {samba_ilum-1.0.0.487 → samba_ilum-1.0.0.489}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SAMBA_ilum
3
- Version: 1.0.0.487
3
+ Version: 1.0.0.489
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.487
3
+ Version: 1.0.0.489
4
4
  Summary: ...
5
5
  Author: Augusto de Lelis Araujo
6
6
  Author-email: augusto-lelis@outlook.com
@@ -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.487'
19
+ version = '1.0.0.489'
20
20
 
21
21
  print(" ")
22
22
  print("=============================================================")
@@ -125,7 +125,7 @@ if (tarefa == 1):
125
125
  # Checagem da estrutura dos arquivos POSCAR, com relação
126
126
  # ao ângulo de rotação em relação ao eixo-z ============
127
127
  #=======================================================
128
- exec(open(dir_codes + '/rotation_axis_check.py').read())
128
+ # exec(open(dir_codes + '/rotation_axis_check.py').read())
129
129
  #=======================================================
130
130
 
131
131
 
@@ -10,6 +10,7 @@ print("")
10
10
  from pymatgen.io.vasp import Poscar
11
11
  from pymatgen.core import Structure
12
12
  from pymatgen.analysis.structure_matcher import StructureMatcher
13
+ from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
13
14
  #---------------------------------------------------------------
14
15
  import numpy as np
15
16
  import filecmp
@@ -36,9 +37,9 @@ if (crit_area <= 0.0): crit_area = 0.01
36
37
  #--------------------------------------------------
37
38
 
38
39
 
39
- #----------------------------------------------------------------------------------------------------------------------------------------------
40
- # Rotulo temporário para os ions inequivalentes da célula unitária ----------------------------------------------------------------------------
41
- #----------------------------------------------------------------------------------------------------------------------------------------------
40
+ #-----------------------------------------------------------------------------------------------------------------------------------------------
41
+ # Rotulo temporário para os ions inequivalentes da célula unitária -----------------------------------------------------------------------------
42
+ #-----------------------------------------------------------------------------------------------------------------------------------------------
42
43
  letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X', 'Z', 'Y', 'W']
43
44
  alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X', 'Z', 'Y', 'W']
44
45
  #------------------------------------------------------
@@ -82,7 +83,7 @@ for k in range(n_Lattice):
82
83
  A1 = poscar.readline().split(); A1x = float(A1[0])*param; A1y = float(A1[1])*param; A1z = float(A1[2])*param
83
84
  A2 = poscar.readline().split(); A2x = float(A2[0])*param; A2y = float(A2[1])*param; A2z = float(A2[2])*param
84
85
  A3 = poscar.readline().split(); A3x = float(A3[0])*param; A3y = float(A3[1])*param; A3z = float(A3[2])*param
85
- #------------------------------------------------------------------------------------------------------------
86
+ #--------------------------------------------------------------------------------------------------------------
86
87
  A1x0.append(A1x); A1y0.append(A1y); A2x0.append(A2x); A2y0.append(A2y) # Armazenando os vetores A1 e A2 de cada rede
87
88
  #------------------------------------------------------------------------------------------------------------------------
88
89
  if ((A1z != 0.0) or (A2z != 0.0) or (A3x != 0.0) or (A3y != 0.0)):
@@ -114,9 +115,46 @@ for k in range(n_Lattice):
114
115
  #-------------
115
116
 
116
117
 
117
- #-------------------------------------------------------------------------------------------------------------------------------
118
- # Estimando a área de cada supercélula (referente a cada Lattice), capaz de abrir o range de ions [ions_crit_i, ions_crit_f] ---
119
- #-------------------------------------------------------------------------------------------------------------------------------
118
+ #---------------------------------------------------------------------------------------------------------------------------------------
119
+ # Obtendo o menor ângulo de rotação da(s) camada(s) superiores, a fim de ajustar o ângulo de rotação final obtido na heteroestrutura ---
120
+ #---------------------------------------------------------------------------------------------------------------------------------------
121
+ for k in range(n_Lattice):
122
+ #---------------------
123
+ estrutura = Structure.from_file(dir_files + '/' + vLattice[k])
124
+ sga = SpacegroupAnalyzer(estrutura, symprec=1e-3)
125
+ operacoes = sga.get_symmetry_operations()
126
+ angulos_z = []
127
+ #-------------------
128
+ for op in operacoes:
129
+ R = op.rotation_matrix
130
+ if int(round(np.linalg.det(R))) != 1: continue
131
+ #----------------------
132
+ z = np.array([0, 0, 1])
133
+ Rz = R @ z
134
+ #--------------------------------
135
+ if np.allclose(Rz, z, atol=1e-3):
136
+ Rxy = R[:2, :2]
137
+ trace = np.trace(Rxy)
138
+ cos_theta = trace / 2
139
+ cos_theta = np.clip(cos_theta, -1.0, 1.0)
140
+ angle = np.arccos(cos_theta)
141
+ angle_deg = round(np.degrees(angle), 4)
142
+ #-------------------------------------------------------------------------------------
143
+ if 0.1 < angle_deg < 360.0 and angle_deg not in angulos_z: angulos_z.append(angle_deg)
144
+ #--------------------------------------------------------------------------------------------
145
+ if (k == 1):
146
+ if angulos_z: rot_z_2 = min(angulos_z)
147
+ else: rot_z_2 = 0.0
148
+ #-----------------------------------------
149
+ if (k == 2):
150
+ if angulos_z: rot_z_3 = min(angulos_z)
151
+ else: rot_z_3 = 0.0
152
+ #-----------------------------------------
153
+
154
+
155
+ #---------------------------------------------------------------------------------------------------------------------------------
156
+ # Estimando a área de cada supercélula (referente a cada Lattice), capaz de abrigar o range de ions [ions_crit_i, ions_crit_f] ---
157
+ #---------------------------------------------------------------------------------------------------------------------------------
120
158
  for k in range(n_Lattice):
121
159
  #---------------------
122
160
  n_ions = 0
@@ -149,9 +187,7 @@ diret = dir_files + '/' + 'output/'
149
187
  #-----------
150
188
  formula = []
151
189
  id_materials = []
152
- temp_center_x = [0]*3
153
- temp_center_y = [0]*3
154
- #--------------------
190
+ #----------------
155
191
 
156
192
 
157
193
  for k in range(n_Lattice):
@@ -449,9 +485,6 @@ for k in range(n_Lattice):
449
485
  if (dist <= temp_d):
450
486
  temp_d = dist
451
487
  new_center_x = coord_x; new_center_y = coord_y; new_center_z = 0.0
452
- #-------------------------------
453
- temp_center_x[k] = new_center_x
454
- temp_center_y[k] = new_center_y
455
488
  #-------------
456
489
  poscar.close()
457
490
  #-------------
@@ -1038,8 +1071,8 @@ if (n_test == 1):
1038
1071
  #-------------------------------------------------------------------------------------------
1039
1072
  for i in range(passo):
1040
1073
  VTemp = poscar2.readline().split()
1041
- x = float(VTemp[0]) + temp_center_x[k]
1042
- y = float(VTemp[1]) + temp_center_y[k]
1074
+ x = float(VTemp[0])
1075
+ y = float(VTemp[1])
1043
1076
  z = float(VTemp[2])
1044
1077
  l = str(VTemp[4])
1045
1078
 
@@ -1242,7 +1275,15 @@ if (n_test == 1):
1242
1275
  # if (len(angle1) == 5): angle1 = angle1 + '00'
1243
1276
  # if (len(angle1) == 6): angle1 = angle1 + '0'
1244
1277
  #-----------------------------------------------------------------
1245
- angle1 = angle0; angle1 = round(angle1, 4)
1278
+ angle1 = angle0
1279
+ #-----------------------------------------------------------------------
1280
+ # Reduzindo angle1 à menor rotação positiva equivalente por simetria ---
1281
+ #-----------------------------------------------------------------------
1282
+ if rot_z_2 != 0.0:
1283
+ theta_mod = angle1 % rot_z_2
1284
+ angle1 = min(theta_mod, rot_z_2 - theta_mod)
1285
+ #-----------------------------------------------------------------
1286
+ angle1 = round(angle1, 4)
1246
1287
  #=================================================================
1247
1288
  if (n_Lattice == 3):
1248
1289
  angle_V13 = np.arctan2(np.cross(V3, V1), np.dot(V3, V1)) # ângulo em radianos
@@ -1255,7 +1296,15 @@ if (n_test == 1):
1255
1296
  # if (len(angle3) == 5): angle3 = angle3 + '00'
1256
1297
  # if (len(angle3) == 6): angle3 = angle3 + '0'
1257
1298
  #-----------------------------------------------------------------
1258
- angle3 = angle2; angle3 = round(angle3, 4)
1299
+ angle3 = angle2
1300
+ #-----------------------------------------------------------------------
1301
+ # Reduzindo angle3 à menor rotação positiva equivalente por simetria ---
1302
+ #-----------------------------------------------------------------------
1303
+ if rot_z_3 != 0.0:
1304
+ theta_mod = angle3 % rot_z_3
1305
+ angle3 = min(theta_mod, rot_z_3 - theta_mod)
1306
+ #-----------------------------------------------------------------
1307
+ angle3 = round(angle3, 4)
1259
1308
  #====================================================================
1260
1309
  for j in range(3):
1261
1310
  VTemp1 = poscar1.readline().split()
@@ -1273,298 +1322,299 @@ if (n_test == 1):
1273
1322
  if (n_Lattice == 3): poscar3.close()
1274
1323
  #------------------------------------
1275
1324
 
1276
-
1277
- #------------------------------------------------------------------------
1278
- # Escrevendo o arquivo POSCAR das Heteroestruturas: ---------------------
1279
- #------------------------------------------------------------------------
1280
- poscar1 = open(diret + 'Lattice1' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1281
- poscar2 = open(diret + 'Lattice2' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1282
- if (n_Lattice == 3): poscar3 = open(diret + 'Lattice3' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1283
- poscar_new = open(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp', "w")
1284
-
1285
- #-----------------------------------------------------
1286
- ID_Heteroestrutura = formula_bilayer + '_' + unique_id
1287
- #-----------------------------------------------------
1288
-
1289
- #================================================
1290
- VTemp1 = poscar1.readline()
1291
- VTemp2 = poscar2.readline()
1292
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1293
- #================================================
1294
- if (mismatch_type >= 0 and mismatch_type <= 3):
1295
- #--------------------------
1325
+ # if ( ((n_Lattice == 2) and (angle1 >= 0.0)) or ((n_Lattice == 3) and (angle1 >= 0.0) and (angle3 >= 0.0)) ):
1326
+ if ( (n_Lattice == 2) or (n_Lattice == 3) ):
1327
+ #------------------------------------------------------------------------
1328
+ # Escrevendo o arquivo POSCAR das Heteroestruturas: ---------------------
1329
+ #------------------------------------------------------------------------
1330
+ poscar1 = open(diret + 'Lattice1' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1331
+ poscar2 = open(diret + 'Lattice2' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1332
+ if (n_Lattice == 3): poscar3 = open(diret + 'Lattice3' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1333
+ poscar_new = open(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp', "w")
1334
+
1335
+ #-----------------------------------------------------
1336
+ ID_Heteroestrutura = formula_bilayer + '_' + unique_id
1337
+ #-----------------------------------------------------
1338
+
1339
+ #================================================
1296
1340
  VTemp1 = poscar1.readline()
1297
1341
  VTemp2 = poscar2.readline()
1298
1342
  if (n_Lattice == 3): VTemp3 = poscar3.readline()
1299
- #----------------------------
1300
- for j in range(2):
1301
- VTemp1 = poscar1.readline()
1302
- VTemp2 = poscar2.readline()
1303
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1304
-
1305
- #--------------------------------------------------------------------------------------------
1306
- # Obtendo o módulo dos vetores (A,B), Area das Células e o Angulo de Abertura das células ---
1307
- #--------------------------------------------------------------------------------------------
1308
- mod_A1 = np.linalg.norm(A1)
1309
- mod_B1 = np.linalg.norm(B1)
1310
- mod_A2 = np.linalg.norm(A2)
1311
- mod_B2 = np.linalg.norm(B2)
1312
- Area1 = np.linalg.norm(np.cross(A1, B1))
1313
- Area2 = np.linalg.norm(np.cross(A2, B2))
1314
- angle_1 = np.arccos(np.dot(A1,B1)/(mod_A1*mod_B1))
1315
- angle_2 = np.arccos(np.dot(A2,B2)/(mod_A2*mod_B2))
1316
- if (n_Lattice == 3):
1317
- mod_A3 = np.linalg.norm(A3)
1318
- mod_B3 = np.linalg.norm(B3)
1319
- Area3 = np.linalg.norm(np.cross(A3, B3))
1320
- angle_3 = np.arccos(np.dot(A3,B3)/(mod_A3*mod_B3))
1321
-
1322
- #----------------------------------------------------------------------------------------------------------------
1323
- # Alinhando as células das diferemtes redes ---------------------------------------------------------------------
1324
- #----------------------------------------------------------------------------------------------------------------
1325
- theta = angle_V12; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1326
- A2_rotated = np.dot(rotation_matrix, A2)
1327
- B2_rotated = np.dot(rotation_matrix, B2)
1328
- #---------------------------------------
1329
- if (n_Lattice == 3):
1330
- theta = angle_V13; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1331
- A3_rotated = np.dot(rotation_matrix, A3)
1332
- B3_rotated = np.dot(rotation_matrix, B3)
1333
- #-------------------------------------------------------
1334
- # Definindo a célula intermediária ---------------------
1335
- #-------------------------------------------------------
1336
- if (mismatch_type == 0):
1337
- if (n_Lattice == 2):
1338
- A_int = (A1 + A2_rotated)/2
1339
- B_int = (B1 + B2_rotated)/2
1343
+ #================================================
1344
+ if (mismatch_type >= 0 and mismatch_type <= 3):
1345
+ #--------------------------
1346
+ VTemp1 = poscar1.readline()
1347
+ VTemp2 = poscar2.readline()
1348
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1349
+ #----------------------------
1350
+ for j in range(2):
1351
+ VTemp1 = poscar1.readline()
1352
+ VTemp2 = poscar2.readline()
1353
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1354
+
1355
+ #--------------------------------------------------------------------------------------------
1356
+ # Obtendo o módulo dos vetores (A,B), Area das Células e o Angulo de Abertura das células ---
1357
+ #--------------------------------------------------------------------------------------------
1358
+ mod_A1 = np.linalg.norm(A1)
1359
+ mod_B1 = np.linalg.norm(B1)
1360
+ mod_A2 = np.linalg.norm(A2)
1361
+ mod_B2 = np.linalg.norm(B2)
1362
+ Area1 = np.linalg.norm(np.cross(A1, B1))
1363
+ Area2 = np.linalg.norm(np.cross(A2, B2))
1364
+ angle_1 = np.arccos(np.dot(A1,B1)/(mod_A1*mod_B1))
1365
+ angle_2 = np.arccos(np.dot(A2,B2)/(mod_A2*mod_B2))
1340
1366
  if (n_Lattice == 3):
1341
- A_int = (A1 + A2_rotated + A3_rotated)/3
1342
- B_int = (B1 + B2_rotated + B3_rotated)/3
1343
- #---------------------------------------------
1344
- if (mismatch_type == 1):
1345
- A_int = A1
1346
- B_int = B1
1347
- #-----------------------
1348
- if (mismatch_type == 2):
1349
- A_int = A2_rotated
1350
- B_int = B2_rotated
1351
- #-----------------------
1352
- if (mismatch_type == 3):
1353
- A_int = A3_rotated
1354
- B_int = B3_rotated
1355
- #--------------------------------
1356
- mod_A_int = np.linalg.norm(A_int)
1357
- mod_B_int = np.linalg.norm(B_int)
1358
- Area_int = np.linalg.norm(np.cross(A_int, B_int))
1359
- angle_int = np.arctan2(np.cross(A_int,B_int), np.dot(A_int,B_int))
1360
-
1361
- #------------------------------------------------------------------------------------------------------------------------
1362
- # Utilização de vetores temporários (A,B) a fim de estimar a deformação sofrida pelas células originais -----------------
1363
- #------------------------------------------------------------------------------------------------------------------------
1364
- var_A1 = ((mod_A_int -mod_A1)/mod_A1)*100; var_A1 = round(var_A1, 4)
1365
- var_B1 = ((mod_B_int -mod_B1)/mod_B1)*100; var_B1 = round(var_B1, 4)
1366
- var_A2 = ((mod_A_int -mod_A2)/mod_A2)*100; var_A2 = round(var_A2, 4)
1367
- var_B2 = ((mod_B_int -mod_B2)/mod_B2)*100; var_B2 = round(var_B2, 4)
1368
- if (n_Lattice == 3):
1369
- var_A3 = ((mod_A_int -mod_A3)/mod_A3)*100; var_A3 = round(var_A3, 4)
1370
- var_B3 = ((mod_B_int -mod_B3)/mod_B3)*100; var_B3 = round(var_B3, 4)
1371
- #--------------------------------------------------------------------------------
1372
- mm_angle12 = ((angle_2 -angle_1)/angle_1)*100; mm_angle12 = round(mm_angle12, 4)
1373
- mm_angle21 = ((angle_1 -angle_2)/angle_2)*100; mm_angle21 = round(mm_angle21, 4)
1374
- if (n_Lattice == 3):
1375
- mm_angle13 = ((angle_3 -angle_1)/angle_1)*100; mm_angle13 = round(mm_angle13, 4)
1376
- mm_angle31 = ((angle_1 -angle_3)/angle_3)*100; mm_angle31 = round(mm_angle31, 4)
1377
- #-----------------------------------------------------------------------------------
1378
- var_angle1 = ((angle_int -angle_1)/angle_1)*100; var_angle1 = round(var_angle1, 4)
1379
- var_angle2 = ((angle_int -angle_2)/angle_2)*100; var_angle2 = round(var_angle2, 4)
1380
- if (n_Lattice == 3):
1381
- var_angle3 = ((angle_int -angle_3)/angle_3)*100; var_angle3 = round(var_angle3, 4)
1382
- #-------------------------------------------------------------------------------------
1383
- mm_Area12 = ((Area2 -Area1)/Area1)*100; mm_Area12 = round(mm_Area12, 4)
1384
- mm_Area21 = ((Area1 -Area2)/Area2)*100; mm_Area21 = round(mm_Area21, 4)
1385
- if (n_Lattice == 3):
1386
- mm_Area13 = ((Area3 -Area1)/Area1)*100; mm_Area13 = round(mm_Area13, 4)
1387
- mm_Area31 = ((Area1 -Area3)/Area3)*100; mm_Area31 = round(mm_Area31, 4)
1388
- #--------------------------------------------------------------------------
1389
- var_Area1 = ((Area_int -Area1)/Area1)*100; var_Area1 = round(var_Area1, 4)
1390
- var_Area2 = ((Area_int -Area2)/Area2)*100; var_Area2 = round(var_Area2, 4)
1391
- if (n_Lattice == 3):
1392
- var_Area3 = ((Area_int -Area3)/Area3)*100; var_Area3 = round(var_Area3, 4)
1393
- #-----------------------------------------------------------------------------
1394
- if(var_A1 == -0.0): var_A1 = 0.0
1395
- if(var_B1 == -0.0): var_B1 = 0.0
1396
- if(var_A2 == -0.0): var_A2 = 0.0
1397
- if(var_B2 == -0.0): var_B2 = 0.0
1398
- if(var_Area1 == -0.0): var_Area1 = 0.0
1399
- if(var_Area2 == -0.0): var_Area2 = 0.0
1400
- if(mm_Area12 == -0.0): mm_Area12 = 0.0
1401
- if(mm_Area21 == -0.0): mm_Area21 = 0.0
1402
- if(var_angle1 == -0.0): var_angle1 = 0.0
1403
- if(var_angle2 == -0.0): var_angle2 = 0.0
1404
- if(mm_angle12 == -0.0): mm_angle12 = 0.0
1405
- if(mm_angle21 == -0.0): mm_angle21 = 0.0
1406
- if (n_Lattice == 3):
1407
- if(var_A3 == -0.0): var_A3 = 0.0
1408
- if(var_B3 == -0.0): var_B3 = 0.0
1409
- if(var_Area3 == -0.0): var_Area3 = 0.0
1410
- if(mm_Area13 == -0.0): mm_Area13 = 0.0
1411
- if(mm_Area31 == -0.0): mm_Area31 = 0.0
1412
- if(var_angle3 == -0.0): var_angle3 = 0.0
1413
- if(mm_angle13 == -0.0): mm_angle13 = 0.0
1414
- if(mm_angle31 == -0.0): mm_angle31 = 0.0
1415
- #------------------------------------------
1416
-
1417
- #=====================================================
1418
- # Obtenção das Matrizes de Strain para cada rede =====
1419
- #=====================================================
1420
- Lattice_A = [ [A1[0], A1[1]], [B1[0], B1[1]] ]
1421
- Lattice_B = [ [A2_rotated[0], A2_rotated[1]], [B2_rotated[0], B2_rotated[1]] ]
1422
- if (n_Lattice == 3):
1423
- Lattice_C = [ [A3_rotated[0], A3_rotated[1]], [B3_rotated[0], B3_rotated[1]] ]
1424
- Lattice_D = [ [A_int[0], A_int[1]], [B_int[0], B_int[1]] ]
1425
- #---------------------------------------------------------
1426
- I = np.eye(2)
1427
- Lattice_A_inv = np.linalg.inv(Lattice_A)
1428
- F_A = np.dot(Lattice_D, Lattice_A_inv)
1429
- MStrain_A = 0.5 * (np.dot(F_A.T, F_A) - I)
1430
- for aa in range(2):
1431
- for bb in range(2):
1432
- #----------------------------------
1433
- F_A[aa][bb] = round(F_A[aa][bb], 9)
1434
- MStrain_A[aa][bb] = round(MStrain_A[aa][bb], 9)
1435
- #----------------------------------------------
1436
- if (F_A[aa][bb] == -0.0): F_A[aa][bb] = 0.0
1437
- if (MStrain_A[aa][bb] == -0.0): MStrain_A[aa][bb] = 0.0
1438
- #--------------------------------------------------------------
1439
- Lattice_B_inv = np.linalg.inv(Lattice_B)
1440
- F_B = np.dot(Lattice_D, Lattice_B_inv)
1441
- MStrain_B = 0.5 * (np.dot(F_B.T, F_B) - I)
1442
- for aa in range(2):
1443
- for bb in range(2):
1444
- #----------------------------------
1445
- F_B[aa][bb] = round(F_B[aa][bb], 9)
1446
- MStrain_B[aa][bb] = round(MStrain_B[aa][bb], 9)
1447
- #----------------------------------------------
1448
- if (F_B[aa][bb] == -0.0): F_B[aa][bb] = 0.0
1449
- if (MStrain_B[aa][bb] == -0.0): MStrain_B[aa][bb] = 0.0
1450
- #--------------------------------------------------------------
1451
- if (n_Lattice == 3):
1452
- Lattice_C_inv = np.linalg.inv(Lattice_C)
1453
- F_C = np.dot(Lattice_D, Lattice_C_inv)
1454
- MStrain_C = 0.5 * (np.dot(F_C.T, F_C) - I)
1367
+ mod_A3 = np.linalg.norm(A3)
1368
+ mod_B3 = np.linalg.norm(B3)
1369
+ Area3 = np.linalg.norm(np.cross(A3, B3))
1370
+ angle_3 = np.arccos(np.dot(A3,B3)/(mod_A3*mod_B3))
1371
+
1372
+ #----------------------------------------------------------------------------------------------------------------
1373
+ # Alinhando as células das diferemtes redes ---------------------------------------------------------------------
1374
+ #----------------------------------------------------------------------------------------------------------------
1375
+ theta = angle_V12; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1376
+ A2_rotated = np.dot(rotation_matrix, A2)
1377
+ B2_rotated = np.dot(rotation_matrix, B2)
1378
+ #---------------------------------------
1379
+ if (n_Lattice == 3):
1380
+ theta = angle_V13; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1381
+ A3_rotated = np.dot(rotation_matrix, A3)
1382
+ B3_rotated = np.dot(rotation_matrix, B3)
1383
+ #-------------------------------------------------------
1384
+ # Definindo a célula intermediária ---------------------
1385
+ #-------------------------------------------------------
1386
+ if (mismatch_type == 0):
1387
+ if (n_Lattice == 2):
1388
+ A_int = (A1 + A2_rotated)/2
1389
+ B_int = (B1 + B2_rotated)/2
1390
+ if (n_Lattice == 3):
1391
+ A_int = (A1 + A2_rotated + A3_rotated)/3
1392
+ B_int = (B1 + B2_rotated + B3_rotated)/3
1393
+ #---------------------------------------------
1394
+ if (mismatch_type == 1):
1395
+ A_int = A1
1396
+ B_int = B1
1397
+ #-----------------------
1398
+ if (mismatch_type == 2):
1399
+ A_int = A2_rotated
1400
+ B_int = B2_rotated
1401
+ #-----------------------
1402
+ if (mismatch_type == 3):
1403
+ A_int = A3_rotated
1404
+ B_int = B3_rotated
1405
+ #--------------------------------
1406
+ mod_A_int = np.linalg.norm(A_int)
1407
+ mod_B_int = np.linalg.norm(B_int)
1408
+ Area_int = np.linalg.norm(np.cross(A_int, B_int))
1409
+ angle_int = np.arctan2(np.cross(A_int,B_int), np.dot(A_int,B_int))
1410
+
1411
+ #------------------------------------------------------------------------------------------------------------------------
1412
+ # Utilização de vetores temporários (A,B) a fim de estimar a deformação sofrida pelas células originais -----------------
1413
+ #------------------------------------------------------------------------------------------------------------------------
1414
+ var_A1 = ((mod_A_int -mod_A1)/mod_A1)*100; var_A1 = round(var_A1, 4)
1415
+ var_B1 = ((mod_B_int -mod_B1)/mod_B1)*100; var_B1 = round(var_B1, 4)
1416
+ var_A2 = ((mod_A_int -mod_A2)/mod_A2)*100; var_A2 = round(var_A2, 4)
1417
+ var_B2 = ((mod_B_int -mod_B2)/mod_B2)*100; var_B2 = round(var_B2, 4)
1418
+ if (n_Lattice == 3):
1419
+ var_A3 = ((mod_A_int -mod_A3)/mod_A3)*100; var_A3 = round(var_A3, 4)
1420
+ var_B3 = ((mod_B_int -mod_B3)/mod_B3)*100; var_B3 = round(var_B3, 4)
1421
+ #--------------------------------------------------------------------------------
1422
+ mm_angle12 = ((angle_2 -angle_1)/angle_1)*100; mm_angle12 = round(mm_angle12, 4)
1423
+ mm_angle21 = ((angle_1 -angle_2)/angle_2)*100; mm_angle21 = round(mm_angle21, 4)
1424
+ if (n_Lattice == 3):
1425
+ mm_angle13 = ((angle_3 -angle_1)/angle_1)*100; mm_angle13 = round(mm_angle13, 4)
1426
+ mm_angle31 = ((angle_1 -angle_3)/angle_3)*100; mm_angle31 = round(mm_angle31, 4)
1427
+ #-----------------------------------------------------------------------------------
1428
+ var_angle1 = ((angle_int -angle_1)/angle_1)*100; var_angle1 = round(var_angle1, 4)
1429
+ var_angle2 = ((angle_int -angle_2)/angle_2)*100; var_angle2 = round(var_angle2, 4)
1430
+ if (n_Lattice == 3):
1431
+ var_angle3 = ((angle_int -angle_3)/angle_3)*100; var_angle3 = round(var_angle3, 4)
1432
+ #-------------------------------------------------------------------------------------
1433
+ mm_Area12 = ((Area2 -Area1)/Area1)*100; mm_Area12 = round(mm_Area12, 4)
1434
+ mm_Area21 = ((Area1 -Area2)/Area2)*100; mm_Area21 = round(mm_Area21, 4)
1435
+ if (n_Lattice == 3):
1436
+ mm_Area13 = ((Area3 -Area1)/Area1)*100; mm_Area13 = round(mm_Area13, 4)
1437
+ mm_Area31 = ((Area1 -Area3)/Area3)*100; mm_Area31 = round(mm_Area31, 4)
1438
+ #--------------------------------------------------------------------------
1439
+ var_Area1 = ((Area_int -Area1)/Area1)*100; var_Area1 = round(var_Area1, 4)
1440
+ var_Area2 = ((Area_int -Area2)/Area2)*100; var_Area2 = round(var_Area2, 4)
1441
+ if (n_Lattice == 3):
1442
+ var_Area3 = ((Area_int -Area3)/Area3)*100; var_Area3 = round(var_Area3, 4)
1443
+ #-----------------------------------------------------------------------------
1444
+ if(var_A1 == -0.0): var_A1 = 0.0
1445
+ if(var_B1 == -0.0): var_B1 = 0.0
1446
+ if(var_A2 == -0.0): var_A2 = 0.0
1447
+ if(var_B2 == -0.0): var_B2 = 0.0
1448
+ if(var_Area1 == -0.0): var_Area1 = 0.0
1449
+ if(var_Area2 == -0.0): var_Area2 = 0.0
1450
+ if(mm_Area12 == -0.0): mm_Area12 = 0.0
1451
+ if(mm_Area21 == -0.0): mm_Area21 = 0.0
1452
+ if(var_angle1 == -0.0): var_angle1 = 0.0
1453
+ if(var_angle2 == -0.0): var_angle2 = 0.0
1454
+ if(mm_angle12 == -0.0): mm_angle12 = 0.0
1455
+ if(mm_angle21 == -0.0): mm_angle21 = 0.0
1456
+ if (n_Lattice == 3):
1457
+ if(var_A3 == -0.0): var_A3 = 0.0
1458
+ if(var_B3 == -0.0): var_B3 = 0.0
1459
+ if(var_Area3 == -0.0): var_Area3 = 0.0
1460
+ if(mm_Area13 == -0.0): mm_Area13 = 0.0
1461
+ if(mm_Area31 == -0.0): mm_Area31 = 0.0
1462
+ if(var_angle3 == -0.0): var_angle3 = 0.0
1463
+ if(mm_angle13 == -0.0): mm_angle13 = 0.0
1464
+ if(mm_angle31 == -0.0): mm_angle31 = 0.0
1465
+ #------------------------------------------
1466
+
1467
+ #=====================================================
1468
+ # Obtenção das Matrizes de Strain para cada rede =====
1469
+ #=====================================================
1470
+ Lattice_A = [ [A1[0], A1[1]], [B1[0], B1[1]] ]
1471
+ Lattice_B = [ [A2_rotated[0], A2_rotated[1]], [B2_rotated[0], B2_rotated[1]] ]
1472
+ if (n_Lattice == 3):
1473
+ Lattice_C = [ [A3_rotated[0], A3_rotated[1]], [B3_rotated[0], B3_rotated[1]] ]
1474
+ Lattice_D = [ [A_int[0], A_int[1]], [B_int[0], B_int[1]] ]
1475
+ #---------------------------------------------------------
1476
+ I = np.eye(2)
1477
+ Lattice_A_inv = np.linalg.inv(Lattice_A)
1478
+ F_A = np.dot(Lattice_D, Lattice_A_inv)
1479
+ MStrain_A = 0.5 * (np.dot(F_A.T, F_A) - I)
1455
1480
  for aa in range(2):
1456
1481
  for bb in range(2):
1457
1482
  #----------------------------------
1458
- F_C[aa][bb] = round(F_C[aa][bb], 9)
1459
- MStrain_C[aa][bb] = round(MStrain_C[aa][bb], 9)
1483
+ F_A[aa][bb] = round(F_A[aa][bb], 9)
1484
+ MStrain_A[aa][bb] = round(MStrain_A[aa][bb], 9)
1460
1485
  #----------------------------------------------
1461
- if (F_C[aa][bb] == -0.0): F_C[aa][bb] = 0.0
1462
- if (MStrain_C[aa][bb] == -0.0): MStrain_C[aa][bb] = 0.0
1463
-
1464
-
1465
- poscar_new.write(f'SAMBA {label_htstructure} {nions_1} {nions_2}')
1466
- if (n_Lattice == 3): poscar_new.write(f' {nions_3}')
1467
- #---------------------------------------------------
1468
- if (n_Lattice == 2):
1469
- poscar_new.write(f' | mismatch_areas_12_21 = {mm_Area12}_{mm_Area21}')
1470
- poscar_new.write(f' | var_areas = {var_Area1}_{var_Area2}')
1471
- poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}')
1472
- poscar_new.write(f' | mismatch_angles_12_21 = {mm_angle12}_{mm_angle21}')
1473
- poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}')
1474
- poscar_new.write(f' | rotation_angle = {angle1}')
1475
- if (n_Lattice == 3):
1476
- poscar_new.write(f' | mismatch_Areas_12_21_13_31 = {mm_Area12}_{mm_Area21}_{mm_Area13}_{mm_Area31}')
1477
- poscar_new.write(f' | var_Areas = {var_Area1}_{var_Area2}_{var_Area3}')
1478
- poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}_{var_A3}_{var_B3}')
1479
- poscar_new.write(f' | mismatch_angles_12_21_13_31 = {mm_angle12}_{mm_angle21}_{mm_angle13}_{mm_angle31}')
1480
- poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}_{var_angle3}')
1481
- poscar_new.write(f' | rotation_angle = {angle1}_{angle3}')
1482
- #------------------------------------------------------------
1483
- poscar_new.write(f' | MSCell_1 = {int(MT1_00[i])}_{int(MT1_01[i])}_{int(MT1_10[i])}_{int(MT1_10[i])}')
1484
- poscar_new.write(f' | MSCell_2 = {int(MT2_00[i])}_{int(MT2_01[i])}_{int(MT2_10[i])}_{int(MT2_10[i])}')
1485
- if (n_Lattice == 3):
1486
- poscar_new.write(f' | MSCell_3 = {int(MT3_00[i])}_{int(MT3_01[i])}_{int(MT3_10[i])}_{int(MT3_10[i])}')
1487
- #----------------------------------------------
1488
- poscar_new.write(f' | MDeform_1 = {float(F_A[0][0])}_{float(F_A[0][1])}_{float(F_A[1][0])}_{float(F_A[1][1])}')
1489
- poscar_new.write(f' | MDeform_2 = {float(F_B[0][0])}_{float(F_B[0][1])}_{float(F_B[1][0])}_{float(F_B[1][1])}')
1490
- if (n_Lattice == 3):
1491
- poscar_new.write(f' | MDeform_3 = {float(F_C[0][0])}_{float(F_C[0][1])}_{float(F_C[1][0])}_{float(F_C[1][1])}')
1492
- #----------------------------------------------
1493
- poscar_new.write(f' | MSTrain_1 = {float(MStrain_A[0][0])}_{float(MStrain_A[0][1])}_{float(MStrain_A[1][0])}_{float(MStrain_A[1][1])}')
1494
- poscar_new.write(f' | MSTrain_2 = {float(MStrain_B[0][0])}_{float(MStrain_B[0][1])}_{float(MStrain_B[1][0])}_{float(MStrain_B[1][1])}')
1495
- if (n_Lattice == 3):
1496
- poscar_new.write(f' | MSTrain_3 = {float(MStrain_C[0][0])}_{float(MStrain_C[0][1])}_{float(MStrain_C[1][0])}_{float(MStrain_C[1][1])}')
1497
- #--------------------------------------------
1498
- if (n_Lattice == 2):
1499
- poscar_new.write(f' | Shift_plane = 0.0_0.0')
1500
- if (n_Lattice == 3):
1501
- poscar_new.write(f' | Shift_plane = 0.0_0.0_0.0_0.0')
1502
- #----------------------------------------------
1503
- poscar_new.write(f' | {ID_Heteroestrutura} \n')
1504
- #----------------------------------------------
1505
- poscar_new.write(f'1.0 \n')
1506
- poscar_new.write(f'{A_int[0]} {A_int[1]} 0.0 \n')
1507
- poscar_new.write(f'{B_int[0]} {B_int[1]} 0.0 \n')
1486
+ if (F_A[aa][bb] == -0.0): F_A[aa][bb] = 0.0
1487
+ if (MStrain_A[aa][bb] == -0.0): MStrain_A[aa][bb] = 0.0
1488
+ #--------------------------------------------------------------
1489
+ Lattice_B_inv = np.linalg.inv(Lattice_B)
1490
+ F_B = np.dot(Lattice_D, Lattice_B_inv)
1491
+ MStrain_B = 0.5 * (np.dot(F_B.T, F_B) - I)
1492
+ for aa in range(2):
1493
+ for bb in range(2):
1494
+ #----------------------------------
1495
+ F_B[aa][bb] = round(F_B[aa][bb], 9)
1496
+ MStrain_B[aa][bb] = round(MStrain_B[aa][bb], 9)
1497
+ #----------------------------------------------
1498
+ if (F_B[aa][bb] == -0.0): F_B[aa][bb] = 0.0
1499
+ if (MStrain_B[aa][bb] == -0.0): MStrain_B[aa][bb] = 0.0
1500
+ #--------------------------------------------------------------
1501
+ if (n_Lattice == 3):
1502
+ Lattice_C_inv = np.linalg.inv(Lattice_C)
1503
+ F_C = np.dot(Lattice_D, Lattice_C_inv)
1504
+ MStrain_C = 0.5 * (np.dot(F_C.T, F_C) - I)
1505
+ for aa in range(2):
1506
+ for bb in range(2):
1507
+ #----------------------------------
1508
+ F_C[aa][bb] = round(F_C[aa][bb], 9)
1509
+ MStrain_C[aa][bb] = round(MStrain_C[aa][bb], 9)
1510
+ #----------------------------------------------
1511
+ if (F_C[aa][bb] == -0.0): F_C[aa][bb] = 0.0
1512
+ if (MStrain_C[aa][bb] == -0.0): MStrain_C[aa][bb] = 0.0
1513
+
1514
+
1515
+ poscar_new.write(f'SAMBA {label_htstructure} {nions_1} {nions_2}')
1516
+ if (n_Lattice == 3): poscar_new.write(f' {nions_3}')
1517
+ #---------------------------------------------------
1518
+ if (n_Lattice == 2):
1519
+ poscar_new.write(f' | mismatch_areas_12_21 = {mm_Area12}_{mm_Area21}')
1520
+ poscar_new.write(f' | var_areas = {var_Area1}_{var_Area2}')
1521
+ poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}')
1522
+ poscar_new.write(f' | mismatch_angles_12_21 = {mm_angle12}_{mm_angle21}')
1523
+ poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}')
1524
+ poscar_new.write(f' | rotation_angle = {angle1}')
1525
+ if (n_Lattice == 3):
1526
+ poscar_new.write(f' | mismatch_Areas_12_21_13_31 = {mm_Area12}_{mm_Area21}_{mm_Area13}_{mm_Area31}')
1527
+ poscar_new.write(f' | var_Areas = {var_Area1}_{var_Area2}_{var_Area3}')
1528
+ poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}_{var_A3}_{var_B3}')
1529
+ poscar_new.write(f' | mismatch_angles_12_21_13_31 = {mm_angle12}_{mm_angle21}_{mm_angle13}_{mm_angle31}')
1530
+ poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}_{var_angle3}')
1531
+ poscar_new.write(f' | rotation_angle = {angle1}_{angle3}')
1532
+ #------------------------------------------------------------
1533
+ poscar_new.write(f' | MSCell_1 = {int(MT1_00[i])}_{int(MT1_01[i])}_{int(MT1_10[i])}_{int(MT1_10[i])}')
1534
+ poscar_new.write(f' | MSCell_2 = {int(MT2_00[i])}_{int(MT2_01[i])}_{int(MT2_10[i])}_{int(MT2_10[i])}')
1535
+ if (n_Lattice == 3):
1536
+ poscar_new.write(f' | MSCell_3 = {int(MT3_00[i])}_{int(MT3_01[i])}_{int(MT3_10[i])}_{int(MT3_10[i])}')
1537
+ #----------------------------------------------
1538
+ poscar_new.write(f' | MDeform_1 = {float(F_A[0][0])}_{float(F_A[0][1])}_{float(F_A[1][0])}_{float(F_A[1][1])}')
1539
+ poscar_new.write(f' | MDeform_2 = {float(F_B[0][0])}_{float(F_B[0][1])}_{float(F_B[1][0])}_{float(F_B[1][1])}')
1540
+ if (n_Lattice == 3):
1541
+ poscar_new.write(f' | MDeform_3 = {float(F_C[0][0])}_{float(F_C[0][1])}_{float(F_C[1][0])}_{float(F_C[1][1])}')
1542
+ #----------------------------------------------
1543
+ poscar_new.write(f' | MSTrain_1 = {float(MStrain_A[0][0])}_{float(MStrain_A[0][1])}_{float(MStrain_A[1][0])}_{float(MStrain_A[1][1])}')
1544
+ poscar_new.write(f' | MSTrain_2 = {float(MStrain_B[0][0])}_{float(MStrain_B[0][1])}_{float(MStrain_B[1][0])}_{float(MStrain_B[1][1])}')
1545
+ if (n_Lattice == 3):
1546
+ poscar_new.write(f' | MSTrain_3 = {float(MStrain_C[0][0])}_{float(MStrain_C[0][1])}_{float(MStrain_C[1][0])}_{float(MStrain_C[1][1])}')
1547
+ #--------------------------------------------
1548
+ if (n_Lattice == 2):
1549
+ poscar_new.write(f' | Shift_plane = 0.0_0.0')
1550
+ if (n_Lattice == 3):
1551
+ poscar_new.write(f' | Shift_plane = 0.0_0.0_0.0_0.0')
1552
+ #----------------------------------------------
1553
+ poscar_new.write(f' | {ID_Heteroestrutura} \n')
1554
+ #----------------------------------------------
1555
+ poscar_new.write(f'1.0 \n')
1556
+ poscar_new.write(f'{A_int[0]} {A_int[1]} 0.0 \n')
1557
+ poscar_new.write(f'{B_int[0]} {B_int[1]} 0.0 \n')
1558
+
1559
+ VTemp1 = poscar1.readline().split()
1560
+ VTemp2 = poscar2.readline()
1561
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1562
+ poscar_new.write(f'{VTemp1[0]} {VTemp1[1]} {VTemp1[2]} \n')
1508
1563
 
1564
+ #=================================================================
1565
+ VTemp1 = poscar1.readline().split()
1566
+ VTemp2 = poscar2.readline().split()
1567
+ if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1568
+ for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1569
+ for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
1570
+ if (n_Lattice == 3):
1571
+ for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1572
+ poscar_new.write(f' \n')
1573
+ #---------------------------------------------------------------------
1509
1574
  VTemp1 = poscar1.readline().split()
1575
+ VTemp2 = poscar2.readline().split()
1576
+ if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1577
+ for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1578
+ for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
1579
+ if (n_Lattice == 3):
1580
+ for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1581
+ poscar_new.write(f' \n')
1582
+ #---------------------------------------------------------------------
1583
+ VTemp1 = poscar1.readline()
1510
1584
  VTemp2 = poscar2.readline()
1511
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1512
- poscar_new.write(f'{VTemp1[0]} {VTemp1[1]} {VTemp1[2]} \n')
1513
-
1514
- #=================================================================
1515
- VTemp1 = poscar1.readline().split()
1516
- VTemp2 = poscar2.readline().split()
1517
- if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1518
- for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1519
- for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
1520
- if (n_Lattice == 3):
1521
- for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1522
- poscar_new.write(f' \n')
1523
- #---------------------------------------------------------------------
1524
- VTemp1 = poscar1.readline().split()
1525
- VTemp2 = poscar2.readline().split()
1526
- if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1527
- for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1528
- for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
1529
- if (n_Lattice == 3):
1530
- for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1531
- poscar_new.write(f' \n')
1532
- #---------------------------------------------------------------------
1533
- VTemp1 = poscar1.readline()
1534
- VTemp2 = poscar2.readline()
1535
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1536
- poscar_new.write(f'direct \n')
1537
- #-----------------------------
1538
- for j in range(nions_1):
1539
- VTemp1 = poscar1.readline().split()
1540
- Z1 = ((vacuum/2)/d)
1541
- poscar_new.write(f'{float(VTemp1[0])} {float(VTemp1[1])} {Z1 + float(VTemp1[2])} \n')
1542
- for j in range(nions_2):
1543
- VTemp2 = poscar2.readline().split()
1544
- Z2 = Z1 + ((dZ[0] + separacao1)/d)
1545
- poscar_new.write(f'{float(VTemp2[0])} {float(VTemp2[1])} {Z2 + float(VTemp2[2])} \n')
1546
- if (n_Lattice == 3):
1547
- for j in range(nions_3):
1548
- VTemp3 = poscar3.readline().split()
1549
- Z3 = Z2 + ((dZ[1] + separacao2)/d)
1550
- poscar_new.write(f'{float(VTemp3[0])} {float(VTemp3[1])} {Z3 + float(VTemp3[2])} \n')
1551
- #-------------------------------------------------------------------------------------------
1552
- poscar1.close()
1553
- poscar2.close()
1554
- if (n_Lattice == 3): poscar3.close()
1555
- poscar_new.close()
1556
- #-----------------
1585
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1586
+ poscar_new.write(f'direct \n')
1587
+ #-----------------------------
1588
+ for j in range(nions_1):
1589
+ VTemp1 = poscar1.readline().split()
1590
+ Z1 = ((vacuum/2)/d)
1591
+ poscar_new.write(f'{float(VTemp1[0])} {float(VTemp1[1])} {Z1 + float(VTemp1[2])} \n')
1592
+ for j in range(nions_2):
1593
+ VTemp2 = poscar2.readline().split()
1594
+ Z2 = Z1 + ((dZ[0] + separacao1)/d)
1595
+ poscar_new.write(f'{float(VTemp2[0])} {float(VTemp2[1])} {Z2 + float(VTemp2[2])} \n')
1596
+ if (n_Lattice == 3):
1597
+ for j in range(nions_3):
1598
+ VTemp3 = poscar3.readline().split()
1599
+ Z3 = Z2 + ((dZ[1] + separacao2)/d)
1600
+ poscar_new.write(f'{float(VTemp3[0])} {float(VTemp3[1])} {Z3 + float(VTemp3[2])} \n')
1601
+ #-------------------------------------------------------------------------------------------
1602
+ poscar1.close()
1603
+ poscar2.close()
1604
+ if (n_Lattice == 3): poscar3.close()
1605
+ poscar_new.close()
1606
+ #-----------------
1557
1607
 
1558
- #--------------------------------------------------------------
1559
- # Excluindo Heteroestrutura distorcida ------------------------
1560
- #--------------------------------------------------------------
1561
- dist_3 = 0.0
1562
- dist_1 = abs(var_A1 -var_B1)
1563
- dist_2 = abs(var_A2 -var_B2)
1564
- if (n_Lattice == 3): dist_3 = abs(var_A3 -var_B3)
1565
- #----------------------------------------------------------------------------------------------------
1566
- if (dist_1 > crit_distorc_lattice or dist_2 > crit_distorc_lattice or dist_3 > crit_distorc_lattice):
1567
- os.remove(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp')
1608
+ #--------------------------------------------------------------
1609
+ # Excluindo Heteroestrutura distorcida ------------------------
1610
+ #--------------------------------------------------------------
1611
+ dist_3 = 0.0
1612
+ dist_1 = abs(var_A1 -var_B1)
1613
+ dist_2 = abs(var_A2 -var_B2)
1614
+ if (n_Lattice == 3): dist_3 = abs(var_A3 -var_B3)
1615
+ #----------------------------------------------------------------------------------------------------
1616
+ if (dist_1 > crit_distorc_lattice or dist_2 > crit_distorc_lattice or dist_3 > crit_distorc_lattice):
1617
+ os.remove(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp')
1568
1618
 
1569
1619
 
1570
1620
  #=====================================================================
@@ -1750,7 +1800,15 @@ for s in range(len(files0)):
1750
1800
  #-----------------
1751
1801
  if (dAB1 == dAB2):
1752
1802
  cont = 1
1753
- #--------------------------------------------------
1803
+ #--------------------------------------------------------
1804
+ if ( (Angle_AB1 < 0) and (Angle_AB2 > 0) and cont == 1 ):
1805
+ if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1806
+ os.remove(diret2 + files0[s] + '/' + files[i])
1807
+ n_exclusion += 1; cont = 0
1808
+ if ( (Angle_AB1 > 0) and (Angle_AB2 < 0) and cont == 1 ):
1809
+ if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1810
+ os.remove(diret2 + files0[s] + '/' + files[j])
1811
+ n_exclusion += 1; cont = 0
1754
1812
  if (abs(Angle_AB1) < abs(Angle_AB2) and cont == 1):
1755
1813
  if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1756
1814
  os.remove(diret2 + files0[s] + '/' + files[j])
@@ -1759,15 +1817,10 @@ for s in range(len(files0)):
1759
1817
  if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1760
1818
  os.remove(diret2 + files0[s] + '/' + files[i])
1761
1819
  n_exclusion += 1; cont = 0
1762
- if (abs(Angle_AB1) == abs(Angle_AB2) and cont == 1):
1763
- if (Angle_AB1 >= Angle_AB2):
1764
- if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1765
- os.remove(diret2 + files0[s] + '/' + files[j])
1766
- n_exclusion += 1
1767
- if (Angle_AB1 < Angle_AB2):
1768
- if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1769
- os.remove(diret2 + files0[s] + '/' + files[i])
1770
- n_exclusion += 1
1820
+ if (Angle_AB1 == Angle_AB2 and cont == 1):
1821
+ if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1822
+ os.remove(diret2 + files0[s] + '/' + files[j])
1823
+ n_exclusion += 1
1771
1824
 
1772
1825
  #---------------
1773
1826
  n_structures = 0
@@ -1965,7 +2018,15 @@ for i in range(len(files)):
1965
2018
  #-----------------
1966
2019
  if (dAB1 == dAB2):
1967
2020
  cont = 1
1968
- #--------------------------------------------------
2021
+ #--------------------------------------------------------
2022
+ if ( (Angle_AB1 < 0) and (Angle_AB2 > 0) and cont == 1 ):
2023
+ if os.path.exists(diret2 + files[i]):
2024
+ os.remove(diret2 + files[i])
2025
+ n_exclusion += 1; cont = 0
2026
+ if ( (Angle_AB1 > 0) and (Angle_AB2 < 0) and cont == 1 ):
2027
+ if os.path.exists(diret2 + files[j]):
2028
+ os.remove(diret2 + files[j])
2029
+ n_exclusion += 1; cont = 0
1969
2030
  if (abs(Angle_AB1) < abs(Angle_AB2) and cont == 1):
1970
2031
  if os.path.exists(diret2 + files[j]):
1971
2032
  os.remove(diret2 + files[j])
@@ -1974,15 +2035,10 @@ for i in range(len(files)):
1974
2035
  if os.path.exists(diret2 + files[i]):
1975
2036
  os.remove(diret2 + files[i])
1976
2037
  n_exclusion += 1; cont = 0
1977
- if (abs(Angle_AB1) == abs(Angle_AB2) and cont == 1):
1978
- if (Angle_AB1 >= Angle_AB2):
1979
- if os.path.exists(diret2 + files[j]):
1980
- os.remove(diret2 + files[j])
1981
- n_exclusion += 1
1982
- if (Angle_AB1 < Angle_AB2):
1983
- if os.path.exists(diret2 + files[i]):
1984
- os.remove(diret2 + files[i])
1985
- n_exclusion += 1
2038
+ if (Angle_AB1 == Angle_AB2 and cont == 1):
2039
+ if os.path.exists(diret2 + files[j]):
2040
+ os.remove(diret2 + files[j])
2041
+ n_exclusion += 1
1986
2042
 
1987
2043
  #-------------------------
1988
2044
  files = os.listdir(diret2)
@@ -6,7 +6,7 @@ import json
6
6
 
7
7
  setup(
8
8
  name = "SAMBA_ilum",
9
- version = "1.0.0.487",
9
+ version = "1.0.0.489",
10
10
  entry_points={'console_scripts': ['samba_ilum = samba_ilum:main']},
11
11
  description = "...",
12
12
  author = "Augusto de Lelis Araujo",
File without changes
File without changes