print ("Symmetry:", si.wfnsym) print (("\nIn this example, the triplet eigenvector is determined by symmetry\n" "to within phase factors because I only have 1 triplet in this\n" "space. This also means that the triplet natural orbitals are still\n" "localized and the interfragment entanglement is second-order, only\n" "appearing in the 2RDM. On the other hand, the singlets do interact\n" "leading to first-order entanglement which is visible in the NOs:\n")) print ("---LASSI eigenvectors---") print (si) # You can get the 1-RDMs of the SA-LASSCF states like this states_casdm1s = las.states_make_casdm1s () # You can get the 1- and 2-RDMs of the LASSI solutions like this roots_casdm1s, roots_casdm2s = lassi.roots_make_rdm12s (las, las.ci, si) # No super-convenient molden API yet # By default orbitals are state-averaged natural-orbitals at the end # of the SA-LASSCF calculation # But you can recanonicalize print ("\nlasscf_state_0-3.molden: single LAS state NOs, (strictly) unentangled") for iroot, dm1 in enumerate (states_casdm1s.sum (1)): # spin sum no_coeff, no_ene, no_occ = las.canonicalize (natorb_casdm1=dm1)[:3] molden.from_mo (las.mol, 'lasscf_state_{}.molden'.format (iroot), no_coeff, occ=no_occ, ene=no_ene) print ("lassi_root_0-3.molden: LASSI eigenstate NOs, (generally) entangled") for iroot, dm1 in enumerate (roots_casdm1s.sum (1)): # spin sum no_coeff, no_ene, no_occ = las.canonicalize (natorb_casdm1=dm1)[:3] molden.from_mo (las.mol, 'lassi_root_{}.molden'.format (iroot), no_coeff, occ=no_occ, ene=no_ene)
las = LASSCF(mf, (4, 4), (4, 4), spin_sub=(1, 1)) las.state_average_(weights=[ 1.0 / 5.0, ] * 5, spins=[[0, 0], [0, 0], [2, -2], [-2, 2], [2, 2]], smults=[[1, 1], [3, 3], [3, 3], [3, 3], [3, 3]]) las.frozen = list(range(las.mo_coeff.shape[-1])) ugg = las.get_ugg() las.mo_coeff = np.loadtxt('test_lassi_mo.dat') las.ci = ugg.unpack(np.loadtxt('test_lassi_ci.dat'))[1] #las.set (conv_tol_grad=1e-8).run () #np.savetxt ('test_lassi_mo.dat', las.mo_coeff) #np.savetxt ('test_lassi_ci.dat', ugg.pack (las.mo_coeff, las.ci)) las.e_states = las.energy_nuc() + las.states_energy_elec() e_roots, si = las.lassi() rdm1s, rdm2s = roots_make_rdm12s(las, las.ci, si) def tearDownModule(): global mol, mf, las mol.stdout.close() del mol, mf, las class KnownValues(unittest.TestCase): def test_evals(self): self.assertAlmostEqual(lib.fp(e_roots), 153.47664766268417, 6) def test_si(self): # Arbitrary signage in both the SI and CI vector, sadly # Actually this test seems really inconsistent overall...