Ejemplo n.º 1
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)
Ejemplo n.º 2
0
import pyscf.lib.parameters as param

mol0 = gto.Mole()
mol0.atom = [
    [1, (0., 1., 1.)],
    ["O1", (0., 0., 0.)],
    [1, (1., 1., 0.)],
]
mol0.nucmod = {"O": 'gaussian', 3: 'g'}
mol0.unit = 'ang'
mol0.basis = {
    "O": [
        (0, 0, (15, 1)),
    ] + gto.etbs((
        (0, 4, 1, 1.8),
        (1, 3, 2, 1.8),
        (2, 2, 1, 1.8),
    )),
    "H": [
        (0, 0, (1, 1, 0), (3, 3, 1), (5, 1, 0)),
        (1, -2, (1, 1)),
    ]
}
mol0.symmetry = 1
mol0.charge = 1
mol0.spin = 1
mol0.verbose = 7
mol0.ecp = {'O1': 'lanl2dz'}
ftmp = tempfile.NamedTemporaryFile()
mol0.output = ftmp.name
mol0.build()
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
import numpy
import scipy.linalg
from pyscf import gto
from pyscf import lib
import pyscf.lib.parameters as param

mol0 = gto.Mole()
mol0.atom = [
    [1  , (0.,1.,1.)],
    ["O1", (0.,0.,0.)],
    [1  , (1.,1.,0.)], ]
mol0.nucmod = { "O":'gaussian', 3:'g' }
mol0.unit = 'ang'
mol0.basis = {
    "O": [(0, 0, (15, 1)), ] + gto.etbs(((0, 4, 1, 1.8),
                                         (1, 3, 2, 1.8),
                                         (2, 2, 1, 1.8),)),
    "H": [(0, 0, (1, 1, 0), (3, 3, 1), (5, 1, 0)),
          (1, -2, (1, 1)), ]}
mol0.symmetry = 1
mol0.charge = 1
mol0.spin = 1
mol0.verbose = 7
mol0.ecp = {'O1': 'lanl2dz'}
ftmp = tempfile.NamedTemporaryFile()
mol0.output = ftmp.name
mol0.build()

def tearDownModule():
    global mol0, ftmp
    mol0.stdout.close()
Ejemplo n.º 5
0
import scipy.linalg
from pyscf import gto
from pyscf import lib
import pyscf.lib.parameters as param
from pyscf.lib.exceptions import BasisNotFoundError

mol0 = gto.Mole()
mol0.atom = [
    [1  , (0.,1.,1.)],
    ["O1", (0.,0.,0.)],
    [1  , (1.,1.,0.)], ]
mol0.nucmod = { "O":'gaussian', 3:'g' }
mol0.unit = 'ang'
mol0.basis = {
    "O": [(0, 0, (15, 1)), ] + gto.etbs(((0, 4, 1, 1.8),
                                         (1, 3, 2, 1.8),
                                         (2, 2, 1, 1.8),)),
    "H": [(0, 0, (1, 1, 0), (3, 3, 1), (5, 1, 0)),
          (1, -2, (1, 1)), ]}
mol0.symmetry = 1
mol0.charge = 1
mol0.spin = 1
mol0.verbose = 7
mol0.ecp = {'O1': 'lanl2dz'}
ftmp = tempfile.NamedTemporaryFile()
mol0.output = ftmp.name
mol0.build()

def tearDownModule():
    global mol0, ftmp
    mol0.stdout.close()
Ejemplo n.º 6
0
    basis = {'O': 'ano@3s2p',  # Truncate the ANO basis and keep only 9
                               # functions (3s, 2p) for O atom.
             'H': 'ccpvdz@1s'  # One s function from cc-pVDZ basis
            }
)


#
# Even tempered gaussian basis
#
mol = gto.M(
    atom = '''O 0 0 0; H1 0 1 0; H2 0 0 1''',
    basis = {'H': 'sto3g',
# even-temper gaussians alpha*beta^i, where i = 0,..,n
#                                  (l, n, alpha, beta)
             'O': gto.etbs([(0, 4, 1.5, 2.2),  # s-function
                            (1, 2, 0.5, 2.2)]) # p-function
            }
)


#
# Internal format (not recommended). See also
# pyscf/gto/basis/dzp_dunning.py  as an example of internal format
#
# basis = {atom_type1:[[angular_momentum
#                       (GTO-exp1, contract-coeff11, contract-coeff12),
#                       (GTO-exp2, contract-coeff21, contract-coeff22),
#                       (GTO-exp3, contract-coeff31, contract-coeff32),
#                       ...],
#                      [angular_momentum
#                       (GTO-exp1, contract-coeff11, contract-coeff12),