-
Notifications
You must be signed in to change notification settings - Fork 0
/
sarDatabase.py
29 lines (26 loc) · 983 Bytes
/
sarDatabase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
from rmgpy.data.base import Database, Entry
from rmgpy.molecule import Molecule
from rmgpy.molecule.group import Group
class SARDatabase(Database):
"""
This class has a tree structure that extends from Database, which is used
for finding the proper node.
"""
def loadEntry(self, label, molecule=None, group=None, data=None):
"""
Load an entry from the forbidden structures database. This method is
automatically called during loading of the forbidden structures
database.
"""
assert molecule is not None or group is not None
assert not (molecule is not None and group is not None)
if molecule is not None:
item = Molecule().fromAdjacencyList(molecule)
elif group is not None:
item = Group().fromAdjacencyList(group)
self.entries[label] = Entry(
label = label,
item = item,
data = data,
)