SAMBA-ilum 1.0.0.488__tar.gz → 1.0.0.490__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.488 → samba_ilum-1.0.0.490}/PKG-INFO +1 -1
  2. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/SAMBA_ilum.egg-info/PKG-INFO +1 -1
  3. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/__main__.py +1 -1
  4. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/HeteroStructure_Generator.py +397 -337
  5. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/setup.py +1 -1
  6. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/LICENSE.txt +0 -0
  7. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/README.md +0 -0
  8. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/SAMBA_ilum.egg-info/SOURCES.txt +0 -0
  9. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/SAMBA_ilum.egg-info/dependency_links.txt +0 -0
  10. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/SAMBA_ilum.egg-info/entry_points.txt +0 -0
  11. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/SAMBA_ilum.egg-info/requires.txt +0 -0
  12. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/SAMBA_ilum.egg-info/top_level.txt +0 -0
  13. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/__init__.py +0 -0
  14. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/BZ_2D.py +0 -0
  15. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/HeteroStructure_Generator_OLD_1.py +0 -0
  16. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/HeteroStructure_Generator_OLD_2.py +0 -0
  17. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_a-scan +0 -0
  18. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_bader +0 -0
  19. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_bader.SO +0 -0
  20. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_bands +0 -0
  21. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_bands.SO +0 -0
  22. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_dos +0 -0
  23. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_dos.SO +0 -0
  24. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_relax +0 -0
  25. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_scf +0 -0
  26. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_scf.SO +0 -0
  27. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_xy-scan +0 -0
  28. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_xyz-scan +0 -0
  29. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/INCAR_z-scan +0 -0
  30. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/SAMBA_HeteroStructure.input +0 -0
  31. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/SAMBA_WorkFlow.input +0 -0
  32. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.bands +0 -0
  33. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.chgcar +0 -0
  34. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.dos +0 -0
  35. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.location +0 -0
  36. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.locpot +0 -0
  37. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.orbitals +0 -0
  38. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/inputs_VASProcar/input.vasprocar.spin +0 -0
  39. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/INPUTS/vdw_kernel.bindat +0 -0
  40. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/_info_pseudo.py +0 -0
  41. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/a-scan.py +0 -0
  42. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/a-scan_analysis.py +0 -0
  43. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/bader +0 -0
  44. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/bader_poscar.py +0 -0
  45. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/bader_update.py +0 -0
  46. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/charge_transfer.py +0 -0
  47. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/chgsum.pl +0 -0
  48. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/contcar_update.py +0 -0
  49. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/data-base_json.py +0 -0
  50. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/data-base_union.py +0 -0
  51. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/energy_scan.py +0 -0
  52. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/hubbard_correction.py +0 -0
  53. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/job.py +0 -0
  54. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/kpoints.py +0 -0
  55. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/lattice_plot3d.py +0 -0
  56. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/make_files.py +0 -0
  57. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/output.py +0 -0
  58. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/potcar.py +0 -0
  59. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/rotation_axis_check.py +0 -0
  60. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/vdW_DF.py +0 -0
  61. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/xy-scan.py +0 -0
  62. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/xy-scan_analysis.py +0 -0
  63. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/xyz-scan.py +0 -0
  64. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/xyz-scan_analysis.py +0 -0
  65. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/z-scan.py +0 -0
  66. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/samba_ilum/src/z-scan_analysis.py +0 -0
  67. {samba_ilum-1.0.0.488 → samba_ilum-1.0.0.490}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SAMBA_ilum
3
- Version: 1.0.0.488
3
+ Version: 1.0.0.490
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.488
3
+ Version: 1.0.0.490
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.488'
19
+ version = '1.0.0.490'
20
20
 
21
21
  print(" ")
22
22
  print("=============================================================")
@@ -7,18 +7,19 @@ 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
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
13
14
  #---------------------------------------------------------------
14
- import numpy as np
15
+ # import numpy as np
15
16
  import filecmp
16
17
  import hashlib
17
18
  import shutil
18
19
  import math
19
20
  import uuid
20
- import sys
21
- import os
21
+ # import sys
22
+ # import os
22
23
 
23
24
 
24
25
  #---------------------------------------------
@@ -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
  #------------------------------------------------------
@@ -63,7 +64,10 @@ if (mismatch_type < 0 or mismatch_type > 3): mismatch_type = 0
63
64
  fator_n = 1 -(crit_area/100); fator_p = 1 +(crit_area/100)
64
65
  area_unit_cell = [0]*3
65
66
  vector_areas = []
66
- #----------------
67
+ #-----------------
68
+ d_origin_x = [0]*3
69
+ d_origin_y = [0]*3
70
+ #-----------------
67
71
 
68
72
 
69
73
  #---------------------------------------------------
@@ -82,7 +86,7 @@ for k in range(n_Lattice):
82
86
  A1 = poscar.readline().split(); A1x = float(A1[0])*param; A1y = float(A1[1])*param; A1z = float(A1[2])*param
