Esempio n. 1
0
    def setUp(self):
        self.tmp = os.path.join(os.path.dirname(__file__), 'test_h2_ab')
        self.qc = QuantumChemistry.get_factory('Dalton', tmpdir=self.tmp)
        def tmp(fil):
            return os.path.join(self.tmp, fil)

        vb.Nod.tmpdir = self.tmp
        vb.Nod.C = full.unit(2)
        vb.Nod.S = self.qc.get_overlap()
        self.wf = vb.WaveFunction(
            [vb.Structure(
                [vb.Nod([0], [0]), vb.Nod([1], [1])],
                [1.0, 1.0]
                ),
             vb.Structure(
                [vb.Nod([0], [1]), vb.Nod([1], [0])],
                [1.0, 1.0]
                )
            ],
            [1.0, 1.0],
            tmpdir = self.tmp
        )
Esempio n. 2
0
    def setUp(self):
        self.tmp = os.path.join(os.path.dirname(__file__), 'test_h2_c')
        def tmp(fil):
            return os.path.join(self.tmp, fil)

        self.qcifc = QuantumChemistry.get_factory('Dalton', tmpdir=self.tmp)
        vb.Nod.tmpdir = self.tmp
        vb.Nod.C = full.matrix((10, 2))
        vb.Nod.C[0, 0] = 1.0
        vb.Nod.C[5, 1] = 1.0
        vb.Nod.S = self.qcifc.get_overlap()
        self.blockdims = ((5, 5), (1, 1))
        self.wf = vb.WaveFunction(
            [vb.Structure(
                [vb.Nod([0], [1]), vb.Nod([1], [0])],
                [1.0, 1.0]
                ),
             vb.Structure([vb.Nod([0], [0])], [1.0]),
             vb.Structure([vb.Nod([1], [1])], [1.0]),
            ],
            [1.0, 0.0, 0.0],
            tmpdir = self.tmp,
            blockdims=self.blockdims
        )

        # In this setup we have local expansions of mos, leading to a block diagonal C
        self.final = full.matrix(13)
        self.final_coef =[0.83675, 0.09850, 0.09850]
        self.final[:3] = self.final_coef
        self.final_C = full.init([
            [0.7633862173, 0.3075441467, 0.0, 0.0, 0.0328947818,0,0,0,0,0],
            [0,0,0,0,0, 0.7633862173, 0.3075441467, 0.0, 0.0, -0.0328947818]
            ])
        self.final[3:8] = self.final_C[:5, 0]
        self.final[8:13] = self.final_C[5:, 1]

        self.wf.normalize_structures()
        self.xfg = VBMinimizer(self.wf)
Esempio n. 3
0
 def setUp(self, arg=None):
     np.random.seed(0)
     self.set_tmpdir(arg)
     self.qcifc = QuantumChemistry.get_factory('Dalton', tmpdir=self.tmpdir)
     self.init_nod()
Esempio n. 4
0
    def setUp(self):
        self.tmp = os.path.join(os.path.dirname(__file__), 'test_h2_c')
        def tmp(fil):
            return os.path.join(self.tmp, fil)

        vb.Nod.tmpdir = self.tmp
        vb.Nod.C = full.matrix((10, 2))
        vb.Nod.C[0, 0] = 1.0
        vb.Nod.C[5, 1] = 1.0
        self.qc = QuantumChemistry.get_factory('Dalton', tmpdir=self.tmp)
        vb.Nod.S = self.qc.get_overlap()
        self.blockdims = ((5, 5), (1, 1))
        self.wf = vb.WaveFunction(
            [vb.Structure(
                [vb.Nod([0], [1]), vb.Nod([1], [0])],
                [1.0, 1.0]
                ),
             vb.Structure([vb.Nod([0], [0])], [1.0]),
             vb.Structure([vb.Nod([1], [1])], [1.0]),
            ],
            [1.0, 0.0, 0.0],
            tmpdir = self.tmp,
            blockdims=self.blockdims
        )


        self.constraints = (
            {'type': 'eq',
             'fun': self.constraint_norm,
             'jac': self.constraint_norm_grad,
             'args': (self.wf,)
            },
            {'type': 'eq',
             'fun': self.generate_structure_constraint(0),
             'jac': self.generate_structure_constraint_gradient(0),
             'args': (self.wf,)
            },
            {'type': 'eq',
             'fun': self.generate_structure_constraint(1),
             'jac': self.generate_structure_constraint_gradient(1),
             'args': (self.wf,)
            },
            {'type': 'eq',
             'fun': self.generate_structure_constraint(2),
             'jac': self.generate_structure_constraint_gradient(2),
             'args': (self.wf,)
            },
            {'type': 'eq',
             'fun': self.generate_orbital_constraint(0),
             'jac': self.generate_orbital_constraint_gradient(0),
             'args': (self.wf,)
            },
            {'type': 'eq',
             'fun': self.generate_orbital_constraint(1),
             'jac': self.generate_orbital_constraint_gradient(1),
             'args': (self.wf,)
            },
        )

        self.final = full.matrix(13)
        self.final[:3] = [0.83675, 0.09850, 0.09850]
        self.final[3:8] = [0.7633862173, 0.3075441467, 0.0, 0.0, 0.0328947818]
        self.final[8:13] = [0.7633862173, 0.3075441467, 0.0, 0.0, -0.0328947818]

        VBTestH2C.update_wf(self.final, self.wf)
        self.wf.normalize_structures()
        VBTestH2C.update_wf(self.final, self.wf)