Beispiel #1
0
    def test_acceptor_default_or_none(self):
        # default acceptor
        self.inputs["acceptor"] = {"type": "default"}
        aimless = driver.parse_aimless(self.inputs, self.VALID_ENGINE)

        # null acceptor
        self.inputs["acceptor"] = None
        aimless = driver.parse_aimless(self.inputs, self.VALID_ENGINE)
Beispiel #2
0
    def test_temperature(self):
        self.inputs["temperature"] = -1
        with self.assertRaises(SchemaError):
            driver.parse_aimless(self.inputs, self.VALID_ENGINE)

        self.inputs["temperature"] = "not a float"
        with self.assertRaises(SchemaError):
            driver.parse_aimless(self.inputs, self.VALID_ENGINE)
Beispiel #3
0
    def test_starts_dir(self):
        self.inputs["starts_dir"] = "fake_dir"
        with self.assertRaises(SchemaError):
            driver.parse_aimless(self.inputs, self.VALID_ENGINE)

        self.inputs["starts_dir"] = 123
        with self.assertRaises(SchemaError):
            driver.parse_aimless(self.inputs, self.VALID_ENGINE)
Beispiel #4
0
    def test_parsing_earlier_fields(self):
        # parse the earlier sections to extract those fields
        driver.parse_aimless(copy.deepcopy(TestAimlessParsing.VALID_INPUTS),
                             copy.deepcopy(TestAimlessParsing.VALID_ENGINE))
        self.inputs["csv_input"] = None

        driver.parse_colvar(self.inputs)

        self.inputs["xyz_input"] = None
        driver.parse_colvar(self.inputs)
Beispiel #5
0
    def test_mulitbasin_basins(self):
        self.inputs["acceptor"] = self.multi_acceptor

        for field in ["reactants", "products"]:
            self.multi_acceptor[field].append("not a number")
            with self.assertRaises(
                    SchemaError,
                    msg=f"All basins of {field} must be integers"):
                driver.parse_aimless(self.inputs, self.VALID_ENGINE)

            # replace list with integer
            self.multi_acceptor[field] = 1
            with self.assertRaises(SchemaError, msg=f"{field} must be a list"):
                driver.parse_aimless(self.inputs, self.VALID_ENGINE)

            # recopy list to check next field
            self.multi_acceptor[field] = copy.copy(self.VALID_MULTI[field])
Beispiel #6
0
    def test_parsing_earlier_fields(self):
        # parse the earlier sections to extract those fields
        driver.parse_aimless(copy.deepcopy(TestAimlessParsing.VALID_INPUTS),
                             copy.deepcopy(TestAimlessParsing.VALID_ENGINE))
        self.inputs["csv_input"] = None
        driver.parse_likelihood(self.inputs)

        self.inputs["colvar_input"] = None
        with self.assertRaises(
                SystemExit,
                msg=
                f"colvar_input should not be allowed to be None without earlier parsing"
        ):
            driver.parse_likelihood(self.inputs)

        driver.parse_colvar(copy.deepcopy(TestColvarParsing.VALID_INPUTS))

        driver.parse_likelihood(self.inputs)
Beispiel #7
0
    def test_number_fields(self):
        # Test all the positive integer fields
        for field in [
                "n_parallel", "n_points", "n_state_tries", "n_vel_tries"
        ]:
            original_value = self.inputs[field]
            # Negative numbers
            self.inputs[field] = -1
            with self.assertRaises(SchemaError,
                                   msg=f"{field} should not be negative"):
                driver.parse_aimless(self.inputs, self.VALID_ENGINE)
            # Null
            self.inputs[field] = None
            with self.assertRaises(SchemaError,
                                   msg=f"{field} should not be None"):
                driver.parse_aimless(self.inputs, self.VALID_ENGINE)
            # Not an integer
            self.inputs[field] = "not a number"
            with self.assertRaises(SchemaError,
                                   msg=f"{field} should not be a string"):
                driver.parse_aimless(self.inputs, self.VALID_ENGINE)

            # Restore the original value so we can test the others
            self.inputs[field] = original_value
Beispiel #8
0
 def test_output_name(self):
     self.inputs["output_name"] = 123
     with self.assertRaises(SchemaError):
         driver.parse_aimless(self.inputs, self.VALID_ENGINE)
Beispiel #9
0
 def test_valid(self):
     driver.parse_aimless(self.inputs, self.VALID_ENGINE)
Beispiel #10
0
 def test_valid_multibasin(self):
     self.inputs["acceptor"] = self.multi_acceptor
     aimless = driver.parse_aimless(self.inputs, self.VALID_ENGINE)