diff --git a/resultsFile/Modules/gaussianFile.py b/resultsFile/Modules/gaussianFile.py index 5a11426..87b2406 100755 --- a/resultsFile/Modules/gaussianFile.py +++ b/resultsFile/Modules/gaussianFile.py @@ -27,6 +27,7 @@ import resultsFile +from lib import * import struct import re diff --git a/resultsFile/Modules/molproFile.py b/resultsFile/Modules/molproFile.py index c72725d..93f1ca1 100755 --- a/resultsFile/Modules/molproFile.py +++ b/resultsFile/Modules/molproFile.py @@ -27,6 +27,7 @@ import resultsFile +from lib import * import struct import re diff --git a/resultsFile/Modules/wfnFile.py b/resultsFile/Modules/wfnFile.py index 54862a8..79b23c7 100755 --- a/resultsFile/Modules/wfnFile.py +++ b/resultsFile/Modules/wfnFile.py @@ -27,6 +27,7 @@ import resultsFile +from lib import * import sys import struct diff --git a/resultsFile/Modules/xmvbFile.py b/resultsFile/Modules/xmvbFile.py index 058e450..e2cab7d 100755 --- a/resultsFile/Modules/xmvbFile.py +++ b/resultsFile/Modules/xmvbFile.py @@ -27,6 +27,7 @@ import resultsFile +from lib import * import struct import re diff --git a/resultsFile/cython_setup b/resultsFile/cython_setup deleted file mode 100755 index d2575e3..0000000 --- a/resultsFile/cython_setup +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/python -# resultsFile is a library which allows to read output files of quantum -# chemistry codes and write input files. -# Copyright (C) 2007 Anthony SCEMAMA -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Anthony Scemama -# LCPQ - IRSAMC -# Universite Paul Sabatier -# 118, route de Narbonne -# 31062 Toulouse Cedex 4 -# scemama@irsamc.ups-tlse.fr - - - -from distutils.core import setup -from distutils.extension import Extension -from Cython.Distutils import build_ext - - -""" -./cython_setup build_ext --inplace -""" - -ext_modules = [Extension("resultsFile_cython", ["resultsFile_cython.pyx"])] - -import os -setup(name="resultsFile", - version=os.getenv("VERSION","1.0"), - author="Anthony Scemama", - author_email="scemama@irsamc.ups-tlse.fr", - license="gpl-license", - description="Module for I/O on Quantum Chemistry files.", - packages=["resultsFile","resultsFile.lib","resultsFile.Modules"], - cmdclass = {'build_ext': build_ext}, - ext_modules = ext_modules - ) - diff --git a/resultsFile/lib/basis.py b/resultsFile/lib/basis.py index 0676bd7..7bd28ee 100755 --- a/resultsFile/lib/basis.py +++ b/resultsFile/lib/basis.py @@ -142,7 +142,7 @@ def rintgauss(n): if n == 0: return res elif n == 1: return 0. elif n%2 == 1: return 0. - res /= 2.**(n/2) + res /= 2.**(n//2) res *= ddfact2(n-1) return res @@ -227,8 +227,11 @@ def xyz_from_lm(l,m): coef = [] absm = abs(m) nb2 = absm - nb1 = (l-absm)/2 - clmt = [ (-0.25)**t * binom(l,t) * binom(l-t,absm+t) for t in range(nb1+1) ] + nb1 = (l-absm)//2 + clmt = [ (-0.25)**t * + binom(l,t) * + binom(l-t,absm+t) + for t in range(nb1+1) ] mod_absm_2 = absm % 2 if m>=0: nb2_start = mod_absm_2 @@ -239,7 +242,7 @@ def xyz_from_lm(l,m): else: norm = 1. for n1 in range(nb2_start,nb2+1,2): - k = (absm-n1)/2 + k = (absm-n1)//2 factor = (-1.)**k * binom(absm,n1) * norm for t in range(nb1+1): for n2 in range(t+1): diff --git a/resultsFile/lib/lib_cython.pyx b/resultsFile/lib/lib_cython.pyx deleted file mode 100644 index 75343c6..0000000 --- a/resultsFile/lib/lib_cython.pyx +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/python -from math import * - -powersave = { 's':(0,0,0) } -def powers(sym): - if sym in powersave: - return powersave[sym] - result = (sym.count('x'),sym.count('y'),sym.count('z')) - powersave[sym] = result - return result - -fact_ = [1.] -cpdef fact(int n): - global fact_ - cdef int nstart = len(fact_) - cdef int i - if n >= nstart : - for i in range(nstart,n+1): - fact_.append(float(fact_[i-1]*i)) - return fact_[n] - -def binom(int n,int m): - return fact(n)/(fact(m)*fact(n-m)) - - -cdef ddfact2(int n): - if n%2 == 0: print 'error in ddfact2' - cdef double res=1. - cdef int i - for i in range(1,n+1,2): - res*=float(i) - return res - -cdef double sqpi = sqrt(pi) - -cpdef rintgauss(int n): - res = sqpi - if n == 0: return res - elif n == 1: return 0. - elif n%2 == 1: return 0. - res /= 2.**(n/2) - res *= ddfact2(n-1) - return res - -cpdef GoverlapCart(fA,fB): - cdef double gamA=fA.expo - cdef double gamB=fB.expo - cdef double gamtot = gamA+gamB - cdef double SAB=1.0 - cdef int l, n, m - cdef double u, arg, alpha, temp, wA, wB, accu - cdef int integ - A = fA.center - B = fB.center - nA = powers(fA.sym) - nB = powers(fB.sym) - for l in range(3): - Al = A[l] - Bl = B[l] - nAl = nA[l] - nBl = nB[l] - u=gamA/gamtot*Al+gamB/gamtot*Bl - arg=gamtot*u*u-gamA*Al*Al-gamB*Bl*Bl - alpha=exp(arg)/gamtot**((1.+float(nAl)+float(nBl))*0.5) - temp = sqrt(gamtot) - wA=temp*(u-Al) - wB=temp*(u-Bl) - accu=0. - for n in range (nAl+1): - for m in range (nBl+1): - integ=nAl+nBl-n-m - accu+=wA**n*wB**m*binom(nAl,n)*binom(nBl,m)*rintgauss(integ) - SAB*=accu*alpha - return SAB - -cpdef GoverlapCartNorm2(fA,fB): - cdef double gamA=fA.expo - cdef double gamB=fB.expo - cdef double gamtot = gamA+gamB - cdef double SAB=1.0 - cdef int l - nA = powers(fA.sym) - nB = powers(fB.sym) - for l in range(3): - nAl = nA[l] - nBl = nB[l] - SAB*=rintgauss(nAl+nBl)/(gamA+gamB)**((1.+float(nAl)+float(nBl))/2.) - return SAB - diff --git a/resultsFile/resultsFile_cython.pyx b/resultsFile/resultsFile_cython.pyx deleted file mode 100755 index 825e311..0000000 --- a/resultsFile/resultsFile_cython.pyx +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/python -# resultsFile is a library which allows to read output files of quantum -# chemistry codes and write input files. -# Copyright (C) 2007 Anthony SCEMAMA -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Anthony Scemama -# LCPQ - IRSAMC -# Universite Paul Sabatier -# 118, route de Narbonne -# 31062 Toulouse Cedex 4 -# scemama@irsamc.ups-tlse.fr - - -from lib import * -import lib.basis as Basis - -def get_uncontracted_basis(basis): - uncontr = [] - for contr in basis: - for b in contr.prim: - uncontr.append(b) - return uncontr - -def get_uncontracted_mo_sets(basis,uncontracted_basis,mo_sets,mo_types): - cdef dict uncontr = {} - cdef int lenmovector - cdef int lenbasis = len(basis) - cdef double ci - cdef int i, j - for motype in mo_types: - uncontr[motype] = [] - for mo in mo_sets[motype]: - lenmovector = len(mo.vector) - monew = orbital() - monew.basis = uncontracted_basis - monew.eigenvalue = mo.eigenvalue - monew.set = motype - v = [] - for i in range(lenbasis): - contr = basis[i] - if i