From b92018c59766736b1958428c61e6caf56712ad05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Gaspard?= Date: Wed, 17 Feb 2021 13:22:20 +0100 Subject: [PATCH] fixed symmetry --- DOC.md | 4 ++++ crystal_met.py | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DOC.md b/DOC.md index 52efd57..61387a1 100644 --- a/DOC.md +++ b/DOC.md @@ -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 + diff --git a/crystal_met.py b/crystal_met.py index 71d95a2..676e744 100644 --- a/crystal_met.py +++ b/crystal_met.py @@ -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: