예제 #1
0
    def test_tuple_list_core_orbitals(self):
        res = expand_spaceargs(self.counter_data(n_bas=80),
                               core_orbitals=([0, 1, 2], [0, 1, 2]))
        assert res["core_orbitals"] == [0, 1, 2, 80, 81, 82]

        res = expand_spaceargs(self.counter_data(n_bas=70),
                               core_orbitals=([1, 3, 7], [2, 3, 6]))
        assert res["core_orbitals"] == [1, 3, 7, 72, 73, 76]
예제 #2
0
    def test_tuple_list_frozen_virtual(self):
        res = expand_spaceargs(self.counter_data(n_bas=80),
                               frozen_virtual=([77, 78, 79], [77, 78, 79]))
        assert res["frozen_virtual"] == [77, 78, 79, 157, 158, 159]

        res = expand_spaceargs(self.counter_data(n_bas=80),
                               frozen_virtual=([74, 76, 79], [73, 75, 77]))
        assert res["frozen_virtual"] == [74, 76, 79, 153, 155, 157]
예제 #3
0
    def test_range_frozen_core(self):
        res = expand_spaceargs(self.counter_data(n_bas=80),
                               frozen_core=range(3))
        assert res["frozen_core"] == [0, 1, 2, 80, 81, 82]

        res = expand_spaceargs(self.counter_data(n_bas=70),
                               frozen_core=range(1, 4))
        assert res["frozen_core"] == [1, 2, 3, 71, 72, 73]
예제 #4
0
    def test_tuple_list_frozen_core(self):
        res = expand_spaceargs(self.counter_data(n_bas=80),
                               frozen_core=([0, 1, 2], [0, 1, 2]))
        assert res["frozen_core"] == [0, 1, 2, 80, 81, 82]

        res = expand_spaceargs(self.counter_data(n_bas=70),
                               frozen_core=([1, 3, 7], [2, 3, 6]))
        assert res["frozen_core"] == [1, 3, 7, 72, 73, 76]
예제 #5
0
    def test_range_core_orbitals(self):
        res = expand_spaceargs(self.counter_data(n_bas=80),
                               core_orbitals=range(3))
        assert res["core_orbitals"] == [0, 1, 2, 80, 81, 82]

        res = expand_spaceargs(self.counter_data(n_bas=70),
                               core_orbitals=range(1, 4))
        assert res["core_orbitals"] == [1, 2, 3, 71, 72, 73]
예제 #6
0
 def test_list_fc_fv_cvs(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_core=[0, 1, 3, 5],
                            core_orbitals=[2, 6],
                            frozen_virtual=[67, 69])
     assert res["frozen_core"] == [0, 1, 3, 5, 70, 71, 73, 75]
     assert res["core_orbitals"] == [2, 6, 72, 76]
     assert res["frozen_virtual"] == [67, 69, 137, 139]
예제 #7
0
 def test_int_fc_fv_cvs(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_core=4,
                            core_orbitals=2,
                            frozen_virtual=5)
     assert res["frozen_core"] == [0, 1, 2, 3, 70, 71, 72, 73]
     assert res["core_orbitals"] == [4, 5, 74, 75]
     assert res["frozen_virtual"] == \
         [65, 66, 67, 68, 69, 135, 136, 137, 138, 139]
예제 #8
0
    assert spec in ["gen", "cvs"]
    for method in ["adc0", "adc1", "adc2", "adc2x", "adc3"]:
        kw = kwargs_overwrite.get(method, kwargs)
        dump_method(case, method, kw, spec)


def dump_method(case, method, kwargs, spec):
    h5file = case + "_hfdata.hdf5"
    if not os.path.isfile(h5file):
        raise ValueError("HfData not found: " + h5file)
    hfdata = atd.HdfProvider(h5file)

    # Get dictionary of parameters for the reference cases.
    refcases = ast.literal_eval(hfdata.data["reference_cases"][()])
    kwargs = dict(kwargs)
    kwargs.update(expand_spaceargs(hfdata, **refcases[spec]))

    fullmethod = method
    if "cvs" in spec:
        fullmethod = "cvs-" + method

    prefix = ""
    if spec != "gen":
        prefix = spec.replace("-", "_") + "_"
    adc_tree = prefix.replace("_", "-") + method
    mp_tree = prefix.replace("_", "-") + "mp"

    dumpfile = "{}_reference_{}{}.hdf5".format(case, prefix, method)
    if not os.path.isfile(dumpfile):
        atd.dump_reference(hfdata,
                           fullmethod,
예제 #9
0
 def test_int_frozen_core(self):
     res = expand_spaceargs(self.counter_data(n_bas=70), frozen_core=5)
     assert res["frozen_core"] == [0, 1, 2, 3, 4, 70, 71, 72, 73, 74]
예제 #10
0
 def test_list_frozen_core(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_core=[1, 3, 7])
     assert res["frozen_core"] == [1, 3, 7, 71, 73, 77]
예제 #11
0
 def test_int_core_orbitals(self):
     res = expand_spaceargs(self.counter_data(n_bas=70), core_orbitals=5)
     assert res["core_orbitals"] == [0, 1, 2, 3, 4, 70, 71, 72, 73, 74]
예제 #12
0
 def test_list_core_orbitals(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            core_orbitals=[1, 3, 7])
     assert res["core_orbitals"] == [1, 3, 7, 71, 73, 77]
예제 #13
0
 def test_list_frozen_virtual(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_virtual=[64, 66, 69])
     assert res["frozen_virtual"] == [64, 66, 69, 134, 136, 139]
예제 #14
0
 def test_list_fc_fv(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_core=[0, 1, 3, 5],
                            frozen_virtual=[66, 69])
     assert res["frozen_core"] == [0, 1, 3, 5, 70, 71, 73, 75]
     assert res["frozen_virtual"] == [66, 69, 136, 139]
예제 #15
0
 def test_int_fc_fv(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_core=4,
                            frozen_virtual=2)
     assert res["frozen_core"] == [0, 1, 2, 3, 70, 71, 72, 73]
     assert res["frozen_virtual"] == [68, 69, 138, 139]
예제 #16
0
 def test_int_fc_cvs(self):
     res = expand_spaceargs(self.counter_data(n_bas=70),
                            frozen_core=4,
                            core_orbitals=2)
     assert res["frozen_core"] == [0, 1, 2, 3, 70, 71, 72, 73]
     assert res["core_orbitals"] == [4, 5, 74, 75]
예제 #17
0
 def test_int_frozen_virtual(self):
     res = expand_spaceargs(self.counter_data(n_bas=70), frozen_virtual=4)
     assert res["frozen_virtual"] == [66, 67, 68, 69, 136, 137, 138, 139]
예제 #18
0
 def test_range_frozen_virtual(self):
     res = expand_spaceargs(self.counter_data(n_bas=80),
                            frozen_virtual=range(77, 80))
     assert res["frozen_virtual"] == [77, 78, 79, 157, 158, 159]