示例#1
0
    def get_plams_settings(self):
        """Returns a plams setting object."""

        sett = plams.Settings()
        sett.input.basis.type = self.basis_name.upper()
        if self.basis_name.upper() in self.additional_basis_type:
            sett.input.basis.path = self.additional_basis_path
        sett.input.basis.core = 'None'
        sett.input.symmetry = 'nosym'

        if self.scf.lower() == 'hf':
            sett.input.XC.HartreeFock = ''

        elif self.scf.lower() == 'dft':
            sett.input.XC.LDA = 'VWN'

        # correct unit
        if self.units == 'angs':
            sett.input.units.length = 'Angstrom'
        elif self.units == 'bohr':
            sett.input.units.length = 'Bohr'

        # total energy
        sett.input.totalenergy = True

        return sett
示例#2
0
    def __init__(self, mol_file, job_name, settings=None, geo_opt=False):
        self.job_name = job_name
        self.mol = plams.Molecule(mol_file)
        #sort atoms to prevent errors in ADF
        self.mol.atoms.sort(key=lambda x: x.symbol)

        self.settings = plams.Settings()
        self._set_std_settings(geo_opt)

        if settings is not None:
            self.settings.update(settings)
示例#3
0
def test_saving_plams_settings(historian: mincepy.Historian):
    from scm import plams

    settings = plams.Settings()
    settings.sub.a = 'a'
    settings.sub.b = 'b'
    settings.top = 'top'

    settings_id = historian.save(settings)
    del settings

    loaded = historian.load(settings_id)
    assert isinstance(loaded.sub, plams.Settings)
    assert loaded.sub.a == 'a'
    assert loaded.sub.b == 'b'
    assert loaded.top == 'top'
 def adf_grads():
     """
     Settings for running gradients calculation
     """
     adf = plams.Settings()
     adf.input.SYMMETRY = 'NOSYM'
     adf.input.BASIS.type = 'DZP'
     adf.input.BASIS.core = 'Large'
     adf.input.XC.GGA = 'BP86'
     adf.input.RESPONSE.Dipole = ""
     adf.input.RESPONSE.AllComponents = ""
     #  adf.input.XC.DISPERSION = 'GRIMME3 BJDAMP'
     #adf.input.RESTART.File = '/Users/janani/Desktop/Raman_trials/ADF_new_version_trials/H2/H2_bp86_sp/H2_bp86_sp.t21'
     #adf.input.RESTART.nogeo = ''
     adf.input.Gradient = ""
     return adf
示例#5
0
    def run(self):
        """Run the calculation

        Raises:
            ValueError: [description]

        Returns:
            np.ndarray -- molecular orbital matrix
        """

        wd = ''.join(self.atoms) + '_' + self.basis_name
        t21_name = wd + '.t21'
        plams_wd = './plams_workdir'
        t21_path = os.path.join(plams_wd, os.path.join(wd, t21_name))

        if os.path.isfile(t21_name):

            print('Reusing previous calculation from ', t21_name)
            kf = plams.KFFile(t21_name)
            e = kf.read('Total Energy', 'Total energy')

        else:

            # init PLAMS
            plams.init()
            plams.config.log.stdout = -1
            plams.config.erase_workdir = True

            # create the molecule
            mol = plams.Molecule()
            for at, xyz in zip(self.atoms, self.atom_coords):
                mol.add_atom(plams.Atom(symbol=at, coords=tuple(xyz)))

            # settings in PLAMS
            sett = plams.Settings()
            sett.input.basis.type = self.basis_name.upper()
            sett.input.basis.core = 'None'
            sett.input.symmetry = 'nosym'
            sett.input.XC.HartreeFock = ''

            # correct unit
            if self.units == 'angs':
                sett.input.units.length = 'Angstrom'
            elif self.units == 'bohr':
                sett.input.units.length = 'Bohr'

            # total energy
            sett.input.totalenergy = True

            # run the ADF job
            job = plams.ADFJob(molecule=mol, settings=sett, name=wd)
            job.run()

            # read the energy from the t21 file
            e = job.results.readkf('Total Energy', 'Total energy')

            # make a copy of the t21 file
            shutil.copyfile(t21_path, t21_name)
            shutil.rmtree(plams_wd)

        # print energy
        print('== SCF Energy : ', e)
        self.out_file = t21_name
示例#6
0
functionals = ['PBE']

print(
    f'Starting singlepoint DFT and DFTB vibration calculations for {len(mol_names)} molecules from the {dataset_name} dataset:'
)
print('Molecules:')
[print('\t' + str(i + 1), n) for i, n in enumerate(mol_names)]

for f in functionals:
    print(
        f'Starting geo-opt DFT vibration calculations for {len(mol_names)} molecules from the {dataset_name} dataset with functional {f}'
    )

    for n, p in zip(mol_names, mol_paths):
        settings = plams.Settings()

        if f == 'PBE':
            settings.input.XC.GGA = 'PBE'

            kf_DFT = jobs.DFTJob(p, job_name=f'{n}_DFT',
                                 geo_opt=True).run(init=False)
            shutil.copy2(kf_DFT, f'{kf_dir}/{n}_DFT.t21')

        if f == 'DFTB3':
            settings.input.DFTB.Model = 'DFTB3'
            settings.input.DFTB.ResourcesDir = 'DFTB.org/3ob-3-1'

            kf_DFTB = jobs.DFTBJob(p, job_name=f'{n}_{f}_DFTB',
                                   geo_opt=True).run(init=False)
            shutil.copy2(kf_DFTB, f'{kf_dir}/{n}_{f}_DFTB.rkf')