@@ -991,6 +991,42 @@ def test_make_fp_siesta(self):
991991 _check_potcar (self , 0 , jdata ["fp_pp_path" ], jdata ["fp_pp_files" ])
992992 shutil .rmtree ("iter.000000" )
993993
994+ def test_make_fp_siesta_with_element_subset (self ):
995+ """Each SIESTA input should select PPs for its present elements."""
996+ setUpModule ()
997+ if os .path .isdir ("iter.000000" ):
998+ shutil .rmtree ("iter.000000" )
999+ with open (param_siesta_file ) as fp :
1000+ jdata = json .load (fp )
1001+ md_descript = []
1002+ for _ in range (2 ):
1003+ system_deviations = []
1004+ for _ in range (3 ):
1005+ system_deviations .append (np .arange (0 , 0.29 , 0.29 / 10 ))
1006+ md_descript .append (system_deviations )
1007+
1008+ try :
1009+ _make_fake_md (0 , md_descript , [0 ] * 6 , jdata ["type_map" ])
1010+ make_fp (0 , jdata , {})
1011+
1012+ tasks = glob .glob (os .path .join ("iter.000000" , "02.fp" , "task.*" ))
1013+ self .assertGreater (len (tasks ), 0 )
1014+ for task in tasks :
1015+ with open (os .path .join (task , "input" )) as fp :
1016+ input_text = fp .read ()
1017+ self .assertIn ("NumberOfSpecies 1" , input_text )
1018+ species_block = input_text .split (
1019+ "%block Chemical_Species_label\n " , maxsplit = 1
1020+ )[1 ].split ("%endblock Chemical_Species_label" , maxsplit = 1 )[0 ]
1021+ species_lines = [
1022+ line for line in species_block .splitlines () if line .strip ()
1023+ ]
1024+ self .assertEqual (1 , len (species_lines ))
1025+ self .assertEqual ("C" , species_lines [0 ].split ()[- 1 ])
1026+ finally :
1027+ if os .path .isdir ("iter.000000" ):
1028+ shutil .rmtree ("iter.000000" )
1029+
9941030
9951031class TestMakeFPVasp (unittest .TestCase ):
9961032 def test_make_fp_vasp (self ):
0 commit comments