$darkmode
DENOPTIM
ZMatrix.java
Go to the documentation of this file.
1package denoptim.molecularmodeling.zmatrix;
2
3import java.util.ArrayList;
4import java.util.Collections;
5import java.util.HashSet;
6import java.util.List;
7import java.util.Set;
8
9import org.openscience.cdk.interfaces.IAtom;
10import org.openscience.cdk.interfaces.IAtomContainer;
11import org.openscience.cdk.interfaces.IBond;
12
13import denoptim.constants.DENOPTIMConstants;
14import denoptim.exception.DENOPTIMException;
15import denoptim.utils.ConnectedLigand;
16import denoptim.utils.ConnectedLigandComparator;
17import denoptim.utils.MathUtils;
18import denoptim.utils.MoleculeUtils;
19import denoptim.utils.ObjectPair;
20import denoptim.utils.RotationalSpaceUtils;
21
22
26public class ZMatrix
27{
31 private String id;
32
36 private List<ZMatrixAtom> lstAtoms;
37
42 private List<ZMatrixBond> lstBonds;
43
44//------------------------------------------------------------------------------
45
49 public ZMatrix()
50 {
51 lstAtoms = new ArrayList<>();
52 lstBonds = new ArrayList<>();
53 }
54
55//------------------------------------------------------------------------------
56
61 public void addAtom(ZMatrixAtom atom)
62 {
63 lstAtoms.add(atom);
64 }
65
66//------------------------------------------------------------------------------
67
72 public void removeAtom(ZMatrixAtom atm)
73 {
74 lstAtoms.remove(atm);
75 List<ZMatrixBond> bondsToRemove = new ArrayList<>();
76 for (ZMatrixBond bond : lstBonds)
77 {
78 if (bond.getAtm1() == atm || bond.getAtm2() == atm)
79 {
80 bondsToRemove.add(bond);
81 }
82 }
83 lstBonds.removeAll(bondsToRemove);
84 }
85
86//------------------------------------------------------------------------------
87
92 public int getAtomCount()
93 {
94 return lstAtoms.size();
95 }
96
97//------------------------------------------------------------------------------
98
103 public int getBondCount()
104 {
105 return lstBonds.size();
106 }
107
108//------------------------------------------------------------------------------
109
114 public List<int[]> getBondData()
115 {
116 List<int[]> bondData = new ArrayList<>();
117 for (ZMatrixBond bond : lstBonds)
118 {
119 bondData.add(new int[] {bond.getAtm1().getId(),
120 bond.getAtm2().getId()});
121 }
122 return bondData;
123 }
124
125//------------------------------------------------------------------------------
126
131 public String getId()
132 {
133 return id;
134 }
135
136//------------------------------------------------------------------------------
137
142 public void setId(String id)
143 {
144 this.id = id;
145 }
146
147//------------------------------------------------------------------------------
148
154 public List<int[]> getBondsToAdd()
155 {
156 List<int[]> bondsToAdd = new ArrayList<>();
157 for (ZMatrixBond bond : lstBonds)
158 {
159 boolean found = false;
160 for (ZMatrixAtom atm : lstAtoms)
161 {
162
163 if (atm.getBondRefAtom() == null)
164 continue;
165
166 if ((atm == bond.getAtm1() && atm.getBondRefAtom() == bond.getAtm2()) ||
167 (atm == bond.getAtm2() && atm.getBondRefAtom() == bond.getAtm1()))
168 {
169 found = true;
170 break;
171 }
172 }
173 if (!found)
174 {
175 bondsToAdd.add(new int[] {bond.getAtm1().getId(),
176 bond.getAtm2().getId()});
177 }
178 }
179 return bondsToAdd;
180 }
181
182//------------------------------------------------------------------------------
183
188 public List<int[]> getBondsToDel()
189 {
190 List<int[]> bondsToDel = new ArrayList<>();
191 for (int i = 0; i < lstAtoms.size(); i++)
192 {
193 ZMatrixAtom atm = lstAtoms.get(i);
194
195 if (atm.getBondRefAtom() == null)
196 continue;
197
198 boolean found = false;
199 for (ZMatrixBond bond : lstBonds)
200 {
201 if ((atm == bond.getAtm1() && atm.getBondRefAtom() == bond.getAtm2()) ||
202 (atm == bond.getAtm2() && atm.getBondRefAtom() == bond.getAtm1()))
203 {
204 found = true;
205 break;
206 }
207 }
208 if (!found)
209 {
210 bondsToDel.add(new int[] {atm.getId(), atm.getBondRefAtom().getId()});
211 }
212 }
213 return bondsToDel;
214 }
215
216//------------------------------------------------------------------------------
217
223 public ZMatrixAtom getAtom(int index)
224 {
225 return lstAtoms.get(index);
226 }
227
228//------------------------------------------------------------------------------
229
234 public List<ZMatrixAtom> getAtoms()
235 {
236 return lstAtoms;
237 }
238
239//------------------------------------------------------------------------------
240
246 public int getIndex(ZMatrixAtom atm)
247 {
248 return lstAtoms.indexOf(atm);
249 }
250
251//------------------------------------------------------------------------------
252
258 public ZMatrixAtom getBondRefAtom(int index)
259 {
260 return getAtom(index).getBondRefAtom();
261 }
262
263//------------------------------------------------------------------------------
264
270 public int getBondRefAtomIndex(int index)
271 {
272 ZMatrixAtom atm = getBondRefAtom(index);
273 if (atm == null)
274 return -1;
275 return lstAtoms.indexOf(atm);
276 }
277
278//------------------------------------------------------------------------------
279
285 public ZMatrixAtom getAngleRefAtom(int index)
286 {
287 return getAtom(index).getAngleRefAtom();
288 }
289
290//------------------------------------------------------------------------------
291
297 public int getAngleRefAtomIndex(int index)
298 {
299 ZMatrixAtom atm = getAngleRefAtom(index);
300 if (atm == null)
301 return -1;
302 return lstAtoms.indexOf(atm);
303 }
304
305//------------------------------------------------------------------------------
306
313 {
314 return getAtom(index).getAngle2RefAtom();
315 }
316
317//------------------------------------------------------------------------------
318
325 public int getAngle2RefAtomIndex(int index)
326 {
327 ZMatrixAtom atm = getAngle2RefAtom(index);
328 if (atm == null)
329 return -1;
330 return lstAtoms.indexOf(atm);
331 }
332
333//------------------------------------------------------------------------------
339 public Double getBondLength(int index)
340 {
341 return getAtom(index).getBondLength();
342 }
343
344//------------------------------------------------------------------------------
345
351 public Double getAngleValue(int index)
352 {
353 return getAtom(index).getAngleValue();
354 }
355
356//------------------------------------------------------------------------------
357
363 public Double getAngle2Value(int index)
364 {
365 return getAtom(index).getAngle2Value();
366 }
367
368//------------------------------------------------------------------------------
369
375 public Integer getChiralFlag(int index)
376 {
377 return getAtom(index).getChiralFlag();
378 }
379
380//------------------------------------------------------------------------------
381
389 public boolean usesProperDihedral(int idx1, int idx2)
390 {
391 for (int ia=0; ia<lstAtoms.size(); ia++)
392 {
393 int idxJ = getBondRefAtomIndex(ia);
394 int idxK = getAngleRefAtomIndex(ia);
395 if ((idxJ==idx1 && idxK==idx2) || (idxJ==idx2 && idxK==idx1))
396 {
397 Integer c = getChiralFlag(ia);
398 if (c != null && c == 0)
399 {
400 return true;
401 }
402 }
403 }
404 return false;
405 }
406
407//------------------------------------------------------------------------------
408
414 public ZMatrixBond getBond(int index)
415 {
416 return lstBonds.get(index);
417 }
418
419//------------------------------------------------------------------------------
420
426 public void delBond(int a1, int a2)
427 {
428 delBond(lstAtoms.get(a1), lstAtoms.get(a2));
429 }
430
431//------------------------------------------------------------------------------
432
438 public void delBond(ZMatrixAtom a1, ZMatrixAtom a2)
439 {
440 List<ZMatrixBond> bondsToDel = new ArrayList<>();
441 for (ZMatrixBond bond : lstBonds)
442 {
443 if ((bond.getAtm1() == a1 && bond.getAtm2() == a2) ||
444 (bond.getAtm1() == a2 && bond.getAtm2() == a1))
445 {
446 bondsToDel.add(bond);
447 break;
448 }
449 }
450 lstBonds.removeAll(bondsToDel);
451 }
452
453//------------------------------------------------------------------------------
454
461 public void addBond(int a1, int a2)
462 {
463 addBond(lstAtoms.get(a1), lstAtoms.get(a2));
464 }
465
466//------------------------------------------------------------------------------
467
474 public void addBond(ZMatrixAtom a1, ZMatrixAtom a2)
475 {
476 lstBonds.add(new ZMatrixBond(a1, a2));
477 }
478
479//------------------------------------------------------------------------------
480
485 public ZMatrix clone()
486 {
487 ZMatrix clone = new ZMatrix();
488 // First pass: create all atoms with null references
489 for (ZMatrixAtom atom : lstAtoms)
490 {
492 atom.getId(), atom.getSymbol(), atom.getType(),
493 null, null, null,
494 atom.getBondLength(),
495 atom.getAngleValue(),
496 atom.getAngle2Value(),
497 atom.getChiralFlag()));
498 }
499 // Second pass: set up references using indices from original
500 for (int i = 0; i < lstAtoms.size(); i++)
501 {
502 ZMatrixAtom origAtom = lstAtoms.get(i);
503 ZMatrixAtom cloneAtom = clone.lstAtoms.get(i);
504
505 if (origAtom.getBondRefAtom() != null)
506 {
507 int refIdx = getIndex(origAtom.getBondRefAtom());
508 cloneAtom.setBondRefAtom(clone.lstAtoms.get(refIdx));
509 }
510
511 if (origAtom.getAngleRefAtom() != null)
512 {
513 int refIdx = getIndex(origAtom.getAngleRefAtom());
514 cloneAtom.setAngleRefAtom(clone.lstAtoms.get(refIdx));
515 }
516
517 if (origAtom.getAngle2RefAtom() != null)
518 {
519 int refIdx = getIndex(origAtom.getAngle2RefAtom());
520 cloneAtom.setAngle2RefAtom(clone.lstAtoms.get(refIdx));
521 }
522 }
523 // Third pass: add bonds
524 for (ZMatrixBond bond : lstBonds)
525 {
527 clone.lstAtoms.get(getIndex(bond.getAtm1())),
528 clone.lstAtoms.get(getIndex(bond.getAtm2())));
529 }
530 return clone;
531 }
532
533//-----------------------------------------------------------------------------
534
545 public static ZMatrix getZMatrixFromIAC(IAtomContainer mol) throws DENOPTIMException
546 {
547 boolean debug = false; //only for development
548 ZMatrix zmat = new ZMatrix();
549 String doneBnd = "visitedBond";
550 for (int i=0; i<mol.getAtomCount(); i++)
551 {
552 int i2 = 0;
553 int i3 = 0;
554 int i4 = 0;
555 int i5 = 0;
556 ZMatrixAtom bndRef = null;
557 ZMatrixAtom angleRef = null;
558 ZMatrixAtom angle2Ref = null;
559 Double bondLength = null;
560 Double angleValue = null;
561 Double angle2Value = null;
562 Integer chiralFlag = null;
563
564 IAtom atmI = mol.getAtom(i);
565 if (debug)
566 {
567 System.err.println("Atom to IC: "
568 + MoleculeUtils.getSymbolOrLabel(atmI)+" "+i);
569 }
570
571 // define the bond length
572 if (i>0)
573 {
574 i2 = getFirstRefAtomId(i,mol);
575 bondLength = atmI.getPoint3d().distance(mol.getAtom(i2).getPoint3d());
576 mol.getBond(atmI,mol.getAtom(i2)).setProperty(doneBnd,"T");
577 bndRef = zmat.getAtom(i2);
578 }
579
580 // define the angle reference atom
581 if (i>1)
582 {
583 i3 = getSecondRefAtomId(i,i2,mol);
584 angleRef = zmat.getAtom(i3);
585 angleValue = MathUtils.angle(atmI.getPoint3d(),
586 mol.getAtom(i2).getPoint3d(),
587 mol.getAtom(i3).getPoint3d());
588 }
589
590 // decide on dihedral or second angle
591 if (i>2)
592 {
593 ObjectPair op = getThirdRefAtomId(i,i2,i3,mol,zmat);
594 i4 = (int) op.getFirst();
595 i5 = (int) op.getSecond();
596 if (i5==1)
597 {
598 angle2Value = MathUtils.angle(atmI.getPoint3d(),
599 mol.getAtom(i2).getPoint3d(),
600 mol.getAtom(i4).getPoint3d());
601 angle2Ref = zmat.getAtom(i4);
602 double sign = MathUtils.torsion(
603 atmI.getPoint3d(),
604 mol.getAtom(i2).getPoint3d(),
605 mol.getAtom(i3).getPoint3d(),
606 mol.getAtom(i4).getPoint3d());
607 if (sign > 0.0)
608 {
609 i5 = -1;
610 }
611 } else {
612 IAtom atmJ = mol.getAtom(i2);
613 IAtom atmK = mol.getAtom(i3);
614 IAtom atmL = mol.getAtom(i4);
615
616 angle2Value = MathUtils.torsion(
617 atmI.getPoint3d(), atmJ.getPoint3d(),
618 atmK.getPoint3d(), atmL.getPoint3d());
619 double valueIJKL = angle2Value;
620
621 angle2Ref = zmat.getAtom(i4);
622
623 IBond bnd = mol.getBond(atmJ, atmK);
624 if (bnd!=null)
625 {
626 Object cnstrDefObj = bnd.getProperty(
628 if (cnstrDefObj!=null)
629 {
630 // For clarity, IJKL are the atoms identifying the
631 // dihedral used in the internal coordinates,
632 // while ABCD are the atoms used to define the
633 // constrained dihedral angle.
634 IAtom[] atomsABCD = (IAtom[]) cnstrDefObj;
635 double cnstrABCD = (double) bnd.getProperty(
637 if (atmJ==atomsABCD[2] && atmK==atomsABCD[1])
638 {
639 // We ensure consistent orfer in the definitions
640 // of the two dihedral angles
641 atomsABCD = new IAtom[]{
642 atomsABCD[3], atomsABCD[2],
643 atomsABCD[1], atomsABCD[0]};
644 if (cnstrABCD>0)
645 {
646 cnstrABCD = 360.0 - cnstrABCD;
647 } else {
648 cnstrABCD = cnstrABCD - 360.0;
649 }
650 }
651
652 double valueABCD = MathUtils.torsion(
653 atomsABCD[0].getPoint3d(),
654 atomsABCD[1].getPoint3d(),
655 atomsABCD[2].getPoint3d(),
656 atomsABCD[3].getPoint3d());
657 double correctionABCD = cnstrABCD - valueABCD;
658
659 angle2Value = angle2Value + correctionABCD;
660
661 if (angle2Value > 360)
662 {
663 angle2Value = angle2Value - 360;
664 } else if (angle2Value < -360) {
665 angle2Value = angle2Value + 360;
666 }
667
668 if (debug)
669 {
670 System.err.println(" dihedral constrain along "
671 + i2 + "-" + i3 + ": "
672 + valueIJKL + " -> " + angle2Value
673 + " (changed by " + correctionABCD + ")");
674 }
675 }
676 }
677 }
678 chiralFlag = i5;
679 if (debug)
680 {
681 System.err.println(" i4 = "+ i4 + " angle2Value: " + angle2Value + " " + i5);
682 }
683 }
684
685 String symb = MoleculeUtils.getSymbolOrLabel(atmI);
686 String atyp = "0";
687 Object atypObj = atmI.getProperty(DENOPTIMConstants.ATMPROPATOMTYPE);
688 if (atypObj != null)
689 atyp = atypObj.toString();
690
691 ZMatrixAtom zatm = new ZMatrixAtom(i, symb, atyp,
692 bndRef, angleRef, angle2Ref,
693 bondLength, angleValue, angle2Value,
694 chiralFlag);
695 zmat.addAtom(zatm);
696 }
697
698 // Add bonds not visited
699 for (IBond b : mol.bonds())
700 {
701 zmat.addBond(mol.indexOf(b.getAtom(0)),
702 mol.indexOf(b.getAtom(1)));
703 }
704
705 // Due to the assumption that all atoms are part of the same
706 // connected network, no bond has to be deleted
707
708 return zmat;
709 }
710
711//----------------------------------------------------------------------------
712
713 private static int getFirstRefAtomId(int i1, IAtomContainer mol)
714 {
715 List<ConnectedLigand> candidates = new ArrayList<ConnectedLigand>();
716 for (IAtom nbr : mol.getConnectedAtomsList(mol.getAtom(i1)))
717 {
718 if (mol.indexOf(nbr) < i1)
719 {
720 ConnectedLigand cl = new ConnectedLigand(nbr,1);
721 candidates.add(cl);
722 }
723 }
724 Collections.sort(candidates, new ConnectedLigandComparator());
725 int i2 = mol.indexOf(candidates.get(0).getAtom());
726 return i2;
727 }
728
729//----------------------------------------------------------------------------
730
731 private static int getSecondRefAtomId(int i1, int i2, IAtomContainer mol)
732 {
733 List<ConnectedLigand> candidates = new ArrayList<ConnectedLigand>();
734 for (IAtom nbr : mol.getConnectedAtomsList(mol.getAtom(i2)))
735 {
736 if ((mol.indexOf(nbr) < i1) && (nbr != mol.getAtom(i1)))
737 {
738 ConnectedLigand cl = new ConnectedLigand(nbr,1);
739 candidates.add(cl);
740 }
741 }
742 Collections.sort(candidates, new ConnectedLigandComparator());
743 int i3 = mol.indexOf(candidates.get(0).getAtom());
744 return i3;
745 }
746
747//----------------------------------------------------------------------------
748
749 private static ObjectPair getThirdRefAtomId(int i1, int i2, int i3,
750 IAtomContainer mol, ZMatrix zmat) throws DENOPTIMException
751 {
752 boolean debug = false; //only for development
753 int i5 = 0;
754 IAtom atmI1 = mol.getAtom(i1);
755 IAtom atmI2 = mol.getAtom(i2);
756 IAtom atmI3 = mol.getAtom(i3);
757 List<ConnectedLigand> candidates = new ArrayList<ConnectedLigand>();
758 if (zmat.usesProperDihedral(i2, i3) ||
759 countPredefinedNeighbours(i1,atmI3,mol)==1)
760 {
761 i5 = 1;
762 for (IAtom nbr : mol.getConnectedAtomsList(atmI2))
763 {
764 if (debug)
765 {
766 System.err.println(" Eval. 3rd (ANG): " +
768 + mol.indexOf(nbr) + " "
769 + (mol.indexOf(nbr) < i1) + " "
770 + (nbr != atmI1) + " "
771 + (nbr != atmI3));
772 }
773 if ((mol.indexOf(nbr) < i1) && (nbr != atmI1) &&
774 (nbr != atmI3))
775 {
776 double dbcAng = MathUtils.angle(nbr.getPoint3d(),
777 atmI2.getPoint3d(),
778 atmI3.getPoint3d());
779 if(dbcAng > 1.0)
780 {
781 ConnectedLigand cl = new ConnectedLigand(nbr,1);
782 candidates.add(cl);
783 }
784 else
785 {
786 if (debug)
787 {
788 System.err.println(" ...but collinear with "
789 + MoleculeUtils.getSymbolOrLabel(atmI3) + i3
790 + " (i4-i2-i3: " + dbcAng
791 + ")");
792 }
793 }
794 }
795 }
796 }
797 else
798 {
799 i5 = 0;
800 for (IAtom nbr : mol.getConnectedAtomsList(atmI3))
801 {
802 if (debug)
803 {
804 System.err.println(" Eval. 3rd (TOR): "
806 + mol.indexOf(nbr) + " "
807 + (mol.indexOf(nbr) < i1) + " "
808 + (nbr != atmI1) + " "
809 + (nbr != atmI2));
810 }
811 if ((mol.indexOf(nbr) < i1) && (nbr != atmI1) &&
812 (nbr != atmI2))
813 {
814 ConnectedLigand cl = new ConnectedLigand(nbr,1);
815 candidates.add(cl);
816 }
817 }
818 }
819 Collections.sort(candidates, new ConnectedLigandComparator());
820 if (candidates.size() == 0)
821 {
822 String msg = "Unable to make internal coordinates. Please, "
823 + "consider the use of dummy atoms in proximity "
824 + "of atom " + zmat.getAtom(i1+1);
825 throw new DENOPTIMException(msg);
826 }
827 int i4 = mol.indexOf(candidates.get(0).getAtom());
828
829 ObjectPair op = new ObjectPair(i4,i5);
830
831 return op;
832 }
833
834//------------------------------------------------------------------------------
835
836 private static int countPredefinedNeighbours(int i, IAtom a, IAtomContainer mol)
837 {
838 int tot = 0;
839 for (IAtom nbr : mol.getConnectedAtomsList(a))
840 {
841 if (mol.indexOf(nbr) < i)
842 tot++;
843 }
844 return tot;
845 }
846
847
848//------------------------------------------------------------------------------
849
850 @Override
851 public boolean equals(Object o)
852 {
853 if (o == null)
854 return false;
855
856 if (o == this)
857 return true;
858
859 if (o.getClass() != getClass())
860 return false;
861
862 ZMatrix other = (ZMatrix) o;
863
864 // Compare id
865 if (this.id == null ? other.id != null : !this.id.equals(other.id))
866 return false;
867
868 // Compare atom counts
869 if (this.lstAtoms.size() != other.lstAtoms.size())
870 return false;
871
872 // Compare atoms (by equals method)
873 for (int i = 0; i < this.lstAtoms.size(); i++)
874 {
875 if (!this.lstAtoms.get(i).equals(other.lstAtoms.get(i)))
876 return false;
877 }
878
879 // Compare bond counts
880 if (this.lstBonds.size() != other.lstBonds.size())
881 return false;
882
883 // Compare bonds (by equals method, order-independent for undirected bonds)
884 // Create sets of bond IDs for comparison
885 Set<String> thisBondIds = new HashSet<>();
886 for (ZMatrixBond bond : this.lstBonds)
887 {
888 int id1 = bond.getAtm1().getId();
889 int id2 = bond.getAtm2().getId();
890 // Store in canonical form (smaller ID first)
891 String bondId = Math.min(id1, id2) + "-" + Math.max(id1, id2);
892 thisBondIds.add(bondId);
893 }
894
895 Set<String> otherBondIds = new HashSet<>();
896 for (ZMatrixBond bond : other.lstBonds)
897 {
898 int id1 = bond.getAtm1().getId();
899 int id2 = bond.getAtm2().getId();
900 String bondId = Math.min(id1, id2) + "-" + Math.max(id1, id2);
901 otherBondIds.add(bondId);
902 }
903
904 return thisBondIds.equals(otherBondIds);
905 }
906
907//------------------------------------------------------------------------------
908
909 @Override
910 public int hashCode()
911 {
912 int result = 17;
913 result = 31 * result + (id != null ? id.hashCode() : 0);
914 result = 31 * result + lstAtoms.size();
915 for (ZMatrixAtom atom : lstAtoms)
916 {
917 result = 31 * result + atom.hashCode();
918 }
919 result = 31 * result + lstBonds.size();
920 for (ZMatrixBond bond : lstBonds)
921 {
922 result = 31 * result + bond.hashCode();
923 }
924 return result;
925 }
926
927//------------------------------------------------------------------------------
928}
929
General set of constants used in DENOPTIM.
static final Object ATMPROPATOMTYPE
NAme of the property used to hold atom types, if any.
Representation of an atom in the ZMatrix.
Definition: ZMatrixAtom.java:9
Double getAngle2Value()
Get the angle2 value.
Integer getChiralFlag()
Get the chiral flag.
void setBondRefAtom(ZMatrixAtom bondRefAtom)
Package-private setter for bond reference atom (used for cloning).
ZMatrixAtom getBondRefAtom()
Get the bond reference atom.
ZMatrixAtom getAngle2RefAtom()
Get the angle2 reference atom.
void setAngle2RefAtom(ZMatrixAtom angle2RefAtom)
Package-private setter for angle2 reference atom (used for cloning).
Double getBondLength()
Get the bond length.
void setAngleRefAtom(ZMatrixAtom angleRefAtom)
Package-private setter for angle reference atom (used for cloning).
Double getAngleValue()
Get the angle value.
ZMatrixAtom getAngleRefAtom()
Get the angle reference atom.
Representation of a bond in the ZMatrix.
Definition: ZMatrixBond.java:7
ZMatrixAtom getAtm2()
Get the second atom in the bond.
ZMatrixAtom getAtm1()
Get the first atom in the bond.
Representation of an atom container's geometry with internal coordinates.
Definition: ZMatrix.java:27
static int getFirstRefAtomId(int i1, IAtomContainer mol)
Definition: ZMatrix.java:713
List< int[]> getBondsToDel()
Get the bonds to delete from the ZMatrix.
Definition: ZMatrix.java:188
int getIndex(ZMatrixAtom atm)
Get the index of the atom.
Definition: ZMatrix.java:246
List< int[]> getBondData()
Get the bond data for the ZMatrix.
Definition: ZMatrix.java:114
static ObjectPair getThirdRefAtomId(int i1, int i2, int i3, IAtomContainer mol, ZMatrix zmat)
Definition: ZMatrix.java:749
void delBond(int a1, int a2)
Delete the bond between the two atoms at the given indices.
Definition: ZMatrix.java:426
int getAtomCount()
Get the number of atoms in the ZMatrix.
Definition: ZMatrix.java:92
Integer getChiralFlag(int index)
Get the chiral flag for the atom at the given index.
Definition: ZMatrix.java:375
static int getSecondRefAtomId(int i1, int i2, IAtomContainer mol)
Definition: ZMatrix.java:731
void removeAtom(ZMatrixAtom atm)
Remove an atom from the ZMatrix.
Definition: ZMatrix.java:72
static int countPredefinedNeighbours(int i, IAtom a, IAtomContainer mol)
Definition: ZMatrix.java:836
List< ZMatrixAtom > getAtoms()
Get the atoms in the ZMatrix.
Definition: ZMatrix.java:234
String getId()
Get the id of the ZMatrix.
Definition: ZMatrix.java:131
int getBondCount()
Get the number of bonds in the ZMatrix.
Definition: ZMatrix.java:103
ZMatrixAtom getAngleRefAtom(int index)
Get the angle reference atom for the atom at the given index.
Definition: ZMatrix.java:285
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
static ZMatrix getZMatrixFromIAC(IAtomContainer mol)
Convert IAtomContainer to ZMatrix.
Definition: ZMatrix.java:545
Double getBondLength(int index)
Get the bond length for the atom at the given index.
Definition: ZMatrix.java:339
ZMatrixBond getBond(int index)
Get the bond at the given index.
Definition: ZMatrix.java:414
boolean usesProperDihedral(int idx1, int idx2)
Check if the dihedral between the two atoms at the given indices uses proper torsion.
Definition: ZMatrix.java:389
void setId(String id)
Set the id of the ZMatrix.
Definition: ZMatrix.java:142
void addBond(int a1, int a2)
Add a bond between the two atoms at the given indices.
Definition: ZMatrix.java:461
void addBond(ZMatrixAtom a1, ZMatrixAtom a2)
Add a bond between the two atoms.
Definition: ZMatrix.java:474
String id
Identifier of this ZMatrix.
Definition: ZMatrix.java:31
List< int[]> getBondsToAdd()
Get the bonds to add to the Z-matrix.
Definition: ZMatrix.java:154
ZMatrixAtom getBondRefAtom(int index)
Get the bond reference atom for the atom at the given index.
Definition: ZMatrix.java:258
ZMatrixAtom getAngle2RefAtom(int index)
Get the second angle reference atom for the atom at the given index.
Definition: ZMatrix.java:312
ZMatrix()
Constructor for ZMatrix.
Definition: ZMatrix.java:49
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
ZMatrixAtom getAtom(int index)
Get the atom at the given index.
Definition: ZMatrix.java:223
void delBond(ZMatrixAtom a1, ZMatrixAtom a2)
Delete the bond between the two atoms.
Definition: ZMatrix.java:438
List< ZMatrixAtom > lstAtoms
All atoms and pseudoAtoms mentioned in the Zmatrix.
Definition: ZMatrix.java:36
void addAtom(ZMatrixAtom atom)
Add an atom to the ZMatrix.
Definition: ZMatrix.java:61
int getAngle2RefAtomIndex(int index)
Get the index of the second angle reference atom for the atom at the given index.
Definition: ZMatrix.java:325
List< ZMatrixBond > lstBonds
All bonds in the system, whether included or not in the Z-matrix intrinsic connections.
Definition: ZMatrix.java:42
int getAngleRefAtomIndex(int index)
Get the index of the angle reference atom for the atom at the given index.
Definition: ZMatrix.java:297
Compare two ConnectedLigand according to the number of connected atoms and the mass number.
A ConnectedLigand is just an atom with an explicit field reporting the number of connected atoms.
Some useful math operations.
Definition: MathUtils.java:39
static double angle(Point3d a, Point3d b, Point3d c)
Calculate the angle between the 3 points.
Definition: MathUtils.java:284
static double torsion(Point3d p1, Point3d p2, Point3d p3, Point3d p4)
Calculate the torsion angle between the 4 points.
Definition: MathUtils.java:363
Utilities for molecule conversion.
static String getSymbolOrLabel(IAtom atm)
Gets either the elemental symbol (for standard atoms) of the label (for pseudo-atoms).
This class is the equivalent of the Pair data structure used in C++ Although AbstractMap....
Definition: ObjectPair.java:30
Tool box for definition and management of the rotational space, which is given by the list of rotatab...