Skip to content

Commit 0491f6a

Browse files
Cleaning the AlgorithmicGroupTheory Repository and updating MAVEN files
1 parent 6be38bb commit 0491f6a

File tree

56 files changed

+14131
-7414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+14131
-7414
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
eclipse.preferences.version=1
22
encoding//src/main/java/AlgorithmicGroupTheory/PermutationGroupFunctions.java=UTF-8
3-
encoding//src/test/java/testCanonicalBlockwiseTest.java=UTF-8

hs_err_pid21084.log

Lines changed: 4831 additions & 0 deletions
Large diffs are not rendered by default.

hs_err_pid9244.log

Lines changed: 2114 additions & 0 deletions
Large diffs are not rendered by default.

hs_err_pid9764.log

Lines changed: 4019 additions & 0 deletions
Large diffs are not rendered by default.

nulloutput.sdf

Whitespace-only changes.

pom.xml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
<groupId>AlgorithmicGroupTheory</groupId>
44
<artifactId>AlgorithmicGroupTheory</artifactId>
55
<version>1.0</version>
6-
<name>AlgorithmicGroupTheory</name>
7-
<description>This project is for Algorithmic group theory, especially for orbit calculations.</description>
8-
<packaging>jar</packaging>
9-
<properties>
10-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11-
<maven.compiler.source>1.8</maven.compiler.source>
12-
<maven.compiler.target>1.8</maven.compiler.target>
13-
</properties>
6+
<description>This project is for Algorithmic group theory, especially for implementation in molecular structure generation.</description>
147
<dependencies>
158
<!-- https://mvnrepository.com/artifact/org.junit/junit -->
169
<dependency>
@@ -158,13 +151,13 @@
158151
<archive>
159152
<manifest>
160153
<addClasspath>true</addClasspath>
161-
<mainClass>AlgorithmicGroupTheory/canonicalBlockwiseTest</mainClass>
154+
<mainClass>AlgorithmicGroupTheory/MORGEN</mainClass>
162155
</manifest>
163156
</archive>
164-
<finalName>AlgorithmicGroupTheory</finalName>
157+
<finalName>MORGEN</finalName>
165158
<descriptorRefs>
166159
<descriptorRef>jar-with-dependencies</descriptorRef>
167-
</descriptorRefs>
160+
</descriptorRefs>
168161
</configuration>
169162
</plugin>
170163
</plugins>

src/main/java/AlgorithmicGroupTheory/EnumerationMethods.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/main/java/AlgorithmicGroupTheory/HydrogenDistributor.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@
3535
package AlgorithmicGroupTheory;
3636

3737
import java.io.FileNotFoundException;
38-
import java.io.IOException;
3938
import java.io.UnsupportedEncodingException;
40-
import java.text.DecimalFormat;
4139
import java.util.ArrayList;
4240
import java.util.Arrays;
43-
import java.util.Collections;
44-
import java.util.Comparator;
4541
import java.util.HashMap;
4642
import java.util.LinkedList;
4743
import java.util.List;
@@ -59,7 +55,6 @@
5955
import org.openscience.cdk.interfaces.IAtom;
6056
import org.openscience.cdk.interfaces.IAtomContainer;
6157
import org.openscience.cdk.interfaces.IChemObjectBuilder;
62-
import org.openscience.cdk.interfaces.IIsotope;
6358
import org.openscience.cdk.interfaces.IMolecularFormula;
6459
import org.openscience.cdk.silent.AtomContainer;
6560
import org.openscience.cdk.silent.SilentChemObjectBuilder;
@@ -138,7 +133,7 @@ public static int[] setValues(int[] partition, int[] degrees) {
138133
capacity[i]=(degrees[sum-1]-1)*partition[i];
139134
i++;
140135
}
141-
136+
142137
HydrogenDistributor.capacity=capacity;
143138
HydrogenDistributor.valences=valences;
144139
HydrogenDistributor.totalAtom=totalAtom;

src/main/java/AlgorithmicGroupTheory/MORGEN.java

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
import java.util.Set;
1616
import java.util.stream.IntStream;
1717

