idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
28,600
public int [ ] getTopoEquivClassbyHuXu ( IAtomContainer atomContainer ) throws NoSuchAtomException { double nodeSequence [ ] = prepareNode ( atomContainer ) ; nodeMatrix = buildNodeMatrix ( nodeSequence ) ; bondMatrix = buildBondMatrix ( ) ; weight = buildWeightMatrix ( nodeMatrix , bondMatrix ) ; return findTopoEquivC...
Get the topological equivalent class of the molecule .
28,601
public double [ ] [ ] buildNodeMatrix ( double [ ] nodeSequence ) { int i , j , k ; for ( i = 0 ; i < nodeNumber ; i ++ ) { nodeMatrix [ i ] [ 0 ] = nodeSequence [ i ] ; for ( j = 1 ; j <= layerNumber ; j ++ ) { nodeMatrix [ i ] [ j ] = 0.0 ; for ( k = 0 ; k < nodeNumber ; k ++ ) { if ( apspMatrix [ i ] [ k ] == j ) { ...
Build node Matrix .
28,602
public double [ ] [ ] buildTrialNodeMatrix ( double [ ] weight ) { int i , j , k ; for ( i = 0 ; i < nodeNumber ; i ++ ) { nodeMatrix [ i ] [ 0 ] = weight [ i + 1 ] ; for ( j = 1 ; j <= layerNumber ; j ++ ) { nodeMatrix [ i ] [ j ] = 0.0 ; for ( k = 0 ; k < nodeNumber ; k ++ ) { if ( apspMatrix [ i ] [ k ] == j ) { nod...
Build trial node Matrix .
28,603
public double [ ] [ ] buildBondMatrix ( ) { int i , j , k , m ; for ( i = 0 ; i < nodeNumber ; i ++ ) { for ( j = 1 ; j <= layerNumber ; j ++ ) { bondMatrix [ i ] [ j - 1 ] = 0.0 ; for ( k = 0 ; k < nodeNumber ; k ++ ) { if ( j == 1 ) { if ( apspMatrix [ i ] [ k ] == j ) { bondMatrix [ i ] [ j - 1 ] += adjaMatrix [ i ]...
Build bond matrix .
28,604
public double [ ] buildWeightMatrix ( double [ ] [ ] nodeMatrix , double [ ] [ ] bondMatrix ) { for ( int i = 0 ; i < nodeNumber ; i ++ ) { weight [ i + 1 ] = nodeMatrix [ i ] [ 0 ] ; for ( int j = 0 ; j < layerNumber ; j ++ ) { weight [ i + 1 ] += nodeMatrix [ i ] [ j + 1 ] * bondMatrix [ i ] [ j ] * Math . pow ( 10.0...
Build weight array for the given node matrix and bond matrix .
28,605
public int checkDiffNumber ( double [ ] weight ) { double category [ ] = new double [ weight . length ] ; int i , j ; int count = 1 ; double t ; category [ 1 ] = weight [ 1 ] ; for ( i = 2 ; i < weight . length ; i ++ ) { for ( j = 1 ; j <= count ; j ++ ) { t = weight [ i ] - category [ j ] ; if ( t < 0.0 ) t = - t ; i...
Get different number of the given number .
28,606
public int [ ] getEquivalentClass ( double [ ] weight ) { double category [ ] = new double [ weight . length ] ; int equivalentClass [ ] = new int [ weight . length ] ; int i , j ; int count = 1 ; double t ; category [ 1 ] = weight [ 1 ] ; for ( i = 2 ; i < weight . length ; i ++ ) { for ( j = 1 ; j <= count ; j ++ ) {...
Get the final equivalent class .
28,607
public int [ ] findTopoEquivClass ( double [ ] weight ) { int trialCount , i ; int equivalentClass [ ] = new int [ weight . length ] ; int count = checkDiffNumber ( weight ) ; trialCount = count ; if ( count == nodeNumber ) { for ( i = 1 ; i <= nodeNumber ; i ++ ) { equivalentClass [ i ] = i ; } equivalentClass [ 0 ] =...
Find the topological equivalent class for the given weight .
28,608
public static void prepare ( IAtomContainer container , boolean ringQuery ) { if ( ringQuery ) { SMARTSAtomInvariants . configureDaylightWithRingInfo ( container ) ; } else { SMARTSAtomInvariants . configureDaylightWithoutRingInfo ( container ) ; } }
Do not use - temporary method until the SMARTS packages are cleaned up .
28,609
private ValidationReport validateCharge ( IAtom atom ) { ValidationReport report = new ValidationReport ( ) ; ValidationTest tooCharged = new ValidationTest ( atom , "Atom has an unlikely large positive or negative charge" ) ; if ( atom . getSymbol ( ) . equals ( "O" ) || atom . getSymbol ( ) . equals ( "N" ) || atom ....
the Atom tests
28,610
private ValidationReport validateStereoChemistry ( IBond bond ) { ValidationReport report = new ValidationReport ( ) ; ValidationTest bondStereo = new ValidationTest ( bond , "Defining stereochemistry on bonds is not safe." , "Use atom based stereochemistry." ) ; if ( bond . getStereo ( ) != IBond . Stereo . NONE ) { r...
the Bond tests
28,611
public ValidationReport validateIsotopeExistence ( IIsotope isotope ) { ValidationReport report = new ValidationReport ( ) ; ValidationTest isotopeExists = new ValidationTest ( isotope , "Isotope with this mass number is not known for this element." ) ; try { IsotopeFactory isotopeFac = Isotopes . getInstance ( ) ; IIs...
the Isotope tests
28,612
private ValidationReport validateBondOrderSum ( IAtom atom , IAtomContainer molecule ) { ValidationReport report = new ValidationReport ( ) ; ValidationTest checkBondSum = new ValidationTest ( atom , "The atom's total bond order is too high." ) ; try { AtomTypeFactory structgenATF = AtomTypeFactory . getInstance ( "org...
the Molecule tests
28,613
public static IAtomContainerSet detect ( IAtomContainer ac ) { IAtomContainerSet piSystemSet = ac . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { IAtom atom = ac . getAtom ( i ) ; atom . setFlag ( CDKConstants . VISITED , false ) ; } for ( int i = 0 ...
Detect all conjugated pi systems in an AtomContainer . This method returns a AtomContainerSet with Atom and Bond objects from the original AtomContainer . The aromaticity has to be known before calling this method .
28,614
private static int checkAtom ( IAtomContainer ac , IAtom currentAtom ) { int check = - 1 ; List < IAtom > atoms = ac . getConnectedAtomsList ( currentAtom ) ; List < IBond > bonds = ac . getConnectedBondsList ( currentAtom ) ; if ( currentAtom . getFlag ( CDKConstants . ISAROMATIC ) ) { check = 0 ; } else if ( currentA...
Check an Atom whether it may be conjugated or not .
28,615
public boolean hasNext ( ) { if ( ! nextAvailableIsKnown ) { hasNext = false ; try { final String line = input . readLine ( ) ; if ( line == null ) { nextAvailableIsKnown = true ; return false ; } hasNext = true ; final String suffix = suffix ( line ) ; nextMolecule = readSmiles ( line ) ; nextMolecule . setTitle ( suf...
Checks whether there is another molecule to read .
28,616
private String suffix ( final String line ) { for ( int i = 0 ; i < line . length ( ) ; i ++ ) { char c = line . charAt ( i ) ; if ( c == ' ' || c == '\t' ) return line . substring ( i + 1 ) ; } return "" ; }
Obtain the suffix after a line containing SMILES . The suffix follows any or \ t termination characters .
28,617
private IAtomContainer readSmiles ( final String line ) { try { return sp . parseSmiles ( line ) ; } catch ( CDKException e ) { logger . error ( "Error while reading the SMILES from: " + line + ", " , e ) ; final IAtomContainer empty = builder . newInstance ( IAtomContainer . class , 0 , 0 , 0 , 0 ) ; empty . setProper...
Read the SMILES given in the input line - or return an empty container .
28,618
private void traverseRing ( int [ ] ringSystem , int v , int rnum ) { ringSystem [ v ] = rnum ; for ( int w : adjList [ v ] ) { if ( ringSystem [ w ] == 0 && bondMap . get ( v , w ) . isInRing ( ) ) traverseRing ( ringSystem , w , rnum ) ; } }
Simple method for marking ring systems with a flood - fill .
28,619
private boolean isCrossed ( Point2d beg1 , Point2d end1 , Point2d beg2 , Point2d end2 ) { return Line2D . linesIntersect ( beg1 . x , beg1 . y , end1 . x , end1 . y , beg2 . x , beg2 . y , end2 . x , end2 . y ) ; }
Check if two bonds are crossing .
28,620
void invert ( Collection < AtomPair > pairs ) { for ( AtomPair pair : pairs ) { if ( congestion . contribution ( pair . fst , pair . snd ) < MIN_SCORE ) continue ; if ( fusionPointInversion ( pair ) ) continue ; if ( macroCycleInversion ( pair ) ) continue ; } }
Special case congestion minimisation rotate terminals bonds around ring systems so they are inside the ring .
28,621
private boolean macroCycleInversion ( AtomPair pair ) { for ( int v : pair . seqAt ) { IAtom atom = mol . getAtom ( v ) ; if ( ! atom . isInRing ( ) || adjList [ v ] . length == 2 ) continue ; if ( atom . getProperty ( MacroCycleLayout . MACROCYCLE_ATOM_HINT ) == null ) continue ; final List < IBond > acyclic = new Arr...
of the ring
28,622
private double stretch ( AtomPair pair , IntStack stack , Point2d [ ] coords , Map < IBond , AtomPair > firstVisit ) { stackBackup . clear ( ) ; final double score = congestion . score ( ) ; double min = score ; for ( IBond bond : pair . bndAt ) { if ( bond . isInRing ( ) ) continue ; if ( bfix . contains ( bond ) ) co...
Stretch all bonds in the shortest path between a pair of atoms in an attempt to resolve the overlap . The stretch that produces the minimum congestion is stored in the provided stack and coords with the congestion score returned .
28,623
private void bendOrStretch ( Collection < AtomPair > pairs ) { Map < IBond , AtomPair > bendVisit = new HashMap < > ( ) ; Map < IBond , AtomPair > stretchVisit = new HashMap < > ( ) ; IntStack bendStack = new IntStack ( atoms . length ) ; IntStack stretchStack = new IntStack ( atoms . length ) ; for ( AtomPair pair : p...
Resolves conflicts either by bending bonds or stretching bonds in the shortest path between an overlapping pair . Bending and stretch are tried for each pair and the best resolution is used .
28,624
public void refine ( ) { for ( int i = 1 ; i <= MAX_ITERATIONS ; i ++ ) { final List < AtomPair > pairs = findCongestedPairs ( ) ; if ( pairs . isEmpty ( ) ) break ; final double min = congestion . score ( ) ; rotate ( pairs ) ; if ( congestion . score ( ) < min ) continue ; invert ( pairs ) ; if ( congestion . score (...
Refine the 2D coordinates of a layout to reduce overlap and congestion .
28,625
private void stretch ( IntStack stack , IAtom beg , IAtom end , double amount ) { Point2d begPoint = beg . getPoint2d ( ) ; Point2d endPoint = end . getPoint2d ( ) ; if ( begPoint . distance ( endPoint ) + amount > MAX_BOND_LENGTH ) return ; Vector2d vector = new Vector2d ( endPoint . x - begPoint . x , endPoint . y - ...
Stretch the distance between beg and end moving all atoms provided in the stack .
28,626
private static IAtom getCommon ( IBond bndA , IBond bndB ) { IAtom beg = bndA . getBegin ( ) ; IAtom end = bndA . getEnd ( ) ; if ( bndB . contains ( beg ) ) return beg ; else if ( bndB . contains ( end ) ) return end ; else return null ; }
Access the common atom shared by two bonds .
28,627
String getFormulasString ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( IMolecularFormula mf : getFormulas ( ) ) { if ( sb . length ( ) != 0 ) sb . append ( ", " ) ; sb . append ( MolecularFormulaManipulator . getString ( mf , false , true ) ) ; } return sb . toString ( ) ; }
Pretty - print the MFs of this isotope container .
28,628
public DescriptorValue calculate ( IAtomContainer container ) { int c1sp1 = 0 ; int c2sp1 = 0 ; int c1sp2 = 0 ; int c2sp2 = 0 ; int c3sp2 = 0 ; int c1sp3 = 0 ; int c2sp3 = 0 ; int c3sp3 = 0 ; int c4sp3 = 0 ; for ( IAtom atom : container . atoms ( ) ) { if ( ! atom . getSymbol ( ) . equals ( "C" ) && ! atom . getSymbol ...
Calculates the 9 carbon types descriptors
28,629
private IAtomContainer removingFlagsAromaticity ( IAtomContainer ac ) { Iterator < IAtom > atoms = ac . atoms ( ) . iterator ( ) ; while ( atoms . hasNext ( ) ) atoms . next ( ) . setFlag ( CDKConstants . ISAROMATIC , false ) ; Iterator < IBond > bonds = ac . bonds ( ) . iterator ( ) ; while ( bonds . hasNext ( ) ) bon...
remove the aromaticity flags .
28,630
private IAtomContainer setFlags ( IAtomContainer container , IAtomContainer ac , boolean b ) { for ( Iterator < IAtom > it = container . atoms ( ) . iterator ( ) ; it . hasNext ( ) ; ) { int positionA = ac . indexOf ( it . next ( ) ) ; ac . getAtom ( positionA ) . setFlag ( CDKConstants . REACTIVE_CENTER , b ) ; } for ...
Set the Flags to atoms and bonds from an atomContainer .
28,631
private IAtomContainer setAntiFlags ( IAtomContainer container , IAtomContainer ac , int number , boolean b ) { IBond bond = ac . getBond ( number ) ; if ( ! container . contains ( bond ) ) { bond . setFlag ( CDKConstants . REACTIVE_CENTER , b ) ; bond . getBegin ( ) . setFlag ( CDKConstants . REACTIVE_CENTER , b ) ; b...
Set the Flags to atoms and bonds which are not contained in an atomContainer .
28,632
private double getElectrostaticPotentialN ( IAtomContainer ac , int atom1 , double [ ] ds ) { double CoulombForceConstant = 0.048 ; double sum = 0.0 ; try { if ( factory == null ) factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/config/data/jmol_atomtypes.txt" , ac . getBuilder ( ) ) ; List < IAtom > atom...
get the electrostatic potential of the neighbours of a atom .
28,633
private double getTopologicalFactors ( IAtomContainer atomContainer , IAtomContainer ac ) { int totalNCharge1 = AtomContainerManipulator . getTotalNegativeFormalCharge ( atomContainer ) ; int totalPCharge1 = AtomContainerManipulator . getTotalPositiveFormalCharge ( atomContainer ) ; double fQ = 1.0 ; if ( totalNCharge1...
get the topological weight factor for each atomContainer .
28,634
private void cleanFlagReactiveCenter ( IAtomContainer ac ) { for ( int j = 0 ; j < ac . getAtomCount ( ) ; j ++ ) ac . getAtom ( j ) . setFlag ( CDKConstants . REACTIVE_CENTER , false ) ; for ( int j = 0 ; j < ac . getBondCount ( ) ; j ++ ) ac . getBond ( j ) . setFlag ( CDKConstants . REACTIVE_CENTER , false ) ; }
clean the flags CDKConstants . REACTIVE_CENTER from the molecule .
28,635
public boolean checkForceFieldType ( String ffname ) { boolean check = false ; for ( int i = 0 ; i < fftypes . length ; i ++ ) { if ( fftypes [ i ] . equals ( ffname ) ) { check = true ; break ; } } if ( ! check ) { return false ; } return true ; }
Sets the forceFieldType attribute of the ForceFieldConfigurator object
28,636
public void setForceFieldConfigurator ( String ffname , IChemObjectBuilder builder ) throws CDKException { ffname = ffname . toLowerCase ( ) ; boolean check = false ; if ( ffname == ffName && parameterSet != null ) { } else { check = this . checkForceFieldType ( ffname ) ; ffName = ffname ; if ( ffName . equals ( "mm2"...
Constructor for the ForceFieldConfigurator object
28,637
public void setMM2Parameters ( IChemObjectBuilder builder ) throws CDKException { try { if ( mm2 == null ) mm2 = new MM2BasedParameterSetReader ( ) ; mm2 . readParameterSets ( builder ) ; } catch ( Exception ex1 ) { throw new CDKException ( "Problem within readParameterSets due to:" + ex1 . toString ( ) , ex1 ) ; } par...
Sets the parameters attribute of the ForceFieldConfigurator object default is mm2 force field
28,638
private IAtomType getAtomType ( String ID ) throws NoSuchAtomTypeException { IAtomType at = null ; for ( int i = 0 ; i < atomTypes . size ( ) ; i ++ ) { at = ( IAtomType ) atomTypes . get ( i ) ; if ( at . getAtomTypeName ( ) . equals ( ID ) ) { return at ; } } throw new NoSuchAtomTypeException ( "AtomType " + ID + " c...
Find the atomType for a id
28,639
private boolean isHeteroRingSystem ( IAtomContainer ac ) { if ( ac != null ) { for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { if ( ! ( ac . getAtom ( i ) . getSymbol ( ) ) . equals ( "H" ) && ! ( ac . getAtom ( i ) . getSymbol ( ) ) . equals ( "C" ) ) { return true ; } } } return false ; }
Returns true if atom is in hetero ring system
28,640
private IAtom setAtom ( IAtom atom , String ID ) throws NoSuchAtomTypeException { IAtomType at = null ; String key = "" ; List < ? > data = null ; Double value = null ; at = getAtomType ( ID ) ; if ( atom . getSymbol ( ) == null ) { atom . setSymbol ( at . getSymbol ( ) ) ; } atom . setAtomTypeName ( at . getAtomTypeNa...
Assigns an atom type to an atom
28,641
public DescriptorValue calculate ( IAtomContainer atomContainer ) { double zagreb = 0 ; for ( IAtom atom : atomContainer . atoms ( ) ) { if ( atom . getSymbol ( ) . equals ( "H" ) ) continue ; int atomDegree = 0 ; List < IAtom > neighbours = atomContainer . getConnectedAtomsList ( atom ) ; for ( IAtom neighbour : neigh...
Evaluate the Zagreb Index for a molecule .
28,642
public static long [ ] getNumbers ( IAtomContainer atomContainer ) throws CDKException { String aux = auxInfo ( atomContainer ) ; long [ ] numbers = new long [ atomContainer . getAtomCount ( ) ] ; parseAuxInfo ( aux , numbers ) ; return numbers ; }
Makes an array containing the InChI atom numbers of the non - hydrogen atoms in the atomContainer . It returns zero for all hydrogens .
28,643
public static void parseAuxInfo ( String aux , long [ ] numbers ) { aux = aux . substring ( aux . indexOf ( "/N:" ) + 3 ) ; String numberStringAux = aux . substring ( 0 , aux . indexOf ( '/' ) ) ; int i = 1 ; for ( String numberString : numberStringAux . split ( "[,;]" ) ) numbers [ Integer . valueOf ( numberString ) -...
Parse the atom numbering from the auxinfo .
28,644
private static void exch ( long [ ] values , int i , int j ) { long k = values [ i ] ; values [ i ] = values [ j ] ; values [ j ] = k ; }
Exchange the elements at index i with that at index j .
28,645
static String auxInfo ( IAtomContainer container , INCHI_OPTION ... options ) throws CDKException { InChIGeneratorFactory factory = InChIGeneratorFactory . getInstance ( ) ; boolean org = factory . getIgnoreAromaticBonds ( ) ; factory . setIgnoreAromaticBonds ( true ) ; InChIGenerator gen = factory . getInChIGenerator ...
Obtain the InChI auxiliary info for the provided structure using using the specified InChI options .
28,646
private void checkLineBeginsWith ( String line , String expect , int lineCount ) throws CDKException { if ( line == null ) { throw new CDKException ( "RGFile invalid, empty/null line at #" + lineCount ) ; } if ( ! line . startsWith ( expect ) ) { throw new CDKException ( "RGFile invalid, line #" + lineCount + " should ...
Checks that a given line starts as expected according to RGFile format .
28,647
private boolean isBondTypeMatch ( IBond targetBond ) { int reactantBondType = queryBond . getOrder ( ) . numeric ( ) ; int productBondType = targetBond . getOrder ( ) . numeric ( ) ; if ( ( queryBond . getFlag ( CDKConstants . ISAROMATIC ) == targetBond . getFlag ( CDKConstants . ISAROMATIC ) ) && ( reactantBondType ==...
Return true if a bond is matched between query and target
28,648
static IAtomContainer apply ( IAtomContainer container ) { int n = container . getAtomCount ( ) ; int [ ] valences = new int [ n ] ; Map < IAtom , Integer > atomToIndex = Maps . newHashMapWithExpectedSize ( n ) ; for ( IAtom atom : container . atoms ( ) ) atomToIndex . put ( atom , atomToIndex . size ( ) ) ; for ( IBon...
Apply the MDL valence model to the provided atom container .
28,649
private boolean checkmArcs ( List < Integer > mArcsT , int neighborBondNumA , int neighborBondNumB ) { int size = neighborBondNumA * neighborBondNumA ; List < Integer > posNumList = new ArrayList < Integer > ( size ) ; for ( int i = 0 ; i < posNumList . size ( ) ; i ++ ) { posNumList . add ( i , 0 ) ; } int yCounter = ...
matrix will be stored in function partsearch .
28,650
public DescriptorValue calculate ( IBond aBond , IAtomContainer atomContainer ) { IAtomContainer ac ; IBond bond ; try { ac = ( IAtomContainer ) atomContainer . clone ( ) ; bond = ac . getBond ( atomContainer . indexOf ( aBond ) ) ; AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( ac ) ; } catch ( CDKExc...
The method calculates the sigma electronegativity of a given bond It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .
28,651
private List < InvPair > createInvarLabel ( IAtomContainer atomContainer ) { Iterator < IAtom > atoms = atomContainer . atoms ( ) . iterator ( ) ; IAtom a ; StringBuffer inv ; List < InvPair > vect = new ArrayList < InvPair > ( ) ; while ( atoms . hasNext ( ) ) { a = ( IAtom ) atoms . next ( ) ; inv = new StringBuffer ...
Create initial invariant labeling corresponds to step 1
28,652
private void primeProduct ( List < InvPair > v , IAtomContainer atomContainer ) { Iterator < InvPair > it = v . iterator ( ) ; Iterator < IAtom > n ; InvPair inv ; IAtom a ; long summ ; while ( it . hasNext ( ) ) { inv = ( InvPair ) it . next ( ) ; List < IAtom > neighbour = atomContainer . getConnectedAtomsList ( inv ...
Calculates the product of the neighbouring primes .
28,653
private void sortArrayList ( List < InvPair > v ) { Collections . sort ( v , new Comparator < InvPair > ( ) { public int compare ( InvPair o1 , InvPair o2 ) { if ( o1 . getCurr ( ) > o2 . getCurr ( ) ) return + 1 ; if ( o1 . getCurr ( ) < o2 . getCurr ( ) ) return - 1 ; return 0 ; } } ) ; Collections . sort ( v , new C...
Sorts the vector according to the current invariance corresponds to step 3
28,654
private void rankArrayList ( List < InvPair > v ) { int num = 1 ; int [ ] temp = new int [ v . size ( ) ] ; InvPair last = ( InvPair ) v . get ( 0 ) ; Iterator < InvPair > it = v . iterator ( ) ; InvPair curr ; for ( int x = 0 ; it . hasNext ( ) ; x ++ ) { curr = ( InvPair ) it . next ( ) ; if ( ! last . equals ( curr ...
Rank atomic vector corresponds to step 4 .
28,655
private boolean isInvPart ( List < InvPair > v ) { if ( ( ( InvPair ) v . get ( v . size ( ) - 1 ) ) . getCurr ( ) == v . size ( ) ) return true ; Iterator < InvPair > it = v . iterator ( ) ; InvPair curr ; while ( it . hasNext ( ) ) { curr = ( InvPair ) it . next ( ) ; if ( curr . getCurr ( ) != curr . getLast ( ) ) r...
Checks to see if the vector is invariantly partitioned
28,656
private void breakTies ( List < InvPair > v ) { Iterator < InvPair > it = v . iterator ( ) ; InvPair curr ; InvPair last = null ; int tie = 0 ; boolean found = false ; for ( int x = 0 ; it . hasNext ( ) ; x ++ ) { curr = it . next ( ) ; curr . setCurr ( curr . getCurr ( ) * 2 ) ; curr . setPrime ( ) ; if ( x != 0 && ! ...
Break ties . Corresponds to step 7
28,657
private void readBioPolymer ( String biopolymerFile ) { try { FileReader fileReader = new FileReader ( biopolymerFile ) ; ISimpleChemObjectReader reader = new ReaderFactory ( ) . createReader ( fileReader ) ; IChemFile chemFile = ( IChemFile ) reader . read ( ( IChemObject ) new ChemFile ( ) ) ; IChemSequence chemSeque...
Creates from a PDB File a BioPolymer .
28,658
public double [ ] findGridBoundaries ( ) { IAtom [ ] atoms = AtomContainerManipulator . getAtomArray ( protein ) ; double [ ] minMax = new double [ 6 ] ; minMax [ 0 ] = atoms [ 0 ] . getPoint3d ( ) . x ; minMax [ 1 ] = atoms [ 0 ] . getPoint3d ( ) . x ; minMax [ 2 ] = atoms [ 0 ] . getPoint3d ( ) . y ; minMax [ 3 ] = a...
Method determines the minimum and maximum values of a coordinate space up to 3D space .
28,659
public void createCubicGrid ( ) { gridGenerator . setDimension ( findGridBoundaries ( ) , true ) ; gridGenerator . generateGrid ( ) ; this . grid = gridGenerator . getGrid ( ) ; }
Method creates a cubic grid with the grid generator class .
28,660
private void sortPockets ( ) { Hashtable < Integer , List < Integer > > hashPockets = new Hashtable < Integer , List < Integer > > ( ) ; List < Point3d > pocket ; List < List < Point3d > > sortPockets = new ArrayList < List < Point3d > > ( pockets . size ( ) ) ; for ( int i = 0 ; i < pockets . size ( ) ; i ++ ) { pocke...
Method sorts the pockets due to its size . The biggest pocket is the first .
28,661
private int [ ] checkBoundaries ( int [ ] minMax , int [ ] dim ) { if ( minMax [ 0 ] < 0 ) { minMax [ 0 ] = 0 ; } if ( minMax [ 1 ] > dim [ 0 ] ) { minMax [ 1 ] = dim [ 0 ] ; } if ( minMax [ 2 ] < 0 ) { minMax [ 2 ] = 0 ; } if ( minMax [ 3 ] > dim [ 1 ] ) { minMax [ 3 ] = dim [ 1 ] ; } if ( minMax [ 4 ] < 0 ) { minMax ...
Method checks boundaries .
28,662
private void firePSPEvent ( List < Point3d > line ) { for ( int i = 0 ; i < line . size ( ) ; i ++ ) { this . grid [ ( int ) line . get ( i ) . x ] [ ( int ) line . get ( i ) . y ] [ ( int ) line . get ( i ) . z ] = this . grid [ ( int ) line . get ( i ) . x ] [ ( int ) line . get ( i ) . y ] [ ( int ) line . get ( i )...
Method which assigns upon a PSP event + 1 to these grid points .
28,663
public void diagonalAxisScanXZY ( int dimK , int dimL , int dimM ) { if ( dimM < dimL ) { dimL = dimM ; } List < Point3d > line = new ArrayList < Point3d > ( ) ; int pspEvent = 0 ; int m = 0 ; for ( int j = dimM ; j >= 1 ; j -- ) { line . clear ( ) ; pspEvent = 0 ; for ( int k = 0 ; k <= dimK ; k ++ ) { m = dimM ; line...
Method performs a scan ; works only for cubic grids!
28,664
public void gridToPmesh ( String outPutFileName ) { try { gridGenerator . writeGridInPmeshFormat ( outPutFileName ) ; } catch ( IOException e ) { logger . debug ( e ) ; } }
Method writes the grid to pmesh format .
28,665
public void writePocketsToPMesh ( String outPutFileName ) { try { for ( int i = 0 ; i < pockets . size ( ) ; i ++ ) { BufferedWriter writer = new BufferedWriter ( new FileWriter ( outPutFileName + "-" + i + ".pmesh" ) ) ; List < Point3d > pocket = pockets . get ( i ) ; writer . write ( pocket . size ( ) + "\n" ) ; for ...
Method writes the pockets to pmesh format .
28,666
public static Vector3d [ ] calcInvertedAxes ( Vector3d aAxis , Vector3d bAxis , Vector3d cAxis ) { double det = aAxis . x * bAxis . y * cAxis . z - aAxis . x * bAxis . z * cAxis . y - aAxis . y * bAxis . x * cAxis . z + aAxis . y * bAxis . z * cAxis . x + aAxis . z * bAxis . x * cAxis . y - aAxis . z * bAxis . y * cAxi...
Inverts three cell axes .
28,667
public static Vector3d [ ] notionalToCartesian ( double alength , double blength , double clength , double alpha , double beta , double gamma ) { Vector3d [ ] axes = new Vector3d [ 3 ] ; axes [ 0 ] = new Vector3d ( ) ; axes [ 0 ] . x = alength ; axes [ 0 ] . y = 0.0 ; axes [ 0 ] . z = 0.0 ; double toRadians = Math . PI...
Calculates Cartesian vectors for unit cell axes from axes lengths and angles between axes .
28,668
public static void fractionalToCartesian ( ICrystal crystal ) { Iterator < IAtom > atoms = crystal . atoms ( ) . iterator ( ) ; Vector3d aAxis = crystal . getA ( ) ; Vector3d bAxis = crystal . getB ( ) ; Vector3d cAxis = crystal . getC ( ) ; while ( atoms . hasNext ( ) ) { IAtom atom = atoms . next ( ) ; Point3d fracPo...
Creates Cartesian coordinates for all Atoms in the Crystal .
28,669
public double getBondLength ( ) { PharmacophoreAtom atom1 = PharmacophoreAtom . get ( getAtom ( 0 ) ) ; PharmacophoreAtom atom2 = PharmacophoreAtom . get ( getAtom ( 1 ) ) ; return atom1 . getPoint3d ( ) . distance ( atom2 . getPoint3d ( ) ) ; }
Get the distance between the two pharmacophore groups that make up the constraint .
28,670
public boolean matches ( IAtom atom ) { PharmacophoreAtom patom = PharmacophoreAtom . get ( atom ) ; return patom . getSymbol ( ) . equals ( getSymbol ( ) ) ; }
Checks whether this query atom matches a target atom .
28,671
Mappings matchRoot ( IAtom root ) { checkCompatibleAPI ( root ) ; IAtomContainer mol = root . getContainer ( ) ; if ( query . getAtomCount ( ) > 0 && ( ( IQueryAtom ) query . getAtom ( 0 ) ) . matches ( root ) ) { DfState local = new DfState ( state ) ; local . setRoot ( root ) ; return filter ( new Mappings ( query , ...
Match the pattern at the provided root .
28,672
public Partition getInitialPartition ( ) { if ( ignoreElements ) { int n = atomContainer . getAtomCount ( ) ; return Partition . unit ( n ) ; } Map < String , SortedSet < Integer > > cellMap = new HashMap < String , SortedSet < Integer > > ( ) ; int numberOfAtoms = atomContainer . getAtomCount ( ) ; for ( int atomIndex...
Get the element partition from an atom container which is simply a list of sets of atom indices where all atoms in one set have the same element symbol .
28,673
private void setupConnectionTable ( IAtomContainer atomContainer ) { int atomCount = atomContainer . getAtomCount ( ) ; connectionTable = new int [ atomCount ] [ ] ; if ( ! ignoreBondOrders ) { bondOrders = new int [ atomCount ] [ ] ; } for ( int atomIndex = 0 ; atomIndex < atomCount ; atomIndex ++ ) { IAtom atom = ato...
Makes a lookup table for the connection between atoms to avoid looking through the bonds each time .
28,674
public void setInputReader ( Reader reader ) { if ( reader instanceof BufferedReader ) { this . in = ( BufferedReader ) reader ; } else if ( reader == null ) { this . in = null ; } else { this . in = new BufferedReader ( reader ) ; } }
Overwrites the default reader from which the input is taken .
28,675
public void write ( IChemObject object ) throws CDKException { if ( object instanceof IReactionSet ) { writeReactionSet ( ( IReactionSet ) object ) ; } else if ( object instanceof IReaction ) { writeReaction ( ( IReaction ) object ) ; } else { throw new CDKException ( "Only supported is writing ReactionSet, Reaction ob...
Writes a IChemObject to the MDL RXN file formated output . It can only output ChemObjects of type Reaction
28,676
private void writeReactionSet ( IReactionSet reactions ) throws CDKException { for ( IReaction iReaction : reactions . reactions ( ) ) { writeReaction ( iReaction ) ; } }
Writes an array of Reaction to an OutputStream in MDL rdf format .
28,677
private void writeAtomContainerSet ( IAtomContainerSet som ) throws IOException , CDKException { for ( int i = 0 ; i < som . getAtomContainerCount ( ) ; i ++ ) { IAtomContainer mol = som . getAtomContainer ( i ) ; for ( int j = 0 ; j < som . getMultiplier ( i ) ; j ++ ) { StringWriter sw = new StringWriter ( ) ; writer...
Writes a MoleculeSet to an OutputStream for the reaction .
28,678
private String formatMDLInt ( int i , int l ) { String s = "" , fs = "" ; NumberFormat nf = NumberFormat . getNumberInstance ( Locale . ENGLISH ) ; nf . setParseIntegerOnly ( true ) ; nf . setMinimumIntegerDigits ( 1 ) ; nf . setMaximumIntegerDigits ( l ) ; nf . setGroupingUsed ( false ) ; s = nf . format ( i ) ; l = l...
Formats an int to fit into the connectiontable and changes it to a String .
28,679
public static SMARTSAtom and ( IQueryAtom left , IQueryAtom right ) { return new Conjunction ( left . getBuilder ( ) , left , right ) ; }
Conjunction the provided expressions .
28,680
public static SMARTSAtom or ( IQueryAtom left , IQueryAtom right ) { return new Disjunction ( left . getBuilder ( ) , left , right ) ; }
Disjunction the provided expressions .
28,681
public PathBuilder quadTo ( Point2d cp , Point2d ep ) { add ( new QuadTo ( cp , ep ) ) ; return this ; }
Make a quadratic curve in the path with one control point .
28,682
public PathBuilder cubicTo ( Point2d cp1 , Point2d cp2 , Point2d ep ) { add ( new CubicTo ( cp1 , cp2 , ep ) ) ; return this ; }
Make a cubic curve in the path with two control points .
28,683
public boolean showCarbon ( IAtom atom , IAtomContainer container , RendererModel model ) { Integer massNumber = atom . getMassNumber ( ) ; if ( massNumber != null ) { try { Integer expectedMassNumber = Isotopes . getInstance ( ) . getMajorIsotope ( atom . getSymbol ( ) ) . getMassNumber ( ) ; if ( ! massNumber . equal...
Returns true if the mass number of this element is set and not equal the mass number of the most abundant isotope of this element .
28,684
private static String encodePath ( int dist , IAtom a , IAtom b ) { return dist + "_" + a . getSymbol ( ) + "_" + b . getSymbol ( ) ; }
Creates the fingerprint name which is used as a key in our hashes
28,685
private static String encodeHalPath ( int dist , IAtom a , IAtom b ) { return dist + "_" + ( isHalogen ( a ) ? "X" : a . getSymbol ( ) ) + "_" + ( isHalogen ( b ) ? "X" : b . getSymbol ( ) ) ; }
Encodes name for halogen paths
28,686
private void calculate ( List < String > paths , IAtomContainer mol ) { AllPairsShortestPaths apsp = new AllPairsShortestPaths ( mol ) ; int numAtoms = mol . getAtomCount ( ) ; for ( int i = 0 ; i < numAtoms ; i ++ ) { if ( ! include ( mol . getAtom ( i ) ) ) continue ; for ( int j = i + 1 ; j < numAtoms ; j ++ ) { if ...
This performs the calculations used to generate the fingerprint
28,687
private void init ( ) { boolean success = false ; if ( ! success ) { try { javax . xml . parsers . SAXParserFactory spf = javax . xml . parsers . SAXParserFactory . newInstance ( ) ; spf . setNamespaceAware ( true ) ; javax . xml . parsers . SAXParser saxParser = spf . newSAXParser ( ) ; parser = saxParser . getXMLRead...
Initializes this reader .
28,688
public void add3DCoordinatesForSinglyBondedLigands ( IAtomContainer atomContainer ) throws CDKException { IAtom refAtom = null ; IAtom atomC = null ; int nwanted = 0 ; for ( int i = 0 ; i < atomContainer . getAtomCount ( ) ; i ++ ) { refAtom = atomContainer . getAtom ( i ) ; if ( ! refAtom . getSymbol ( ) . equals ( "H...
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 or taken out of a parameter set if...
28,689
public Point3d rescaleBondLength ( IAtom atom1 , IAtom atom2 , Point3d point2 ) { Point3d point1 = atom1 . getPoint3d ( ) ; Double d1 = atom1 . getCovalentRadius ( ) ; Double d2 = atom2 . getCovalentRadius ( ) ; double distance = ( d1 == null || d2 == null ) ? 1.0 : d1 + d2 ; if ( pSet != null ) { distance = getDistanc...
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,690
public Point3d [ ] get3DCoordinatesForSP2Ligands ( IAtom refAtom , IAtomContainer noCoords , IAtomContainer withCoords , IAtom atomC , double length , double angle ) { Point3d newPoints [ ] = new Point3d [ 1 ] ; if ( angle < 0 ) { angle = SP2_ANGLE ; } if ( withCoords . getAtomCount ( ) >= 2 ) { newPoints [ 0 ] = calcu...
Main method for the calculation of the ligand coordinates for sp2 atoms . Decides if one or two coordinates should be created
28,691
public Point3d [ ] get3DCoordinatesForSP3Ligands ( IAtom refAtom , IAtomContainer noCoords , IAtomContainer withCoords , IAtom atomC , int nwanted , double length , double angle ) { Point3d newPoints [ ] = new Point3d [ 0 ] ; Point3d aPoint = refAtom . getPoint3d ( ) ; int nwithCoords = withCoords . getAtomCount ( ) ; ...
Main method for the calculation of the ligand coordinates for sp3 atoms . Decides how many coordinates should be created
28,692
private Vector3d getNonColinearVector ( Vector3d ab ) { Vector3d cr = new Vector3d ( ) ; cr . cross ( ab , XV ) ; if ( cr . length ( ) > 0.00001 ) { return XV ; } else { return YV ; } }
Gets the nonColinearVector attribute of the AtomLigandPlacer3D class
28,693
public static Vector3d rotate ( Vector3d vector , Vector3d axis , double angle ) { Matrix3d rotate = new Matrix3d ( ) ; rotate . set ( new AxisAngle4d ( axis . x , axis . y , axis . z , angle ) ) ; Vector3d result = new Vector3d ( ) ; rotate . transform ( vector , result ) ; return result ; }
Rotates a vector around an axis .
28,694
private double getDistanceValue ( 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 { return DEFAULT_BOND_LENGTH_H ; } ...
Gets the distance between two atoms out of the parameter set .
28,695
public double getSpatproduct ( Vector3d a , Vector3d b , Vector3d c ) { return ( c . x * ( b . y * a . z - b . z * a . y ) + c . y * ( b . z * a . x - b . x * a . z ) + c . z * ( b . x * a . y - b . y * a . x ) ) ; }
Gets the spatproduct of three vectors .
28,696
public double getTorsionAngle ( Point3d a , Point3d b , Point3d c , Point3d d ) { Vector3d ab = new Vector3d ( a . x - b . x , a . y - b . y , a . z - b . z ) ; Vector3d cb = new Vector3d ( c . x - b . x , c . y - b . y , c . z - b . z ) ; Vector3d dc = new Vector3d ( d . x - c . x , d . y - c . y , d . z - c . z ) ; V...
Calculates the torsionAngle of a - b - c - d .
28,697
public IAtomContainer getPlacedAtomsInAtomContainer ( IAtom atom , IAtomContainer ac ) { List bonds = ac . getConnectedBondsList ( atom ) ; IAtomContainer connectedAtoms = atom . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtom connectedAtom = null ; for ( int i = 0 ; i < bonds . size ( ) ; i ++ ) { conn...
Gets all placed neighbouring atoms of a atom .
28,698
public IAtomContainer getUnsetAtomsInAtomContainer ( IAtom atom , IAtomContainer ac ) { List atoms = ac . getConnectedAtomsList ( atom ) ; IAtomContainer connectedAtoms = atom . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; for ( int i = 0 ; i < atoms . size ( ) ; i ++ ) { IAtom curAtom = ( IAtom ) atoms . ...
Gets the unsetAtomsInAtomContainer attribute of the AtomTetrahedralLigandPlacer3D object .
28,699
public IAtom getPlacedHeavyAtomInAtomContainer ( IAtom atomA , IAtom atomB , IAtomContainer ac ) { List atoms = ac . getConnectedAtomsList ( atomA ) ; IAtom atom = null ; for ( int i = 0 ; i < atoms . size ( ) ; i ++ ) { IAtom curAtom = ( IAtom ) atoms . get ( i ) ; if ( curAtom . getFlag ( CDKConstants . ISPLACED ) &&...
Returns a placed neighbouring atom of a central atom atomA which is not atomB .