Beispiel #1
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Minimal Basis Iterative Stockholder (MBIS)'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
         ])
Beispiel #2
0
 def _init_log_base(self):
     if log.do_medium:
         log('Performing a density-based AIM analysis with a wavefunction as input.')
         log.deflist([
             ('Molecular grid', self._grid),
             ('Using local grids', self._local),
         ])
Beispiel #3
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Hirshfeld'),
             ('Proatomic DB',  self.proatomdb),
         ])
         log.cite('hirshfeld1977', 'the use of Hirshfeld partitioning')
Beispiel #4
0
 def _init_log_base(self):
     if log.do_medium:
         log('Performing a density-based AIM analysis with a wavefunction as input.')
         log.deflist([
             ('Molecular grid', self._grid),
             ('Using local grids', self._local),
         ])
Beispiel #5
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Minimal Basis Iterative Stockholder (MBIS)'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
         ])
Beispiel #6
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Hirshfeld'),
             ('Proatomic DB',  self.proatomdb),
         ])
         biblio.cite('hirshfeld1977', 'the use of Hirshfeld partitioning')
Beispiel #7
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Minimal Basis Iterative Stockholder (MBIS)'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
         ])
         biblio.cite('verstraelen2016', 'the use of MBIS partitioning')
Beispiel #8
0
 def _log_init(self):
     if log.do_medium:
         log('Initialized: %s' % self)
         log.deflist([
             ('Numbers', self._rgrid_map.keys()),
             ('Records', self._map.keys()),
         ])
         log.blank()
Beispiel #9
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Minimal Basis Iterative Stockholder (MBIS)'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
         ])
         log.cite('verstraelen2016', 'the use of MBIS partitioning')
Beispiel #10
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Iterative Stockholder'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
         ])
         log.cite('lillestolen2008', 'the use of Iterative Stockholder partitioning')
Beispiel #11
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Becke'),
             ('Switching function', 'k=%i' % self._k),
         ])
         biblio.cite('becke1988_multicenter', 'the use of Becke partitioning')
         biblio.cite('slater1964', 'the Brag-Slater radii used in the Becke partitioning')
Beispiel #12
0
 def _log_init(self):
     if log.do_medium:
         log('Initialized: %s' % self)
         log.deflist([
             ('Numbers', self._rgrid_map.keys()),
             ('Records', self._map.keys()),
         ])
         log.blank()
Beispiel #13
0
 def log(self):
     log('Occupation model: %s' % self)
     log.deflist([
         ('nalpha', self.nalpha),
         ('nbeta', self.nbeta),
         ('temperature', self.temperature),
         ('eps', self.eps),
     ])
Beispiel #14
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Becke'),
             ('Switching function', 'k=%i' % self._k),
         ])
         log.cite('becke1988_multicenter', 'the use of Becke partitioning')
         log.cite('slater1964', 'the Brag-Slater radii used in the Becke partitioning')
Beispiel #15
0
 def log(self):
     log('Occupation model: %s' % self)
     log.deflist([
         ('nalpha', self.nalpha),
         ('nbeta', self.nbeta),
         ('temperature', self.temperature),
         ('eps', self.eps),
     ])
Beispiel #16
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Iterative Stockholder'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
         ])
         log.cite('lillestolen2008', 'the use of Iterative Stockholder partitioning')
Beispiel #17
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Hirshfeld-I'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
             ('Proatomic DB', self._proatomdb),
         ])
         log.cite('bultinck2007', 'the use of Hirshfeld-I partitioning')
Beispiel #18
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist([
             ('Scheme', 'Hirshfeld-I'),
             ('Convergence threshold', '%.1e' % self._threshold),
             ('Maximum iterations', self._maxiter),
             ('Proatomic DB',  self._proatomdb),
         ])
         log.cite('bultinck2007', 'the use of Hirshfeld-I partitioning')
Beispiel #19
0
 def _init_log_base(self):
     if log.do_medium:
         log('Performing a density-based AIM analysis with a wavefunction as input.')
         log.deflist([
             ('Molecular grid', self._grid),
             ('System', self._system),
             ('Using local grids', self._local),
             ('Epsilon density:', self.epsilon),
             ('Compute expensive properties (slow)', self._slow),
         ])
