I have had several requests from people interested in running MaterialsScripts from the command line on a Linux server. This is possible but it is unsupported, there are multiple environment variables that you need to set prior to running the script, and several issues to watch out for.
I have attached a gzip file containing a bash script which sets the appropriate environment variables for Materials Studio 4.3 - note you will need to edit this for your specific install location and license pack/server location.
As mentioned before, there are some complications when you run a script from the command line. The main issue is that a new project folder is created in your run folder to hold the files generated from the script. This project is called MaterialsScript_Project with an associated MaterialsScript_Project Files folder. Therefore, when running from command line, you have to import any project files that you wish to work on into the newly created project folder as part of the script.
Luckily, you can use Perl to help with this by passing in the structure names as command line arguments using the ARGV array. An example script is included in the zip file. This script will create the project, import the document C.msi, count the number of atoms, and print them to the screen. You can then use standard Linux commands to pipe the output etc.
Another issue is that you shouldn't launch more than one job from the same folder. This is because the MaterialsScript job expects a folder of it's own (as is created when running from Materials Visualizer) and hence if you launch more than one job in the same folder, the files are added to the existing folder.
The contents of the attached .gz file are:
MaterialsStudio43Environment.sh - edit this to set the paths to your install location for Materials Studio 4.3, License Pack location, and licenses. Note this is a bash script. If you run from the csh, you will have to change the export commands to setenv.
import.pl - Simple Perl script which shows how to import a structure into the project. You should use this by typing:
perl import.pl C.msi
C.msi - structure to be imported.
Please remember that this is unsupported functionality so it may not be possible to sort out issues you might have (and I don't know enough about Linux!). The file structure may also change from release to release meaning that the environment variables may break for a new release. The names of the folders that are used to store the data etc may also change in the future.
Happy scripting,
Stephen
I have attached a gzip file containing a bash script which sets the appropriate environment variables for Materials Studio 4.3 - note you will need to edit this for your specific install location and license pack/server location.
As mentioned before, there are some complications when you run a script from the command line. The main issue is that a new project folder is created in your run folder to hold the files generated from the script. This project is called MaterialsScript_Project with an associated MaterialsScript_Project Files folder. Therefore, when running from command line, you have to import any project files that you wish to work on into the newly created project folder as part of the script.
Luckily, you can use Perl to help with this by passing in the structure names as command line arguments using the ARGV array. An example script is included in the zip file. This script will create the project, import the document C.msi, count the number of atoms, and print them to the screen. You can then use standard Linux commands to pipe the output etc.
Another issue is that you shouldn't launch more than one job from the same folder. This is because the MaterialsScript job expects a folder of it's own (as is created when running from Materials Visualizer) and hence if you launch more than one job in the same folder, the files are added to the existing folder.
The contents of the attached .gz file are:
MaterialsStudio43Environment.sh - edit this to set the paths to your install location for Materials Studio 4.3, License Pack location, and licenses. Note this is a bash script. If you run from the csh, you will have to change the export commands to setenv.
import.pl - Simple Perl script which shows how to import a structure into the project. You should use this by typing:
perl import.pl C.msi
C.msi - structure to be imported.
Please remember that this is unsupported functionality so it may not be possible to sort out issues you might have (and I don't know enough about Linux!). The file structure may also change from release to release meaning that the environment variables may break for a new release. The names of the folders that are used to store the data etc may also change in the future.
Happy scripting,
Stephen