@@ -422,86 +422,97 @@ def test_quick_step() -> None:
422
422
423
423
424
424
@pytest .mark .parametrize (
425
- 'basis_set_name, basis_type, role' ,
425
+ 'basis_set_name, basis_type, role, expected_name, expected_type, expected_role ' ,
426
426
[
427
- ('cc-pVTZ' , 'GTO' , 'orbital' ),
428
- ('def2-TZVP' , 'GTO' , 'auxiliary_scf' ),
429
- ('aug-cc-pVDZ' , 'STO' , 'auxiliary_post_hf' ),
430
- ('custom_basis' , None , None ), # Undefined type and role
427
+ ('cc-pVTZ' , 'GTO' , 'orbital' , 'cc-pVTZ' , 'GTO' , 'orbital' ),
428
+ ('def2-TZVP' , 'GTO' , 'auxiliary_scf' , 'def2-TZVP' , 'GTO' , 'auxiliary_scf' ),
429
+ ('aug-cc-pVDZ' , 'STO' , 'auxiliary_post_hf' , 'aug-cc-pVDZ' , 'STO' , 'auxiliary_post_hf' ),
430
+ ('custom_basis' , None , None , 'custom_basis' , None , None ), # Undefined type and role
431
431
],
432
432
)
433
- def test_atom_centered_basis_set_init (basis_set_name , basis_type , role ) -> None :
433
+ def test_atom_centered_basis_set_init (
434
+ basis_set_name , basis_type , role , expected_name , expected_type , expected_role
435
+ ):
434
436
"""Test initialization of AtomCenteredBasisSet."""
435
437
bs = AtomCenteredBasisSet (basis_set = basis_set_name , type = basis_type , role = role )
436
- assert bs .basis_set == basis_set_name
437
- assert bs .type == basis_type
438
- assert bs .role == role
438
+ assert bs .basis_set == expected_name
439
+ assert bs .type == expected_type
440
+ assert bs .role == expected_role
439
441
440
442
441
443
@pytest .mark .parametrize (
442
- 'functions' ,
444
+ 'functions, expected_count ' ,
443
445
[
444
- [
445
- AtomCenteredFunction (
446
- basis_type = 'spherical' ,
447
- function_type = 's' ,
448
- n_primitive = 3 ,
449
- exponents = [1.0 , 2.0 , 3.0 ],
450
- contraction_coefficients = [0.5 , 0.3 , 0.2 ],
451
- ),
452
- ],
453
- [
454
- AtomCenteredFunction (
455
- basis_type = 'cartesian' ,
456
- function_type = 'p' ,
457
- n_primitive = 1 ,
458
- exponents = [0.5 ],
459
- contraction_coefficients = [1.0 ],
460
- ),
461
- AtomCenteredFunction (
462
- basis_type = 'spherical' ,
463
- function_type = 'd' ,
464
- n_primitive = 2 ,
465
- exponents = [1.0 , 2.0 ],
466
- contraction_coefficients = [0.4 , 0.6 ],
467
- ),
468
- ],
446
+ (
447
+ [
448
+ AtomCenteredFunction (
449
+ harmonic_type = 'spherical' ,
450
+ function_type = 's' ,
451
+ n_primitive = 3 ,
452
+ exponents = [1.0 , 2.0 , 3.0 ],
453
+ contraction_coefficients = [0.5 , 0.3 , 0.2 ],
454
+ ),
455
+ ],
456
+ 1 ,
457
+ ),
458
+ (
459
+ [
460
+ AtomCenteredFunction (
461
+ harmonic_type = 'cartesian' ,
462
+ function_type = 'p' ,
463
+ n_primitive = 1 ,
464
+ exponents = [0.5 ],
465
+ contraction_coefficients = [1.0 ],
466
+ ),
467
+ AtomCenteredFunction (
468
+ harmonic_type = 'spherical' ,
469
+ function_type = 'd' ,
470
+ n_primitive = 2 ,
471
+ exponents = [1.0 , 2.0 ],
472
+ contraction_coefficients = [0.4 , 0.6 ],
473
+ ),
474
+ ],
475
+ 2 ,
476
+ ),
469
477
],
470
478
)
471
- def test_atom_centered_basis_set_functional_composition (functions ) -> None :
479
+ def test_atom_centered_basis_set_functional_composition (functions , expected_count ) :
472
480
"""Test functional composition within AtomCenteredBasisSet."""
473
481
bs = AtomCenteredBasisSet (functional_composition = functions )
474
- assert len (bs .functional_composition ) == len ( functions )
482
+ assert len (bs .functional_composition ) == expected_count
475
483
for f , ref_f in zip (bs .functional_composition , functions ):
476
- assert f .basis_type == ref_f .basis_type
484
+ assert f .harmonic_type == ref_f .harmonic_type
477
485
assert f .function_type == ref_f .function_type
478
486
assert f .n_primitive == ref_f .n_primitive
479
487
assert np .allclose (f .exponents , ref_f .exponents )
480
488
assert np .allclose (f .contraction_coefficients , ref_f .contraction_coefficients )
481
489
482
490
483
- def test_atom_centered_basis_set_normalize () -> None :
491
+ def test_atom_centered_basis_set_normalize ():
484
492
"""Test normalization of AtomCenteredBasisSet."""
485
493
bs = AtomCenteredBasisSet (
486
494
basis_set = 'cc-pVTZ' ,
487
495
type = 'GTO' ,
488
496
role = 'orbital' ,
489
497
functional_composition = [
490
498
AtomCenteredFunction (
491
- basis_type = 'spherical' ,
499
+ harmonic_type = 'spherical' ,
492
500
function_type = 's' ,
493
501
n_primitive = 2 ,
494
502
exponents = [1.0 , 2.0 ],
495
503
contraction_coefficients = [0.5 , 0.5 ],
496
504
)
497
505
],
498
506
)
499
- bs .normalize (None , logger )
500
- # Add checks for normalized behavior, if any
507
+ bs .normalize (None , None )
508
+ # Add assertions for normalized attributes if needed
501
509
assert bs .basis_set == 'cc-pVTZ'
510
+ assert bs .type == 'GTO'
511
+ assert bs .role == 'orbital'
512
+ assert len (bs .functional_composition ) == 1
502
513
503
514
504
- def test_atom_centered_basis_set_invalid_data () -> None :
515
+ def test_atom_centered_basis_set_invalid_data ():
505
516
"""Test behavior with missing or invalid data."""
506
517
bs = AtomCenteredBasisSet (
507
518
basis_set = 'invalid_basis' ,
@@ -514,7 +525,7 @@ def test_atom_centered_basis_set_invalid_data() -> None:
514
525
515
526
# Test functional composition with invalid data
516
527
invalid_function = AtomCenteredFunction (
517
- basis_type = 'spherical' ,
528
+ harmonic_type = 'spherical' ,
518
529
function_type = 's' ,
519
530
n_primitive = 2 ,
520
531
exponents = [1.0 ], # Mismatched length
@@ -524,4 +535,5 @@ def test_atom_centered_basis_set_invalid_data() -> None:
524
535
525
536
# Call normalize to trigger validation
526
537
with pytest .raises (ValueError , match = 'Mismatch in number of exponents' ):
527
- invalid_function .normalize (None , logger )
538
+ invalid_function .normalize (None , None )
539
+
0 commit comments