83
87
  A2 = poscar.readline().split(); A2x = float(A2[0])*param; A2y = float(A2[1])*param; A2z = float(A2[2])*param
84
88
  A3 = poscar.readline().split(); A3x = float(A3[0])*param; A3y = float(A3[1])*param; A3z = float(A3[2])*param
85
- #------------------------------------------------------------------------------------------------------------
89
+ #--------------------------------------------------------------------------------------------------------------
86
90
  A1x0.append(A1x); A1y0.append(A1y); A2x0.append(A2x); A2y0.append(A2y) # Armazenando os vetores A1 e A2 de cada rede
87
91
  #------------------------------------------------------------------------------------------------------------------------
88
92
  if ((A1z != 0.0) or (A2z != 0.0) or (A3x != 0.0) or (A3y != 0.0)):
@@ -114,9 +118,46 @@ for k in range(n_Lattice):
114
118
  #-------------
115
119
 
116
120
 
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
- #-------------------------------------------------------------------------------------------------------------------------------
121
+ #---------------------------------------------------------------------------------------------------------------------------------------
122
+ # 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 ---
123
+ #---------------------------------------------------------------------------------------------------------------------------------------
124
+ for k in range(n_Lattice):
125
+ #---------------------
126
+ estrutura = Structure.from_file(dir_files + '/' + vLattice[k])
127
+ sga = SpacegroupAnalyzer(estrutura, symprec=1e-3)
128
+ operacoes = sga.get_symmetry_operations()
129
+ angulos_z = []
130
+ #-------------------
131
+ for op in operacoes:
132
+ R = op.rotation_matrix
133
+ if int(round(np.linalg.det(R))) != 1: continue
134
+ #----------------------
135
+ z = np.array([0, 0, 1])
136
+ Rz = R @ z
137
+ #--------------------------------
138
+ if np.allclose(Rz, z, atol=1e-3):
139
+ Rxy = R[:2, :2]
140
+ trace = np.trace(Rxy)
141
+ cos_theta = trace / 2
142
+ cos_theta = np.clip(cos_theta, -1.0, 1.0)
143
+ angle = np.arccos(cos_theta)
144
+ angle_deg = round(np.degrees(angle), 4)
145
+ #-------------------------------------------------------------------------------------
146
+ if 0.1 < angle_deg < 360.0 and angle_deg not in angulos_z: angulos_z.append(angle_deg)
147
+ #--------------------------------------------------------------------------------------------
148
+ if (k == 1):
149
+ if angulos_z: rot_z_2 = min(angulos_z)
150
+ else: rot_z_2 = 0.0
151
+ #-----------------------------------------
152
+ if (k == 2):
153
+ if angulos_z: rot_z_3 = min(angulos_z)
154
+ else: rot_z_3 = 0.0
155
+ #-----------------------------------------
156
+
157
+
158
+ #---------------------------------------------------------------------------------------------------------------------------------
159
+ # Estimando a área de cada supercélula (referente a cada Lattice), capaz de abrigar o range de ions [ions_crit_i, ions_crit_f] ---
160
+ #---------------------------------------------------------------------------------------------------------------------------------
120
161
  for k in range(n_Lattice):
121
162
  #---------------------
122
163
  n_ions = 0
@@ -149,9 +190,7 @@ diret = dir_files + '/' + 'output/'
149
190
  #-----------
150
191
  formula = []
151
192
  id_materials = []
152
- temp_center_x = [0]*3
153
- temp_center_y = [0]*3
154
- #--------------------
193
+ #----------------
155
194
 
156
195
 
157
196
  for k in range(n_Lattice):
@@ -449,9 +488,9 @@ for k in range(n_Lattice):
449
488
  if (dist <= temp_d):
450
489
  temp_d = dist
451
490
  new_center_x = coord_x; new_center_y = coord_y; new_center_z = 0.0
452
- #-------------------------------------
453
- temp_center_x[k] = (coord_x -center_x)
454
- temp_center_y[k] = (coord_y -center_y)
491
+ #----------------------------------
492
+ d_origin_x[k] = (center_x -coord_x)
493
+ d_origin_y[k] = (center_y -coord_y)
455
494
  #-------------
456
495
  poscar.close()
457
496
  #-------------
@@ -671,9 +710,9 @@ for i in range(len(formula)):
671
710
  if (i < (len(formula) -1)): formula_bilayer += '+'
672
711
 
673
712
 
674
- #===================================================== # ??????????????????????????????????????????????????????????????????????????????????????
675
- # Analisando todos os possíveis casamentos de Rede === # ????????????????? Faz sentido este trecho de script, pq estes arquivos existem apenas
676
- #===================================================== # ????????????????? se uma rede tiver sido grava neles, logo sempre serão > 0
713
+ #=====================================================
714
+ # Analisando todos os possíveis casamentos de Rede ===
715
+ #=====================================================
677
716
  for k in range(n_Lattice):
678
717
  files = os.listdir(diret + 'cells_Lattice' + str(k+1))
679
718
  for s in range(len(files)):
