# it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation version 3 of the License. # # 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. # # Brown owns the intellectual property right for this file and reserves the # right to distribute it under a license other than LGPL import ManyBodyState as mbs import numpy as np import cPickle as pickle f = open('mbDimension.pkl', 'r') mbDim = pickle.load(f) f.close() f = open('LowLyingStates.mtx', 'r') header = f.readline() entries, gsEnergy = header.split() vList = np.zeros(mbDim, complex) for index, line in enumerate(f): real, imag = line.split() vList[index] = complex(float(real), float(imag)) f.close() v = np.array(vList) mbs.analyzeOccupations(v)
print '<====== ' + fname + '========>' print vecFile = open(fname, 'r') [vectorSizeTxt, gsEnergyTxt] = vecFile.readline().split() print vectorSizeTxt, gsEnergyTxt vectorSize = int(vectorSizeTxt) vector = np.zeros(vectorSize, dtype=complex) index = 0 for line in vecFile: [realTxt, imagTxt] = line.split() #print realTxt, imagTxt vector[index] = complex(float(realTxt), float(imagTxt)) index = index + 1 vecFile.close() mbs.analyzeOccupations(vector) readFlag = True s2Ham = mbh.ManyBodyHamMTX('SSquaredOp', readFlag) exp = s2Ham.expValue(vector) print 'S2 exp:', exp l2Ham = mbh.ManyBodyHamMTX('LSquaredOp', readFlag) exp = l2Ham.expValue(vector) print 'L2 exp:', exp j2Ham = mbh.ManyBodyHamMTX('JSquaredOp', readFlag) exp = j2Ham.expValue(vector) print 'J2 exp:', exp