Example #1
0
    def __init__(self, ff_file_name, debug=False):
        from foyer.forcefield import preprocess_forcefield_files

        try:
            preprocessed_ff_file_name = preprocess_forcefield_files(
                [ff_file_name])

            ff_tree = etree.parse(preprocessed_ff_file_name[0])
            self.validate_xsd(ff_tree)

            self.atom_type_names = ff_tree.xpath(
                "/ForceField/AtomTypes/Type/@name")
            self.atom_types = ff_tree.xpath("/ForceField/AtomTypes/Type")

            self.validate_class_type_exclusivity(ff_tree)

            # Loading forcefield should succeed, because XML can be parsed and
            # basics have been validated.
            from foyer.forcefield import Forcefield

            self.smarts_parser = Forcefield(preprocessed_ff_file_name,
                                            validation=False).parser
        finally:
            for ff_file_name in preprocessed_ff_file_name:
                os.remove(ff_file_name)

        self.validate_smarts(debug=debug)
        self.validate_overrides()
Example #2
0
    def __init__(self, ff_file_name):

        from foyer.forcefield import preprocess_forcefield_files

        preprocessed_ff_file_name = preprocess_forcefield_files([ff_file_name])

        ff_tree = etree.parse(preprocessed_ff_file_name[0])
        self.validate_xsd(ff_tree)

        # Loading forcefield should succeed, because XML can be parsed and
        # basics have been validated.
        from foyer.forcefield import Forcefield
        self.smarts_parser = Forcefield(preprocessed_ff_file_name, validation=False).parser

        self.validate_smarts(ff_tree)
Example #3
0
    def __init__(self, ff_file_name):

        from foyer.forcefield import preprocess_forcefield_files

        preprocessed_ff_file_name = preprocess_forcefield_files([ff_file_name])

        ff_tree = etree.parse(preprocessed_ff_file_name[0])
        self.validate_xsd(ff_tree)

        # Loading forcefield should succeed, because XML can be parsed and
        # basics have been validated.
        from foyer.forcefield import Forcefield
        self.smarts_parser = Forcefield(preprocessed_ff_file_name,
                                        validation=False).parser

        self.validate_smarts(ff_tree)
Example #4
0
    def __init__(self, ff_file_name, debug=False):
        from foyer.forcefield import preprocess_forcefield_files
        preprocessed_ff_file_name = preprocess_forcefield_files([ff_file_name])

        ff_tree = etree.parse(preprocessed_ff_file_name[0])
        self.validate_xsd(ff_tree)

        self.atom_type_names = ff_tree.xpath('/ForceField/AtomTypes/Type/@name')
        self.atom_types = ff_tree.xpath('/ForceField/AtomTypes/Type')

        self.validate_class_type_exclusivity(ff_tree)

        # Loading forcefield should succeed, because XML can be parsed and
        # basics have been validated.
        from foyer.forcefield import Forcefield
        self.smarts_parser = Forcefield(preprocessed_ff_file_name, validation=False).parser

        self.validate_smarts(debug=debug)
        self.validate_overrides()