Ejemplo n.º 1
0
def check_opts_set(file_pattern,
                   folder='',
                   server=None,
                   username=None,
                   passwrd=None):
    analysis = pg.Analysis(folderpath=folder,
                           server=server,
                           username=username,
                           passwrd=passwrd)
    files = analysis.folder.list_files(file_pattern)
    if not files:
        return None

    for file_name in files:
        analysis.add_run({'File': file_name},
                         opt_fname=file_name,
                         add_if_error=True)

    analysis.add_basic_properties(['optimised'])
    analysis.add_basic_properties(['opt_error'])
    analysis.add_mol_property('E(au)', 'get_optimisation_E', units='hartree')
    analysis.add_mol_property('allE',
                              'get_optimisation_E',
                              units='hartree',
                              final=False)

    df = analysis.get_table(row_index='File')
    df['Steps'] = df.allE.map(lambda x: x.shape[0])
    df['Ediff'] = df.allE.map(lambda x: x[-1] - x[-2]
                              if x.shape[0] > 1 else np.nan)
    return df.drop('allE', 1)
Ejemplo n.º 2
0
    def test_tbl_graphs(self, gtype, share_plot, **kwargs):

        analysis = pg.Analysis(folder_obj=pg.get_test_folder())
        analysis.add_runs(
            headers=['Cation', 'Anion', 'Initial'],
            values=[['emim'], ['cl'], ['B', 'F', 'FE']],
            init_pattern='*{0}-{1}_{2}_init.com',
            opt_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_opt*unfrz.log',
            freq_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_freq*.log',
            nbo_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_pop-nbo-full-*.log',
            alignto=[3, 2, 1],
            atom_groups={
                'emim': list(range(20)),
                'cl': [20]
            })

        fig, caption = analysis.plot_mol_graphs(
            gtype=gtype,
            share_plot=share_plot,
            info_columns=['Cation', 'Anion', 'Initial'],
            max_cols=2,
            info_incl_id=True,
            tick_rotation=45,
            **kwargs)

        that.assert_equal(type(caption), str)
Ejemplo n.º 3
0
    def test_add_runs_with_errors(self, add_if_error, count):

        analysis = pg.Analysis(folder_obj=self.folder)
        errors = analysis.add_runs(
            headers=['Cation', 'Anion', 'Initial'],
            values=[['emim'], ['cl'], ['B', 'Error']],
            init_pattern='*{0}-{1}_{2}_init.com',
            opt_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_opt*unfrz.log',
            freq_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_freq*.log',
            nbo_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_pop-nbo-full-*.log',
            add_if_error=add_if_error)

        that.assert_equals(analysis.count_runs(), count)
Ejemplo n.º 4
0
    def test_add_mol_property(self, name, prop, *args, **kwargs):
        analysis = pg.Analysis(folder_obj=self.folder)
        analysis.add_runs(
            headers=['Cation', 'Anion', 'Initial'],
            values=[['emim'], ['cl'], ['B', 'F', 'FE']],
            init_pattern='*{0}-{1}_{2}_init.com',
            opt_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_opt*unfrz.log',
            freq_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_freq*.log',
            nbo_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_pop-nbo-full-*.log',
            alignto=[3, 2, 1],
            atom_groups={
                'emim': list(range(20)),
                'cl': [20]
            })

        analysis.add_mol_property(name, prop, *args, **kwargs)
Ejemplo n.º 5
0
    def test_add_runs(self):

        analysis = pg.Analysis(folder_obj=self.folder)
        analysis.add_runs(
            headers=['Cation', 'Anion', 'Initial'],
            values=[['emim'], ['cl'], ['B', 'F', 'FE']],
            init_pattern='*{0}-{1}_{2}_init.com',
            opt_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_opt*unfrz.log',
            freq_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_freq*.log',
            nbo_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_pop-nbo-full-*.log',
            alignto=[3, 2, 1],
            atom_groups={
                'emim': list(range(20)),
                'cl': [20]
            })

        that.assert_equals(analysis.count_runs(), 3)
Ejemplo n.º 6
0
    def test_add_run_fails(self):

        analysis = pg.Analysis(folder_obj=self.folder)

        errors = analysis.add_run(
            identifiers={'Test': 'test'},
            init_fname='none.com',
            opt_fname='*emim-cl_B_6-311+g-d-p-_gd3bj_opt*unfrz.log',
            freq_fname='*emim-cl_B_6-311+g-d-p-_gd3bj_freq*.log',
            nbo_fname='*emim-cl_B_6-311+g-d-p-_gd3bj_pop-nbo-full-*.log',
            alignto=[3, 2, 1],
            atom_groups={
                'emim': list(range(20)),
                'cl': [20]
            })
        that.assert_equals(len(errors), 1)
        that.assert_equals(analysis.count_runs(), 0)
Ejemplo n.º 7
0
def check_freqs_set(file_pattern,
                    folder='',
                    server=None,
                    username=None,
                    passwrd=None):
    analysis = pg.Analysis(folderpath=folder,
                           server=server,
                           username=username,
                           passwrd=passwrd)
    files = analysis.folder.list_files(file_pattern)
    if not files:
        return None

    for file_name in files:
        analysis.add_run({'File': file_name},
                         freq_fname=file_name,
                         add_if_error=True)
        analysis.add_basic_properties(['conformer'])

    df = analysis.get_table(row_index='File')
    return df
Ejemplo n.º 8
0
    def test_tbl_images(self, mtype):

        analysis = pg.Analysis(folder_obj=self.folder)
        analysis.add_runs(
            headers=['Cation', 'Anion', 'Initial'],
            values=[['emim'], ['cl'], ['B', 'F', 'FE']],
            init_pattern='*{0}-{1}_{2}_init.com',
            opt_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_opt*unfrz.log',
            freq_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_freq*.log',
            nbo_pattern='*{0}-{1}_{2}_6-311+g-d-p-_gd3bj_pop-nbo-full-*.log',
            alignto=[3, 2, 1],
            atom_groups={
                'emim': list(range(20)),
                'cl': [20]
            })

        fig, caption = analysis.plot_mol_images(
            mtype=mtype,
            max_cols=2,
            info_columns=['Cation', 'Anion', 'Initial'],
            rotations=[[0, 0, 90]])
Ejemplo n.º 9
0
 def test_initialises(self):
     pg.Analysis(folder_obj=self.folder)