18+
import org.apache.commons.cli.CommandLine;
19+
import org.apache.commons.cli.CommandLineParser;
20+
import org.apache.commons.cli.DefaultParser;
21+
import org.apache.commons.cli.HelpFormatter;
22+
import org.apache.commons.cli.Option;
23+
import org.apache.commons.cli.Options;
24+
import org.apache.commons.cli.ParseException;
1825
import org.openscience.cdk.Atom;
1926
import org.openscience.cdk.DefaultChemObjectBuilder;
2027
import org.openscience.cdk.depict.DepictionGenerator;
@@ -273,7 +280,6 @@ public static void initialDegrees(){
273280

274281
public static void build(String mol) throws IOException, CloneNotSupportedException, CDKException {
275282
for(int i=0;i<firstSymbols.size();i++) {
276-
System.out.println(firstSymbols.get(i)+" "+firstOccurrences.get(i));
277283
for(int j=0;j<firstOccurrences.get(i);j++) {
278284
atomContainer.addAtom(new Atom(firstSymbols.get(i)));
279285
}
@@ -737,7 +743,18 @@ public static int[][] forwardSubRow(int lInverse, int cInverse, int maximalX,int
737743
}
738744
//IAtomContainer molden= buildC(addHydrogens(mat2,hIndex));
739745
if(connectivityTest(hIndex,addHydrogens(mat2,hIndex))){
740-
/**pWriter.println("canonical matrix"+" "+count);
746+
/**System.out.println("**************");
747+
for(int s=0;s<10;s++) {
748+
for(int k=0; k<s;k++) {
749+
System.out.print(" ");
750+
}
751+
for(int k=s+1; k<10;k++) {
752+
System.out.print(mat2[s][k]);
753+
}
754+
System.out.println();
755+
}
756+
System.out.println("**************");
757+
pWriter.println("canonical matrix"+" "+count);
741758
for(int s=0;s<6;s++) {
742759
for(int k=0; k<s;k++) {
743760
pWriter.print(" ");
@@ -747,8 +764,8 @@ public static int[][] forwardSubRow(int lInverse, int cInverse, int maximalX,int
747764
}
748765
pWriter.println();
749766
}**/
750-
//IAtomContainer mol= buildC(addHydrogens(mat2,hIndex));
751-
//outFile.write(mol);
767+
IAtomContainer mol= buildC(addHydrogens(mat2,hIndex));
768+
outFile.write(mol);
752769
//depict(mol,filedir+count+".png");
753770
count++;
754771
}
@@ -880,10 +897,8 @@ public static int nextCount(int i, int size, Integer[] degrees, ArrayList<Intege
880897
}
881898
return count;
882899
}
883-
public static void run(String molecularFormula, String filePath) throws IOException, CDKException, CloneNotSupportedException {
900+
public static void run() throws IOException, CDKException, CloneNotSupportedException {
884901
long startTime = System.nanoTime();
885-
formula=molecularFormula;
886-
filedir=filePath;
887902
getSymbolsOccurrences(formula);
888903
initialDegrees();
889904
//initialPartition=occurrences;
@@ -929,24 +944,22 @@ public static List<int[]> distributeHydrogens(ArrayList<Integer> partition, int[
929944
public static void canonicalBlockbasedGeneratorDemo() throws IOException, CloneNotSupportedException, CDKException{
930945
size=initialDegrees.length;
931946
List<int[]> newDegrees= distributeHydrogens(firstOccurrences, firstDegrees);
947+
//System.out.println(initialPartition);
932948
//partitionList.add(0,initialPartition);
933949
/**int[] newDegrees = new int[6];
934950
newDegrees[0]=3;
935951
newDegrees[1]=3;
936952
newDegrees[2]=3;
937953
newDegrees[3]=3;
938954
newDegrees[4]=3;
939-
newDegrees[5]=3;**/
940-
//genStrip(newDegrees);
955+
newDegrees[5]=3;
956+
genStrip(newDegrees);**/
941957
for(int[] degree: newDegrees) {
942958
partitionList.clear();
943959
formerPermutations.clear();
944960
//genDemo(degree);
945961
initialPartition=getPartition(degree,occurrences);
946-
System.out.println(Arrays.toString(degree)+" "+initialPartition);
947-
System.out.println("count"+" "+count);
948962
partitionList.add(0,initialPartition);
949-
System.out.println("hIndex"+" "+hIndex);
950963
genStrip(degree);
951964
}
952965
}
@@ -1507,10 +1520,62 @@ public static ArrayList<Integer> partitionCriteria(ArrayList<Integer> partEx, in
15071520
return partNew;
15081521
}
15091522

1510-
public static void main(String[] args) throws IOException, CDKException, CloneNotSupportedException {
1511-
//FileWriter fWriter = new FileWriter("C:\\Users\\mehme\\Desktop\\No-Backup Zone\\outputs\\output.txt");
1512-
//pWriter = new PrintWriter(fWriter);
1513-
run("C3NO2SH7","C:\\Users\\mehme\\Desktop\\No-Backup Zone\\outputs\\");
1514-
//pWriter.close();
1523+
private void parseArgs(String[] args) throws ParseException, IOException, org.apache.commons.cli.ParseException{
1524+
Options options = setupOptions(args);
1525+
CommandLineParser parser = new DefaultParser();
1526+
try {
1527+
CommandLine cmd = parser.parse(options, args);
1528+
MORGEN.formula = cmd.getOptionValue("formula");
1529+
MORGEN.filedir = cmd.getOptionValue("filedir");
1530+
if (cmd.hasOption("verbose")) MORGEN.verbose = true;
1531+
} catch (ParseException e) {
1532+
HelpFormatter formatter = new HelpFormatter();
1533+
formatter.setOptionComparator(null);
1534+
String header = "\nGenerates molecular structures for a given molecular formula."
1535+
+ " The input is a molecular formula string."
1536+
+ "For example 'C2OH4'."
1537+
+"For this version, the hydrogens should be kept at the end of the string."
1538+
+ "Besides this formula, the directory is needed to be specified for the output"
1539+
+ "file. \n\n";
1540+
String footer = "\nPlease report issues at https://github.com/MehmetAzizYirik/AlgorithmicGroupTheory";
1541+
formatter.printHelp( "java -jar AlgorithmicGroupTheory.jar", header, options, footer, true );
1542+
throw new ParseException("Problem parsing command line");
1543+
}
1544+
}
1545+
1546+
private Options setupOptions(String[] args){
1547+
Options options = new Options();
1548+
Option formula = Option.builder("f")
1549+
.required(true)
1550+
.hasArg()
1551+
.longOpt("formula")
1552+
.desc("formula (required)")
1553+
.build();
1554+
options.addOption(formula);
1555+
Option verbose = Option.builder("v")
1556+
.required(false)
1557+
.longOpt("verbose")
1558+
.desc("print message")
1559+
.build();
1560+
options.addOption(verbose);
1561+
Option filedir = Option.builder("d")
1562+
.required(true)
1563+
.hasArg()
1564+
.longOpt("filedir")
1565+
.desc("Creates and store the output txt file in the directory (required)")
1566+
.build();
1567+
options.addOption(filedir);
1568+
return options;
1569+
}
1570+
1571+
public static void main(String[] arguments) throws IOException, CDKException, CloneNotSupportedException {
1572+
MORGEN gen= new MORGEN();
1573+
//String[] argument= {"-f","C4H8", "-d", "C:\\Users\\mehme\\Desktop\\", "-v"};
1574+
try {
1575+
gen.parseArgs(arguments);
1576+
MORGEN.run();
1577+
} catch (Exception e) {
1578+
if (MORGEN.verbose) e.getCause();
1579+
}
15151580
}
15161581
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package AlgorithmicGroupTheory;
2+
3+
import java.io.IOException;
4+
import java.util.ArrayList;
5+
import java.util.Arrays;
6+
import java.util.List;
7+
8+
import org.openscience.cdk.exception.CDKException;
9+
10+
public class MyRunnable implements Runnable {
11+
private final int[] degree;
12+
13+
MyRunnable(int[] degree2) {
14+
this.degree = degree2;
15+
}
16+
17+
public ThreadLocal<ArrayList<Integer>> getPartition(int[] degrees, ArrayList<Integer> partition){
18+
ThreadLocal<ArrayList<Integer>> initial= new ThreadLocal<ArrayList<Integer>>();
19+
ArrayList<Integer> newPartition = new ArrayList<Integer>();
20+
int i=0;
21+
for(Integer p:partition) {
22+
Integer[] subArray= trialAbstractClass.getBlocks(degrees,i,p+i);
23+
newPartition.addAll(trialAbstractClass.getSubPartition(subArray));
24+
i=i+p;
25+
}
26+
initial.set(newPartition);
27+
return initial;
28+
}
29+
30+
@Override
31+
public void run() {
32+
System.out.println(Arrays.toString(degree));
33+
ThreadLocal<List<ArrayList<Integer>>> partList= new ThreadLocal<List<ArrayList<Integer>>>();
34+
//trialAbstractClass.partitionList.clear();
35+
ThreadLocal<ThreadLocal<List<ArrayList<Integer>>>> formers= new ThreadLocal<ThreadLocal<List<ArrayList<Integer>>>>();
36+
//trialAbstractClass.formerPermutations.clear();
37+
trialAbstractClass.initialPartition=trialAbstractClass.getPartition(degree,trialAbstractClass.occurrences);
38+
//trialAbstractClass.partitionList.add(0,trialAbstractClass.initialPartition);
39+
List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
40+
list.add(0,trialAbstractClass.initialPartition);
41+
partList.set(list);
42+
try {
43+
trialAbstractClass.genStrip(degree);
44+
} catch (IOException | CloneNotSupportedException | CDKException e) {
45+
// TODO Auto-generated catch block
46+
e.printStackTrace();
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)