Example #1
0
    def test_atomtyper_elemental(self):
        """
        Test elemental atomtype sampler for hydrogen
        """
        atomtype_sampler = smarty.AtomTypeSampler(
            self.mols_alkethoh,
            self.basetypes,
            self.basetypes,
            self.combine_decs,
            replacements_filename=self.replacements,
            reference_typed_molecules=self.mols_alkethoh_ref,
            temperature=0.1,
            verbose=False,
            decorator_behavior='combinatorial-decorators',
            element=1)
        # run sampler with optional outputs
        traj = 'test_smarty.csv'
        plot = 'test_smarty.pdf'
        atomtype_sampler.run(5, traj)
        # test trajectory analysis functions on smarty output
        timeseries = score_utils.load_trajectory(traj)
        scores_vs_time = score_utils.scores_vs_time(timeseries)
        score_utils.create_plot_file(traj, plot, True, False)

        # check if score is 100% at first iteration
        if scores_vs_time['all'][0] == 1.0:
            raise Exception(
                "Scoring problem, 100% at first iteration for total")
Example #2
0
 def test_random_sampler(self):
     """
     Test FragmentSampler runs for 10 iterations with no failures
     Test score_utils functions with the outputFile
     """
     typetag = 'Torsion'
     sampler = FragmentSampler(self.molecules,
                               typetag,
                               self.atom_OR_bases,
                               self.atom_OR_decors,
                               self.atom_AND_decors,
                               self.bond_OR_bases,
                               self.bond_AND_decors,
                               AtomIndexOdds=self.atom_odds,
                               BondIndexOdds=self.bond_odds,
                               replacements=self.replacements,
                               initialtypes=None,
                               SMIRFF=self.SMIRFF,
                               temperature=0.0,
                               outputFile=self.outputFile)
     fracfound = sampler.run(10)
     # load_trajectory converts csv file to dictionary
     timeseries = score_utils.load_trajectory('%s.csv' % self.outputFile)
     # scores_vs_time converts num/den entries to fractional scores
     scores_vs_time = score_utils.scores_vs_time(timeseries)
     # test plotting function
     score_utils.create_plot_file('%s.csv' % self.outputFile,
                                  '%s.pdf' % self.outputFile)
 def test_random_sampler(self):
     """
     Test FragmentSampler runs for 10 iterations with no failures
     Test score_utils functions with the outputFile
     """
     typetag = 'Torsion'
     sampler = FragmentSampler(self.molecules, typetag, self.atom_OR_bases,
             self.atom_OR_decors, self.atom_AND_decors, self.bond_OR_bases,
             self.bond_AND_decors,
             AtomIndexOdds = self.atom_odds, BondIndexOdds = self.bond_odds,
             replacements = self.replacements, initialtypes = None,
             SMIRFF = self.SMIRFF, temperature = 0.0, outputFile = self.outputFile)
     fracfound = sampler.run(10)
     # load_trajectory converts csv file to dictionary
     timeseries = score_utils.load_trajectory('%s.csv' % self.outputFile)
     # scores_vs_time converts num/den entries to fractional scores
     scores_vs_time = score_utils.scores_vs_time(timeseries)
     # test plotting function
     score_utils.create_plot_file('%s.csv' % self.outputFile, '%s.pdf' % self.outputFile)