idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
27,900
private Edge findDirectionalEdge ( Graph g , int u ) { List < Edge > edges = g . edges ( u ) ; if ( edges . size ( ) == 1 ) return null ; Edge first = null ; for ( Edge e : edges ) { Bond b = e . bond ( ) ; if ( b == Bond . UP || b == Bond . DOWN ) { if ( first == null ) first = e ; else if ( ( ( first . either ( ) == ...
Utility for find the first directional edge incident to a vertex . If there are no directional labels then null is returned .
27,901
private IStereoElement newTetrahedral ( int u , int [ ] vs , IAtom [ ] atoms , Configuration c ) { if ( vs . length != 4 ) { if ( vs . length != 3 ) return null ; vs = insert ( u , vs ) ; } Stereo stereo = c == Configuration . TH1 ? Stereo . ANTI_CLOCKWISE : Stereo . CLOCKWISE ; return new TetrahedralChirality ( atoms ...
Creates a tetrahedral element for the given configuration . Currently only tetrahedral centres with 4 explicit atoms are handled .
27,902
private static int [ ] insert ( int v , int [ ] vs ) { final int n = vs . length ; final int [ ] ws = Arrays . copyOf ( vs , n + 1 ) ; ws [ n ] = v ; for ( int i = n ; i > 0 && ws [ i ] < ws [ i - 1 ] ; i -- ) { int tmp = ws [ i ] ; ws [ i ] = ws [ i - 1 ] ; ws [ i - 1 ] = tmp ; } return ws ; }
Insert the vertex v into sorted position in the array vs .
27,903
private IAtom createAtom ( Element element ) { IAtom atom = builder . newAtom ( ) ; atom . setSymbol ( element . symbol ( ) ) ; atom . setAtomicNumber ( element . atomicNumber ( ) ) ; return atom ; }
Create a new atom for the provided symbol . The atom is created by cloning an existing template . Unfortunately IChemObjectBuilders really show a slow down when SMILES processing .
27,904
public void saturate ( IAtomContainer atomContainer ) throws CDKException { logger . info ( "Saturating atomContainer by adjusting bond orders..." ) ; boolean allSaturated = allSaturated ( atomContainer ) ; if ( ! allSaturated ) { logger . info ( "Saturating bond orders is needed..." ) ; IBond [ ] bonds = new IBond [ a...
Saturates a molecule by setting appropriate bond orders .
27,905
public boolean saturate ( IBond [ ] bonds , IAtomContainer atomContainer ) throws CDKException { logger . debug ( "Saturating bond set of size: " , bonds . length ) ; boolean bondsAreFullySaturated = false ; if ( bonds . length > 0 ) { IBond bond = bonds [ 0 ] ; int leftBondCount = bonds . length - 1 ; IBond [ ] leftBo...
Saturates a set of Bonds in an AtomContainer .
27,906
public boolean saturateByIncreasingBondOrder ( IBond bond , IAtomContainer atomContainer ) throws CDKException { IAtom [ ] atoms = BondManipulator . getAtomArray ( bond ) ; IAtom atom = atoms [ 0 ] ; IAtom partner = atoms [ 1 ] ; logger . debug ( " saturating bond: " , atom . getSymbol ( ) , "-" , partner . getSymbol ...
Tries to saturate a bond by increasing its bond orders by 1 . 0 .
27,907
public boolean couldMatchAtomType ( IAtom atom , double bondOrderSum , IBond . Order maxBondOrder , IAtomType type ) { logger . debug ( "couldMatchAtomType: ... matching atom " , atom , " vs " , type ) ; int hcount = atom . getImplicitHydrogenCount ( ) ; int charge = atom . getFormalCharge ( ) ; if ( charge == type ....
Determines if the atom can be of type AtomType . That is it sees if this AtomType only differs in bond orders or implicit hydrogen count .
27,908
public int calculateNumberOfImplicitHydrogens ( IAtom atom , double bondOrderSum , IBond . Order maxBondOrder , int neighbourCount ) throws CDKException { int missingHydrogens = 0 ; if ( atom instanceof IPseudoAtom ) { logger . debug ( "don't figure it out... it simply does not lack H's" ) ; return 0 ; } logger . debug...
Calculates the number of hydrogens that can be added to the given atom to fullfil the atom s valency . It will return 0 for PseudoAtoms and for atoms for which it does not have an entry in the configuration file .
27,909
public boolean isSaturated ( IAtom atom , IAtomContainer container ) throws CDKException { if ( atom instanceof IPseudoAtom ) { logger . debug ( "don't figure it out... it simply does not lack H's" ) ; return true ; } IAtomType [ ] atomTypes = getAtomTypeFactory ( atom . getBuilder ( ) ) . getAtomTypes ( atom . getSymb...
Checks whether an Atom is saturated by comparing it with known AtomTypes . It returns true if the atom is an PseudoAtom and when the element is not in the list .
27,910
private static boolean familyHalogen ( IAtom atom ) { String symbol = atom . getSymbol ( ) ; if ( symbol . equals ( "F" ) || symbol . equals ( "Cl" ) || symbol . equals ( "Br" ) || symbol . equals ( "I" ) ) return true ; else return false ; }
Looking if the IAtom belongs to the halogen family . The IAtoms are F Cl Br I .
27,911
private static boolean familyBond ( IAtomContainer container , IBond bond ) { List < String > normalAt = new ArrayList < String > ( ) ; normalAt . add ( "C" ) ; normalAt . add ( "H" ) ; if ( getDoubleBondNumber ( container ) > 30 ) return false ; StructureResonanceGenerator gRN = new StructureResonanceGenerator ( ) ; I...
Looking if the Bond belongs to the bond family . Not in resosance with other heteroatoms .
27,912
private static int getDoubleBondNumber ( IAtomContainer container ) { int doubleNumber = 0 ; for ( IBond bond : container . bonds ( ) ) { if ( bond . getOrder ( ) . equals ( IBond . Order . DOUBLE ) || bond . getOrder ( ) . equals ( IBond . Order . TRIPLE ) ) doubleNumber ++ ; } return doubleNumber ; }
Extract the number of bond with superior ordre .
27,913
private static double getDTBondF ( double [ ] resultsH ) { double result = 0.0 ; double SE = resultsH [ 0 ] ; double PE = resultsH [ 1 ] ; double PSC = resultsH [ 2 ] ; double PIC = resultsH [ 3 ] ; double ETP = resultsH [ 4 ] ; double COUNTR = resultsH [ 6 ] ; result = 0.1691 * SE + 1.1536 * PE + - 6.3049 * PSC + - 15...
Get the desicion - tree result for the Halogen family given a series of values . It is based in 6 qsar descriptors .
27,914
private static IAtomContainer initiateIonization ( IAtomContainer container , IAtom atom ) throws CDKException { IReactionProcess reactionNBE = new ElectronImpactNBEReaction ( ) ; IAtomContainerSet setOfReactants = container . getBuilder ( ) . newInstance ( IAtomContainerSet . class ) ; setOfReactants . addAtomContaine...
Initiate the reaction ElectronImpactNBE .
27,915
public Iterable < IReaction > reactions ( ) { return new Iterable < IReaction > ( ) { public Iterator < IReaction > iterator ( ) { return new ReactionIterator ( ) ; } } ; }
Get an iterator for this reaction set .
27,916
private void growReactionArray ( ) { growArraySize = reactions . length ; IReaction [ ] newreactions = new IReaction [ reactions . length + growArraySize ] ; System . arraycopy ( reactions , 0 , newreactions , 0 , reactions . length ) ; reactions = newreactions ; }
Grows the reaction array by a given size .
27,917
public static IAtom [ ] findTerminalAtoms ( IAtomContainer container , IAtom focus ) { List < IBond > focusBonds = container . getConnectedBondsList ( focus ) ; if ( focusBonds . size ( ) != 2 ) throw new IllegalArgumentException ( "focus must have exactly 2 neighbors" ) ; IAtom leftPrev = focus ; IAtom rightPrev = foc...
Helper method to locate two terminal atoms in a container for a given focus .
27,918
public IAtom [ ] findTerminalAtoms ( IAtomContainer container ) { IAtom [ ] atoms = findTerminalAtoms ( container , getFocus ( ) ) ; List < IAtom > carriers = getCarriers ( ) ; if ( container . getBond ( atoms [ 0 ] , carriers . get ( 2 ) ) != null || container . getBond ( atoms [ 0 ] , carriers . get ( 3 ) ) != null )...
Helper method to locate two terminal atoms in a container for this extended tetrahedral element . The atoms are ordered such that the first index is attached to the first two peripheral atoms and the second index is attached to the second two peripheral atoms .
27,919
public void setParameters ( Object [ ] params ) throws CDKException { if ( params . length != 1 ) throw new CDKException ( "One parameter expected" ) ; if ( ! ( params [ 0 ] instanceof Boolean ) ) throw new CDKException ( "Boolean parameter expected" ) ; addlp = ( Boolean ) params [ 0 ] ; }
Sets the parameters attribute of the IPMolecularLearningDescriptor object
27,920
public DescriptorValue calculate ( IAtomContainer atomContainer ) { IAtomContainer local ; if ( addlp ) { try { local = ( IAtomContainer ) atomContainer . clone ( ) ; LonePairElectronChecker lpcheck = new LonePairElectronChecker ( ) ; lpcheck . saturate ( local ) ; } catch ( CloneNotSupportedException e ) { return new ...
It calculates the first ionization energy of a molecule .
27,921
public DescriptorValue calculatePlus ( IAtomContainer container ) throws CDKException { ArrayList < Double > dar = new ArrayList < Double > ( ) ; for ( Iterator < IAtom > itA = container . atoms ( ) . iterator ( ) ; itA . hasNext ( ) ; ) { IAtom atom = itA . next ( ) ; double value = IonizationPotentialTool . predictIP...
It calculates the 1 2 .. ionization energies of a molecule .
27,922
private DoubleArrayResult arrangingEnergy ( ArrayList < Double > array ) { DoubleArrayResult results = new DoubleArrayResult ( ) ; int count = array . size ( ) ; for ( int i = 0 ; i < count ; i ++ ) { double min = array . get ( 0 ) ; int pos = 0 ; for ( int j = 0 ; j < array . size ( ) ; j ++ ) { double value = array ....
put in increasing order the ArrayList
27,923
public boolean compare ( Object object ) { if ( ! ( object instanceof Isotope ) ) { return false ; } if ( ! super . compare ( object ) ) { return false ; } Isotope isotope = ( Isotope ) object ; if ( isotope . getMassNumber ( ) != null && massNumber != null && isotope . getMassNumber ( ) . intValue ( ) != this . getMas...
Compares an isotope with this isotope .
27,924
public DescriptorValue calculate ( IAtomContainer container ) { IAtomContainer local = AtomContainerManipulator . removeHydrogens ( container ) ; int natom = local . getAtomCount ( ) ; int [ ] [ ] admat = AdjacencyMatrix . getMatrix ( local ) ; int [ ] [ ] distmat = PathTools . computeFloydAPSP ( admat ) ; int eccenind...
Calculates the eccentric connectivity
27,925
public static int randomInt ( int lo , int hi ) { return ( Math . abs ( random . nextInt ( ) ) % ( hi - lo + 1 ) ) + lo ; }
Generates a random integer between the specified values .
27,926
private static long nextLong ( Random rng , long n ) { if ( n <= 0 ) throw new IllegalArgumentException ( "n must be greater than 0" ) ; long bits , val ; do { bits = ( rng . nextLong ( ) << 1 ) >>> 1 ; val = bits % n ; } while ( bits - val + ( n - 1 ) < 0L ) ; return val ; }
Access the next long random number between 0 and n .
27,927
public static int markRingAtomsAndBonds ( IAtomContainer mol ) { EdgeToBondMap bonds = EdgeToBondMap . withSpaceFor ( mol ) ; return markRingAtomsAndBonds ( mol , GraphUtil . toAdjList ( mol , bonds ) , bonds ) ; }
Find and mark all cyclic atoms and bonds in the provided molecule .
27,928
public static int markRingAtomsAndBonds ( IAtomContainer mol , int [ ] [ ] adjList , EdgeToBondMap bondMap ) { RingSearch ringSearch = new RingSearch ( mol , adjList ) ; for ( int v = 0 ; v < mol . getAtomCount ( ) ; v ++ ) { mol . getAtom ( v ) . setIsInRing ( false ) ; for ( int w : adjList [ v ] ) { if ( v > w && ri...
Find and mark all cyclic atoms and bonds in the provided molecule . This optimised version allows the caller to optionally provided indexed fast access structure which would otherwise be created .
27,929
public static Cycles all ( IAtomContainer container , int length ) throws Intractable { return all ( ) . find ( container , length ) ; }
All cycles of smaller than or equal to the specified length .
27,930
private static int [ ] lift ( int [ ] path , int [ ] mapping ) { for ( int i = 0 ; i < path . length ; i ++ ) { path [ i ] = mapping [ path [ i ] ] ; } return path ; }
Internal - lifts a path in a subgraph back to the original graph .
27,931
private static IRingSet toRingSet ( IAtomContainer container , int [ ] [ ] cycles , EdgeToBondMap bondMap ) { IChemObjectBuilder builder = container . getBuilder ( ) ; IRingSet rings = builder . newInstance ( IRingSet . class ) ; for ( int [ ] cycle : cycles ) { rings . addAtomContainer ( toRing ( container , cycle , b...
Internal - convert a set of cycles to an ring set .
27,932
private static IRing toRing ( IAtomContainer container , int [ ] cycle , EdgeToBondMap bondMap ) { IAtom [ ] atoms = new IAtom [ cycle . length - 1 ] ; IBond [ ] bonds = new IBond [ cycle . length - 1 ] ; for ( int i = 1 ; i < cycle . length ; i ++ ) { int v = cycle [ i ] ; int u = cycle [ i - 1 ] ; atoms [ i - 1 ] = c...
Internal - convert a set of cycles to a ring .
27,933
private static IBond getBond ( IAtomContainer container , EdgeToBondMap bondMap , int u , int v ) { if ( bondMap != null ) return bondMap . get ( u , v ) ; return container . getBond ( container . getAtom ( u ) , container . getAtom ( v ) ) ; }
Obtain the bond between the atoms at index u and v . If the bondMap is non - null it is used for direct lookup otherwise the slower linear lookup in container is used .
27,934
public List < IAtomType > readAtomTypes ( IChemObjectBuilder builder ) throws IOException { List < IAtomType > atomTypes = new ArrayList < IAtomType > ( ) ; if ( ins == null ) { ins = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( configFile ) ; } if ( ins == null ) throw new IOException ( "There was ...
Reads a text based configuration file .
27,935
public static List < IChemObject > getAllChemObjects ( IAtomContainerSet set ) { ArrayList < IChemObject > list = new ArrayList < IChemObject > ( ) ; list . add ( set ) ; for ( IAtomContainer atomContainer : set . atomContainers ( ) ) { list . add ( atomContainer ) ; } return list ; }
Does not recursively return the contents of the AtomContainer .
27,936
public DescriptorValue calculate ( IAtom first , IAtom second , IAtomContainer atomContainer ) { IAtomContainer ac ; try { ac = ( IAtomContainer ) atomContainer . clone ( ) ; } catch ( CloneNotSupportedException e ) { return getDummyDescriptorValue ( e ) ; } IAtom clonedFirst = ac . getAtom ( atomContainer . indexOf ( ...
The method returns if two atoms have pi - contact .
27,937
private boolean isANeighboorsInAnAtomContainer ( List < IAtom > neighs , IAtomContainer ac ) { boolean isIn = false ; int count = 0 ; for ( IAtom neigh : neighs ) { if ( ac . contains ( neigh ) ) { count += 1 ; } } if ( count > 0 ) { isIn = true ; } return isIn ; }
Gets if neighbours of an atom are in an atom container .
27,938
public void initializeGrid ( double value ) { for ( int i = 0 ; i < grid . length ; i ++ ) { for ( int j = 0 ; j < grid [ 0 ] . length ; j ++ ) { for ( int k = 0 ; k < grid [ 0 ] [ 0 ] . length ; k ++ ) { grid [ k ] [ j ] [ i ] = value ; } } } }
Method initialise the given grid points with a value .
27,939
public double [ ] gridToGridArray ( double [ ] [ ] [ ] grid ) { if ( grid == null ) { grid = this . grid ; } gridArray = new double [ dim [ 0 ] * dim [ 1 ] * dim [ 2 ] + 3 ] ; int dimCounter = 0 ; for ( int z = 0 ; z < grid [ 0 ] [ 0 ] . length ; z ++ ) { for ( int y = 0 ; y < grid [ 0 ] . length ; y ++ ) { for ( int x...
Method transforms the grid to an array .
27,940
public Point3d getCoordinatesFromGridPoint ( Point3d gridPoint ) { double dx = minx + latticeConstant * gridPoint . x ; double dy = miny + latticeConstant * gridPoint . y ; double dz = minz + latticeConstant * gridPoint . z ; return new Point3d ( dx , dy , dz ) ; }
Method calculates coordinates from a given grid point .
27,941
public Point3d getCoordinatesFromGridPoint ( int gridPoint ) { int dimCounter = 0 ; Point3d point = new Point3d ( 0 , 0 , 0 ) ; for ( int z = 0 ; z < grid [ 0 ] [ 0 ] . length ; z ++ ) { for ( int y = 0 ; y < grid [ 0 ] . length ; y ++ ) { for ( int x = 0 ; x < grid . length ; x ++ ) { if ( dimCounter == gridPoint ) { ...
Method calculates coordinates from a given grid array position .
27,942
public Point3d getGridPointFrom3dCoordinates ( Point3d coord ) throws Exception { Point3d gridPoint = new Point3d ( ) ; if ( coord . x >= minx & coord . x <= maxx ) { gridPoint . x = ( int ) Math . round ( Math . abs ( minx - coord . x ) / latticeConstant ) ; } else { throw new Exception ( "CDKGridError: Given coordina...
Method calculates the nearest grid point from given coordinates .
27,943
public void writeGridInPmeshFormat ( String outPutFileName ) throws IOException { BufferedWriter writer = new BufferedWriter ( new FileWriter ( outPutFileName + ".pmesh" ) ) ; int numberOfGridPoints = grid . length * grid [ 0 ] . length * grid [ 0 ] [ 0 ] . length ; writer . write ( numberOfGridPoints + "\n" ) ; for ( ...
Method transforms the grid into pmesh format .
27,944
public StereoEncoder create ( IAtomContainer container , int [ ] [ ] graph ) { int n = container . getAtomCount ( ) ; List < StereoEncoder > encoders = new ArrayList < StereoEncoder > ( ) ; Map < IAtom , Integer > elevation = new HashMap < IAtom , Integer > ( 10 ) ; ATOMS : for ( int i = 0 ; i < n ; i ++ ) { int degree...
Create a stereo encoder for all potential 2D and 3D tetrahedral elements .
27,945
private static GeometricParity geometric ( Map < IAtom , Integer > elevationMap , List < IBond > bonds , int i , int [ ] adjacent , IAtomContainer container ) { int nStereoBonds = nStereoBonds ( bonds ) ; if ( nStereoBonds > 0 ) return geometric2D ( elevationMap , bonds , i , adjacent , container ) ; else if ( nStereoB...
Create the geometric part of an encoder
27,946
private static GeometricParity geometric2D ( Map < IAtom , Integer > elevationMap , List < IBond > bonds , int i , int [ ] adjacent , IAtomContainer container ) { IAtom atom = container . getAtom ( i ) ; makeElevationMap ( atom , bonds , elevationMap ) ; Point2d [ ] coordinates = new Point2d [ 4 ] ; int [ ] elevations ...
Create the geometric part of an encoder of 2D configurations
27,947
private static GeometricParity geometric3D ( int i , int [ ] adjacent , IAtomContainer container ) { IAtom atom = container . getAtom ( i ) ; Point3d [ ] coordinates = new Point3d [ 4 ] ; if ( atom . getPoint3d ( ) != null ) coordinates [ 3 ] = atom . getPoint3d ( ) ; else return null ; for ( int j = 0 ; j < adjacent ....
Create the geometric part of an encoder of 3D configurations
27,948
private static int nStereoBonds ( List < IBond > bonds ) { int count = 0 ; for ( IBond bond : bonds ) { IBond . Stereo stereo = bond . getStereo ( ) ; switch ( stereo ) { case E_OR_Z : case UP_OR_DOWN : case UP_OR_DOWN_INVERTED : return - 1 ; case UP : case DOWN : case UP_INVERTED : case DOWN_INVERTED : count ++ ; brea...
access the number of stereo bonds in the provided bond list .
27,949
private static void makeElevationMap ( IAtom atom , List < IBond > bonds , Map < IAtom , Integer > map ) { map . clear ( ) ; for ( IBond bond : bonds ) { int elevation = 0 ; switch ( bond . getStereo ( ) ) { case UP : case DOWN_INVERTED : elevation = + 1 ; break ; case DOWN : case UP_INVERTED : elevation = - 1 ; break ...
Maps the input bonds to a map of Atom - > Elevation where the elevation is whether the bond is off the plane with respect to the central atom .
27,950
private static String [ ] readSMARTSPattern ( String filename ) throws Exception { InputStream ins = StandardSubstructureSets . class . getClassLoader ( ) . getResourceAsStream ( filename ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( ins ) ) ; List < String > tmp = new ArrayList < String > ( ...
Load a list of SMARTS patterns from the specified file .
27,951
protected String getBondSymbol ( IBond bond ) { String bondSymbol = "" ; if ( bond . getOrder ( ) == IBond . Order . SINGLE ) { if ( isSP2Bond ( bond ) ) { bondSymbol = ":" ; } else { bondSymbol = "-" ; } } else if ( bond . getOrder ( ) == IBond . Order . DOUBLE ) { if ( isSP2Bond ( bond ) ) { bondSymbol = ":" ; } else...
Gets the bond Symbol attribute of the Fingerprinter class .
27,952
private boolean isSP2Bond ( IBond bond ) { return bond . getAtomCount ( ) == 2 && bond . getBegin ( ) . getHybridization ( ) == Hybridization . SP2 && bond . getEnd ( ) . getHybridization ( ) == Hybridization . SP2 ; }
Returns true if the bond binds two atoms and both atoms are SP2 .
27,953
public Iterable < IMapping > mappings ( ) { return new Iterable < IMapping > ( ) { public Iterator < IMapping > iterator ( ) { return new MappingIterator ( ) ; } } ; }
Returns the mappings between the reactant and the product side .
27,954
public void addProduct ( IAtomContainer product , Double coefficient ) { products . addAtomContainer ( product , coefficient ) ; }
Adds a product to this reaction .
27,955
public boolean setReactantCoefficient ( IAtomContainer reactant , Double coefficient ) { boolean result = reactants . setMultiplier ( reactant , coefficient ) ; return result ; }
Sets the coefficient of a a reactant to a given value .
27,956
public boolean setProductCoefficient ( IAtomContainer product , Double coefficient ) { boolean result = products . setMultiplier ( product , coefficient ) ; return result ; }
Sets the coefficient of a a product to a given value .
27,957
private void bondAtom ( IAtomContainer container , IAtom atom ) { double myCovalentRadius = atom . getCovalentRadius ( ) ; double searchRadius = myCovalentRadius + maxCovalentRadius + bondTolerance ; Point tupleAtom = new Point ( atom . getPoint3d ( ) . x , atom . getPoint3d ( ) . y , atom . getPoint3d ( ) . z ) ; for ...
Rebonds one atom by looking up nearby atom using the binary space partition tree .
27,958
private boolean isBonded ( double covalentRadiusA , double covalentRadiusB , double distance2 ) { double maxAcceptable = covalentRadiusA + covalentRadiusB + bondTolerance ; double maxAcceptable2 = maxAcceptable * maxAcceptable ; double minBondDistance2 = this . minBondDistance * this . minBondDistance ; if ( distance2 ...
Returns the bond order for the bond . At this moment it only returns 0 or 1 but not 2 or 3 or aromatic bond order .
27,959
private static boolean isHueckelValid ( IAtomContainer singleRing ) throws CDKException { int electronCount = 0 ; for ( IAtom ringAtom : singleRing . atoms ( ) ) { if ( ringAtom . getHybridization ( ) != CDKConstants . UNSET && ( ringAtom . getHybridization ( ) == Hybridization . SP2 ) || ringAtom . getHybridization ( ...
Tests if the electron count matches the H&uuml ; ckel 4n + 2 rule .
27,960
public void setHighlightedAtom ( IAtom highlightedAtom ) { if ( ( this . highlightedAtom != null ) || ( highlightedAtom != null ) ) { this . highlightedAtom = highlightedAtom ; fireChange ( ) ; } }
Sets the atom currently highlighted .
27,961
public void setHighlightedBond ( IBond highlightedBond ) { if ( ( this . highlightedBond != null ) || ( highlightedBond != null ) ) { this . highlightedBond = highlightedBond ; fireChange ( ) ; } }
Sets the Bond currently highlighted .
27,962
public void addCDKChangeListener ( ICDKChangeListener listener ) { if ( listeners == null ) { listeners = new ArrayList < ICDKChangeListener > ( ) ; } if ( ! listeners . contains ( listener ) ) { listeners . add ( listener ) ; } }
Adds a change listener to the list of listeners .
27,963
public void fireChange ( ) { if ( getNotification ( ) && listeners != null ) { EventObject event = new EventObject ( this ) ; for ( int i = 0 ; i < listeners . size ( ) ; i ++ ) { listeners . get ( i ) . stateChanged ( event ) ; } } }
Notifies registered listeners of certain changes that have occurred in this model .
27,964
public String getToolTipText ( IAtom atom ) { if ( toolTipTextMap . get ( atom ) != null ) { return toolTipTextMap . get ( atom ) ; } else { return null ; } }
Gets the toolTipText for atom certain atom .
27,965
public List getAngleData ( String angleType , String id1 , String id2 , String id3 ) throws Exception { String akey = "" ; if ( pSet . containsKey ( ( "angle" + angleType + ";" + id1 + ";" + id2 + ";" + id3 ) ) ) { akey = "angle" + angleType + ";" + id1 + ";" + id2 + ";" + id3 ; } else if ( pSet . containsKey ( ( "angl...
Gets the angle parameter set .
27,966
private int getNearestBondtoAGivenAtom ( IAtomContainer mol , IAtom atom , IBond bond ) { int nearestBond = 0 ; double [ ] values ; double distance = 0 ; IAtom atom0 = bond . getBegin ( ) ; List < IBond > bondsAtLeft = mol . getConnectedBondsList ( atom0 ) ; int partial ; for ( int i = 0 ; i < bondsAtLeft . size ( ) ; ...
this method returns a bond bonded to this double bond
27,967
private static IAtom getOtherAtom ( IAtomContainer mol , IAtom atom , IAtom other ) { List < IBond > bonds = mol . getConnectedBondsList ( atom ) ; if ( bonds . size ( ) != 2 ) return null ; if ( bonds . get ( 0 ) . contains ( other ) ) return bonds . get ( 1 ) . getOrder ( ) == IBond . Order . DOUBLE ? bonds . get ( 1...
internal find a neighbor connected to atom that is not other
27,968
public boolean effectiveCharges ( IAtomContainer mol ) { int [ ] [ ] adjList = mol . getProperty ( MMFF_ADJLIST_CACHE ) ; GraphUtil . EdgeToBondMap edgeMap = mol . getProperty ( MMFF_EDGEMAP_CACHE ) ; if ( adjList == null || edgeMap == null ) throw new IllegalArgumentException ( "Invoke assignAtomTypes first." ) ; prim...
Assign the effective formal charges used by MMFF in calculating the final partial charge values . Atom types must be assigned first . All existing charges are cleared .
27,969
public boolean partialCharges ( IAtomContainer mol ) { int [ ] [ ] adjList = mol . getProperty ( MMFF_ADJLIST_CACHE ) ; GraphUtil . EdgeToBondMap edgeMap = mol . getProperty ( MMFF_EDGEMAP_CACHE ) ; if ( adjList == null || edgeMap == null ) throw new IllegalArgumentException ( "Invoke assignAtomTypes first." ) ; effect...
Assign the partial charges all existing charges are cleared . Atom types must be assigned first .
27,970
public void clearProps ( IAtomContainer mol ) { mol . removeProperty ( MMFF_EDGEMAP_CACHE ) ; mol . removeProperty ( MMFF_ADJLIST_CACHE ) ; for ( IBond bond : mol . bonds ( ) ) bond . removeProperty ( MMFF_AROM ) ; }
Clear all transient properties assigned by this class . Assigned charges and atom type names remain set .
27,971
void effectiveCharges ( IAtomContainer mol , int [ ] [ ] adjList ) { double [ ] tmp = new double [ mol . getAtomCount ( ) ] ; for ( int v = 0 ; v < tmp . length ; v ++ ) { IAtom atom = mol . getAtom ( v ) ; int intType = mmffParamSet . intType ( atom . getAtomTypeName ( ) ) ; if ( intType == 0 ) { continue ; } int crd ...
Internal effective charges method .
27,972
private Set < IChemObject > getAromatics ( IAtomContainer mol ) { Set < IChemObject > oldArom = new HashSet < > ( ) ; for ( IAtom atom : mol . atoms ( ) ) if ( atom . getFlag ( CDKConstants . ISAROMATIC ) ) oldArom . add ( atom ) ; for ( IBond bond : mol . bonds ( ) ) if ( bond . getFlag ( CDKConstants . ISAROMATIC ) )...
Helper method to find all existing aromatic chem objects .
27,973
private void setAtomTypes ( IChemObjectBuilder builder ) throws Exception { String name = "" ; String rootType = "" ; int an = 0 ; int rl = 255 ; int gl = 20 ; int bl = 147 ; int maxbond = 0 ; double mass = 0.0 ; st . nextToken ( ) ; String sid = st . nextToken ( ) ; rootType = st . nextToken ( ) ; name = st . nextToke...
Read and stores the atom types in a vector
27,974
private void setvdWaals ( ) throws Exception { List data = new Vector ( ) ; st . nextToken ( ) ; String sid = st . nextToken ( ) ; String sradius = st . nextToken ( ) ; String sepsi = st . nextToken ( ) ; try { double epsi = new Double ( sepsi ) . doubleValue ( ) ; double radius = new Double ( sradius ) . doubleValue (...
Read vdw radius stored into the parameter set
27,975
private void setOpBend ( ) throws Exception { List data = new Vector ( ) ; st . nextToken ( ) ; String sid1 = st . nextToken ( ) ; String sid2 = st . nextToken ( ) ; String value1 = st . nextToken ( ) ; try { double va1 = new Double ( value1 ) . doubleValue ( ) ; data . add ( new Double ( va1 ) ) ; key = "opbend" + sid...
Sets the opBend attribute stored into the parameter set
27,976
private void setDipole ( ) throws Exception { List data = new Vector ( ) ; st . nextToken ( ) ; String sid1 = st . nextToken ( ) ; String sid2 = st . nextToken ( ) ; String value1 = st . nextToken ( ) ; String value2 = st . nextToken ( ) ; try { double va1 = new Double ( value1 ) . doubleValue ( ) ; double va2 = new Do...
Sets the dipole attribute stored into the parameter set
27,977
private Integer massNumber ( int atomicNumber , double exactMass ) throws IOException { String symbol = PeriodicTable . getSymbol ( atomicNumber ) ; IIsotope isotope = Isotopes . getInstance ( ) . getIsotope ( symbol , exactMass , 0.001 ) ; return isotope != null ? isotope . getMassNumber ( ) : null ; }
Mass number for a atom with a given atomic number and exact mass .
27,978
public static MarkedElement markup ( IRenderingElement elem , String ... classes ) { assert elem != null ; MarkedElement tagElem = new MarkedElement ( elem ) ; for ( String cls : classes ) tagElem . aggClass ( cls ) ; return tagElem ; }
Markup a rendering element with the specified classes .
27,979
private void setForceField ( String ffname , IChemObjectBuilder builder ) throws CDKException { if ( ffname == null ) { ffname = "mm2" ; } try { forceFieldName = ffname ; ffc . setForceFieldConfigurator ( ffname , builder ) ; parameterSet = ffc . getParameterSet ( ) ; } catch ( CDKException ex1 ) { logger . error ( "Pr...
Sets the forceField attribute of the ModelBuilder3D object .
27,980
private IRingSet getRingSetOfAtom ( List ringSystems , IAtom atom ) { IRingSet ringSetOfAtom = null ; for ( int i = 0 ; i < ringSystems . size ( ) ; i ++ ) { if ( ( ( IRingSet ) ringSystems . get ( i ) ) . contains ( atom ) ) { return ( IRingSet ) ringSystems . get ( i ) ; } } return ringSetOfAtom ; }
Gets the ringSetOfAtom attribute of the ModelBuilder3D object .
27,981
private void layoutMolecule ( List ringSetMolecule , IAtomContainer molecule , AtomPlacer3D ap3d , AtomTetrahedralLigandPlacer3D atlp3d , AtomPlacer atomPlacer ) throws CDKException , IOException , CloneNotSupportedException { IAtomContainer ac = null ; int safetyCounter = 0 ; IAtom atom = null ; do { safetyCounter ++ ...
Layout the molecule starts with ring systems and than aliphatic chains .
27,982
private void setBranchAtom ( IAtomContainer molecule , IAtom unplacedAtom , IAtom atomA , IAtomContainer atomNeighbours , AtomPlacer3D ap3d , AtomTetrahedralLigandPlacer3D atlp3d ) throws CDKException { IAtomContainer noCoords = molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; noCoords . addAtom ( u...
Sets a branch atom to a ring or aliphatic chain .
27,983
private void searchAndPlaceBranches ( IAtomContainer molecule , IAtomContainer chain , AtomPlacer3D ap3d , AtomTetrahedralLigandPlacer3D atlp3d , AtomPlacer atomPlacer ) throws CDKException { List atoms = null ; IAtomContainer branchAtoms = molecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtomConta...
Search and place branches of a chain or ring .
27,984
private void placeLinearChains3D ( IAtomContainer molecule , IAtomContainer startAtoms , AtomPlacer3D ap3d , AtomTetrahedralLigandPlacer3D atlp3d , AtomPlacer atomPlacer ) throws CDKException { IAtom dihPlacedAtom = null ; IAtom thirdPlacedAtom = null ; IAtomContainer longestUnplacedChain = molecule . getBuilder ( ) . ...
Layout all aliphatic chains with ZMatrix .
27,985
private void translateStructure ( Point3d originalCoord , Point3d newCoord , IAtomContainer ac ) { Point3d transVector = new Point3d ( originalCoord ) ; transVector . sub ( newCoord ) ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { if ( ! ( ac . getAtom ( i ) . getFlag ( CDKConstants . ISPLACED ) ) ) { ac . ge...
Translates the template ring system to new coordinates .
27,986
private void setAtomsToPlace ( IAtomContainer ac ) { for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) { ac . getAtom ( i ) . setFlag ( CDKConstants . ISPLACED , true ) ; } }
Sets the atomsToPlace attribute of the ModelBuilder3D object .
27,987
private void setAtomsToUnPlaced ( IAtomContainer molecule ) { for ( int i = 0 ; i < molecule . getAtomCount ( ) ; i ++ ) { molecule . getAtom ( i ) . setFlag ( CDKConstants . ISPLACED , false ) ; } }
Sets the atomsToUnPlaced attribute of the ModelBuilder3D object .
27,988
private void setAtomsToUnVisited ( IAtomContainer molecule ) { for ( int i = 0 ; i < molecule . getAtomCount ( ) ; i ++ ) { molecule . getAtom ( i ) . setFlag ( CDKConstants . VISITED , false ) ; } }
Sets the atomsToUnVisited attribute of the ModelBuilder3D object .
27,989
public static IAtomContainer makeDeepCopy ( IAtomContainer container ) { IAtomContainer newAtomContainer = container . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; IAtom [ ] atoms = copyAtoms ( container , newAtomContainer ) ; copyBonds ( atoms , container , newAtomContainer ) ; for ( int index = 0 ; index...
Retrurns deep copy of the molecule
27,990
public static int getExplicitHydrogenCount ( IAtomContainer atomContainer , IAtom atom ) { int hCount = 0 ; for ( IAtom iAtom : atomContainer . getConnectedAtomsList ( atom ) ) { IAtom connectedAtom = iAtom ; if ( connectedAtom . getSymbol ( ) . equals ( "H" ) ) { hCount ++ ; } } return hCount ; }
Returns The number of explicit hydrogens for a given IAtom .
27,991
public static int getHydrogenCount ( IAtomContainer atomContainer , IAtom atom ) { return getExplicitHydrogenCount ( atomContainer , atom ) + getImplicitHydrogenCount ( atom ) ; }
The summed implicit + explicit hydrogens of the given IAtom .
27,992
@ SuppressWarnings ( "unchecked" ) public < T > T getValue ( SgroupKey key ) { return ( T ) attributes . get ( key ) ; }
Access an attribute for the Sgroup .
27,993
public final void addBracket ( SgroupBracket bracket ) { List < SgroupBracket > brackets = getValue ( SgroupKey . CtabBracket ) ; if ( brackets == null ) { putValue ( SgroupKey . CtabBracket , brackets = new ArrayList < > ( 2 ) ) ; } brackets . add ( bracket ) ; }
Add a bracket for this Sgroup .
27,994
public Rectangle calculateScreenBounds ( Rectangle2D modelBounds ) { double scale = rendererModel . getParameter ( Scale . class ) . getValue ( ) ; double zoom = rendererModel . getParameter ( ZoomFactor . class ) . getValue ( ) ; double margin = rendererModel . getParameter ( Margin . class ) . getValue ( ) ; Point2d ...
Converts a bounding rectangle in model space into the equivalent bounds in screen space . Used to determine how much space the model will take up on screen given a particular scale zoom and margin .
27,995
public Point2d toModelCoordinates ( double screenX , double screenY ) { try { double [ ] dest = new double [ 2 ] ; double [ ] src = new double [ ] { screenX , screenY } ; transform . inverseTransform ( src , 0 , dest , 0 , 1 ) ; return new Point2d ( dest [ 0 ] , dest [ 1 ] ) ; } catch ( NoninvertibleTransformException ...
Convert a point in screen space into a point in model space .
27,996
public Point2d toScreenCoordinates ( double modelX , double modelY ) { double [ ] dest = new double [ 2 ] ; transform . transform ( new double [ ] { modelX , modelY } , 0 , dest , 0 , 1 ) ; return new Point2d ( dest [ 0 ] , dest [ 1 ] ) ; }
Convert a point in model space into a point in screen space .
27,997
public void shiftDrawCenter ( double shiftX , double shiftY ) { drawCenter . set ( drawCenter . x + shiftX , drawCenter . y + shiftY ) ; setup ( ) ; }
Move the draw center by dx and dy .
27,998
public void setZoomToFit ( double drawWidth , double drawHeight , double diagramWidth , double diagramHeight ) { double margin = rendererModel . getParameter ( Margin . class ) . getValue ( ) ; double widthRatio = drawWidth / ( diagramWidth + ( 2 * margin ) ) ; double heightRatio = drawHeight / ( diagramHeight + ( 2 * ...
Calculate and set the zoom factor needed to completely fit the diagram onto the screen bounds .
27,999
protected void paint ( IDrawVisitor drawVisitor , IRenderingElement diagram ) { if ( diagram == null ) return ; this . cachedDiagram = diagram ; fontManager . setFontName ( rendererModel . getParameter ( FontName . class ) . getValue ( ) ) ; fontManager . setFontStyle ( rendererModel . getParameter ( UsedFontStyle . cl...
The target method for paintChemModel paintReaction and paintMolecule .