22import static org.junit.jupiter.api.Assertions.assertEquals;
23import static org.junit.jupiter.api.Assertions.assertFalse;
24import static org.junit.jupiter.api.Assertions.assertNotEquals;
25import static org.junit.jupiter.api.Assertions.assertTrue;
27import java.util.ArrayList;
29import javax.vecmath.Point3d;
31import org.junit.jupiter.api.Test;
32import org.openscience.cdk.Atom;
33import org.openscience.cdk.interfaces.IAtomContainer;
34import org.openscience.cdk.silent.Bond;
36import denoptim.constants.DENOPTIMConstants;
37import denoptim.exception.DENOPTIMException;
38import denoptim.utils.DummyAtomHandler;
48 private static final String
APRULE =
"MyRule";
51 + DENOPTIMConstants.SEPARATORAPPROPSCL +
APSUBRULE;
60 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
61 Atom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
62 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
69 new Point3d(
new double[]{0.0, 2.2, 3.3}));
71 new Point3d(
new double[]{0.0, 0.0, 3.3}));
73 new Point3d(
new double[]{0.0, 0.0, 1.1}));
75 new Point3d(
new double[]{3.0, 0.0, 3.3}));
81 Atom a4 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
82 Atom a5 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
83 Atom a6 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
95 "Equality of #AP-on-atom");
108 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
109 Atom a2 =
new Atom(
"O",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
110 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
114 frg1.
addBond(
new Bond(a1, a2));
115 frg1.
addBond(
new Bond(a2, a3));
117 new Point3d(
new double[]{1.0, 2.5, 3.3}));
119 new Point3d(
new double[]{2.0, -2.5, 3.3}));
121 new Point3d(
new double[]{-2.0, -2.5, 3.3}));
123 new Point3d(
new double[]{2.5, 2.5, 3.3}));
125 new Point3d(
new double[]{3.0, 2.5, 3.3}));
127 new Point3d(
new double[]{4.0, -2.5, 3.3}));
129 new Point3d(
new double[]{-4.0, -2.5, 3.3}));
146 "SymmSet [0,4] in frg1");
148 "SymmSet [0,4] in frg2");
150 "SymmSet [1,5] in frg1");
152 "SymmSet [1,5] in frg2");
160 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
161 Atom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
162 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
169 new Point3d(
new double[]{0.0, 2.2, 3.3}));
171 new Point3d(
new double[]{0.0, 0.0, 3.3}));
173 new Point3d(
new double[]{0.0, 0.0, 1.1}));
175 new Point3d(
new double[]{3.0, 0.0, 3.3}));
177 ArrayList<SymmetricAPs> ssaps =
new ArrayList<SymmetricAPs>();
207 assertEquals(4,((
Fragment) c).getNumberOfAPs(),
209 assertEquals(1,((
Fragment) c).getAPCountOnAtom(0),
211 assertEquals(3,((
Fragment) c).getAPCountOnAtom(2),
214 "Number of APs (B)");
216 "Number of symmetric sets");
218 "Number of symmetric APs in set");
225 "Number of SymAPs sets");
228 assertNotEquals(v.hashCode(), c.hashCode(),
232 "Building bloc ktype");
233 assertEquals(
"PROVALUE",c.
getProperty(
"PROPNAME"));
241 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
242 Atom a2 =
new Atom(
"O",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
243 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
250 new Point3d(
new double[]{0.0, 2.2, 3.3}));
252 new Point3d(
new double[]{0.0, 0.0, 3.3}));
254 new Point3d(
new double[]{0.0, 0.0, 1.1}));
256 new Point3d(
new double[]{3.0, 0.0, 3.3}));
270 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
271 Atom a2 =
new Atom(
"O",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
272 Atom a3 =
new Atom(
"H",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
279 new Point3d(
new double[]{0.0, 2.2, 3.3}));
281 new Point3d(
new double[]{0.0, 0.0, 3.3}));
283 new Point3d(
new double[]{0.0, 0.0, 1.1}));
285 new Point3d(
new double[]{3.0, 0.0, 3.3}));
299 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
300 Atom a2 =
new Atom(
"O",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
301 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
308 new Point3d(
new double[]{0.0, 2.2, 3.3}));
310 new Point3d(
new double[]{0.0, 0.0, 3.3}));
312 new Point3d(
new double[]{0.0, 0.0, 1.1}));
314 new Point3d(
new double[]{3.0, 0.0, 3.3}));
General set of constants used in DENOPTIM.
static final String APSTAG
SDF tag defining attachment points.
static final String SEPARATORAPPROPSCL
Separator between APClass and APSubClass and coordinates.
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
Class representing a continuously connected portion of chemical object holding attachment points.
void setSymmetricAPSets(List< SymmetricAPs > sAPs)
int getAPCountOnAtom(int srcAtmId)
Returns the number of APs currently defined on a specific atom source.
AttachmentPoint addAPOnAtom(IAtom srcAtm, APClass apc, Point3d vector)
Add an attachment point to the specifies atom.
Fragment clone()
Returns a deep copy of this fragments.
boolean isIsomorphicTo(Vertex other)
Checks for isomorphism of the graph representation of this and another fragment.
IAtomContainer getIAtomContainer()
void projectAPsToProperties()
Finds the DENOPTIMAttachmentPoint objects defined as properties of the atoms in this container,...
List< SymmetricAPs > getSymmetricAPSets()
void projectPropertyToAP()
Uses the molecular property defining attachment points to create the DENOPTIMAttachmentPoint objects ...
Unit test for DENOPTIMFragment.
void testConversionToIAC()
static Fragment makeFragment()
static final String APCSEP
static Fragment makeFragmentC()
Differs from the fragment produced by makeFragmentA() only by the one APCLass.
void testHandlingAPsAsObjOrProperty()
static final String APCLASS
static Fragment makeFragmentA()
static final String APSUBRULE
void testIsomorphicInLinear()
static final String APRULE
static Fragment makeFragmentB()
Differs from the fragment produced by makeFragmentA() only by the identity of one atom.
A collection of AttachmentPoints that are related by a relation that we call "symmetry",...
boolean add(T item)
Adds an item to this list, if not already present.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
void setVertexId(long vertexId2)
Vertex.BBType getBuildingBlockType()
void setAsRCV(boolean isRCV)
abstract List< AttachmentPoint > getAttachmentPoints()
abstract List< SymmetricAPs > getSymmetricAPSets()
SymmetricAPs getSymmetricAPs(AttachmentPoint ap)
For the given attachment point index locate the symmetric partners i.e.
Object getProperty(Object property)
void setBuildingBlockType(Vertex.BBType buildingBlockType)
void setProperty(Object key, Object property)
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
Toll to add/remove dummy atoms from linearities or multi-hapto sites.
static void addDummiesOnLinearities(Fragment frag, double angLim)
Append dummy atoms on otherwise linear arrangements of atoms.
The type of building block.