@@ -799,12 +838,12 @@ for s in range(len(files)):
799
838
  Structures.write(f'0.0 0.0 0.0 0.0 \n')
800
839
  #======================================
801
840
  if (n_Lattice == 3):
802
- #====================================================================================================================
803
- Structures.write(f'{A1x[i]:>14,.9f} {A1y[i]:>14,.9f} {dA1[i]} {B1x[i]:>14,.9f} {B1y[i]:>14,.9f} {dB1[i]} {ang1[i]} ')
804
- Structures.write(f'{A2x[j]:>14,.9f} {A2y[j]:>14,.9f} {dA2[j]} {B2x[j]:>14,.9f} {B2y[j]:>14,.9f} {dB2[j]} {ang2[j]} ')
805
- Structures.write(f'{MT1_00[i]} {MT1_01[i]} {MT1_10[i]} {MT1_11[i]} ')
806
- Structures.write(f'{MT2_00[j]} {MT2_01[j]} {MT2_10[j]} {MT2_11[j]} \n')
807
- #======================================================================
841
+ #==================================================================================================================== #?????????????????????????????
842
+ Structures.write(f'{A1x[i]:>14,.9f} {A1y[i]:>14,.9f} {dA1[i]} {B1x[i]:>14,.9f} {B1y[i]:>14,.9f} {dB1[i]} {ang1[i]} ') #?????????????????????????????
843
+ Structures.write(f'{A2x[j]:>14,.9f} {A2y[j]:>14,.9f} {dA2[j]} {B2x[j]:>14,.9f} {B2y[j]:>14,.9f} {dB2[j]} {ang2[j]} ') #?????????????????????????????
844
+ Structures.write(f'{MT1_00[i]} {MT1_01[i]} {MT1_10[i]} {MT1_11[i]} ') #?????????????????????????????
845
+ Structures.write(f'{MT2_00[j]} {MT2_01[j]} {MT2_10[j]} {MT2_11[j]} \n') #?????????????????????????????
846
+ #====================================================================== #?????????????????????????????
808
847
  #-----------------
809
848
  Structures.close()
810
849
  #-----------------
@@ -1009,21 +1048,19 @@ if (n_test == 1):
1009
1048
  VTemp = poscar1.readline()
1010
1049
  poscar_new.write(f'{VTemp}')
1011
1050
  #---------------------------------------------
1012
- for i in range(3):
1013
- VTemp = poscar1.readline()
1051
+ for i in range(3): VTemp = poscar1.readline()
1014
1052
  #---------------------------------------------
1015
1053
  poscar_new.write(f' {x1:>28,.21f} {y1:>28,.21f} {null:>28,.21f} \n')
1016
1054
  poscar_new.write(f' {x2:>28,.21f} {y2:>28,.21f} {null:>28,.21f} \n')
1017
1055
  poscar_new.write(f' {null:>28,.21f} {null:>28,.21f} {d:>28,.21f} \n')
1018
1056
  #---------------------------------------------
1019
1057
  VTemp = poscar1.readline()
1020
- poscar_new.write(f'{VTemp}') # poscar_new.write(f'{s_old}')
1058
+ poscar_new.write(f'{VTemp}')
1021
1059
  #---------------------------------------------
1022
1060
  passo = 0
1023
1061
  VTemp = poscar1.readline().split()
1024
1062
  for i in range(len(VTemp)):
1025
1063
  passo += int(VTemp[i])
1026
-
1027
1064
  #--------------
1028
1065
  poscar1.close()
1029
1066
  #--------------
@@ -1038,8 +1075,8 @@ if (n_test == 1):
1038
1075
  #-------------------------------------------------------------------------------------------
1039
1076
  for i in range(passo):
1040
1077
  VTemp = poscar2.readline().split()
1041
- x = float(VTemp[0]) + temp_center_x[k]
1042
- y = float(VTemp[1]) + temp_center_y[k]
1078
+ x = float(VTemp[0]) + d_origin_x[k]
1079
+ y = float(VTemp[1]) + d_origin_y[k]
1043
1080
  z = float(VTemp[2])
1044
1081
  l = str(VTemp[4])
1045
1082
 
@@ -1242,7 +1279,15 @@ if (n_test == 1):
1242
1279
  # if (len(angle1) == 5): angle1 = angle1 + '00'
1243
1280
  # if (len(angle1) == 6): angle1 = angle1 + '0'
1244
1281
  #-----------------------------------------------------------------
1245
- angle1 = angle0; angle1 = round(angle1, 4)
1282
+ angle1 = angle0
1283
+ #-----------------------------------------------------------------------
1284
+ # Reduzindo angle1 à menor rotação positiva equivalente por simetria ---
1285
+ #-----------------------------------------------------------------------
1286
+ if rot_z_2 != 0.0:
1287
+ theta_mod = angle1 % rot_z_2
1288
+ angle1 = min(theta_mod, rot_z_2 - theta_mod)
1289
+ #-----------------------------------------------------------------
1290
+ angle1 = round(angle1, 4)
1246
1291
  #=================================================================
1247
1292
  if (n_Lattice == 3):
