Python search script to search for catalysts

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Python search script to search for catalysts

Post by gmc_nxtman » May 31st, 2015, 12:10 pm

I'm wondering if there's a good python or perl (preferably python) script to search for catalysts. I know about Bellman, and I would love to use it, but C programs haven't been too friendly for my Mac (with Xcode even already installed =_≈). Also, would a search program like this be able to match Bellman and Catalyst in terms of quality? If it isn't possible to do such a script, or would take too much time (over a day) then I would like help with Bellman. But the only programs that I've been able to get working are apgsearch (written in python) and afind (written in C or C++). All the other catalytic search programs I know are written in c, and unhandleable by my Mac. Can somebody please help? :?

User avatar
simsim314
Posts: 1824
Joined: February 10th, 2014, 1:27 pm

Re: Python search script to search for catalysts

Post by simsim314 » June 1st, 2015, 5:48 pm

Hi,

Python script will run much slower (although such idea came to my mind, especially when I need fast one catalyst check, and I really don't need speed).

Bellman is not the only catalyst search utility, not the best as well. Bellman does its job the best way there is, local search for special non spartan catalyst for very specific purpose in small search area. There are definitely many other really nice options such as ptbsearch which Chris managed to hack, and recently mine CatForce which is in development and before beta stage, but works pretty well and already used to find many novelties as well.

I would suggest to post specific request after you go over specific utility thread in the forum.

CatForce thread.
ptbsearch.
Bellman

EDIT Oh and of course catalyst which is very old and has no advantage over ptbsearch except that it has GUI interface for golly that I wrote (and pretty much forgot how to use).

catalyst

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 1st, 2015, 6:16 pm

Thanks, I would like to try CatForce. I have already downloaded it and LifeAPI, but they're c files. So what are the commands for compiling them? Also, there is one .exe file. Is that mandatory? I don't think .exe files are runnable on mac, period.

Thanks in advance, gmc :)

User avatar
simsim314
Posts: 1824
Joined: February 10th, 2014, 1:27 pm

Re: Python search script to search for catalysts

Post by simsim314 » June 1st, 2015, 6:35 pm

gmc_nxtman wrote:So what are the commands for compiling them?
Well you need to first make sure some simple "hello world" works with g++ (c++ compiler that works with the code). Check out this tutorial, and generally google g++ compile on Mac. I would recommend to see other flags for g++ as well (like if you want to actually search you must add -O3, this is release mode that work x100 faster than default).

Once you have g++ and have the basic of compilation - you don't need to compile LifeAPI just make sure it's in the same folder as CatForce, and compile CatForce the same way you compiled "hello world". In CatForce's ReadMe you can see usages and some examples.

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 1st, 2015, 6:49 pm

The file in the tutorial you posted, "hello.cpp" works, but I'm not sure whether to save CatForce as .cpp or .c. Also, when I use the compiling command in Terminal, this error comes up: (apparently I need a file called conio.h?)

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
In file included from CatForce.c:3:
./LifeAPI.h:2:10: fatal error: 'conio.h' file not found
#include <conio.h>
^
1 error generated.

Important things you should probably know so the problem is clearer:

I saved the file as CatForce.c in a folder in Applications called CatForce along with LifeAPI.h and readme.md. I did not modify any of these files, although I think I should but I don't know how.

User avatar
Scorbie
Posts: 1693
Joined: December 7th, 2013, 1:05 am

Re: Python search script to search for catalysts

Post by Scorbie » June 1st, 2015, 7:30 pm

