Skip to content

Instantly share code, notes, and snippets.

void plot_line(GraphPoint[] line, int m, int c) {
Point next = new Point(0, c);
while (next.x < line.length) {
line[next.x] = new GraphPoint(next, graphpoint.crosshair);
next.x += 1;
next.y += m;
}
}
public class AtomTests {
public final static IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
@Test
public void one_four_cyclohexadiene() throws InvalidSmilesException {
String acpString = "C0C1C2C3C4C5 0:1(2),0:5(1),1:2(1),2:3(1),3:4(2),4:5(1)";
IAtomContainer cyclohexadiene = AtomContainerPrinter.fromString(acpString, builder);
AtomDiscretePartitionRefiner refiner = new AtomDiscretePartitionRefiner();
PermutationGroup aut = refiner.getAutomorphismGroup(cyclohexadiene);
import java.util.ArrayList;
import java.util.List;
public class Atom {
public Atom(String element) {
this.element = element;
}
public String element;
@gilleain
gilleain / patch.bsh
Created July 21, 2011 14:03
bsh script
import org.openscience.cdk.Molecule;
import org.openscience.cdk.io.CDKSourceCodeWriter;
import org.openscience.cdk.io.MDLReader;
import org.eclipse.jgit.api.*;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.storage.file.*;
element = bsh.args[0];
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = builder.readEnvironment().findGitDir().build();
@gilleain
gilleain / patch.sh
Created July 21, 2011 14:03
shell script
for e in Ag Au
do
echo "Checking out $e"
git checkout $e
git reset --soft HEAD~1
java -cp ~/jgit/org.eclipse.jgit-1.0.0.201106090707-r.jar bsh.Interpreter patcher.bsh $e
git add src/
git commit -m "$e final"
git checkout master
done
@gilleain
gilleain / RingPlateGenerator_2.java
Created June 13, 2011 21:58
Altered version of the ring fill generator for equivalence classes
package customgenerator;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Point2d;
import javax.vecmath.Vector2d;
import org.openscience.cdk.geometry.GeometryTools;
@gilleain
gilleain / RingPlateGenerator.java
Created June 12, 2011 20:47
Ring fill generator for CDK
package customgenerator;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Point2d;
import javax.vecmath.Vector2d;
import org.openscience.cdk.geometry.GeometryTools;
@gilleain
gilleain / drawMolecule.java
Created June 12, 2011 20:46
A method to draw molecules with CDK
public void drawMolecule(IMolecule molecule, String name) throws Exception {
// layout the molecule
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setMolecule(molecule, false);
sdg.generateCoordinates();
// make generators
List<IGenerator<IAtomContainer>> generators = new ArrayList<IGenerator<IAtomContainer>>();
generators.add(new BasicSceneGenerator());
From 5a86e14eef2b516dab2c4e369376d76bb6dfdd7b Mon Sep 17 00:00:00 2001
From: maclean <gilleain.torrance@gmail.com>
Date: Wed, 30 Mar 2011 07:59:03 +0100
Subject: [PATCH] Use IAtomContainer instead of AtomContainer in AtomContainerSet
---
src/main/org/openscience/cdk/AtomContainerSet.java | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/org/openscience/cdk/AtomContainerSet.java b/src/main/org/openscience/cdk/AtomContainerSet.java
@gilleain
gilleain / stacktrace.txt
Created March 28, 2011 14:01
stacktrace of ant error
Caused by: java.lang.NullPointerException
[java] at net.sf.cdk.tools.MakeJavafilesFiles.readBlackList(MakeJavafilesFiles.java:79)
[java] at net.sf.cdk.tools.MakeJavafilesFiles.<init>(MakeJavafilesFiles.java:66)
[java] at net.sf.cdk.tools.MakeJavafilesFiles.main(MakeJavafilesFiles.java:241)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)