protected override void Run() { var agent = new Algorithms.Deterministic(settings); BFSNode seedNode = new BFSNode(Seed, 0); QueueBFS.Enqueue(seedNode); while (QueueBFS.Count != 0) { var popNode = QueueBFS.Dequeue(); Console.WriteLine("{0},{1}", popNode.getSMILE(), popNode.getDepth()); // Console.Write("."); if (popNode.getDepth() < MAX_DEPTH) { var newNodes = popNode.getChildren(agent); foreach (var node in newNodes) { var nodeSMILE = node.getSMILE(); if (!allNode.Contains(nodeSMILE)) { nodeInfoWriter.WriteLine("{0},{1}", nodeSMILE, node.getDepth()); // var nodeDir = _runDirectory + "/interNode/depth" + node.getDepth() + "/node" + nodeCnt; // Directory.CreateDirectory(nodeDir); // Settings.filer.Save(nodeDir + "/node" + nodeCnt + ".xml", node.getCand()); allNode.Add(nodeSMILE); QueueBFS.Enqueue(node); nodeCnt++; var terminalLinker = node.getFinalCand(agent); foreach (var linker in terminalLinker) { var mol = OBFunctions.designgraphtomol(linker.graph); var candSMILE = OBFunctions.moltoSMILES(mol); if (!allFinalCand.Contains(candSMILE)) { // var linkerDir = _runDirectory + "/finalNode/depth" + node.getDepth() + "/linker" + candCnt; // Directory.CreateDirectory(linkerDir); // // var coeff = Path.Combine(linkerDir, "linker" + candCnt + ".coeff"); // var lmpdat = Path.Combine(linkerDir, "linker" + candCnt + ".lmpdat"); allFinalCand.Add(candSMILE); // // Set up UFF and run lammps // Converter.moltoUFF(mol, coeff, lmpdat, false, 100); // Settings.filer.Save(linkerDir + "/linker" + candCnt + ".xml", linker.graph); candInfoWriter.WriteLine("{0},{1}", candSMILE, node.getDepth()); candCnt++; } } } } } } nodeInfoWriter.Close(); candInfoWriter.Close(); }
public BFSNode[] getChildren(Deterministic agent) { var opts = AbstractAlgorithm.GetAvailableOptions(Cand); var nodes = new BFSNode[opts.Count]; for (var i = 0; i < nodes.Length; i++) { var child = agent.CopyAndApplyOption(opts[i], Cand, true); nodes[i] = new BFSNode(child, Depth + 1); } return(nodes); }