Author Topic: How to use SCF data from previous LCAO run for further Analysis?  (Read 2320 times)

0 Members and 1 Guest are viewing this topic.

Offline JuneNanoscience

  • New QuantumATK user
  • *
  • Posts: 1
  • Country: us
  • Reputation: 0
    • View Profile
Hello! This is my first post on the forum. I tried searching for the answer to my question before posting but did not find what I was looking for.

My group is going calculations on a variety of 2D systems. We optimize the geometry/atomic positions of the atoms in our supercell, then import that final opt geometry and do a LCAO run, usually with a denser k-grid, followed by other "post-SCF" Analysis calculations (FatBandstructure, PDOS, PartialElectronDensity, MullikenPopulation, etc.). However, we sometimes like to adjust the parameters within those "post-SCF" Analysis calculations (e.g. the PartialElectronDensity E_min, E_max values), after the first time we run them, for comparison. However, we have to wait for another full LCAO run to complete. Time consuming.

I would like to know how to use the data from an older LCAO run (same material system/configuration) in order to save time when doing the Analysis calculations, so we may change the Analysis input parameters without having to wait for another full LCAO run to converge. The data necessary to do additional Analysis should be there, but I am not sure how to set up the calculation in the Workflow, so the code knows to use the last SCF run from the previous LCAO calculation.

Is this possible and, if so, how may we properly execute such an approach in the Workflow or otherwise.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5519
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Answered by email, posting answer here for the benefit of other users. Indeed as you note, you don’t want to rerun the calculation just to do post-processing and fortunately it’s very easy to do that in QuantumATK. It can easily be done in a script, as shown below, or in the GUI: 1.   Open the Workflow Builder and click the + button to start a new workflow 2.   Locate “Load from file” in the right-hand panel (you can e.g. filter on the word “file”) and insert it in the flow 3.   Open this block (double-click) and click the button Load from file. 4.   Now locate the directory and HDF5 file containing the converged calculation 5.   Once you have selected the file in the file dialog, select the relevant BulkConfiguration (or similar) object in the right-most panel and click Load 6.   After this you can insert any analysis objects you want, such as Bandstructure etc into the flow, and execute it as usual It is instructive to inspect the Python script generated by this procedure. A normal QuantumATK script has the following general structure in metacode:
Code: python
configuration = BulkConfiguration(…)
calculator = LCAOCalculator(…)
configuration.setCalculator(calculator)
configuration.update()
nlsave(“file.hdf5”, configuration)
bandstructure = Bandstructure(configuration)
nlsave(“file.hdf5”, bandstructure)
What you need to do if you forgot some analysis is to bypass the SCF loop (the “update”) and read back the converged state from the HDF5 file:
Code: python
configuration = nlread(“file.hdf5”, BulkConfiguration)[0]
bandstructure = Bandstructure(configuration)
nlsave(“file.hdf5”, bandstructure)
This provides a very easy way to perform this kind of analysis without using the GUI. Notes: •   You then don’t need the calculator and configuration definitions because they are read from the file too. •   You don’t absolutely need the BulkConfiguration argument to nlread, then it will read all objects (instead of just the configurations) but you always need the [ 0 ] or [ -1 ] because nlread always returns a list, even if only one object is found. You can also explicitly ask for a specific object if you know it’s object_id which is visible in the GUI in the Data view:
Code: python
configuration = nlread(“file.hdf5”, object_id=”BulkConfiguration_0”)[0]