idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
28,800
protected IAtomContainer buildMolecule ( int mainChain , List < AttachedGroup > attachedSubstituents , List < AttachedGroup > attachedGroups , boolean isMainCyclic , String name ) throws ParseException , CDKException { currentMolecule . setID ( name ) ; currentMolecule . add ( buildChain ( mainChain , isMainCyclic ) ) ...
Start of the process of building a molecule from the parsed data . Passes the parsed tokens to other functions which build up the Molecule .
28,801
public static int getAtomCount ( IMolecularFormula formula ) { int count = 0 ; for ( IIsotope isotope : formula . isotopes ( ) ) { count += formula . getIsotopeCount ( isotope ) ; } return count ; }
Checks a set of Nodes for the occurrence of each isotopes instance in the molecular formula . In short number of atoms .
28,802
public static int getElementCount ( IMolecularFormula formula , IElement element ) { int count = 0 ; for ( IIsotope isotope : formula . isotopes ( ) ) { if ( isotope . getSymbol ( ) . equals ( element . getSymbol ( ) ) ) count += formula . getIsotopeCount ( isotope ) ; } return count ; }
Checks a set of Nodes for the occurrence of the isotopes in the molecular formula from a particular IElement . It returns 0 if the element does not exist . The search is based only on the IElement .
28,803
public static int getElementCount ( IMolecularFormula formula , IIsotope isotope ) { return getElementCount ( formula , formula . getBuilder ( ) . newInstance ( IElement . class , isotope ) ) ; }
Occurrences of a given element from an isotope in a molecular formula .
28,804
public static int getElementCount ( IMolecularFormula formula , String symbol ) { return getElementCount ( formula , formula . getBuilder ( ) . newInstance ( IElement . class , symbol ) ) ; }
Occurrences of a given element in a molecular formula .
28,805
public static List < IIsotope > getIsotopes ( IMolecularFormula formula , IElement element ) { List < IIsotope > isotopeList = new ArrayList < IIsotope > ( ) ; for ( IIsotope isotope : formula . isotopes ( ) ) { if ( isotope . getSymbol ( ) . equals ( element . getSymbol ( ) ) ) isotopeList . add ( isotope ) ; } return...
Get a list of IIsotope from a given IElement which is contained molecular . The search is based only on the IElement .
28,806
public static List < IElement > elements ( IMolecularFormula formula ) { List < IElement > elementList = new ArrayList < IElement > ( ) ; List < String > stringList = new ArrayList < String > ( ) ; for ( IIsotope isotope : formula . isotopes ( ) ) { if ( ! stringList . contains ( isotope . getSymbol ( ) ) ) { elementLi...
Get a list of all Elements which are contained molecular .
28,807
public static boolean containsElement ( IMolecularFormula formula , IElement element ) { for ( IIsotope isotope : formula . isotopes ( ) ) { if ( element . getSymbol ( ) . equals ( isotope . getSymbol ( ) ) ) return true ; } return false ; }
True if the MolecularFormula contains the given element as IIsotope object .
28,808
public static IMolecularFormula removeElement ( IMolecularFormula formula , IElement element ) { for ( IIsotope isotope : getIsotopes ( formula , element ) ) { formula . removeIsotope ( isotope ) ; } return formula ; }
Removes all isotopes from a given element in the MolecularFormula .
28,809
public static String getString ( IMolecularFormula formula , boolean setOne ) { if ( containsElement ( formula , formula . getBuilder ( ) . newInstance ( IElement . class , "C" ) ) ) return getString ( formula , generateOrderEle_Hill_WithCarbons ( ) , setOne , false ) ; else return getString ( formula , generateOrderEl...
Returns the string representation of the molecular formula . Based on Hill System . The Hill system is a system of writing chemical formulas such that the number of carbon atoms in a molecule is indicated first the number of hydrogen atoms next and then the number of all other chemical elements subsequently in alphabet...
28,810
public static IMolecularFormula getMajorIsotopeMolecularFormula ( String stringMF , IChemObjectBuilder builder ) { return getMolecularFormula ( stringMF , true , builder ) ; }
Construct an instance of IMolecularFormula initialized with a molecular formula string . The string is immediately analyzed and a set of Nodes is built based on this analysis . The hydrogens must be implicit . Major isotopes are being used .
28,811
private static IMolecularFormula getMolecularFormula ( String stringMF , IMolecularFormula formula , boolean assumeMajorIsotope ) { if ( stringMF . contains ( "." ) || stringMF . contains ( "(" ) || stringMF . length ( ) > 0 && stringMF . charAt ( 0 ) >= '0' && stringMF . charAt ( 0 ) <= '9' ) stringMF = simplifyMolecu...
Add to an instance of IMolecularFormula the elements extracts form molecular formula string . The string is immediately analyzed and a set of Nodes is built based on this analysis . The hydrogens are assumed to be implicit . The boolean indicates if the major isotope is to be assumed or if no assumption is to be made .
28,812
private static double correctMass ( double mass , Integer charge ) { if ( charge == null ) return mass ; double massE = 0.00054857990927 ; if ( charge > 0 ) mass -= massE * charge ; else if ( charge < 0 ) mass += massE * Math . abs ( charge ) ; return mass ; }
Correct the mass according the charge of the IMmoleculeFormula . Negative charge will add the mass of one electron to the mass .
28,813
public static double getTotalMassNumber ( IMolecularFormula formula ) { double mass = 0.0 ; for ( IIsotope isotope : formula . isotopes ( ) ) { try { IIsotope isotope2 = Isotopes . getInstance ( ) . getMajorIsotope ( isotope . getSymbol ( ) ) ; if ( isotope2 != null ) { mass += isotope2 . getMassNumber ( ) * formula . ...
Get the summed mass number of all isotopes from an MolecularFormula . It assumes isotope masses to be preset and returns 0 . 0 if not .
28,814
public static double getTotalNaturalAbundance ( IMolecularFormula formula ) { double abundance = 1.0 ; for ( IIsotope isotope : formula . isotopes ( ) ) { if ( isotope . getNaturalAbundance ( ) == null ) return 0.0 ; abundance = abundance * Math . pow ( isotope . getNaturalAbundance ( ) , formula . getIsotopeCount ( is...
Get the summed natural abundance of all isotopes from an MolecularFormula . Assumes abundances to be preset and will return 0 . 0 if not .
28,815
public static double getDBE ( IMolecularFormula formula ) throws CDKException { int valencies [ ] = new int [ 5 ] ; IAtomContainer ac = getAtomContainer ( formula ) ; AtomTypeFactory factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/structgen_atomtypes.xml" , ac . getBuilder ( ) ) ; for ( int f...
Returns the number of double bond equivalents in this molecule .
28,816
public static boolean compare ( IMolecularFormula formula1 , IMolecularFormula formula2 ) { if ( ! Objects . equals ( formula1 . getCharge ( ) , formula2 . getCharge ( ) ) ) return false ; if ( formula1 . getIsotopeCount ( ) != formula2 . getIsotopeCount ( ) ) return false ; for ( IIsotope isotope : formula1 . isotopes...
Compare two IMolecularFormula looking at type and number of IIsotope and charge of the formula .
28,817
private static String muliplier ( String formula , int factor ) { String finalformula = "" ; String recentElementSymbol = "" ; String recentElementCountString = "0" ; for ( int f = 0 ; f < formula . length ( ) ; f ++ ) { char thisChar = formula . charAt ( f ) ; if ( f < formula . length ( ) ) { if ( thisChar >= 'A' && ...
This method multiply all the element over a value .
28,818
public static boolean adjustProtonation ( IMolecularFormula mf , int hcnt ) { if ( mf == null ) throw new NullPointerException ( "No formula provided" ) ; if ( hcnt == 0 ) return false ; final IChemObjectBuilder bldr = mf . getBuilder ( ) ; final int chg = mf . getCharge ( ) != null ? mf . getCharge ( ) : 0 ; IIsotope ...
Adjust the protonation of a molecular formula . This utility method adjusts the hydrogen isotope count and charge at the same time .
28,819
private static int findOther ( int [ ] vs , int u , int x ) { for ( int v : vs ) { if ( v != u && v != x ) return v ; } throw new IllegalArgumentException ( "vs[] did not contain another vertex" ) ; }
Finds a vertex in vs which is not u or x . .
28,820
private static Map < IAtom , Integer > indexMap ( Map < IAtom , Integer > map , IAtomContainer container ) { if ( map != null ) return map ; map = new HashMap < IAtom , Integer > ( ) ; for ( IAtom a : container . atoms ( ) ) { map . put ( a , map . size ( ) ) ; } return map ; }
Lazy creation of an atom index map .
28,821
public IsotopePattern getIsotopes ( IMolecularFormula molFor ) { if ( builder == null ) { try { isoFactory = Isotopes . getInstance ( ) ; builder = molFor . getBuilder ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } String mf = MolecularFormulaManipulator . getString ( molFor , true ) ; IMolecularFormula ...
Get all combinatorial chemical isotopes given a structure .
28,822
protected boolean canDraw ( IAtom atom , IAtomContainer container , RendererModel model ) { if ( ! hasCoordinates ( atom ) ) { return false ; } if ( invisibleHydrogen ( atom , model ) ) { return false ; } if ( invisibleCarbon ( atom , container , model ) ) { return false ; } return true ; }
Checks an atom to see if it should be drawn . There are three reasons not to draw an atom - a ) no coordinates b ) an invisible hydrogen or c ) an invisible carbon .
28,823
public IRenderingElement generateCompactElement ( IAtom atom , RendererModel model ) { Point2d point = atom . getPoint2d ( ) ; double radius = ( Double ) model . get ( AtomRadius . class ) / model . getParameter ( Scale . class ) . getValue ( ) ; double distance = 2 * radius ; if ( model . get ( CompactShape . class ) ...
Generate a compact element for an atom such as a circle or a square rather than text element .
28,824
public AtomSymbolElement generateElement ( IAtom atom , int alignment , RendererModel model ) { String text ; if ( atom instanceof IPseudoAtom ) { text = ( ( IPseudoAtom ) atom ) . getLabel ( ) ; } else { text = atom . getSymbol ( ) ; } return new AtomSymbolElement ( atom . getPoint2d ( ) . x , atom . getPoint2d ( ) . ...
Generate an atom symbol element .
28,825
protected boolean showCarbon ( IAtom carbonAtom , IAtomContainer container , RendererModel model ) { if ( ( Boolean ) model . get ( KekuleStructure . class ) ) return true ; if ( carbonAtom . getFormalCharge ( ) != 0 ) return true ; int connectedBondCount = container . getConnectedBondsList ( carbonAtom ) . size ( ) ; ...
Checks a carbon atom to see if it should be shown .
28,826
public static void removeAcidicOxygen ( IAminoAcid acid ) throws CDKException { if ( acid . getCTerminus ( ) == null ) throw new CDKException ( "Cannot remove oxygen: C-terminus is not defined!" ) ; java . util . List < IBond > bonds = acid . getConnectedBondsList ( acid . getCTerminus ( ) ) ; for ( IBond bond : bonds ...
Removes the singly bonded oxygen from the acid group of the AminoAcid .
28,827
public static void addAcidicOxygen ( IAminoAcid acid ) throws CDKException { if ( acid . getCTerminus ( ) == null ) throw new CDKException ( "Cannot add oxygen: C-terminus is not defined!" ) ; IAtom acidicOxygen = acid . getBuilder ( ) . newInstance ( IAtom . class , "O" ) ; acid . addAtom ( acidicOxygen ) ; acid . add...
Adds the singly bonded oxygen from the acid group of the AminoAcid .
28,828
public void setRestrictions ( List < IRule > rulesNew ) throws CDKException { Iterator < IRule > itRules = rulesNew . iterator ( ) ; while ( itRules . hasNext ( ) ) { IRule rule = itRules . next ( ) ; if ( rule instanceof ElementRule ) { mfRange = ( MolecularFormulaRange ) ( ( Object [ ] ) rule . getParameters ( ) ) [ ...
Set the restrictions that must be presents in the molecular formula .
28,829
public void setDefaultRestrictions ( ) { try { callDefaultRestrictions ( ) ; } catch ( CDKException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Set the default restrictions that must be presents in the molecular formula .
28,830
private List < IIsotope > orderList ( List < IIsotope > isotopes_TO ) { List < IIsotope > newOrderList = new ArrayList < IIsotope > ( ) ; for ( int i = 0 ; i < orderElements . length ; i ++ ) { String symbol = orderElements [ i ] ; Iterator < IIsotope > itIso = isotopes_TO . iterator ( ) ; while ( itIso . hasNext ( ) )...
Put the order the List of IIsotope according the probability occurrence .
28,831
private int getMaxOccurence ( double massTo , int element_pos , int [ ] matrix , List < IIsotope > isoToCond_new ) { double massIn = isoToCond_new . get ( element_pos ) . getExactMass ( ) ; double massToM = massTo ; for ( int i = 0 ; i < matrix . length ; i ++ ) if ( i != element_pos ) if ( matrix [ i ] != 0 ) massToM ...
Get the maximal occurrence of this List .
28,832
private IMolecularFormula getFormula ( List < IIsotope > isoToCond_new , int [ ] value_In ) { IMolecularFormula mf = builder . newInstance ( IMolecularFormula . class ) ; for ( int i = 0 ; i < isoToCond_new . size ( ) ; i ++ ) { if ( value_In [ i ] != 0 ) { for ( int j = 0 ; j < value_In [ i ] ; j ++ ) mf . addIsotope ...
Set the formula molecular as IMolecularFormula object .
28,833
private IMolecularFormula putInOrder ( IMolecularFormula formula ) { IMolecularFormula new_formula = formula . getBuilder ( ) . newInstance ( IMolecularFormula . class ) ; for ( int i = 0 ; i < orderElements . length ; i ++ ) { IElement element = builder . newInstance ( IElement . class , orderElements [ i ] ) ; if ( M...
Put in order the elements of the molecular formula .
28,834
private double calculateMassT ( List < IIsotope > isoToCond_new , int [ ] value_In ) { double result = 0 ; for ( int i = 0 ; i < isoToCond_new . size ( ) ; i ++ ) { if ( value_In [ i ] != 0 ) { result += isoToCond_new . get ( i ) . getExactMass ( ) * value_In [ i ] ; } } return result ; }
Calculate the mass total given the elements and their respective occurrences .
28,835
private IMolecularFormulaSet returnOrdered ( double mass , IMolecularFormulaSet formulaSet ) { IMolecularFormulaSet solutions_new = null ; if ( formulaSet . size ( ) != 0 ) { double valueMin = 100 ; int i_final = 0 ; solutions_new = formulaSet . getBuilder ( ) . newInstance ( IMolecularFormulaSet . class ) ; List < Int...
Return all molecular formulas but ordered according the tolerance difference between masses .
28,836
private int [ ] [ ] getMatrix ( int size ) { logger . info ( "Creating matrix for isotopes combination" ) ; int lengthM = ( int ) Math . pow ( 2 , size ) ; lengthM -- ; int [ ] [ ] matrix = new int [ lengthM ] [ size ] ; int [ ] combi = new int [ size ] ; for ( int j = 0 ; j < size ; j ++ ) { combi [ j ] = 0 ; } int po...
Get the corresponding matrix and create it .
28,837
public static int getAtomCount ( IChemFile file ) { int count = 0 ; for ( int i = 0 ; i < file . getChemSequenceCount ( ) ; i ++ ) { count += ChemSequenceManipulator . getAtomCount ( file . getChemSequence ( i ) ) ; } return count ; }
Get the total number of atoms inside an IChemFile .
28,838
public static int getBondCount ( IChemFile file ) { int count = 0 ; for ( int i = 0 ; i < file . getChemSequenceCount ( ) ; i ++ ) { count += ChemSequenceManipulator . getBondCount ( file . getChemSequence ( i ) ) ; } return count ; }
Get the total number of bonds inside an IChemFile .
28,839
public static List < IChemObject > getAllChemObjects ( IChemFile file ) { List < IChemObject > list = new ArrayList < IChemObject > ( ) ; for ( int i = 0 ; i < file . getChemSequenceCount ( ) ; i ++ ) { list . add ( file . getChemSequence ( i ) ) ; list . addAll ( ChemSequenceManipulator . getAllChemObjects ( file . ge...
Returns a List of all IChemObject inside a ChemFile .
28,840
public static List < IAtomContainer > getAllAtomContainers ( IChemFile file ) { List < IAtomContainer > acList = new ArrayList < IAtomContainer > ( ) ; for ( IChemSequence sequence : file . chemSequences ( ) ) { acList . addAll ( ChemSequenceManipulator . getAllAtomContainers ( sequence ) ) ; } return acList ; }
Returns all the AtomContainer s of a ChemFile .
28,841
public static List < IChemModel > getAllChemModels ( IChemFile file ) { List < IChemModel > modelsList = new ArrayList < IChemModel > ( ) ; for ( int f = 0 ; f < file . getChemSequenceCount ( ) ; f ++ ) { for ( IChemModel model : file . getChemSequence ( f ) . chemModels ( ) ) { modelsList . add ( model ) ; } } return ...
Get a list of all ChemModels inside an IChemFile .
28,842
public static List < IReaction > getAllReactions ( IChemFile file ) { List < IReaction > reactonList = new ArrayList < IReaction > ( ) ; List < IChemModel > chemModel = getAllChemModels ( file ) ; for ( int f = 0 ; f < chemModel . size ( ) ; f ++ ) { for ( IReaction reaction : chemModel . get ( f ) . getReactionSet ( )...
Get a list of all IReaction inside an IChemFile .
28,843
private int getHybridisationState ( IAtom atom1 ) { IBond . Order maxBondOrder = atom1 . getMaxBondOrder ( ) ; if ( atom1 . getFormalNeighbourCount ( ) == 1 ) { } else if ( atom1 . getFormalNeighbourCount ( ) == 2 || maxBondOrder == IBond . Order . TRIPLE ) { return 1 ; } else if ( atom1 . getFormalNeighbourCount ( ) =...
Gets the hybridisation state of an atom .
28,844
private int getDoubleBondConfiguration2D ( IBond bond , Point2d a , Point2d b , Point2d c , Point2d d ) throws CDKException { if ( bond . getOrder ( ) != IBond . Order . DOUBLE ) { return 0 ; } if ( a == null || b == null || c == null || d == null ) return 0 ; Point2d cb = new Point2d ( c . x - b . x , c . y - b . y ) ...
Gets the doubleBondConfiguration2D attribute of the AtomPlacer3D object using existing 2D coordinates .
28,845
public double getBondLengthValue ( String id1 , String id2 ) { String dkey = "" ; if ( pSet . containsKey ( ( "bond" + id1 + ";" + id2 ) ) ) { dkey = "bond" + id1 + ";" + id2 ; } else if ( pSet . containsKey ( ( "bond" + id2 + ";" + id1 ) ) ) { dkey = "bond" + id2 + ";" + id1 ; } else { logger . warn ( "KEYError: Unkno...
Gets the distanceValue attribute of the parameter set .
28,846
public IAtom getNextUnplacedHeavyAtomWithAliphaticPlacedNeighbour ( IAtomContainer molecule ) { Iterator < IBond > bonds = molecule . bonds ( ) . iterator ( ) ; while ( bonds . hasNext ( ) ) { IBond bond = bonds . next ( ) ; if ( bond . getBegin ( ) . getFlag ( CDKConstants . ISPLACED ) && ! ( bond . getEnd ( ) . getFl...
Gets the nextUnplacedHeavyAtomWithAliphaticPlacedNeighbour from an atom container or molecule .
28,847
IAtom getUnplacedHeavyAtom ( IAtomContainer molecule ) { for ( IAtom atom : molecule . atoms ( ) ) { if ( isUnplacedHeavyAtom ( atom ) ) return atom ; } return null ; }
Find the first unplaced atom .
28,848
public IAtom getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour ( IAtomContainer molecule ) { Iterator < IBond > bonds = molecule . bonds ( ) . iterator ( ) ; while ( bonds . hasNext ( ) ) { IBond bond = bonds . next ( ) ; IAtom atom0 = bond . getBegin ( ) ; IAtom atom1 = bond . getEnd ( ) ; if ( atom0 . getFlag ( CD...
Gets the nextPlacedHeavyAtomWithAliphaticPlacedNeigbor from an atom container or molecule .
28,849
public IAtom getFarthestAtom ( Point3d refAtomPoint , IAtomContainer ac ) { double distance = 0 ; IAtom atom = null ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { if ( ac . getAtom ( i ) . getPoint3d ( ) != null ) { if ( Math . abs ( refAtomPoint . distance ( ac . getAtom ( i ) . getPoint3d ( ) ) ) > distance...
Gets the farthestAtom attribute of the AtomPlacer3D object .
28,850
public IAtom getUnplacedRingHeavyAtom ( IAtomContainer molecule , IAtom atom ) { List < IBond > bonds = molecule . getConnectedBondsList ( atom ) ; IAtom connectedAtom = null ; for ( IBond bond : bonds ) { connectedAtom = bond . getOther ( atom ) ; if ( isUnplacedHeavyAtom ( connectedAtom ) && connectedAtom . getFlag (...
Gets the unplacedRingHeavyAtom attribute of the AtomPlacer3D object .
28,851
public Point3d geometricCenterAllPlacedAtoms ( IAtomContainer molecule ) { IAtomContainer allPlacedAtoms = getAllPlacedAtoms ( molecule ) ; return GeometryUtil . get3DCenter ( allPlacedAtoms ) ; }
Calculates the geometric center of all placed atoms in the atomcontainer .
28,852
public IAtom getPlacedHeavyAtom ( IAtomContainer molecule , IAtom atom ) { List < IBond > bonds = molecule . getConnectedBondsList ( atom ) ; for ( IBond bond : bonds ) { IAtom connectedAtom = bond . getOther ( atom ) ; if ( isPlacedHeavyAtom ( connectedAtom ) ) { return connectedAtom ; } } return null ; }
Returns a placed atom connected to a given atom .
28,853
public IAtom getPlacedHeavyAtom ( IAtomContainer molecule , IAtom atomA , IAtom atomB ) { List < IBond > bonds = molecule . getConnectedBondsList ( atomA ) ; for ( IBond bond : bonds ) { IAtom connectedAtom = bond . getOther ( atomA ) ; if ( isPlacedHeavyAtom ( connectedAtom ) && ! connectedAtom . equals ( atomB ) ) { ...
Gets the first placed Heavy Atom around atomA which is not atomB .
28,854
public IAtomContainer getPlacedHeavyAtoms ( IAtomContainer molecule , IAtom atom ) { List < IBond > bonds = molecule . getConnectedBondsList ( atom ) ; IAtomContainer connectedAtoms = molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtom connectedAtom = null ; for ( IBond bond : bonds ) { connected...
Gets the placed Heavy Atoms connected to an atom .
28,855
private IAtomContainer getAllPlacedAtoms ( IAtomContainer molecule ) { IAtomContainer placedAtoms = new AtomContainer ( ) ; for ( int i = 0 ; i < molecule . getAtomCount ( ) ; i ++ ) { if ( molecule . getAtom ( i ) . getFlag ( CDKConstants . ISPLACED ) ) { placedAtoms . addAtom ( molecule . getAtom ( i ) ) ; } } return...
Gets the allPlacedAtoms attribute of the AtomPlacer3D object .
28,856
public boolean allHeavyAtomsPlaced ( IAtomContainer ac ) { for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { if ( isUnplacedHeavyAtom ( ac . getAtom ( i ) ) ) { return false ; } } return true ; }
True is all the atoms in the given AtomContainer have been placed .
28,857
public DescriptorValue calculate ( IAtomContainer atomContainer ) { IAtomContainer ac = null ; try { ac = ( IAtomContainer ) atomContainer . clone ( ) ; } catch ( CloneNotSupportedException e ) { return getDummyDescriptorValue ( e ) ; } int carbonCount = 0 ; int heteroCount = 0 ; for ( IAtom atom : ac . atoms ( ) ) { i...
Calculates the Mannhold LogP for an atom container .
28,858
public ValidationReport validateBond ( IBond subject ) { ValidationReport report = new ValidationReport ( ) ; if ( subject . getAtomCount ( ) == 2 ) { double distance = subject . getBegin ( ) . getPoint3d ( ) . distance ( subject . getEnd ( ) . getPoint3d ( ) ) ; if ( distance > 3.0 ) { ValidationTest badBondLengthErro...
assumes 1 unit in the coordinate system is one angstrom
28,859
protected static < T > T [ ] invapply ( T [ ] src , int [ ] perm ) { T [ ] res = src . clone ( ) ; for ( int i = 0 ; i < src . length ; i ++ ) res [ i ] = src [ perm [ i ] ] ; return res ; }
apply the inverse of a permutation
28,860
private static Shape createAtomHighlight ( IAtom atom , double radius ) { double x = atom . getPoint2d ( ) . x ; double y = atom . getPoint2d ( ) . y ; return new RoundRectangle2D . Double ( x - radius , y - radius , 2 * radius , 2 * radius , 2 * radius , 2 * radius ) ; }
Create the shape which will highlight the provided atom .
28,861
private static Shape createBondHighlight ( IBond bond , double radius ) { double x1 = bond . getBegin ( ) . getPoint2d ( ) . x ; double x2 = bond . getEnd ( ) . getPoint2d ( ) . x ; double y1 = bond . getBegin ( ) . getPoint2d ( ) . y ; double y2 = bond . getEnd ( ) . getPoint2d ( ) . y ; double dx = x2 - x1 ; double d...
Create the shape which will highlight the provided bond .
28,862
public static Palette createPalette ( final Color color , final Color ... colors ) { Color [ ] cs = new Color [ colors . length + 1 ] ; cs [ 0 ] = color ; System . arraycopy ( colors , 0 , cs , 1 , colors . length ) ; return new FixedPalette ( cs ) ; }
Create a palette which uses the provided colors .
28,863
public IVector sub ( IVector b ) { IVector result = new IVector ( size ) ; sub ( b , result ) ; return result ; }
Subtraction from two vectors
28,864
public Complex dot ( IVector b ) { if ( ( b == null ) || ( size != b . size ) ) return new Complex ( Double . NaN , Double . NaN ) ; Complex result = new Complex ( 0d , 0d ) ; int i ; for ( i = 0 ; i < size ; i ++ ) { result . real += realvector [ i ] * b . realvector [ i ] - imagvector [ i ] * b . imagvector [ i ] ; r...
Multiplication from two vectors
28,865
public void duplicate ( IVector result ) { if ( result . size != size ) result . reshape ( size ) ; int i ; for ( i = 0 ; i < size ; i ++ ) { result . realvector [ i ] = realvector [ i ] ; result . imagvector [ i ] = imagvector [ i ] ; } }
Copy a vector
28,866
public void reshape ( int newsize ) { if ( ( newsize == size ) || ( newsize <= 0 ) ) return ; double [ ] newrealvector = new double [ newsize ] ; double [ ] newimagvector = new double [ newsize ] ; int min = Math . min ( size , newsize ) ; int i ; for ( i = 0 ; i < min ; i ++ ) { newrealvector [ i ] = realvector [ i ] ...
Resize this vector
28,867
public String getInchiKey ( ) throws CDKException { JniInchiOutputKey key ; try { key = JniInchiWrapper . getInchiKey ( output . getInchi ( ) ) ; if ( key . getReturnStatus ( ) == INCHI_KEY . OK ) { return key . getKey ( ) ; } else { throw new CDKException ( "Error while creating InChIKey: " + key . getReturnStatus ( )...
Gets generated InChIKey string .
28,868
public void push ( ICMLModule item ) { if ( sp == stack . length ) { ICMLModule [ ] temp = new ICMLModule [ 2 * sp ] ; System . arraycopy ( stack , 0 , temp , 0 , sp ) ; stack = temp ; } stack [ sp ++ ] = item ; }
Adds an entry to the stack .
28,869
public PermutationGroup getAutomorphismGroup ( IAtomContainer atomContainer , Partition initialPartition ) { setup ( atomContainer ) ; super . refine ( initialPartition ) ; return super . getAutomorphismGroup ( ) ; }
Get the automorphism group of the molecule given an initial partition .
28,870
public IAtomContainer assignInductivePartialCharges ( IAtomContainer ac ) throws Exception { if ( factory == null ) { factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/jmol_atomtypes.txt" , ac . getBuilder ( ) ) ; } int stepsLimit = 9 ; IAtom [ ] atoms = AtomContainerManipulator . getAtomArray ...
Main method set charge as atom properties .
28,871
public double [ ] getPaulingElectronegativities ( IAtomContainer ac , boolean modified ) throws CDKException { double [ ] paulingElectronegativities = new double [ ac . getAtomCount ( ) ] ; IElement element = null ; String symbol = null ; int atomicNumber = 0 ; try { ifac = Isotopes . getInstance ( ) ; for ( int i = 0 ...
Gets the paulingElectronegativities attribute of the InductivePartialCharges object .
28,872
public double getAtomicSoftnessCore ( IAtomContainer ac , int atomPosition ) throws CDKException { if ( factory == null ) { factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/jmol_atomtypes.txt" , ac . getBuilder ( ) ) ; } IAtom target = null ; double core = 0 ; double radiusTarget = 0 ; target ...
of effective electronegativity
28,873
private double getAtomicChargeIncrement ( IAtomContainer ac , int atomPosition , double [ ] ElEn , int as ) throws CDKException { IAtom [ ] allAtoms = null ; IAtom target = null ; double incrementedCharge = 0 ; double radiusTarget = 0 ; target = ac . getAtom ( atomPosition ) ; allAtoms = AtomContainerManipulator . getA...
Gets the atomicChargeIncrement attribute of the InductivePartialCharges object .
28,874
private double getCovalentRadius ( String symbol , IBond . Order maxBondOrder ) { double radiusTarget = 0 ; if ( symbol . equals ( "F" ) ) { radiusTarget = 0.64 ; } else if ( symbol . equals ( "Cl" ) ) { radiusTarget = 0.99 ; } else if ( symbol . equals ( "Br" ) ) { radiusTarget = 1.14 ; } else if ( symbol . equals ( "...
Gets the covalentRadius attribute of the InductivePartialCharges object .
28,875
public DescriptorValue calculate ( IAtom atom , IAtomContainer atomContainer ) { IAtomContainer clonedAtomContainer ; try { clonedAtomContainer = ( IAtomContainer ) atomContainer . clone ( ) ; } catch ( CloneNotSupportedException e ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParam...
The method is a proton descriptor that evaluate if a proton is bonded to an aromatic system or if there is distance of 2 bonds . It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,876
private MaccsKey [ ] keys ( final IChemObjectBuilder builder ) throws CDKException { MaccsKey [ ] result = keys ; if ( result == null ) { synchronized ( lock ) { result = keys ; if ( result == null ) { try { keys = result = readKeyDef ( builder ) ; } catch ( IOException e ) { throw new CDKException ( "could not read MA...
Access MACCS keys definitions .
28,877
private Pattern createPattern ( String smarts , IChemObjectBuilder builder ) throws IOException { SmartsPattern ptrn = SmartsPattern . create ( smarts , builder ) ; ptrn . setPrepare ( false ) ; return ptrn ; }
Create a pattern for the provided SMARTS - if the SMARTS is ? a pattern is not created .
28,878
public void process ( ) throws CDKException { logger . debug ( "Started parsing from input..." ) ; try { parser . setFeature ( "http://xml.org/sax/features/validation" , false ) ; logger . info ( "Deactivated validation" ) ; } catch ( SAXException e ) { logger . warn ( "Cannot deactivate validation." ) ; } parser . set...
Starts the reading of the CML file . Whenever a new Molecule is read a event is thrown to the ReaderListener .
28,879
public void addReactant ( IAtomContainer reactant , Double coefficient ) { reactants . addAtomContainer ( reactant , coefficient ) ; notifyChanged ( ) ; }
Adds a reactant to this reaction with a stoichiometry coefficient .
28,880
public boolean setReactantCoefficients ( Double [ ] coefficients ) { boolean result = reactants . setMultipliers ( coefficients ) ; notifyChanged ( ) ; return result ; }
Sets the coefficients of the reactants .
28,881
public boolean setProductCoefficients ( Double [ ] coefficients ) { boolean result = products . setMultipliers ( coefficients ) ; notifyChanged ( ) ; return result ; }
Sets the coefficient of the products .
28,882
public void addMapping ( IMapping mapping ) { if ( mappingCount + 1 >= map . length ) growMappingArray ( ) ; map [ mappingCount ] = mapping ; mappingCount ++ ; notifyChanged ( ) ; }
Adds a mapping between the reactant and product side to this Reaction .
28,883
public void removeMapping ( int pos ) { for ( int i = pos ; i < mappingCount - 1 ; i ++ ) { map [ i ] = map [ i + 1 ] ; } map [ mappingCount - 1 ] = null ; mappingCount -- ; notifyChanged ( ) ; }
Removes a mapping between the reactant and product side to this Reaction .
28,884
public static MolecularFormulaRange getRange ( IMolecularFormulaSet mfSet ) { MolecularFormulaRange mfRange = new MolecularFormulaRange ( ) ; for ( IMolecularFormula mf : mfSet . molecularFormulas ( ) ) { for ( IIsotope isotope : mf . isotopes ( ) ) { int occur_new = mf . getIsotopeCount ( isotope ) ; if ( ! mfRange . ...
Extract from a set of MolecularFormula the range of each each element found and put the element and occurrence in a new MolecularFormulaRange .
28,885
public static IMolecularFormula getMaximalFormula ( MolecularFormulaRange mfRange , IChemObjectBuilder builder ) { IMolecularFormula formula = builder . newInstance ( IMolecularFormula . class ) ; for ( IIsotope isotope : mfRange . isotopes ( ) ) { formula . addIsotope ( isotope , mfRange . getIsotopeCountMax ( isotope...
Returns the maximal occurrence of the IIsotope into IMolecularFormula from this MolelecularFormulaRange .
28,886
public static IMolecularFormula getMinimalFormula ( MolecularFormulaRange mfRange , IChemObjectBuilder builder ) { IMolecularFormula formula = builder . newInstance ( IMolecularFormula . class ) ; for ( IIsotope isotope : mfRange . isotopes ( ) ) { formula . addIsotope ( isotope , mfRange . getIsotopeCountMin ( isotope...
Returns the minimal occurrence of the IIsotope into IMolecularFormula from this MolelecularFormulaRange .
28,887
public int [ ] transformPoint ( double xCoord , double yCoord ) { double [ ] src = new double [ ] { xCoord , yCoord } ; double [ ] dest = new double [ 2 ] ; this . transform . transform ( src , 0 , dest , 0 , 1 ) ; return new int [ ] { ( int ) dest [ 0 ] , ( int ) dest [ 1 ] } ; }
Transforms a point according to the current affine transformation converting a world coordinate into a screen coordinate .
28,888
protected Rectangle2D getTextBounds ( String text , double xCoord , double yCoord , Graphics2D graphics ) { FontMetrics fontMetrics = graphics . getFontMetrics ( ) ; Rectangle2D bounds = fontMetrics . getStringBounds ( text , graphics ) ; double widthPad = 3 ; double heightPad = 1 ; double width = bounds . getWidth ( )...
Calculates the boundaries of a text string in screen coordinates .
28,889
public Object [ ] getParameters ( ) { Object [ ] params = new Object [ 2 ] ; params [ 0 ] = checkAromaticity ; params [ 1 ] = checkRingSystem ; return params ; }
Gets the parameters attribute of the LargestChainDescriptor object .
28,890
public void setMode ( int mode ) { switch ( mode ) { case MODE_EXACT : case MODE_JCOMPOUNDMAPPER : break ; default : throw new IllegalArgumentException ( "Invalid mode specified!" ) ; } this . mode = mode ; int numAtoms = mol . getAtomCount ( ) ; for ( int atomIdx = 0 ; atomIdx < numAtoms ; atomIdx ++ ) this . aexpr [ ...
Set the mode of SMARTS substructure selection
28,891
public String generate ( int [ ] atomIdxs ) { if ( atomIdxs == null ) throw new NullPointerException ( "No atom indexes provided" ) ; if ( atomIdxs . length == 0 ) return null ; if ( atomIdxs . length == 1 && mode == MODE_EXACT ) return aexpr [ atomIdxs [ 0 ] ] ; Arrays . fill ( rbnds , 0 ) ; Arrays . fill ( avisit , 0...
Generate a SMARTS for the substructure formed of the provided atoms .
28,892
private void encodeExpr ( int idx , int bprev , StringBuilder sb ) { avisit [ idx ] = numVisit ++ ; sb . append ( aexpr [ idx ] ) ; final int d = deg [ idx ] ; int remain = d ; for ( int j = 0 ; j < d ; j ++ ) { int nbr = atomAdj [ idx ] [ j ] ; int bidx = bondAdj [ idx ] [ j ] ; if ( rbnds [ bidx ] < 0 ) { final int r...
Recursively encodes a SMARTS expression into the provides string builder .
28,893
private int chooseRingNumber ( ) { for ( int i = 1 ; i < rnums . length ; i ++ ) { if ( rnums [ i ] == 0 ) { rnums [ i ] = 1 ; return i ; } } throw new IllegalStateException ( "No more ring numbers available!" ) ; }
Select the lowest ring number for use in SMARTS .
28,894
static public SimpleGraph getMoleculeGraph ( IAtomContainer molecule ) { SimpleGraph graph = new SimpleGraph ( ) ; for ( int i = 0 ; i < molecule . getAtomCount ( ) ; i ++ ) { IAtom atom = molecule . getAtom ( i ) ; graph . addVertex ( atom ) ; } for ( int i = 0 ; i < molecule . getBondCount ( ) ; i ++ ) { IBond bond =...
Creates a molecule graph for use with jgrapht . Bond orders are not respected .
28,895
public DescriptorValue calculate ( IAtomContainer container ) { if ( taeParams == null ) return getDummyDescriptorValue ( new CDKException ( "TAE parameters were not initialized" ) ) ; if ( ! ( container instanceof IBioPolymer ) ) return getDummyDescriptorValue ( new CDKException ( "The molecule should be of type IBioP...
Calculates the 147 TAE descriptors for amino acids .
28,896
private List < Integer > getAttachedInOrder ( IRing macrocycle , IAtomContainer shared ) { List < Integer > ringAttach = new ArrayList < > ( ) ; Set < IAtom > visit = new HashSet < > ( ) ; IAtom atom = shared . getAtom ( 0 ) ; while ( atom != null ) { visit . add ( atom ) ; ringAttach . add ( macrocycle . indexOf ( ato...
Get the shared indices of a macrocycle and atoms shared with another ring .
28,897
private int selectCoords ( Collection < Point2d [ ] > ps , Point2d [ ] coords , IRing macrocycle , IRingSet ringset ) { assert ps . size ( ) != 0 ; final int [ ] winding = new int [ coords . length ] ; MacroScore best = null ; for ( Point2d [ ] p : ps ) { final int wind = winding ( p , winding ) ; MacroScore score = be...
Select the best coordinates
28,898
private static int winding ( final Point2d [ ] coords , final int [ ] winding ) { int cw = 0 , ccw = 0 ; Point2d prev = coords [ coords . length - 1 ] ; for ( int i = 0 ; i < coords . length ; i ++ ) { Point2d curr = coords [ i ] ; Point2d next = coords [ ( i + 1 ) % coords . length ] ; winding [ i ] = winding ( prev ,...
Determine the overall winding and the vertex of a ring template .
28,899
private static int winding ( Point2d a , Point2d b , Point2d c ) { return ( int ) Math . signum ( ( b . x - a . x ) * ( c . y - a . y ) - ( b . y - a . y ) * ( c . x - a . x ) ) ; }
Determine the winding of three points using the determinant .