gmc_nxtman wrote:clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
AFAIK, catforce is a cpp application so you (and probaly simsim314's repository) should save it as catforce.cpp
gmc_nxtman wrote:./LifeAPI.h:2:10: fatal error: 'conio.h' file not found
#include <conio.h>
conio.h only works in windows so you (and again, simsim314's repo) should change the code to work without that to remove platform dependencies.

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 1st, 2015, 7:38 pm

Scorbie wrote: conio.h only works in windows so you (and again, simsim314's repo) should change the code to work without that to remove platform dependencies.
I don't know how to change code...
Scorbie wrote:
gmc_nxtman wrote: clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
AFAIK, catforce is a cpp application so you (and probaly simsim314's repository) should save it as catforce.cpp
and I did change the extension to .cpp.

User avatar
Andrew
Moderator
Posts: 981
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Python search script to search for catalysts

Post by Andrew » June 1st, 2015, 9:32 pm

A couple of things to note:

1. I don't see any "#include <conio.h>" line in the latest version of LifeAPI.h, so try downloading the source code again.

2. When you run g++ (or gcc) on Mac OS 10.9 or later you are actually running Clang. Unfortunately, Clang is a lot fussier about following the C++ standard so a lot of code that used to compile on older Macs will now fail. My Mac can dual boot into 10.6 or 10.9. I haven't tried compiling catforce on 10.9 but it built fine on 10.6 using "g++ -O3 -o catforce Catforce.c". I've put the resulting binary on my website:

http://www.trevorrow.com/golly/catforce

I tested "./catforce 1.in" and it seemed to work fine. Let me know if it doesn't work on your Mac and I'll try to do a build on 10.9.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 1st, 2015, 11:05 pm

Alright, will do. I don't have time today, but will do tomorrow (and probably edit this post)

EDIT: It seems that compiling went fine, as I have a new file (executable file) in my CatForce folder called catforce, I'll have a look at the other thread now. Btw, I used the command "g++ -O3 -o catforce CatForce.c".

EDIT2: Now that I've compiled it, I need the command to run it!.... and how to use it. The first place I looked after the thread was the readme.md, but that contains a bunch of instructions for the .exe file, which can't work on my computer, and .in files, which I will download if necessary.
Last edited by gmc_nxtman on June 2nd, 2015, 10:23 am, edited 2 times in total.

User avatar
simsim314
Posts: 1824
Joined: February 10th, 2014, 1:27 pm

Re: Python search script to search for catalysts

Post by simsim314 » June 2nd, 2015, 3:11 am

Andrew wrote:I don't see any "#include <conio.h>" line in the latest version of LifeAPI.h
Well actually the latest LifeAPI is at CatForce repository with few fixes. No one worked with LifeAPI repository, including myself so I didn't updated it, but it should work - not sure why you need conio.h
Andrew wrote: it built fine on 10.6 using "g++ -O3 -o catforce Catforce.c
It's g++ standard and compiles well on Windows (and I think Linux), without reported issues. There should be no good reason to fail at the 10.9 as well (no usage of anything non standard).

Thx for the feedback.
Scorbie wrote: catforce is a cpp application so you (and probaly simsim314's repository) should save it as catforce.cpp
Well this is really strange that this happens only on Mac. I would suggest to rename it to CatForce.cpp and if this is the only issue indeed I will rename it in the repository. It started as .c app, and I didn't see a reason to rename it on any stage.
Scorbie wrote:conio.h only works in windows so you (and again, simsim314's repo) should change the code to work without that
It worked for Kazyan on Linux I think. No conio.h that I can find. I did special attempt to make LifeAPI.h Linux friendly and as close to C as possible. CatForce is c++ but it uses just the standard c++ libraries.

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 2nd, 2015, 4:06 pm

Alright, I compiled it: and I know how to run it. But I don't have the exe file, and it won't work. Here is the error I get:

Usage CatForce.exe <in file>*****sSlverBook:CatForce ************$
Last edited by gmc_nxtman on May 27th, 2016, 4:52 pm, edited 1 time in total.

User avatar
Andrew
Moderator
Posts: 981
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Python search script to search for catalysts

Post by Andrew » June 2nd, 2015, 7:57 pm

That error message only applies on Windows where the executable is called CatForce.exe. On Mac/Linux the executable is simply called catforce. If you run it by typing "./catforce" then you'll get that error message because you need to provide an input file; eg: "./catforce foo.in". A number of example .in files should be present if you downloaded everything from github.

Note that typing "./catforce 1.in" should take a few minutes to complete. After you see the "FINISH" message it looks like the program hangs, but it's just waiting for you to hit return (no idea why it does that -- if you want to avoid it then remove the getchar() call at the end of the code). Hit ctrl-C if you want to abort a catforce run.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 2nd, 2015, 8:08 pm

Thanks. I downloaded all the .in files, and renamed them to their proper names. I did do ./catforce 1.in, ./catforce 2.in, etc.. for all the files. However it kept just giving me this message:

Input: 1.in
Initializing please wait
Segmentation fault: 11
computername:~ username$

Is it just still thinking? Is my LifeAPI not working? It seems to be not too unreasonable a hypothesis (to me) that my LifeAPI is not working, as I did not use any commands to compile it. Do I need to compile the .in files?

(sorry for all the questions, which may sound ridiculous to you, but I know next to nothing about coding)

User avatar
Andrew
Moderator
Posts: 981
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Python search script to search for catalysts

Post by Andrew » June 2nd, 2015, 8:22 pm

gmc_nxtman wrote:I downloaded all the .in files, and renamed them to their proper names.
I don't understand -- why did you need to rename them?
Segmentation fault: 11
That tells you the program has crashed. Was this using the catforce executable downloaded from my website or using your build? If the latter, did you get any warning messages when you compiled it? In an earlier post you said you compiled it with the command "g++ -O3 -o catforce CatForce.c". Try again without the -O3 option, or change it to -O2.

EDIT: The .in files are just ordinary text files that are used to pass input parameters to catforce. No need to compile them (just use a text editor to create/change them).
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 2nd, 2015, 8:58 pm

Andrew wrote:
gmc_nxtman wrote:I downloaded all the .in files, and renamed them to their proper names.
I don't understand -- why did you need to rename them?
Well, (this may sound stupid) I went to the website with CatForce and went to the page for a specific file, went to "Raw", did command-A, command-C, and command-V in a new file, and changed it to the proper extension. I haven't really used github before. :roll:
Andrew wrote:Try again without the -O3, or change it to -O2.
I did try both of those, and did find an executable in my CatForce directory, but running it (or trying to run it) still gave me
Segmentation fault: 11
so unfortunately I don't know what to do now :(
Anyways, I downloaded the attachment thingy, and put it in my CatForce folder *along with* CatForce.cpp, and tried the run command again. (ugh this is getting so complicated. :| I'm sure you love technology Andrew)
This gave me an even weirder error:

Code: Select all

Last login: Tue Jun  2 17:57:25 on ttys000
computername:CatForce username$ ./catforce
-bash: ./catforce: Permission denied
computername:CatForce username$ 

User avatar
simsim314
Posts: 1824
Joined: February 10th, 2014, 1:27 pm

Re: Python search script to search for catalysts

Post by simsim314 » June 3rd, 2015, 3:30 am

gmc_nxtman wrote:-bash: ./catforce: Permission denied

CatForce writes the results on disk. You probably didn't gave permission to CatForce to write stuff on your disk. I'm not familiar with Mac permission system, but this is the only place I think CatForce tries to do anything requiring permissions.

User avatar
Andrew
Moderator
Posts: 981
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Python search script to search for catalysts

Post by Andrew » June 3rd, 2015, 6:40 am

gmc_nxtman wrote:I haven't really used github before.
The github UI isn't all that intuitive. All you need to do is click the "Download Zip" button on the right hand side. Double-click the resulting CatForce-master.zip file and you'll get a CatForce-master folder containing all the source code and the example .in files.

I managed to build catforce on my 10.9 system but noticed that it didn't produce the same results as my 10.6 build (didn't get any seg fault though so I'm not sure how you managed that). Then I tried building a 32-bit version using this command:

g++ -m32 -O3 -o catforce CatForce.c

This time "./catforce 1.in" produced the correct results, so it looks to me like the CatForce code doesn't like to be compiled as a 64-bit binary (at least on a Mac). So try the above command and see if you have more success.
-bash: ./catforce: Permission denied
The downloaded catforce file probably didn't have the executable permission. Easily fixed by typing "chmod +x catforce" (but you won't need to do that if you build your own catforce).
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 3rd, 2015, 9:41 am

Ok, thanks for all the help guys. It seems to be working now, but a bit strangely because it generated "full.rle" and "1.rle" in my CatForce-Mastr directory but they contain no data. I'm assuming this means it's just searching right? Now it seems as if the only "trouble" is how to use it.
Andrew wrote:Why did you need to rename them?
My computer seems to have a strange problem with file formats; downloading files sometimes puts the wrong extension on them, and I can never seem to get a file in the right "format" even by changing the extension. Sort of hard to explain.

User avatar
Andrew
Moderator
Posts: 981
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Python search script to search for catalysts

Post by Andrew » June 3rd, 2015, 6:18 pm

gmc_nxtman wrote:It seems to be working now, but a bit strangely because it generated "full.rle" and "1.rle" in my CatForce-Mastr directory but they contain no data. I'm assuming this means it's just searching right?
No, it's not working correctly. That's exactly what happened with my 64-bit binary. The 32-bit binary (built with the -m32 option -- see above post) creates rle files with sensible data, so I assume it's doing things correctly.
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 3rd, 2015, 6:25 pm

(I deleted the post because it was stupid)
Last edited by gmc_nxtman on June 3rd, 2015, 6:53 pm, edited 1 time in total.

User avatar
Andrew
Moderator
Posts: 981
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: Python search script to search for catalysts

Post by Andrew » June 3rd, 2015, 6:42 pm

Sheesh, please read more carefully! The 32-bit version works correctly. The 64-bit version does NOT. You need to build catforce using this command:

g++ -m32 -O3 -o catforce CatForce.c
Use Glu to explore CA rules on non-periodic tilings: DominoLife and HatLife

User avatar
gmc_nxtman
Posts: 1150
Joined: May 26th, 2015, 7:20 pm

Re: Python search script to search for catalysts

Post by gmc_nxtman » June 3rd, 2015, 6:49 pm

Sorry. Compiling it with the 32 bit didn't work, but I'm currently trying to compile it as catforce.cpp. I think that might be what's causing the trouble; People on this topic suggested that I should save it as a .cpp, and the command you're giving is for c. Just a misunderstanding, that's all.. But I'm still unsure of whether to save it as cpp or c... I'll try both and give feedback on what I get.

EDIT: I'll also try doing it with/without all the flags you gave.

Post Reply