Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verify named argument to to_records #282

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions openff/qcsubmit/results/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ def _validate_record_types(
)

@abc.abstractmethod
def to_records(self) -> List[Tuple[BaseRecord, Molecule]]:
def to_records(
self, client_kwargs: Optional[dict] = None
) -> List[Tuple[BaseRecord, Molecule]]:
"""Returns the native QCPortal record objects for each of the records referenced
in this collection along with a corresponding OpenFF molecule object.
"""
Expand Down Expand Up @@ -371,17 +373,21 @@ def from_server(
spec_name,
)

def to_records(self) -> List[Tuple[SinglepointRecord, Molecule]]:
def to_records(
self, client_kwargs: Optional[dict] = None
) -> List[Tuple[SinglepointRecord, Molecule]]:
"""Returns the native QCPortal record objects for each of the records referenced
in this collection along with a corresponding OpenFF molecule object.

Each molecule will contain the conformer referenced by the record.
"""

records_and_molecules = []
if client_kwargs is None:
client_kwargs = dict()

for client_address, records in self.entries.items():
client = PortalClient(client_address)
client = PortalClient(client_address, **client_kwargs)

# TODO - batching/chunking (maybe in portal?)
for record in records:
Expand Down Expand Up @@ -522,7 +528,9 @@ def from_server(
spec_name,
)

def to_records(self) -> List[Tuple[OptimizationRecord, Molecule]]:
def to_records(
self, client_kwargs: Optional[dict] = None
) -> List[Tuple[OptimizationRecord, Molecule]]:
"""Returns the native QCPortal record objects for each of the records referenced
in this collection along with a corresponding OpenFF molecule object.

Expand All @@ -531,9 +539,11 @@ def to_records(self) -> List[Tuple[OptimizationRecord, Molecule]]:
"""

records_and_molecules = []
if client_kwargs is None:
client_kwargs = dict()

for client_address, results in self.entries.items():
client = PortalClient(client_address)
client = PortalClient(client_address, **client_kwargs)

rec_ids = [result.record_id for result in results]
# Do one big request to save time
Expand Down Expand Up @@ -791,7 +801,9 @@ def from_server(
spec_name,
)

def to_records(self) -> List[Tuple[TorsiondriveRecord, Molecule]]:
def to_records(
self, client_kwargs: Optional[dict] = None
) -> List[Tuple[TorsiondriveRecord, Molecule]]:
"""Returns the native QCPortal record objects for each of the records referenced
in this collection along with a corresponding OpenFF molecule object.

Expand All @@ -800,9 +812,11 @@ def to_records(self) -> List[Tuple[TorsiondriveRecord, Molecule]]:
"""

records_and_molecules = []
if client_kwargs is None:
client_kwargs = dict()

for client_address, records in self.entries.items():
client = PortalClient(client_address)
client = PortalClient(client_address, **client_kwargs)

# retrieve all torsiondrives at once, including their
# minimum_optimizations
Expand Down
Loading