def main(): """ Main function. """ m_description = "Welcome to the Chemical Environment Package." parser = ArgumentParser(description=m_description) setup_help = "Used to setup the configuration of the package " setup_help += "(MaterialsProject access, ICSD database access, package options, ...)" parser.add_argument("-s", "--setup", help=setup_help, action="store_true") parser.add_argument( "-m", "--message-level", help="Message level (DEBUG, INFO, WARNING, ERROR or CRITICAL - " "default : WARNING)", default="WARNING", ) args = parser.parse_args() if args.setup: chemenv_config = ChemEnvConfig.auto_load() chemenv_config.setup() print("\n Setup completed") else: chemenv_config = ChemEnvConfig.auto_load() welcome(chemenv_config) logging.basicConfig( format="%(levelname)s:%(module)s:%(funcName)s:%(message)s", level=args.message_level, ) compute_environments(chemenv_config) thankyou()
def main(): m_description = 'Welcome to the Chemical Environment Package.' parser = ArgumentParser(description=m_description) setup_help = 'Used to setup the configuration of the package ' setup_help += '(MaterialsProject access, ICSD database access, package options, ...)' parser.add_argument('-s', '--setup', help=setup_help, action='store_true') parser.add_argument( '-m', '--message-level', help='Message level (DEBUG, INFO, WARNING, ERROR or CRITICAL - ' 'default : WARNING)', default='WARNING') args = parser.parse_args() if args.setup: chemenv_config = ChemEnvConfig.auto_load() chemenv_config.setup() print('\n Setup completed') else: chemenv_config = ChemEnvConfig.auto_load() welcome(chemenv_config) logging.basicConfig( format='%(levelname)s:%(module)s:%(funcName)s:%(message)s', level=args.message_level) compute_environments(chemenv_config) thankyou()
def test_chemenv_config(self): config = ChemEnvConfig() self.assertFalse(config.has_materials_project_access) package_options = ChemEnvConfig.DEFAULT_PACKAGE_OPTIONS package_options['default_max_distance_factor'] = 1.8 config = ChemEnvConfig(package_options=package_options) print(repr(config.package_options_description())) self.assertEqual( config.package_options_description(), 'Package options :\n' ' - Maximum distance factor : 1.8000\n' ' - Default strategy is "SimplestChemenvStrategy" :\n' ' Simplest ChemenvStrategy using fixed angle and distance parameters \n' ' for the definition of neighbors in the Voronoi approach. \n' ' The coordination environment is then given as the one with the \n' ' lowest continuous symmetry measure.\n' ' with options :\n' ' - distance_cutoff : 1.4\n' ' - angle_cutoff : 0.3\n' ' - additional_condition : 1\n' ' - continuous_symmetry_measure_cutoff : 10.0\n') config.save(root_dir='tmp_dir') config = config.auto_load(root_dir='tmp_dir') self.assertEqual(config.package_options, package_options)
def test_chemenv_config(self): with ScratchDir("."): config = ChemEnvConfig() if SETTINGS.get("PMG_MAPI_KEY", "") != "": self.assertTrue(config.has_materials_project_access) else: self.assertFalse(config.has_materials_project_access) package_options = ChemEnvConfig.DEFAULT_PACKAGE_OPTIONS package_options["default_max_distance_factor"] = 1.8 config = ChemEnvConfig(package_options=package_options) self.assertEqual( config.package_options_description(), "Package options :\n" " - Maximum distance factor : 1.8000\n" ' - Default strategy is "SimplestChemenvStrategy" :\n' " Simplest ChemenvStrategy using fixed angle and distance parameters \n" " for the definition of neighbors in the Voronoi approach. \n" " The coordination environment is then given as the one with the \n" " lowest continuous symmetry measure.\n" " with options :\n" " - distance_cutoff : 1.4\n" " - angle_cutoff : 0.3\n" " - additional_condition : 1\n" " - continuous_symmetry_measure_cutoff : 10.0\n", ) config.save(root_dir="tmp_dir") config = config.auto_load(root_dir="tmp_dir") self.assertEqual(config.package_options, package_options)
def test_chemenv_config(self): config = ChemEnvConfig() self.assertFalse(config.has_materials_project_access) package_options = ChemEnvConfig.DEFAULT_PACKAGE_OPTIONS package_options['default_max_distance_factor'] = 1.8 config = ChemEnvConfig(package_options=package_options) print(repr(config.package_options_description())) self.assertEqual(config.package_options_description(), 'Package options :\n' ' - Maximum distance factor : 1.8000\n' ' - Default strategy is "SimplestChemenvStrategy" :\n' ' Simplest ChemenvStrategy using fixed angle and distance parameters \n' ' for the definition of neighbors in the Voronoi approach. \n' ' The coordination environment is then given as the one with the \n' ' lowest continuous symmetry measure.\n' ' with options :\n' ' - distance_cutoff : 1.4\n' ' - angle_cutoff : 0.3\n' ' - additional_condition : 1\n' ' - continuous_symmetry_measure_cutoff : 10.0\n') config.save(root_dir='tmp_dir') config = config.auto_load(root_dir='tmp_dir') self.assertEqual(config.package_options, package_options)
def run_script(): m_description = 'Welcome to the Chemical Environment Package.' parser = ArgumentParser(description=m_description) setup_help = 'Used to setup the configuration of the package ' setup_help += '(MaterialsProject access, ICSD database access, package options, ...)' parser.add_argument('-s', '--setup', help=setup_help, action='store_true') parser.add_argument('-m', '--message-level', help='Message level (DEBUG, INFO, WARNING, ERROR or CRITICAL)', default='WARNING') args = parser.parse_args() if args.setup: chemenv_config = ChemEnvConfig.auto_load() chemenv_config.setup() print('\n Setup completed') else: chemenv_config = ChemEnvConfig.auto_load() welcome(chemenv_config) logging.basicConfig(format='%(levelname)s:%(module)s:%(funcName)s:%(message)s', level=args.message_level) compute_environments(chemenv_config) thankyou()