ulissigroup / finetuna

Active Learning for Machine Learning Potentials
MIT License
45 stars 11 forks source link

QE colab calculator does not work as intended #12

Closed saurabhsivakumar closed 2 years ago

saurabhsivakumar commented 3 years ago

Traceback for error as follows:

/usr/local/lib/python3.6/dist-packages/al_mlp/offline_learner.py in learn(self)
     88 
     89         while not self.terminate:
---> 90             self.do_before_train()
     91             self.do_train()
     92             self.do_after_train()
/usr/local/lib/python3.6/dist-packages/al_mlp/offline_learner.py in do_before_train(self)
     98         """
     99         if self.iterations > 0:
--> 100             self.query_data()
    101         self.fn_label = f"{self.file_dir}{self.filename}_iter_{self.iterations}"
    102 
/usr/local/lib/python3.6/dist-packages/al_mlp/offline_learner.py in query_data(self)
    140         """
    141         queried_images = self.query_func()
--> 142         self.training_data += compute_with_calc(queried_images, self.delta_sub_calc)
    143 
    144     def check_terminate(self):
/usr/local/lib/python3.6/dist-packages/al_mlp/utils.py in compute_with_calc(images, calculator)
     53     for image in images:
     54         image.set_calculator(copy.deepcopy(calculator))
---> 55     return convert_to_singlepoint(images)
     56 
     57 
/usr/local/lib/python3.6/dist-packages/al_mlp/utils.py in convert_to_singlepoint(images)
     24         os.makedirs("./temp", exist_ok=True)
     25         os.chdir("./temp")
---> 26         sample_energy = image.get_potential_energy(apply_constraint=False)
     27         sample_forces = image.get_forces(apply_constraint=False)
     28         image.set_calculator(
/usr/local/lib/python3.6/dist-packages/ase/atoms.py in get_potential_energy(self, force_consistent, apply_constraint)
    731                 self, force_consistent=force_consistent)
    732         else:
--> 733             energy = self._calc.get_potential_energy(self)
    734         if apply_constraint:
    735             for constraint in self.constraints:
/usr/local/lib/python3.6/dist-packages/ase/calculators/calculator.py in get_potential_energy(self, atoms, force_consistent)
    706 
    707     def get_potential_energy(self, atoms=None, force_consistent=False):
--> 708         energy = self.get_property('energy', atoms)
    709         if force_consistent:
    710             if 'free_energy' not in self.results:
/usr/local/lib/python3.6/dist-packages/ase/calculators/calculator.py in get_property(self, name, atoms, allow_calculation)
    734             if not allow_calculation:
    735                 return None
--> 736             self.calculate(atoms, [name], system_changes)
    737 
    738         if name not in self.results:
/usr/local/lib/python3.6/dist-packages/al_mlp/calcs.py in calculate(self, atoms, properties, system_changes)
     52         self.calcs[0].results = self.parent_results
     53         self.calcs[1].results = self.base_results
---> 54         super().calculate(atoms, properties, system_changes)
     55 
     56         if "energy" in self.results:
/usr/local/lib/python3.6/dist-packages/ase/calculators/mixing.py in calculate(self, atoms, properties, system_changes)
     50 
     51         for w, calc in zip(self.weights, self.calcs):
---> 52             calc.calculate(atoms, properties, system_changes)
     53 
     54             for k in properties:
TypeError: calculate() takes from 2 to 3 positional arguments but 4 were given