1package denoptim.fragspace;
3import static org.junit.jupiter.api.Assertions.assertEquals;
4import static org.junit.jupiter.api.Assertions.assertTrue;
25import java.util.ArrayList;
26import java.util.Arrays;
27import java.util.HashMap;
28import java.util.HashSet;
31import java.util.Random;
33import java.util.function.Supplier;
34import java.util.stream.Collectors;
35import java.util.stream.IntStream;
37import javax.vecmath.Point3d;
39import org.junit.jupiter.api.Test;
40import org.junit.jupiter.api.io.TempDir;
41import org.openscience.cdk.Atom;
42import org.openscience.cdk.DefaultChemObjectBuilder;
43import org.openscience.cdk.PseudoAtom;
44import org.openscience.cdk.interfaces.IAtom;
45import org.openscience.cdk.interfaces.IAtomContainer;
46import org.openscience.cdk.interfaces.IChemObjectBuilder;
47import org.openscience.cdk.silent.Bond;
49import denoptim.exception.DENOPTIMException;
50import denoptim.files.FileUtils;
51import denoptim.graph.APClass;
52import denoptim.graph.AttachmentPoint;
53import denoptim.graph.DGraph;
54import denoptim.graph.Edge;
55import denoptim.graph.Edge.BondType;
56import denoptim.graph.Fragment;
57import denoptim.graph.Ring;
58import denoptim.graph.SymmetricAPs;
59import denoptim.graph.Template;
60import denoptim.graph.Vertex;
61import denoptim.graph.Vertex.BBType;
62import denoptim.graph.rings.RingClosingAttractor;
63import denoptim.io.DenoptimIO;
64import denoptim.molecularmodeling.ThreeDimTreeBuilder;
65import denoptim.utils.GraphUtils;
66import denoptim.utils.MoleculeUtils;
76 private static final String
SEP = System.getProperty(
"file.separator");
81 private final Random
rng =
new Random();
85 private static final String
RULAPCS =
"apc-S";
86 private static final String
RULAPC1 =
"apc-1";
87 private static final String
RULAPC2 =
"apc-2";
88 private static final String
RULAPC3 =
"apc-3";
89 private static final String
RULAPC4 =
"apc-4";
90 private static final String
RULAPC5 =
"a_p_c-5";
91 private static final String
RULAPC6 =
"a_p_c-6";
92 private static final String
RULAPCC1 =
"cap-1";
93 private static final String
RULAPCC2 =
"cap-2";
111 assertTrue(
tempDir.isDirectory(),
"Should be a directory ");
129 String rootName =
tempDir.getAbsolutePath() +
SEP;
131 ArrayList<Vertex> fragLib =
new ArrayList<Vertex>();
133 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
134 Atom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
135 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
139 frg1.
addBond(
new Bond(a1, a2));
140 frg1.
addBond(
new Bond(a2, a3));
149 Atom a21 =
new Atom(
"N",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
150 Atom a22 =
new Atom(
"H",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
153 frg2.
addBond(
new Bond(a21, a22));
160 Atom a31 =
new Atom(
"P",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
169 Atom a81 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, -2.2}));
170 Atom a82 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, -2.2}));
171 Atom a83 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, -2.2}));
175 frg8.
addBond(
new Bond(a81, a82));
176 frg8.
addBond(
new Bond(a82, a83));
177 frg8.
addAPOnAtom(a83,
APC4,
new Point3d(
new double[]{0.0, 2.2, -3.3}));
178 frg8.
addAPOnAtom(a83,
APC4,
new Point3d(
new double[]{0.0, 0.0, -3.3}));
179 frg8.
addAPOnAtom(a83,
APC6,
new Point3d(
new double[]{0.0, 0.0, -1.1}));
180 frg8.
addAPOnAtom(a82,
APC5,
new Point3d(
new double[]{1.0, 0.1, -2.2}));
181 frg8.
addAPOnAtom(a82,
APC5,
new Point3d(
new double[]{1.0, 0.1, -1.2}));
182 frg8.
addAPOnAtom(a82,
APC5,
new Point3d(
new double[]{1.0, 2.1, -2.2}));
183 frg8.
addAPOnAtom(a81,
APC5,
new Point3d(
new double[]{3.0, 0.0, -3.3}));
187 String fragLibFile = rootName +
"frags.sdf";
190 ArrayList<Vertex> scaffLib =
new ArrayList<Vertex>();
192 Atom a41 =
new Atom(
"O",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
193 Atom a42 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
194 Atom a43 =
new Atom(
"Ru",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
198 scaf0.
addBond(
new Bond(a41, a42));
199 scaf0.
addBond(
new Bond(a42, a43));
200 scaf0.
addAPOnAtom(a43,
APCS,
new Point3d(
new double[]{0.0, 2.2, 3.3}));
201 scaf0.
addAPOnAtom(a43,
APCS,
new Point3d(
new double[]{0.0, 0.0, 3.3}));
202 scaf0.
addAPOnAtom(a43,
APCS,
new Point3d(
new double[]{0.0, 0.0, 1.1}));
203 scaf0.
addAPOnAtom(a41,
APCS,
new Point3d(
new double[]{3.0, 0.0, 3.3}));
208 Atom a51 =
new Atom(
"Zn",
new Point3d(
new double[]{5.0, 1.1, 2.2}));
210 scaf1.
addAPOnAtom(a51,
APCS,
new Point3d(
new double[]{5.0, 2.2, 3.3}));
211 scaf1.
addAPOnAtom(a51,
APCS,
new Point3d(
new double[]{5.0, 0.0, 3.3}));
212 scaf1.
addAPOnAtom(a51,
APCS,
new Point3d(
new double[]{5.0, 0.0, 1.1}));
216 String scaffLibFile = rootName +
"scaff.sdf";
219 ArrayList<Vertex> cappLib =
new ArrayList<Vertex>();
221 Atom a61 =
new Atom(
"H",
new Point3d(
new double[]{10.0, 1.1, 2.2}));
228 Atom a71 =
new Atom(
"Cl",
new Point3d(
new double[]{10.0, 1.1, 2.2}));
234 String capLibFile = rootName +
"caps.sdf";
237 HashMap<APClass,ArrayList<APClass>> cpMap =
238 new HashMap<APClass,ArrayList<APClass>>();
239 ArrayList<APClass> lst1 =
new ArrayList<APClass>();
242 cpMap.put(
APCS, lst1);
243 ArrayList<APClass> lst2 =
new ArrayList<APClass>();
245 cpMap.put(
APC1, lst2);
246 ArrayList<APClass> lst3 =
new ArrayList<APClass>();
249 cpMap.put(
APC2, lst3);
251 HashMap<APClass,APClass> capMap =
new HashMap<APClass,APClass>();
256 HashSet<APClass> ends =
new HashSet<APClass>();
259 String cpmFile = rootName +
"cpm.dat";
270 capLibFile, cpmFile);
286 "Number of symmetric sets of APs");
288 Map<APClass,Integer> expectedCount =
new HashMap<APClass,Integer>();
289 expectedCount.put(
APC4, 2);
290 expectedCount.put(
APC5, 3);
293 APClass apc = ss.get(0).getAPClass();
294 assertEquals(expectedCount.get(apc),ss.size(),
295 "Number of APs in symmetric set for APClass "+apc);
306 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
308 assertEquals(4,l.size(),
"Wrong size of AP IDs with given APClass.");
315 id.getVertexMolId(),
id.getVertexMolType(), fs);
328 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
330 assertEquals(4,lst.size(),
"Wrong size of AP IDs with given APClass.");
334 assertTrue( v.getAllAPClasses().contains(
APC2));
345 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
347 Set<APClass> query =
new HashSet<APClass>();
351 assertEquals(2, lst.size());
356 assertTrue(v.getAllAPClasses().contains(apc));
368 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
372 Atom a1b =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
373 Atom a2b =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
376 frg1b.
addBond(
new Bond(a1b, a2b));
377 frg1b.
addAPOnAtom(a1b,
APC1,
new Point3d(
new double[]{0.0, 2.2, 3.3}));
378 frg1b.
addAPOnAtom(a1b,
APC1,
new Point3d(
new double[]{0.0, 0.0, 3.3}));
379 frg1b.
addAPOnAtom(a2b,
APC2,
new Point3d(
new double[]{0.0, 0.0, 1.1}));
380 frg1b.
addAPOnAtom(a2b,
APC2,
new Point3d(
new double[]{3.0, 0.0, 3.3}));
385 Atom a1c =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
386 Atom a2c =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
389 frg1c.
addBond(
new Bond(a1c, a2c));
390 frg1c.
addAPOnAtom(a1c,
APC1,
new Point3d(
new double[]{0.0, 2.2, 3.3}));
391 frg1c.
addAPOnAtom(a2c,
APC2,
new Point3d(
new double[]{3.0, 0.0, 3.3}));
396 Atom a1d =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
397 Atom a2d =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
400 frg1d.
addBond(
new Bond(a1d, a2d));
401 frg1d.
addAPOnAtom(a1d,
APCS,
new Point3d(
new double[]{0.0, 2.2, 3.3}));
402 frg1d.
addAPOnAtom(a2d,
APC2,
new Point3d(
new double[]{3.0, 0.0, 3.3}));
403 frg1d.
addAPOnAtom(a1d,
APC2,
new Point3d(
new double[]{3.0, 0.0, 3.3}));
404 frg1d.
addAPOnAtom(a1d,
APC1,
new Point3d(
new double[]{3.0, 0.0, 3.3}));
409 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
410 Atom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
413 frg1.
addBond(
new Bond(a1, a2));
420 Map<APClass,Integer> query =
new HashMap<APClass,Integer>();
424 assertEquals(3, lst.size());
428 for (
APClass apc : query.keySet())
430 assertTrue(query.get(apc) <= v.getAttachmentPoints().stream()
431 .filter(ap -> ap.getAPClass().equals(apc))
444 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
447 assertEquals(1, lst.size(),
"Wrong size of AP IDs with given APClass.");
452 for (
APClass apc : v.getAllAPClasses())
454 if (apc.toString().startsWith(
RULAPC5.substring(0, 4)))
458 assertEquals(2, counter);
469 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
472 assertEquals(4,lst.size(),
"Size of compatible APs list is wrong.");
479 id.getVertexMolId(),
id.getVertexMolType(), fs);
482 "Incompatible choice at "+i);
493 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
496 ArrayList<IdFragmentAndAP> srcAPs =
new ArrayList<IdFragmentAndAP>();
521 assertEquals(4,lst.size(),
"Size of compatible APs list is wrong.");
528 id.getVertexMolId(),
id.getVertexMolType(), fs);
532 "Incompatible choice at "+i);
543 assertTrue(fs.
isDefined(),
"FragmentSpace is defined");
546 ArrayList<IdFragmentAndAP> srcAPs =
new ArrayList<IdFragmentAndAP>();
553 assertEquals(3,lst.size(),
"Wrong number of compatible fragments.");
567 HashMap<APClass,ArrayList<APClass>> cpMap =
568 new HashMap<APClass,ArrayList<APClass>>();
569 ArrayList<APClass> lstA =
new ArrayList<APClass>();
571 cpMap.put(apcA, lstA);
572 ArrayList<APClass> lstB =
new ArrayList<APClass>();
575 cpMap.put(apcB, lstB);
577 HashMap<APClass,ArrayList<APClass>> rcCPMap =
578 new HashMap<APClass,ArrayList<APClass>>();
579 ArrayList<APClass> lstC =
new ArrayList<APClass>();
581 rcCPMap.put(apcA, lstC);
583 ArrayList<Vertex> fragments =
new ArrayList<Vertex>();
586 Atom a21 =
new Atom(
"N",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
587 Atom a22 =
new Atom(
"H",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
590 frg2.
addBond(
new Bond(a21, a22));
591 frg2.
addAP(1, apcB,
new Point3d(
new double[]{0.0, 2.2, 3.3}));
592 frg2.
addAP(1, apcA,
new Point3d(
new double[]{0.0, 0.0, 3.3}));
599 rcv1.
addAP(0, rcvP,
new Point3d(1.0, 0, 0));
607 rcv2.
addAP(0, rcvM,
new Point3d(-1.0, 0, 0));
615 rcv3.
addAP(0, rcvM,
new Point3d(-2.0, 0, 0));
619 HashMap<APClass,APClass> capMap =
new HashMap<APClass,APClass>();
620 HashSet<APClass> forbEnds =
new HashSet<APClass>();
624 new ArrayList<Vertex>(),
626 new ArrayList<Vertex>(),
627 cpMap, capMap, forbEnds, cpMap);
631 assertEquals(1, rcvs1.size());
632 assertEquals(rcvP, rcvs1.get(0).getAP(0).getAPClass());
634 assertEquals(3, rcvs2.size());
639 if (rcvP == rcv.getAP(0).getAPClass())
644 assertEquals(1, countP);
645 assertEquals(2, countM);
647 assertEquals(0, rcvs3.size());
661 HashMap<APClass,ArrayList<APClass>> cpMap =
662 new HashMap<APClass,ArrayList<APClass>>();
663 ArrayList<APClass> lstA =
new ArrayList<APClass>();
665 cpMap.put(apcA, lstA);
666 ArrayList<APClass> lstB =
new ArrayList<APClass>();
669 cpMap.put(apcB, lstB);
671 HashMap<APClass,ArrayList<APClass>> rcCPMap =
672 new HashMap<APClass,ArrayList<APClass>>();
673 ArrayList<APClass> lstC =
new ArrayList<APClass>();
675 rcCPMap.put(apcA, lstC);
677 ArrayList<Vertex> fragments =
new ArrayList<Vertex>();
680 Atom a21 =
new Atom(
"N",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
681 Atom a22 =
new Atom(
"H",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
684 frg2.
addBond(
new Bond(a21, a22));
685 frg2.
addAP(1, apcB,
new Point3d(
new double[]{0.0, 2.2, 3.3}));
686 frg2.
addAP(1, apcA,
new Point3d(
new double[]{0.0, 0.0, 3.3}));
693 rcv1.
addAP(0, rcvP,
new Point3d(1.0, 0, 0));
701 rcv2.
addAP(0, rcvM,
new Point3d(-1.0, 0, 0));
705 HashMap<APClass,APClass> capMap =
new HashMap<APClass,APClass>();
706 HashSet<APClass> forbEnds =
new HashSet<APClass>();
710 new ArrayList<Vertex>(),
712 new ArrayList<Vertex>(),
713 cpMap, capMap, forbEnds, cpMap);
717 assertEquals(1, rcvs1.size());
718 assertTrue(rcv1.
sameAs(rcvs1.get(0)));
721 assertEquals(1, rcvs2.size());
722 assertTrue(rcv2.
sameAs(rcvs2.get(0)));
741 fsp.fragmentLibFile =
"dummyFilename_DenoptimTest_Frag";
742 fsp.scaffoldLibFile =
"dummyFilename_DenoptimTest_Scaff";
756 assertEquals(1, fragLib.size());
757 Vertex actual = fragLib.get(0);
758 StringBuilder sb =
new StringBuilder();
760 "Problem is "+sb.toString());
774 fsp.fragmentLibFile =
"dummyFilename_DenoptimTest_Frag";
775 fsp.scaffoldLibFile =
"dummyFilename_DenoptimTest_Scaff";
793 assertEquals(1, scaffLib.size());
794 Vertex actual = scaffLib.get(0);
795 assertTrue(testCase.
expected.
sameAs(actual,
new StringBuilder()));
804 fsp.fragmentLibFile =
"dummyFilename_DenoptimTest_Frag";
805 fsp.scaffoldLibFile =
"dummyFilename_DenoptimTest_Scaff";
808 final int TRY_ADDING = 10;
809 List<DGraph> sameGraphs = IntStream
810 .range(0, TRY_ADDING)
812 .peek(t -> t.renumberGraphVertices())
813 .collect(Collectors.toList());
818 for (
DGraph g : sameGraphs) {
826 assertEquals(1, fragLib.size());
860 Ring r124 =
new Ring(Arrays.asList(rcv14, c1, c2, c4,
862 Ring r425 =
new Ring(Arrays.asList(rcv45, c4, c2, c5,
881 .indexOfVertexWithID(c3.getVertexId()));
894 IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
895 IAtom carbon = builder.newAtom();
896 carbon.setSymbol(
"C");
897 IAtomContainer mol = builder.newAtomContainer();
903 for (
int i = 0; i < 4; i++) {
913 IChemObjectBuilder builder = DefaultChemObjectBuilder
915 IAtomContainer dummyMol = builder.newAtomContainer();
916 IAtom dummyAtom = builder.newAtom();
917 dummyMol.addAtom(dummyAtom);
930 int precision = 10 * 10 * 10 * 10;
932 Supplier<Double> randomCoord = () ->
933 (
double) (Math.round(
rng.nextDouble() * (double) precision)) /
934 ((
double) precision);
936 return new Point3d(randomCoord.get(), randomCoord.get(),
980 fsp.fragmentLibFile =
"dummyFilename_DenoptimTest_Frag";
981 fsp.scaffoldLibFile =
"dummyFilename_DenoptimTest_Scaff";
984 IAtom s1 =
new Atom(
"C",
new Point3d(0,0,0));
995 IAtom a1 =
new Atom(
"C",
new Point3d(0,0,0));
996 IAtom a2 =
new Atom(
"C",
new Point3d(0,0,1));
997 IAtom a3 =
new Atom(
"C",
new Point3d(0,0,2));
1001 frg.
addBond(
new Bond(a1, a2));
1002 frg.
addBond(
new Bond(a2, a3));
1012 IAtom a4 =
new PseudoAtom(
"ATN",
new Point3d(0,0,0));
1082 wholeGraph.
clone(),
true);
1085 for (
int i=0; i<wholeMol.getAtomCount(); i++)
1087 IAtom atm = wholeMol.getAtom(i);
1088 if (atm instanceof PseudoAtom)
1089 ((PseudoAtom) atm).setLabel(
"Du");
1092 atm.setPoint3d(
new Point3d(r*Math.cos(Math.toRadians(360/34 * i)),
1093 r*Math.sin(Math.toRadians(360/34 * i)),0));
1099 String scafFile =
tempDir.getAbsolutePath() +
SEP +
"newScaf.sdf";
1100 String fragFile =
tempDir.getAbsolutePath() +
SEP +
"newFrag.sdf";
1101 fsp.scaffoldLibFile = scafFile;
1102 fsp.fragmentLibFile = fragFile;
1108 "Size scaffolds library");
1110 "Size fragments library");
1115 "#APs on new scaffold");
1122 assertEquals(10,nP,
"#P in new scaffold");
1127 "#APs on new fragment");
1134 assertEquals(9,nP,
"#P in new fragment");
static void deleteFile(String fileName)
Delete the file.
Class defining a space of building blocks.
ArrayList< Vertex > getFragmentsCompatibleWithTheseAPs(ArrayList< IdFragmentAndAP > srcAPs)
Searches for all building blocks that are compatible with the given list of APs.
void appendVertexToLibrary(Vertex v, Vertex.BBType bbt, ArrayList< Vertex > library)
Takes a vertex and add it to a given library.
ArrayList< IdFragmentAndAP > getFragAPsCompatibleWithTheseAPs(ArrayList< IdFragmentAndAP > srcAPs)
Searches for all APs that are compatible with the given list of APs.
boolean isDefined()
Checks for valid definition of this fragment space.
Vertex getVertexFromLibrary(Vertex.BBType bbType, int bbIdx)
Returns a clone of the requested building block.
void setAPclassBasedApproach(boolean useAPC)
Set the fragment space to behave according to APClass-based approach.
ArrayList< IdFragmentAndAP > getFragsWithAPClass(APClass apc)
Returns the list of attachment points with the given class.
List< Vertex > getVerticesWithAPClassStartingWith(String root)
Extracts vertexes from the collection of vertexes defined by this FragmentSpace.
List< Vertex > getRCVsWithAPClass(APClass apc)
Searches for all building blocks that are ring-closing vertexes and hold an AP with the given class.
ArrayList< IdFragmentAndAP > getFragAPsCompatibleWithClass(APClass aPC1)
Returns the list of attachment points found in the fragment space and that are compatible with a give...
void addFusedRingsToFragmentLibrary(DGraph graph)
Extracts a system of one or more fused rings and adds them to the fragment space if not already prese...
ArrayList< Vertex > getVerticesWithAPClass(APClass apc)
Returns the list of vertexes with attachment points of the given class.
List< Vertex > getVerticesWithAPClasses(Set< APClass > apcs)
Returns the list of vertexes with at least one attachment point of each of the given classes.
ArrayList< Vertex > getScaffoldLibrary()
ArrayList< Vertex > getFragmentLibrary()
List< Vertex > getRCVsForAPClass(APClass apc)
Searches for all building blocks that are ring-closing vertexes and are compatible with the given AP.
List< Vertex > getVerticesWithAPFingerprint(Map< APClass, Integer > apcCounts)
Returns the list of vertexes that have the specified number of AttachmentPoints with the given APClas...
Parameters defining the fragment space.
String getPathnameToAppendedFragments()
FragmentSpace getFragmentSpace()
String getPathnameToAppendedScaffolds()
TestCase(DGraph g, Template expected)
Unit test for fragment space.
void testGetVerticesWithAPClasses()
void testGetFragAPsCompatibleWithTheseAPs()
void testGetVerticesWithAPClass()
static final String RULAPCS
void testGetRCVsForAPClass()
static final String RULAPC4
static final String RULAPC1
void testFusedRingAddedToScaffoldLibrary()
Checks that a graph with a fused ring containing a scaffold vertex is added to the scaffold library.
void testUseWholeMolGeometryForExtractedTemplates()
Works with this graph:
void testFusedRingAddedToFragmentLibrary()
Check that the following graph's fused ring gets added to the fragment library.
void testGetFragsWithAPClass()
void testFusedRingOnlyAddedOnce()
static final String RULAPC3
static final String RULAPCC1
static final BBType BBTFRAG
Fragment getCarbonVertex()
static final String RULAPCC2
static final String RULAPC6
void testGetFragsWithAPClassStartingWith()
void testGetFragmentsCompatibleWithTheseAPs()
Point3d getRandomVector()
void testGetRCVsWithAPClass()
static final String RULAPC5
static final int APSUBRULE
void testGetVerticesWithAPFingerprint()
FragmentSpaceParameters buildFragmentSpace()
void testGetFragAPsCompatibleWithClass()
Template getExpectedTemplate(DGraph g, Vertex c3)
static final String RULAPC2
Data structure containing information that identifies a single AP of a vertex/fragment.
BBType getVertexMolType()
boolean isCPMapCompatibleWith(APClass other, FragmentSpace fragSpace)
Check compatibility as defined in the compatibility matrix considering this AP as source and the othe...
static final APClass RCACLASSPLUS
Conventional class of attachment points on ring-closing vertexes.
static final APClass RCACLASSMINUS
Conventional class of attachment points on ring-closing vertexes.
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
APClass getAPClass()
Returns the Attachment Point class.
Container for the list of vertices and the edges that connect them.
void addVertex(Vertex vertex)
Appends a vertex to this graph without creating any edge.
void removeVertex(Vertex vertex)
Remove a vertex from this graph.
Vertex getVertexAtPosition(int pos)
Returns the vertex that is in the given position of the list of vertices belonging to this graph.
void appendVertexOnAP(AttachmentPoint srcAP, AttachmentPoint trgAP)
Append a vertex to this graph: adds the new vertex to the list of vertices belonging to the graph,...
List< Vertex > getVertexList()
DGraph clone()
Returns almost "deep-copy" of this graph.
void renumberGraphVertices()
Reassign vertex IDs to all vertices of this graph.
void addEdge(Edge edge)
Adds the edge to the list of edges belonging to this graph.
This class represents the edge between two vertices.
Class representing a continuously connected portion of chemical object holding attachment points.
boolean sameAs(Fragment other, StringBuilder reason)
Compares this and another fragment ignoring vertex IDs.
void addAP(int atomPositionNumber)
Adds an attachment point with a dummy APClass.
AttachmentPoint addAPOnAtom(IAtom srcAtm, APClass apc, Point3d vector)
Add an attachment point to the specifies atom.
void projectAPsToProperties()
Finds the DENOPTIMAttachmentPoint objects defined as properties of the atoms in this container,...
This class represents the closure of a ring in a spanning tree.
A collection of AttachmentPoints that are related by a relation that we call "symmetry",...
void setInnerGraph(DGraph innerGraph)
boolean sameAs(Template other, StringBuilder reason)
Compares this and another template ignoring vertex IDs.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
void setAsRCV(boolean isRCV)
abstract List< AttachmentPoint > getAttachmentPoints()
void setBuildingBlockId(int buildingBlockId)
abstract List< SymmetricAPs > getSymmetricAPSets()
void setBuildingBlockType(Vertex.BBType buildingBlockType)
abstract IAtomContainer getIAtomContainer()
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
static Vertex newVertexFromLibrary(int bbId, Vertex.BBType bbt, FragmentSpace fragSpace)
Builds a new molecular fragment kind of vertex.
The RingClosingAttractor represent the available valence/connection that allows to close a ring.
static final HashMap< APClass, String > RCALABELPERAPCLASS
Conventional labels for attractor pseudoatom.
Utility methods for input/output.
static void writeCompatibilityMatrix(String fileName, HashMap< APClass, ArrayList< APClass > > cpMap, HashMap< APClass, APClass > capMap, HashSet< APClass > ends)
The class compatibility matrix.
static void writeVertexesToSDF(File file, List< Vertex > vertexes, boolean append)
Write a list of vertexes to file.
Tool to build build three-dimensional (3D) tree-like molecular structures from DGraph.
IAtomContainer convertGraphTo3DAtomContainer(DGraph graph)
Created a three-dimensional molecular representation from a given DGraph.
Logger getLogger()
Get the name of the program specific logger.
Randomizer getRandomizer()
Returns the current program-specific randomizer.
static synchronized long getUniqueVertexIndex()
Unique counter for the number of graph vertices generated.
Utilities for molecule conversion.
static String getSymbolOrLabel(IAtom atm)
Gets either the elemental symbol (for standard atoms) of the label (for pseudo-atoms).
Possible chemical bond types an edge can represent.
The type of building block.