Ignore:
Timestamp:
Apr 23, 2021, 8:51:43 PM (5 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
1be100
Parents:
0f9eb0
git-author:
Frederik Heber <frederik.heber@…> (03/27/21 14:54:53)
git-committer:
Frederik Heber <frederik.heber@…> (04/23/21 20:51:43)
Message:

FIX: Small changes to ChemicalSpaceEvaluatorAction.

  • discarding degree combination before we begin calculating the fragment

energy.

  • made the log info more specific and easier to read.
  • FIX: CSE used wrong graph when generating the homology graph key.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/GraphAction/ChemicalSpaceEvaluatorAction.cpp

    r0f9eb0 rd951a5  
    160160static SaturatedGraph saturateGraph(
    161161    const graph_type &graph,
    162     const Extractors::nodes_t &nodes,
    163162    const BoostGraphCreator::name_map_t &name_map,
    164163    const Extractors::type_index_lookup_t &type_index_lookup,
     
    192191  }
    193192
     193  LOG(2, "DEBUG: Saturating graph with " << boost::num_vertices(newgraph.saturated_graph) << " nodes.");
    194194  size_t no_nodes = boost::num_vertices(newgraph.saturated_graph);
    195195  // step through every node, sum up its degrees
     
    406406  }
    407407
     408  // put all nodes in a list
     409  Extractors::nodes_t nodes;
     410  for (size_t nodeid = 0; nodeid < nodes_in_graph; ++nodeid) {
     411    nodes.insert(nodeid);
     412  }
     413
    408414  typedef std::vector<
    409415      std::pair<
     
    416422      degrees_iter != list_of_edge_degrees.end(); ++degrees_iter) {
    417423    const degrees_t &current_degrees = *degrees_iter;
     424    LOG(2, "DEBUG: Current degree combination is " << current_degrees);
     425
     426    // saturate subgraph: add to nodes, add to type_index_lookup, index_map
     427      // saturate any leftover valence with hydrogen nodes
     428    SaturatedGraph fullgraph =
     429        saturateGraph(graph, name_map,
     430            type_index_lookup, type_valence_map, edge_index,
     431            edges, current_degrees);
     432
     433    // don't add if one of the node's valence cannot be fulfilled
     434    if (!fullgraph.ValencesAllFulfilled) {
     435      LOG(2, "DEBUG: The degree combination " << current_degrees << " can NOT be fulfilled.");
     436      continue;
     437    } else {
     438      LOG(2, "DEBUG: The degree combination is admissable.");
     439    }
     440
    418441
    419442    // simply sum up the contributions from all fragments for the total energy
     
    426449        nodesiter != set_of_nodes.end(); ++nodesiter) {
    427450      const Extractors::nodes_t &current_nodes = *nodesiter;
    428       LOG(2, "DEBUG: Nodes for graph are " << current_nodes);
     451      LOG(2, "DEBUG: Fragment nodes for graph are " << current_nodes);
    429452
    430453      // create subgraph
     
    438461        for (; viter != vend; ++viter) {
    439462          const atomId_t vindex = boost::get(new_name_map, *viter);
    440           LOG(4, "DEBUG: Copied node has index " << vindex);
     463          LOG(4, "DEBUG: Copied node in fragment has index " << vindex);
    441464        }
    442465      }
     
    444467      // saturate subgraph: add to nodes, add to type_index_lookup, index_map
    445468        // saturate any leftover valence with hydrogen nodes
    446       SaturatedGraph fullgraph =
    447           saturateGraph(newgraph, current_nodes, new_name_map,
     469      SaturatedGraph fragmentgraph =
     470          saturateGraph(newgraph, new_name_map,
    448471              type_index_lookup, type_valence_map, edge_index,
    449472              edges, current_degrees);
    450473
    451474      // don't add if one of the node's valence cannot be fulfilled
    452       if (!fullgraph.ValencesAllFulfilled)
    453         continue;
     475      ASSERT(fragmentgraph.ValencesAllFulfilled,
     476          "GraphChemicalSpaceEvaluatorAction::performCall() - encountered subgraph whose valences cannot be fulfilled.");
    454477
    455478      const Extractors::index_map_t subgraph_index_map =
    456           boost::get(boost::vertex_index, fullgraph.saturated_graph);
    457       const BoostGraphCreator::name_map_t subgraph_name_map =
    458           boost::get(boost::vertex_name, fullgraph.saturated_graph);
     479          boost::get(boost::vertex_index, fragmentgraph.saturated_graph);
     480      // const BoostGraphCreator::name_map_t subgraph_name_map =
     481      //    boost::get(boost::vertex_name, fragmentgraph.saturated_graph);
    459482
    460483      Extractors::nodes_t saturated_nodes;
    461484      BoostGraphCreator::vertex_iter viter, vend;
    462       boost::tie(viter, vend) = boost::vertices(fullgraph.saturated_graph);
     485      boost::tie(viter, vend) = boost::vertices(fragmentgraph.saturated_graph);
    463486      for (; viter != vend; ++viter) {
    464487        const Extractors::node_t vindex = boost::get(subgraph_index_map, *viter);
    465         LOG(4, "DEBUG: Adding node index " << vindex << " to saturated nodes list.");
     488        LOG(4, "DEBUG: Adding fragment node index " << vindex << " of type "
     489            << Extractors::getParticleTypeToNode(fragmentgraph.type_index_lookup, vindex)
     490            << " to saturated fragment nodes list.");
    466491        saturated_nodes.insert(vindex);
    467492      }
     
    470495          Extractors::createHomologyGraphFromNodes(
    471496              saturated_nodes,
    472               fullgraph.type_index_lookup,
    473               fullgraph.saturated_graph,
     497              fragmentgraph.type_index_lookup,
     498              fragmentgraph.saturated_graph,
    474499              subgraph_index_map);
    475       LOG(2, "DEBUG: Looking for graph " << nodes_graph);
     500      LOG(2, "DEBUG: Looking for fragment graphs " << nodes_graph << " in homology container.");
    476501
    477502      /// Query HomologyContainer for this HomologyGraph.
     
    487512      }
    488513    }
    489     LOG(1, "The graph with degrees " << *degrees_iter << " has a total energy of " << total_energy);
     514    LOG(1, "The graph with degrees " << current_degrees << " has a total BOSSANOVA energy of " << total_energy);
    490515  }
    491516
Note: See TracChangeset for help on using the changeset viewer.