From 85d9d3b79092d71c668e0eed5d54038e8bd161d8 Mon Sep 17 00:00:00 2001 From: Steven T Date: Tue, 24 Sep 2019 15:05:58 -0400 Subject: [PATCH 1/2] Fixed bug in GP from AIMD and improved verbosity flexibility --- flare/gp_from_aimd.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/flare/gp_from_aimd.py b/flare/gp_from_aimd.py index 747e10faf..2df65a34f 100644 --- a/flare/gp_from_aimd.py +++ b/flare/gp_from_aimd.py @@ -29,8 +29,7 @@ def __init__(self, frames: List[Structure], calculate_energy: bool = False, output_name: str = 'gp_from_aimd', max_atoms_from_frame: int = np.inf, max_trains: int = np.inf, - min_atoms_added: int = 1, - n_cpus: int = 1, shuffle_frames: bool = False, + min_atoms_added: int = 1, shuffle_frames: bool = False, verbose: int = 0, model_write: str = '', pre_train_on_skips: bool = False, pre_train_seed_frames: List[Structure] = None, @@ -94,8 +93,6 @@ def __init__(self, frames: List[Structure], self.output = Output(output_name) - # set number of cpus for parallelization - self.n_cpus = n_cpus # To later be filled in using the time library self.start_time = None @@ -130,7 +127,8 @@ def pre_run(self): self.abs_std_tolerance)) self.start_time = time.time() - + if self.verbose >= 3: + print("Now beginning pre-run training.") # If seed environments were passed in, add them to the GP. for point in self.seed_envs: self.gp.add_one_env(point[0], point[1], train=False) @@ -139,7 +137,7 @@ def pre_run(self): # Take one of each atom species in the first frame # so all atomic species are represented in the first step. # Otherwise use the seed frames passed in by user. - if len(self.gp.training_data) == 0 and self.seed_frames is None: + if len(self.gp.training_data) == 0 and self.seed_frames is []: self.seed_frames = [self.frames[0]] for frame in self.seed_frames: @@ -161,6 +159,9 @@ def pre_run(self): # These conditions correspond to if either the GP was never trained # or if data was added to it during the pre-run. + if self.verbose >= 3: + print("Now commencing initial training of GP (which has " + "non-empty training set)") if (self.gp.l_mat is None) \ or (self.seed_frames is not None @@ -174,7 +175,8 @@ def run(self): the training set upon the triggering of the uncertainty threshold. :return: """ - + if self.verbose >= 3: + print("Commencing run with pre-run...") self.pre_run() # Loop through trajectory From 05db1b50f95a18b2c4ca22ad3e79195666bbd32b Mon Sep 17 00:00:00 2001 From: Steven T Date: Tue, 24 Sep 2019 15:45:27 -0400 Subject: [PATCH 2/2] Added verbosity options and bugfixes --- flare/gp_from_aimd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flare/gp_from_aimd.py b/flare/gp_from_aimd.py index 2df65a34f..6f2d6ff4e 100644 --- a/flare/gp_from_aimd.py +++ b/flare/gp_from_aimd.py @@ -164,8 +164,8 @@ def pre_run(self): "non-empty training set)") if (self.gp.l_mat is None) \ - or (self.seed_frames is not None - or self.seed_envs is not None): + or (self.seed_frames is not [] + or self.seed_envs is not []): self.gp.train(output=self.output if self.verbose > 0 else None) def run(self):