SAMBA-ilum 1.0.0.484__tar.gz → 1.0.0.486__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.484 → samba_ilum-1.0.0.486}/PKG-INFO +1 -1
  2. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/SAMBA_ilum.egg-info/PKG-INFO +1 -1
  3. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/__main__.py +1 -1
  4. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/HeteroStructure_Generator.py +330 -427
  5. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/setup.py +1 -1
  6. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/LICENSE.txt +0 -0
  7. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/README.md +0 -0
  8. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/SAMBA_ilum.egg-info/SOURCES.txt +0 -0
  9. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/SAMBA_ilum.egg-info/dependency_links.txt +0 -0
  10. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/SAMBA_ilum.egg-info/entry_points.txt +0 -0
  11. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/SAMBA_ilum.egg-info/requires.txt +0 -0
  12. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/SAMBA_ilum.egg-info/top_level.txt +0 -0
  13. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/__init__.py +0 -0
  14. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/BZ_2D.py +0 -0
  15. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/HeteroStructure_Generator_OLD_1.py +0 -0
  16. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/HeteroStructure_Generator_OLD_2.py +0 -0
  17. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_a-scan +0 -0
  18. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_bader +0 -0
  19. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_bader.SO +0 -0
  20. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_bands +0 -0
  21. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_bands.SO +0 -0
  22. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_dos +0 -0
  23. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_dos.SO +0 -0
  24. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_relax +0 -0
  25. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_scf +0 -0
  26. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_scf.SO +0 -0
  27. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_xy-scan +0 -0
  28. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_xyz-scan +0 -0
  29. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/INCAR_z-scan +0 -0
  30. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/SAMBA_HeteroStructure.input +0 -0
  31. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/SAMBA_WorkFlow.input +0 -0
  32. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.bands +0 -0
  33. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.chgcar +0 -0
  34. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.dos +0 -0
  35. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.location +0 -0
  36. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.locpot +0 -0
  37. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.orbitals +0 -0
  38. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.spin +0 -0
  39. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/INPUTS/vdw_kernel.bindat +0 -0
  40. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/_info_pseudo.py +0 -0
  41. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/a-scan.py +0 -0
  42. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/a-scan_analysis.py +0 -0
  43. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/bader +0 -0
  44. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/bader_poscar.py +0 -0
  45. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/bader_update.py +0 -0
  46. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/charge_transfer.py +0 -0
  47. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/chgsum.pl +0 -0
  48. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/contcar_update.py +0 -0
  49. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/data-base_json.py +0 -0
  50. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/data-base_union.py +0 -0
  51. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/energy_scan.py +0 -0
  52. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/hubbard_correction.py +0 -0
  53. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/job.py +0 -0
  54. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/kpoints.py +0 -0
  55. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/lattice_plot3d.py +0 -0
  56. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/make_files.py +0 -0
  57. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/output.py +0 -0
  58. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/potcar.py +0 -0
  59. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/rotation_axis_check.py +0 -0
  60. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/vdW_DF.py +0 -0
  61. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/xy-scan.py +0 -0
  62. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/xy-scan_analysis.py +0 -0
  63. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/xyz-scan.py +0 -0
  64. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/xyz-scan_analysis.py +0 -0
  65. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/z-scan.py +0 -0
  66. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/samba_ilum/src/z-scan_analysis.py +0 -0
  67. {samba_ilum-1.0.0.484 → samba_ilum-1.0.0.486}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SAMBA_ilum
3
- Version: 1.0.0.484
3
+ Version: 1.0.0.486
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.484
3
+ Version: 1.0.0.486
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.484'
19
+ version = '1.0.0.486'
20
20
 
21
21
  print(" ")
22
22
  print("=============================================================")
@@ -7,19 +7,18 @@ print("==================================")
7
7
  print("")
8
8
 
9
9
 
10
- # from pymatgen.io.vasp import Poscar
11
- # from pymatgen.core import Structure
12
- # from pymatgen.analysis.structure_matcher import StructureMatcher
13
- # from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
10
+ from pymatgen.io.vasp import Poscar
11
+ from pymatgen.core import Structure
12
+ from pymatgen.analysis.structure_matcher import StructureMatcher
14
13
  #---------------------------------------------------------------
15
- # import numpy as np
14
+ import numpy as np
16
15
  import filecmp
17
16
  import hashlib
18
17
  import shutil
19
18
  import math
20
19
  import uuid
21
- # import sys
22
- # import os
20
+ import sys
21
+ import os
23
22
 
24
23
 
25
24
  #---------------------------------------------
@@ -37,9 +36,9 @@ if (crit_area <= 0.0): crit_area = 0.01
37
36
  #--------------------------------------------------
