10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 23:22:18 +02:00

Merge branch 'master' of github.com:eginer/quantum_package

This commit is contained in:
Manu 2015-07-20 14:39:58 +02:00
commit 83c8b0c3f8
13 changed files with 326 additions and 308 deletions

View File

@ -1,17 +1,28 @@
sudo: true #sudo: true
# #before_script:
#cache: # - sudo apt-get update -q
# directories: # - sudo apt-get install gfortran liblapack-dev gcc
# - $HOME/.opam/ # - sudo apt-get install graphviz
sudo: false
addons:
apt:
packages:
- gfortran
- gcc
- liblapack-dev
- graphviz
cache:
directories:
- $HOME/.opam/
language: python language: python
python: python:
- "2.6" - "2.6"
before_script:
- sudo apt-get update -q
- sudo apt-get install gfortran liblapack-dev gcc
- sudo apt-get install graphviz
script: script:
- ./configure --production ./config/gfortran.cfg - ./configure --production ./config/gfortran.cfg

View File

@ -29,7 +29,17 @@ Documentation
Alpha Fock matrix in AO basis set Alpha Fock matrix in AO basis set
`create_guess <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L8>`_ `big <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/test.irp.f#L1>`_
Produce `Huckel` MO orbital
output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
Produce `Hartree_Fock` MO orbital
output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
output: hartree_fock.energy
input: mo_basis.mo_coef
Run SCF calculation
`create_guess <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L13>`_
Create an MO guess if no MOs are present in the EZFIO directory Create an MO guess if no MOs are present in the EZFIO directory
@ -139,12 +149,15 @@ Documentation
Maximum number of SCF iterations Maximum number of SCF iterations
`run <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L33>`_ `run <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L38>`_
Run SCF calculation Run SCF calculation
`scf <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L2>`_ `scf <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/SCF.irp.f#L1>`_
Undocumented Produce `Hartree_Fock` MO orbital
output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
output: hartree_fock.energy
optional: mo_basis.mo_coef
`thresh_scf <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/ezfio_interface.irp.f#L46>`_ `thresh_scf <http://github.com/LCPQ/quantum_package/tree/master/src/Hartree_Fock/ezfio_interface.irp.f#L46>`_

View File

@ -1,5 +1,10 @@
program scf program scf
BEGIN_DOC
! Produce `Hartree_Fock` MO orbital
! output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
! output: hartree_fock.energy
! optional: mo_basis.mo_coef
END_DOC
call create_guess call create_guess
call orthonormalize_mos call orthonormalize_mos
call run call run

View File

@ -12,15 +12,17 @@ subroutine huckel_guess
TOUCH mo_coef TOUCH mo_coef
label = "Guess" label = "Guess"
call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, & call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, &
size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label) size(mo_mono_elec_integral,1), &
size(mo_mono_elec_integral,2),label)
TOUCH mo_coef TOUCH mo_coef
c = 0.5d0 * 1.75d0 c = 0.5d0 * 1.75d0
do j=1,ao_num do j=1,ao_num
do i=1,ao_num do i=1,ao_num
if (i/=j) then if (i.ne.j) then
Fock_matrix_ao(i,j) = c*ao_overlap(i,j)*(ao_mono_elec_integral(i,i) + & Fock_matrix_ao(i,j) = c*ao_overlap(i,j)*(ao_mono_elec_integral(i,i) + &
ao_mono_elec_integral(j,j)) ao_mono_elec_integral(j,j))
else else
Fock_matrix_ao(i,j) = Fock_matrix_alpha_ao(i,j) Fock_matrix_ao(i,j) = Fock_matrix_alpha_ao(i,j)
endif endif

View File

