idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
28,900
private static IAtomContainer roundUpIfNeeded ( IAtomContainer anon ) { IChemObjectBuilder bldr = anon . getBuilder ( ) ; if ( ( anon . getAtomCount ( ) & 0x1 ) != 0 ) { IBond bond = anon . removeBond ( anon . getBondCount ( ) - 1 ) ; IAtom dummy = bldr . newInstance ( IAtom . class , "C" ) ; anon . addAtom ( dummy ) ;...
Make a ring one atom bigger if it s of an odd size .
28,901
public IAtomType findMatchingAtomType ( IAtomContainer atomContainer , IAtom atom ) throws CDKException { if ( factory == null ) { try { factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/structgen_atomtypes.xml" , atom . getBuilder ( ) ) ; } catch ( Exception ex1 ) { logger . error ( ex1 . getM...
Finds the AtomType matching the Atom s element symbol formal charge and hybridization state .
28,902
public DescriptorValue calculate ( IBond bond , IAtomContainer atomContainer ) { double value = 0 ; String originalAtomtypeName1 = bond . getBegin ( ) . getAtomTypeName ( ) ; Integer originalNeighborCount1 = bond . getBegin ( ) . getFormalNeighbourCount ( ) ; IAtomType . Hybridization originalHybridization1 = bond . ge...
This method calculates the ionization potential of a bond .
28,903
public Partition getInitialPartition ( ) { int bondCount = atomContainer . getBondCount ( ) ; Map < String , SortedSet < Integer > > cellMap = new HashMap < String , SortedSet < Integer > > ( ) ; for ( int bondIndex = 0 ; bondIndex < bondCount ; bondIndex ++ ) { IBond bond = atomContainer . getBond ( bondIndex ) ; Stri...
Get the bond partition based on the element types of the atoms at either end of the bond and the bond order .
28,904
private int ringSystemClassifier ( IRing ring , String smile ) throws CDKException { logger . debug ( "Comparing ring systems: SMILES=" , smile ) ; if ( PYRROLE_SMI == null ) { final SmilesParser smipar = new SmilesParser ( ring . getBuilder ( ) ) ; initCache ( smipar ) ; } if ( smile . equals ( PYRROLE_SMI ) ) return ...
Identifies ringSystem and returns a number which corresponds to CDKChemicalRingConstant
28,905
public void setAtoms ( IAtom [ ] atoms ) { this . atoms = atoms ; for ( IAtom atom : atoms ) { atom . addListener ( this ) ; } this . atomCount = atoms . length ; notifyChanged ( ) ; }
Sets the array of atoms of this AtomContainer .
28,906
public void setBonds ( IBond [ ] bonds ) { this . bonds = bonds ; for ( IBond bond : bonds ) { bond . addListener ( this ) ; } this . bondCount = bonds . length ; }
Sets the array of bonds of this AtomContainer .
28,907
public List < IAtom > getConnectedAtomsList ( IAtom atom ) { List < IAtom > atomsList = new ArrayList < IAtom > ( ) ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) ) atomsList . add ( bonds [ i ] . getOther ( atom ) ) ; } return atomsList ; }
Returns an ArrayList of all atoms connected to the given atom .
28,908
public List < IBond > getConnectedBondsList ( IAtom atom ) { List < IBond > bondsList = new ArrayList < IBond > ( ) ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) ) bondsList . add ( bonds [ i ] ) ; } return bondsList ; }
Returns an ArrayList of all Bonds connected to the given atom .
28,909
public List < ISingleElectron > getConnectedSingleElectronsList ( IAtom atom ) { List < ISingleElectron > lps = new ArrayList < ISingleElectron > ( ) ; for ( int i = 0 ; i < singleElectronCount ; i ++ ) { if ( singleElectrons [ i ] . contains ( atom ) ) lps . add ( singleElectrons [ i ] ) ; } return lps ; }
Returns an array of all SingleElectron connected to the given atom .
28,910
public int getConnectedAtomsCount ( IAtom atom ) { int count = 0 ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) ) ++ count ; } return count ; }
Returns the number of atoms connected to the given atom .
28,911
public int getConnectedLonePairsCount ( IAtom atom ) { int count = 0 ; for ( int i = 0 ; i < lonePairCount ; i ++ ) { if ( lonePairs [ i ] . contains ( atom ) ) ++ count ; } return count ; }
Returns the number of LonePairs for a given Atom .
28,912
public int getConnectedSingleElectronsCount ( IAtom atom ) { int count = 0 ; for ( int i = 0 ; i < singleElectronCount ; i ++ ) { if ( singleElectrons [ i ] . contains ( atom ) ) ++ count ; } return count ; }
Returns the sum of the SingleElectron for a given Atom .
28,913
public double getBondOrderSum ( IAtom atom ) { double count = 0 ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) ) { if ( bonds [ i ] . getOrder ( ) == IBond . Order . SINGLE ) { count += 1 ; } else if ( bonds [ i ] . getOrder ( ) == IBond . Order . DOUBLE ) { count += 2 ; } else if ( b...
Returns the sum of the bond orders for a given Atom .
28,914
public Order getMaximumBondOrder ( IAtom atom ) { IBond . Order max = IBond . Order . SINGLE ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) && bonds [ i ] . getOrder ( ) . ordinal ( ) > max . ordinal ( ) ) { max = bonds [ i ] . getOrder ( ) ; } } return max ; }
Returns the maximum bond order that this atom currently has in the context of this AtomContainer .
28,915
public Order getMinimumBondOrder ( IAtom atom ) { IBond . Order min = IBond . Order . QUADRUPLE ; for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) && bonds [ i ] . getOrder ( ) . ordinal ( ) < min . ordinal ( ) ) { min = bonds [ i ] . getOrder ( ) ; } } return min ; }
Returns the minimum bond order that this atom currently has in the context of this AtomContainer .
28,916
public void add ( IAtomContainer atomContainer ) { if ( atomContainer instanceof QueryAtomContainer ) { for ( int f = 0 ; f < atomContainer . getAtomCount ( ) ; f ++ ) { if ( ! contains ( atomContainer . getAtom ( f ) ) ) { addAtom ( atomContainer . getAtom ( f ) ) ; } } for ( int f = 0 ; f < atomContainer . getBondCou...
Adds all atoms and electronContainers of a given atomcontainer to this container .
28,917
public void addAtom ( IAtom atom ) { if ( contains ( atom ) ) { return ; } if ( atomCount + 1 >= atoms . length ) { growAtomArray ( ) ; } atom . addListener ( this ) ; atoms [ atomCount ] = atom ; atomCount ++ ; notifyChanged ( ) ; }
Adds an atom to this container .
28,918
public void addBond ( IBond bond ) { if ( bondCount >= bonds . length ) growBondArray ( ) ; bonds [ bondCount ] = bond ; ++ bondCount ; notifyChanged ( ) ; }
Adds a Bond to this AtomContainer .
28,919
public void addLonePair ( ILonePair lonePair ) { if ( lonePairCount >= lonePairs . length ) growLonePairArray ( ) ; lonePairs [ lonePairCount ] = lonePair ; ++ lonePairCount ; notifyChanged ( ) ; }
Adds a lone pair to this AtomContainer .
28,920
public void addSingleElectron ( ISingleElectron singleElectron ) { if ( singleElectronCount >= singleElectrons . length ) growSingleElectronArray ( ) ; singleElectrons [ singleElectronCount ] = singleElectron ; ++ singleElectronCount ; notifyChanged ( ) ; }
Adds a single electron to this AtomContainer .
28,921
public void removeAtom ( IAtom atom ) { int position = getAtomNumber ( atom ) ; if ( position != - 1 ) { for ( int i = 0 ; i < bondCount ; i ++ ) { if ( bonds [ i ] . contains ( atom ) ) { removeBond ( i ) ; -- i ; } } for ( int i = 0 ; i < lonePairCount ; i ++ ) { if ( lonePairs [ i ] . contains ( atom ) ) { removeLon...
Removes the given atom and all connected electronContainers from the AtomContainer .
28,922
public void addBond ( int atom1 , int atom2 , IBond . Order order , IBond . Stereo stereo ) { IBond bond = getBuilder ( ) . newInstance ( IBond . class , getAtom ( atom1 ) , getAtom ( atom2 ) , order , stereo ) ; if ( contains ( bond ) ) { return ; } if ( bondCount >= bonds . length ) { growBondArray ( ) ; } addBond ( ...
Adds a bond to this container .
28,923
public boolean contains ( IElectronContainer electronContainer ) { if ( electronContainer instanceof IBond ) return contains ( ( IBond ) electronContainer ) ; if ( electronContainer instanceof ILonePair ) return contains ( ( ILonePair ) electronContainer ) ; if ( electronContainer instanceof ISingleElectron ) return co...
True if the AtomContainer contains the given ElectronContainer object .
28,924
private void growAtomArray ( ) { growArraySize = ( atoms . length < growArraySize ) ? growArraySize : atoms . length ; IAtom [ ] newatoms = new IAtom [ atoms . length + growArraySize ] ; System . arraycopy ( atoms , 0 , newatoms , 0 , atoms . length ) ; atoms = newatoms ; }
Grows the atom array by a given size .
28,925
private void growBondArray ( ) { growArraySize = ( bonds . length < growArraySize ) ? growArraySize : bonds . length ; IBond [ ] newBonds = new IBond [ bonds . length + growArraySize ] ; System . arraycopy ( bonds , 0 , newBonds , 0 , bonds . length ) ; bonds = newBonds ; }
Grows the bond array by a given size .
28,926
private void growLonePairArray ( ) { growArraySize = ( lonePairs . length < growArraySize ) ? growArraySize : lonePairs . length ; ILonePair [ ] newLonePairs = new ILonePair [ lonePairs . length + growArraySize ] ; System . arraycopy ( lonePairs , 0 , newLonePairs , 0 , lonePairs . length ) ; lonePairs = newLonePairs ;...
Grows the lone pair array by a given size .
28,927
private void growSingleElectronArray ( ) { growArraySize = ( singleElectrons . length < growArraySize ) ? growArraySize : singleElectrons . length ; ISingleElectron [ ] newSingleElectrons = new ISingleElectron [ singleElectrons . length + growArraySize ] ; System . arraycopy ( singleElectrons , 0 , newSingleElectrons ,...
Grows the single electron array by a given size .
28,928
public static int [ ] [ ] getMatrix ( IAtomContainer container ) { IBond bond ; int indexAtom1 ; int indexAtom2 ; int [ ] [ ] conMat = new int [ container . getAtomCount ( ) ] [ container . getAtomCount ( ) ] ; for ( int f = 0 ; f < container . getBondCount ( ) ; f ++ ) { bond = container . getBond ( f ) ; indexAtom1 =...
Returns the adjacency matrix for the given AtomContainer .
28,929
public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { if ( factory == null ) try { factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/jmol_atomtypes.txt" , container . getBuilder ( ) ) ; } catch ( Exception exception ) { return new DescriptorValue ( getSpecification ( ) , ...
This method calculates the Covalent radius of an atom .
28,930
public void setMoleculeSet ( IAtomContainerSet setOfMolecules ) { if ( this . setOfMolecules != null ) this . setOfMolecules . removeListener ( this ) ; this . setOfMolecules = setOfMolecules ; if ( this . setOfMolecules != null ) this . setOfMolecules . addListener ( this ) ; notifyChanged ( ) ; }
Sets the MoleculeSet of this ChemModel .
28,931
public void setRingSet ( IRingSet ringSet ) { if ( this . ringSet != null ) this . ringSet . removeListener ( this ) ; this . ringSet = ringSet ; if ( this . ringSet != null ) this . ringSet . addListener ( this ) ; notifyChanged ( ) ; }
Sets the RingSet of this ChemModel .
28,932
public void setCrystal ( ICrystal crystal ) { if ( this . crystal != null ) this . crystal . removeListener ( this ) ; this . crystal = crystal ; if ( this . crystal != null ) this . crystal . addListener ( this ) ; notifyChanged ( ) ; }
Sets the Crystal contained in this ChemModel .
28,933
public void setReactionSet ( IReactionSet sor ) { if ( this . setOfReactions != null ) this . setOfReactions . removeListener ( this ) ; this . setOfReactions = sor ; if ( this . setOfReactions != null ) this . setOfReactions . addListener ( this ) ; notifyChanged ( ) ; }
Sets the ReactionSet contained in this ChemModel .
28,934
public static IAtomContainer makeDeepCopy ( IAtomContainer container ) { IAtomContainer newAtomContainer = DefaultChemObjectBuilder . getInstance ( ) . newInstance ( IAtomContainer . class ) ; int lonePairCount = container . getLonePairCount ( ) ; int singleElectronCount = container . getSingleElectronCount ( ) ; ILone...
Returns deep copy of the molecule
28,935
public static void aromatizeMolecule ( IAtomContainer mol ) { IRingSet ringSet = null ; try { AllRingsFinder arf = new AllRingsFinder ( ) ; ringSet = arf . findAllRings ( mol ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } try { SMSDNormalizer . percieveAtomTypesAndConfigureAtoms ( mol ) ; Aromaticity . cdkLe...
This function finds rings and uses aromaticity detection code to aromatize the molecule .
28,936
public static int getImplicitHydrogenCount ( IAtomContainer atomContainer , IAtom atom ) { return atom . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ? 0 : atom . getImplicitHydrogenCount ( ) ; }
Returns The number of Implicit Hydrogen Count for a given IAtom .
28,937
protected void fireFrameRead ( ) { for ( IChemObjectIOListener chemListener : getListeners ( ) ) { IReaderListener listener = ( IReaderListener ) chemListener ; if ( frameReadEvent == null ) { frameReadEvent = new ReaderEvent ( this ) ; } listener . frameRead ( frameReadEvent ) ; } }
Sends a frame read event to the registered ReaderListeners .
28,938
public DescriptorValue calculate ( IAtomContainer container ) { double bpol = 0 ; int atomicNumber0 ; int atomicNumber1 ; double difference ; try { IsotopeFactory ifac = Isotopes . getInstance ( ) ; IElement element0 ; IElement element1 ; String symbol0 ; String symbol1 ; for ( IBond bond : container . bonds ( ) ) { IA...
This method calculate the sum of the absolute value of the difference between atomic polarizabilities of all bonded atoms in the molecule
28,939
public static void displayMatrix ( double [ ] [ ] matrix ) { String line ; for ( int f = 0 ; f < matrix . length ; f ++ ) { line = "" ; for ( int g = 0 ; g < matrix . length ; g ++ ) { line += matrix [ g ] [ f ] + " | " ; } logger . debug ( line ) ; } }
Lists a 2D double matrix to the System console .
28,940
public static void displayArray ( int [ ] array ) { String line = "" ; for ( int f = 0 ; f < array . length ; f ++ ) { line += array [ f ] + " | " ; } logger . debug ( line ) ; }
Lists a 1D array to the System console .
28,941
public void write ( IChemObject object ) throws CDKException { if ( object instanceof ICrystal ) { writeCrystal ( ( ICrystal ) object ) ; } else { throw new CDKException ( "Only Crystal objects can be read." ) ; } }
Serializes the IChemObject to ShelX and redirects it to the output Writer .
28,942
private void setActiveCenters ( IAtomContainer reactant ) throws CDKException { Iterator < IAtom > atoms = reactant . atoms ( ) . iterator ( ) ; while ( atoms . hasNext ( ) ) { IAtom atom = atoms . next ( ) ; if ( reactant . getConnectedLonePairsCount ( atom ) > 0 && reactant . getConnectedSingleElectronsCount ( atom )...
set the active center for this molecule . The active center will be heteroatoms which contain at least one group of lone pair electrons .
28,943
public static void add3DCoordinates1 ( IAtomContainer atomContainer ) { IAtomContainer noCoords = atomContainer . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtomContainer refAtoms = atomContainer . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; for ( int i = 0 ; i < atomContainer . getAtomCou...
Generate coordinates for all atoms which are singly bonded and have no coordinates . This is useful when hydrogens are present but have no coordinates . It knows about C O N S only and will give tetrahedral or trigonal geometry elsewhere . Bond lengths are computed from covalent radii if available . Angles are tetrahed...
28,944
public static Point3d rescaleBondLength ( IAtom atom1 , IAtom atom2 , Point3d point2 ) { Point3d point1 = atom1 . getPoint3d ( ) ; double d1 = atom1 . getCovalentRadius ( ) ; double d2 = atom2 . getCovalentRadius ( ) ; double distance = ( d1 < 0.1 || d2 < 0.1 ) ? 1.0 : atom1 . getCovalentRadius ( ) + atom2 . getCovalen...
Rescales Point2 so that length 1 - 2 is sum of covalent radii . if covalent radii cannot be found use bond length of 1 . 0
28,945
protected void newAtomData ( ) { atomCounter = 0 ; elsym = new ArrayList < String > ( ) ; elid = new ArrayList < String > ( ) ; eltitles = new ArrayList < String > ( ) ; formalCharges = new ArrayList < String > ( ) ; partialCharges = new ArrayList < String > ( ) ; isotope = new ArrayList < String > ( ) ; atomicNumbers ...
Clean all data about read atoms .
28,946
protected void newBondData ( ) { bondCounter = 0 ; bondid = new ArrayList < String > ( ) ; bondARef1 = new ArrayList < String > ( ) ; bondARef2 = new ArrayList < String > ( ) ; order = new ArrayList < String > ( ) ; bondStereo = new ArrayList < String > ( ) ; bondCustomProperty = new Hashtable < String , Map < String ,...
Clean all data about read bonds .
28,947
public static double atof ( String s ) { int i = 0 ; int sign = 1 ; double r = 0 ; double p = 1 ; int state = 0 ; while ( i < s . length ( ) && Character . isWhitespace ( s . charAt ( i ) ) ) i ++ ; if ( i < s . length ( ) && s . charAt ( i ) == '-' ) { sign = - 1 ; i ++ ; } else if ( i < s . length ( ) && s . charAt (...
Converts a string of digits to an double .
28,948
public DescriptorValue calculate ( IAtomContainer mol ) { try { mol = mol . clone ( ) ; } catch ( CloneNotSupportedException ex ) { } double polar = 0 , weight = 0 ; try { IChemObjectBuilder builder = mol . getBuilder ( ) ; CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher . getInstance ( builder ) ; for ( IAtom atom : m...
Calculates the topological polar surface area and expresses it as a ratio to molecule size .
28,949
public static IAtomContainerSet partitionIntoMolecules ( IAtomContainer container ) { ConnectedComponents cc = new ConnectedComponents ( GraphUtil . toAdjList ( container ) ) ; return partitionIntoMolecules ( container , cc . components ( ) ) ; }
Partitions the atoms in an AtomContainer into covalently connected components .
28,950
public static double [ ] [ ] getMatrix ( IAtomContainer container ) { IBond bond = null ; int indexAtom1 ; int indexAtom2 ; double [ ] [ ] conMat = new double [ container . getAtomCount ( ) ] [ container . getAtomCount ( ) ] ; for ( int f = 0 ; f < container . getBondCount ( ) ; f ++ ) { bond = container . getBond ( f ...
Returns the connection matrix representation of this AtomContainer .
28,951
public boolean isIdentity ( ) { for ( int i = 0 ; i < this . values . length ; i ++ ) { if ( this . values [ i ] != i ) { return false ; } } return true ; }
Check to see if this permutation is the identity permutation .
28,952
public void setTo ( Permutation other ) { if ( this . values . length != other . values . length ) throw new IllegalArgumentException ( "permutations are different size" ) ; for ( int i = 0 ; i < this . values . length ; i ++ ) { this . values [ i ] = other . values [ i ] ; } }
Alter a permutation by setting it to the values in the other permutation .
28,953
public String toCycleString ( ) { int n = this . values . length ; boolean [ ] p = new boolean [ n ] ; Arrays . fill ( p , true ) ; StringBuilder sb = new StringBuilder ( ) ; int j = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] ) { sb . append ( '(' ) ; sb . append ( i ) ; p [ i ] = false ; j = i ; while ( p [ v...
An easily - readable version of the permutation as a product of cycles .
28,954
static boolean isSelected ( IChemObject object , RendererModel model ) { if ( object . getProperty ( StandardGenerator . HIGHLIGHT_COLOR ) != null ) return true ; if ( model . getSelection ( ) != null ) return model . getSelection ( ) . contains ( object ) ; return false ; }
Determine if an object is selected .
28,955
static boolean hasSelectedBond ( List < IBond > bonds , RendererModel model ) { for ( IBond bond : bonds ) { if ( isSelected ( bond , model ) ) return true ; } return false ; }
Determines if any bond in the list is selected
28,956
public void add ( double x , double y ) { if ( x < minX ) minX = x ; if ( y < minY ) minY = y ; if ( x > maxX ) maxX = x ; if ( y > maxY ) maxY = y ; }
Ensure the point x y is included in the bounding box .
28,957
public void add ( Bounds bounds ) { if ( bounds . minX < minX ) minX = bounds . minX ; if ( bounds . minY < minY ) minY = bounds . minY ; if ( bounds . maxX > maxX ) maxX = bounds . maxX ; if ( bounds . maxY > maxY ) maxY = bounds . maxY ; }
Add one bounds to another .
28,958
private void add ( GeneralPath path ) { double [ ] points = new double [ 6 ] ; for ( org . openscience . cdk . renderer . elements . path . PathElement element : path . elements ) { element . points ( points ) ; switch ( element . type ( ) ) { case MoveTo : case LineTo : add ( points [ 0 ] , points [ 1 ] ) ; break ; ca...
Add the provided general path to the bounding box .
28,959
public DescriptorValue calculate ( IAtom atom , IAtomContainer ac ) { if ( factory == null ) try { factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/jmol_atomtypes.txt" , ac . getBuilder ( ) ) ; } catch ( Exception exception ) { return getDummyDescriptorValue ( exception ) ; } Iterator < IAtom ...
It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder and 3D coordinates .
28,960
private TextElement makePlus ( Rectangle2D moleculeBox1 , Rectangle2D moleculeBox2 , double axis , Color color ) { double arrowCenter = ( moleculeBox1 . getCenterX ( ) + moleculeBox2 . getCenterX ( ) ) / 2 ; return new TextElement ( arrowCenter , axis , "+" , color ) ; }
Place a + sign between two molecules .
28,961
private void print ( String level , SAXParseException exception ) { if ( level . equals ( "warning" ) ) { logger . warn ( "** " + level + ": " + exception . getMessage ( ) ) ; logger . warn ( " URI = " + exception . getSystemId ( ) ) ; logger . warn ( " line = " + exception . getLineNumber ( ) ) ; } else { logger ...
Internal procedure that outputs an SAXParseException with a significance level to the cdk . tools . LoggingTool logger .
28,962
public void error ( SAXParseException exception ) throws SAXException { if ( reportErrors ) print ( "error" , exception ) ; if ( abortOnErrors ) throw exception ; }
Outputs a SAXParseException error to the logger .
28,963
public void fatalError ( SAXParseException exception ) throws SAXException { if ( reportErrors ) print ( "fatal" , exception ) ; if ( abortOnErrors ) throw exception ; }
Outputs as fatal SAXParseException error to the logger .
28,964
public static SymbolVisibility all ( ) { return new SymbolVisibility ( ) { public boolean visible ( IAtom atom , List < IBond > neighbors , RendererModel model ) { return true ; } } ; }
All atom symbols are visible .
28,965
public synchronized void sortResultsByStereoAndBondMatch ( ) throws CDKException { Map < Integer , Map < Integer , Integer > > allStereoMCS = new HashMap < Integer , Map < Integer , Integer > > ( ) ; Map < Integer , Map < IAtom , IAtom > > allStereoAtomMCS = new HashMap < Integer , Map < IAtom , IAtom > > ( ) ; Map < I...
Sort MCS solution by stereo and bond type matches .
28,966
public synchronized void sortResultsByFragments ( ) { Map < Integer , Map < Integer , Integer > > allFragmentMCS = new TreeMap < Integer , Map < Integer , Integer > > ( ) ; Map < Integer , Map < IAtom , IAtom > > allFragmentAtomMCS = new TreeMap < Integer , Map < IAtom , IAtom > > ( ) ; Map < Integer , Double > stereoS...
Sort solution by ascending order of the fragment count .
28,967
public synchronized void sortResultsByEnergies ( ) throws CDKException { Map < Integer , Map < Integer , Integer > > allEnergyMCS = new TreeMap < Integer , Map < Integer , Integer > > ( ) ; Map < Integer , Map < IAtom , IAtom > > allEnergyAtomMCS = new TreeMap < Integer , Map < IAtom , IAtom > > ( ) ; Map < Integer , D...
Sort MCS solution by bond breaking energy .
28,968
public static int convertBondStereo ( IBond bond ) { int value = 0 ; switch ( bond . getStereo ( ) ) { case UP : value = 1 ; break ; case UP_INVERTED : value = 1 ; break ; case DOWN : value = 6 ; break ; case DOWN_INVERTED : value = 6 ; break ; case UP_OR_DOWN : value = 4 ; break ; case UP_OR_DOWN_INVERTED : value = 4 ...
Get stereo value as integer
28,969
public static IBond . Stereo convertStereo ( int stereoValue ) { IBond . Stereo stereo = IBond . Stereo . NONE ; if ( stereoValue == 1 ) { stereo = IBond . Stereo . UP ; } else if ( stereoValue == 6 ) { stereo = IBond . Stereo . DOWN ; } else if ( stereoValue == 0 ) { stereo = IBond . Stereo . NONE ; } else if ( stereo...
Get stereo value as Stereo enum
28,970
List < IStereoElement > recognise ( Set < Projection > projections ) { if ( ! projections . contains ( Projection . Fischer ) ) return Collections . emptyList ( ) ; Map < IAtom , Integer > atomToIndex = new HashMap < IAtom , Integer > ( ) ; for ( IAtom atom : container . atoms ( ) ) { if ( atom . getPoint2d ( ) == null...
Recognise the tetrahedral stereochemistry in the provided structure .
28,971
static ITetrahedralChirality newTetrahedralCenter ( IAtom focus , IBond [ ] bonds ) { IBond [ ] cardinalBonds = cardinalBonds ( focus , bonds ) ; if ( cardinalBonds == null ) return null ; if ( ! isPlanarSigmaBond ( cardinalBonds [ NORTH ] ) || ! isPlanarSigmaBond ( cardinalBonds [ SOUTH ] ) ) return null ; if ( cardin...
Create a new tetrahedral stereocenter of the given focus and neighboring bonds . This is an internal method and is presumed the atom can support tetrahedral stereochemistry and it has three or four explicit neighbors .
28,972
private boolean isTerminal ( IAtom atom , Map < IAtom , Integer > atomToIndex ) { return graph [ atomToIndex . get ( atom ) ] . length == 1 ; }
Is the atom terminal having only one connection .
28,973
private static IBond [ ] neighbors ( int v , int [ ] [ ] g , EdgeToBondMap bondMap ) { int [ ] ws = g [ v ] ; IBond [ ] bonds = new IBond [ ws . length ] ; for ( int i = 0 ; i < ws . length ; i ++ ) { bonds [ i ] = bondMap . get ( v , ws [ i ] ) ; } return bonds ; }
Helper method to obtain the neighbouring bonds from an adjacency list graph and edge - > bond map .
28,974
private static boolean match ( String regExp , String userInput ) { Pattern pattern = Pattern . compile ( regExp ) ; Matcher matcher = pattern . matcher ( userInput ) ; if ( matcher . find ( ) ) return true ; else return false ; }
Helper method for regular expression matching .
28,975
AtomSymbol addAnnotation ( TextOutline annotation ) { List < TextOutline > newAnnotations = new ArrayList < TextOutline > ( annotationAdjuncts ) ; newAnnotations . add ( annotation ) ; return new AtomSymbol ( element , adjuncts , newAnnotations , alignment , hull ) ; }
Include a new annotation adjunct in the atom symbol .
28,976
Point2D getAlignmentCenter ( ) { if ( alignment == SymbolAlignment . Left ) { return element . getFirstGlyphCenter ( ) ; } else if ( alignment == SymbolAlignment . Right ) { return element . getLastGlyphCenter ( ) ; } else { return element . getCenter ( ) ; } }
Access the center point of the symbol . The center point is determined by the alignment .
28,977
List < Shape > getOutlines ( ) { List < Shape > shapes = new ArrayList < Shape > ( ) ; shapes . add ( element . getOutline ( ) ) ; for ( TextOutline adjunct : adjuncts ) shapes . add ( adjunct . getOutline ( ) ) ; return shapes ; }
Access the Java 2D shape text outlines that display the atom symbol .
28,978
List < Shape > getAnnotationOutlines ( ) { List < Shape > shapes = new ArrayList < Shape > ( ) ; for ( TextOutline adjunct : annotationAdjuncts ) shapes . add ( adjunct . getOutline ( ) ) ; return shapes ; }
Access the java . awt . Shape outlines of each annotation adjunct .
28,979
AtomSymbol transform ( AffineTransform transform ) { List < TextOutline > transformedAdjuncts = new ArrayList < TextOutline > ( adjuncts . size ( ) ) ; for ( TextOutline adjunct : adjuncts ) transformedAdjuncts . add ( adjunct . transform ( transform ) ) ; List < TextOutline > transformedAnnAdjuncts = new ArrayList < T...
Transform the position and orientation of the symbol .
28,980
AtomSymbol resize ( double scaleX , double scaleY ) { Point2D center = element . getCenter ( ) ; AffineTransform transform = new AffineTransform ( ) ; transform . translate ( center . getX ( ) , center . getY ( ) ) ; transform . scale ( scaleX , scaleY ) ; transform . translate ( - center . getX ( ) , - center . getY (...
Convenience function to resize an atom symbol .
28,981
AtomSymbol center ( double x , double y ) { Point2D center = getAlignmentCenter ( ) ; return translate ( x - center . getX ( ) , y - center . getY ( ) ) ; }
Convenience function to center an atom symbol on a specified point . The centering depends on the symbol alignment .
28,982
public StereoElementFactory interpretProjections ( Projection ... projections ) { Collections . addAll ( this . projections , projections ) ; this . check = true ; return this ; }
Indicate that stereochemistry drawn as a certain projection should be interpreted .
28,983
public double resolveOverlap ( IAtomContainer ac , IRingSet sssr ) { Vector overlappingAtoms = new Vector ( ) ; Vector overlappingBonds = new Vector ( ) ; logger . debug ( "Start of resolveOverlap" ) ; double overlapScore = getOverlapScore ( ac , overlappingAtoms , overlappingBonds ) ; if ( overlapScore > 0 ) { overlap...
Main method to be called to resolve overlap situations .
28,984
public double displace ( IAtomContainer ac , Vector overlappingAtoms , Vector overlappingBonds ) { double bondLength = GeometryUtil . getBondLengthAverage ( ac ) ; OverlapPair op = null ; IAtom a1 = null , a2 = null ; Vector2d v1 = null , v2 = null ; int steps = 0 ; int p = 0 ; double overlapScore = 0 ; double choice =...
Makes a small displacement to some atoms or rings in the given atomcontainer .
28,985
public double getOverlapScore ( IAtomContainer ac , Vector overlappingAtoms , Vector overlappingBonds ) { double overlapScore = 0 ; overlapScore = getAtomOverlapScore ( ac , overlappingAtoms ) ; return overlapScore ; }
Calculates a score based on the overlap of atoms and intersection of bonds . The overlap is calculated by summing up the distances between all pairs of atoms if they are less than half the standard bondlength apart .
28,986
public double getAtomOverlapScore ( IAtomContainer ac , Vector overlappingAtoms ) { overlappingAtoms . removeAllElements ( ) ; IAtom atom1 = null ; IAtom atom2 = null ; Point2d p1 = null ; Point2d p2 = null ; double distance = 0 ; double overlapScore = 0 ; double bondLength = GeometryUtil . getBondLengthAverage ( ac ) ...
Calculates a score based on the overlap of atoms . The overlap is calculated by summing up the distances between all pairs of atoms if they are less than half the standard bondlength apart .
28,987
public double getBondOverlapScore ( IAtomContainer ac , Vector overlappingBonds ) { overlappingBonds . removeAllElements ( ) ; double overlapScore = 0 ; IBond bond1 = null ; IBond bond2 = null ; double bondLength = GeometryUtil . getBondLengthAverage ( ac ) ; ; double overlapCutoff = bondLength / 2 ; for ( int f = 0 ; ...
Calculates a score based on the intersection of bonds .
28,988
public boolean areIntersected ( IBond bond1 , IBond bond2 ) { double x1 = 0 , x2 = 0 , x3 = 0 , x4 = 0 ; double y1 = 0 , y2 = 0 , y3 = 0 , y4 = 0 ; x1 = bond1 . getBegin ( ) . getPoint2d ( ) . x ; x2 = bond1 . getEnd ( ) . getPoint2d ( ) . x ; x3 = bond2 . getBegin ( ) . getPoint2d ( ) . x ; x4 = bond2 . getEnd ( ) . g...
Checks if two bonds cross each other .
28,989
private void setActiveCenters ( IAtomContainer reactant ) throws CDKException { if ( AtomContainerManipulator . getTotalCharge ( reactant ) != 0 ) return ; Iterator < IBond > bondis = reactant . bonds ( ) . iterator ( ) ; while ( bondis . hasNext ( ) ) { IBond bondi = bondis . next ( ) ; if ( ( ( bondi . getOrder ( ) =...
set the active center for this molecule . The active center will be those which correspond with X = Y .
28,990
public DescriptorValue calculate ( IAtom atom , IAtomContainer container ) { double value ; try { int i = container . indexOf ( atom ) ; if ( i < 0 ) throw new CDKException ( "atom was not a memeber of the provided container" ) ; container = container . clone ( ) ; atom = container . getAtom ( i ) ; AtomContainerManipu...
This method calculates the protonation affinity of an atom .
28,991
public Double [ ] getMultipliers ( ) { Double [ ] returnArray = new Double [ this . atomContainerCount ] ; System . arraycopy ( this . multipliers , 0 , returnArray , 0 , this . atomContainerCount ) ; return returnArray ; }
Returns an array of double with the stoichiometric coefficients of the products .
28,992
public boolean setMultipliers ( Double [ ] newMultipliers ) { if ( newMultipliers . length == atomContainerCount ) { if ( multipliers == null ) { multipliers = new Double [ atomContainerCount ] ; } System . arraycopy ( newMultipliers , 0 , multipliers , 0 , atomContainerCount ) ; notifyChanged ( ) ; return true ; } ret...
Sets the multipliers of the AtomContainers .
28,993
public void addAtomContainer ( IAtomContainer atomContainer , double multiplier ) { if ( atomContainerCount + 1 >= atomContainers . length ) { growAtomContainerArray ( ) ; } atomContainer . addListener ( this ) ; atomContainers [ atomContainerCount ] = atomContainer ; multipliers [ atomContainerCount ] = multiplier ; a...
Adds an atomContainer to this container with the given multiplier .
28,994
public void add ( IAtomContainerSet atomContainerSet ) { for ( IAtomContainer iter : atomContainerSet . atomContainers ( ) ) { addAtomContainer ( iter ) ; } }
Adds all atomContainers in the AtomContainerSet to this container .
28,995
public Iterable < IAtomContainer > atomContainers ( ) { return new Iterable < IAtomContainer > ( ) { public Iterator < IAtomContainer > iterator ( ) { return new AtomContainerIterator ( ) ; } } ; }
Get an iterator for this AtomContainerSet .
28,996
public Double getMultiplier ( IAtomContainer container ) { for ( int i = 0 ; i < atomContainerCount ; i ++ ) { if ( atomContainers [ i ] . equals ( container ) ) { return multipliers [ i ] ; } } return - 1.0 ; }
Returns the multiplier of the given AtomContainer .
28,997
protected void growAtomContainerArray ( ) { growArraySize = atomContainers . length ; IAtomContainer [ ] newatomContainers = new IAtomContainer [ atomContainers . length + growArraySize ] ; System . arraycopy ( atomContainers , 0 , newatomContainers , 0 , atomContainers . length ) ; atomContainers = newatomContainers ;...
Grows the atomContainer array by a given size .
28,998
public void sortAtomContainers ( final Comparator < IAtomContainer > comparator ) { Integer [ ] indexes = new Integer [ atomContainerCount ] ; for ( int i = 0 ; i < indexes . length ; i ++ ) indexes [ i ] = i ; Arrays . sort ( indexes , new Comparator < Integer > ( ) { public int compare ( Integer o1 , Integer o2 ) { r...
Sort the AtomContainers and multipliers using a provided Comparator .
28,999
public Collection essentialCycles ( ) { Collection result = new HashSet ( ) ; for ( Object subgraphBase : subgraphBases ) { SimpleCycleBasis cycleBasis = ( SimpleCycleBasis ) subgraphBase ; result . addAll ( cycleBasis . essentialCycles ( ) ) ; } return result ; }
Returns the essential cycles of this cycle basis . A essential cycle is contained in every minimum cycle basis of a graph .