def test_from_schema(): protocol_a = DummyProtocol("protocol_a") protocol_a.input_value = 1 * unit.kelvin schema = WorkflowSchema() schema.protocol_schemas = [protocol_a.schema] workflow = Workflow.from_schema(schema, {}, unique_id="") assert workflow is not None rebuilt_schema = workflow.schema rebuilt_schema.outputs_to_store = UNDEFINED assert rebuilt_schema.json(format=True) == schema.json(format=True)
def main(): setup_timestamp_logging() # Retrieve the current version. version = evaluator.__version__.replace(".", "-").replace("v", "") if "+" in version: version = "latest" # Create a new directory to run the current versions results in. os.makedirs(os.path.join(version, "results")) with temporarily_change_directory(version): # Load in the force field force_field = ForceField( "openff-1.2.0.offxml", get_data_filename("forcefield/tip3p.offxml"), ) force_field_source = SmirnoffForceFieldSource.from_object(force_field) force_field_source.json("force-field.json") # Load in the data set, retaining only a specific host / guest pair. binding_affinity = TaproomDataSet( host_codes=["acd"], guest_codes=["bam"], default_ionic_strength=150 * unit.millimolar, ).properties[0] # Set up the calculation schema = HostGuestBindingAffinity.default_paprika_schema( n_solvent_molecules=2000).workflow_schema schema.replace_protocol_types({ "BaseBuildSystem": ("BuildSmirnoffSystem" if isinstance( force_field_source, SmirnoffForceFieldSource) else "BuildTLeapSystem" if isinstance( force_field_source, TLeapForceFieldSource) else "BaseBuildSystem") }) metadata = Workflow.generate_default_metadata(binding_affinity, "force-field.json", UNDEFINED) workflow = Workflow.from_schema(schema, metadata, "acd_bam") # Run the calculation with DaskLSFBackend( minimum_number_of_workers=1, maximum_number_of_workers=50, resources_per_worker=QueueWorkerResources( number_of_gpus=1, preferred_gpu_toolkit=QueueWorkerResources.GPUToolkit.CUDA, per_thread_memory_limit=5 * unit.gigabyte, wallclock_time_limit="05:59", ), setup_script_commands=[ "conda activate openff-evaluator-paprika", "module load cuda/10.0", ], queue_name="gpuqueue", ) as calculation_backend: results = workflow.execute( root_directory="workflow", calculation_backend=calculation_backend).result() # Save the results results.json("results.json", format=True)