GOFEE builds all operators from scratch because the implementation in ase.ga is more time consuming
env MPICC=/comm/swstack/core/intel-2019.5.281/mpich/3.2/bin/mpicc pip install mpi4py==3.0.1 pip install cymem==1.31.2
CrossOver acts on both parents
while Mutation is only valid on parents[0]
.
def get_new_candidate(self, parents): """Generate new candidate by applying a randomly drawn operation on the structures. This is done successively for each list of operations, if multiple are present. """ for op_list, rho_list in zip(self.operations, self.rho): for i_trial in range(5): # Do five trials to_use = self.__get_index__(rho_list) anew = op_list[to_use].get_new_candidate(parents) if anew is not None: parents[0] = anew # anew will be used in next set of operations break else: anew = parents[0] # use old parents[0] if the operation failed anew = op_list[to_use].finalize(anew, successfull=False) return anew
Traceback (most recent call last): File "calc_gofee.py", line 62, in <module> search.run() File "/home/tang/project/constrained-GOFEE/src/gofee/gofee.py", line 295, in run unrelaxed_candidates = self.generate_new_candidates() File "/home/tang/project/constrained-GOFEE/src/gofee/gofee.py", line 372, in generate_new_candidates candidates = parallel_function_eval(self.comm, func1) File "/home/tang/project/constrained-GOFEE/src/gofee/parallel_utils.py", line 21, in parallel_function_eval results = func() File "/home/tang/project/constrained-GOFEE/src/gofee/gofee.py", line 371, in func1 return [self.generate_candidate() for i in task_split[self.comm.rank]] File "/home/tang/project/constrained-GOFEE/src/gofee/gofee.py", line 371, in <listcomp> return [self.generate_candidate() for i in task_split[self.comm.rank]] File "/home/tang/project/constrained-GOFEE/src/gofee/gofee.py", line 394, in generate_candidate parents = self.population.get_structure_pair() File "/home/tang/project/constrained-GOFEE/src/gofee/population.py", line 97, in get_structure_pair t1, t2 = np.random.permutation(len(self.pop))[:2] ValueError: not enough values to unpack (expected 2, got 1)
get_structure_pair() in gofee.population
is defined as:
def get_structure_pair(self): t1, t2 = np.random.permutation(len(self.pop))[:2] structure_pair = [self.pop[t1].copy(), self.pop[t2].copy()] return structure_pair
A possible solution to get rid of the case where the population only has one structure is that
def get_structure_pair(self): try: t1, t2 = np.random.permutation(len(self.pop))[:2] except ValueError: t1 = 0 t2 = 0 print('len(self.pop): {}'.format(len(self.pop))) print(self.pop) structure_pair = [self.pop[t1].copy(), self.pop[t2].copy()] return structure_pair