mirror of
https://github.com/LCPQ/quantum_package
synced 2024-10-19 22:41:48 +02:00
Merge branch 'master' of https://github.com/scemama/quantum_package into toto
This commit is contained in:
commit
43e6f64969
4
TODO
4
TODO
@ -1,12 +1,10 @@
|
|||||||
* Virer tous les modules qui sont dans plugins
|
* Virer tous les modules qui sont dans plugins
|
||||||
|
* Separer integrales ERF
|
||||||
|
|
||||||
# qp_module
|
# qp_module
|
||||||
|
|
||||||
* Permettre aux utilisateurs de facilement deposer des plugins dans plugins via une commande
|
|
||||||
* Permettre de descendre plus bas dans l'arborescence de plugins pour permettre des `git clone` dans le repertoire plugins
|
|
||||||
* Mettre les fichiers de test dans le directory source
|
* Mettre les fichiers de test dans le directory source
|
||||||
* Mettre le fichier LIB
|
* Mettre le fichier LIB
|
||||||
* Mettre les fichiers install.sh dans les modules externes
|
|
||||||
|
|
||||||
# Web/doc
|
# Web/doc
|
||||||
|
|
||||||
|
@ -1,29 +1,32 @@
|
|||||||
IRPF90_temp/
|
# Automatically created by $QP_ROOT/scripts/module/module_handler.py
|
||||||
IRPF90_man/
|
.ninja_deps
|
||||||
irpf90.make
|
.ninja_log
|
||||||
irpf90_entities
|
/home/scemama/quantum_package/src/tools/diagonalize_h
|
||||||
tags
|
/home/scemama/quantum_package/src/tools/fcidump
|
||||||
|
/home/scemama/quantum_package/src/tools/four_idx_transform
|
||||||
|
/home/scemama/quantum_package/src/tools/molden
|
||||||
|
/home/scemama/quantum_package/src/tools/save_natorb
|
||||||
|
/home/scemama/quantum_package/src/tools/save_ortho_mos
|
||||||
|
/home/scemama/quantum_package/src/tools/write_integrals_erf
|
||||||
|
IRPF90_man
|
||||||
|
IRPF90_temp
|
||||||
Makefile
|
Makefile
|
||||||
|
Makefile.depend
|
||||||
ao_basis
|
ao_basis
|
||||||
ao_one_e_integrals
|
ao_one_e_integrals
|
||||||
ao_two_e_integrals
|
ao_two_e_integrals
|
||||||
becke_numerical_grid
|
|
||||||
bitmask
|
bitmask
|
||||||
cis
|
|
||||||
cisd
|
|
||||||
davidson
|
davidson
|
||||||
davidson_dressed
|
|
||||||
davidson_undressed
|
davidson_undressed
|
||||||
determinants
|
determinants
|
||||||
dressing
|
|
||||||
dummy
|
|
||||||
electrons
|
electrons
|
||||||
ezfio_files
|
ezfio_files
|
||||||
|
ezfio_interface.irp.f
|
||||||
fci
|
fci
|
||||||
generators_cas
|
|
||||||
generators_full
|
generators_full
|
||||||
hartree_fock
|
hartree_fock
|
||||||
integrals_bielec
|
irpf90.make
|
||||||
|
irpf90_entities
|
||||||
iterations
|
iterations
|
||||||
mo_basis
|
mo_basis
|
||||||
mo_guess
|
mo_guess
|
||||||
@ -36,11 +39,9 @@ perturbation
|
|||||||
pseudo
|
pseudo
|
||||||
psiref_cas
|
psiref_cas
|
||||||
psiref_utils
|
psiref_utils
|
||||||
selectors_cassd
|
scf_utils
|
||||||
selectors_full
|
selectors_full
|
||||||
selectors_utils
|
selectors_utils
|
||||||
single_ref_method
|
tags
|
||||||
slave
|
|
||||||
tools
|
|
||||||
utils
|
utils
|
||||||
zmq
|
zmq
|
@ -1 +1 @@
|
|||||||
Hartree_Fock Determinants
|
hartree_fock determinants
|
||||||
|
@ -1,106 +0,0 @@
|
|||||||
! DO NOT MODIFY BY HAND
|
|
||||||
! Created by $QP_ROOT/scripts/ezfio_interface/ei_handler.py
|
|
||||||
! from file /home/loos/quantum_package/src/NOFT/EZFIO.cfg
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ logical, do_jk_functionals ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Compute energies for JK-only functionals
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
logical :: has
|
|
||||||
PROVIDE ezfio_filename
|
|
||||||
if (mpi_master) then
|
|
||||||
|
|
||||||
call ezfio_has_noft_do_jk_functionals(has)
|
|
||||||
if (has) then
|
|
||||||
call ezfio_get_noft_do_jk_functionals(do_jk_functionals)
|
|
||||||
else
|
|
||||||
print *, 'noft/do_jk_functionals not found in EZFIO file'
|
|
||||||
stop 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
IRP_IF MPI
|
|
||||||
include 'mpif.h'
|
|
||||||
integer :: ierr
|
|
||||||
call MPI_BCAST( do_jk_functionals, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
|
|
||||||
if (ierr /= MPI_SUCCESS) then
|
|
||||||
stop 'Unable to read do_jk_functionals with MPI'
|
|
||||||
endif
|
|
||||||
IRP_ENDIF
|
|
||||||
|
|
||||||
call write_time(6)
|
|
||||||
if (mpi_master) then
|
|
||||||
write(6, *) 'Read do_jk_functionals'
|
|
||||||
endif
|
|
||||||
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ logical, do_jkl_functionals ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Compute energies for JKL-only functionals (PNOFs)
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
logical :: has
|
|
||||||
PROVIDE ezfio_filename
|
|
||||||
if (mpi_master) then
|
|
||||||
|
|
||||||
call ezfio_has_noft_do_jkl_functionals(has)
|
|
||||||
if (has) then
|
|
||||||
call ezfio_get_noft_do_jkl_functionals(do_jkl_functionals)
|
|
||||||
else
|
|
||||||
print *, 'noft/do_jkl_functionals not found in EZFIO file'
|
|
||||||
stop 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
IRP_IF MPI
|
|
||||||
include 'mpif.h'
|
|
||||||
integer :: ierr
|
|
||||||
call MPI_BCAST( do_jkl_functionals, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
|
|
||||||
if (ierr /= MPI_SUCCESS) then
|
|
||||||
stop 'Unable to read do_jkl_functionals with MPI'
|
|
||||||
endif
|
|
||||||
IRP_ENDIF
|
|
||||||
|
|
||||||
call write_time(6)
|
|
||||||
if (mpi_master) then
|
|
||||||
write(6, *) 'Read do_jkl_functionals'
|
|
||||||
endif
|
|
||||||
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ logical, do_pt2_noft ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Compute PT2 correction for NOFT
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
logical :: has
|
|
||||||
PROVIDE ezfio_filename
|
|
||||||
if (mpi_master) then
|
|
||||||
|
|
||||||
call ezfio_has_noft_do_pt2_noft(has)
|
|
||||||
if (has) then
|
|
||||||
call ezfio_get_noft_do_pt2_noft(do_pt2_noft)
|
|
||||||
else
|
|
||||||
print *, 'noft/do_pt2_noft not found in EZFIO file'
|
|
||||||
stop 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
IRP_IF MPI
|
|
||||||
include 'mpif.h'
|
|
||||||
integer :: ierr
|
|
||||||
call MPI_BCAST( do_pt2_noft, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
|
|
||||||
if (ierr /= MPI_SUCCESS) then
|
|
||||||
stop 'Unable to read do_pt2_noft with MPI'
|
|
||||||
endif
|
|
||||||
IRP_ENDIF
|
|
||||||
|
|
||||||
call write_time(6)
|
|
||||||
if (mpi_master) then
|
|
||||||
write(6, *) 'Read do_pt2_noft'
|
|
||||||
endif
|
|
||||||
|
|
||||||
END_PROVIDER
|
|
@ -5,21 +5,22 @@ Module utilitary
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
module_handler.py print_descendant [<module_name>...]
|
module_handler.py print_descendant [<module_name>...]
|
||||||
module_handler.py create_png [<module_name>...]
|
|
||||||
module_handler.py clean [ --all | <module_name>...]
|
module_handler.py clean [ --all | <module_name>...]
|
||||||
module_handler.py create_git_ignore [<module_name>...]
|
module_handler.py create_git_ignore [<module_name>...]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
print_descendant Print the genealogy of the needed modules
|
print_descendant Print the genealogy of the needed modules
|
||||||
create_png Create a png of the file
|
|
||||||
NEED The path of NEED file.
|
NEED The path of NEED file.
|
||||||
by default try to open the file in the current path
|
by default try to open the file in the current path
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
|
from collections import namedtuple
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from docopt import docopt
|
from docopt import docopt
|
||||||
from qp_path import QP_SRC, QP_ROOT, QP_PLUGINS
|
from qp_path import QP_SRC, QP_ROOT, QP_PLUGINS
|
||||||
@ -36,8 +37,30 @@ def is_plugin(path_module_rel):
|
|||||||
return os.path.isfile(os.path.join(QP_PLUGINS, path_module_rel, "NEED"))
|
return os.path.isfile(os.path.join(QP_PLUGINS, path_module_rel, "NEED"))
|
||||||
|
|
||||||
|
|
||||||
def is_exe(fpath):
|
def get_binaries(path_module):
|
||||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK) and not fpath.endswith(".py")
|
"""
|
||||||
|
Return the list of binaries
|
||||||
|
"""
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
try:
|
||||||
|
cmd = 'grep -l -i --regexp="^\\s*program\\s" {0}/*.irp.f'.format(path_module)
|
||||||
|
process = subprocess.Popen([cmd],
|
||||||
|
shell=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = process.communicate()
|
||||||
|
except OSError:
|
||||||
|
return []
|
||||||
|
else:
|
||||||
|
if not stdout:
|
||||||
|
return []
|
||||||
|
elif "No such file or directory" not in stdout:
|
||||||
|
l_bin = [i.replace(".irp.f", "", 1) for i in stdout.split()]
|
||||||
|
return [os.path.realpath(bin_) for bin_ in l_bin]
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_dict_child(l_root_abs=None):
|
def get_dict_child(l_root_abs=None):
|
||||||
@ -174,49 +197,6 @@ class ModuleHandler():
|
|||||||
|
|
||||||
return l_module_reduce
|
return l_module_reduce
|
||||||
|
|
||||||
def create_png(self, l_module):
|
|
||||||
"""Create the png of the dependency tree for a l_module"""
|
|
||||||
|
|
||||||
# Don't update if we are not in the main repository
|
|
||||||
from is_master_repository import is_master_repository
|
|
||||||
if not is_master_repository:
|
|
||||||
return
|
|
||||||
|
|
||||||
basename = "tree_dependency"
|
|
||||||
path = '{0}.png'.format(basename)
|
|
||||||
|
|
||||||
from graphviz import Digraph
|
|
||||||
|
|
||||||
all_ready_done = []
|
|
||||||
|
|
||||||
def draw_module_edge(module, l_children):
|
|
||||||
"Draw all the module recursifly"
|
|
||||||
|
|
||||||
if module not in all_ready_done:
|
|
||||||
for children in l_children:
|
|
||||||
# Add Edge
|
|
||||||
graph.edge(module, children)
|
|
||||||
# Recurs
|
|
||||||
draw_module_edge(children, d_ref[children])
|
|
||||||
all_ready_done.append(module)
|
|
||||||
|
|
||||||
graph = Digraph(comment=l_module, format="png", filename=basename)
|
|
||||||
d_ref = self.dict_child
|
|
||||||
|
|
||||||
# Create all the edge
|
|
||||||
for module in l_module:
|
|
||||||
graph.node(module, fontcolor="red")
|
|
||||||
draw_module_edge(module, d_ref[module])
|
|
||||||
|
|
||||||
# Try to render the png
|
|
||||||
# If not just touch it
|
|
||||||
try:
|
|
||||||
graph.render(cleanup=True)
|
|
||||||
except:
|
|
||||||
with open(path, 'a'):
|
|
||||||
os.utime(path, None)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
@ -245,15 +225,6 @@ if __name__ == '__main__':
|
|||||||
for module in l_module:
|
for module in l_module:
|
||||||
print " ".join(sorted(m.l_descendant_unique([module])))
|
print " ".join(sorted(m.l_descendant_unique([module])))
|
||||||
|
|
||||||
if arguments["create_png"]:
|
|
||||||
try:
|
|
||||||
m.create_png(l_module)
|
|
||||||
except RuntimeError:
|
|
||||||
pass
|
|
||||||
except SyntaxError:
|
|
||||||
print "Warning: The graphviz API dropped support for python 2.6."
|
|
||||||
pass
|
|
||||||
|
|
||||||
if arguments["clean"] or arguments["create_git_ignore"]:
|
if arguments["clean"] or arguments["create_git_ignore"]:
|
||||||
|
|
||||||
l_dir = ['IRPF90_temp', 'IRPF90_man']
|
l_dir = ['IRPF90_temp', 'IRPF90_man']
|
||||||
@ -264,8 +235,7 @@ if __name__ == '__main__':
|
|||||||
for module in l_module:
|
for module in l_module:
|
||||||
module_abs = os.path.realpath(os.path.join(QP_SRC, module))
|
module_abs = os.path.realpath(os.path.join(QP_SRC, module))
|
||||||
l_symlink = m.l_descendant_unique([module])
|
l_symlink = m.l_descendant_unique([module])
|
||||||
l_exe = [f for f in os.listdir(module_abs)
|
l_exe = get_binaries(module_abs)
|
||||||
if is_exe(os.path.join(module_abs, f))]
|
|
||||||
|
|
||||||
if arguments["clean"]:
|
if arguments["clean"]:
|
||||||
for f in l_dir:
|
for f in l_dir:
|
||||||
@ -295,11 +265,6 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
if arguments["create_git_ignore"]:
|
if arguments["create_git_ignore"]:
|
||||||
|
|
||||||
# Don't update if we are not in the main repository
|
|
||||||
from is_master_repository import is_master_repository
|
|
||||||
if not is_master_repository:
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
path = os.path.join(module_abs, ".gitignore")
|
path = os.path.join(module_abs, ".gitignore")
|
||||||
|
|
||||||
with open(path, "w+") as f:
|
with open(path, "w+") as f:
|
||||||
@ -307,3 +272,5 @@ if __name__ == '__main__':
|
|||||||
l_text = l_dir + l_file + l_symlink + l_exe
|
l_text = l_dir + l_file + l_symlink + l_exe
|
||||||
l_text.sort()
|
l_text.sort()
|
||||||
f.write("\n".join(l_text))
|
f.write("\n".join(l_text))
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,16 +2,29 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Usage:
|
Usage:
|
||||||
qp_module create -n <name> [<children_modules>...]
|
qp_plugins list [ -i | -u ]
|
||||||
qp_module download -n <name> [<path_folder>...]
|
qp_plugins download <url>
|
||||||
qp_module install <name>...
|
qp_plugins install <name>...
|
||||||
qp_module list (--installed | --available-local)
|
qp_plugins uninstall <name>
|
||||||
qp_module uninstall <name>
|
qp_plugins create -n <name> [<children_modules>...]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
list: List all the modules available
|
list List all the plugins
|
||||||
create: Create a new module
|
-i List only the installed plugins
|
||||||
"""
|
-u List only the uninstalled plugins
|
||||||
|
|
||||||
|
download <url> Download an external repository.
|
||||||
|
The URL points to a tar.gz file or a git repository:
|
||||||
|
http://example.com/site/example.tar.gz
|
||||||
|
git@gitlab.com:user/example_repository
|
||||||
|
|
||||||
|
install Install a plugin
|
||||||
|
|
||||||
|
uninstall Uninstall a plugin
|
||||||
|
|
||||||
|
create -n <name> Create a new plugin named <name>
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
@ -71,14 +84,31 @@ def save_new_module(path, l_child):
|
|||||||
|
|
||||||
def main(arguments):
|
def main(arguments):
|
||||||
if arguments["list"]:
|
if arguments["list"]:
|
||||||
if arguments["--installed"]:
|
# Search in src all directories with a NEED file
|
||||||
l_repository = [QP_SRC]
|
l_tmp = [ dirname for (dirname, _, filenames) in os.walk(QP_PLUGINS, followlinks=False) for f in filenames if f == 'NEED']
|
||||||
elif arguments["--available-local"]:
|
|
||||||
l_repository = [join(QP_PLUGINS, f) for f in listdir(QP_PLUGINS) if isdir(join(QP_PLUGINS, f))]
|
# Find directories which contain modules
|
||||||
|
l_tmp = [ os.path.split(f) for f in l_tmp ]
|
||||||
|
d_tmp = {}
|
||||||
|
for (x,_) in l_tmp:
|
||||||
|
d_tmp[x] = 1
|
||||||
|
l_repository = d_tmp.keys()
|
||||||
|
m_all_instances = ModuleHandler(l_repository)
|
||||||
m_instance = ModuleHandler(l_repository)
|
m_instance = ModuleHandler(l_repository)
|
||||||
|
l_plugins = [ module for module in m_instance.l_module ]
|
||||||
for module in sorted(m_instance.l_module):
|
l_result = l_plugins
|
||||||
|
|
||||||
|
if arguments["-i"] or arguments["-u"]:
|
||||||
|
# Search in src all symbolic links that are modules
|
||||||
|
l_installed = [ f for f in os.listdir(QP_SRC) if (os.path.islink(os.path.join(QP_SRC,f)) and f != ".gitignore") ]
|
||||||
|
|
||||||
|
if arguments["-i"]:
|
||||||
|
l_result = [ f for f in l_plugins if f in l_installed ]
|
||||||
|
|
||||||
|
elif arguments["-u"]:
|
||||||
|
l_result = [ f for f in l_plugins if f not in l_installed ]
|
||||||
|
|
||||||
|
for module in sorted(l_result):
|
||||||
print "* {0}".format(module)
|
print "* {0}".format(module)
|
||||||
|
|
||||||
if arguments["create"]:
|
if arguments["create"]:
|
||||||
@ -90,18 +120,15 @@ def main(arguments):
|
|||||||
|
|
||||||
path = os.path.join(QP_PLUGINS, name)
|
path = os.path.join(QP_PLUGINS, name)
|
||||||
|
|
||||||
print "Created module:"
|
print "Created plugin:"
|
||||||
print path, '\n'
|
print path, '\n'
|
||||||
|
|
||||||
for children in l_children:
|
for children in l_children:
|
||||||
if children not in m_instance.dict_descendant:
|
if children not in m_instance.dict_descendant:
|
||||||
print "This module ({0}) is not a valid module.".format(children)
|
print "Error: {0} is not a valid module.".format(children)
|
||||||
print "Run `list` for the list of available modules."
|
|
||||||
print "Maybe you need to install some other module first."
|
|
||||||
print "Aborting..."
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print "Needed module:"
|
print "Needed modules:"
|
||||||
print l_children, '\n'
|
print l_children, '\n'
|
||||||
|
|
||||||
print "This corresponds to using the following modules:"
|
print "This corresponds to using the following modules:"
|
||||||
@ -121,8 +148,32 @@ def main(arguments):
|
|||||||
main(arguments)
|
main(arguments)
|
||||||
|
|
||||||
elif arguments["download"]:
|
elif arguments["download"]:
|
||||||
print "Not yet implemented"
|
url = arguments["<url>"]
|
||||||
pass
|
is_repo = not( url.endswith(".tar.gz") or \
|
||||||
|
url.endswith(".tgz") or \
|
||||||
|
url.endswith(".zip") \
|
||||||
|
)
|
||||||
|
os.chdir(QP_PLUGINS)
|
||||||
|
if is_repo:
|
||||||
|
subprocess.check_call(["git", "clone", url])
|
||||||
|
else:
|
||||||
|
filename = url.split('/')[-1]
|
||||||
|
|
||||||
|
import requests, shutil
|
||||||
|
try:
|
||||||
|
r = requests.get(url,verify=True,stream=True)
|
||||||
|
except:
|
||||||
|
r = requests.get(url,verify=False,stream=True)
|
||||||
|
r.raw.decode_content = True
|
||||||
|
with open(filename, 'wb') as f:
|
||||||
|
shutil.copyfileobj(r.raw, f)
|
||||||
|
|
||||||
|
if filename.endswith(".tar.gz") or \
|
||||||
|
filename.endswith(".tgz") or \
|
||||||
|
filename.endswith(".tar.bz2") or \
|
||||||
|
filename.endswith(".tar"):
|
||||||
|
subprocess.check_call(["tar", "xf", filename])
|
||||||
|
os.remove(filename)
|
||||||
|
|
||||||
elif arguments["install"]:
|
elif arguments["install"]:
|
||||||
|
|
||||||
@ -152,7 +203,7 @@ def main(arguments):
|
|||||||
|
|
||||||
if l_module_to_cp:
|
if l_module_to_cp:
|
||||||
|
|
||||||
print "You will need all these modules"
|
print "Required dependencies:"
|
||||||
print l_module_to_cp
|
print l_module_to_cp
|
||||||
|
|
||||||
print "Installation...",
|
print "Installation...",
|
||||||
@ -164,19 +215,13 @@ def main(arguments):
|
|||||||
des = os.path.join(QP_SRC, module_to_cp)
|
des = os.path.join(QP_SRC, module_to_cp)
|
||||||
try:
|
try:
|
||||||
os.symlink(src, des)
|
os.symlink(src, des)
|
||||||
|
install = os.path.join(src,"install")
|
||||||
|
if os.path.isfile(install):
|
||||||
|
subprocess.check_call([install])
|
||||||
except OSError:
|
except OSError:
|
||||||
print "Your src directory is broken. Please remove %s" % des
|
print "The src directory is broken. Please remove %s" % des
|
||||||
raise
|
raise
|
||||||
try:
|
|
||||||
subprocess.check_call(["qp_create_ninja", "update"])
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
|
|
||||||
print "[ OK ]"
|
print "[ OK ]"
|
||||||
print ""
|
|
||||||
print "You can now compile as usual"
|
|
||||||
print "`cd {0} ; ninja` for example".format(QP_ROOT)
|
|
||||||
print " or --in developement mode-- you can cd in a directory and compile here"
|
|
||||||
|
|
||||||
elif arguments["uninstall"]:
|
elif arguments["uninstall"]:
|
||||||
|
|
||||||
@ -189,25 +234,27 @@ def main(arguments):
|
|||||||
l_failed = [name for name in l_name if name not in d_local]
|
l_failed = [name for name in l_name if name not in d_local]
|
||||||
|
|
||||||
if l_failed:
|
if l_failed:
|
||||||
print "Modules not installed:"
|
print "Plugins not installed:"
|
||||||
for name in sorted(l_failed):
|
for name in sorted(l_failed):
|
||||||
print "* %s" % name
|
print "* %s" % name
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
l_name_to_remove = l_name + [module for module in m_instance.l_module for name in l_name if name in d_descendant[module]]
|
l_name_to_remove = l_name + [module for module in m_instance.l_module for name in l_name if name in d_descendant[module]]
|
||||||
|
|
||||||
print "You will remove all of:"
|
print "Removing plugins:"
|
||||||
print l_name_to_remove
|
print l_name_to_remove
|
||||||
|
|
||||||
for module in set(l_name_to_remove):
|
for module in set(l_name_to_remove):
|
||||||
|
|
||||||
try:
|
subprocess.check_call(["module_handler.py", "clean", module])
|
||||||
subprocess.check_call(["module_handler.py", "clean", module])
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
|
|
||||||
for module in set(l_name_to_remove):
|
for module in set(l_name_to_remove):
|
||||||
|
|
||||||
|
uninstall = os.path.join(QP_SRC,module,"uninstall")
|
||||||
|
print uninstall
|
||||||
|
if os.path.isfile(uninstall):
|
||||||
|
subprocess.check_call([uninstall])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.unlink(os.path.join(QP_SRC, module))
|
os.unlink(os.path.join(QP_SRC, module))
|
||||||
except OSError:
|
except OSError:
|
@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env python2
|
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
QP_ROOT=os.environ["QP_ROOT"]
|
|
||||||
|
|
||||||
name_to_elec = {}
|
|
||||||
with open(QP_ROOT+"/data/list_element.txt","r") as f:
|
|
||||||
data = f.readlines()
|
|
||||||
for line in data:
|
|
||||||
b = line.split()
|
|
||||||
name_to_elec[b[1]] = int(b[0])
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
print name_to_elec
|
|
@ -1,370 +0,0 @@
|
|||||||
#!/usr/bin/env python2
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
Create the pseudo potential for a given atom
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
put_pseudo_in_ezfio.py <ezfio_path> <pseudo_name> [<db_dump_path>]
|
|
||||||
|
|
||||||
Help:
|
|
||||||
atom is the Abreviation of the atom
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from docopt import docopt
|
|
||||||
|
|
||||||
from subprocess import Popen, PIPE
|
|
||||||
|
|
||||||
qpackage_root = os.environ['QP_ROOT']
|
|
||||||
|
|
||||||
EZFIO = "{0}/install/EZFIO".format(qpackage_root)
|
|
||||||
sys.path = [EZFIO + "/Python"] + sys.path
|
|
||||||
|
|
||||||
from ezfio import ezfio
|
|
||||||
|
|
||||||
import re
|
|
||||||
p = re.compile(ur'\|(\d+)><\d+\|')
|
|
||||||
|
|
||||||
|
|
||||||
def get_pseudo_str(db_dump_path,pseudo_name,l_atom):
|
|
||||||
"""
|
|
||||||
Run EMSL_local for getting the str of the pseudo potential
|
|
||||||
|
|
||||||
str_ele :
|
|
||||||
Element Symbol: Na
|
|
||||||
Number of replaced protons: 10
|
|
||||||
Number of projectors: 2
|
|
||||||
|
|
||||||
Pseudopotential data:
|
|
||||||
|
|
||||||
Local component:
|
|
||||||
Coeff. r^n Exp.
|
|
||||||
1.00000000 -1 5.35838717
|
|
||||||
5.35838717 1 3.67918975
|
|
||||||
-2.07764789 0 1.60507673
|
|
||||||
|
|
||||||
Non-local component:
|
|
||||||
Coeff. r^n Exp. Proj.
|
|
||||||
10.69640234 0 1.32389367 |0><0|
|
|
||||||
10.11238853 0 1.14052020 |1><1|
|
|
||||||
"""
|
|
||||||
|
|
||||||
EMSL_root = "{0}/install/emsl/".format(qpackage_root)
|
|
||||||
EMSL_path = "{0}/EMSL_api.py".format(EMSL_root)
|
|
||||||
|
|
||||||
str_ = ""
|
|
||||||
|
|
||||||
for a in l_atom:
|
|
||||||
|
|
||||||
if a is not 'X':
|
|
||||||
l_cmd_atom = ["--atom", a]
|
|
||||||
|
|
||||||
l_cmd_head = [EMSL_path, "get_basis_data",
|
|
||||||
"--db_dump_path", db_dump_path,
|
|
||||||
"--basis", pseudo_name]
|
|
||||||
|
|
||||||
process = Popen(l_cmd_head + l_cmd_atom, stdout=PIPE, stderr=PIPE)
|
|
||||||
|
|
||||||
stdout, _ = process.communicate()
|
|
||||||
str_ += stdout.strip() + "\n"
|
|
||||||
|
|
||||||
else: # Dummy atoms
|
|
||||||
str_ += """Element Symbol: X
|
|
||||||
Number of replaced protons: 0
|
|
||||||
Number of projectors: 0
|
|
||||||
|
|
||||||
Pseudopotential data:
|
|
||||||
|
|
||||||
Local component:
|
|
||||||
Coeff. r^n Exp.
|
|
||||||
0.0 -1 0.
|
|
||||||
0.0 1 0.
|
|
||||||
0.0 0 0.
|
|
||||||
|
|
||||||
Non-local component:
|
|
||||||
Coeff. r^n Exp. Proj.
|
|
||||||
"""
|
|
||||||
return str_
|
|
||||||
|
|
||||||
|
|
||||||
def get_v_n_dz_local(str_ele):
|
|
||||||
"""
|
|
||||||
From a str_ele of the pseudo (aka only one ele in the str)
|
|
||||||
get the list ussefull for the Local potential : v_k n_k and dz_k
|
|
||||||
"""
|
|
||||||
l_v_k = []
|
|
||||||
l_n_k = []
|
|
||||||
l_dz_k = []
|
|
||||||
|
|
||||||
for l in str_ele.splitlines():
|
|
||||||
try:
|
|
||||||
v, n, dz = l.split()
|
|
||||||
v = float(v)
|
|
||||||
n = int(n)
|
|
||||||
dz = float(dz)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
l_v_k.append(v)
|
|
||||||
l_n_k.append(n)
|
|
||||||
l_dz_k.append(dz)
|
|
||||||
|
|
||||||
return l_v_k, l_n_k, l_dz_k
|
|
||||||
|
|
||||||
|
|
||||||
def get_v_n_dz_l_nonlocal(str_ele):
|
|
||||||
"""
|
|
||||||
From a str_ele of the pseudo (aka only one ele in the str)
|
|
||||||
get the list ussefull for the non Local potential
|
|
||||||
v_kl (v, l)
|
|
||||||
n_k (v, l)
|
|
||||||
dz_k (dz ,l)
|
|
||||||
"""
|
|
||||||
l_v_kl = []
|
|
||||||
l_n_kl = []
|
|
||||||
l_dz_kl = []
|
|
||||||
|
|
||||||
for l in str_ele.splitlines():
|
|
||||||
try:
|
|
||||||
v, n, dz, proj = l.split()
|
|
||||||
v = float(v)
|
|
||||||
n = int(n)
|
|
||||||
dz = float(dz)
|
|
||||||
l = int(p.match(proj).group(1))
|
|
||||||
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
l_v_kl.append([v])
|
|
||||||
l_n_kl.append([n])
|
|
||||||
l_dz_kl.append([dz])
|
|
||||||
|
|
||||||
if not l_v_kl:
|
|
||||||
l_v_kl.append([0.])
|
|
||||||
l_n_kl.append([0])
|
|
||||||
l_dz_kl.append([0.])
|
|
||||||
|
|
||||||
return l_v_kl, l_n_kl, l_dz_kl
|
|
||||||
|
|
||||||
|
|
||||||
def get_zeff_alpha_beta(str_ele):
|
|
||||||
"""
|
|
||||||
Return the the zeff, alpha num elec and beta num elec
|
|
||||||
Assert ezfio_set_file alredy defined
|
|
||||||
"""
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
# ___
|
|
||||||
# | ._ o _|_
|
|
||||||
# _|_ | | | |_
|
|
||||||
#
|
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~ #
|
|
||||||
# s t r _ e l e #
|
|
||||||
# ~#~#~#~#~#~#~ #
|
|
||||||
|
|
||||||
# m = re.search('Element Symbol: ([a-zA-Z]+)', str_ele)
|
|
||||||
# name = m.group(1).capitalize()
|
|
||||||
name = str_ele.split("\n")[0].strip().capitalize()
|
|
||||||
|
|
||||||
m = re.search('Number of replaced protons: (\d+)', str_ele)
|
|
||||||
z_remove = int(m.group(1))
|
|
||||||
|
|
||||||
# _
|
|
||||||
# |_) _. ._ _ _
|
|
||||||
# | (_| | _> (/_
|
|
||||||
#
|
|
||||||
|
|
||||||
from elts_num_ele import name_to_elec
|
|
||||||
from math import ceil, floor
|
|
||||||
z = name_to_elec[name]
|
|
||||||
|
|
||||||
z_eff = z - z_remove
|
|
||||||
|
|
||||||
alpha = int(ceil(z_remove / 2.))
|
|
||||||
beta = int(floor(z_remove / 2.))
|
|
||||||
|
|
||||||
# Remove more alpha, than beta
|
|
||||||
|
|
||||||
# _
|
|
||||||
# |_) _ _|_ ._ ._
|
|
||||||
# | \ (/_ |_ |_| | | |
|
|
||||||
#
|
|
||||||
|
|
||||||
return [z_remove, z_eff, alpha, beta]
|
|
||||||
|
|
||||||
|
|
||||||
def add_zero(array, size, type):
|
|
||||||
for add in xrange(len(array), size):
|
|
||||||
array.append([type(0)])
|
|
||||||
|
|
||||||
return array
|
|
||||||
|
|
||||||
|
|
||||||
def make_it_square(matrix, dim, type=float):
|
|
||||||
"""
|
|
||||||
matix the matrix to square
|
|
||||||
dim array [lmax, kmax]
|
|
||||||
type the null value you want
|
|
||||||
[[[28.59107316], [19.37583724]], [[50.25646328]]]
|
|
||||||
=>
|
|
||||||
[[[28.59107316], [19.37583724]], [[50.25646328], [0.0]]]
|
|
||||||
"""
|
|
||||||
|
|
||||||
lmax = dim[0]
|
|
||||||
kmax = dim[1]
|
|
||||||
|
|
||||||
for l_list in matrix:
|
|
||||||
|
|
||||||
l_list = add_zero(l_list, lmax, type)
|
|
||||||
|
|
||||||
for k_list in list_:
|
|
||||||
k_list = add_zero(k_list, kmax, type)
|
|
||||||
|
|
||||||
return matrix
|
|
||||||
|
|
||||||
def full_path(path):
|
|
||||||
path = os.path.expanduser(path)
|
|
||||||
path = os.path.expandvars(path)
|
|
||||||
path = os.path.abspath(path)
|
|
||||||
return path
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
arguments = docopt(__doc__)
|
|
||||||
# ___
|
|
||||||
# | ._ o _|_
|
|
||||||
# _|_ | | | |_
|
|
||||||
#
|
|
||||||
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
# E Z F I O #
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
|
|
||||||
ezfio_path = full_path(arguments["<ezfio_path>"])
|
|
||||||
ezfio.set_file("{0}".format(ezfio_path))
|
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~ #
|
|
||||||
# P s e u d o _ d a t a #
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~ #
|
|
||||||
|
|
||||||
if arguments["<db_dump_path>"]:
|
|
||||||
db_dump_path = full_path(arguments["<db_dump_path>"])
|
|
||||||
else:
|
|
||||||
db_dump_path= full_path("{0}/data/BFD-Pseudo.dump".format(qpackage_root))
|
|
||||||
|
|
||||||
pseudo_name = arguments["<pseudo_name>"]
|
|
||||||
l_ele = ezfio.get_nuclei_nucl_label()
|
|
||||||
|
|
||||||
str_ = get_pseudo_str(db_dump_path,pseudo_name,l_ele)
|
|
||||||
|
|
||||||
# _
|
|
||||||
# |_) _. ._ _ _
|
|
||||||
# | (_| | _> (/_
|
|
||||||
#
|
|
||||||
|
|
||||||
l_str_ele = [str_ele for str_ele in str_.split("Element Symbol: ")
|
|
||||||
if str_ele]
|
|
||||||
|
|
||||||
for i in "l_zeff l_remove v_k n_k dz_k v_kl n_kl dz_kl".split():
|
|
||||||
exec("{0} = []".format(i))
|
|
||||||
|
|
||||||
alpha_tot = 0
|
|
||||||
beta_tot = 0
|
|
||||||
|
|
||||||
for str_ele in l_str_ele:
|
|
||||||
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
# S p l i t #
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
|
|
||||||
l = str_ele.find("Local component:")
|
|
||||||
nl = str_ele.find("Non-local component")
|
|
||||||
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
# L o c a l #
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
|
|
||||||
l_v, l_n, l_dz = get_v_n_dz_local(str_ele[l:nl])
|
|
||||||
|
|
||||||
v_k.append(l_v)
|
|
||||||
n_k.append(l_n)
|
|
||||||
dz_k.append(l_dz)
|
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~#~#~ #
|
|
||||||
# N o n _ L o c a l #
|
|
||||||
# ~#~#~#~#~#~#~#~#~ #
|
|
||||||
|
|
||||||
l_v_kl, l_n_kl, l_dz_kl = get_v_n_dz_l_nonlocal(str_ele[nl:])
|
|
||||||
|
|
||||||
v_kl.append(l_v_kl)
|
|
||||||
n_kl.append(l_n_kl)
|
|
||||||
dz_kl.append(l_dz_kl)
|
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
|
||||||
# Z _ e f f , a l p h a / b e t a _ e l e c #
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
|
||||||
|
|
||||||
zremove, zeff, alpha, beta = get_zeff_alpha_beta(str_ele)
|
|
||||||
|
|
||||||
alpha_tot += alpha
|
|
||||||
beta_tot += beta
|
|
||||||
l_zeff.append(zeff)
|
|
||||||
l_remove.append(zremove)
|
|
||||||
|
|
||||||
# _
|
|
||||||
# /\ _| _| _|_ _ _ _ _|_ o _
|
|
||||||
# /--\ (_| (_| |_ (_) (/_ /_ | | (_)
|
|
||||||
#
|
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
|
||||||
# Z _ e f f , a l p h a / b e t a _ e l e c #
|
|
||||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
|
||||||
|
|
||||||
ezfio.nuclei_nucl_charge = l_zeff
|
|
||||||
ezfio.pseudo_nucl_charge_remove = l_remove
|
|
||||||
|
|
||||||
alpha_tot = ezfio.get_electrons_elec_alpha_num() - alpha_tot
|
|
||||||
beta_tot = ezfio.get_electrons_elec_beta_num() - beta_tot
|
|
||||||
|
|
||||||
ezfio.electrons_elec_alpha_num = alpha_tot
|
|
||||||
ezfio.electrons_elec_beta_num = beta_tot
|
|
||||||
|
|
||||||
# Change all the array 'cause EZFIO
|
|
||||||
# v_kl (v, l) => v_kl(l,v)
|
|
||||||
# v_kl => zip(*_v_kl)
|
|
||||||
# [[7.0, 79.74474797, -49.45159098], [1.0, 5.41040609, -4.60151975]]
|
|
||||||
# [(7.0, 1.0), (79.74474797, 5.41040609), (-49.45159098, -4.60151975)]
|
|
||||||
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
# L o c a l #
|
|
||||||
# ~#~#~#~#~ #
|
|
||||||
|
|
||||||
klocmax = max([len(i) for i in v_k])
|
|
||||||
ezfio.pseudo_pseudo_klocmax = klocmax
|
|
||||||
|
|
||||||
ezfio.pseudo_pseudo_v_k = zip(*v_k)
|
|
||||||
ezfio.pseudo_pseudo_n_k = zip(*n_k)
|
|
||||||
ezfio.pseudo_pseudo_dz_k = zip(*dz_k)
|
|
||||||
|
|
||||||
# ~#~#~#~#~#~#~#~#~ #
|
|
||||||
# N o n _ L o c a l #
|
|
||||||
# ~#~#~#~#~#~#~#~#~ #
|
|
||||||
|
|
||||||
lmax = max([len(i) for i in v_kl])
|
|
||||||
kmax = max([len(sublist) for list_ in v_kl for sublist in list_])
|
|
||||||
|
|
||||||
ezfio.pseudo_pseudo_lmax = lmax - 1
|
|
||||||
ezfio.pseudo_pseudo_kmax = kmax
|
|
||||||
|
|
||||||
v_kl = make_it_square(v_kl, [lmax, kmax])
|
|
||||||
n_kl = make_it_square(n_kl, [lmax, kmax], int)
|
|
||||||
dz_kl = make_it_square(dz_kl, [lmax, kmax])
|
|
||||||
|
|
||||||
ezfio.pseudo_pseudo_v_kl = zip(*v_kl)
|
|
||||||
ezfio.pseudo_pseudo_n_kl = zip(*n_kl)
|
|
||||||
ezfio.pseudo_pseudo_dz_kl = zip(*dz_kl)
|
|
||||||
|
|
||||||
ezfio.pseudo_do_pseudo = True
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env python2
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
pipe = subprocess.Popen("git config --get remote.origin.url", \
|
|
||||||
shell=True, stdout=subprocess.PIPE)
|
|
||||||
result = pipe.stdout.read()
|
|
||||||
is_master_repository = "LCPQ/quantum_package" in result
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import sys
|
|
||||||
if is_master_repository:
|
|
||||||
sys.exit(0)
|
|
||||||
else:
|
|
||||||
sys.exit(-1)
|
|
Loading…
Reference in New Issue
Block a user