Creating Your Own Driver Code
Driver code means code containing a "main" function that will be compiled into an executable you can run. Typically for a program called "myappname" the main function appears in a file called "myappname.cc". (ITensor uses the convention that C++ source code files have the extension .cc, but other common conventions include .cpp or .C.)
For convenience, ITensor includes a project template folder ready for you to use. To use it, follow these steps:
Assuming the ITensor source code is located in
/home/username/itensor(whereusernameis your actual username), and assuming you want to create your new project under/home/username/software, issue the commands:mkdir -p /home/username/software cp -r /home/username/itensor/tutorial/project_template \ /home/username/software/myproject
Here you will want to choose
myprojectto be the actual name of your program.Go to the
/home/username/software/myappnamefolder. Edit theMakefilethere. Make sureLIBRARY_DIRis set to the actual location of the ITensor source code on your computer.Test your configuration by issuing the command
make. This should build themyappnamesample program, which you can run by typing./myappname.Finally, when changing
myappname.ccto some other program name, make sure to also update theAPPvariable in the fileMakefileused by themakeprogram. Themyclass.handmyclass.ccfiles are included to show how to create helper classes for your program to use. If you rename or remove these, make sure to edit theMakefileappropriately. Also you will need to modify or remove the line#include "myclass.h"inside ofmyappname.cc.