38
37
 
39
38
 
40
- #-----------------------------------------------------------------------------------------------------------------------------------------------
41
- # Rotulo temporário para os ions inequivalentes da célula unitária -----------------------------------------------------------------------------
42
- #-----------------------------------------------------------------------------------------------------------------------------------------------
39
+ #----------------------------------------------------------------------------------------------------------------------------------------------
40
+ # Rotulo temporário para os ions inequivalentes da célula unitária ----------------------------------------------------------------------------
41
+ #----------------------------------------------------------------------------------------------------------------------------------------------
43
42
  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']
44
43
  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']
45
44
  #------------------------------------------------------
@@ -83,7 +82,7 @@ for k in range(n_Lattice):
83
82
  A1 = poscar.readline().split(); A1x = float(A1[0])*param; A1y = float(A1[1])*param; A1z = float(A1[2])*param
84
83
  A2 = poscar.readline().split(); A2x = float(A2[0])*param; A2y = float(A2[1])*param; A2z = float(A2[2])*param
85
84
  A3 = poscar.readline().split(); A3x = float(A3[0])*param; A3y = float(A3[1])*param; A3z = float(A3[2])*param
86
- #--------------------------------------------------------------------------------------------------------------
85
+ #------------------------------------------------------------------------------------------------------------
87
86
  A1x0.append(A1x); A1y0.append(A1y); A2x0.append(A2x); A2y0.append(A2y) # Armazenando os vetores A1 e A2 de cada rede
88
87
  #------------------------------------------------------------------------------------------------------------------------
89
88
  if ((A1z != 0.0) or (A2z != 0.0) or (A3x != 0.0) or (A3y != 0.0)):
@@ -115,45 +114,8 @@ for k in range(n_Lattice):
115
114
  #-------------
116
115
 
117
116
 
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
117
  #-------------------------------------------------------------------------------------------------------------------------------
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] ---
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] ---
157
119
  #-------------------------------------------------------------------------------------------------------------------------------
158
120
  for k in range(n_Lattice):
159
121
  #---------------------
@@ -187,7 +149,9 @@ diret = dir_files + '/' + 'output/'
187
149
  #-----------
188
150
  formula = []
189
151
  id_materials = []
190
- #----------------
152
+ temp_center_x = []*3
153
+ temp_center_y = []*3
154
+ #-------------------
191
155
 
192
156
 
193
157
  for k in range(n_Lattice):
@@ -485,6 +449,9 @@ for k in range(n_Lattice):
485
449
  if (dist <= temp_d):
486
450
  temp_d = dist
487
451
  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
488
455
  #-------------
489
456
  poscar.close()
490
457
  #-------------
@@ -1034,50 +1001,6 @@ if (n_test == 1):
1034
1001
  # Definir a matriz de transformação
1035
1002
  T = np.linalg.inv(np.array([a, b, c]).T)
1036
1003
  #---------------------------------------------
1037
-
1038
-
1039
- #-------------------------------------------------------------------------
1040
- # Obtenção das coordenadas do átomo mais próximo da nova origem ----------
1041
- #-------------------------------------------------------------------------
1042
- poscar1 = open(diret + 'POSCAR_Supercell_' + label + '_cartesian.vasp', "r")
1043
- #-----------------
1044
- for i in range(2): VTemp = poscar1.readline()
1045
- param = float(VTemp)
1046
- #-------------------
1047
- for i in range(3):
1048
- VTemp = poscar1.readline().split(); A = [float(VTemp[0])*param, float(VTemp[1])*param]
1049
- VTemp = poscar1.readline().split(); B = [float(VTemp[0])*param, float(VTemp[1])*param]
1050
- VTemp = poscar1.readline().split()
1051
- #----------------------------------------------------
1052
- for i in range(2): VTemp = poscar1.readline().split()
1053
- passo = 0
1054
- for i in range(len(VTemp)): passo += int(VTemp[i])
1055
- VTemp = poscar1.readline()
1056
- #-------------------------
1057
- if (orig == 0):
1058
- center_x = 0.5*A[0] + 0.5*B[0]
1059
- center_y = 0.5*A[1] + 0.5*B[1]
1060
- if (orig == 1):
1061
- center_x = 0.5*A[0]
1062
- center_y = 0.5*A[1]
1063
- #---------------------
1064
- temp_d = 1000.0
1065
- for i in range(passo):
1066
- VTemp = poscar1.readline().split()
1067
- #------------------------
1068
- coord_x = float(VTemp[0])
1069
- coord_y = float(VTemp[1])
1070
- #------------------------
1071
- dist = ((coord_x -center_x)**2 + (coord_y -center_y)**2)**(0.5)
1072
- if (dist <= temp_d):
1073
- temp_d = dist
1074
- new_center_x = coord_x; new_center_y = coord_y
1075
- #--------------
1076
- poscar1.close()
1077
- #--------------
1078
-
1079
-
1080
- #---------------------------------------------------------------------------
1081
1004
  poscar1 = open(diret + 'POSCAR_Supercell_' + label + '_cartesian.vasp', "r")
