Nordland's reply says that you should place the file "in the same directory as the file you are going to use it with". However, when you drop your script on the Job Manager, your main script is in c:/users/yanmi/appdata/local/temp/ (as the error message says).
You have a couple of way to resolve this.
- You could copy the file projected_density_of_states.py to the "temp" directory. Not a clean solution, but it works, at least it's a quick fix.
- Instead of using the Job Manager, export the script to the same directory where projected_density_of_states.py is located, and run ATK manually from there. This requires that you have either installed ATK separately or set up your PATH you include the atk/bin directory under the VNL installation. This can be useful under any circumstance!
- The most pythonic way would be to include this line at the top of the script, before the import statement:
import sys
sys.path.append("c:/users/yanmi/")
I assumed that projected_density_of_states.py is located in c:/users/yanmi/; adjust to reflect the correct location.
Don't bother with putting files in the temp directory, you will just forget to move them back out from there later ;)
Assuming that you are doing mostly everything from within VNL, the easiest way is:
- Keep control over where the NC file ends up when you run the initial calculation by specifying, in the NanoLanguage Scripter, the absolute path where you want it to end up, like c:/my_calculations/checkpointfile.nc or something
- Then, when you perform subsequent analysis steps, just point the script to this file, with the full path
So, if you don't know where the NC file is, the easiest way is to rerun the initial calculation (it's quite fast, in this case, after all), taking the first point about into account. (You may find the NC file in temp, if you're lucky; in that case, just copy it out of there to a more convenient location.)
Then, run the PDOS analysis, with something like
scf = restoreSelfConsistentCalculation('c:/my_calculations/lih2li.nc')
Of course the directory name c:/my_calculations is just a suggestion, you can use something more relevant in My Documents instead, as you prefer. Do note however that forward-slashes "/" must be used instead of "\" as is "normal" on Windows.
The statement
pdos = calculateProjectedDensityOfStates(scf,numpy.arange(-3,3.01,0.01)*Units.eV,
projection_atoms = projection_atoms)
explicitly specifies the energy spacing between points (0.01 eV in this case).
pdos = calculateProjectedDensityOfStates(scf,numpy.arange(-3,3.01,0.001)*Units.eV,
projection_atoms = projection_atoms)
The "lih2li.nc"," projected_density_of_states.py" and "example.py" have been placed in the same directory. And the "example.py" file has been runned on ATK SE2010.02. The error message appears as following.
Traceback (most recent call last):
File "c:\docume~1\fanghui\locals~1\temp\8573268483295537.py", line 1, in <module>
from ATK.TwoProbe import *; import numpy
ImportError: No module named ATK.TwoProbe
NanoLanguageScript execution failure
How to deal with this situation?
ATK 2010.02 uses slightly different keywords, so there's no "TwoProbe" module anymore. Instead, use
from NanoLanguage import *
Do note, however, that you will need to modify other parts of the code as well; the scripts are not compatible. Your best option is actually to rebuild it from scratch in VNL or by hand. You can find the Li-H2-Li example still in the manual (http://quantumwise.com/documents/manuals/latest/VNLTutorial/chap.lih2.html).