Author Topic: How to use the ActiveLearningSimulation type Blocks  (Read 5414 times)

0 Members and 1 Guest are viewing this topic.

Offline msingh96

  • Regular QuantumATK user
  • **
  • Posts: 9
  • Country: us
  • Reputation: 0
    • View Profile
Hello, I'm trying to use the active learning simulation methods but am having trouble setting up workflows to go forward. the active learning blocks tell me an initial training data set of type table was not provided... so I tried exporting existing trajectories from an MD simulation I had done with an MTP as table... but I'm fairly clueless as to exporting an existing table or old trajectory data to the workflow manager. the tutorials for active learning in the documentation do not use the new GUI, so I wasn't able to find much help there.
I'm sure there are concepts I'm not understanding but what I am trying to do is as follows:

  • Train an initial MLP using crystal training template, which is based on tutorial for HfO2
  • Generate additional training using fitted MTP in MD simulation
  • Active Learning on the data from MD.

I'm having trouble with the 3rd step of this list, how do I export the trajectories along with the energies and forces from my MD simulation to the active learning format?

Thanks, Mayur

Offline msingh96

  • Regular QuantumATK user
  • **
  • Posts: 9
  • Country: us
  • Reputation: 0
    • View Profile
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #1 on: July 26, 2024, 20:12 »
Hi has anyone used active learning in the new version of QuantumATK before?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #2 on: July 30, 2024, 00:18 »
You don't  run the MD separately from the active learning; rather, the Active Learning algorithm runs MD internally. So steps 2 and 3 in your list are really just one Python call in our code. Probably best explained in https://docs.quantumatk.com/tutorials/mtp_hfo2/mtp_hfo2.html. Even though some parts of this might be slightly outdated and we are working on updating it, the basic concept of Active Learning is explained in the form it should be used.

Offline msingh96

  • Regular QuantumATK user
  • **
  • Posts: 9
  • Country: us
  • Reputation: 0
    • View Profile
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #3 on: July 31, 2024, 21:02 »
Hi Anders, thank you for the insight. However, I cant seem to get the active learning blocks set up for what the example suggests. When I insert an ActiveLearningSimulation block I get an error saying that I have not provided configurations or initial training data to perform the job.
I'm messing up something completely novice here, but I'm not very familiar with the custom scripting in quantumATK I'm attaching some pictures of my workflow and hopefully that is informative.

Thanks again, Mayur

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #4 on: August 2, 2024, 01:26 »
It is fully understandable that you are confused by this, we need to explain it better. Let me get back to you, when I have prepared an example.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #5 on: August 2, 2024, 23:37 »
In the image attached you can see the required components for an Active Learning simulation. You were close, but let me explain the role of each block.

ConfigurationTable: This will hold the starting configurations for the MD run. It can be a single configuration, or many, in which case multiple MD simulations will be run.

Load Table: This is the key step that tripped you up. It is defined from a "Load from file" block, and needs to load a file containing the original training sets. You only run an AL simulation when you already have a base MTP, and the AL uses the original training data in the refitting. To prepare this file, you need to
a) Right-click the "mtp" object in the HDF5 file from the original MTP fitting and choose Export as>TrainingSet (this can take some time!)
b) Next, right-click the TrainingSet object in the newly created file and again do Export as, this time as Table.
The second file created is the one you Load from file in the AL workflow. The reason for this workflow is that you can use it to combine several training sets into one table, and all will be combined and used for the AL.

After that you should be able to add, same as you already did, the NonLinearCoefficientsParameters, MTPFittingParameters, ActiveLearningSimulation and ActiveLearningMD.

However, note that the calculator you insert in the workflow should be the one which will be used to calculate energy, forces and stress for the newly added configurations discovered by the AL, so typically this should be a DFT calculator. Also, it should not be a "Set Calculator" block (which attaches the calculator to a configuration) but rather the Auxiliary>Calculator block which only defines the calculator itself.

I hope you get this to work, but I'll be happy to answer further questions.

Offline msingh96

  • Regular QuantumATK user
  • **
  • Posts: 9
  • Country: us
  • Reputation: 0
    • View Profile
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #6 on: August 18, 2024, 22:36 »
Hi Anders, this was really helpful. I got an active learning workflow to actually "work" now. Now for some tuning and fidgeting with the parameters. some followup questions:
  • The calculator used is typically a DFT calculator, I guess this means that we simply train a new MTP. In the active learning parameters it is possible to manually set a reference calculator and a correction calculator, I'm wondering if it is possible to use an existing MTP for active learning to "retrain" or improve the results of the MTP by using these settings?
  • what parameters are the usual suspects if trying to perform a sensitivity analysis on the active learning and regular training of the MTP?

Regards and thanks for the assistance,
Mayur

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: How to use the ActiveLearningSimulation type Blocks
« Reply #7 on: August 27, 2024, 01:19 »
Yes, the whole point of AL is that you have an MTP which is decently ok (say, for crystalline materials) and through the AL procedure you add more training structures so that it can cover a wider space, like amorphous materials or high-temperature cases, basically anything far from equilibrium. So you retrain the MTP in AL, using all the previous training data from the basic training plus the new ones.

I must admit I have no direct experience in using a correction_calculator but my understanding is that you don't need to consider it except for special cases like van der Waals corrections.