Exemplo n.º 1
0
    def form_operators(self) -> None:

        if self.program == Program.PySCF:
            from pyresponse.pyscf import integrals

            integral_generator = integrals.IntegralsPyscf(self.program_obj)
        elif self.program == Program.Psi4:
            from pyresponse.psi4 import integrals

            integral_generator = integrals.IntegralsPsi4(self.program_obj)
        else:
            raise RuntimeError

        operator_angmom = Operator(
            label="angmom", is_imaginary=True, is_spin_dependent=False, triplet=False
        )
        operator_angmom.ao_integrals = integral_generator.integrals(integrals.ANGMOM_COMMON_GAUGE)
        self.driver.add_operator(operator_angmom)

        operator_diplen = Operator(
            label="dipole", is_imaginary=False, is_spin_dependent=False, triplet=False
        )
        operator_diplen.ao_integrals = integral_generator.integrals(integrals.DIPOLE)
        self.driver.add_operator(operator_diplen)

        if self.do_dipvel:
            operator_dipvel = Operator(
                label="dipvel", is_imaginary=True, is_spin_dependent=False, triplet=False
            )
            operator_dipvel.ao_integrals = integral_generator.integrals(integrals.DIPVEL)
            self.driver.add_operator(operator_dipvel)
Exemplo n.º 2
0
    def form_operators(self) -> None:

        if self.program == Program.PySCF:
            from pyresponse.pyscf import integrals

            integral_generator = integrals.IntegralsPyscf(self.program_obj)
        elif self.program == Program.Psi4:
            from pyresponse.psi4 import integrals

            integral_generator = integrals.IntegralsPsi4(self.program_obj)
        else:
            raise RuntimeError

        if self.use_giao:
            integrals_angmom_ao = integral_generator.integrals(
                integrals.ANGMOM_GIAO)
        else:
            integrals_angmom_ao = integral_generator.integrals(
                integrals.ANGMOM_COMMON_GAUGE)
        operator_angmom = Operator(label="angmom",
                                   is_imaginary=True,
                                   is_spin_dependent=False,
                                   triplet=False)
        operator_angmom.ao_integrals = integrals_angmom_ao
        self.driver.add_operator(operator_angmom)
def test_integrals_pyscf():
    mol = molecules.molecule_water_sto3g()
    mol.build()
    integral_generator = integrals.IntegralsPyscf(mol)
    np.testing.assert_equal(mol.intor("cint1e_r_sph", comp=3),
                            integral_generator.integrals(integrals.DIPOLE))
    np.testing.assert_equal(
        mol.intor("cint1e_cg_irxp_sph", comp=3),
        integral_generator.integrals(integrals.ANGMOM_COMMON_GAUGE),
    )
Exemplo n.º 4
0
    def form_operators(self) -> None:

        if self.program == Program.PySCF:
            from pyresponse.pyscf import integrals

            integral_generator = integrals.IntegralsPyscf(self.program_obj)
        elif self.program == Program.Psi4:
            from pyresponse.psi4 import integrals

            integral_generator = integrals.IntegralsPsi4(self.program_obj)
        else:
            raise RuntimeError

        # angular momentum
        operator_angmom = Operator(label="angmom",
                                   is_imaginary=True,
                                   is_spin_dependent=False,
                                   triplet=False)
        self.program_obj.set_common_orig(self.gauge_origin)
        operator_angmom.ao_integrals = integral_generator.integrals(
            integrals.ANGMOM_COMMON_GAUGE)
        self.driver.add_operator(operator_angmom)

        # spin-orbit (1-electron, exact nuclear charges)
        operator_spinorb = Operator(label="spinorb",
                                    is_imaginary=True,
                                    is_spin_dependent=False,
                                    triplet=False)
        integrals_spinorb_ao = 0
        for atm_id in range(self.program_obj.natm):
            self.program_obj.set_rinv_orig(self.program_obj.atom_coord(atm_id))
            chg = self.program_obj.atom_charge(atm_id)
            integrals_spinorb_ao += chg * integral_generator.integrals(
                integrals.SO_SPHER_1e)
        operator_spinorb.ao_integrals = integrals_spinorb_ao
        self.driver.add_operator(operator_spinorb)

        # spin-orbit (1-electron, effective nuclear charges)
        operator_spinorb_eff = Operator(label="spinorb_eff",
                                        is_imaginary=True,
                                        is_spin_dependent=False,
                                        triplet=False)
        integrals_spinorb_eff_ao = 0
        for atm_id in range(self.program_obj.natm):
            self.program_obj.set_rinv_orig(self.program_obj.atom_coord(atm_id))
            # chg = self.program_obj.atom_effective_charge[atm_id]
            chg = 0
            integrals_spinorb_eff_ao += chg * integral_generator.integrals(
                integrals.SO_SPHER_1e)
        operator_spinorb_eff.ao_integrals = integrals_spinorb_eff_ao
        self.driver.add_operator(operator_spinorb_eff)
Exemplo n.º 5
0
    def form_operators(self):

        if self.program == Program.PySCF:
            from pyresponse.pyscf import integrals

            integral_generator = integrals.IntegralsPyscf(self.program_obj)
        elif self.program == Program.Psi4:
            from pyresponse.psi4 import integrals

            integral_generator = integrals.IntegralsPsi4(self.program_obj)
        else:
            raise RuntimeError

        operator_diplen = Operator(label="dipole",
                                   is_imaginary=False,
                                   is_spin_dependent=False,
                                   triplet=False)
        operator_diplen.ao_integrals = integral_generator.integrals(
            integrals.DIPOLE)
        self.driver.add_operator(operator_diplen)