1082
1005
  poscar2 = open(diret + 'Coord_Supercell_' + label + '.dat', "r")
1083
1006
  poscar_new = open(temp_dir + '/temp_' + str(j+1) + '.vasp', "w")
@@ -1085,25 +1008,28 @@ if (n_test == 1):
1085
1008
  for i in range(2):
1086
1009
  VTemp = poscar1.readline()
1087
1010
  poscar_new.write(f'{VTemp}')
1088
- #--------------------------------------------
1089
- for i in range(3): VTemp = poscar1.readline()
1090
- #--------------------------------------------
1011
+ #---------------------------------------------
1012
+ for i in range(3):
1013
+ VTemp = poscar1.readline()
1014
+ #---------------------------------------------
1091
1015
  poscar_new.write(f' {x1:>28,.21f} {y1:>28,.21f} {null:>28,.21f} \n')
1092
1016
  poscar_new.write(f' {x2:>28,.21f} {y2:>28,.21f} {null:>28,.21f} \n')
1093
1017
  poscar_new.write(f' {null:>28,.21f} {null:>28,.21f} {d:>28,.21f} \n')
1094
- #--------------------------------------------------------------------
1018
+ #---------------------------------------------
1095
1019
  VTemp = poscar1.readline()
1096
- poscar_new.write(f'{VTemp}')
1097
- #---------------------------
1020
+ poscar_new.write(f'{VTemp}') # poscar_new.write(f'{s_old}')
1021
+ #---------------------------------------------
1098
1022
  passo = 0
1099
1023
  VTemp = poscar1.readline().split()
1100
1024
  for i in range(len(VTemp)):
1101
1025
  passo += int(VTemp[i])
1026
+
1102
1027
  #--------------
1103
1028
  poscar1.close()
1104
1029
  #--------------
1105
1030
 
1106
1031
  #####################################################################
1032
+
1107
1033
  poscar_new.write(f'direct \n')
1108
1034
 
1109
1035
  #----------------------------------------------------------------------------------------------------
@@ -1112,8 +1038,8 @@ if (n_test == 1):
1112
1038
  #-------------------------------------------------------------------------------------------
1113
1039
  for i in range(passo):
1114
1040
  VTemp = poscar2.readline().split()
1115
- x = float(VTemp[0]) + new_center_x
1116
- y = float(VTemp[1]) + new_center_y
1041
+ x = float(VTemp[0]) + temp_center_x[k]
1042
+ y = float(VTemp[1]) + temp_center_y[k]
1117
1043
  z = float(VTemp[2])
1118
1044
  l = str(VTemp[4])
1119
1045
 
@@ -1316,15 +1242,7 @@ if (n_test == 1):
1316
1242
  # if (len(angle1) == 5): angle1 = angle1 + '00'
1317
1243
  # if (len(angle1) == 6): angle1 = angle1 + '0'
1318
1244
  #-----------------------------------------------------------------
1319
- angle1 = angle0
1320
- #-----------------------------------------------------------------------
1321
- # Reduzindo angle1 à menor rotação positiva equivalente por simetria ---
1322
- #-----------------------------------------------------------------------
1323
- if rot_z_2 != 0.0:
1324
- theta_mod = angle1 % rot_z_2
1325
- angle1 = min(theta_mod, rot_z_2 - theta_mod)
1326
- #-----------------------------------------------------------------
1327
- angle1 = round(angle1, 4)
1245
+ angle1 = angle0; angle1 = round(angle1, 4)
1328
1246
  #=================================================================
1329
1247
  if (n_Lattice == 3):
1330
1248
  angle_V13 = np.arctan2(np.cross(V3, V1), np.dot(V3, V1)) # ângulo em radianos
@@ -1337,15 +1255,7 @@ if (n_test == 1):
1337
1255
  # if (len(angle3) == 5): angle3 = angle3 + '00'
1338
1256
  # if (len(angle3) == 6): angle3 = angle3 + '0'
1339
1257
  #-----------------------------------------------------------------