Beispiel #20
0
 def _init_log_scheme(self):
     if log.do_medium:
         log.deflist(
             [
                 ("Scheme", "Iterative Stockholder"),
                 ("Convergence threshold", "%.1e" % self._threshold),
                 ("Maximum iterations", self._maxiter),
             ]
         )
         biblio.cite("lillestolen2008", "the use of Iterative Stockholder partitioning")
Beispiel #21
0
 def _log_init(self):
     if log.do_medium:
         log('Initialized: %s' % self)
         log.deflist([
             ('Size', self.size),
             ('Switching function', 'k=%i' % self._k),
         ])
         log.blank()
     # Cite reference
     biblio.cite('becke1988_multicenter', 'the multicenter integration scheme used for the molecular integration grid')
     biblio.cite('cordero2008', 'the covalent radii used for the Becke-Lebedev molecular integration grid')
Beispiel #22
0
 def _init_log_base(self):
     if log.do_medium:
         log('Performing a density-based AIM analysis with a wavefunction as input.'
             )
         log.deflist([
             ('Molecular grid', self._grid),
             ('System', self._system),
             ('Using local grids', self._local),
             ('Epsilon density:', self.epsilon),
             ('Compute expensive properties (slow)', self._slow),
         ])
Beispiel #23
0
 def _log_init(self):
     if log.do_medium:
         log('Initialized: %s' % self)
         log.deflist([
             ('Size', self.size),
             ('Switching function', 'k=%i' % self._k),
         ])
         log.blank()
     # Cite reference
     log.cite('becke1988_multicenter', 'the multicenter integration scheme used for the molecular integration grid')
     log.cite('cordero2008', 'the covalent radii used for the Becke-Lebedev molecular integration grid')
Beispiel #24
0
 def _init_log_base(self):
     if log.do_medium:
         log('Performing a density-based AIM analysis with a cube file as input.')
         log.deflist([
             ('Uniform Integration Grid', self.grid),
             ('Grid shape', self.grid.shape),
             ('Using local grids', self._local),
             ('Mean spacing', '%10.5e' % (self.grid.get_grid_cell().volume**(1.0/3.0))),
             ('Weight corr. numbers', ' '.join(str(n) for n in self.wcor_numbers)),
             ('Weight corr. max rcut', '%10.5f' % self._wcor_rcut_max),
             ('Weight corr. rcond', '%10.5e' % self._wcor_rcond),
         ])
Beispiel #25
0
 def _log_init(self):
     if log.do_high:
         log('Initialized: %s' % self)
         log.deflist([
             ('Size', self.size),
             ('Number of radii', self.nsphere),
             ('Min LL sphere', self._nlls.min()),
             ('Max LL sphere', self._nlls.max()),
             ('Radial Transform', self._rgrid.rtransform.to_string()),
         ])
     # Cite reference
     biblio.cite('lebedev1999', 'the use of Lebedev-Laikov grids (quadrature on a sphere)')
Beispiel #26
0
 def _log_init(self):
     if log.do_high:
         log('Initialized: %s' % self)
         log.deflist([
             ('Size', self.size),
             ('Number of radii', self.nsphere),
             ('Min LL sphere', self._nlls.min()),
             ('Max LL sphere', self._nlls.max()),
             ('Radial Transform', self._rgrid.rtransform.to_string()),
             ('1D Integrator', self._rgrid.int1d),
         ])
     # Cite reference
     biblio.cite('lebedev1999', 'the use of Lebedev-Laikov grids (quadrature on a sphere)')
Beispiel #27
0
 def _log_init(self):
     '''Write some basic information about the system to the screen logger.'''
     if log.do_medium:
         log('Initialized: %s' % self)
         log.deflist([('Number of atoms', self.natom)] +
                     [('Number of %s' % periodic[n].symbol,
                       (self.numbers == n).sum())
                      for n in sorted(np.unique(self.numbers))] + [
                          ('Linalg Factory', self._lf),
                          ('Orbital basis', self._obasis),
                          ('Wavefunction', self._wfn),
                          ('Checkpoint file', self._chk),
                      ])
         if len(self._cache) > 0:
             log('The following cached items are present: %s' %
                 (', '.join(self._cache.iterkeys())))
         if len(self._extra) > 0:
             log('The following extra attributes are present: %s' %
                 (', '.join(self._extra.iterkeys())))
         log.blank()
