The Local NanoCap Database

6.1 The Local NanoCap Database

One of the main features of NanoCap is the local database of structures which allows the user to efficiently store previously generated structures. By default the database is stored in the NanoCap user directory (.nanocap). The database can be accessed in several ways; using the NanoCap GUI, using the NanoCap scripts or using an external SQLite client. Using the GUI, the Database Viewer window is located in the View–$>$Local Database menu.

\includegraphics[scale= 0.6]{../../screens/nanocap_db_menu.png} \includegraphics[scale= 0.6]{../../screens/nanocap_db_viewer.png}
Figure 10: NanoCap database viewer

The database viewer provides an interactive interface to the NanoCap database allowing real time searching and loading of stored structures (Fig. 10). Additional search parameters can be added by pressing the Select Properties button which displays all possible database fields. When searching for a structure, logical expressions can be used for each file. For example, if ‘> 100’ is entered into the Natoms fields then only structures with more than 100 atoms will be returned. The column labelled ‘>View’  provides buttons to load a structure into the main NanoCap window. The loaded structures can then be modified, for example: re-optimised with a different force field.

To access the database via Python scripts, the NanoCap libraries can be used. For examples of these scripts see Section 10.

As the NanoCap database is written using SQLite, a suitable database client can be used to view the database. An example using the sqlite3 client is shown below:

bash-3.2$ sqlite3 ~/.nanocap/nanocap.db
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .headers on;
sqlite> .mode column
sqlite> select id,type,Natoms,energy,ff_id from carbon_lattices
   ...> where type="Fullerene" and ff_id="EDIP";
id          type        natoms      energy            ff_id               
----------  ----------  --------  ----------------  --------------------
11          Fullerene   220       -1550.4155355469  EDIP                   
50          Fullerene   200       -1403.7245939477  EDIP                
51          Fullerene   200       -1403.5958295534  EDIP                
52          Fullerene   200       -1404.0657391286  EDIP                
53          Fullerene   200       -1402.8514086776  EDIP                
54          Fullerene   200       -1403.3230258698  EDIP                
55          Fullerene   200       -1404.3263445713  EDIP                
56          Fullerene   200       -1403.4800906205  EDIP                
57          Fullerene   200       -1404.3965982273  EDIP                
58          Fullerene   200       -1404.1298467551  EDIP                
59          Fullerene   200       -1403.4657122674  EDIP                
64          Fullerene   200       -1403.7245939160  EDIP