1248
1293
  angle_V13 = np.arctan2(np.cross(V3, V1), np.dot(V3, V1)) # ângulo em radianos
@@ -1255,7 +1300,15 @@ if (n_test == 1):
1255
1300
  # if (len(angle3) == 5): angle3 = angle3 + '00'
1256
1301
  # if (len(angle3) == 6): angle3 = angle3 + '0'
1257
1302
  #-----------------------------------------------------------------
1258
- angle3 = angle2; angle3 = round(angle3, 4)
1303
+ angle3 = angle2
1304
+ #-----------------------------------------------------------------------
1305
+ # Reduzindo angle3 à menor rotação positiva equivalente por simetria ---
1306
+ #-----------------------------------------------------------------------
1307
+ if rot_z_3 != 0.0:
1308
+ theta_mod = angle3 % rot_z_3
1309
+ angle3 = min(theta_mod, rot_z_3 - theta_mod)
1310
+ #-----------------------------------------------------------------
1311
+ angle3 = round(angle3, 4)
1259
1312
  #====================================================================
1260
1313
  for j in range(3):
1261
1314
  VTemp1 = poscar1.readline().split()
@@ -1273,298 +1326,299 @@ if (n_test == 1):
1273
1326
  if (n_Lattice == 3): poscar3.close()
1274
1327
  #------------------------------------
