3
0
mirror of https://github.com/NehZio/Crystal-MEC synced 2024-09-20 16:44:12 +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
* 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 distance(t,a) == 0:
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:
newCoord.append(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("Are you sure about the xOz symmetry operation ?")
break
if 'yOz' in operations:
if np.abs(a[0]) > da and 'yOz' in operations:
if distance(t,b) <= da:
newCoord.append(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("Are you sure about the yOz symmetry operation ?")
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:
newCoord.append(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("Are you sure about the C2z symmetry operation ?")
break
if 'xOy' in operations:
if np.abs(a[2]) > da and 'xOy' in operations:
if distance(t,e) <= da:
newCoord.append(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("Are you sure about the xOy symmetry operation ?")
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:
newCoord.append(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("Are you sure about the C2y symmetry operation ?")
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:
newCoord.append(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("Are you sure about the C2x symmetry operation ?")
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:
newCoord.append(h)
newCoord[-1].append(name+'h')
@ -836,6 +836,8 @@ def main():
prog += 1
now = datetime.datetime.now()
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])
print("Nuclear repulsion after symmetry : %f"%rep)
else: