Skip to content

Commit

Permalink
Merged branch cdk-1.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Aug 21, 2011
2 parents 98f16f8 + dd7db22 commit 409733e
Show file tree
Hide file tree
Showing 7 changed files with 726 additions and 47 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Expand Up @@ -11,6 +11,8 @@ Martin Eklund
Matteo Floris
Dan Gezelter
Uli Fechner
Thorsten Flügel
Nimish Gopal
Rajarshi Guha
Yonquan Han
Thierry Hanser
Expand Down
5 changes: 3 additions & 2 deletions src/main/net/sf/cdk/tools/doclets/CDKGitTaglet.java
Expand Up @@ -95,8 +95,9 @@ public String toString(Tag[] tags) {
}

private String expand(Tag tag) {
// get the version number
String text = tag.text();
// Tag only returns the file name, not the path (anymore)
if (true)
return "<a href=\"https://github.com/cdk/cdk/tree/cdk-1.4.x/src/main/org/openscience/cdk\" target=\"_blank\">cdk-1.4.x</a>";

// create the URL
SourcePosition file = tag.position();
Expand Down
3 changes: 1 addition & 2 deletions src/main/net/sf/cdk/tools/doclets/CDKModuleTaglet.java
Expand Up @@ -73,8 +73,7 @@ public static void register(Map<String, CDKModuleTaglet> tagletMap) {

public String toString(Tag tag) {
return "<DT><B>Belongs to CDK module: </B><DD>"
+ "<a href=\"http://pele.farmbio.uu.se/nightly-1.2.x/modules/" + tag.text() + ".html"
+ tag.text() + "/\">" + tag.text() + "</a></DD>\n";
+ tag.text() + "</DD>\n";
}

public String toString(Tag[] tags) {
Expand Down
161 changes: 142 additions & 19 deletions src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
Expand Up @@ -141,6 +141,10 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
type = perceiveGallium(atomContainer, atom);
} else if ("Ge".equals(atom.getSymbol())) {
type = perceiveGermanium(atomContainer, atom);
} else if ("Hg".equals(atom.getSymbol())) {
type = perceiveMercury(atomContainer, atom);
} else if ("Fe".equals(atom.getSymbol())) {
type = perceiveIron(atomContainer, atom);
} else if ("Ra".equals(atom.getSymbol())) {
type = perceiveRadium(atomContainer, atom);
} else if ("Au".equals(atom.getSymbol())) {
Expand Down Expand Up @@ -849,6 +853,143 @@ private int countExplicitHydrogens(IAtom atom, IAtomContainer atomContainer) {
}
return count;
}

private IAtomType perceiveIron(IAtomContainer atomContainer, IAtom atom) throws CDKException {
if ("Fe".equals(atom.getSymbol())) {
if (hasOneSingleElectron(atomContainer, atom)) {
// no idea how to deal with this yet
return null;
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == 0)) {
IAtomType type = getAtomType("Fe.metallic");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
int neighbors = atomContainer.getConnectedAtomsCount(atom);
if (neighbors == 2) {
IAtomType type5 = getAtomType("Fe.2");
if (isAcceptable(atom, atomContainer, type5)) {
return type5;
}
} else if (neighbors == 3) {
IAtomType type6 = getAtomType("Fe.3");
if (isAcceptable(atom, atomContainer, type6)) {
return type6;
}
} else if (neighbors == 4) {
IAtomType type7 = getAtomType("Fe.4");
if (isAcceptable(atom, atomContainer, type7)) {
return type7;
}
} else if (neighbors == 5) {
IAtomType type8 = getAtomType("Fe.5");
if (isAcceptable(atom, atomContainer, type8)) {
return type8;
}
} else if (neighbors == 6) {
IAtomType type9 = getAtomType("Fe.6");
if (isAcceptable(atom, atomContainer, type9)) {
return type9;
}
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == 2)) {
int neighbors = atomContainer.getConnectedAtomsCount(atom);
if (neighbors <= 1) {
IAtomType type = getAtomType("Fe.2plus");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == 1)) {
int neighbors = atomContainer.getConnectedAtomsCount(atom);

if (neighbors == 2) {
IAtomType type0 = getAtomType("Fe.plus");
if (isAcceptable(atom, atomContainer, type0)) {
return type0;
}
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == 3)) {
IAtomType type1 = getAtomType("Fe.3plus");
if (isAcceptable(atom, atomContainer, type1)) {
return type1;
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == -2)) {
IAtomType type2 = getAtomType("Fe.2minus");
if (isAcceptable(atom, atomContainer, type2)) {
return type2;
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == -3)) {
IAtomType type3 = getAtomType("Fe.3minus");
if (isAcceptable(atom, atomContainer, type3)) {
return type3;
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == -4)) {
IAtomType type4 = getAtomType("Fe.4minus");
if (isAcceptable(atom, atomContainer, type4)) {
return type4;
}
}
}
return null;
}


private IAtomType perceiveMercury(IAtomContainer atomContainer, IAtom atom) throws CDKException {
if ("Hg".equals(atom.getSymbol())) {
if (hasOneSingleElectron(atomContainer, atom)) {
// no idea how to deal with this yet
return null;
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == -1)) {
IAtomType type = getAtomType("Hg.minus");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == 2)) {
IAtomType type = getAtomType("Hg.2plus");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == +1)) {
int neighbors = atomContainer.getConnectedAtomsCount(atom);
if (neighbors <= 1) {
IAtomType type = getAtomType("Hg.plus");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
}
} else if ((atom.getFormalCharge() != null
&& atom.getFormalCharge() == 0)) {
int neighbors = atomContainer.getConnectedAtomsCount(atom);
if (neighbors == 2) {
IAtomType type = getAtomType("Hg.2");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
} else if (neighbors == 1) {
IAtomType type = getAtomType("Hg.1");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
} else if (neighbors == 0) {
IAtomType type = getAtomType("Hg.metallic");
if (isAcceptable(atom, atomContainer, type)) {
return type;
}
}
}
}
return null;
}

