Exemple #1
0
mol = gto.M(
    atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
    basis = {'O': gto.parse('''
# Parse NWChem format basis string (see https://bse.pnl.gov/bse/portal).
# Comment lines are ignored
#BASIS SET: (6s,3p) -> [2s,1p]
O    S
    130.7093200              0.15432897       
     23.8088610              0.53532814       
      6.4436083              0.44463454       
O    SP
      5.0331513             -0.09996723             0.15591627       
      1.1695961              0.39951283             0.60768372       
      0.3803890              0.70011547             0.39195739       
                                '''),
             'H1': gto.load(basis_file_from_user, 'H'),
             'H2': gto.load('sto-3g', 'He')  # or use basis of another atom
            }
)

mol = gto.M(
    atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
    basis = {'O': 'unc-ccpvdz', # prefix "unc-" will uncontract the ccpvdz basis.
                                # It is equivalent to assigning
                                #   'O': gto.uncontract(gto.load('ccpvdz', 'O')),
             'H': 'ccpvdz'  # H1 H2 will use the same basis ccpvdz
            }
)


mol = gto.M(
Exemple #2
0
    def test_format_basis(self):
        mol = gto.M(atom='''O 0 0 0; 1 0 1 0; H 0 0 1''', basis={8: 'ccpvdz'})
        self.assertEqual(mol.nao_nr(), 14)

        mol = gto.M(atom='''O 0 0 0; H:1 0 1 0; H@2 0 0 1''',
                    basis={
                        'O': 'ccpvdz',
                        'H:1': 'sto3g',
                        'H': 'unc-iglo3'
                    })
        self.assertEqual(mol.nao_nr(), 32)

        mol = gto.M(atom='''O 0 0 0; H1 0 1 0; H2 0 0 1''',
                    basis={
                        'default': ('6-31g', [[0, [.05, 1.]], []]),
                        'H2': 'sto3g'
                    })
        self.assertEqual(mol.nao_nr(), 14)

        mol = gto.M(
            atom='''O 0 0 0; H1 0 1 0; H2 0 0 1''',
            basis={
                'H1':
                gto.parse('''
# Parse NWChem format basis string (see https://bse.pnl.gov/bse/portal).
# Comment lines are ignored
#BASIS SET: (6s,3p) -> [2s,1p]
        H    S
              2.9412494             -0.09996723
              0.6834831              0.39951283
              0.2222899              0.70011547
        H    S
              2.9412494             0.15591627
              0.6834831             0.60768372
              0.2222899             0.39195739
                                    ''',
                          optimize=True),
                'O':
                'unc-ccpvdz',
                'H2':
                gto.load('sto-3g', 'He')  # or use basis of another atom
            })
        self.assertEqual(mol.nao_nr(), 29)

        mol = gto.M(
            atom='''O 0 0 0; H1 0 1 0; H2 0 0 1''',
            basis={
                'H': [
                    'sto3g', '''unc
        C    S
             71.6168370              0.15432897
             13.0450960              0.53532814
              3.5305122              0.44463454
        C    SP
              2.9412494             -0.09996723             0.15591627
              0.6834831              0.39951283             0.60768372
              0.2222899              0.70011547             0.39195739
        '''
                ],
                'O':
                mol.expand_etbs([
                    (0, 4, 1.5, 2.2),  # s-function
                    (1, 2, 0.5, 2.2)
                ])  # p-function
            })
        self.assertEqual(mol.nao_nr(), 42)

        mol = gto.M(atom='''O 0 0 0; H1 0 1 0; H2 0 0 1''',
                    basis=('sto3g', 'ccpvdz', '3-21g',
                           gto.etbs([(0, 4, 1.5, 2.2), (1, 2, 0.5, 2.2)]),
                           [[0, numpy.array([1e3, 1.])]]))
        self.assertEqual(mol.nao_nr(), 77)

        mol.atom = 'Hg'
        mol.basis = 'ccpvdz'
        self.assertRaises(RuntimeError, mol.build)
This example illustrates how basis sets can be directly obtained from
a local copy of the Basis Set Exchange.
'''

mol = gto.M(
    atom = '''
N          0.6683566134        0.2004327755        0.0000000000
H          0.9668193796       -0.3441960976        0.8071193402
H          0.9668193796       -0.3441960976       -0.8071193402
F         -0.7347916126       -0.0467759204        0.0000000000
''',
    basis = {
        # The BSE returns the basis in NWChem format, which is then
        # parsed in PySCF as usual. It is also easy to mix various
        # basis sets, although this should only be done by experts.
        'H' : gto.load(basis_set_exchange.api.get_basis('sto-2g', elements='H', fmt='nwchem'), 'H'),
        'N' : gto.load(basis_set_exchange.api.get_basis('svp (dunning-hay)', elements='N', fmt='nwchem'), 'N'),
        'F' : gto.load(basis_set_exchange.api.get_basis('2zapa-nr', elements='F', fmt='nwchem'), 'F'),
    },
    verbose = 4
)


mol = gto.M(
    atom = '''
N          0.6683566134        0.2004327755        0.0000000000
H          0.9668193796       -0.3441960976        0.8071193402
H          0.9668193796       -0.3441960976       -0.8071193402
F         -0.7347916126       -0.0467759204        0.0000000000
''',
    basis = {
Exemple #4
0
    def test_format_basis(self):
        mol = gto.M(atom = '''O 0 0 0; 1 0 1 0; H 0 0 1''',
                    basis = {8: 'ccpvdz'})
        self.assertEqual(mol.nao_nr(), 14)

        mol = gto.M(atom = '''O 0 0 0; H:1 0 1 0; H@2 0 0 1''',
                    basis = {'O': 'ccpvdz', 'H:1': 'sto3g', 'H': 'unc-iglo3'})
        self.assertEqual(mol.nao_nr(), 32)

        mol = gto.M(
            atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
            basis = {'default': ('6-31g', [[0, [.05, 1.]], []]), 'H2': 'sto3g'}
        )
        self.assertEqual(mol.nao_nr(), 14)

        mol = gto.M(
            atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
            basis = {'H1': gto.parse('''
# Parse NWChem format basis string (see https://bse.pnl.gov/bse/portal).
# Comment lines are ignored
#BASIS SET: (6s,3p) -> [2s,1p]
        H    S
              2.9412494             -0.09996723
              0.6834831              0.39951283
              0.2222899              0.70011547
        H    S
              2.9412494             0.15591627
              0.6834831             0.60768372
              0.2222899             0.39195739
                                    ''', optimize=True),
                     'O': 'unc-ccpvdz',
                     'H2': gto.load('sto-3g', 'He')  # or use basis of another atom
                    }
        )
        self.assertEqual(mol.nao_nr(), 29)

        mol = gto.M(
            atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
            basis = {'H': ['sto3g', '''unc
        C    S
             71.6168370              0.15432897
             13.0450960              0.53532814
              3.5305122              0.44463454
        C    SP
              2.9412494             -0.09996723             0.15591627
              0.6834831              0.39951283             0.60768372
              0.2222899              0.70011547             0.39195739
        '''],
                     'O': mol.expand_etbs([(0, 4, 1.5, 2.2),  # s-function
                                           (1, 2, 0.5, 2.2)]) # p-function
                    }
        )
        self.assertEqual(mol.nao_nr(), 42)

        mol = gto.M(
            atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
            basis = ('sto3g', 'ccpvdz', '3-21g',
                     gto.etbs([(0, 4, 1.5, 2.2), (1, 2, 0.5, 2.2)]),
                    [[0, numpy.array([1e3, 1.])]])
        )
        self.assertEqual(mol.nao_nr(), 77)

        mol.atom = 'Hg'
        mol.basis = 'ccpvdz'
        self.assertRaises(RuntimeError, mol.build)
Exemple #5
0
 def test_to_general_contraction(self):
     b = gto.basis.to_general_contraction(gto.load('cc-pvtz', 'H'))
     self.assertEqual(len(b), 3)
     self.assertEqual(len(b[0]), 6)
     self.assertEqual(len(b[1]), 3)
     self.assertEqual(len(b[2]), 2)
Exemple #6
0
    atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
    basis = {'O': gto.parse('''
# Parse NWChem format basis string (see https://bse.pnl.gov/bse/portal).
# Comment lines are ignored
#BASIS SET: (6s,3p) -> [2s,1p]
O    S
    130.7093200              0.15432897
     23.8088610              0.53532814
      6.4436083              0.44463454
O    SP
      5.0331513             -0.09996723             0.15591627
      1.1695961              0.39951283             0.60768372
      0.3803890              0.70011547             0.39195739
                                '''),
             'H1': basis_file_from_user,
             'H2': gto.load('sto-3g', 'He')  # or use basis of another atom
            }
)

#
# Uncontracted basis, decontracting basis.
#
mol = gto.M(
    atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
    basis = {'O': 'unc-ccpvdz', # prefix "unc-" will uncontract the ccpvdz basis.
                                # It is equivalent to assigning
                                #   'O': gto.uncontract(gto.load('ccpvdz', 'O')),
             'H': 'ccpvdz'  # H1 H2 will use the same basis ccpvdz
            }
)