From 028b56d0409d2d2fbef2329c9afeff618590cbd9 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Fri, 3 Jul 2015 14:32:22 +0200 Subject: [PATCH 1/7] Remove Ezfio_files/README.rst to git. Change to many time --- plugins/loc_cele/README.rst | 2 +- src/Ezfio_files/.gitignore | 3 +- src/Ezfio_files/README.rst | 140 ------------------------------------ 3 files changed, 3 insertions(+), 142 deletions(-) delete mode 100644 src/Ezfio_files/README.rst diff --git a/plugins/loc_cele/README.rst b/plugins/loc_cele/README.rst index 2db141ee..c2bd983d 100644 --- a/plugins/loc_cele/README.rst +++ b/plugins/loc_cele/README.rst @@ -8,7 +8,7 @@ Documentation This program performs a localization of the active orbitals of a CASSCF wavefunction, reading the orbitals from a RASORB file of molcas. - id1=max number of MO in a given symmetry. + id1=max is the number of MO in a given symmetry. Needed Modules ============== diff --git a/src/Ezfio_files/.gitignore b/src/Ezfio_files/.gitignore index 85ad9d4e..24230463 100644 --- a/src/Ezfio_files/.gitignore +++ b/src/Ezfio_files/.gitignore @@ -9,4 +9,5 @@ Makefile.depend build.ninja .ninja_log .ninja_deps -ezfio_interface.irp.f \ No newline at end of file +ezfio_interface.irp.f +README.rst \ No newline at end of file diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst deleted file mode 100644 index b0570428..00000000 --- a/src/Ezfio_files/README.rst +++ /dev/null @@ -1,140 +0,0 @@ -================== -Ezfio_files Module -================== - -This modules essentially contains the name of the EZFIO directory in the -``ezfio_filename`` variable. This is read as the first argument of the -command-line, or as the ``QPACKAGE_INPUT`` environment variable. -Documentation -============= - -.. Do not edit this section. It was auto-generated from the -.. by the `update_README.py` script. - -`ezfio_filename `_ - Name of EZFIO file. It is obtained from the QPACKAGE_INPUT environment - variable if it is set, or as the 1st argument of the command line. - - -`getunitandopen `_ - :f: - file name - .br - :mode: - 'R' : READ, UNFORMATTED - 'W' : WRITE, UNFORMATTED - 'r' : READ, FORMATTED - 'w' : WRITE, FORMATTED - 'a' : APPEND, FORMATTED - 'x' : READ/WRITE, FORMATTED - .br - - -`output_ao_basis `_ - Output file for AO_Basis - - -`output_bitmask `_ - Output file for Bitmask - - -`output_casino `_ - Output file for Casino - - -`output_cpu_time_0 `_ - Initial CPU and wall times when printing in the output files - - -`output_determinants `_ - Output file for Determinants - - -`output_electrons `_ - Output file for Electrons - - -`output_ezfio_files `_ - Output file for Ezfio_files - - -`output_full_ci `_ - Output file for Full_CI - - -`output_generators_full `_ - Output file for Generators_full - - -`output_hartree_fock `_ - Output file for Hartree_Fock - - -`output_integrals_bielec `_ - Output file for Integrals_Bielec - - -`output_integrals_monoelec `_ - Output file for Integrals_Monoelec - - -`output_loc_cele `_ - Output file for loc_cele - - -`output_mo_basis `_ - Output file for MO_Basis - - -`output_moguess `_ - Output file for MOGuess - - -`output_molden `_ - Output file for Molden - - -`output_nuclei `_ - Output file for Nuclei - - -`output_perturbation `_ - Output file for Perturbation - - -`output_properties `_ - Output file for Properties - - -`output_pseudo `_ - Output file for Pseudo - - -`output_selectors_full `_ - Output file for Selectors_full - - -`output_utils `_ - Output file for Utils - - -`output_wall_time_0 `_ - Initial CPU and wall times when printing in the output files - - -`write_bool `_ - Write an logical value in output - - -`write_double `_ - Write a double precision value in output - - -`write_int `_ - Write an integer value in output - - -`write_time `_ - Write a time stamp in the output for chronological reconstruction - - From 23f03e252e6da3dd4c54d61025408a367fd7136b Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Fri, 3 Jul 2015 15:07:24 +0200 Subject: [PATCH 2/7] Fix #92 --- scripts/module/module_handler.py | 21 +- scripts/utility/pydot.py | 458 ++++++++++++++----------------- src/MOGuess/H_CORE_guess.irp.f | 7 +- src/MOGuess/README.rst | 3 +- 4 files changed, 226 insertions(+), 263 deletions(-) diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index 10151a1f..30bdbdba 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -173,8 +173,16 @@ class ModuleHandler(): def create_png(self, l_module): """Create the png of the dependency tree for a l_module""" + path = '{0}.png'.format("tree_dependency") + # Init - import pydot + try: + import pydot + except: + with open(path, 'a'): + os.utime(path, None) + return + all_ready_done = [] def draw_module_edge(module, l_children): @@ -189,16 +197,7 @@ class ModuleHandler(): draw_module_edge(children, d_ref[children]) all_ready_done.append(module) - path = '{0}.png'.format("tree_dependency") - - # Init - try: - graph = pydot.Dot(graph_type='digraph') - except: - with open(path, 'a'): - os.utime(path, None) - return - + graph = pydot.Dot(graph_type='digraph') d_ref = self.dict_child # Create all the edge diff --git a/scripts/utility/pydot.py b/scripts/utility/pydot.py index c4a84bb6..07a5b4f5 100644 --- a/scripts/utility/pydot.py +++ b/scripts/utility/pydot.py @@ -26,130 +26,157 @@ import re import subprocess import tempfile import copy -import sys +import dot_parser -try: - import dot_parser -except Exception as e: - pass - # print >> sys.stderr, "Couldn't import dot_parser, loading of dot files will not be possible." - - -GRAPH_ATTRIBUTES = set(['Damping', 'K', 'URL', 'aspect', 'bb', 'bgcolor', - 'center', 'charset', 'clusterrank', 'colorscheme', 'comment', 'compound', - 'concentrate', 'defaultdist', 'dim', 'dimen', 'diredgeconstraints', - 'dpi', 'epsilon', 'esep', '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', +GRAPH_ATTRIBUTES = set(['Damping', + 'K', + 'URL', + 'aspect', + 'bb', + 'bgcolor', + 'center', + 'charset', + 'clusterrank', + 'colorscheme', + 'comment', + 'compound', + 'concentrate', + 'defaultdist', + 'dim', + 'dimen', + 'diredgeconstraints', + 'dpi', + 'epsilon', + 'esep', + '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 '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', - 'arrowhead', - 'arrowsize', - 'arrowtail', +NODE_ATTRIBUTES = set(['URL', 'color', 'colorscheme', 'comment', - 'constraint', - 'decorate', - 'dir', - 'edgeURL', - 'edgehref', - 'edgetarget', - 'edgetooltip', + 'distortion', + 'fillcolor', + 'fixedsize', 'fontcolor', 'fontname', 'fontsize', - 'headURL', - 'headclip', - 'headhref', - 'headlabel', - 'headport', - 'headtarget', - 'headtooltip', - 'href', + 'group', + 'height', 'id', + 'image', + 'imagescale', 'label', - 'labelURL', - 'labelangle', - 'labeldistance', - 'labelfloat', - 'labelfontcolor', - 'labelfontname', - 'labelfontsize', - 'labelhref', - 'labeltarget', - 'labeltooltip', + 'labelloc', 'layer', - 'len', - 'lhead', - 'lp', - 'ltail', - 'minlen', + 'margin', 'nojustify', + 'orientation', 'penwidth', + 'peripheries', + 'pin', 'pos', - 'samehead', - 'sametail', + 'rects', + 'regular', + 'root', + 'samplepoints', + 'shape', + 'shapefile', 'showboxes', + 'sides', + 'skew', + 'sortv', 'style', - 'tailURL', - 'tailclip', - 'tailhref', - 'taillabel', - 'tailport', - 'tailtarget', - 'tailtooltip', 'target', 'tooltip', - 'weight', - 'rank']) - - -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', + 'vertices', + 'width', + 'z', # The following are attributes dot2tex - 'texlbl', 'texmode']) + 'texlbl', + 'texmode']) - -CLUSTER_ATTRIBUTES = set(['K', - 'URL', - 'bgcolor', - 'color', - 'colorscheme', - 'fillcolor', - 'fontcolor', - 'fontname', - 'fontsize', - 'label', - 'labeljust', - 'labelloc', - 'lheight', - 'lp', - 'lwidth', - 'nojustify', - 'pencolor', - 'penwidth', - 'peripheries', - 'sortv', - 'style', - 'target', - 'tooltip']) +CLUSTER_ATTRIBUTES = set( + ['K', 'URL', 'bgcolor', 'color', '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. # class frozendict(dict): - def _blocked_attribute(obj): raise AttributeError("A frozendict cannot be modified.") + _blocked_attribute = property(_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_with_ports = re.compile( - '^[_a-zA-Z][a-zA-Z0-9_,:\"]*[a-zA-Z0-9_,\"]+$', - re.UNICODE) + '^[_a-zA-Z][a-zA-Z0-9_,:\"]*[a-zA-Z0-9_,\"]+$', re.UNICODE) id_re_num = re.compile('^[0-9,]+$', re.UNICODE) id_re_with_port = re.compile('^([^:]*):([^:]*)$', re.UNICODE) id_re_dbl_quoted = re.compile('^\".*\"$', re.S | re.UNICODE) @@ -245,11 +271,9 @@ def needs_quotes(s): return True for test_re in [ - id_re_alpha_nums, - id_re_num, - id_re_dbl_quoted, - id_re_html, - id_re_alpha_nums_with_ports]: + id_re_alpha_nums, id_re_num, id_re_dbl_quoted, id_re_html, + id_re_alpha_nums_with_ports + ]: if test_re.match(s): return False @@ -274,9 +298,7 @@ def quote_if_necessary(s): return s if needs_quotes(s): - replace = {'"': r'\"', - "\n": r'\n', - "\r": r'\r'} + replace = {'"': r'\"', "\n": r'\n', "\r": r'\r'} for (a, b) in replace.items(): s = s.replace(a, b) @@ -374,8 +396,7 @@ def graph_from_adjacency_matrix(matrix, node_prefix=u'', directed=False): for e in r: if e: graph.add_edge( - Edge(node_prefix + node_orig, - node_prefix + node_dest)) + Edge(node_prefix + node_orig, node_prefix + node_dest)) node_dest += 1 node_orig += 1 @@ -410,8 +431,7 @@ def graph_from_incidence_matrix(matrix, node_prefix='', directed=False): if len(nodes) == 2: graph.add_edge( - Edge(node_prefix + abs(nodes[0]), - node_prefix + nodes[1])) + Edge(node_prefix + abs(nodes[0]), node_prefix + nodes[1])) if not directed: graph.set_simplify(True) @@ -437,7 +457,8 @@ def __find_executables(path): 'neato': '', 'circo': '', 'fdp': '', - 'sfdp': ''} + 'sfdp': '' + } was_quoted = False path = path.strip() @@ -533,11 +554,7 @@ def find_graphviz(): def RegOpenKeyEx(key, subkey, opt, sam): result = ctypes.c_uint(0) ctypes.windll.advapi32.RegOpenKeyExA( - key, - subkey, - opt, - sam, - ctypes.byref(result)) + key, subkey, opt, sam, ctypes.byref(result)) return result.value def RegQueryValueEx(hkey, valuename): @@ -546,11 +563,7 @@ def find_graphviz(): data = ctypes.create_string_buffer(1024) res = ctypes.windll.advapi32.RegQueryValueExA( - hkey, - valuename, - 0, - ctypes.byref(data_type), - data, + hkey, valuename, 0, ctypes.byref(data_type), data, ctypes.byref(data_len)) return data.value @@ -574,8 +587,8 @@ def find_graphviz(): for potentialKey in potentialKeys: try: - hkey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - potentialKey, 0, KEY_QUERY_VALUE) + hkey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, potentialKey, 0, + KEY_QUERY_VALUE) if hkey is not None: path = RegQueryValueEx(hkey, "InstallPath") @@ -625,10 +638,7 @@ def find_graphviz(): # information, but win32api may not be installed. path = os.path.join( - os.environ['PROGRAMFILES'], - 'ATT', - 'GraphViz', - 'bin') + os.environ['PROGRAMFILES'], 'ATT', 'GraphViz', 'bin') else: @@ -643,10 +653,8 @@ def find_graphviz(): return progs for path in ( - '/usr/bin', '/usr/local/bin', - '/opt/local/bin', - '/opt/bin', '/sw/bin', '/usr/share', - '/Applications/Graphviz.app/Contents/MacOS/'): + '/usr/bin', '/usr/local/bin', '/opt/local/bin', '/opt/bin', '/sw/bin', + '/usr/share', '/Applications/Graphviz.app/Contents/MacOS/'): progs = __find_executables(path) if progs is not None: @@ -659,7 +667,6 @@ def find_graphviz(): class Common: - """Common information to several classes. Should not be directly used, several classes are derived from @@ -771,22 +778,17 @@ class Common: # Generate all the Setter methods. # self.__setattr__( - 'set_' + - attr, - lambda x, - a=attr: self.obj_dict['attributes'].__setitem__( - a, - x)) + 'set_' + attr, + lambda x, a=attr: self.obj_dict['attributes'].__setitem__( + a, x)) # Generate all the Getter methods. # self.__setattr__( - 'get_' + attr, - lambda a=attr: self.__get_attribute__(a)) + 'get_' + attr, lambda a=attr: self.__get_attribute__(a)) class Error(Exception): - """General error handling class. """ @@ -798,7 +800,6 @@ class Error(Exception): class InvocationException(Exception): - """To indicate that a ploblem occurred while running any of the GraphViz executables. """ @@ -810,7 +811,6 @@ class InvocationException(Exception): class Node(object, Common): - """A graph node. This class represents a graph's node with all its attributes. @@ -919,7 +919,6 @@ class Node(object, Common): class Edge(object, Common): - """A graph edge. 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 # source nor destination. # - if ((self.get_source() == edge.get_source() and self.get_destination() == edge.get_destination()) or ( - edge.get_source() == self.get_destination() and edge.get_destination() == self.get_source())): + if ((self.get_source() == edge.get_source() and + self.get_destination() == edge.get_destination()) or ( + edge.get_source() == self.get_destination() and + edge.get_destination() == self.get_source())): return True else: @@ -1035,8 +1036,8 @@ class Edge(object, Common): node_port_idx = node_str.rfind(':') if node_port_idx > 0 and node_str[0] == '"' and node_str[ - node_port_idx - - 1] == '"': + node_port_idx - 1 + ] == '"': return node_str @@ -1068,8 +1069,8 @@ class Edge(object, Common): edge = [src] if (self.get_parent_graph() 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() and + self.get_parent_graph().get_top_graph_type() == 'digraph'): edge.append('->') @@ -1101,7 +1102,6 @@ class Edge(object, Common): class Graph(object, Common): - """Class representing a graph in Graphviz's dot language. This class implements the methods to work on a representation @@ -1138,14 +1138,13 @@ class Graph(object, Common): """ def __init__( - self, - graph_name='G', - obj_dict=None, - graph_type='digraph', - strict=False, - suppress_disconnected=False, - simplify=False, - **attrs): + self, + graph_name='G', + obj_dict=None, + graph_type='digraph', + strict=False, + suppress_disconnected=False, + simplify=False, **attrs): if obj_dict is not None: self.obj_dict = obj_dict @@ -1158,8 +1157,8 @@ class Graph(object, Common): if graph_type not in ['graph', 'digraph']: raise Error( - 'Invalid type "%s". Accepted graph types are: graph, digraph, subgraph' % - graph_type) + 'Invalid type "%s". Accepted graph types are: graph, digraph, subgraph' + % graph_type) self.obj_dict['name'] = quote_if_necessary(graph_name) self.obj_dict['type'] = graph_type @@ -1328,17 +1327,17 @@ class Graph(object, Common): if not node: self.obj_dict['nodes'][ - graph_node.get_name()] = [ - graph_node.obj_dict] + graph_node.get_name() + ] = [ + graph_node.obj_dict + ] #self.node_dict[graph_node.get_name()] = graph_node.attributes graph_node.set_parent_graph(self.get_parent_graph()) else: - self.obj_dict['nodes'][ - graph_node.get_name()].append( - graph_node.obj_dict) + self.obj_dict['nodes'][graph_node.get_name()].append(graph_node.obj_dict) 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( self.obj_dict['edges'][ - (src, dst)]): + (src, dst) + ]): del self.obj_dict['edges'][(src, dst)][index] return True else: @@ -1504,7 +1504,8 @@ class Graph(object, Common): match = list() 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( edge_points, @@ -1513,8 +1514,7 @@ class Graph(object, Common): for edge_obj_dict in edges_obj_dict: match.append( Edge( - edge_points[0], - edge_points[1], + edge_points[0], edge_points[1], obj_dict=edge_obj_dict)) return match @@ -1544,10 +1544,8 @@ class Graph(object, Common): """ if not isinstance( - sgraph, - Subgraph) and not isinstance( - sgraph, - Cluster): + sgraph, Subgraph) and not isinstance( + sgraph, Cluster): raise TypeError( 'add_subgraph() received a non subgraph class object:' + str(sgraph)) @@ -1638,14 +1636,14 @@ class Graph(object, Common): if self.obj_dict['name'] == '': if 'show_keyword' in self.obj_dict and self.obj_dict[ - 'show_keyword']: + 'show_keyword' + ]: graph.append('subgraph {\n') else: graph.append('{\n') else: graph.append( - '%s %s {\n' % - (self.obj_dict['type'], self.obj_dict['name'])) + '%s %s {\n' % (self.obj_dict['type'], self.obj_dict['name'])) 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 (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 @@ -1720,7 +1718,6 @@ class Graph(object, Common): class Subgraph(Graph): - """Class representing a subgraph in Graphviz's dot language. This class implements the methods to work on a representation @@ -1752,20 +1749,18 @@ class Subgraph(Graph): # as a graph to all methods # def __init__( - self, - graph_name='', - obj_dict=None, - suppress_disconnected=False, - simplify=False, - **attrs): + self, + graph_name='', + obj_dict=None, + suppress_disconnected=False, + simplify=False, **attrs): Graph.__init__( self, graph_name=graph_name, obj_dict=obj_dict, suppress_disconnected=suppress_disconnected, - simplify=simplify, - **attrs) + simplify=simplify, **attrs) if obj_dict is None: @@ -1773,7 +1768,6 @@ class Subgraph(Graph): class Cluster(Graph): - """Class representing a cluster in Graphviz's dot language. This class implements the methods to work on a representation @@ -1802,20 +1796,18 @@ class Cluster(Graph): """ def __init__( - self, - graph_name='subG', - obj_dict=None, - suppress_disconnected=False, - simplify=False, - **attrs): + self, + graph_name='subG', + obj_dict=None, + suppress_disconnected=False, + simplify=False, **attrs): Graph.__init__( self, graph_name=graph_name, obj_dict=obj_dict, suppress_disconnected=suppress_disconnected, - simplify=simplify, - **attrs) + simplify=simplify, **attrs) if obj_dict is None: @@ -1826,7 +1818,6 @@ class Cluster(Graph): class Dot(Graph): - """A container for handling a dot language file. This class implements methods to write and process @@ -1842,42 +1833,12 @@ class Dot(Graph): self.progs = None self.formats = [ - 'canon', - 'cmap', - 'cmapx', - 'cmapx_np', - 'dia', - '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'] + 'canon', 'cmap', 'cmapx', 'cmapx_np', 'dia', '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' @@ -1885,9 +1846,7 @@ class Dot(Graph): # of output in any of the supported formats. for frmt in self.formats: self.__setattr__( - 'create_' + frmt, - lambda f=frmt, - prog=self.prog: self.create( + 'create_' + frmt, lambda f=frmt, prog=self.prog: self.create( format=f, prog=prog)) f = self.__dict__['create_' + frmt] @@ -1896,9 +1855,7 @@ class Dot(Graph): for frmt in self.formats + ['raw']: self.__setattr__( 'write_' + frmt, - lambda path, - f=frmt, - prog=self.prog: self.write( + lambda path, f=frmt, prog=self.prog: self.write( path, format=f, prog=prog)) @@ -2036,15 +1993,14 @@ class Dot(Graph): if self.progs is None: self.progs = find_graphviz() if self.progs is None: - raise InvocationException( - 'GraphViz\'s executables not found') + raise InvocationException('GraphViz\'s executables not found') if prog not in self.progs: raise InvocationException( 'GraphViz\'s executable "%s" not found' % prog) if not os.path.exists( - self.progs[prog]) or not os.path.isfile( + self.progs[prog]) or not os.path.isfile( self.progs[prog]): raise InvocationException( 'GraphViz\'s executable "%s" is not a file or doesn\'t exist' % @@ -2076,7 +2032,8 @@ class Dot(Graph): p = subprocess.Popen( cmdline, cwd=tmp_dir, - stderr=subprocess.PIPE, stdout=subprocess.PIPE) + stderr=subprocess.PIPE, + stdout=subprocess.PIPE) stderr = p.stderr stdout = p.stdout @@ -2109,7 +2066,8 @@ class Dot(Graph): if status != 0: raise InvocationException( 'Program terminated with status: %d. stderr follows: %s' % ( - status, stderr_output)) + status, stderr_output + )) elif stderr_output: print stderr_output diff --git a/src/MOGuess/H_CORE_guess.irp.f b/src/MOGuess/H_CORE_guess.irp.f index 2e10dd94..1893c08b 100644 --- a/src/MOGuess/H_CORE_guess.irp.f +++ b/src/MOGuess/H_CORE_guess.irp.f @@ -1,11 +1,16 @@ 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 character*(64) :: label mo_coef = ao_ortho_lowdin_coef TOUCH mo_coef label = "Guess" 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' call save_mos diff --git a/src/MOGuess/README.rst b/src/MOGuess/README.rst index 03ae8c15..e7280786 100644 --- a/src/MOGuess/README.rst +++ b/src/MOGuess/README.rst @@ -34,5 +34,6 @@ Documentation `h_core_guess `_ - 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 From cccc90ea1e66da95d6c444095dd20e8fce151b3b Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Fri, 3 Jul 2015 15:40:25 +0200 Subject: [PATCH 3/7] Re add EZFIO_file/README.rst --- scripts/compilation/qp_create_ninja.py | 5 +- src/Ezfio_files/README.rst | 140 +++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 src/Ezfio_files/README.rst diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index 67652890..14d6811c 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -19,7 +19,10 @@ try: from read_compilation_cfg import get_compilation_option from docopt import docopt 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 """ Error: source %s diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst new file mode 100644 index 00000000..ba8f4c8e --- /dev/null +++ b/src/Ezfio_files/README.rst @@ -0,0 +1,140 @@ +================== +Ezfio_files Module +================== + +This modules essentially contains the name of the EZFIO directory in the +``ezfio_filename`` variable. This is read as the first argument of the +command-line, or as the ``QP_INPUT`` environment variable. +Documentation +============= + +.. Do not edit this section. It was auto-generated from the +.. by the `update_README.py` script. + +`ezfio_filename `_ + Name of EZFIO file. It is obtained from the QPACKAGE_INPUT environment + variable if it is set, or as the 1st argument of the command line. + + +`getunitandopen `_ + :f: + file name + .br + :mode: + 'R' : READ, UNFORMATTED + 'W' : WRITE, UNFORMATTED + 'r' : READ, FORMATTED + 'w' : WRITE, FORMATTED + 'a' : APPEND, FORMATTED + 'x' : READ/WRITE, FORMATTED + .br + + +`output_ao_basis `_ + Output file for AO_Basis + + +`output_bitmask `_ + Output file for Bitmask + + +`output_casino `_ + Output file for Casino + + +`output_cpu_time_0 `_ + Initial CPU and wall times when printing in the output files + + +`output_determinants `_ + Output file for Determinants + + +`output_electrons `_ + Output file for Electrons + + +`output_ezfio_files `_ + Output file for Ezfio_files + + +`output_full_ci `_ + Output file for Full_CI + + +`output_generators_full `_ + Output file for Generators_full + + +`output_hartree_fock `_ + Output file for Hartree_Fock + + +`output_integrals_bielec `_ + Output file for Integrals_Bielec + + +`output_integrals_monoelec `_ + Output file for Integrals_Monoelec + + +`output_loc_cele `_ + Output file for loc_cele + + +`output_mo_basis `_ + Output file for MO_Basis + + +`output_moguess `_ + Output file for MOGuess + + +`output_molden `_ + Output file for Molden + + +`output_nuclei `_ + Output file for Nuclei + + +`output_perturbation `_ + Output file for Perturbation + + +`output_properties `_ + Output file for Properties + + +`output_pseudo `_ + Output file for Pseudo + + +`output_selectors_full `_ + Output file for Selectors_full + + +`output_utils `_ + Output file for Utils + + +`output_wall_time_0 `_ + Initial CPU and wall times when printing in the output files + + +`write_bool `_ + Write an logical value in output + + +`write_double `_ + Write a double precision value in output + + +`write_int `_ + Write an integer value in output + + +`write_time `_ + Write a time stamp in the output for chronological reconstruction + + From 63055bbbceabede79658b6304000cc83e505f2d9 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Mon, 6 Jul 2015 14:06:49 +0200 Subject: [PATCH 4/7] Beter doc --- plugins/Hartree_Fock/SCF.irp.f | 7 ++++++- plugins/Hartree_Fock/huckel.irp.f | 8 +++++--- scripts/ezfio_interface/ei_handler.py | 3 +-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/Hartree_Fock/SCF.irp.f b/plugins/Hartree_Fock/SCF.irp.f index 33e1ac6c..864e9f3f 100644 --- a/plugins/Hartree_Fock/SCF.irp.f +++ b/plugins/Hartree_Fock/SCF.irp.f @@ -1,5 +1,10 @@ - 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 orthonormalize_mos call run diff --git a/plugins/Hartree_Fock/huckel.irp.f b/plugins/Hartree_Fock/huckel.irp.f index 4ea8d93f..1b9e02aa 100644 --- a/plugins/Hartree_Fock/huckel.irp.f +++ b/plugins/Hartree_Fock/huckel.irp.f @@ -12,15 +12,17 @@ subroutine huckel_guess TOUCH mo_coef label = "Guess" 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 c = 0.5d0 * 1.75d0 + do j=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) + & - ao_mono_elec_integral(j,j)) + ao_mono_elec_integral(j,j)) else Fock_matrix_ao(i,j) = Fock_matrix_alpha_ao(i,j) endif diff --git a/scripts/ezfio_interface/ei_handler.py b/scripts/ezfio_interface/ei_handler.py index 1be604da..b25ebe6f 100755 --- a/scripts/ezfio_interface/ei_handler.py +++ b/scripts/ezfio_interface/ei_handler.py @@ -86,6 +86,7 @@ from os.path import isdir, join, exists from qp_path import QP_ROOT, QP_SRC, QP_OCAML, QP_EZFIO Type = namedtuple('Type', 'fancy ocaml fortran') +Module = namedtuple('Module', 'path lower') def is_bool(str_): @@ -789,8 +790,6 @@ if __name__ == "__main__": l_module_with_ezfio = [] - Module = namedtuple('Module', 'path lower') - for f in l_module: path = join(QP_SRC, f, "EZFIO.cfg") if exists(path): From 2bd6a05beb341be74620eb06eb4a269aa19c2569 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 15 Jul 2015 09:50:51 +0200 Subject: [PATCH 5/7] Try new travis --- .travis.yml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46e8057f..0e78a8c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,28 @@ -sudo: true -# -#cache: -# directories: -# - $HOME/.opam/ +#sudo: true +#before_script: +# - sudo apt-get update -q +# - sudo apt-get install gfortran liblapack-dev gcc +# - sudo apt-get install graphviz + +sudo: false + +addons: + apt: + packages: + - gfortran + - gcc + - liblapack-dev + - graphviz + +cache: + directories: + - $HOME/.opam/ language: python python: - "2.6" -before_script: - - sudo apt-get update -q - - sudo apt-get install gfortran liblapack-dev gcc - - sudo apt-get install graphviz + script: - ./configure --production ./config/gfortran.cfg From 5bfc28b1f7ac1f9ecfa9dada9240c125b296c280 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 15 Jul 2015 11:00:23 +0200 Subject: [PATCH 6/7] When uninstall module cleaning fist --- plugins/Hartree_Fock/.gitignore | 1 + plugins/Hartree_Fock/README.rst | 21 +++++++++++++--- scripts/compilation/qp_create_ninja.py | 28 +++++++++++++-------- scripts/module/qp_install_module.py | 35 +++++++++++++++++--------- src/MOGuess/README.rst | 4 +++ 5 files changed, 62 insertions(+), 27 deletions(-) diff --git a/plugins/Hartree_Fock/.gitignore b/plugins/Hartree_Fock/.gitignore index dbafb30b..189438ef 100644 --- a/plugins/Hartree_Fock/.gitignore +++ b/plugins/Hartree_Fock/.gitignore @@ -21,4 +21,5 @@ MOGuess Nuclei Utils Huckel_guess +test SCF \ No newline at end of file diff --git a/plugins/Hartree_Fock/README.rst b/plugins/Hartree_Fock/README.rst index 4dacf17c..7066f7c6 100644 --- a/plugins/Hartree_Fock/README.rst +++ b/plugins/Hartree_Fock/README.rst @@ -29,7 +29,17 @@ Documentation Alpha Fock matrix in AO basis set -`create_guess `_ +`big `_ + 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 `_ Create an MO guess if no MOs are present in the EZFIO directory @@ -139,12 +149,15 @@ Documentation Maximum number of SCF iterations -`run `_ +`run `_ Run SCF calculation -`scf `_ - Undocumented +`scf `_ + 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 `_ diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index 14d6811c..c49f4cc1 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -26,7 +26,7 @@ except ImportError: print """ Error: source %s -"""%f +""" % f sys.exit(1) header = r"""# @@ -313,8 +313,11 @@ def ninja_symlink_build(path_module, l_symlink): if not l_symlink: return [] - l_string = ["build l_symlink_{0} : phony {1}".format( - path_module.rel, " ".join([s.destination for s in l_symlink])), ""] + l_folder = [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: l_string += ["build {0}: build_symlink {1}".format(symlink.destination, @@ -336,20 +339,22 @@ def ninja_gitignore_rule(): " 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") 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, - " ".join(l_b), - path_module.rel), - " module_rel = {0}".format(path_module.rel), - ""] + root = "build {0}: build_gitignore {1}".format(path_gitignore, + " ".join(l_b)) + if l_symlink: + 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 @@ -911,7 +916,8 @@ if __name__ == "__main__": l_string += ninja_binaries_build(module_to_compile, l_children, 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: f.write(header) diff --git a/scripts/module/qp_install_module.py b/scripts/module/qp_install_module.py index 3240e142..2cad51a9 100755 --- a/scripts/module/qp_install_module.py +++ b/scripts/module/qp_install_module.py @@ -16,6 +16,7 @@ Options: import sys import os +import subprocess try: from docopt import docopt @@ -152,6 +153,11 @@ if __name__ == '__main__': except OSError: print "Your src directory is broken. Please remove %s" % des raise + try: + import subprocess + subprocess.check_call(["qp_create_ninja.py", "update"]) + except: + raise print "Done" print "You can now compile as usual" @@ -164,24 +170,29 @@ if __name__ == '__main__': l_name = arguments[""] l_failed = [name for name in l_name if name not in d_local] + if l_failed: print "Modules not installed:" for name in sorted(l_failed): print "* %s" % name 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: - 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]] - print "You will remove all of:" - print l_name_to_remove + for module in l_name_to_remove: - else: - l_name_to_remove = l_name + try: + subprocess.check_call(["module_handler.py", "clean", module]) + except: + raise - def unlink(x): - try: - os.unlink(os.path.join(QP_SRC, x)) - except OSError: - print "%s is a core module which can not be renmoved" % x - map(unlink, l_name_to_remove) + try: + os.unlink(os.path.join(QP_SRC, module)) + except OSError: + print "%s is a core module which can not be renmoved" % x diff --git a/src/MOGuess/README.rst b/src/MOGuess/README.rst index e7280786..d10b1ef5 100644 --- a/src/MOGuess/README.rst +++ b/src/MOGuess/README.rst @@ -37,3 +37,7 @@ Documentation 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 `_ + Produce `H_core` MO orbital + From b4c45f154ab40751ca5c02fadd054214ceb8a0a4 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 15 Jul 2015 11:21:05 +0200 Subject: [PATCH 7/7] Maj .gitignore HF --- plugins/Hartree_Fock/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/Hartree_Fock/.gitignore b/plugins/Hartree_Fock/.gitignore index 189438ef..dbafb30b 100644 --- a/plugins/Hartree_Fock/.gitignore +++ b/plugins/Hartree_Fock/.gitignore @@ -21,5 +21,4 @@ MOGuess Nuclei Utils Huckel_guess -test SCF \ No newline at end of file