private IAtomType perceiveSulphurs(IAtomContainer atomContainer, IAtom atom)
throws CDKException {
Expand Down Expand Up @@ -1268,15 +1409,6 @@ private IAtomType perceiveCommonSalts(IAtomContainer atomContainer, IAtom atom)
IAtomType type = getAtomType("Mg.2plus");
if (isAcceptable(atom, atomContainer, type)) return type;
}
} else if ("Fe".equals(atom.getSymbol())) {
if (hasOneSingleElectron(atomContainer, atom)) {
// no idea how to deal with this yet
return null;
} else if ((atom.getFormalCharge() != CDKConstants.UNSET &&
atom.getFormalCharge() == +2)) {
IAtomType type = getAtomType("Fe.2plus");
if (isAcceptable(atom, atomContainer, type)) return type;
}
} else if ("Co".equals(atom.getSymbol())) {
if (hasOneSingleElectron(atomContainer, atom)) {
// no idea how to deal with this yet
Expand Down Expand Up @@ -1403,16 +1535,7 @@ private IAtomType perceiveChromium(IAtomContainer atomContainer, IAtom atom) thr
return null;
}
private IAtomType perceiveOrganometallicCenters(IAtomContainer atomContainer, IAtom atom) throws CDKException {
if ("Hg".equals(atom.getSymbol())) {
if (hasOneSingleElectron(atomContainer, atom)) {
// no idea how to deal with this yet
return null;
} else if ((atom.getFormalCharge() != CDKConstants.UNSET &&
atom.getFormalCharge() == -1)) {
IAtomType type = getAtomType("Hg.minus");
if (isAcceptable(atom, atomContainer, type)) return type;
}
} else if ("Po".equals(atom.getSymbol())) {
if ("Po".equals(atom.getSymbol())) {
if (hasOneSingleElectron(atomContainer, atom)) {
// no idea how to deal with this yet
return null;
Expand Down
113 changes: 113 additions & 0 deletions src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl
Expand Up @@ -1284,6 +1284,84 @@
<at:piBondCount>0</at:piBondCount>
</at:AtomType>


<at:AtomType rdf:ID="Fe.metallic">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>0</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.4">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>4</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.plus">
<at:formalCharge>1</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>2</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.3minus">
<at:formalCharge>-3</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>6</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.4minus">
<at:formalCharge>-4</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>6</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.5">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>5</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.6">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>6</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.2minus">
<at:formalCharge>-2</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>6</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.3plus">
<at:formalCharge>3</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>0</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.3">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>3</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Fe.2">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Fe"/>
<at:formalNeighbourCount>2</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Pt.2plus">
<at:formalCharge>2</at:formalCharge>
<at:hasElement rdf:resource="&elem;Pt"/>
Expand Down Expand Up @@ -1435,6 +1513,41 @@
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Hg.2plus">
<at:formalCharge>2</at:formalCharge>
<at:hasElement rdf:resource="&elem;Hg"/>
<at:formalNeighbourCount>0</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Hg.plus">
<at:formalCharge>1</at:formalCharge>
<at:hasElement rdf:resource="&elem;Hg"/>
<at:formalNeighbourCount>1</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Hg.metallic">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Hg"/>
<at:formalNeighbourCount>0</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Hg.2">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Hg"/>
<at:formalNeighbourCount>2</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Hg.1">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Hg"/>
<at:formalNeighbourCount>1</at:formalNeighbourCount>
<at:piBondCount>1</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Hg.minus">
<at:formalCharge>-1</at:formalCharge>
<at:hasElement rdf:resource="&elem;Hg"/>
Expand Down

0 comments on commit 409733e

Please sign in to comment.