def conformer_to_stat_values(conformer): """Beam transform to produce stats values for later aggregation. Each output will be a tuple of primary_key, secondary_key and these will be aggregated as counts. Args: conformer: dataset_pb2.Conformer Yields: primary_key, secondary_key """ # Yield the values for all the relevant error fields. for field in [ 'status', 'warn_t1', 'warn_t1_excess', 'warn_bse_b5_b6', 'warn_bse_cccsd_b5', 'warn_exc_lowest_excitation', 'warn_exc_smallest_oscillator', 'warn_exc_largest_oscillator', 'warn_vib_linearity', 'warn_vib_imaginary', 'warn_num_neg', 'error_nstat1', 'error_nstatc', 'error_nstatt', 'error_frequencies' ]: yield 'errors.' + field, getattr(conformer.properties.errors, field) yield 'fate', dataset_pb2.Conformer.FateCategory.Name(conformer.fate) yield 'num_initial_geometries', len(conformer.initial_geometries) yield 'num_duplicates', len(conformer.duplicate_of) if not conformer.duplicated_by: yield 'num_topologies', len(conformer.bond_topologies) for field in smu_utils_lib.find_zero_values(conformer): yield 'zero_field', field
def molecule_to_stat_values(molecule): """Beam transform to produce stats values for later aggregation. Each output will be a tuple of primary_key, secondary_key and these will be aggregated as counts. Args: molecule: dataset_pb2.Molecule Yields: primary_key, secondary_key """ # Yield the values for all the relevant error fields. for field in [ 'status', 'warn_t1', 'warn_t1_excess', 'warn_bse_b5_b6', 'warn_bse_cccsd_b5', 'warn_exc_lowest_excitation', 'warn_exc_smallest_oscillator', 'warn_exc_largest_oscillator', 'warn_vib_linearity', 'warn_vib_imaginary', 'warn_num_neg', 'error_nstat1', 'error_nstatc', 'error_nstatt', 'error_frequencies' ]: yield 'errors.' + field, getattr(molecule.properties.errors, field) yield 'fate', dataset_pb2.Properties.FateCategory.Name( molecule.properties.errors.fate) yield 'num_initial_geometries', len( [g for g in molecule.initial_geometries if g.atom_positions]) yield 'num_duplicates', len(molecule.duplicate_of) for field in smu_utils_lib.find_zero_values(molecule): yield 'zero_field', field if not molecule.duplicated_by and molecule.properties.errors.status < 512: yield 'num_topologies', len(molecule.bond_topologies) yield 'num_topologies_itc', len([ None for bt in molecule.bond_topologies if bt.source & dataset_pb2.BondTopology.SOURCE_ITC ]) yield 'num_topologies_mlcr', len([ None for bt in molecule.bond_topologies if bt.source & dataset_pb2.BondTopology.SOURCE_MLCR ]) yield 'num_topologies_csd', len([ None for bt in molecule.bond_topologies if bt.source & dataset_pb2.BondTopology.SOURCE_CSD ]) for bt in molecule.bond_topologies: yield 'bt_source', bt.source
def test_excitation(self): conformer = get_stage2_conformer() conformer.properties.excitation_energies_cc2.value[2] = 0.0 got = list(smu_utils_lib.find_zero_values(conformer)) self.assertEqual(got, ['excitation_energies_cc2'])
def test_scalar(self): conformer = get_stage2_conformer() conformer.properties.lumo_b3lyp_6_31ppgdp.value = 0.0 got = list(smu_utils_lib.find_zero_values(conformer)) self.assertEqual(got, ['lumo_b3lyp_6_31ppgdp'])
def test_no_zeroes(self): conformer = get_stage2_conformer() got = list(smu_utils_lib.find_zero_values(conformer)) self.assertEqual(got, [])
def test_atomic(self): conformer = get_stage2_conformer() conformer.properties.partial_charges_esp_fit_hf_6_31gd.values[3] = 0.0 got = list(smu_utils_lib.find_zero_values(conformer)) self.assertEqual(got, ['partial_charges_esp_fit_hf_6_31gd'])