10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 15:12:14 +02:00

Working pseudo

This commit is contained in:
TApplencourt 2016-11-08 15:29:35 -06:00
parent be6cef694c
commit 90418ec728
7 changed files with 93 additions and 78 deletions

2
configure vendored
View File

@ -122,7 +122,7 @@ docopt = Info(
default_path=join(QP_ROOT_INSTALL, "docopt"))
resultsFile = Info(
url='{head}/LCPQ/resultsFile/{tail}'.format(**path_github),
url='{head}/TApplencourt/resultsFile/{tail}'.format(**path_github),
description=' resultsFile',
default_path=join(QP_ROOT_INSTALL, "resultsFile"))

View File

@ -12,26 +12,24 @@ Option:
"""
import sys
import os
from functools import reduce
# ~#~#~#~#~#~#~#~ #
# Add to the path #
# ~#~#~#~#~#~#~#~ #
try:
QP_ROOT = os.environ["QP_ROOT"]
except:
print "Error: QP_ROOT environment variable not found."
sys.exit(1)
else:
sys.path = [QP_ROOT + "/install/EZFIO/Python",
QP_ROOT + "/resultsFile",
QP_ROOT + "/scripts"] + sys.path
sys.path = [
QP_ROOT + "/install/EZFIO/Python", QP_ROOT + "/resultsFile", QP_ROOT +
"/scripts"
] + sys.path
# ~#~#~#~#~#~ #
# I m p o r t #
@ -39,7 +37,6 @@ else:
from ezfio import ezfio
try:
from resultsFile import *
except:
@ -254,7 +251,7 @@ def write_ezfio(res, filename):
for coef in m.vector:
MoMatrix.append(coef)
while len(MoMatrix) < len(MOs[0].vector) ** 2:
while len(MoMatrix) < len(MOs[0].vector)**2:
MoMatrix.append(0.)
# ~#~#~#~#~ #
@ -273,7 +270,6 @@ def write_ezfio(res, filename):
# \_| |___/\___|\__,_|\__,_|\___/
#
# INPUT
# {% for lanel,zcore, l_block in l_atom $}
# #local l_block l=0}
@ -292,80 +288,81 @@ def write_ezfio(res, filename):
# v_kl[l][n-2][atom] = value
def pad(array, size, value=0):
new_array= array
for add in xrange(len(array), size):
new_array.append(value)
new_array = array
for add in xrange(len(array), size):
new_array.append(value)
return new_array
return new_array
def parse_str(pseudo_str):
'''Return 4d array atom,l,n, attribute (attribute is coef, n, zeta)'''
matrix = []
array_l_max_block = []
array_z_remove = []
'''Return 4d array atom,l,n, attribute (attribute is coef, n, zeta)'''
matrix = []
array_l_max_block = []
array_z_remove = []
for block in [b for b in pseudo_str.split('\n\n') if b]:
#First element is header, the rest are l_param
array_party = [i for i in re.split(r"\n\d+\n",block) if i]
for block in [b for b in pseudo_str.split('\n\n') if b]:
#First element is header, the rest are l_param
array_party = [i for i in re.split(r"\n\d+\n", block) if i]
z_remove, l_max_block = map(int,array_party[0].split()[-2:])
array_l_max_block.append(l_max_block)
array_z_remove.append(z_remove)
z_remove, l_max_block = map(int, array_party[0].split()[-2:])
array_l_max_block.append(l_max_block)
array_z_remove.append(z_remove)
matrix_3d.append([ [coef_n_zeta.split()[1:] for coef_n_zeta in l.split('\n')] for l in array_party[1:] ])
matrix.append([[coef_n_zeta.split()[1:] for coef_n_zeta in l.split('\n')] for l in array_party[1:]])
return (matrix, array_l_max_block, array_z_remove)
return (matrix, array_l_max_block, array_z_remove)
def get_local_stuff(matrix):
matrix_local_unpad = [atom[0] for atom in matrix]
k_loc_max = max(len(i) for i in matrix_local_unpad)
matrix_local = [pad(ll,k_loc_max,[0.,0,0.]) for ll in matrix_local_unpad]
matrix_local_unpad = [atom[0] for atom in matrix]
k_loc_max = max(len(i) for i in matrix_local_unpad)
m_coef =[ [float(i[0]) for i in atom] for atom in matrix_local]
m_n = [ [int(i[1])-2 for i in atom] for atom in matrix_local]
m_zeta = [ [float(i[2]) for i in atom] for atom in matrix_local]
matrix_local = [ pad(ll, k_loc_max, [0., 2, 0.]) for ll in matrix_local_unpad]
return (k_loc_max, m_coef,m_n,m_zeta)
m_coef = [[float(i[0]) for i in atom] for atom in matrix_local]
m_n = [[int(i[1]) - 2 for i in atom] for atom in matrix_local]
m_zeta = [[float(i[2]) for i in atom] for atom in matrix_local]
return (k_loc_max, m_coef, m_n, m_zeta)
def get_non_local_stuff(matrix):
matrix_unlocal_unpad = [atom[1:] for atom in matrix]
l_max_block = max(len(i) for i in matrix_unlocal_unpad)
k_max = max( [len(item) for row in matrix_unlocal_unpad for item in row ] )
k_max = max([len(item) for row in matrix_unlocal_unpad for item in row])
matrix_unlocal_semipaded =[ [pad(item,k_max,[0.,0,0.]) for item in row] for row in matrix_unlocal_unpad]
matrix_unlocal_semipaded = [[pad(item, k_max, [0., 2, 0.]) for item in row] for row in matrix_unlocal_unpad]
empty_row = [ [0.,0,0.] for k in range(l_max_block)]
matrix_unlocal = [pad(ll,l_max_block,empty_row) for ll in matrix_unlocal_semipaded]
empty_row = [[0., 2, 0.] for k in range(l_max_block)]
matrix_unlocal = [ pad(ll, l_max_block, empty_row) for ll in matrix_unlocal_semipaded ]
m_coef_noloc = [ [ [ float(k[0]) for k in j ] for j in i ] for i in matrix_local ]
m_n_noloc = [ [ [ int(k[1])-2 for k in j ] for j in i ] for i in matrix_local ]
m_zeta_noloc = [ [ [ float(k[2]) for k in j ] for j in i ] for i in matrix_local ]
return (l_max_block,k_max, m_coef_noloc,m_n_noloc,m_zeta_noloc)
m_coef_noloc = [[[float(k[0]) for k in j] for j in i] for i in matrix_unlocal]
m_n_noloc = [[[int(k[1]) - 2 for k in j] for j in i] for i in matrix_unlocal]
m_zeta_noloc = [[[float(k[2]) for k in j] for j in i] for i in matrix_unlocal]
return (l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc)
try:
pseudo_str = res_file.get_pseudo()
pseudo_str = res_file.get_pseudo()
except:
ezfio.set_pseudo_do_pseudo(False)
ezfio.set_pseudo_do_pseudo(False)
else:
ezfio.set_pseudo_do_pseudo(True)
matrix, array_l_max_block, array_z_remove = parse(pseudo_str)
ezfio.set_pseudo_do_pseudo(True)
matrix, array_l_max_block, array_z_remove = parse_str(pseudo_str)
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# Z _ e f f , a l p h a / b e t a _ e l e c #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
ezfio.pseudo_charge_remove = array_z_remove
ezfio.nuclei_nucl_charge = ezfio.nuclei_nucl_charge - array_z_remove
ezfio.nuclei_nucl_charge = [
i - j for i, j in zip(ezfio.nuclei_nucl_charge, array_z_remove)
]
import math
num_elec = sum(ezfio.nuclei_nucl_charge)
ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
ezfio.electrons_elec_beta_num = int(math.floor(num_beta / 2.))
ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
# Change all the array 'cause EZFIO
# v_kl (v, l) => v_kl(l,v)
@ -377,29 +374,35 @@ def write_ezfio(res, filename):
# L o c a l #
# ~#~#~#~#~ #
klocmax, m_coef,m_n,m_zeta = get_local_stuff(matrix)
klocmax, m_coef, m_n, m_zeta = get_local_stuff(matrix)
ezfio.pseudo_pseudo_klocmax = klocmax
ezfio.pseudo_pseudo_v_k = zip(*m_coef)
ezfio.pseudo_pseudo_n_k = zip(*m_n)
ezfio.pseudo_pseudo_dz_k = zip(*m_zeta)
# ~#~#~#~#~#~#~#~#~ #
# N o n _ L o c a l #
# ~#~#~#~#~#~#~#~#~ #
l_max_block,k_max, m_coef_noloc,m_n_noloc,m_zeta_noloc = get_non_local_stuff(matrix)
l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc = get_non_local_stuff(
matrix)
ezfio.pseudo_pseudo_lmax = l_max_block - 1
ezfio.pseudo_pseudo_kmax = k_max
ezfio.pseudo_pseudo_v_kl = zip(*m_coef_noloc)
ezfio.pseudo_pseudo_n_kl = zip(*m_n_noloc)
ezfio.pseudo_pseudo_dz_kl = zip(*m_zeta_noloc)
def get_full_path(file_path):
file_path = os.path.expanduser(file_path)
file_path = os.path.expandvars(file_path)
file_path = os.path.abspath(file_path)
return file_path
if __name__ == '__main__':
arguments = docopt(__doc__)

View File

@ -298,6 +298,7 @@ if __name__ == '__main__':
# Don't update if we are not in the main repository
from is_master_repository import is_master_repository
if not is_master_repository:
print 'Not in the master repo'
sys.exit()
path = os.path.join(module_abs, ".gitignore")

View File

@ -3,7 +3,11 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integral, (ao_num_align,ao_num)]
BEGIN_DOC
! Pseudo-potential integrals
END_DOC
print*, 'Hi from ao_pseudo_integral'
print*, read_ao_one_integrals
if (read_ao_one_integrals) then
call read_one_e_integrals('ao_pseudo_integral', ao_pseudo_integral,&
size(ao_pseudo_integral,1), size(ao_pseudo_integral,2))
@ -53,13 +57,6 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integral_local, (ao_num_align,ao_nu
call wall_time(wall_1)
call cpu_time(cpu_1)
!write(33,*) 'xxxLOCxxx'
!write(33,*) 'pseudo_klocmax', pseudo_klocmax
!write(33,*) 'pseudo_v_k_transp ', pseudo_v_k_transp
!write(33,*) 'pseudo_n_k_transp ', pseudo_n_k_transp
!write(33,*) 'pseudo_dz_k_transp', pseudo_dz_k_transp
!write(33,*) 'xxxLOCxxx'
thread_num = 0
!$OMP PARALLEL &
!$OMP DEFAULT (NONE) &
@ -109,14 +106,6 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integral_local, (ao_num_align,ao_nu
pseudo_n_k_transp (1,k), &
pseudo_dz_k_transp(1,k), &
A_center,power_A,alpha,B_center,power_B,beta,C_center)
! write(33,*) i,j,k
! write(33,*) A_center,power_A,alpha,B_center,power_B,beta,C_center, &
! Vloc(pseudo_klocmax, &
! pseudo_v_k_transp (1,k), &
! pseudo_n_k_transp (1,k), &
! pseudo_dz_k_transp(1,k), &
! A_center,power_A,alpha,B_center,power_B,beta,C_center)
! write(33,*)
enddo
ao_pseudo_integral_local(i,j) = ao_pseudo_integral_local(i,j) +&

View File

@ -86,4 +86,16 @@ doc: QMC grid
interface: ezfio
size: (ao_basis.ao_num,-pseudo.pseudo_lmax:pseudo.pseudo_lmax,0:pseudo.pseudo_lmax,nuclei.nucl_num,pseudo.pseudo_grid_size)
[disk_access_pseudo_local_integrals]
type: Disk_access
doc: Read/Write the local ntegrals from/to disk [ Write | Read | None ]
interface: ezfio,provider,ocaml
default: None
[disk_access_pseudo_no_local_integrals]
type: Disk_access
doc: Read/Write the no-local ntegrals from/to disk [ Write | Read | None ]
interface: ezfio,provider,ocaml
default: None

View File

@ -17,17 +17,22 @@ module map_module
! should be called before getting data from the map.
use omp_lib
use iso_fortran_env
integer, parameter :: integral_kind = 8
integer, parameter :: integral_kind = 16 ! 8
integer, parameter :: cache_key_kind = 2
integer, parameter :: cache_map_size_kind = 4
integer, parameter :: cache_key_kind = 4 ! 2
integer, parameter :: cache_map_size_kind = 8 ! 4
integer, parameter :: key_kind = 8
integer, parameter :: map_size_kind = 8
integer, parameter :: key_kind = 16 !8
integer, parameter :: map_size_kind =16 ! 8
integer, parameter :: map_shift = -15
integer*8, parameter :: map_mask = ibset(0_8,15)-1_8
integer, parameter :: map_shift = -31 !-15
!integer*8, parameter :: map_mask = ibset(0_8,15)-1_8
integer(kind=int16), parameter :: z_kind = 0
integer(kind=int16), parameter :: o_kind = 1
integer(kind=int16), parameter :: map_mask = ibset(z_kind,15)-o_kind
type cache_map_type
real(integral_kind), pointer :: value(:)
@ -45,8 +50,13 @@ module map_module
integer*8, pointer :: consolidated_idx(:)
logical :: sorted
logical :: consolidated
integer(map_size_kind) :: map_size
integer(map_size_kind) :: n_elements
! integer(kind=map_size_kind) :: map_size
! integer(kind=map_size_kind) :: n_elements
integer(kind=int16) :: map_size
integer(kind=int16) :: n_elements
integer(omp_lock_kind) :: lock
end type map_type

View File

@ -1,6 +1,6 @@
3
XYZ file: coordinates in Angstrom
H 0.7510000000 0.1940000000 0.0000000000
O 0.0000000000 -0.3880000000 0.0000000000
H 0.7510000000 0.1940000000 0.0000000000
H -0.7510000000 0.1940000000 0.0000000000