Beispiel #28
0
def setup_mean_field_wfn(system, charge=0, mult=None, restricted=None, temperature=0):
    '''Initialize a mean-field wavefunction and assign it to the given system.

       **Arguments:**

       system
            A System instance.

       **Optional Arguments:**

       charge
            The total charge of the system. Defaults to zero.

       mult
            The spin multiplicity. Defaults to lowest possible. Use 'free' to
            let the SCF algorithm find the spin multiplicity with the lowest
            energy. (Beware of local minima.)

       temperature
            The electronic temperature used for the Fermi smearing.

       restricted
            Set to True or False to enforce a restricted or unrestricted
            wavefunction. Note that restricted open shell is not yet
            supported. When not set, restricted is used when mult==1 and
            unrestricted otherwise.

       If a wavefunction of the correct type is already present, it will be
       configured with the requested charge and multiplicity.
    '''
    if system._obasis is None:
        raise RuntimeError('A wavefunction can only be initialized when a basis is specified.')

    # Determine charge, spin, mult and restricted
    if charge is None:
        charge = 0
    nel = system.numbers.sum() - charge
    if isinstance(nel, int):
        if mult is None:
            mult = nel%2+1
        elif mult != 'free' and ((nel%2 == 0) ^ (mult%2 != 0)):
            raise ValueError('Not compatible: number of electrons = %i and spin multiplicity = %i' % (nel, mult))
    else:
        if mult is None:
            if restricted is True:
                mult = 1.0
            else:
                raise ValueError('In case of an unrestricted wfn and a fractional number of electrons, mult must be given explicitly or must be set to \'free\'.')
    if mult != 'free' and mult < 1:
        raise ValueError('mult must be strictly positive.')
    if restricted is True and mult != 1:
        raise ValueError('Restricted==True only works when mult==1. Restricted open shell is not supported yet.')
    if restricted is None:
        restricted = mult==1

    # Show some thing on screen.
    if log.do_medium:
        log('Wavefunction initialization, without initial guess.')
        log.deflist([
            ('Charge', charge),
            ('Multiplicity', mult),
            ('Number of e', nel),
            ('Restricted', restricted),
        ])
        log.blank()

    # Create a model for the occupation numbers
    if temperature == 0:
        if restricted:
            occ_model = AufbauOccModel(nel/2, nel/2)
        elif mult=='free':
            occ_model = AufbauSpinOccModel(nel)
        else:
            occ_model = AufbauOccModel((nel + (mult-1))/2, (nel - (mult-1))/2)
    else:
        if restricted:
            occ_model = FermiOccModel(nel/2, nel/2, temperature)
        elif mult=='free':
            raise NotImplementedError
            #occ_model = FermiSpinOccModel(nel)
        else:
            occ_model = FermiOccModel((nel + (mult-1))/2, (nel - (mult-1))/2, temperature)

    if system._wfn is not None:
        # Check if the existing wfn is consistent with the arguments
        if not isinstance(system.wfn, MeanFieldWFN):
            raise ValueError('A wavefunction is already present and it is not a mean-field wavefunction.')
        elif system.wfn.nbasis != system.obasis.nbasis:
            raise ValueError('The number of basis functions in the wfn is incorrect.')
        elif restricted ^ isinstance(system.wfn, RestrictedWFN):
            raise ValueError('The wfn does not match the restricted argument.')

        # Assign occ_model
        system.wfn.occ_model = occ_model

        # If the wfn contains an expansion, update the occupations and remove
        # density matrices. Otherwise clean up
        if 'exp_alpha' in system.wfn._cache:
            if restricted:
                system.wfn.occ_model.assign(system.wfn.exp_alpha)
            else:
                system.wfn.occ_model.assign(system.wfn.exp_alpha, system.wfn.exp_beta)
            system.wfn.clear_dm()
        else:
            system.wfn.clear()
    else:
        # if the wfn does not exist yet, create a proper one.
        if restricted:
            system._wfn = RestrictedWFN(system.lf, system.obasis.nbasis, occ_model)
        else:
            system._wfn = UnrestrictedWFN(system.lf, system.obasis.nbasis, occ_model)
Beispiel #29
0
 def log(self):
     log('Occupation model: %s' % self)
     log.deflist([('nel', self.nel)])