@ -19,11 +19,14 @@ try:
from read_compilation_cfg import get_compilation_option from read_compilation_cfg import get_compilation_option
from docopt import docopt from docopt import docopt
except ImportError: except ImportError:
f = os.path.realpath(os.path.join(os.path.dirname(__file__),"..","..","quantum_package.rc")) f = os.path.realpath(os.path.join(os.path.dirname(__file__),
"..",
"..",
"quantum_package.rc"))
print """ print """
Error: Error:
source %s source %s
"""%f """ % f
sys.exit(1) sys.exit(1)
# __ # __
@ -311,8 +314,11 @@ def ninja_symlink_build(path_module, l_symlink):
if not l_symlink: if not l_symlink:
return [] return []
l_string = ["build l_symlink_{0} : phony {1}".format( l_folder = [s.destination for s in l_symlink]
path_module.rel, " ".join([s.destination for s in l_symlink])), ""]
l_string = ["build l_symlink_{0} : phony {1}".format(path_module.rel,
" ".join(l_folder)),
""]
for symlink in l_symlink: for symlink in l_symlink:
l_string += ["build {0}: build_symlink {1}".format(symlink.destination, l_string += ["build {0}: build_symlink {1}".format(symlink.destination,
@ -334,20 +340,22 @@ def ninja_gitignore_rule():
" description = Create gitignore for $module_rel", ""] " description = Create gitignore for $module_rel", ""]
def ninja_gitignore_build(path_module, d_binaries): def ninja_gitignore_build(path_module, d_binaries, l_symlink):
""" """
""" """
path_gitignore = join(path_module.abs, ".gitignore") path_gitignore = join(path_module.abs, ".gitignore")
l_b = [i.abs for i in d_binaries[path_module]] l_b = [i.abs for i in d_binaries[path_module]]
l_sym = [i.destination for i in l_symlink]
l_string = ["build {0}: build_gitignore {1} || l_symlink_{2}".format(path_gitignore, root = "build {0}: build_gitignore {1}".format(path_gitignore,
" ".join(l_b), " ".join(l_b))
path_module.rel), if l_symlink:
" module_rel = {0}".format(path_module.rel), l_string = ["{0} || l_symlink_{1}".format(root, path_module.rel)]
""] else:
l_string = ["{0}".format(root)]
l_string.extend((" module_rel = {0}".format(path_module.rel), ""))
return l_string return l_string
@ -909,7 +917,8 @@ if __name__ == "__main__":
l_string += ninja_binaries_build(module_to_compile, l_children, l_string += ninja_binaries_build(module_to_compile, l_children,
d_binaries) d_binaries)
l_string += ninja_gitignore_build(module_to_compile, d_binaries) l_string += ninja_gitignore_build(module_to_compile, d_binaries,
l_symlink)
with open(join(QP_ROOT, "config", "build.ninja"), "w+") as f: with open(join(QP_ROOT, "config", "build.ninja"), "w+") as f:
f.write(header) f.write(header)

View File

@ -86,6 +86,7 @@ from os.path import isdir, join, exists
from qp_path import QP_ROOT, QP_SRC, QP_OCAML, QP_EZFIO from qp_path import QP_ROOT, QP_SRC, QP_OCAML, QP_EZFIO
Type = namedtuple('Type', 'fancy ocaml fortran') Type = namedtuple('Type', 'fancy ocaml fortran')
Module = namedtuple('Module', 'path lower')
def is_bool(str_): def is_bool(str_):
@ -789,8 +790,6 @@ if __name__ == "__main__":
l_module_with_ezfio = [] l_module_with_ezfio = []
Module = namedtuple('Module', 'path lower')
for f in l_module: for f in l_module:
path = join(QP_SRC, f, "EZFIO.cfg") path = join(QP_SRC, f, "EZFIO.cfg")
if exists(path): if exists(path):

View File

@ -174,8 +174,16 @@ class ModuleHandler():
def create_png(self, l_module): def create_png(self, l_module):
"""Create the png of the dependency tree for a l_module""" """Create the png of the dependency tree for a l_module"""
path = '{0}.png'.format("tree_dependency")
# Init # Init
import pydot try:
import pydot
except:
with open(path, 'a'):
os.utime(path, None)
return
all_ready_done = [] all_ready_done = []
def draw_module_edge(module, l_children): def draw_module_edge(module, l_children):
@ -190,16 +198,7 @@ class ModuleHandler():
draw_module_edge(children, d_ref[children]) draw_module_edge(children, d_ref[children])
all_ready_done.append(module) all_ready_done.append(module)
path = '{0}.png'.format("tree_dependency") graph = pydot.Dot(graph_type='digraph')
# Init
try:
graph = pydot.Dot(graph_type='digraph')
except:
with open(path, 'a'):
os.utime(path, None)
return
d_ref = self.dict_child d_ref = self.dict_child
# Create all the edge # Create all the edge

View File

@ -16,6 +16,7 @@ Options:
import sys import sys
import os import os
import subprocess
try: try:
from docopt import docopt from docopt import docopt
@ -152,6 +153,11 @@ if __name__ == '__main__':
except OSError: except OSError:
print "Your src directory is broken. Please remove %s" % des print "Your src directory is broken. Please remove %s" % des
raise raise
try:
import subprocess
subprocess.check_call(["qp_create_ninja.py", "update"])
except:
raise
print "Done" print "Done"
print "You can now compile as usual" print "You can now compile as usual"
@ -164,24 +170,29 @@ if __name__ == '__main__':
l_name = arguments["<name>"] l_name = arguments["<name>"]
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 "Modules 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)
if arguments["--and_ancestor"]:
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 l_name_to_remove
else: else:
if arguments["--and_ancestor"]: l_name_to_remove = l_name
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]] for module in l_name_to_remove:
print "You will remove all of:"
print l_name_to_remove
else: try:
l_name_to_remove = l_name subprocess.check_call(["module_handler.py", "clean", module])
except:
raise
def unlink(x): try:
try: os.unlink(os.path.join(QP_SRC, module))
os.unlink(os.path.join(QP_SRC, x)) except OSError:
except OSError: print "%s is a core module which can not be renmoved" % x
print "%s is a core module which can not be renmoved" % x
map(unlink, l_name_to_remove)

View File

