Merge branch 'master' into 'master'

correcting the phase in the CSF information in the gamessfile module

See merge request scemama/resultsFile!2
This commit is contained in:
Anthony Scemama 2022-02-07 08:25:30 +00:00
commit 6ddb0d49ea
1 changed files with 38 additions and 25 deletions

View File

@ -1301,12 +1301,25 @@ class gamessFile(resultsFile.resultsFileX):
mo = []
for i in mostr:
mo.append (int(i))
p_count=0
for j in range ( len(mo) ):
if mo[j] < 0:
for l in range ( j+1, len(mo) ):
if mo[l] > 0:
p_count+=1
# Calculate the phase based on the the number of swaps in the determinant
p_count=0; done = False
while (not done):
swaps = 0
for j in range ( len(mo) -1 ):
if (abs(mo[j]) > abs(mo[j+1])):
tmp = mo[j]
mo[j] = mo[j+1]
mo[j+1] = tmp
swaps += 1
elif (abs(mo[j]) == abs(mo[j+1])):
if (mo[j] < 0):
mo[j] = -mo[j]
mo[j+1] = -mo[j+1]
swaps += 1
if (swaps == 0):
done = True
else:
p_count += swaps
coef = float (buffer[0])*(-1.0)**p_count
tempcsf_a = []
tempcsf_b = []