From 698a59225118800a8b9de21d246197ae7f3279cf Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 Feb 2020 21:10:22 +0100 Subject: [PATCH] First working release for Python3 --- resultsFile/Modules/gamessFile.py | 4 +-- resultsFile/Modules/gaussianFile.py | 6 ++-- resultsFile/Modules/wfnFile.py | 2 +- resultsFile/Modules/xmvbFile.py | 4 +-- resultsFile/__init__.py | 1 + resultsFile/lib/cython_setup | 51 ----------------------------- 6 files changed, 9 insertions(+), 59 deletions(-) delete mode 100755 resultsFile/lib/cython_setup diff --git a/resultsFile/Modules/gamessFile.py b/resultsFile/Modules/gamessFile.py index f5e4043..7a55a45 100755 --- a/resultsFile/Modules/gamessFile.py +++ b/resultsFile/Modules/gamessFile.py @@ -1171,12 +1171,12 @@ class gamessFile(resultsFile.resultsFileX): def get_num_alpha(self): if self._num_alpha is None: - self._num_alpha = (self.num_elec + self.multiplicity-1)/2 + self._num_alpha = (self.num_elec + self.multiplicity-1)//2 return self._num_alpha def get_num_beta(self): if self._num_beta is None: - self._num_beta = (self.num_elec - self.multiplicity+1)/2 + self._num_beta = (self.num_elec - self.multiplicity+1)//2 return self._num_beta def get_determinants_mo_type(self): diff --git a/resultsFile/Modules/gaussianFile.py b/resultsFile/Modules/gaussianFile.py index 87b2406..d199ad2 100755 --- a/resultsFile/Modules/gaussianFile.py +++ b/resultsFile/Modules/gaussianFile.py @@ -532,7 +532,7 @@ class gaussianFile(resultsFile.resultsFileX): self.find_next_string(" 1 2") posend[index] = [] posend[index].append(self._pos) - end = self._pos + (4+len(self.basis))/5 * ( len(self.basis) + 3 ) + end = self._pos + (4+len(self.basis))//5 * ( len(self.basis) + 3 ) posend[index].append(end) if method.startswith("U"): self.find_string("Beta Molecular Orbital Coefficients") @@ -541,7 +541,7 @@ class gaussianFile(resultsFile.resultsFileX): self.find_next_string(" 1 2") posend[index] = [] posend[index].append(self._pos) - end = self._pos + (4+len(self.basis))/5 * ( len(self.basis) + 3 ) + end = self._pos + (4+len(self.basis))//5 * ( len(self.basis) + 3 ) posend[index].append(end) except IndexError: pass @@ -552,7 +552,7 @@ class gaussianFile(resultsFile.resultsFileX): self.find_next_string(" 1 2") posend[index] = [] posend[index].append(self._pos) - end = self._pos + (4+len(self.basis))/5 * ( len(self.basis) + 2 ) + end = self._pos + (4+len(self.basis))//5 * ( len(self.basis) + 2 ) posend[index].append(end) except IndexError: pass diff --git a/resultsFile/Modules/wfnFile.py b/resultsFile/Modules/wfnFile.py index 79b23c7..f13b3b8 100755 --- a/resultsFile/Modules/wfnFile.py +++ b/resultsFile/Modules/wfnFile.py @@ -218,7 +218,7 @@ class wfnFile(resultsFile.resultsFileX): def get_num_beta(self): if self._num_beta is None: - self._num_beta = self.num_elec/2 + self._num_beta = self.num_elec//2 return self._num_beta def get_determinants_mo_type(self): diff --git a/resultsFile/Modules/xmvbFile.py b/resultsFile/Modules/xmvbFile.py index e2cab7d..ea7461e 100755 --- a/resultsFile/Modules/xmvbFile.py +++ b/resultsFile/Modules/xmvbFile.py @@ -620,12 +620,12 @@ class xmvbFile(resultsFile.resultsFileX): def get_num_alpha(self): if self._num_alpha is None: - self._num_alpha = self.num_elec/2 + (self.multiplicity-1)/2 + self._num_alpha = self.num_elec//2 + (self.multiplicity-1)//2 return self._num_alpha def get_num_beta(self): if self._num_beta is None: - self._num_beta = self.num_elec/2 - (self.multiplicity-1)/2 + self._num_beta = self.num_elec//2 - (self.multiplicity-1)//2 return self._num_beta def get_determinants_mo_type(self): diff --git a/resultsFile/__init__.py b/resultsFile/__init__.py index 16c904d..98ef7a3 100755 --- a/resultsFile/__init__.py +++ b/resultsFile/__init__.py @@ -298,6 +298,7 @@ class resultsFileX(object): for mo in mo_sets[motype]: newvec = [] vec = mo.vector + print(mo.vector) for i,w in zip(map,weight): newvec.append(vec[i]*w) mo.vector = newvec diff --git a/resultsFile/lib/cython_setup b/resultsFile/lib/cython_setup deleted file mode 100755 index 4ca692e..0000000 --- a/resultsFile/lib/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("lib_cython", ["lib_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 - ) -