1275
1328
 
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
- #--------------------------
1329
+ # if ( ((n_Lattice == 2) and (angle1 >= 0.0)) or ((n_Lattice == 3) and (angle1 >= 0.0) and (angle3 >= 0.0)) ):
1330
+ if ( (n_Lattice == 2) or (n_Lattice == 3) ):
1331
+ #------------------------------------------------------------------------
1332
+ # Escrevendo o arquivo POSCAR das Heteroestruturas: ---------------------
1333
+ #------------------------------------------------------------------------
1334
+ poscar1 = open(diret + 'Lattice1' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1335
+ poscar2 = open(diret + 'Lattice2' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1336
+ if (n_Lattice == 3): poscar3 = open(diret + 'Lattice3' + '/' + dir_temp_m + '/' + '/POSCAR_' + str(i+1) + '.vasp', "r")
1337
+ poscar_new = open(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp', "w")
1338
+
1339
+ #-----------------------------------------------------
1340
+ ID_Heteroestrutura = formula_bilayer + '_' + unique_id
1341
+ #-----------------------------------------------------
1342
+
1343
+ #================================================
1296
1344
  VTemp1 = poscar1.readline()
1297
1345
  VTemp2 = poscar2.readline()
1298
1346
  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
1347
+ #================================================
1348
+ if (mismatch_type >= 0 and mismatch_type <= 3):
1349
+ #--------------------------
1350
+ VTemp1 = poscar1.readline()
1351
+ VTemp2 = poscar2.readline()
1352
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1353
+ #----------------------------
1354
+ for j in range(2):
1355
+ VTemp1 = poscar1.readline()
1356
+ VTemp2 = poscar2.readline()
1357
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1358
+
1359
+ #--------------------------------------------------------------------------------------------
1360
+ # Obtendo o módulo dos vetores (A,B), Area das Células e o Angulo de Abertura das células ---
1361
+ #--------------------------------------------------------------------------------------------
1362
+ mod_A1 = np.linalg.norm(A1)
1363
+ mod_B1 = np.linalg.norm(B1)
1364
+ mod_A2 = np.linalg.norm(A2)
1365
+ mod_B2 = np.linalg.norm(B2)
1366
+ Area1 = np.linalg.norm(np.cross(A1, B1))
1367
+ Area2 = np.linalg.norm(np.cross(A2, B2))
1368
+ angle_1 = np.arccos(np.dot(A1,B1)/(mod_A1*mod_B1))
1369
+ angle_2 = np.arccos(np.dot(A2,B2)/(mod_A2*mod_B2))
1340
1370
  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)
1371
+ mod_A3 = np.linalg.norm(A3)
1372
+ mod_B3 = np.linalg.norm(B3)
1373
+ Area3 = np.linalg.norm(np.cross(A3, B3))
1374
+ angle_3 = np.arccos(np.dot(A3,B3)/(mod_A3*mod_B3))
1375
+
1376
+ #----------------------------------------------------------------------------------------------------------------
1377
+ # Alinhando as células das diferemtes redes ---------------------------------------------------------------------
1378
+ #----------------------------------------------------------------------------------------------------------------
1379
+ theta = angle_V12; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1380
+ A2_rotated = np.dot(rotation_matrix, A2)
1381
+ B2_rotated = np.dot(rotation_matrix, B2)
1382
+ #---------------------------------------
1383
+ if (n_Lattice == 3):
1384
+ theta = angle_V13; rotation_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]])
1385
+ A3_rotated = np.dot(rotation_matrix, A3)
1386
+ B3_rotated = np.dot(rotation_matrix, B3)
1387
+ #-------------------------------------------------------
1388
+ # Definindo a célula intermediária ---------------------
1389
+ #-------------------------------------------------------
1390
+ if (mismatch_type == 0):
1391
+ if (n_Lattice == 2):
1392
+ A_int = (A1 + A2_rotated)/2
1393
+ B_int = (B1 + B2_rotated)/2
1394
+ if (n_Lattice == 3):
1395
+ A_int = (A1 + A2_rotated + A3_rotated)/3
1396
+ B_int = (B1 + B2_rotated + B3_rotated)/3
1397
+ #---------------------------------------------
1398
+ if (mismatch_type == 1):
1399
+ A_int = A1
1400
+ B_int = B1
1401
+ #-----------------------
1402
+ if (mismatch_type == 2):
1403
+ A_int = A2_rotated
1404
+ B_int = B2_rotated
1405
+ #-----------------------
1406
+ if (mismatch_type == 3):
1407
+ A_int = A3_rotated
1408
+ B_int = B3_rotated
1409
+ #--------------------------------
1410
+ mod_A_int = np.linalg.norm(A_int)
1411
+ mod_B_int = np.linalg.norm(B_int)
1412
+ Area_int = np.linalg.norm(np.cross(A_int, B_int))
1413
+ angle_int = np.arctan2(np.cross(A_int,B_int), np.dot(A_int,B_int))
1414
+
1415
+ #------------------------------------------------------------------------------------------------------------------------
1416
+ # Utilização de vetores temporários (A,B) a fim de estimar a deformação sofrida pelas células originais -----------------
1417
+ #------------------------------------------------------------------------------------------------------------------------
1418
+ var_A1 = ((mod_A_int -mod_A1)/mod_A1)*100; var_A1 = round(var_A1, 4)
1419
+ var_B1 = ((mod_B_int -mod_B1)/mod_B1)*100; var_B1 = round(var_B1, 4)
1420
+ var_A2 = ((mod_A_int -mod_A2)/mod_A2)*100; var_A2 = round(var_A2, 4)
1421
+ var_B2 = ((mod_B_int -mod_B2)/mod_B2)*100; var_B2 = round(var_B2, 4)
1422
+ if (n_Lattice == 3):
1423
+ var_A3 = ((mod_A_int -mod_A3)/mod_A3)*100; var_A3 = round(var_A3, 4)
1424
+ var_B3 = ((mod_B_int -mod_B3)/mod_B3)*100; var_B3 = round(var_B3, 4)
1425
+ #--------------------------------------------------------------------------------
1426
+ mm_angle12 = ((angle_2 -angle_1)/angle_1)*100; mm_angle12 = round(mm_angle12, 4)
1427
+ mm_angle21 = ((angle_1 -angle_2)/angle_2)*100; mm_angle21 = round(mm_angle21, 4)
1428
+ if (n_Lattice == 3):
1429
+ mm_angle13 = ((angle_3 -angle_1)/angle_1)*100; mm_angle13 = round(mm_angle13, 4)
1430
+ mm_angle31 = ((angle_1 -angle_3)/angle_3)*100; mm_angle31 = round(mm_angle31, 4)
1431
+ #-----------------------------------------------------------------------------------
1432
+ var_angle1 = ((angle_int -angle_1)/angle_1)*100; var_angle1 = round(var_angle1, 4)
1433
+ var_angle2 = ((angle_int -angle_2)/angle_2)*100; var_angle2 = round(var_angle2, 4)
1434
+ if (n_Lattice == 3):
1435
+ var_angle3 = ((angle_int -angle_3)/angle_3)*100; var_angle3 = round(var_angle3, 4)
1436
+ #-------------------------------------------------------------------------------------
1437
+ mm_Area12 = ((Area2 -Area1)/Area1)*100; mm_Area12 = round(mm_Area12, 4)
1438
+ mm_Area21 = ((Area1 -Area2)/Area2)*100; mm_Area21 = round(mm_Area21, 4)
1439
+ if (n_Lattice == 3):
1440
+ mm_Area13 = ((Area3 -Area1)/Area1)*100; mm_Area13 = round(mm_Area13, 4)
1441
+ mm_Area31 = ((Area1 -Area3)/Area3)*100; mm_Area31 = round(mm_Area31, 4)
1442
+ #--------------------------------------------------------------------------
1443
+ var_Area1 = ((Area_int -Area1)/Area1)*100; var_Area1 = round(var_Area1, 4)
1444
+ var_Area2 = ((Area_int -Area2)/Area2)*100; var_Area2 = round(var_Area2, 4)
1445
+ if (n_Lattice == 3):
1446
+ var_Area3 = ((Area_int -Area3)/Area3)*100; var_Area3 = round(var_Area3, 4)
1447
+ #-----------------------------------------------------------------------------
1448
+ if(var_A1 == -0.0): var_A1 = 0.0
1449
+ if(var_B1 == -0.0): var_B1 = 0.0
1450
+ if(var_A2 == -0.0): var_A2 = 0.0
1451
+ if(var_B2 == -0.0): var_B2 = 0.0
1452
+ if(var_Area1 == -0.0): var_Area1 = 0.0
1453
+ if(var_Area2 == -0.0): var_Area2 = 0.0
1454
+ if(mm_Area12 == -0.0): mm_Area12 = 0.0
1455
+ if(mm_Area21 == -0.0): mm_Area21 = 0.0
1456
+ if(var_angle1 == -0.0): var_angle1 = 0.0
1457
+ if(var_angle2 == -0.0): var_angle2 = 0.0
1458
+ if(mm_angle12 == -0.0): mm_angle12 = 0.0
1459
+ if(mm_angle21 == -0.0): mm_angle21 = 0.0
1460
+ if (n_Lattice == 3):
1461
+ if(var_A3 == -0.0): var_A3 = 0.0
1462
+ if(var_B3 == -0.0): var_B3 = 0.0
1463
+ if(var_Area3 == -0.0): var_Area3 = 0.0
1464
+ if(mm_Area13 == -0.0): mm_Area13 = 0.0
1465
+ if(mm_Area31 == -0.0): mm_Area31 = 0.0
1466
+ if(var_angle3 == -0.0): var_angle3 = 0.0
1467
+ if(mm_angle13 == -0.0): mm_angle13 = 0.0
1468
+ if(mm_angle31 == -0.0): mm_angle31 = 0.0
1469
+ #------------------------------------------
1470
+
1471
+ #=====================================================
1472
+ # Obtenção das Matrizes de Strain para cada rede =====
1473
+ #=====================================================
1474
+ Lattice_A = [ [A1[0], A1[1]], [B1[0], B1[1]] ]
1475
+ Lattice_B = [ [A2_rotated[0], A2_rotated[1]], [B2_rotated[0], B2_rotated[1]] ]
1476
+ if (n_Lattice == 3):
1477
+ Lattice_C = [ [A3_rotated[0], A3_rotated[1]], [B3_rotated[0], B3_rotated[1]] ]
1478
+ Lattice_D = [ [A_int[0], A_int[1]], [B_int[0], B_int[1]] ]
1479
+ #---------------------------------------------------------
1480
+ I = np.eye(2)
1481
+ Lattice_A_inv = np.linalg.inv(Lattice_A)
1482
+ F_A = np.dot(Lattice_D, Lattice_A_inv)
1483
+ MStrain_A = 0.5 * (np.dot(F_A.T, F_A) - I)
1455
1484
  for aa in range(2):
