@@ -529,6 +529,84 @@ def test_parse_thermo_comments(self):
529529 assert source ["GAV" ]["ring" ][0 ][1 ] == - 1 # the weight of benzene contribution should be -1
530530 assert source ["GAV" ]["group" ][0 ][1 ] == 2 # weight of the group(Cs-CsCsHH) conbtribution should be 2
531531
532+ # ------------------------------- Surface Examples ---------------------------
533+ # Surface library only
534+ OX = rmgpy .species .Species (smiles = "O=*" )
535+ OX .thermo = rmgpy .thermo .NASA ()
536+ OX .thermo .comment = 'Thermo library: surfaceThermoPt111'
537+ source = self .database .extract_source_from_comments (OX )
538+ assert "Library" in source
539+ assert source ["Library" ] == "surfaceThermoPt111"
540+
541+ # Gas library + adsorption correction
542+ CH2X = rmgpy .species .Species (smiles = "[CH2]=*" )
543+ CH2X .thermo = rmgpy .thermo .NASA ()
544+ CH2X .thermo .comment = 'Gas phase thermo for CH2(T) from Thermo library: primaryThermoLibrary. Adsorption correction: + Thermo group additivity estimation:\n adsorptionPt111(C=*R2)'
545+ source = self .database .extract_source_from_comments (CH2X )
546+ assert "Library" in source
547+ assert source ["Library" ] == "primaryThermoLibrary"
548+ assert "ADS" in source
549+ assert source ['ADS' ]['adsorptionPt111' ][0 ][0 ].label == 'C=*R2'
550+ assert source ['ADS' ]['adsorptionPt111' ][0 ][1 ] == 1 # weight should be 1
551+ assert len (source ['ADS' ]['adsorptionPt111' ]) == 1 # there should only be one adsorption contribution
552+
553+ # GAV gas + adsorption correction
554+ CO2X = rmgpy .species .Species (smiles = "O=C=O.*" )
555+ CO2X .thermo = rmgpy .thermo .NASA ()
556+ CO2X .thermo .comment = 'Gas phase thermo for O=C=O from Thermo group additivity estimation: group(Cdd-OdOd). Adsorption correction: + Thermo group additivity estimation:\n adsorptionPt111((CR2)*)'
557+ source = self .database .extract_source_from_comments (CO2X )
558+ assert "GAV" in source
559+ assert source ["GAV" ]["group" ][0 ][0 ].label == "Cdd-OdOd"
560+ assert source ["GAV" ]["group" ][0 ][1 ] == 1 # weight should be 1
561+ assert len (source ["GAV" ]["group" ]) == 1 # there should only be one GAV contribution
562+ assert "ADS" in source
563+ assert source ['ADS' ]['adsorptionPt111' ][0 ][0 ].label == '(CR2)*'
564+ assert source ['ADS' ]['adsorptionPt111' ][0 ][1 ] == 1 # weight should be 1
565+ assert len (source ['ADS' ]['adsorptionPt111' ]) == 1 # there should only be one adsorption contribution
566+
567+ # Gas library + radical for HBI + adsorption correction
568+ CHOX = rmgpy .species .Species (smiles = "O=[CH]*" )
569+ CHOX .thermo = rmgpy .thermo .NASA ()
570+ CHOX .thermo .comment = 'Gas phase thermo for [CH]=O from Thermo library: primaryThermoLibrary + radical(HCdsJO). Adsorption correction: + Thermo group additivity estimation: adsorptionPt111(C-*R3)'
571+ source = self .database .extract_source_from_comments (CHOX )
572+ assert "Library" in source
573+ assert source ["Library" ] == "primaryThermoLibrary"
574+ assert "GAV" in source
575+ assert source ["GAV" ]["radical" ][0 ][0 ].label == "HCdsJO"
576+ assert source ["GAV" ]["radical" ][0 ][1 ] == 1 # weight should be 1
577+ assert len (source ["GAV" ]["radical" ]) == 1 # there should only be one radical contribution
578+ assert "ADS" in source
579+ assert source ['ADS' ]['adsorptionPt111' ][0 ][0 ].label == 'C-*R3'
580+ assert source ['ADS' ]['adsorptionPt111' ][0 ][1 ] == 1 # weight should be 1
581+ assert len (source ['ADS' ]['adsorptionPt111' ]) == 1 # there should only be one adsorption contribution
582+
583+ # Also test that the database is retrieving and assembling comments correctly
584+ # Here we use the extremely limited test database already available in memory
585+ OX_comment = self .database .get_thermo_data (OX ).comment
586+ OX .thermo .comment = OX_comment # set the comment to be the generated comment
587+ source = self .database .extract_source_from_comments (OX )
588+ assert "Library" in source
589+ assert source ["Library" ] == "primaryThermoLibrary"
590+ assert 'ADS' in source
591+ assert source ['ADS' ]['adsorptionPt111' ][0 ][0 ].label == 'O=*'
592+ assert source ['ADS' ]['adsorptionPt111' ][0 ][1 ] == 1 # weight should be 1
593+ assert len (source ['ADS' ]['adsorptionPt111' ]) == 1 # there should only be one adsorption contribution
594+
595+ # an example with a radical and a library and an adsorption correction
596+ CH2CHCH_ads = rmgpy .species .Species (smiles = "[CH]C=C.*" )
597+ CH2CHCH_ads .thermo = self .database .get_thermo_data (CH2CHCH_ads )
598+ source = self .database .extract_source_from_comments (CH2CHCH_ads )
599+ assert "Library" in source
600+ assert source ["Library" ] == "DFT_QCI_thermo"
601+ assert "GAV" in source
602+ assert source ["GAV" ]["radical" ][0 ][0 ].label == "AllylJ2_triplet"
603+ assert source ["GAV" ]["radical" ][0 ][1 ] == 1 # weight should be 1
604+ assert len (source ["GAV" ]["radical" ]) == 1 # there should only be one radical contribution
605+ assert "ADS" in source
606+ assert source ['ADS' ]['adsorptionPt111' ][0 ][0 ].label == '(CR2CR)*'
607+ assert source ['ADS' ]['adsorptionPt111' ][0 ][1 ] == 1 # weight should be 1
608+ assert len (source ['ADS' ]['adsorptionPt111' ]) == 1 # there should only be one adsorption contribution
609+
532610 def test_species_thermo_generation_hbi_library (self ):
533611 """Test thermo generation for species objects for HBI correction on library value.
534612
0 commit comments