def initialize(self): rc = self.rc.config['west', 'system'] # pcoord parameters self.pcoord_ndim = 2 self.pcoord_len = 2 self.pcoord_dtype = pcoord_dtype self.target_count = rc.get('target_count') self.nbins = rc.get('nbins') y = np.linspace(0.05, 0.95, self.nbins) centers = np.zeros((self.nbins, self.pcoord_ndim), dtype=self.pcoord_dtype) centers[:, 1] = y self.bin_mapper = VoronoiBinMapper(dfunc, centers) self.bin_target_counts = np.zeros((self.bin_mapper.nbins, ), dtype=np.int_) self.bin_target_counts[...] = self.target_count # string method parameters self.sm_params = { 'slen': [self.nbins], 'kappa': 0.01, 'fixed_ends': False, 'isperiodic': np.array([0, 1], dtype=np.int), 'boxsize': np.array([1.0e8, 1.0]), 'sciflag': True }
def initialize(self): rc = self.rc.config['west', 'system'] self.pcoord_ndim = 3 self.pcoord_len = 2 self.pcoord_dtype = pcoord_dtype self.target_count = rc.get('target_count') self.nbins = rc.get('nbins') slen = self.nbins // 2 x = np.linspace(-3.0, 3.0, slen) centers = np.zeros((self.nbins, self.pcoord_ndim), dtype=self.pcoord_dtype) centers[:slen, 0] = x centers[slen:, 0] = x[::-1] centers[:slen, 2] = 0.0 centers[slen:, 2] = 1.0 self.bin_mapper = VoronoiBinMapper(dfunc, centers) self.bin_target_counts = np.zeros((self.bin_mapper.nbins,), dtype=np.int_) self.bin_target_counts[...] = self.target_count slen = self.nbins // 2 self.sm_params = {'slen': [slen, slen], 'kappa': 0.001, 'dtau': 0.15, 'fixed_ends': False, 'sciflag': True, 'mpairs': [[0, self.nbins - 1], [slen - 1, slen]], 'slabels': [2], 'fourierflag': True, 'fourier_P': 2}
def update_bin_mapper(self): '''Update the bin_mapper using the current set of voronoi centers''' westpa.rc.pstatus('westext.adaptvoronoi: Updating bin mapper\n') westpa.rc.pflush() # self.mapper_func = plugin_config.get('mapper_func', False) try: dfargs = getattr(self.system, 'dfargs', None) dfkwargs = getattr(self.system, 'dfkwargs', None) if self.mapper_func: # The mapper should take in 1) distance function, # 2) centers, 3) dfargs, 4) dfkwargs and return # the mapper we want self.system.bin_mapper = self.mapper_func(self.dfunc, self.centers, dfargs=dfargs, dfkwargs=dfkwargs) else: self.system.bin_mapper = VoronoiBinMapper(self.dfunc, self.centers, dfargs=dfargs, dfkwargs=dfkwargs) self.ncenters = self.system.bin_mapper.nbins new_target_counts = np.empty((self.ncenters, ), np.int) new_target_counts[...] = self.walk_count self.system.bin_target_counts = new_target_counts except (ValueError, TypeError) as e: log.error('AdaptiveVoronoiDriver Error: \ Failed updating the bin mapper: {}'.format(e)) raise
def initialize(self): self.pcoord_ndim = 2 self.pcoord_dtype = pcoord_dtype self.pcoord_len = pcoord_len nbins = 1 self.nbins = nbins centers = np.zeros((self.nbins,self.pcoord_ndim),dtype=self.pcoord_dtype) centers[:,:] = 1 self.bin_mapper = VoronoiBinMapper(dfunc, centers) self.bin_target_counts = np.empty((self.bin_mapper.nbins,), np.int) self.bin_target_counts[...] = 10
def update_bin_mapper(self): '''Update the bin_mapper using the current string''' westpa.rc.pstatus('westext.stringmethod: Updating bin mapper\n') westpa.rc.pflush() try: dfargs = getattr(self.system, 'dfargs', None) dfkwargs = getattr(self.system, 'dfkwargs', None) self.system.bin_mapper = VoronoiBinMapper(self.dfunc, self.strings.centers, dfargs=dfargs, dfkwargs=dfkwargs) except (ValueError, TypeError) as e: log.error('StringDriver Error: Failed updating the bin mapper: {}'.format(e)) raise
def initialize(self): self.pcoord_ndim = 8 self.pcoord_len = 2 self.pcoord_dtype = np.float32 self.nbins = 1 centers = np.zeros((self.nbins, self.pcoord_ndim), dtype=self.pcoord_dtype) # Using the values from the inital point centers[0, 0] = 4.0 centers[0, 1] = 18.0 centers[0, 4] = 1.0 centers[0, 6] = 1.0 self.bin_mapper = VoronoiBinMapper(dfunc, centers) self.bin_target_counts = np.empty((self.bin_mapper.nbins, ), np.int) self.bin_target_counts[...] = 10
def initialize(self): rc = self.rc.config # pcoord parameters ff_data = np.load(rc.require(['west', 'elasticnetwork', 'ff_data'])) self.pcoord_ndim = 2 * ff_data['coordsA'].size self.pcoord_len = rc.require( ['west', 'elasticnetwork', 'blocks_per_iteration']) self.pcoord_dtype = pcoord_dtype self.target_count = rc.require(['west', 'system', 'target_count']) self.nbins = rc.require(['west', 'system', 'nbins']) # string method parameters self.cpos = self.pcoord_ndim // 2 self.natoms = ff_data['coordsA'].shape[0] self.sm_params = { 'slen': [self.nbins], 'dtau': 0.1, 'kappa': 0.2, 'fixed_ends': rc.require(['west', 'plugins', 1, 'fixed_ends'], type_=bool), 'slabels': range(self.cpos, self.pcoord_ndim) } self.init_pos = {} self.init_pos['coordsA'] = ff_data['coordsA'] self.init_pos['coordsB'] = ff_data['coordsB'] try: self.init_str_ends = np.load( rc.get(['west', 'plugins', 1, 'init_string_ends'], None)) except: self.init_str_ends = np.vstack((self.init_pos['coordsA'].ravel(), self.init_pos['coordsB'].ravel())) confA = self.init_str_ends[0] confB = self.init_str_ends[1] # Check and reshape coordinates assert confA.shape == confB.shape if len(confA.shape) == 1: confA = confA.reshape((self.cpos // 3, 3)) if len(confB.shape) == 1: confB = confB.reshape((self.cpos // 3, 3)) assert confA.shape == confB.shape == (self.cpos // 3, 3) # Build initial string centers = str_utils.interpolate_conformations(confA, confB, self.nbins) # Add dummy progress coordinates for velocities centers = np.hstack( (centers, np.zeros_like(centers))).astype(pcoord_dtype) self.bin_mapper = VoronoiBinMapper(dfunc, centers) self.bin_target_counts = np.zeros((self.bin_mapper.nbins, ), dtype=np.int_) self.bin_target_counts[...] = self.target_count