1456
1485
  for bb in range(2):
1457
1486
  #----------------------------------
1458
- F_C[aa][bb] = round(F_C[aa][bb], 9)
1459
- MStrain_C[aa][bb] = round(MStrain_C[aa][bb], 9)
1487
+ F_A[aa][bb] = round(F_A[aa][bb], 9)
1488
+ MStrain_A[aa][bb] = round(MStrain_A[aa][bb], 9)
1460
1489
  #----------------------------------------------
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')
1490
+ if (F_A[aa][bb] == -0.0): F_A[aa][bb] = 0.0
1491
+ if (MStrain_A[aa][bb] == -0.0): MStrain_A[aa][bb] = 0.0
1492
+ #--------------------------------------------------------------
1493
+ Lattice_B_inv = np.linalg.inv(Lattice_B)
1494
+ F_B = np.dot(Lattice_D, Lattice_B_inv)
1495
+ MStrain_B = 0.5 * (np.dot(F_B.T, F_B) - I)
1496
+ for aa in range(2):
1497
+ for bb in range(2):
1498
+ #----------------------------------
1499
+ F_B[aa][bb] = round(F_B[aa][bb], 9)
1500
+ MStrain_B[aa][bb] = round(MStrain_B[aa][bb], 9)
1501
+ #----------------------------------------------
1502
+ if (F_B[aa][bb] == -0.0): F_B[aa][bb] = 0.0
1503
+ if (MStrain_B[aa][bb] == -0.0): MStrain_B[aa][bb] = 0.0
1504
+ #--------------------------------------------------------------
1505
+ if (n_Lattice == 3):
1506
+ Lattice_C_inv = np.linalg.inv(Lattice_C)
1507
+ F_C = np.dot(Lattice_D, Lattice_C_inv)
1508
+ MStrain_C = 0.5 * (np.dot(F_C.T, F_C) - I)
1509
+ for aa in range(2):
1510
+ for bb in range(2):
1511
+ #----------------------------------
1512
+ F_C[aa][bb] = round(F_C[aa][bb], 9)
1513
+ MStrain_C[aa][bb] = round(MStrain_C[aa][bb], 9)
1514
+ #----------------------------------------------
1515
+ if (F_C[aa][bb] == -0.0): F_C[aa][bb] = 0.0
1516
+ if (MStrain_C[aa][bb] == -0.0): MStrain_C[aa][bb] = 0.0
1517
+
1518
+
1519
+ poscar_new.write(f'SAMBA {label_htstructure} {nions_1} {nions_2}')
1520
+ if (n_Lattice == 3): poscar_new.write(f' {nions_3}')
1521
+ #---------------------------------------------------
1522
+ if (n_Lattice == 2):
1523
+ poscar_new.write(f' | mismatch_areas_12_21 = {mm_Area12}_{mm_Area21}')
1524
+ poscar_new.write(f' | var_areas = {var_Area1}_{var_Area2}')
1525
+ poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}')
1526
+ poscar_new.write(f' | mismatch_angles_12_21 = {mm_angle12}_{mm_angle21}')
1527
+ poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}')
1528
+ poscar_new.write(f' | rotation_angle = {angle1}')
1529
+ if (n_Lattice == 3):
1530
+ poscar_new.write(f' | mismatch_Areas_12_21_13_31 = {mm_Area12}_{mm_Area21}_{mm_Area13}_{mm_Area31}')
1531
+ poscar_new.write(f' | var_Areas = {var_Area1}_{var_Area2}_{var_Area3}')
1532
+ poscar_new.write(f' | var_vectors = {var_A1}_{var_B1}_{var_A2}_{var_B2}_{var_A3}_{var_B3}')
1533
+ poscar_new.write(f' | mismatch_angles_12_21_13_31 = {mm_angle12}_{mm_angle21}_{mm_angle13}_{mm_angle31}')
1534
+ poscar_new.write(f' | var_angles = {var_angle1}_{var_angle2}_{var_angle3}')
1535
+ poscar_new.write(f' | rotation_angle = {angle1}_{angle3}')
1536
+ #------------------------------------------------------------
1537
+ poscar_new.write(f' | MSCell_1 = {int(MT1_00[i])}_{int(MT1_01[i])}_{int(MT1_10[i])}_{int(MT1_10[i])}')
1538
+ poscar_new.write(f' | MSCell_2 = {int(MT2_00[i])}_{int(MT2_01[i])}_{int(MT2_10[i])}_{int(MT2_10[i])}')
1539
+ if (n_Lattice == 3):
1540
+ poscar_new.write(f' | MSCell_3 = {int(MT3_00[i])}_{int(MT3_01[i])}_{int(MT3_10[i])}_{int(MT3_10[i])}')
1541
+ #----------------------------------------------
1542
+ 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])}')
1543
+ 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])}')
1544
+ if (n_Lattice == 3):
1545
+ 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])}')
1546
+ #----------------------------------------------
1547
+ 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])}')
1548
+ 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])}')
1549
+ if (n_Lattice == 3):
1550
+ 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])}')
1551
+ #--------------------------------------------
1552
+ if (n_Lattice == 2):
1553
+ poscar_new.write(f' | Shift_plane = 0.0_0.0')
1554
+ if (n_Lattice == 3):
1555
+ poscar_new.write(f' | Shift_plane = 0.0_0.0_0.0_0.0')
1556
+ #----------------------------------------------
1557
+ poscar_new.write(f' | {ID_Heteroestrutura} \n')
1558
+ #----------------------------------------------
1559
+ poscar_new.write(f'1.0 \n')
1560
+ poscar_new.write(f'{A_int[0]} {A_int[1]} 0.0 \n')
1561
+ poscar_new.write(f'{B_int[0]} {B_int[1]} 0.0 \n')
1562
+
1563
+ VTemp1 = poscar1.readline().split()
1564
+ VTemp2 = poscar2.readline()
1565
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1566
+ poscar_new.write(f'{VTemp1[0]} {VTemp1[1]} {VTemp1[2]} \n')
1508
1567
 
