QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: krabidix on December 7, 2023, 11:29

Title: Error: Using pre-calculated data for TrainingSet for MTP training
Post by: krabidix on December 7, 2023, 11:29
Hi,
I am using my pre-calculated data (BulkConfigurations) as the TrainingSet following: https://docs.quantumatk.com/manual/Types/TrainingSet/TrainingSet.html#trainingset-c (https://docs.quantumatk.com/manual/Types/TrainingSet/TrainingSet.html#trainingset-c)
The pre-calculated data was obtained using LCAO and saved in '.hdf5', files, there are a number of BulkConfigurations.
When I am using following script:
 
Code
import glob
import os
directory = ''

filenames= glob.glob(os.path.join(directory, 'data_*.hdf5'))


bulk_configurations = []


for filename in filenames:
    bulk_configurations.append(nlread(filename, BulkConfiguration)[0])
   
calculator = bulk_configurations[0].calculator()
training_set= TrainingSet(bulk_configurations, recalculate_training_data=False, calculator = calculator )
scan_over_non_linear_coefficients = scanOverNonLinearCoefficients(
    perform_optimization=False

# Moment Tensor Potential Training
moment_tensor_potential_training = MomentTensorPotentialTraining(
    filename='MTP.hdf5',
    object_id='mtp',
    training_sets= training_set,
    calculator=calculator, 
    fitting_parameters_list=scan_over_non_linear_coefficients
)
moment_tensor_potential_training.update()

It gives the error: "training_sets miss data. Check that all required energy, forces, or stress data is provided.".
The Bulkconfigurations are converged. What could be the possible solution to this error?

Best,
krabidix
Title: Re: Error: Using pre-calculated data for TrainingSet for MTP training
Post by: Anders Blom on December 9, 2023, 00:47
As the error says, it's not enough to just have the configurations, you must also have the data to train to, i.e. energy, forces and stress.
Without having had the chance to test it explicitly, I think you just have to set recalculate_training_data=True instead of False, and I hope this will not rerun the scf loop since you do provide the same calculator as originally used.