Beispiel #30
0
def setup_mean_field_wfn(system,
                         charge=0,
                         mult=None,
                         restricted=None,
                         temperature=0):
    '''Initialize a mean-field wavefunction and assign it to the given system.

       **Arguments:**

       system
            A System instance.

       **Optional Arguments:**

       charge
            The total charge of the system. Defaults to zero.

       mult
            The spin multiplicity. Defaults to lowest possible. Use 'free' to
            let the SCF algorithm find the spin multiplicity with the lowest
            energy. (Beware of local minima.)

       temperature
            The electronic temperature used for the Fermi smearing.

       restricted
            Set to True or False to enforce a restricted or unrestricted
            wavefunction. Note that restricted open shell is not yet
            supported. When not set, restricted is used when mult==1 and
            unrestricted otherwise.

       If a wavefunction of the correct type is already present, it will be
       configured with the requested charge and multiplicity.
    '''
    if system._obasis is None:
        raise RuntimeError(
            'A wavefunction can only be initialized when a basis is specified.'
        )

    # Determine charge, spin, mult and restricted
    if charge is None:
        charge = 0
    nel = system.numbers.sum() - charge
    if isinstance(nel, int):
        if mult is None:
            mult = nel % 2 + 1
        elif mult != 'free' and ((nel % 2 == 0) ^ (mult % 2 != 0)):
            raise ValueError(
                'Not compatible: number of electrons = %i and spin multiplicity = %i'
                % (nel, mult))
    else:
        if mult is None:
            if restricted is True:
                mult = 1.0
            else:
                raise ValueError(
                    'In case of an unrestricted wfn and a fractional number of electrons, mult must be given explicitly or must be set to \'free\'.'
                )
    if mult != 'free' and mult < 1:
        raise ValueError('mult must be strictly positive.')
    if restricted is True and mult != 1:
        raise ValueError(
            'Restricted==True only works when mult==1. Restricted open shell is not supported yet.'
        )
    if restricted is None:
        restricted = mult == 1

    # Show some thing on screen.
    if log.do_medium:
        log('Wavefunction initialization, without initial guess.')
        log.deflist([
            ('Charge', charge),
            ('Multiplicity', mult),
            ('Number of e', nel),
            ('Restricted', restricted),
        ])
        log.blank()

    # Create a model for the occupation numbers
    if temperature == 0:
        if restricted:
            occ_model = AufbauOccModel(nel / 2, nel / 2)
        elif mult == 'free':
            occ_model = AufbauSpinOccModel(nel)
        else:
            occ_model = AufbauOccModel((nel + (mult - 1)) / 2,
                                       (nel - (mult - 1)) / 2)
    else:
        if restricted:
            occ_model = FermiOccModel(nel / 2, nel / 2, temperature)
        elif mult == 'free':
            raise NotImplementedError
            #occ_model = FermiSpinOccModel(nel)
        else:
            occ_model = FermiOccModel((nel + (mult - 1)) / 2,
                                      (nel - (mult - 1)) / 2, temperature)

    if system._wfn is not None:
        # Check if the existing wfn is consistent with the arguments
        if not isinstance(system.wfn, MeanFieldWFN):
            raise ValueError(
                'A wavefunction is already present and it is not a mean-field wavefunction.'
            )
        elif system.wfn.nbasis != system.obasis.nbasis:
            raise ValueError(
                'The number of basis functions in the wfn is incorrect.')
        elif restricted ^ isinstance(system.wfn, RestrictedWFN):
            raise ValueError('The wfn does not match the restricted argument.')

        # Assign occ_model
        system.wfn.occ_model = occ_model

        # If the wfn contains an expansion, update the occupations and remove
        # density matrices. Otherwise clean up
        if 'exp_alpha' in system.wfn._cache:
            if restricted:
                system.wfn.occ_model.assign(system.wfn.exp_alpha)
            else:
                system.wfn.occ_model.assign(system.wfn.exp_alpha,
                                            system.wfn.exp_beta)
            system.wfn.clear_dm()
        else:
            system.wfn.clear()
    else:
        # if the wfn does not exist yet, create a proper one.
        if restricted:
            system._wfn = RestrictedWFN(system.lf, system.obasis.nbasis,
                                        occ_model)
        else:
            system._wfn = UnrestrictedWFN(system.lf, system.obasis.nbasis,
                                          occ_model)
Beispiel #31
0
 def log(self):
     log('Occupation model: %s' % self)
     log.deflist([('nalpha', self.nalpha), ('nbeta', self.nbeta)])
Beispiel #32
0
 def log(self):
     log('Occupation model: %s' % self)
     log.deflist([('nel', self.nel)])
Beispiel #33
0
 def log(self):
     log('Occupation model: %s' % self)
     log.deflist([('nalpha', self.nalpha), ('nbeta', self.nbeta)])