Permalink
Browse files

Merged branch cdk-1.4.x

  • Loading branch information...
2 parents 98f16f8 + dd7db22 commit 409733e2c8383f080f2c01f8909e2dc9c2452ab8 @egonw egonw committed Aug 21, 2011
View
@@ -11,6 +11,8 @@ Martin Eklund
Matteo Floris
Dan Gezelter
Uli Fechner
+Thorsten Flügel
+Nimish Gopal
Rajarshi Guha
Yonquan Han
Thierry Hanser
@@ -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();
@@ -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) {
@@ -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())) {
@@ -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 {
@@ -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
@@ -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;
@@ -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"/>
@@ -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"/>
Oops, something went wrong.

0 comments on commit 409733e

Please sign in to comment.