You are here: Home Research / Programming StructureFinder

StructureFinder

A program to search for crystal structures on your hard drive or file server

Have you ever had to find a certain structure from an ancient Postdoc or PhD years ago and there is no systematic list of structures?

StructureFinder is the solution.

StructureFinder indexes all cif files below a certain directory(s) and makes them searchable. Additionally, it is able to search for unit cells in the Bruker APEX2/3 software database.

 

StructureFinder download

 

Before the first installation:

You may need to install the Microsoft Visual C++ Redistributable package first.

C++ Redistributable for Windows 7/8/10 version (local copy)

C++ Redistributable for Windows XP version (local copy)

 

Screenshots

In the main tab, you can import cif files to a database, you can save this database, you can open an existing database or open the APEX2/3 database on your computer. To search the APEX database, just click on the 'Open APEX Database' button. The program will try to connect the database on the local computer with the default username and password. If that fails, it will ask for a different.

Selecting a certain entry of the database shows the unit cell, the residuals and the asymmetric unit.

Basic search options for unit cells and text is also available. The cell search takes six parameters a, b, c, αβ, γ. The search is unsharp so 10 10 10 90 90 90 would find the same cell as 10.00 10.00 10.00 90.00 90.00 90.00.

The algorithm is a combination of a cell comparison by volume first (for speed) and subsequent matching using the Lenstra-Lenstra-Lovasz lattice basis reduction for cell reduction with a sphere search taking periodic boundary conditions into account. The lattice matching implementation was made by the http://pymatgen.org/ project.

The tolerances for the cell search are:

regular
volume: ± 3%, length: 0.001 Å, angle: 1°

more results option
volume: ± 8%, length: 0.09 Å, angle: 1.8°

The text search field searches in the directory, name and .res file text data. You can concatenate words with ? and *. For example foo*bar means 'foo[any text]bar'.

StructurFinder runs best with Python3.6 64bit, numpy (any version) and PyQt5.9. The WindowsXP version has limited functionality, because only Python3.4 runs on WindowsXP. The XP version is only intended to search for unit cells in the APEX database on an ancient Bruker framebuffer computer!

StructureFinder main window

Pro tip: Double click on the unit cell to copy the cell to the clip board.

 

 

The 'all cif values' tab shows all cif values available in the database. These are not necessarily all but most values from the cif file.

list of all cif values

 

The 'Advanced Search' tab allows you to search for several options at a time and also allows to exclude parameters. I will add more options in the future. I would be happy if you suggest more search options if you need more.

advanced search tab

 


Indexing cif files

The 'Import Directory' button starts indexing of cif files below the selected directory recoursively. It will scan all subdirectories for cif files as well as zip files containing cif files. The time for indexing mostly depends on the speed of your hard drive. Scanning a complete 256 GB SSD takes about 50s. A complete file server with over 100 user directories and 10.000 crystal structures can take 20-30 minutes.

You should never run the import on a network drive. It will take ages!

 

Command Line Version

With the strf_cmd.py script, you can index directories without a graphical user interface.

The options -d and -e can be given multiple times.

The command line version only needs Python >= 3.5 and numpy (any version)

 

$ python3.6 strf_cmd.py 
usage: strf_cmd.py [-h] [-d "directory"] [-e "directory"] [-o "file name"]
Command line version of StructureFinder to collect cif files to a database.
StructureFinder will search for cif files in the given directory(s)
recursively.
optional arguments:
-h, --help show this help message and exit
-d "directory" Directory(s) where cif files are located.
-e "directory" Directory names to be excluded from the file search. Default
is: "ROOT", ".OLEX", "TMP", "TEMP", "Papierkorb",
"Recycle.Bin" Modifying -e option discards the default.
-o "file name" Name of the output database file. Default: "structuredb.sqlite"

 

Indexing Example

Creates the file structuredb.sqlite in the current directory:

python3.6 strf_cmd.py -d /home/daniel

collecting files... (may take some minutes)
Committed
Added 233 cif files (20 in .zip files) to database in: 0 h, 0 m, 10.23 s

 

The command line version always appends all data to an already existing database.

 

Database Format

The database format is just plain sqlite (http://www.sqlite.org/). You can view the database structure with the fantastic sqlitebrowser (http://sqlitebrowser.org/).

The database structure is not supposed to change, but I might add compression to the file format in the future. 

 

Web interface

Instead of the regular user interface, you can run StructureFinder as web service. First, create a database with strf_cmd.py. This can be automated with a cron job to do it regularly. The zip file strf_cmd_version.zip above contains all you need to start the web service or use the Git repository. 

Change the variables

host = "127.0.0.1"
port = "80"
dbfilename = "/path/to/database.sqlite"

in cgi_ui/cgi-bin/strf_web.py to your desired webserver adress and database path. Some operating systems do not allow users to run services at port 80. You might use port 8080 instead.

Go into the Structurefinder main directory and run

python3 cgi_ui/cgi-bin/strf_web.py

 

Be aware that running a web server has security implications. Do not expose this server to the internet unless you know what you are doing!

The web site should look like this after clicking on a table row:

strf_web.png

 

Changelog

-v18 Added more compatible installer package (solving OpenGL issues).

-v17 Added space group search. Be aware that older cif files might not have a space group number defined!

-v16 Improved layout, extra tab for res file, structure resizes with window.

-v15 Added check for validity of searched elements. New 64bit installer package.

-v14 Improved element search. Added web interface to zip file.

-v13 Fixed search behavior. 

-v12 Added possibility to search for modification times of cif files. Added warning for new version.

-v11 More information about reflections and minor fixes. Web interface has now almost the same functionality as the     stand-alone version.

-v10 Fixed crash during text search.

-v9 Supports "open with..." for database file in windows.

-v8 Support for CIF in .tgz files. Improved stability. Improved command line output.

-v7 zip files should now work correctly.

-v6 Fixed parsing of cif files. Known bug: zip files are not handled correctly at the moment (also in v5). Will fix later...

-v5 Added indexing of .cif files in .zip files. 

 

License

StructureFinder is free software  and licensed under the beerware license.