1340
- angle3 = angle2
1341
- #-----------------------------------------------------------------------
1342
- # Reduzindo angle3 à menor rotação positiva equivalente por simetria ---
1343
- #-----------------------------------------------------------------------
1344
- if rot_z_3 != 0.0:
1345
- theta_mod = angle3 % rot_z_3
1346
- angle3 = min(theta_mod, rot_z_3 - theta_mod)
1347
- #-----------------------------------------------------------------
1348
- angle3 = round(angle3, 4)
1258
+ angle3 = angle2; angle3 = round(angle3, 4)
1349
1259
  #====================================================================
1350
1260
  for j in range(3):
1351
1261
  VTemp1 = poscar1.readline().split()
@@ -1363,299 +1273,298 @@ if (n_test == 1):
1363
1273
  if (n_Lattice == 3): poscar3.close()
1364
1274
  #------------------------------------
1365
1275
 
1366
- # if ( ((n_Lattice == 2) and (angle1 >= 0.0)) or ((n_Lattice == 3) and (angle1 >= 0.0) and (angle3 >= 0.0)) ):
1367
- if ( (n_Lattice == 2) or (n_Lattice == 3) ):
1368
- #------------------------------------------------------------------------
1369
- # Escrevendo o arquivo POSCAR das Heteroestruturas: ---------------------
1370
- #------------------------------------------------------------------------
1371
- poscar1 = open(diret + 'Lattice1' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1372
- poscar2 = open(diret + 'Lattice2' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1373
- if (n_Lattice == 3): poscar3 = open(diret + 'Lattice3' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1374
- poscar_new = open(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp', "w")
1375
-
1376
- #-----------------------------------------------------
1377
- ID_Heteroestrutura = formula_bilayer + '_' + unique_id
1378
- #-----------------------------------------------------
1379
-
1380
- #================================================
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
+ #--------------------------
1381
1296
  VTemp1 = poscar1.readline()
1382
1297
  VTemp2 = poscar2.readline()
1383
1298
  if (n_Lattice == 3): VTemp3 = poscar3.readline()
1384
- #================================================
1385
- if (mismatch_type >= 0 and mismatch_type <= 3):
1386
- #--------------------------
1387
- VTemp1 = poscar1.readline()
1388
- VTemp2 = poscar2.readline()
1389
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1390
- #----------------------------
1391
- for j in range(2):
1392
- VTemp1 = poscar1.readline()
1393
- VTemp2 = poscar2.readline()
1394
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1395
-
1396
- #--------------------------------------------------------------------------------------------
1397
- # Obtendo o módulo dos vetores (A,B), Area das Células e o Angulo de Abertura das células ---
1398
- #--------------------------------------------------------------------------------------------
1399
- mod_A1 = np.linalg.norm(A1)
1400
- mod_B1 = np.linalg.norm(B1)
1401
- mod_A2 = np.linalg.norm(A2)
1402
- mod_B2 = np.linalg.norm(B2)
1403
- Area1 = np.linalg.norm(np.cross(A1, B1))
1404
- Area2 = np.linalg.norm(np.cross(A2, B2))
1405
- angle_1 = np.arccos(np.dot(A1,B1)/(mod_A1*mod_B1))
1406
- angle_2 = np.arccos(np.dot(A2,B2)/(mod_A2*mod_B2))
1407
- if (n_Lattice == 3):
1408
- mod_A3 = np.linalg.norm(A3)
1409
- mod_B3 = np.linalg.norm(B3)
1410
- Area3 = np.linalg.norm(np.cross(A3, B3))
1411
- angle_3 = np.arccos(np.dot(A3,B3)/(mod_A3*mod_B3))
1412
-
1413
- #----------------------------------------------------------------------------------------------------------------
1414
- # Alinhando as células das diferemtes redes ---------------------------------------------------------------------
1415
- #----------------------------------------------------------------------------------------------------------------
1416
- theta = angle_V12; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1417
- A2_rotated = np.dot(rotation_matrix, A2)
1418
- B2_rotated = np.dot(rotation_matrix, B2)
1419
- #---------------------------------------
1420
- if (n_Lattice == 3):
1421
- theta = angle_V13; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1422
- A3_rotated = np.dot(rotation_matrix, A3)
1423
- B3_rotated = np.dot(rotation_matrix, B3)
1424
- #-------------------------------------------------------
1425
- # Definindo a célula intermediária ---------------------
1426
- #-------------------------------------------------------
1427
- if (mismatch_type == 0):
1428
- if (n_Lattice == 2):
1429
- A_int = (A1 + A2_rotated)/2
1430
- B_int = (B1 + B2_rotated)/2
1431
- if (n_Lattice == 3):
1432
- A_int = (A1 + A2_rotated + A3_rotated)/3
1433
- B_int = (B1 + B2_rotated + B3_rotated)/3
1434
- #---------------------------------------------
1435
- if (mismatch_type == 1):
1436
- A_int = A1
1437
- B_int = B1
1438
- #-----------------------
1439
- if (mismatch_type == 2):
1440
- A_int = A2_rotated
1441
- B_int = B2_rotated
1442
- #-----------------------
1443
- if (mismatch_type == 3):
1444
- A_int = A3_rotated
1445
- B_int = B3_rotated
1446
- #--------------------------------
1447
- mod_A_int = np.linalg.norm(A_int)
1448
- mod_B_int = np.linalg.norm(B_int)
1449
- Area_int = np.linalg.norm(np.cross(A_int, B_int))
1450
- angle_int = np.arctan2(np.cross(A_int,B_int), np.dot(A_int,B_int))
1451
-
1452
- #------------------------------------------------------------------------------------------------------------------------
1453
- # Utilização de vetores temporários (A,B) a fim de estimar a deformação sofrida pelas células originais -----------------
1454
- #------------------------------------------------------------------------------------------------------------------------
1455
- var_A1 = ((mod_A_int -mod_A1)/mod_A1)*100; var_A1 = round(var_A1, 4)
1456
- var_B1 = ((mod_B_int -mod_B1)/mod_B1)*100; var_B1 = round(var_B1, 4)
1457
- var_A2 = ((mod_A_int -mod_A2)/mod_A2)*100; var_A2 = round(var_A2, 4)
1458
- var_B2 = ((mod_B_int -mod_B2)/mod_B2)*100; var_B2 = round(var_B2, 4)
1459
- if (n_Lattice == 3):
1460
- var_A3 = ((mod_A_int -mod_A3)/mod_A3)*100; var_A3 = round(var_A3, 4)
1461
- var_B3 = ((mod_B_int -mod_B3)/mod_B3)*100; var_B3 = round(var_B3, 4)
1462
- #--------------------------------------------------------------------------------
1463
- mm_angle12 = ((angle_2 -angle_1)/angle_1)*100; mm_angle12 = round(mm_angle12, 4)
1464
- mm_angle21 = ((angle_1 -angle_2)/angle_2)*100; mm_angle21 = round(mm_angle21, 4)
1465
- if (n_Lattice == 3):
1466
- mm_angle13 = ((angle_3 -angle_1)/angle_1)*100; mm_angle13 = round(mm_angle13, 4)
1467
- mm_angle31 = ((angle_1 -angle_3)/angle_3)*100; mm_angle31 = round(mm_angle31, 4)
1468
- #-----------------------------------------------------------------------------------
1469
- var_angle1 = ((angle_int -angle_1)/angle_1)*100; var_angle1 = round(var_angle1, 4)
1470
- var_angle2 = ((angle_int -angle_2)/angle_2)*100; var_angle2 = round(var_angle2, 4)
1471
- if (n_Lattice == 3):
1472
- var_angle3 = ((angle_int -angle_3)/angle_3)*100; var_angle3 = round(var_angle3, 4)
1473
- #-------------------------------------------------------------------------------------
1474
- mm_Area12 = ((Area2 -Area1)/Area1)*100; mm_Area12 = round(mm_Area12, 4)
1475
- mm_Area21 = ((Area1 -Area2)/Area2)*100; mm_Area21 = round(mm_Area21, 4)
1476
- if (n_Lattice == 3):
1477
- mm_Area13 = ((Area3 -Area1)/Area1)*100; mm_Area13 = round(mm_Area13, 4)
1478
- mm_Area31 = ((Area1 -Area3)/Area3)*100; mm_Area31 = round(mm_Area31, 4)
1479
- #--------------------------------------------------------------------------
1480
- var_Area1 = ((Area_int -Area1)/Area1)*100; var_Area1 = round(var_Area1, 4)
1481
- var_Area2 = ((Area_int -Area2)/Area2)*100; var_Area2 = round(var_Area2, 4)
1482
- if (n_Lattice == 3):
1483
- var_Area3 = ((Area_int -Area3)/Area3)*100; var_Area3 = round(var_Area3, 4)
1484
- #-----------------------------------------------------------------------------
1485
- if(var_A1 == -0.0): var_A1 = 0.0
1486
- if(var_B1 == -0.0): var_B1 = 0.0
1487
- if(var_A2 == -0.0): var_A2 = 0.0
1488
- if(var_B2 == -0.0): var_B2 = 0.0
1489
- if(var_Area1 == -0.0): var_Area1 = 0.0
1490
- if(var_Area2 == -0.0): var_Area2 = 0.0
1491
- if(mm_Area12 == -0.0): mm_Area12 = 0.0
1492
- if(mm_Area21 == -0.0): mm_Area21 = 0.0
1493
- if(var_angle1 == -0.0): var_angle1 = 0.0
1494
- if(var_angle2 == -0.0): var_angle2 = 0.0
1495
- if(mm_angle12 == -0.0): mm_angle12 = 0.0
1496
- if(mm_angle21 == -0.0): mm_angle21 = 0.0
1497
- if (n_Lattice == 3):
1498
- if(var_A3 == -0.0): var_A3 = 0.0
1499
- if(var_B3 == -0.0): var_B3 = 0.0
1500
- if(var_Area3 == -0.0): var_Area3 = 0.0
1501
- if(mm_Area13 == -0.0): mm_Area13 = 0.0
1502
- if(mm_Area31 == -0.0): mm_Area31 = 0.0
1503
- if(var_angle3 == -0.0): var_angle3 = 0.0
1504
- if(mm_angle13 == -0.0): mm_angle13 = 0.0
1505
- if(mm_angle31 == -0.0): mm_angle31 = 0.0
1506
- #------------------------------------------
1507
-
1508
- #=====================================================
1509
- # Obtenção das Matrizes de Strain para cada rede =====
1510
- #=====================================================
1511
- Lattice_A = [ [A1[0], A1[1]], [B1[0], B1[1]] ]
1512
- Lattice_B = [ [A2_rotated[0], A2_rotated[1]], [B2_rotated[0], B2_rotated[1]] ]
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
1513
1340
  if (n_Lattice == 3):
1514
- Lattice_C = [ [A3_rotated[0], A3_rotated[1]], [B3_rotated[0], B3_rotated[1]] ]
1515
- Lattice_D = [ [A_int[0], A_int[1]], [B_int[0], B_int[1]] ]
1516
- #---------------------------------------------------------
1517
- I = np.eye(2)
1518
- Lattice_A_inv = np.linalg.inv(Lattice_A)
1519
- F_A = np.dot(Lattice_D, Lattice_A_inv)
1520
- MStrain_A = 0.5 * (np.dot(F_A.T, F_A) - I)
1521
- for aa in range(2):
1522
- for bb in range(2):
1523
- #----------------------------------
1524
- F_A[aa][bb] = round(F_A[aa][bb], 9)
1525
- MStrain_A[aa][bb] = round(MStrain_A[aa][bb], 9)
1526
- #----------------------------------------------
1527
- if (F_A[aa][bb] == -0.0): F_A[aa][bb] = 0.0
1528
- if (MStrain_A[aa][bb] == -0.0): MStrain_A[aa][bb] = 0.0
1529
- #--------------------------------------------------------------
1530
- Lattice_B_inv = np.linalg.inv(Lattice_B)
1531
- F_B = np.dot(Lattice_D, Lattice_B_inv)
1532
- MStrain_B = 0.5 * (np.dot(F_B.T, F_B) - I)
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)
1533
1455
  for aa in range(2):
1534
1456
  for bb in range(2):
1535
1457
  #----------------------------------
1536
- F_B[aa][bb] = round(F_B[aa][bb], 9)
1537
- MStrain_B[aa][bb] = round(MStrain_B[aa][bb], 9)
1458
+ F_C[aa][bb] = round(F_C[aa][bb], 9)
1459
+ MStrain_C[aa][bb] = round(MStrain_C[aa][bb], 9)
1538
1460
  #----------------------------------------------
1539
- if (F_B[aa][bb] == -0.0): F_B[aa][bb] = 0.0
1540
- if (MStrain_B[aa][bb] == -0.0): MStrain_B[aa][bb] = 0.0
1541
- #--------------------------------------------------------------
1542
- if (n_Lattice == 3):
1543
- Lattice_C_inv = np.linalg.inv(Lattice_C)
1544
- F_C = np.dot(Lattice_D, Lattice_C_inv)
1545
- MStrain_C = 0.5 * (np.dot(F_C.T, F_C) - I)
1546
- for aa in range(2):
1547
- for bb in range(2):
1548
- #----------------------------------
1549
- F_C[aa][bb] = round(F_C[aa][bb], 9)
1550
- MStrain_C[aa][bb] = round(MStrain_C[aa][bb], 9)
1551
- #----------------------------------------------
1552
- if (F_C[aa][bb] == -0.0): F_C[aa][bb] = 0.0
1553
- if (MStrain_C[aa][bb] == -0.0): MStrain_C[aa][bb] = 0.0
1554
-
1555
-
1556
- poscar_new.write(f'SAMBA {label_htstructure} {nions_1} {nions_2}')
1557
- if (n_Lattice == 3): poscar_new.write(f' {nions_3}')
1558
- #---------------------------------------------------
1559
- if (n_Lattice == 2):
1560
- poscar_new.write(f' | mismatch_areas_12_21 = {mm_Area12}_{mm_Area21}')
1561
- poscar_new.write(f' | var_areas = {var_Area1}_{var_Area2}')
1562
- poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}')
1563
- poscar_new.write(f' | mismatch_angles_12_21 = {mm_angle12}_{mm_angle21}')
1564
- poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}')
1565
- poscar_new.write(f' | rotation_angle = {angle1}')
1566
- if (n_Lattice == 3):
1567
- poscar_new.write(f' | mismatch_Areas_12_21_13_31 = {mm_Area12}_{mm_Area21}_{mm_Area13}_{mm_Area31}')
1568
- poscar_new.write(f' | var_Areas = {var_Area1}_{var_Area2}_{var_Area3}')
1569
- poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}_{var_A3}_{var_B3}')
1570
- poscar_new.write(f' | mismatch_angles_12_21_13_31 = {mm_angle12}_{mm_angle21}_{mm_angle13}_{mm_angle31}')
1571
- poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}_{var_angle3}')
1572
- poscar_new.write(f' | rotation_angle = {angle1}_{angle3}')
1573
- #------------------------------------------------------------
1574
- poscar_new.write(f' | MSCell_1 = {int(MT1_00[i])}_{int(MT1_01[i])}_{int(MT1_10[i])}_{int(MT1_10[i])}')
1575
- poscar_new.write(f' | MSCell_2 = {int(MT2_00[i])}_{int(MT2_01[i])}_{int(MT2_10[i])}_{int(MT2_10[i])}')
1576
- if (n_Lattice == 3):
1577
- poscar_new.write(f' | MSCell_3 = {int(MT3_00[i])}_{int(MT3_01[i])}_{int(MT3_10[i])}_{int(MT3_10[i])}')
1578
- #----------------------------------------------
1579
- 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])}')
1580
- 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])}')
1581
- if (n_Lattice == 3):
1582
- 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])}')
1583
- #----------------------------------------------
1584
- 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])}')
1585
- 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])}')
1586
- if (n_Lattice == 3):
1587
- 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])}')
1588
- #--------------------------------------------
1589
- if (n_Lattice == 2):
1590
- poscar_new.write(f' | Shift_plane = 0.0_0.0')
1591
- if (n_Lattice == 3):
1592
- poscar_new.write(f' | Shift_plane = 0.0_0.0_0.0_0.0')
1593
- #----------------------------------------------
1594
- poscar_new.write(f' | {ID_Heteroestrutura} \n')
1595
- #----------------------------------------------
1596
- poscar_new.write(f'1.0 \n')
1597
- poscar_new.write(f'{A_int[0]} {A_int[1]} 0.0 \n')
1598
- poscar_new.write(f'{B_int[0]} {B_int[1]} 0.0 \n')
1599
-
1600
- VTemp1 = poscar1.readline().split()
1601
- VTemp2 = poscar2.readline()
1602
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1603
- poscar_new.write(f'{VTemp1[0]} {VTemp1[1]} {VTemp1[2]} \n')
1604
-
1605
- #=================================================================
1606
- VTemp1 = poscar1.readline().split()
1607
- VTemp2 = poscar2.readline().split()
1608
- if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1609
- for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1610
- for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
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}')
1611
1475
  if (n_Lattice == 3):
