3
0
mirror of https://github.com/NehZio/Crystal-MEC synced 2024-09-27 03:51:07 +02:00

fixed symmetry

This commit is contained in:
Léo Gaspard 2021-02-17 13:22:20 +01:00
parent fd72c2fb24
commit b92018c597
2 changed files with 13 additions and 7 deletions

4
DOC.md
View File

@ -104,3 +104,7 @@ Will use an optimization method to set the total charge to 0 by slightly changin
Simili Evjen method to calculate the charge of the atom on the outer shell, note that OPTIMIZATION and EVJEN keywords can not be used together Simili Evjen method to calculate the charge of the atom on the outer shell, note that OPTIMIZATION and EVJEN keywords can not be used together
* SYMMETRY [C2x C2y C2z xOy xOz yOz i]
Symmetry operations in the fragment and bath to be applied to everyhing

View File

@ -431,7 +431,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
if name == atoms[index]: #Check if it is the same atom if name == atoms[index]: #Check if it is the same atom
if distance(t,a) == 0: if distance(t,a) == 0:
print("ERROR : Twice the same atom") print("ERROR : Twice the same atom")
if 'xOz' in operations: if np.abs(a[1]) > da and 'xOz' in operations:
if distance(t,d) <= da: if distance(t,d) <= da:
newCoord.append(d) newCoord.append(d)
newCoord[-1].append(name+'d') newCoord[-1].append(name+'d')
@ -443,7 +443,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index]) print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index])
print("Are you sure about the xOz symmetry operation ?") print("Are you sure about the xOz symmetry operation ?")
break break
if 'yOz' in operations: if np.abs(a[0]) > da and 'yOz' in operations:
if distance(t,b) <= da: if distance(t,b) <= da:
newCoord.append(b) newCoord.append(b)
newCoord[-1].append(name+'b') newCoord[-1].append(name+'b')
@ -455,7 +455,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index]) print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index])
print("Are you sure about the yOz symmetry operation ?") print("Are you sure about the yOz symmetry operation ?")
break break
if 'C2z' in operations: if (np.abs(a[0]) > da and np.abs(a[1]) > da) and 'C2z' in operations:
if distance(t,c) <= da: if distance(t,c) <= da:
newCoord.append(c) newCoord.append(c)
newCoord[-1].append(name+'c') newCoord[-1].append(name+'c')
@ -467,7 +467,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index]) print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index])
print("Are you sure about the C2z symmetry operation ?") print("Are you sure about the C2z symmetry operation ?")
break break
if 'xOy' in operations: if np.abs(a[2]) > da and 'xOy' in operations:
if distance(t,e) <= da: if distance(t,e) <= da:
newCoord.append(e) newCoord.append(e)
newCoord[-1].append(name+'e') newCoord[-1].append(name+'e')
@ -479,7 +479,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index]) print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index])
print("Are you sure about the xOy symmetry operation ?") print("Are you sure about the xOy symmetry operation ?")
break break
if 'C2y' in operations: if (np.abs(a[0]) > da and np.abs(a[2]) > da) and 'C2y' in operations:
if distance(t,f) <= da: if distance(t,f) <= da:
newCoord.append(f) newCoord.append(f)
newCoord[-1].append(name+'f') newCoord[-1].append(name+'f')
@ -491,7 +491,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index]) print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index])
print("Are you sure about the C2y symmetry operation ?") print("Are you sure about the C2y symmetry operation ?")
break break
if 'C2x' in operations: if (np.abs(a[1]) > da and np.abs(a[2]) > da) and 'C2x' in operations:
if distance(t,g) <= da: if distance(t,g) <= da:
newCoord.append(g) newCoord.append(g)
newCoord[-1].append(name+'g') newCoord[-1].append(name+'g')
@ -503,7 +503,7 @@ def symmetry(coord,atoms,charges, operations): #Find symmetry elements in the co
print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index]) print("Error : This atom should not be there",distance(t,d),t,d,a,charges[index])
print("Are you sure about the C2x symmetry operation ?") print("Are you sure about the C2x symmetry operation ?")
break break
if 'i' in operations: if (np.abs(a[0]) > da and np.abs(a[1]) > da and np.abs(a[2]) > da) and 'i' in operations:
if distance(t,h) <= da: if distance(t,h) <= da:
newCoord.append(h) newCoord.append(h)
newCoord[-1].append(name+'h') newCoord[-1].append(name+'h')
@ -836,6 +836,8 @@ def main():
prog += 1 prog += 1
now = datetime.datetime.now() now = datetime.datetime.now()
printProgressBar(start,now,prog,((len(coords)-1)*len(coords))/2,prefix='Calculating nuclear repulsion',length=50) printProgressBar(start,now,prog,((len(coords)-1)*len(coords))/2,prefix='Calculating nuclear repulsion',length=50)
if(distance(coords[i],coords[j])<=da):
print(i,j,coords[i],coords[j])
rep += (coords[i][4]*coords[j][4])/distance(coords[i],coords[j]) rep += (coords[i][4]*coords[j][4])/distance(coords[i],coords[j])
print("Nuclear repulsion after symmetry : %f"%rep) print("Nuclear repulsion after symmetry : %f"%rep)
else: else: