$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.IRingSet;
40import org.openscience.cdk.silent.RingSet;
41
42import denoptim.constants.DENOPTIMConstants;
43import denoptim.exception.DENOPTIMException;
44import denoptim.graph.DGraph;
45import denoptim.graph.Edge.BondType;
46import denoptim.graph.Ring;
47import denoptim.graph.rings.RingClosingAttractor;
48import denoptim.graph.rings.RingClosure;
49import denoptim.molecularmodeling.zmatrix.ZMatrix;
50import denoptim.utils.MathUtils;
51import denoptim.utils.ObjectPair;
52
61{
66
70 private IAtomContainer fmol;
71
75 private ZMatrix zmat;
76
80 private String molName;
81
85 private List<RingClosingAttractor> attractors;
86
90 private Map<RingClosingAttractor,Integer> attToAtmID;
91
96 private List<Set<ObjectPair>> allRCACombs;
97
101 private List<ObjectPair> rotatableBnds;
102
106 private List<RingClosure> newRingClosures;
107
111 private double overalRCScore = Double.NaN;
112
116 private double atmOveralScore = Double.NaN;
117
121 private Logger logger;
122
123 private List<Integer> oldToNewOrder;
124 private List<Integer> newToOldOrder;
125
126//------------------------------------------------------------------------------
127
145 IAtomContainer fmol,
146 ZMatrix zmat,
147 String molName,
148 List<ObjectPair> rotatableBnds,
149 List<RingClosingAttractor> attractors,
150 Map<RingClosingAttractor,Integer> attToAtmID,
151 List<Set<ObjectPair>> allRCACombs,
152 List<RingClosure> ringClosures,
153 List<Integer> oldToNewOrder,
154 List<Integer> newToOldOrder,
155 Logger logger)
156 {
157 this.logger = logger;
158 this.molGraph = molGraph;
159 this.fmol = fmol;
160 this.zmat = zmat;
161 this.attractors = attractors;
162 this.attToAtmID = attToAtmID;
163 this.allRCACombs = allRCACombs;
164 this.rotatableBnds = rotatableBnds;
165 this.molName = molName;
166 this.newRingClosures = ringClosures;
167 this.overalRCScore = Double.NaN;
168 this.atmOveralScore = Double.NaN;
169 if (this.attractors.size() != 0)
170 {
172 {
173 // ring closures defined in the input
175 }
176 }
177 this.oldToNewOrder = oldToNewOrder;
178 this.newToOldOrder = newToOldOrder;
179 }
180
181//------------------------------------------------------------------------------
182
200 public ChemicalObjectModel(DGraph molGraph, IAtomContainer fmol,
201 ZMatrix zmat, String molName,
202 List<ObjectPair> rotatableBnds,
203 List<Integer> oldToNewOrder,
204 List<Integer> newToOldOrder,
205 Logger logger) throws DENOPTIMException
206 {
207 this.logger = logger;
208 this.molGraph = molGraph;
209 this.fmol = fmol;
210 this.zmat = zmat;
212 this.molName = molName;
213 this.rotatableBnds = rotatableBnds;
214 this.molName = molName;
215 this.attractors = new ArrayList<RingClosingAttractor>();
216 this.attToAtmID = new HashMap<RingClosingAttractor,Integer>();
218 this.allRCACombs = new ArrayList<Set<ObjectPair>>();
219 if (this.attractors.size() != 0)
220 {
222 {
223 // ring closures defined in the input
225 }
226 }
227 this.newRingClosures = new ArrayList<RingClosure>();
228 this.overalRCScore = Double.NaN;
229 this.atmOveralScore = Double.NaN;
230 this.oldToNewOrder = oldToNewOrder;
231 this.newToOldOrder = newToOldOrder;
232 }
233
234//------------------------------------------------------------------------------
235
236 public List<Integer> getOldToNewOrder()
237 {
238 return oldToNewOrder;
239 }
240
241//------------------------------------------------------------------------------
242
243 public List<Integer> getNewToOldOrder()
244 {
245 return newToOldOrder;
246 }
247
248//------------------------------------------------------------------------------
249
250 private void findAttractors()
251 {
252 // Identify all RingClosingAttractors
253 for (IAtom atm : fmol.atoms())
254 {
256 if (rca.isAttractor())
257 {
258 attractors.add(rca);
259 attToAtmID.put(rca, fmol.indexOf(atm));
260 }
261 }
262 }
263
264//------------------------------------------------------------------------------
265
267 {
268 //When we give the a graph with rings, we are defining the RCA
269 //combinations, so there will be only one RCA combination
270 Set<ObjectPair> singleRCAcomb = new HashSet<ObjectPair>();
271
272 for (int i=0; i<attractors.size(); i++)
273 {
274 RingClosingAttractor rcaI = attractors.get(i);
275 Ring ringOwnerI = rcaI.getRingUser();
276 if (ringOwnerI==null)
277 continue;
278
279 for (int j=i+1; j<attractors.size(); j++)
280 {
281 RingClosingAttractor rcaJ = attractors.get(j);
282 Ring ringOwnerJ = rcaJ.getRingUser();
283 if (ringOwnerJ==null)
284 continue;
285 if (ringOwnerI==ringOwnerJ)
286 {
287 singleRCAcomb.add(new ObjectPair(rcaI, rcaJ));
288 }
289 }
290 }
291 allRCACombs.add(singleRCAcomb);
292 }
293
294//------------------------------------------------------------------------------
295
301 public void updateXYZ(List<Point3d> newCoords) throws DENOPTIMException
302 {
303 for (int i=0; i<fmol.getAtomCount(); i++)
304 {
305 fmol.getAtom(i).setPoint3d(newCoords.get(i));
306 }
307 }
308
309//------------------------------------------------------------------------------
310
317 {
318 List<Point3d> newCoords = new ArrayList<Point3d>();
319 for (int i=0; i<fmol.getAtomCount(); i++)
320 {
321 int ia = zmat.getBondRefAtomIndex(i);
322 int ib = zmat.getAngleRefAtomIndex(i);
323 int ic = zmat.getAngle2RefAtomIndex(i);
324 if ((ia != -1 && ia > i) || (ib != -1 && ib > i) || (ic != -1 && ic > i))
325 {
326 String msg = "ERROR! Cannot convert internal coordinates of "
327 + "atom " + i + ". Reference "
328 + "atoms have higher ID. The atoms list in "
329 + "Molecule3DBuilder needs to be reordered.";
330 throw new DENOPTIMException(msg);
331 }
332 Integer chirality = zmat.getChiralFlag(i);
333 Double bond = zmat.getBondLength(i);
334 Double angle1 = zmat.getAngleValue(i);
335 Double angle2 = zmat.getAngle2Value(i);
336
337 double[] newXYZ = {0.0, 0.0, 0.0};
338
340 if (ia == -1 && ib == -1 && ic == -1)
341 {
342 //first atom remains on the origin
343 }
344 else if (ib == -1 && ic == -1)
345 {
346 if (bond == null)
347 {
348 String msg = "ERROR! Cannot convert internal coordinates of "
349 + "atom " + i + ". Bond length is null.";
350 throw new DENOPTIMException(msg);
351 }
352 newXYZ[2] = bond;
353 }
354 else if (ic == -1)
355 {
356 if (bond == null)
357 {
358 String msg = "ERROR! Cannot convert internal coordinates of "
359 + "atom " + i + ". Bond length is null.";
360 throw new DENOPTIMException(msg);
361 }
362 if (angle1 == null)
363 {
364 String msg = "ERROR! Cannot convert internal coordinates of "
365 + "atom " + i + ". Angle 1 is null.";
366 throw new DENOPTIMException(msg);
367 }
368 double s1 = Math.sin(angle1 * 2 * Math.PI / 360.0);
369 double c1 = Math.cos(angle1 * 2 * Math.PI / 360.0);
370 Vector3d nab = MathUtils.normDist(
371 newCoords.get(ia),newCoords.get(ib));
372 double rab = MathUtils.distance(
373 newCoords.get(ia),newCoords.get(ib));
374 newXYZ[0] = bond * s1;
375 newXYZ[2] = newCoords.get(ib).z + (rab - bond*c1)*nab.z;
376 }
377 else
378 {
379 if (bond == null)
380 {
381 String msg = "ERROR! Cannot convert internal coordinates of "
382 + "atom " + i + ". Bond length is null.";
383 throw new DENOPTIMException(msg);
384 }
385 if (angle1 == null)
386 {
387 String msg = "ERROR! Cannot convert internal coordinates of "
388 + "atom " + i + ". Angle 1 is null.";
389 throw new DENOPTIMException(msg);
390 }
391 if (angle2 == null)
392 {
393 String msg = "ERROR! Cannot convert internal coordinates of "
394 + "atom " + i + ". Angle 2 is null.";
395 throw new DENOPTIMException(msg);
396 }
397 if (chirality == null)
398 {
399 String msg = "ERROR! Cannot convert internal coordinates of "
400 + "atom " + i + ". Chirality is null.";
401 throw new DENOPTIMException(msg);
402 }
403 double s1 = Math.sin(angle1 * 2 * Math.PI / 360.0);
404 double s2 = Math.sin(angle2 * 2 * Math.PI / 360.0);
405 double c1 = Math.cos(angle1 * 2 * Math.PI / 360.0);
406 double c2 = Math.cos(angle2 * 2 * Math.PI / 360.0);
407
408 if (chirality.equals(0))
409 {
410 Vector3d nab = MathUtils.normDist(
411 newCoords.get(ia),newCoords.get(ib));
412 Vector3d nbc = MathUtils.normDist(
413 newCoords.get(ib),newCoords.get(ic));
414 Vector3d t = new Vector3d();
415 t.cross(nbc,nab);
416 double c = nab.x*nbc.x + nab.y*nbc.y + nab.z*nbc.z;
417 if (Math.abs(c) > (1.0 - smallDble))
418 {
419 String msg = "ERROR! Linearity does not allow definition "
420 + "of the dihedral angle for atom " + i
421 + " (Value of c="+c+" too close to unity; threshold is "
422 + (1.0 - smallDble) + "). "
423 + "You better use dummy atoms to avoid linearities.";
424 throw new DENOPTIMException(msg);
425 }
426 t.scale(1/Math.sqrt(Math.max(1.00 - c*c, smallDble)));
427 Vector3d u = new Vector3d();
428 u.cross(t,nab);
429 newXYZ[0] = newCoords.get(ia).x
430 + bond*(u.x*s1*c2 + t.x*s1*s2 - nab.x*c1);
431 newXYZ[1] = newCoords.get(ia).y
432 + bond*(u.y*s1*c2 + t.y*s1*s2 - nab.y*c1);
433 newXYZ[2] = newCoords.get(ia).z
434 + bond*(u.z*s1*c2 + t.z*s1*s2 - nab.z*c1);
435 }
436 else if (chirality.equals(1) || chirality.equals(-1))
437 {
438 Vector3d nba = MathUtils.normDist(
439 newCoords.get(ib),newCoords.get(ia));
440 Vector3d nac = MathUtils.normDist(
441 newCoords.get(ia),newCoords.get(ic));
442 Vector3d t = new Vector3d();
443 t.cross(nac,nba);
444 double c = nba.x*nac.x + nba.y*nac.y + nba.z*nac.z;
445 if (Math.abs(c) > (1.0 - smallDble))
446 {
447 logger.log(Level.WARNING, "WARNING! close-to-linear system "
448 + "in the definition of atom " + i + ". "
449 + "You better use dummy atoms to avoid linearities.");
450 }
451 double s = Math.max(1.00 - c*c, smallDble);
452 double a = (-c2 - c*c1) / s;
453 double b = (c1 + c*c2) / s;
454 double ci = (1.00 + a*c2 - b*c1) / s;
455 if (ci > smallDble)
456 {
457 ci = chirality * Math.sqrt(ci);
458 }
459 else if (ci < -smallDble)
460 {
461 ci = Math.sqrt((a*nac.x+b*nba.x)*(a*nac.x+b*nba.x)
462 + (a*nac.y+b*nba.y)*(a*nac.y+b*nba.y)
463 + (a*nac.z+b*nba.z)*(a*nac.z+b*nba.z));
464 a = a / ci;
465 b = b / ci;
466 ci = 0.0;
467 logger.log(Level.WARNING, "WARNING! close-to-linear system "
468 + "in the definition of atom " + i + ". "
469 + "You better use dummy atoms to avoid linearities.");
470 }
471 else
472 {
473 ci = 0.0;
474 }
475 newXYZ[0] = newCoords.get(ia).x
476 + bond*(a*nac.x + b*nba.x + ci*t.x);
477 newXYZ[1] = newCoords.get(ia).y
478 + bond*(a*nac.y + b*nba.y + ci*t.y);
479 newXYZ[2] = newCoords.get(ia).z
480 + bond*(a*nac.z + b*nba.z + ci*t.z);
481 }
482 }
483 Point3d p3d = new Point3d(newXYZ[0],newXYZ[1],newXYZ[2]);
484 newCoords.add(p3d);
485 }
486
487 updateXYZ(newCoords);
488 }
489
490//------------------------------------------------------------------------------
491
498 {
499 return molGraph;
500 }
501
502//------------------------------------------------------------------------------
503
508 public IAtomContainer getIAtomContainer()
509 {
510 return fmol;
511 }
512
513//------------------------------------------------------------------------------
514
520 {
521 return zmat;
522 }
523
524//------------------------------------------------------------------------------
525
530 public List<RingClosingAttractor> getAttractorsList()
531 {
532 return attractors;
533 }
534
535//------------------------------------------------------------------------------
536
542 {
543 return attractors.get(i);
544 }
545
546//------------------------------------------------------------------------------
547
554 {
555 return attToAtmID.get(rca);
556 }
557
558//------------------------------------------------------------------------------
559
567 {
568 int rcaIdx = getZMatIdxOfRCA(rca);
569 return zmat.getBondRefAtomIndex(rcaIdx);
570 }
571
572//------------------------------------------------------------------------------
573
581 public List<Set<ObjectPair>> getRCACombinations()
582 {
583 return allRCACombs;
584 }
585
586//------------------------------------------------------------------------------
587
592 public List<ObjectPair> getRotatableBonds()
593 {
594 return rotatableBnds;
595 }
596
597//------------------------------------------------------------------------------
598
604 {
605 return rotatableBnds.size();
606 }
607
608//------------------------------------------------------------------------------
609
615 public List<RingClosure> getNewRingClosures()
616 {
617 return newRingClosures;
618 }
619
620//------------------------------------------------------------------------------
621
627 {
628 if (Double.isNaN(overalRCScore))
629 {
630 double score = 0.0;
632 {
633 score = score + rc.getRingClosureQuality();
634 }
635 overalRCScore = score;
636 }
637 return overalRCScore;
638 }
639
640//------------------------------------------------------------------------------
641
647 public double getAtomOverlapScore()
648 {
649 if (Double.isNaN(atmOveralScore))
650 {
651 double score = 0.0;
652 for (IAtom atmA : fmol.atoms())
653 {
654 String elA = atmA.getSymbol();
655
656 if (DENOPTIMConstants.DUMMYATMSYMBOL.equals(elA))
657 continue;
658
659 IAtom[] toExclude = PathTools.findClosestByBond(fmol,atmA,4);
660 for (IAtom atmB : fmol.atoms())
661 {
662 if (atmA == atmB)
663 continue;
664
665 if (Arrays.asList(toExclude).contains(atmB))
666 continue;
667
668 String elB = atmB.getSymbol();
669 if (DENOPTIMConstants.DUMMYATMSYMBOL.equals(elB))
670 continue;
671
672 double dist = atmA.getPoint3d().distance(atmB.getPoint3d());
673 score = score + dist;
674 }
675 }
676 atmOveralScore = score;
677 }
678 return atmOveralScore;
679 }
680
681//------------------------------------------------------------------------------
682
687 public String getName()
688 {
689 return molName;
690 }
691
692//------------------------------------------------------------------------------
693
704 public void addBond(IAtom atmA, IAtom atmB, RingClosure nRc,
705 BondType bndTyp)
706 {
707 this.newRingClosures.add(nRc);
708 this.overalRCScore = Double.NaN;
709
710 int iA = fmol.indexOf(atmA);
711 int iB = fmol.indexOf(atmB);
712
713 if (bndTyp.hasCDKAnalogue())
714 {
715 this.fmol.addBond(iA, iB, bndTyp.getCDKOrder());
716 logger.log(Level.FINE, "ADDING BOND: "+iA+" "+iB);
717 } else {
718 logger.log(Level.FINE, "WARNING! Attempt to add ring closing bond "
719 + "did not add any actual chemical bond because the "
720 + "bond type of the chord is '" + bndTyp +"'.");
721 }
722
723 if (iA < iB)
724 {
725 this.zmat.addBond(iA, iB);
726 } else {
727 this.zmat.addBond(iB, iA);
728 }
729 }
730
731//------------------------------------------------------------------------------
732
739 {
740 //Get all rings
741 SpanningTree st = new SpanningTree(fmol);
742 IRingSet allRings = new RingSet();
743 try {
744 allRings = st.getAllRings();
745 } catch (Exception ex) {
746 throw new DENOPTIMException(ex);
747 }
748
749 //Identify bonds to remove (cyclic bonds)
750 List<ObjectPair> toRemove = new ArrayList<ObjectPair>();
751 for (ObjectPair op : rotatableBnds)
752 {
753 int i1 = ((Integer)op.getFirst()).intValue();
754 int i2 = ((Integer)op.getSecond()).intValue();
755
756 IBond bnd = fmol.getBond(fmol.getAtom(i1), fmol.getAtom(i2));
757 IRingSet rs = allRings.getRings(bnd);
758 if (!rs.isEmpty())
759 {
760 toRemove.add(op);
761 logger.log(Level.FINE, "Bond " + i1 + "-" + i2 + " (TnkID:"
762 + (i1+1) + "-" + (i2+1) + ") is not rotatable anymore");
763 }
764 }
765
766 //Remove bonds
767 for (ObjectPair op : toRemove)
768 {
769 rotatableBnds.remove(op);
770 }
771 }
772
773//------------------------------------------------------------------------------
774
783 {
784 String nMolName = this.molName;
785 DGraph nMolGraph = this.molGraph.clone();
786 IAtomContainer nFMol;
787 ZMatrix nzmat;
788 List<ObjectPair> nRotBnds;
789
790 try
791 {
792 nFMol = this.fmol.clone();
793 nzmat = (ZMatrix) this.zmat.clone();
794 }
795 catch (CloneNotSupportedException cns)
796 {
797 throw new DENOPTIMException(cns);
798 }
799
800 nRotBnds = new ArrayList<>(this.rotatableBnds);
801
802 List<RingClosingAttractor> nAttractors =
803 new ArrayList<RingClosingAttractor>();
804 Map<RingClosingAttractor,Integer> nAttToAtmID =
805 new HashMap<RingClosingAttractor,Integer>();
806 Map<RingClosingAttractor,RingClosingAttractor> oldToNewRCA =
807 new HashMap<RingClosingAttractor,RingClosingAttractor>();
808 for (int iorca=0; iorca<attractors.size(); iorca++)
809 {
810 RingClosingAttractor oRca = attractors.get(iorca);
811 int ioatm = this.attToAtmID.get(oRca);
812 IAtom atm = nFMol.getAtom(ioatm);
813 RingClosingAttractor nRca = new RingClosingAttractor(atm,nFMol);
814 nAttractors.add(nRca);
815 nAttToAtmID.put(nRca, ioatm);
816 oldToNewRCA.put(oRca, nRca);
817 }
818
819 List<Set<ObjectPair>> nAllRCACombs =
820 new ArrayList<Set<ObjectPair>>();
821 for (Set<ObjectPair> sop : this.allRCACombs)
822 {
823 Set<ObjectPair> nSop = new HashSet<ObjectPair>();
824 for (ObjectPair op : sop)
825 {
826 ObjectPair nOp = new ObjectPair(
827 oldToNewRCA.get(op.getFirst()),
828 oldToNewRCA.get(op.getSecond()));
829 nSop.add(nOp);
830 }
831 nAllRCACombs.add(nSop);
832 }
833
834 List<RingClosure> nNewRingClosures = new ArrayList<RingClosure>();
835 for (RingClosure rc : this.newRingClosures)
836 {
837 nNewRingClosures.add(rc.deepCopy());
838 }
839
840 List<Integer> newOldToNewOrder = new ArrayList<Integer>();
841 for (Integer i : oldToNewOrder)
842 newOldToNewOrder.add(i.intValue());
843
844 List<Integer> newNewToOldOrder = new ArrayList<Integer>();
845 for (Integer i : newToOldOrder)
846 newNewToOldOrder.add(i.intValue());
847
848 ChemicalObjectModel molClone = new ChemicalObjectModel(nMolGraph,
849 nFMol,
850 nzmat,
851 nMolName,
852 nRotBnds,
853 nAttractors,
854 nAttToAtmID,
855 nAllRCACombs,
856 nNewRingClosures,
857 newOldToNewOrder,
858 newNewToOldOrder, logger);
859
860 return molClone;
861 }
862
863//------------------------------------------------------------------------------
864}
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:3415
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:1134
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...
Collector of molecular information, related to a single chemical object, that is deployed within the ...
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 ring closures.
List< RingClosure > newRingClosures
List of new ring closing environments.
List< RingClosingAttractor > getAttractorsList()
Returns the list of RuingClosingAttractors.
double getNewRingClosuresQuality()
Return the overal evaluation of the whole list of RingClosures.
Map< RingClosingAttractor, Integer > attToAtmID
Relation between RingClosingAttractor and index in the ZMatrix.
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.
ChemicalObjectModel(DGraph molGraph, IAtomContainer fmol, ZMatrix zmat, String molName, List< ObjectPair > rotatableBnds, List< Integer > oldToNewOrder, List< Integer > newToOldOrder, Logger logger)
Constructs a Molecule3DBuilder specifying all its features.
List< ObjectPair > getRotatableBonds()
Returns the list of rotatable bonds.
List< Set< ObjectPair > > getRCACombinations()
Returns the list of combinations of RingClosingAttractor.
String getName()
Return the name of this molecule.
void purgeListRotatableBonds()
Remove the cyclic bonds from the list of rotatable bonds.
IAtomContainer getIAtomContainer()
Returns the CDK representation of the molecular system.
List< ObjectPair > rotatableBnds
List of rotatable bonds.
void addBond(IAtom atmA, IAtom atmB, RingClosure nRc, BondType bndTyp)
Modify the molecule adding a cyclic bond between two atoms.
List< RingClosure > getNewRingClosures()
Return the list of RingClosures that have been identified as closable head/tail of atom chains during...
ZMatrix getZMatrix()
Returns the ZMatrix representation of the molecule.
void updateXYZ(List< Point3d > newCoords)
currently loaded internal coordinates into Cartesian overwriting the current XYZ.
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)
ChemicalObjectModel(DGraph molGraph, IAtomContainer fmol, ZMatrix zmat, String molName, List< ObjectPair > rotatableBnds, List< RingClosingAttractor > attractors, Map< RingClosingAttractor, Integer > attToAtmID, List< Set< ObjectPair > > allRCACombs, List< RingClosure > ringClosures, List< Integer > oldToNewOrder, List< Integer > newToOldOrder, Logger logger)
Constructs an item specifying all its features.
List< RingClosingAttractor > attractors
List of RingClosingAttractors.
List< Set< ObjectPair > > allRCACombs
List of combinations of RingClosingAttractor (i.e., possible set of rings to create)
RingClosingAttractor getAttractor(int i)
Returns the attractor given its position in the list of attractors.
Representation of an atom container's geometry with internal coordinates.
Definition: ZMatrix.java:27
Integer getChiralFlag(int index)
Get the chiral flag for the atom at the given index.
Definition: ZMatrix.java:375
int getBondRefAtomIndex(int index)
Get the index of the bond reference atom for the atom at the given index.
Definition: ZMatrix.java:270
ZMatrix clone()
Clone the ZMatrix.
Definition: ZMatrix.java:485
Double getBondLength(int index)
Get the bond length for the atom at the given index.
Definition: ZMatrix.java:339
void addBond(int a1, int a2)
Add a bond between the two atoms at the given indices.
Definition: ZMatrix.java:461
Double getAngle2Value(int index)
Get the angle2 angle for the atom at the given index.
Definition: ZMatrix.java:363
Double getAngleValue(int index)
Get the bond angle for the atom at the given index.
Definition: ZMatrix.java:351
int getAngle2RefAtomIndex(int index)
Get the index of the second angle reference atom for the atom at the given index.
Definition: ZMatrix.java:325
int getAngleRefAtomIndex(int index)
Get the index of the angle reference atom for the atom at the given index.
Definition: ZMatrix.java:297
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