def resume(self, phases=None): """ Resume an existing set of alchemical free energy calculations found in current store directory. Parameters ---------- phases : list of str, optional, default=None The list of calculation phases (e.g. ['solvent', 'complex']) to resume. If not specified, all simulations in the store_directory will be resumed. """ # If no phases specified, construct a list of phases from the filename prefixes in the store directory. if phases is None: phases = utils.find_phases_in_store_directory( self._store_directory) self._phases = phases.keys() # Construct store filenames. self._store_filenames = { phase: os.path.join(self._store_directory, phase + '.nc') for phase in self._phases } # Ensure we can resume from each store file, processing override options. for phase in self._phases: # TODO: Use resume capabaility of repex to resume and modify any parameters we can change. store_filename = self._store_filenames[phase] pass # Record we are now initialized. self._initialized = True return
def resume(self, phases=None): """ Resume an existing set of alchemical free energy calculations found in current store directory. Parameters ---------- phases : list of str, optional, default=None The list of calculation phases (e.g. ['solvent', 'complex']) to resume. If not specified, all simulations in the store_directory will be resumed. """ # If no phases specified, construct a list of phases from the filename prefixes in the store directory. if phases is None: phases = utils.find_phases_in_store_directory(self._store_directory) self._phases = phases.keys() # Construct store filenames. self._store_filenames = { phase : os.path.join(self._store_directory, phase + '.nc') for phase in self._phases } # Ensure we can resume from each store file, processing override options. for phase in self._phases: # TODO: Use resume capabaility of repex to resume and modify any parameters we can change. store_filename = self._store_filenames[phase] pass # Record we are now initialized. self._initialized = True return
def print_status(store_directory): """ Print a quick summary of simulation progress. Parameters ---------- store_directory : string The location of the NetCDF simulation output files. Returns ------- success : bool True is returned on success; False if some files could not be read. """ # Get NetCDF files phases = utils.find_phases_in_store_directory(store_directory) # Process each netcdf file. for phase, fullpath in phases.items(): # Check that the file exists. if not os.path.exists(fullpath): # Report failure. logger.info("File %s not found." % fullpath) logger.info( "Check to make sure the right directory was specified, and 'yank setup' has been run." ) return False # Open NetCDF file for reading. logger.debug( "Opening NetCDF trajectory file '%(fullpath)s' for reading..." % vars()) ncfile = netcdf.Dataset(fullpath, 'r') # Read dimensions. niterations = ncfile.variables['positions'].shape[0] nstates = ncfile.variables['positions'].shape[1] natoms = ncfile.variables['positions'].shape[2] # Print summary. logger.info("%s" % phase) logger.info(" %8d iterations completed" % niterations) logger.info(" %8d alchemical states" % nstates) logger.info(" %8d atoms" % natoms) # TODO: Print average ns/day and estimated completion time. # Close file. ncfile.close() return True
def print_status(store_directory): """ Print a quick summary of simulation progress. Parameters ---------- store_directory : string The location of the NetCDF simulation output files. Returns ------- success : bool True is returned on success; False if some files could not be read. """ # Get NetCDF files phases = utils.find_phases_in_store_directory(store_directory) # Process each netcdf file. for phase, fullpath in phases.items(): # Check that the file exists. if not os.path.exists(fullpath): # Report failure. logger.info("File %s not found." % fullpath) logger.info("Check to make sure the right directory was specified, and 'yank setup' has been run.") return False # Open NetCDF file for reading. logger.debug("Opening NetCDF trajectory file '%(fullpath)s' for reading..." % vars()) ncfile = netcdf.Dataset(fullpath, 'r') # Read dimensions. niterations = ncfile.variables['positions'].shape[0] nstates = ncfile.variables['positions'].shape[1] natoms = ncfile.variables['positions'].shape[2] # Print summary. logger.info("%s" % phase) logger.info(" %8d iterations completed" % niterations) logger.info(" %8d alchemical states" % nstates) logger.info(" %8d atoms" % natoms) # TODO: Print average ns/day and estimated completion time. # Close file. ncfile.close() return True