1568
+ #=================================================================
1569
+ VTemp1 = poscar1.readline().split()
1570
+ VTemp2 = poscar2.readline().split()
1571
+ if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1572
+ for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1573
+ for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
1574
+ if (n_Lattice == 3):
1575
+ for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1576
+ poscar_new.write(f' \n')
1577
+ #---------------------------------------------------------------------
1509
1578
  VTemp1 = poscar1.readline().split()
1579
+ VTemp2 = poscar2.readline().split()
1580
+ if (n_Lattice == 3): VTemp3 = poscar3.readline().split()
1581
+ for j in range(len(VTemp1)): poscar_new.write(f'{str(VTemp1[j])} ')
1582
+ for j in range(len(VTemp2)): poscar_new.write(f'{str(VTemp2[j])} ')
1583
+ if (n_Lattice == 3):
1584
+ for j in range(len(VTemp3)): poscar_new.write(f'{str(VTemp3[j])} ')
1585
+ poscar_new.write(f' \n')
1586
+ #---------------------------------------------------------------------
1587
+ VTemp1 = poscar1.readline()
1510
1588
  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
- #-----------------
1589
+ if (n_Lattice == 3): VTemp3 = poscar3.readline()
1590
+ poscar_new.write(f'direct \n')
1591
+ #-----------------------------
1592
+ for j in range(nions_1):
1593
+ VTemp1 = poscar1.readline().split()
1594
+ Z1 = ((vacuum/2)/d)
1595
+ poscar_new.write(f'{float(VTemp1[0])} {float(VTemp1[1])} {Z1 + float(VTemp1[2])} \n')
1596
+ for j in range(nions_2):
1597
+ VTemp2 = poscar2.readline().split()
1598
+ Z2 = Z1 + ((dZ[0] + separacao1)/d)
1599
+ poscar_new.write(f'{float(VTemp2[0])} {float(VTemp2[1])} {Z2 + float(VTemp2[2])} \n')
1600
+ if (n_Lattice == 3):
1601
+ for j in range(nions_3):
1602
+ VTemp3 = poscar3.readline().split()
1603
+ Z3 = Z2 + ((dZ[1] + separacao2)/d)
1604
+ poscar_new.write(f'{float(VTemp3[0])} {float(VTemp3[1])} {Z3 + float(VTemp3[2])} \n')
1605
+ #-------------------------------------------------------------------------------------------
1606
+ poscar1.close()
1607
+ poscar2.close()
1608
+ if (n_Lattice == 3): poscar3.close()
1609
+ poscar_new.close()
1610
+ #-----------------
1557
1611
 
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')
1612
+ #--------------------------------------------------------------
1613
+ # Excluindo Heteroestrutura distorcida ------------------------
1614
+ #--------------------------------------------------------------
1615
+ dist_3 = 0.0
1616
+ dist_1 = abs(var_A1 -var_B1)
1617
+ dist_2 = abs(var_A2 -var_B2)
1618
+ if (n_Lattice == 3): dist_3 = abs(var_A3 -var_B3)
1619
+ #----------------------------------------------------------------------------------------------------
1620
+ if (dist_1 > crit_distorc_lattice or dist_2 > crit_distorc_lattice or dist_3 > crit_distorc_lattice):
1621
+ os.remove(diret2 + dir_temp_m + '/POSCAR_' + str(i+1) + '.vasp')
1568
1622
 