@ -26,130 +26,157 @@ import re
import subprocess import subprocess
import tempfile import tempfile
import copy import copy
import sys import dot_parser
try: GRAPH_ATTRIBUTES = set(['Damping',
import dot_parser 'K',
except Exception as e: 'URL',
pass 'aspect',
# print >> sys.stderr, "Couldn't import dot_parser, loading of dot files will not be possible." 'bb',
'bgcolor',
'center',
GRAPH_ATTRIBUTES = set(['Damping', 'K', 'URL', 'aspect', 'bb', 'bgcolor', 'charset',
'center', 'charset', 'clusterrank', 'colorscheme', 'comment', 'compound', 'clusterrank',
'concentrate', 'defaultdist', 'dim', 'dimen', 'diredgeconstraints', 'colorscheme',
'dpi', 'epsilon', 'esep', 'fontcolor', 'fontname', 'fontnames', 'comment',
'fontpath', 'fontsize', 'id', 'label', 'labeljust', 'labelloc', 'compound',
'landscape', 'layers', 'layersep', 'layout', 'levels', 'levelsgap', 'concentrate',
'lheight', 'lp', 'lwidth', 'margin', 'maxiter', 'mclimit', 'mindist', 'defaultdist',
'mode', 'model', 'mosek', 'nodesep', 'nojustify', 'normalize', 'nslimit', 'dim',
'nslimit1', 'ordering', 'orientation', 'outputorder', 'overlap', 'dimen',
'overlap_scaling', 'pack', 'packmode', 'pad', 'page', 'pagedir', 'diredgeconstraints',
'quadtree', 'quantum', 'rankdir', 'ranksep', 'ratio', 'remincross', 'dpi',
'repulsiveforce', 'resolution', 'root', 'rotate', 'searchsize', 'sep', 'epsilon',
'showboxes', 'size', 'smoothing', 'sortv', 'splines', 'start', 'esep',
'stylesheet', 'target', 'truecolor', 'viewport', 'voro_margin', 'fontcolor',
'fontname',
'fontnames',
'fontpath',
'fontsize',
'id',
'label',
'labeljust',
'labelloc',
'landscape',
'layers',
'layersep',
'layout',
'levels',
'levelsgap',
'lheight',
'lp',
'lwidth',
'margin',
'maxiter',
'mclimit',
'mindist',
'mode',
'model',
'mosek',
'nodesep',
'nojustify',
'normalize',
'nslimit',
'nslimit1',
'ordering',
'orientation',
'outputorder',
'overlap',
'overlap_scaling',
'pack',
'packmode',
'pad',
'page',
'pagedir',
'quadtree',
'quantum',
'rankdir',
'ranksep',
'ratio',
'remincross',
'repulsiveforce',
'resolution',
'root',
'rotate',
'searchsize',
'sep',
'showboxes',
'size',
'smoothing',
'sortv',
'splines',
'start',
'stylesheet',
'target',
'truecolor',
'viewport',
'voro_margin',
# for subgraphs # for subgraphs
'rank']) 'rank'])
EDGE_ATTRIBUTES = set(
['URL', 'arrowhead', 'arrowsize', 'arrowtail', 'color', 'colorscheme',
'comment', 'constraint', 'decorate', 'dir', 'edgeURL', 'edgehref',
'edgetarget', 'edgetooltip', 'fontcolor', 'fontname', 'fontsize',
'headURL', 'headclip', 'headhref', 'headlabel', 'headport', 'headtarget',
'headtooltip', 'href', 'id', 'label', 'labelURL', 'labelangle',
'labeldistance', 'labelfloat', 'labelfontcolor', 'labelfontname',
'labelfontsize', 'labelhref', 'labeltarget', 'labeltooltip', 'layer',
'len', 'lhead', 'lp', 'ltail', 'minlen', 'nojustify', 'penwidth', 'pos',
'samehead', 'sametail', 'showboxes', 'style', 'tailURL', 'tailclip',
'tailhref', 'taillabel', 'tailport', 'tailtarget', 'tailtooltip',
'target', 'tooltip', 'weight', 'rank'])
EDGE_ATTRIBUTES = set(['URL', NODE_ATTRIBUTES = set(['URL',
'arrowhead',
'arrowsize',
'arrowtail',
'color', 'color',
'colorscheme', 'colorscheme',
'comment', 'comment',
'constraint', 'distortion',
'decorate', 'fillcolor',
'dir', 'fixedsize',
'edgeURL',
'edgehref',
'edgetarget',
'edgetooltip',
'fontcolor', 'fontcolor',
'fontname', 'fontname',
'fontsize', 'fontsize',
'headURL', 'group',
'headclip', 'height',
'headhref',
'headlabel',
'headport',
'headtarget',
'headtooltip',
'href',
'id', 'id',
'image',
'imagescale',
'label', 'label',
'labelURL', 'labelloc',
'labelangle',
'labeldistance',
'labelfloat',
'labelfontcolor',
'labelfontname',
'labelfontsize',
'labelhref',
'labeltarget',
'labeltooltip',
'layer', 'layer',
'len', 'margin',
'lhead',
'lp',
'ltail',
'minlen',
'nojustify', 'nojustify',
'orientation',
'penwidth', 'penwidth',
'peripheries',
'pin',
'pos', 'pos',
'samehead', 'rects',
'sametail', 'regular',
'root',
'samplepoints',
'shape',
'shapefile',
'showboxes', 'showboxes',
'sides',
'skew',
'sortv',
'style', 'style',
'tailURL',
'tailclip',
'tailhref',
'taillabel',
'tailport',
'tailtarget',
'tailtooltip',
'target', 'target',
'tooltip', 'tooltip',
'weight', 'vertices',
'rank']) 'width',
'z',
NODE_ATTRIBUTES = set(['URL', 'color', 'colorscheme', 'comment',
'distortion', 'fillcolor', 'fixedsize', 'fontcolor', 'fontname',
'fontsize', 'group', 'height', 'id', 'image', 'imagescale', 'label',
'labelloc', 'layer', 'margin', 'nojustify', 'orientation', 'penwidth',
'peripheries', 'pin', 'pos', 'rects', 'regular', 'root', 'samplepoints',
'shape', 'shapefile', 'showboxes', 'sides', 'skew', 'sortv', 'style',
'target', 'tooltip', 'vertices', 'width', 'z',
# The following are attributes dot2tex # The following are attributes dot2tex
'texlbl', 'texmode']) 'texlbl',
'texmode'])
CLUSTER_ATTRIBUTES = set(
CLUSTER_ATTRIBUTES = set(['K', ['K', 'URL', 'bgcolor', 'color', 'colorscheme', 'fillcolor', 'fontcolor',
'URL', 'fontname', 'fontsize', 'label', 'labeljust', 'labelloc', 'lheight', 'lp',
'bgcolor', 'lwidth', 'nojustify', 'pencolor', 'penwidth', 'peripheries', 'sortv',
'color', 'style', 'target', 'tooltip'])
'colorscheme',
'fillcolor',
'fontcolor',
'fontname',
'fontsize',
'label',
'labeljust',
'labelloc',
'lheight',
'lp',
'lwidth',
'nojustify',
'pencolor',
'penwidth',
'peripheries',
'sortv',
'style',
'target',
'tooltip'])
# #
@ -160,9 +187,9 @@ CLUSTER_ATTRIBUTES = set(['K',
# This version freezes dictionaries used as values within dictionaries. # This version freezes dictionaries used as values within dictionaries.
# #
class frozendict(dict): class frozendict(dict):
def _blocked_attribute(obj): def _blocked_attribute(obj):
raise AttributeError("A frozendict cannot be modified.") raise AttributeError("A frozendict cannot be modified.")
_blocked_attribute = property(_blocked_attribute) _blocked_attribute = property(_blocked_attribute)
__delitem__ = __setitem__ = clear = _blocked_attribute __delitem__ = __setitem__ = clear = _blocked_attribute
@ -213,8 +240,7 @@ dot_keywords = ['graph', 'subgraph', 'digraph', 'node', 'edge', 'strict']
id_re_alpha_nums = re.compile('^[_a-zA-Z][a-zA-Z0-9_,]*$', re.UNICODE) id_re_alpha_nums = re.compile('^[_a-zA-Z][a-zA-Z0-9_,]*$', re.UNICODE)
id_re_alpha_nums_with_ports = re.compile( id_re_alpha_nums_with_ports = re.compile(
'^[_a-zA-Z][a-zA-Z0-9_,:\"]*[a-zA-Z0-9_,\"]+$', '^[_a-zA-Z][a-zA-Z0-9_,:\"]*[a-zA-Z0-9_,\"]+$', re.UNICODE)
re.UNICODE)
id_re_num = re.compile('^[0-9,]+$', re.UNICODE) id_re_num = re.compile('^[0-9,]+$', re.UNICODE)
id_re_with_port = re.compile('^([^:]*):([^:]*)$', re.UNICODE) id_re_with_port = re.compile('^([^:]*):([^:]*)$', re.UNICODE)
id_re_dbl_quoted = re.compile('^\".*\"$', re.S | re.UNICODE) id_re_dbl_quoted = re.compile('^\".*\"$', re.S | re.UNICODE)
@ -245,11 +271,9 @@ def needs_quotes(s):
return True return True
for test_re in [ for test_re in [
id_re_alpha_nums, id_re_alpha_nums, id_re_num, id_re_dbl_quoted, id_re_html,
id_re_num, id_re_alpha_nums_with_ports
id_re_dbl_quoted, ]:
id_re_html,
id_re_alpha_nums_with_ports]:
if test_re.match(s): if test_re.match(s):
return False return False
@ -274,9 +298,7 @@ def quote_if_necessary(s):
return s return s
if needs_quotes(s): if needs_quotes(s):
replace = {'"': r'\"', replace = {'"': r'\"', "\n": r'\n', "\r": r'\r'}
"\n": r'\n',
"\r": r'\r'}
for (a, b) in replace.items(): for (a, b) in replace.items():
s = s.replace(a, b) s = s.replace(a, b)
@ -374,8 +396,7 @@ def graph_from_adjacency_matrix(matrix, node_prefix=u'', directed=False):
for e in r: for e in r:
if e: if e:
graph.add_edge( graph.add_edge(
Edge(node_prefix + node_orig, Edge(node_prefix + node_orig, node_prefix + node_dest))
node_prefix + node_dest))
node_dest += 1 node_dest += 1
node_orig += 1 node_orig += 1
@ -410,8 +431,7 @@ def graph_from_incidence_matrix(matrix, node_prefix='', directed=False):
if len(nodes) == 2: if len(nodes) == 2:
graph.add_edge( graph.add_edge(
Edge(node_prefix + abs(nodes[0]), Edge(node_prefix + abs(nodes[0]), node_prefix + nodes[1]))
node_prefix + nodes[1]))
if not directed: if not directed:
graph.set_simplify(True) graph.set_simplify(True)
@ -437,7 +457,8 @@ def __find_executables(path):
'neato': '', 'neato': '',
'circo': '', 'circo': '',
'fdp': '', 'fdp': '',
'sfdp': ''} 'sfdp': ''
}
was_quoted = False was_quoted = False
path = path.strip() path = path.strip()
@ -533,11 +554,7 @@ def find_graphviz():
def RegOpenKeyEx(key, subkey, opt, sam): def RegOpenKeyEx(key, subkey, opt, sam):
result = ctypes.c_uint(0) result = ctypes.c_uint(0)
ctypes.windll.advapi32.RegOpenKeyExA( ctypes.windll.advapi32.RegOpenKeyExA(
key, key, subkey, opt, sam, ctypes.byref(result))
subkey,
opt,
sam,
ctypes.byref(result))
return result.value return result.value
def RegQueryValueEx(hkey, valuename): def RegQueryValueEx(hkey, valuename):
@ -546,11 +563,7 @@ def find_graphviz():
data = ctypes.create_string_buffer(1024) data = ctypes.create_string_buffer(1024)
res = ctypes.windll.advapi32.RegQueryValueExA( res = ctypes.windll.advapi32.RegQueryValueExA(
hkey, hkey, valuename, 0, ctypes.byref(data_type), data,
valuename,
0,
ctypes.byref(data_type),
data,
ctypes.byref(data_len)) ctypes.byref(data_len))
return data.value return data.value
@ -574,8 +587,8 @@ def find_graphviz():
for potentialKey in potentialKeys: for potentialKey in potentialKeys:
try: try:
hkey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, hkey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, potentialKey, 0,
potentialKey, 0, KEY_QUERY_VALUE) KEY_QUERY_VALUE)
if hkey is not None: if hkey is not None:
path = RegQueryValueEx(hkey, "InstallPath") path = RegQueryValueEx(hkey, "InstallPath")
@ -625,10 +638,7 @@ def find_graphviz():
# information, but win32api may not be installed. # information, but win32api may not be installed.
path = os.path.join( path = os.path.join(
os.environ['PROGRAMFILES'], os.environ['PROGRAMFILES'], 'ATT', 'GraphViz', 'bin')
'ATT',
'GraphViz',
'bin')
else: else:
@ -643,10 +653,8 @@ def find_graphviz():
return progs return progs
for path in ( for path in (
'/usr/bin', '/usr/local/bin', '/usr/bin', '/usr/local/bin', '/opt/local/bin', '/opt/bin', '/sw/bin',
'/opt/local/bin', '/usr/share', '/Applications/Graphviz.app/Contents/MacOS/'):
'/opt/bin', '/sw/bin', '/usr/share',
'/Applications/Graphviz.app/Contents/MacOS/'):
progs = __find_executables(path) progs = __find_executables(path)
if progs is not None: if progs is not None:
@ -659,7 +667,6 @@ def find_graphviz():
class Common: class Common:
"""Common information to several classes. """Common information to several classes.
Should not be directly used, several classes are derived from Should not be directly used, several classes are derived from
@ -771,22 +778,17 @@ class Common:
# Generate all the Setter methods. # Generate all the Setter methods.
# #
self.__setattr__( self.__setattr__(
'set_' + 'set_' + attr,
attr, lambda x, a=attr: self.obj_dict['attributes'].__setitem__(
lambda x, a, x))
a=attr: self.obj_dict['attributes'].__setitem__(
a,
x))
# Generate all the Getter methods. # Generate all the Getter methods.
# #
self.__setattr__( self.__setattr__(
'get_' + attr, 'get_' + attr, lambda a=attr: self.__get_attribute__(a))
lambda a=attr: self.__get_attribute__(a))
class Error(Exception): class Error(Exception):
"""General error handling class. """General error handling class.
""" """
@ -798,7 +800,6 @@ class Error(Exception):
class InvocationException(Exception): class InvocationException(Exception):
"""To indicate that a ploblem occurred while running any of the GraphViz executables. """To indicate that a ploblem occurred while running any of the GraphViz executables.
""" """
@ -810,7 +811,6 @@ class InvocationException(Exception):
class Node(object, Common): class Node(object, Common):
"""A graph node. """A graph node.
This class represents a graph's node with all its attributes. This class represents a graph's node with all its attributes.
@ -919,7 +919,6 @@ class Node(object, Common):
class Edge(object, Common): class Edge(object, Common):
"""A graph edge. """A graph edge.
This class represents a graph's edge with all its attributes. This class represents a graph's edge with all its attributes.
@ -1011,8 +1010,10 @@ class Edge(object, Common):
# If the graph is undirected, the edge has neither # If the graph is undirected, the edge has neither
# source nor destination. # source nor destination.
# #
if ((self.get_source() == edge.get_source() and self.get_destination() == edge.get_destination()) or ( if ((self.get_source() == edge.get_source() and
edge.get_source() == self.get_destination() and edge.get_destination() == self.get_source())): self.get_destination() == edge.get_destination()) or (
edge.get_source() == self.get_destination() and
edge.get_destination() == self.get_source())):
return True return True
else: else:
@ -1035,8 +1036,8 @@ class Edge(object, Common):
node_port_idx = node_str.rfind(':') node_port_idx = node_str.rfind(':')
if node_port_idx > 0 and node_str[0] == '"' and node_str[ if node_port_idx > 0 and node_str[0] == '"' and node_str[
node_port_idx - node_port_idx - 1
1] == '"': ] == '"':
return node_str return node_str
@ -1068,8 +1069,8 @@ class Edge(object, Common):
edge = [src] edge = [src]
if (self.get_parent_graph() and if (self.get_parent_graph() and
self.get_parent_graph().get_top_graph_type() and self.get_parent_graph().get_top_graph_type() and
self.get_parent_graph().get_top_graph_type() == 'digraph'): self.get_parent_graph().get_top_graph_type() == 'digraph'):
edge.append('->') edge.append('->')
@ -1101,7 +1102,6 @@ class Edge(object, Common):
class Graph(object, Common): class Graph(object, Common):
"""Class representing a graph in Graphviz's dot language. """Class representing a graph in Graphviz's dot language.
This class implements the methods to work on a representation This class implements the methods to work on a representation
@ -1138,14 +1138,13 @@ class Graph(object, Common):
""" """
def __init__( def __init__(
self, self,
graph_name='G', graph_name='G',
obj_dict=None, obj_dict=None,
graph_type='digraph', graph_type='digraph',
strict=False, strict=False,
suppress_disconnected=False, suppress_disconnected=False,
simplify=False, simplify=False, **attrs):
**attrs):
if obj_dict is not None: if obj_dict is not None:
self.obj_dict = obj_dict self.obj_dict = obj_dict
@ -1158,8 +1157,8 @@ class Graph(object, Common):
if graph_type not in ['graph', 'digraph']: if graph_type not in ['graph', 'digraph']:
raise Error( raise Error(
'Invalid type "%s". Accepted graph types are: graph, digraph, subgraph' % 'Invalid type "%s". Accepted graph types are: graph, digraph, subgraph'
graph_type) % graph_type)
self.obj_dict['name'] = quote_if_necessary(graph_name) self.obj_dict['name'] = quote_if_necessary(graph_name)
self.obj_dict['type'] = graph_type self.obj_dict['type'] = graph_type
@ -1328,17 +1327,17 @@ class Graph(object, Common):
if not node: if not node:
self.obj_dict['nodes'][ self.obj_dict['nodes'][
graph_node.get_name()] = [ graph_node.get_name()
graph_node.obj_dict] ] = [
graph_node.obj_dict
]
#self.node_dict[graph_node.get_name()] = graph_node.attributes #self.node_dict[graph_node.get_name()] = graph_node.attributes
graph_node.set_parent_graph(self.get_parent_graph()) graph_node.set_parent_graph(self.get_parent_graph())
else: else:
self.obj_dict['nodes'][ self.obj_dict['nodes'][graph_node.get_name()].append(graph_node.obj_dict)
graph_node.get_name()].append(
graph_node.obj_dict)
graph_node.set_sequence(self.get_next_sequence_number()) graph_node.set_sequence(self.get_next_sequence_number())
@ -1474,7 +1473,8 @@ class Graph(object, Common):
if index is not None and index < len( if index is not None and index < len(
self.obj_dict['edges'][ self.obj_dict['edges'][
(src, dst)]): (src, dst)
]):
del self.obj_dict['edges'][(src, dst)][index] del self.obj_dict['edges'][(src, dst)][index]
return True return True
else: else:
@ -1504,7 +1504,8 @@ class Graph(object, Common):
match = list() match = list()
if edge_points in self.obj_dict['edges'] or ( if edge_points in self.obj_dict['edges'] or (
self.get_top_graph_type() == 'graph' and edge_points_reverse in self.obj_dict['edges']): self.get_top_graph_type() == 'graph' and
edge_points_reverse in self.obj_dict['edges']):
edges_obj_dict = self.obj_dict['edges'].get( edges_obj_dict = self.obj_dict['edges'].get(
edge_points, edge_points,
@ -1513,8 +1514,7 @@ class Graph(object, Common):
for edge_obj_dict in edges_obj_dict: for edge_obj_dict in edges_obj_dict:
match.append( match.append(
Edge( Edge(
edge_points[0], edge_points[0], edge_points[1],
edge_points[1],
obj_dict=edge_obj_dict)) obj_dict=edge_obj_dict))
return match return match
@ -1544,10 +1544,8 @@ class Graph(object, Common):
""" """
if not isinstance( if not isinstance(
sgraph, sgraph, Subgraph) and not isinstance(
Subgraph) and not isinstance( sgraph, Cluster):
sgraph,
Cluster):
raise TypeError( raise TypeError(
'add_subgraph() received a non subgraph class object:' + 'add_subgraph() received a non subgraph class object:' +
str(sgraph)) str(sgraph))
@ -1638,14 +1636,14 @@ class Graph(object, Common):
if self.obj_dict['name'] == '': if self.obj_dict['name'] == '':
if 'show_keyword' in self.obj_dict and self.obj_dict[ if 'show_keyword' in self.obj_dict and self.obj_dict[
'show_keyword']: 'show_keyword'
]:
graph.append('subgraph {\n') graph.append('subgraph {\n')
else: else:
graph.append('{\n') graph.append('{\n')
else: else:
graph.append( graph.append(
'%s %s {\n' % '%s %s {\n' % (self.obj_dict['type'], self.obj_dict['name']))
(self.obj_dict['type'], self.obj_dict['name']))
for attr in self.obj_dict['attributes'].iterkeys(): for attr in self.obj_dict['attributes'].iterkeys():
@ -1692,7 +1690,7 @@ class Graph(object, Common):
if self.obj_dict.get('suppress_disconnected', False): if self.obj_dict.get('suppress_disconnected', False):
if (node.get_name() not in edge_src_set and if (node.get_name() not in edge_src_set and
node.get_name() not in edge_dst_set): node.get_name() not in edge_dst_set):
continue continue
@ -1720,7 +1718,6 @@ class Graph(object, Common):
class Subgraph(Graph): class Subgraph(Graph):
"""Class representing a subgraph in Graphviz's dot language. """Class representing a subgraph in Graphviz's dot language.
This class implements the methods to work on a representation This class implements the methods to work on a representation
@ -1752,20 +1749,18 @@ class Subgraph(Graph):
# as a graph to all methods # as a graph to all methods
# #
def __init__( def __init__(
self, self,
graph_name='', graph_name='',
obj_dict=None, obj_dict=None,
suppress_disconnected=False, suppress_disconnected=False,
simplify=False, simplify=False, **attrs):
**attrs):
Graph.__init__( Graph.__init__(
self, self,
graph_name=graph_name, graph_name=graph_name,
obj_dict=obj_dict, obj_dict=obj_dict,
suppress_disconnected=suppress_disconnected, suppress_disconnected=suppress_disconnected,
simplify=simplify, simplify=simplify, **attrs)
**attrs)
if obj_dict is None: if obj_dict is None:
@ -1773,7 +1768,6 @@ class Subgraph(Graph):
class Cluster(Graph): class Cluster(Graph):
"""Class representing a cluster in Graphviz's dot language. """Class representing a cluster in Graphviz's dot language.
This class implements the methods to work on a representation This class implements the methods to work on a representation
@ -1802,20 +1796,18 @@ class Cluster(Graph):
""" """
def __init__( def __init__(
self, self,
graph_name='subG', graph_name='subG',
obj_dict=None, obj_dict=None,
suppress_disconnected=False, suppress_disconnected=False,
simplify=False, simplify=False, **attrs):
**attrs):
Graph.__init__( Graph.__init__(
self, self,
graph_name=graph_name, graph_name=graph_name,
obj_dict=obj_dict, obj_dict=obj_dict,
suppress_disconnected=suppress_disconnected, suppress_disconnected=suppress_disconnected,
simplify=simplify, simplify=simplify, **attrs)
**attrs)
if obj_dict is None: if obj_dict is None:
@ -1826,7 +1818,6 @@ class Cluster(Graph):
class Dot(Graph): class Dot(Graph):
"""A container for handling a dot language file. """A container for handling a dot language file.
This class implements methods to write and process This class implements methods to write and process
@ -1842,42 +1833,12 @@ class Dot(Graph):
self.progs = None self.progs = None
self.formats = [ self.formats = [
'canon', 'canon', 'cmap', 'cmapx', 'cmapx_np', 'dia', 'dot', 'fig', 'gd',
'cmap', 'gd2', 'gif', 'hpgl', 'imap', 'imap_np', 'ismap', 'jpe', 'jpeg',
'cmapx', 'jpg', 'mif', 'mp', 'pcl', 'pdf', 'pic', 'plain', 'plain-ext',
'cmapx_np', 'png', 'ps', 'ps2', 'svg', 'svgz', 'vml', 'vmlz', 'vrml', 'vtx',
'dia', 'wbmp', 'xdot', 'xlib'
'dot', ]
'fig',
'gd',
'gd2',
'gif',
'hpgl',
'imap',
'imap_np',
'ismap',
'jpe',
'jpeg',
'jpg',
'mif',
'mp',
'pcl',
'pdf',
'pic',
'plain',
'plain-ext',
'png',
'ps',
'ps2',
'svg',
'svgz',
'vml',
'vmlz',
'vrml',
'vtx',
'wbmp',
'xdot',
'xlib']
self.prog = 'dot' self.prog = 'dot'
@ -1885,9 +1846,7 @@ class Dot(Graph):
# of output in any of the supported formats. # of output in any of the supported formats.
for frmt in self.formats: for frmt in self.formats:
self.__setattr__( self.__setattr__(
'create_' + frmt, 'create_' + frmt, lambda f=frmt, prog=self.prog: self.create(
lambda f=frmt,
prog=self.prog: self.create(
format=f, format=f,
prog=prog)) prog=prog))
f = self.__dict__['create_' + frmt] f = self.__dict__['create_' + frmt]
@ -1896,9 +1855,7 @@ class Dot(Graph):
for frmt in self.formats + ['raw']: for frmt in self.formats + ['raw']:
self.__setattr__( self.__setattr__(
'write_' + frmt, 'write_' + frmt,
lambda path, lambda path, f=frmt, prog=self.prog: self.write(
f=frmt,
prog=self.prog: self.write(
path, path,
format=f, format=f,
prog=prog)) prog=prog))
@ -2036,15 +1993,14 @@ class Dot(Graph):
if self.progs is None: if self.progs is None:
self.progs = find_graphviz() self.progs = find_graphviz()
if self.progs is None: if self.progs is None:
raise InvocationException( raise InvocationException('GraphViz\'s executables not found')
'GraphViz\'s executables not found')
if prog not in self.progs: if prog not in self.progs:
raise InvocationException( raise InvocationException(
'GraphViz\'s executable "%s" not found' % prog) 'GraphViz\'s executable "%s" not found' % prog)
if not os.path.exists( if not os.path.exists(
self.progs[prog]) or not os.path.isfile( self.progs[prog]) or not os.path.isfile(
self.progs[prog]): self.progs[prog]):
raise InvocationException( raise InvocationException(
'GraphViz\'s executable "%s" is not a file or doesn\'t exist' % 'GraphViz\'s executable "%s" is not a file or doesn\'t exist' %
@ -2076,7 +2032,8 @@ class Dot(Graph):
p = subprocess.Popen( p = subprocess.Popen(
cmdline, cmdline,
cwd=tmp_dir, cwd=tmp_dir,
stderr=subprocess.PIPE, stdout=subprocess.PIPE) stderr=subprocess.PIPE,
stdout=subprocess.PIPE)
stderr = p.stderr stderr = p.stderr
stdout = p.stdout stdout = p.stdout
@ -2109,7 +2066,8 @@ class Dot(Graph):
if status != 0: if status != 0:
raise InvocationException( raise InvocationException(
'Program terminated with status: %d. stderr follows: %s' % ( 'Program terminated with status: %d. stderr follows: %s' % (
status, stderr_output)) status, stderr_output
))
elif stderr_output: elif stderr_output:
print stderr_output print stderr_output

View File

@ -9,4 +9,5 @@ Makefile.depend
build.ninja build.ninja
.ninja_log .ninja_log
.ninja_deps .ninja_deps
ezfio_interface.irp.f ezfio_interface.irp.f
README.rst

View File

@ -4,7 +4,7 @@ Ezfio_files Module
This modules essentially contains the name of the EZFIO directory in the This modules essentially contains the name of the EZFIO directory in the
``ezfio_filename`` variable. This is read as the first argument of the ``ezfio_filename`` variable. This is read as the first argument of the
command-line, or as the ``QPACKAGE_INPUT`` environment variable. command-line, or as the ``QP_INPUT`` environment variable.
Documentation Documentation
============= =============

View File

@ -1,11 +1,16 @@
program H_CORE_guess program H_CORE_guess
BEGIN_DOC
! Produce `H_core` MO orbital
! output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
END_DOC
implicit none implicit none
character*(64) :: label character*(64) :: label
mo_coef = ao_ortho_lowdin_coef mo_coef = ao_ortho_lowdin_coef
TOUCH mo_coef TOUCH mo_coef
label = "Guess" label = "Guess"
call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, & call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, &
size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label) size(mo_mono_elec_integral,1), &
size(mo_mono_elec_integral,2),label)
print *, 'save mos' print *, 'save mos'
call save_mos call save_mos

View File

@ -34,5 +34,10 @@ Documentation
`h_core_guess <http://github.com/LCPQ/quantum_package/tree/master/src/MOGuess/H_CORE_guess.irp.f#L1>`_ `h_core_guess <http://github.com/LCPQ/quantum_package/tree/master/src/MOGuess/H_CORE_guess.irp.f#L1>`_
Undocumented Produce `H_core` MO orbital
output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ
`hcore_guess <http://github.com/LCPQ/quantum_package/tree/master/src/MOGuess/h_core_guess_routine.irp.f#L1>`_
Produce `H_core` MO orbital