1612
- for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1613
- poscar_new.write(f' \n')
1614
- #---------------------------------------------------------------------
1615
- VTemp1 = poscar1.readline().split()
1616
- VTemp2 = poscar2.readline().split()
1617
- if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1618
- for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1619
- for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
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])}')
1620
1485
  if (n_Lattice == 3):
1621
- for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1622
- poscar_new.write(f' \n')
1623
- #---------------------------------------------------------------------
1624
- VTemp1 = poscar1.readline()
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')
1508
+
1509
+ VTemp1 = poscar1.readline().split()
1625
1510
  VTemp2 = poscar2.readline()
1626
- if (n_Lattice == 3): VTemp3 = poscar3.readline()
1627
- poscar_new.write(f'direct \n')
1628
- #-----------------------------
1629
- for j in range(nions_1):
1630
- VTemp1 = poscar1.readline().split()
1631
- Z1 = ((vacuum/2)/d)
1632
- poscar_new.write(f'{float(VTemp1[0])} {float(VTemp1[1])} {Z1 + float(VTemp1[2])} \n')
1633
- for j in range(nions_2):
1634
- VTemp2 = poscar2.readline().split()
1635
- Z2 = Z1 + ((dZ[0] + separacao1)/d)
1636
- poscar_new.write(f'{float(VTemp2[0])} {float(VTemp2[1])} {Z2 + float(VTemp2[2])} \n')
1637
- if (n_Lattice == 3):
1638
- for j in range(nions_3):
1639
- VTemp3 = poscar3.readline().split()
1640
- Z3 = Z2 + ((dZ[1] + separacao2)/d)
1641
- poscar_new.write(f'{float(VTemp3[0])} {float(VTemp3[1])} {Z3 + float(VTemp3[2])} \n')
1642
- #-------------------------------------------------------------------------------------------
1643
- poscar1.close()
1644
- poscar2.close()
1645
- if (n_Lattice == 3): poscar3.close()
1646
- poscar_new.close()
1647
- #-----------------
1511
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1512
+ poscar_new.write(f'{VTemp1[0]} {VTemp1[1]} {VTemp1[2]} \n')
1648
1513
 