1569
1623
 
1570
1624
  #=====================================================================
@@ -1750,7 +1804,15 @@ for s in range(len(files0)):
1750
1804
  #-----------------
1751
1805
  if (dAB1 == dAB2):
1752
1806
  cont = 1
1753
- #--------------------------------------------------
1807
+ #--------------------------------------------------------
1808
+ if ( (Angle_AB1 < 0) and (Angle_AB2 > 0) and cont == 1 ):
1809
+ if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1810
+ os.remove(diret2 + files0[s] + '/' + files[i])
1811
+ n_exclusion += 1; cont = 0
1812
+ if ( (Angle_AB1 > 0) and (Angle_AB2 < 0) and cont == 1 ):
1813
+ if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1814
+ os.remove(diret2 + files0[s] + '/' + files[j])
1815
+ n_exclusion += 1; cont = 0
1754
1816
  if (abs(Angle_AB1) < abs(Angle_AB2) and cont == 1):
1755
1817
  if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1756
1818
  os.remove(diret2 + files0[s] + '/' + files[j])
@@ -1759,15 +1821,10 @@ for s in range(len(files0)):
1759
1821
  if os.path.exists(diret2 + files0[s] + '/' + files[i]):
1760
1822
  os.remove(diret2 + files0[s] + '/' + files[i])
1761
1823
  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
1824
+ if (Angle_AB1 == Angle_AB2 and cont == 1):
1825
+ if os.path.exists(diret2 + files0[s] + '/' + files[j]):
1826
+ os.remove(diret2 + files0[s] + '/' + files[j])
1827
+ n_exclusion += 1
1771
1828
 
1772
1829
  #---------------
1773
1830
  n_structures = 0
@@ -1965,7 +2022,15 @@ for i in range(len(files)):
1965
2022
  #-----------------
1966
2023
  if (dAB1 == dAB2):
1967
2024
  cont = 1
1968
- #--------------------------------------------------
2025
+ #--------------------------------------------------------
2026
+ if ( (Angle_AB1 < 0) and (Angle_AB2 > 0) and cont == 1 ):
2027
+ if os.path.exists(diret2 + files[i]):
2028
+ os.remove(diret2 + files[i])
2029
+ n_exclusion += 1; cont = 0
2030
+ if ( (Angle_AB1 > 0) and (Angle_AB2 < 0) and cont == 1 ):
2031
+ if os.path.exists(diret2 + files[j]):
2032
+ os.remove(diret2 + files[j])
2033
+ n_exclusion += 1; cont = 0
1969
2034
  if (abs(Angle_AB1) < abs(Angle_AB2) and cont == 1):
1970
2035
  if os.path.exists(diret2 + files[j]):
1971
2036
  os.remove(diret2 + files[j])
@@ -1974,15 +2039,10 @@ for i in range(len(files)):
1974
2039
  if os.path.exists(diret2 + files[i]):
1975
2040
  os.remove(diret2 + files[i])
1976
2041
  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
2042
+ if (Angle_AB1 == Angle_AB2 and cont == 1):
2043
+ if os.path.exists(diret2 + files[j]):
2044
+ os.remove(diret2 + files[j])
2045
+ n_exclusion += 1
1986
2046
 
1987
2047
  #-------------------------
1988
2048
  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.488",
9
+ version = "1.0.0.490",
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