$darkmode
DENOPTIM
ChemicalObjectModel.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.molecularmodeling;
20
21import java.util.ArrayList;
22import java.util.Arrays;
23import java.util.HashMap;
24import java.util.HashSet;
25import java.util.List;
26import java.util.Map;
27import java.util.Set;
28import java.util.logging.Level;
29import java.util.logging.Logger;
30
31import javax.vecmath.Point3d;
32import javax.vecmath.Vector3d;
33
34import org.openscience.cdk.graph.PathTools;
35import org.openscience.cdk.graph.SpanningTree;
36import org.openscience.cdk.interfaces.IAtom;
37import org.openscience.cdk.interfaces.IAtomContainer;
38import org.openscience.cdk.interfaces.IBond;
39import org.openscience.cdk.interfaces.IChemObjectBuilder;
40import org.openscience.cdk.interfaces.IRingSet;
41import org.openscience.cdk.silent.RingSet;
42import org.openscience.cdk.silent.SilentChemObjectBuilder;
43
44import denoptim.constants.DENOPTIMConstants;
45import denoptim.exception.DENOPTIMException;
46import denoptim.graph.DGraph;
47import denoptim.graph.Edge.BondType;
48import denoptim.graph.Ring;
49import denoptim.graph.rings.RingClosingAttractor;
50import denoptim.graph.rings.RingClosure;
51import denoptim.integration.tinker.TinkerAtom;
52import denoptim.integration.tinker.TinkerMolecule;
53import denoptim.utils.MathUtils;
54import denoptim.utils.ObjectPair;
55
64{
69
73 private IAtomContainer fmol;
74
79
83 private String molName;
84
88 private ArrayList<RingClosingAttractor> attractors;
89
93 private Map<RingClosingAttractor,Integer> attToAtmID;
94
99 private ArrayList<Set<ObjectPair>> allRCACombs;
100
104 private ArrayList<ObjectPair> rotatableBnds;
105
109 private ArrayList<RingClosure> newRingClosures;
110
114 private double overalRCScore = Double.NaN;
115
119 private double atmOveralScore = Double.NaN;
120
124 private Logger logger;
125
126 private ArrayList<Integer> oldToNewOrder;
127 private ArrayList<Integer> newToOldOrder;
128
129//------------------------------------------------------------------------------
130
136 {
137 this.molGraph = new DGraph();
138 IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
139 this.fmol = builder.newAtomContainer();
140 this.tmol = new TinkerMolecule();
141 this.attractors = new ArrayList<RingClosingAttractor>();
142 this.attToAtmID = new HashMap<RingClosingAttractor,Integer>();
143 this.allRCACombs = new ArrayList<Set<ObjectPair>>();
144 this.rotatableBnds = new ArrayList<ObjectPair>();
145 this.newRingClosures = new ArrayList<RingClosure>();
146 this.molName = "none";
147 this.oldToNewOrder = new ArrayList<Integer>();
148 this.newToOldOrder = new ArrayList<Integer>();
149 }
150
151//------------------------------------------------------------------------------
152
169 IAtomContainer fmol,
171 String molName,
172 ArrayList<ObjectPair> rotatableBnds,
173 ArrayList<RingClosingAttractor> attractors,
174 Map<RingClosingAttractor,Integer> attToAtmID,
175 ArrayList<Set<ObjectPair>> allRCACombs,
176 ArrayList<RingClosure> ringClosures,
177 ArrayList<Integer> oldToNewOrder,
178 ArrayList<Integer> newToOldOrder,
179 Logger logger)
180 {
181 this.molGraph = molGraph;
182 this.fmol = fmol;
183 this.tmol = tmol;
184 this.attractors = attractors;
185 this.attToAtmID = attToAtmID;
186 this.allRCACombs = allRCACombs;
187 this.rotatableBnds = rotatableBnds;
188 this.molName = molName;
189 this.newRingClosures = ringClosures;
190 this.overalRCScore = Double.NaN;
191 this.atmOveralScore = Double.NaN;
192 if (this.attractors.size() != 0)
193 {
195 {
196 // ring closures defined in the input
198 }
199 }
200 this.oldToNewOrder = oldToNewOrder;
201 this.newToOldOrder = newToOldOrder;
202 this.logger = logger;
203 }
204
205//------------------------------------------------------------------------------
206
224 public ChemicalObjectModel(DGraph molGraph, IAtomContainer fmol,
226 ArrayList<ObjectPair> rotatableBnds,
227 ArrayList<Integer> oldToNewOrder,
228 ArrayList<Integer> newToOldOrder,
229 Logger logger) throws DENOPTIMException
230 {
231 this.molGraph = molGraph;
232 this.fmol = fmol;
233 this.tmol = tmol;
235 this.molName = molName;
236 this.rotatableBnds = rotatableBnds;
237 this.molName = molName;
238 this.attractors = new ArrayList<RingClosingAttractor>();
239 this.attToAtmID = new HashMap<RingClosingAttractor,Integer>();
241 this.allRCACombs = new ArrayList<Set<ObjectPair>>();
242 if (this.attractors.size() != 0)
243 {
245 {
246 // ring closures defined in the input
248 }
249 }
250 this.newRingClosures = new ArrayList<RingClosure>();
251 this.overalRCScore = Double.NaN;
252 this.atmOveralScore = Double.NaN;
253 this.oldToNewOrder = oldToNewOrder;
254 this.newToOldOrder = newToOldOrder;
255 this.logger = logger;
256 }
257
258//------------------------------------------------------------------------------
259
260 public List<Integer> getOldToNewOrder()
261 {
262 return oldToNewOrder;
263 }
264
265//------------------------------------------------------------------------------
266
267 public List<Integer> getNewToOldOrder()
268 {
269 return newToOldOrder;
270 }
271
272//------------------------------------------------------------------------------
273
274 private void findAttractors()
275 {
276 // Identify all RingClosingAttractors
277 for (IAtom atm : fmol.atoms())
278 {
280 if (rca.isAttractor())
281 {
282 attractors.add(rca);
283 attToAtmID.put(rca, fmol.indexOf(atm));
284 }
285 }
286 }
287
288//------------------------------------------------------------------------------
289
291 {
292 //When we give the a graph with rings, we are defining the RCA
293 //combinations, so there will be only one RCA combination
294 Set<ObjectPair> singleRCAcomb = new HashSet<ObjectPair>();
295
296 for (int i=0; i<attractors.size(); i++)
297 {
298 RingClosingAttractor rcaI = attractors.get(i);
299 Ring ringOwnerI = rcaI.getRingUser();
300 if (ringOwnerI==null)
301 continue;
302
303 for (int j=i+1; j<attractors.size(); j++)
304 {
305 RingClosingAttractor rcaJ = attractors.get(j);
306 Ring ringOwnerJ = rcaJ.getRingUser();
307 if (ringOwnerJ==null)
308 continue;
309 if (ringOwnerI==ringOwnerJ)
310 {
311 singleRCAcomb.add(new ObjectPair(rcaI, rcaJ));
312 }
313 }
314 }
315 allRCACombs.add(singleRCAcomb);
316 }
317
318//------------------------------------------------------------------------------
319
326 {
327 ArrayList<Point3d> newCoords = new ArrayList<Point3d>();
328 for (int i=0; i<fmol.getAtomCount(); i++)
329 {
330 int iTnk = i + 1;
331 TinkerAtom tAtm = tmol.getAtom(iTnk);
332 int ia = tAtm.getAtomNeighbours()[0];
333 int ib = tAtm.getAtomNeighbours()[1];
334 int ic = tAtm.getAtomNeighbours()[2];
335 if (ia > i || ib > i || ic > i)
336 {
337 String msg = "ERROR! Cannot convert internal coordinates of "
338 + "atom " + i + " " + tAtm + ". Reference "
339 + "atoms have higher ID. The atoms list in "
340 + "Molecule3DBuilder needs to be reordered.";
341 throw new DENOPTIMException(msg);
342 }
343 int angleFlag = tAtm.getAtomNeighbours()[3];
344 double bond = tAtm.getDistAngle()[0];
345 double angle1 = tAtm.getDistAngle()[1] * 2 * Math.PI / 360.0;
346 double angle2 = tAtm.getDistAngle()[2] * 2 * Math.PI / 360.0;
347 double[] newXYZ = {0.0, 0.0, 0.0};
349 double s1 = Math.sin(angle1);
350 double s2 = Math.sin(angle2);
351 double c1 = Math.cos(angle1);
352 double c2 = Math.cos(angle2);
353 if (ia == 0)
354 {
355 //first atom remains on the origin
356 }
357 else if (ib == 0)
358 {
359 newXYZ[2] = bond;
360 }
361 else if (ic == 0)
362 {
363 Vector3d nab = MathUtils.normDist(
364 newCoords.get(ia-1),newCoords.get(ib-1));
365 double rab = MathUtils.distance(
366 newCoords.get(ia-1),newCoords.get(ib-1));
367 newXYZ[0] = bond * s1;
368 newXYZ[2] = newCoords.get(ib-1).z + (rab - bond*c1)*nab.z;
369 }
370 else if (angleFlag == 0)
371 {
372 Vector3d nab = MathUtils.normDist(
373 newCoords.get(ia-1),newCoords.get(ib-1));
374 Vector3d nbc = MathUtils.normDist(
375 newCoords.get(ib-1),newCoords.get(ic-1));
376 Vector3d t = new Vector3d();
377 t.cross(nbc,nab);
378 double c = nab.x*nbc.x + nab.y*nbc.y + nab.z*nbc.z;
379 if (Math.abs(c) > (1.0 - smallDble))
380 {
381 String msg = "ERROR! Linearity does not allow definition "
382 + "of the dihedral angle for atom " + i + " " + tAtm
383 + " (Value of c="+c+" too close to unity; threshold is "
384 + (1.0 - smallDble) + "). "
385 + "You better use dummy atoms to avoid linearities.";
386 throw new DENOPTIMException(msg);
387 }
388 t.scale(1/Math.sqrt(Math.max(1.00 - c*c, smallDble)));
389 Vector3d u = new Vector3d();
390 u.cross(t,nab);
391 newXYZ[0] = newCoords.get(ia-1).x
392 + bond*(u.x*s1*c2 + t.x*s1*s2 - nab.x*c1);
393 newXYZ[1] = newCoords.get(ia-1).y
394 + bond*(u.y*s1*c2 + t.y*s1*s2 - nab.y*c1);
395 newXYZ[2] = newCoords.get(ia-1).z
396 + bond*(u.z*s1*c2 + t.z*s1*s2 - nab.z*c1);
397 }
398 else if (Math.abs(angleFlag) == 1)
399 {
400 Vector3d nba = MathUtils.normDist(
401 newCoords.get(ib-1),newCoords.get(ia-1));
402 Vector3d nac = MathUtils.normDist(
403 newCoords.get(ia-1),newCoords.get(ic-1));
404 Vector3d t = new Vector3d();
405 t.cross(nac,nba);
406 double c = nba.x*nac.x + nba.y*nac.y + nba.z*nac.z;
407 if (Math.abs(c) > (1.0 - smallDble))
408 {
409 logger.log(Level.WARNING, "WARNING! close-to-linear system "
410 + "in the definition of atom " + i + " " + tAtm + ". "
411 + "You better use dummy atoms to avoid linearities.");
412 }
413 double s = Math.max(1.00 - c*c, smallDble);
414 double a = (-c2 - c*c1) / s;
415 double b = (c1 + c*c2) / s;
416 double ci = (1.00 + a*c2 - b*c1) / s;
417 if (ci > smallDble)
418 {
419 ci = angleFlag * Math.sqrt(ci);
420 }
421 else if (ci < -smallDble)
422 {
423 ci = Math.sqrt((a*nac.x+b*nba.x)*(a*nac.x+b*nba.x)
424 + (a*nac.y+b*nba.y)*(a*nac.y+b*nba.y)
425 + (a*nac.z+b*nba.z)*(a*nac.z+b*nba.z));
426 a = a / ci;
427 b = b / ci;
428 ci = 0.0;
429 logger.log(Level.WARNING, "WARNING! close-to-linear system "
430 + "in the definition of atom " + i + " " + tAtm + ". "
431 + "You better use dummy atoms to avoid linearities.");
432 }
433 else
434 {
435 ci = 0.0;
436 }
437 newXYZ[0] = newCoords.get(ia-1).x
438 + bond*(a*nac.x + b*nba.x + ci*t.x);
439 newXYZ[1] = newCoords.get(ia-1).y
440 + bond*(a*nac.y + b*nba.y + ci*t.y);
441 newXYZ[2] = newCoords.get(ia-1).z
442 + bond*(a*nac.z + b*nba.z + ci*t.z);
443 }
444 Point3d p3d = new Point3d(newXYZ[0],newXYZ[1],newXYZ[2]);
445 newCoords.add(p3d);
446 }
447
448 // Update Cartesian coordinates
449 for (int i=0; i<fmol.getAtomCount(); i++)
450 {
451 fmol.getAtom(i).setPoint3d(newCoords.get(i));
452 tmol.getAtom(i+1).moveTo(newCoords.get(i).x,
453 newCoords.get(i).y,
454 newCoords.get(i).z);
455 }
456 }
457
458//------------------------------------------------------------------------------
459
466 {
467 return molGraph;
468 }
469
470//------------------------------------------------------------------------------
471
476 public IAtomContainer getIAtomContainer()
477 {
478 return fmol;
479 }
480
481//------------------------------------------------------------------------------
482
488 {
489 return tmol;
490 }
491
492//------------------------------------------------------------------------------
493
498 public ArrayList<RingClosingAttractor> getAttractorsList()
499 {
500 return attractors;
501 }
502
503//------------------------------------------------------------------------------
504
510 {
511 return attractors.get(i);
512 }
513
514//------------------------------------------------------------------------------
515
522 {
523 return attToAtmID.get(rca);
524 }
525
526//------------------------------------------------------------------------------
527
534 {
535 return attToAtmID.get(rca) + 1;
536 }
537
538//------------------------------------------------------------------------------
539
547 public ArrayList<Set<ObjectPair>> getRCACombinations()
548 {
549 return allRCACombs;
550 }
551
552//------------------------------------------------------------------------------
553
558 public ArrayList<ObjectPair> getRotatableBonds()
559 {
560 return rotatableBnds;
561 }
562
563//------------------------------------------------------------------------------
564
570 {
571 return rotatableBnds.size();
572 }
573
574//------------------------------------------------------------------------------
575
581 public ArrayList<RingClosure> getNewRingClosures()
582 {
583 return newRingClosures;
584 }
585
586//------------------------------------------------------------------------------
587
593 {
594 if (Double.isNaN(overalRCScore))
595 {
596 double score = 0.0;
598 {
599 score = score + rc.getRingClosureQuality();
600 }
601 overalRCScore = score;
602 }
603 return overalRCScore;
604 }
605
606//------------------------------------------------------------------------------
607
613 public double getAtomOverlapScore()
614 {
615 if (Double.isNaN(atmOveralScore))
616 {
617 double score = 0.0;
618 for (IAtom atmA : fmol.atoms())
619 {
620 String elA = atmA.getSymbol();
621
622 if (DENOPTIMConstants.DUMMYATMSYMBOL.equals(elA))
623 continue;
624
625 IAtom[] toExclude = PathTools.findClosestByBond(fmol,atmA,4);
626 for (IAtom atmB : fmol.atoms())
627 {
628 if (atmA == atmB)
629 continue;
630
631 if (Arrays.asList(toExclude).contains(atmB))
632 continue;
633
634 String elB = atmB.getSymbol();
635 if (DENOPTIMConstants.DUMMYATMSYMBOL.equals(elB))
636 continue;
637
638 double dist = atmA.getPoint3d().distance(atmB.getPoint3d());
639 score = score + dist;
640 }
641 }
642 atmOveralScore = score;
643 }
644 return atmOveralScore;
645 }
646
647//------------------------------------------------------------------------------
648
653 public String getName()
654 {
655 return molName;
656 }
657
658//------------------------------------------------------------------------------
659
670 public void addBond(IAtom atmA, IAtom atmB, RingClosure nRc,
671 BondType bndTyp)
672 {
673 this.newRingClosures.add(nRc);
674 this.overalRCScore = Double.NaN;
675
676 int iA = fmol.indexOf(atmA);
677 int iB = fmol.indexOf(atmB);
678
679 if (bndTyp.hasCDKAnalogue())
680 {
681 this.fmol.addBond(iA, iB, bndTyp.getCDKOrder());
682 logger.log(Level.FINE, "ADDING BOND: "+iA+" "+iB);
683 } else {
684 logger.log(Level.FINE, "WARNING! Attempt to add ring closing bond "
685 + "did not add any actual chemical bond because the "
686 + "bond type of the chord is '" + bndTyp +"'.");
687 }
688
689 if (iA < iB)
690 {
691 this.tmol.addBond(iA+1, iB+1);
692 }
693 else
694 {
695 this.tmol.addBond(iB+1, iA+1);
696 }
697 }
698
699//------------------------------------------------------------------------------
700
707 {
708 //Get all rings
709 SpanningTree st = new SpanningTree(fmol);
710 IRingSet allRings = new RingSet();
711 try {
712 allRings = st.getAllRings();
713 } catch (Exception ex) {
714 throw new DENOPTIMException(ex);
715 }
716
717 //Identify bonds to remove (cyclic bonds)
718 ArrayList<ObjectPair> toRemove = new ArrayList<ObjectPair>();
719 for (ObjectPair op : rotatableBnds)
720 {
721 int i1 = ((Integer)op.getFirst()).intValue();
722 int i2 = ((Integer)op.getSecond()).intValue();
723
724 IBond bnd = fmol.getBond(fmol.getAtom(i1), fmol.getAtom(i2));
725 IRingSet rs = allRings.getRings(bnd);
726 if (!rs.isEmpty())
727 {
728 toRemove.add(op);
729 logger.log(Level.FINE, "Bond " + i1 + "-" + i2 + " (TnkID:"
730 + (i1+1) + "-" + (i2+1) + ") is not rotatable anymore");
731 }
732 }
733
734 //Remove bonds
735 for (ObjectPair op : toRemove)
736 {
737 rotatableBnds.remove(op);
738 }
739 }
740
741//------------------------------------------------------------------------------
742
750 @SuppressWarnings("unchecked")
752 {
753 String nMolName = this.molName;
754 DGraph nMolGraph = this.molGraph.clone();
755 IAtomContainer nFMol;
756 TinkerMolecule nTMol;
757 ArrayList<ObjectPair> nRotBnds;
758
759 try
760 {
761 nFMol = this.fmol.clone();
762 nTMol = (TinkerMolecule) this.tmol.deepCopy();
763 nRotBnds = (ArrayList<ObjectPair>) this.rotatableBnds.clone();
764 }
765 catch (CloneNotSupportedException cns)
766 {
767 throw new DENOPTIMException(cns);
768 }
769
770 ArrayList<RingClosingAttractor> nAttractors =
771 new ArrayList<RingClosingAttractor>();
772 Map<RingClosingAttractor,Integer> nAttToAtmID =
773 new HashMap<RingClosingAttractor,Integer>();
774 Map<RingClosingAttractor,RingClosingAttractor> oldToNewRCA =
775 new HashMap<RingClosingAttractor,RingClosingAttractor>();
776 for (int iorca=0; iorca<attractors.size(); iorca++)
777 {
778 RingClosingAttractor oRca = attractors.get(iorca);
779 int ioatm = this.getAtmIdOfRCA(oRca);
780 IAtom atm = nFMol.getAtom(ioatm);
781 RingClosingAttractor nRca = new RingClosingAttractor(atm,nFMol);
782 nAttractors.add(nRca);
783 nAttToAtmID.put(nRca, ioatm);
784 oldToNewRCA.put(oRca, nRca);
785 }
786
787 ArrayList<Set<ObjectPair>> nAllRCACombs =
788 new ArrayList<Set<ObjectPair>>();
789 for (Set<ObjectPair> sop : this.allRCACombs)
790 {
791 Set<ObjectPair> nSop = new HashSet<ObjectPair>();
792 for (ObjectPair op : sop)
793 {
794 ObjectPair nOp = new ObjectPair(
795 oldToNewRCA.get(op.getFirst()),
796 oldToNewRCA.get(op.getSecond()));
797 nSop.add(nOp);
798 }
799 nAllRCACombs.add(nSop);
800 }
801
802 ArrayList<RingClosure> nNewRingClosures = new ArrayList<RingClosure>();
803 for (RingClosure rc : this.newRingClosures)
804 {
805 nNewRingClosures.add(rc.deepCopy());
806 }
807
808 ArrayList<Integer> newOldToNewOrder = new ArrayList<Integer>();
809 for (Integer i : oldToNewOrder)
810 newOldToNewOrder.add(i.intValue());
811
812 ArrayList<Integer> newNewToOldOrder = new ArrayList<Integer>();
813 for (Integer i : newToOldOrder)
814 newNewToOldOrder.add(i.intValue());
815
816 ChemicalObjectModel molClone = new ChemicalObjectModel(nMolGraph,
817 nFMol,
818 nTMol,
819 nMolName,
820 nRotBnds,
821 nAttractors,
822 nAttToAtmID,
823 nAllRCACombs,
824 nNewRingClosures,
825 newOldToNewOrder,
826 newNewToOldOrder, logger);
827
828 return molClone;
829 }
830
831//------------------------------------------------------------------------------
832}
General set of constants used in DENOPTIM.
static final double FLOATCOMPARISONTOLERANCE
Smallest difference for comparison of double and float numbers.
static final String DUMMYATMSYMBOL
Symbol of dummy atom.
Container for the list of vertices and the edges that connect them.
Definition: DGraph.java:102
DGraph clone()
Returns almost "deep-copy" of this graph.
Definition: DGraph.java:3186
boolean hasOrEmbedsRings()
Check for rings in this graph and in any graph that is embedded at any level in any vertex of this gr...
Definition: DGraph.java:906
This class represents the closure of a ring in a spanning tree.
Definition: Ring.java:40
The RingClosingAttractor represent the available valence/connection that allows to close a ring.
Ring getRingUser()
Get the reference to the graph representation of the ring this attractor is meant to close.
boolean isAttractor()
Checks whether the constructed RingClosingAttractor does corresponds to a RingClosingAttractor in the...
RingClosure represents the arrangement of atoms and PseudoAtoms identifying the head and tail of a ch...
Based on the code from ffx.kenai.com Michael J.
Definition: TinkerAtom.java:26
void moveTo(double[] d)
Add a vector to the Atom's current position vector.
TinkerMolecule deepCopy()
This method produces a deep copy of the object.
void addBond(int a1, int a2)
Add one bond by appending a pair of indeces into the z-add section.
TinkerAtom getAtom(int pos)
Returns the atom which has the XYZ index set to pos.
Object clone()
This method produces a shallow copy of the object.
Collector of molecular information, related to a single chemical object, that is deployed within the ...
ChemicalObjectModel(DGraph molGraph, IAtomContainer fmol, TinkerMolecule tmol, String molName, ArrayList< ObjectPair > rotatableBnds, ArrayList< Integer > oldToNewOrder, ArrayList< Integer > newToOldOrder, Logger logger)
Constructs a Molecule3DBuilder specifying all its features.
double getAtomOverlapScore()
Return the atoms overlap score which is calculated for all atoms pairs not in 1-4 or lower relationsh...
double overalRCScore
Quality score of the list of RingClosures.
double getNewRingClosuresQuality()
Return the overal evaluation of the whole list of RingClosures.
Map< RingClosingAttractor, Integer > attToAtmID
Relation between RingClosingAttractor and atom ID.
int getTnkAtmIdOfRCA(RingClosingAttractor rca)
Returns the Tinker atom number, 1 to n,of the given RingClosingAttractor.
ArrayList< RingClosingAttractor > attractors
List of Ring Closing Attractors.
ChemicalObjectModel deepcopy()
Return a new Molecule3DBuilder having exactly the same features of this Molecule3DBuilder.
int getNumberRotatableBonds()
Returns the size of the current list of rotatable bonds.
DGraph getGraph()
Returns the graph representation of this molecule as it was originally generated by DEOPTIM.
int getAtmIdOfRCA(RingClosingAttractor rca)
Returns the CDK atom number, 0 to (n-1), of the given RingClosingAttractor.
String getName()
Return the name of this molecule.
void purgeListRotatableBonds()
Remove the cyclic bonds from the list of rotatable bonds.
ArrayList< ObjectPair > rotatableBnds
List of rotatable bonds.
IAtomContainer getIAtomContainer()
Returns the CDK representation of the molecular system.
void addBond(IAtom atmA, IAtom atmB, RingClosure nRc, BondType bndTyp)
Modify the molecule adding a cyclic bond between two atoms.
ArrayList< RingClosingAttractor > getAttractorsList()
Returns the list of RuingClosingAttractors.
ArrayList< ObjectPair > getRotatableBonds()
Returns the list of rotatable bonds.
ChemicalObjectModel(DGraph molGraph, IAtomContainer fmol, TinkerMolecule tmol, String molName, ArrayList< ObjectPair > rotatableBnds, ArrayList< RingClosingAttractor > attractors, Map< RingClosingAttractor, Integer > attToAtmID, ArrayList< Set< ObjectPair > > allRCACombs, ArrayList< RingClosure > ringClosures, ArrayList< Integer > oldToNewOrder, ArrayList< Integer > newToOldOrder, Logger logger)
Constructs an item specifying all its features.
ArrayList< RingClosure > newRingClosures
List of new ring closing environments.
void updateXYZFromINT()
Converts currently loaded internal coordinates into Cartesian overwriting the current XYZ.
double atmOveralScore
Atom overlap score (for atoms not is 1-4 or lower relationship)
ArrayList< Set< ObjectPair > > getRCACombinations()
Returns the list of combinations of RingClosingAttractor.
TinkerMolecule tmol
Tinker internal coordinates representation.
ArrayList< Set< ObjectPair > > allRCACombs
List of combinations of RingClosingAttractors (i.e., possible set of rings to create)
TinkerMolecule getTinkerMolecule()
Returns the Tinker Internal Coordination representation of the molecule.
ArrayList< RingClosure > getNewRingClosures()
Return the list of RingClosures that have been identified as closable head/tail of atom chains during...
RingClosingAttractor getAttractor(int i)
Returns the attractor given its position in the list of attractors.
Some useful math operations.
Definition: MathUtils.java:39
static Vector3d normDist(Point3d p1, Point3d p2)
Get normalized distance between two point.
Definition: MathUtils.java:86
static double distance(Point3d a, Point3d b)
Calculates distance between point a and point b.
Definition: MathUtils.java:342
This class is the equivalent of the Pair data structure used in C++ Although AbstractMap....
Definition: ObjectPair.java:30
Possible chemical bond types an edge can represent.
Definition: Edge.java:303
boolean hasCDKAnalogue()
Checks if it is possible to convert this edge type into a CDK bond.
Definition: Edge.java:328