1649
- #--------------------------------------------------------------
1650
- # Excluindo Heteroestrutura distorcida ------------------------
1651
- #--------------------------------------------------------------
1652
- dist_3 = 0.0
1653
- dist_1 = abs(var_A1 -var_B1)
1654
- dist_2 = abs(var_A2 -var_B2)
1655
- if (n_Lattice == 3): dist_3 = abs(var_A3 -var_B3)
1656
- #----------------------------------------------------------------------------------------------------
1657
- if (dist_1 > crit_distorc_lattice or dist_2 > crit_distorc_lattice or dist_3 > crit_distorc_lattice):
1658
- os.remove(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp')
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
+ #-----------------
1557
+
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')
1659
1568
 
1660
1569
 
1661
1570
  #=====================================================================
@@ -1841,15 +1750,7 @@ for s in range(len(files0)):
1841
1750
  #-----------------
1842
1751
  if (dAB1 == dAB2):
1843
1752
  cont = 1
1844
- #--------------------------------------------------------
1845
- if ( (Angle_AB1 < 0) and (Angle_AB2 > 0) and cont == 1 ):
1846
- if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1847
- os.remove(diret2 + files0[s] + '/' + files[i])
1848
- n_exclusion += 1; cont = 0
1849
- if ( (Angle_AB1 > 0) and (Angle_AB2 < 0) and cont == 1 ):
1850
- if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1851
- os.remove(diret2 + files0[s] + '/' + files[j])
1852
- n_exclusion += 1; cont = 0
1753
+ #--------------------------------------------------
1853
1754
  if (abs(Angle_AB1) < abs(Angle_AB2) and cont == 1):
1854
1755
  if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1855
1756
  os.remove(diret2 + files0[s] + '/' + files[j])
@@ -1858,10 +1759,15 @@ for s in range(len(files0)):
1858
1759
  if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1859
1760
  os.remove(diret2 + files0[s] + '/' + files[i])
1860
1761
  n_exclusion += 1; cont = 0
1861
- if (Angle_AB1 == Angle_AB2 and cont == 1):
1862
- if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1863
- os.remove(diret2 + files0[s] + '/' + files[j])
1864
- n_exclusion += 1
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
1865
1771
 
1866
1772
  #---------------
1867
1773
  n_structures = 0
@@ -2059,15 +1965,7 @@ for i in range(len(files)):
2059
1965
  #-----------------
2060
1966
  if (dAB1 == dAB2):
2061
1967
  cont = 1
2062
- #--------------------------------------------------------
2063
- if ( (Angle_AB1 < 0) and (Angle_AB2 > 0) and cont == 1 ):
2064
- if os.path.exists(diret2 + files[i]):
2065
- os.remove(diret2 + files[i])
2066
- n_exclusion += 1; cont = 0
2067
- if ( (Angle_AB1 > 0) and (Angle_AB2 < 0) and cont == 1 ):
2068
- if os.path.exists(diret2 + files[j]):
2069
- os.remove(diret2 + files[j])
2070
- n_exclusion += 1; cont = 0
1968
+ #--------------------------------------------------
2071
1969
  if (abs(Angle_AB1) < abs(Angle_AB2) and cont == 1):
2072
1970
  if os.path.exists(diret2 + files[j]):
2073
1971
  os.remove(diret2 + files[j])
@@ -2076,10 +1974,15 @@ for i in range(len(files)):
2076
1974
  if os.path.exists(diret2 + files[i]):
2077
1975
  os.remove(diret2 + files[i])
2078
1976
  n_exclusion += 1; cont = 0
2079
- if (Angle_AB1 == Angle_AB2 and cont == 1):
2080
- if os.path.exists(diret2 + files[j]):
2081
- os.remove(diret2 + files[j])
2082
- n_exclusion += 1
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
2083
1986
 
2084
1987
  #-------------------------
2085
1988
  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.484",
9
+ version = "1.0.0.486",
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