File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,13 +170,19 @@ def handle_command(self):
170170
171171 electrons -= self .calc .charge
172172
173- if self .calc .multiplicity != 1 :
174- raise InvalidParameter ("Unimplemented multiplicity" )
173+ if self .calc .multiplicity == 1 :
174+ n_HOMO = (electrons // 2 ) - 1
175+ n_LUMO = electrons // 2
176+ n_LUMO1 = (electrons // 2 ) + 1
177+ n_LUMO2 = (electrons // 2 ) + 2
178+ elif self .calc .multiplicity == 2 :
179+ n_HOMO = ((electrons + 1 ) // 2 ) - 1
180+ n_LUMO = (electrons + 1 ) // 2
181+ n_LUMO1 = ((electrons + 1 ) // 2 ) + 1
182+ n_LUMO2 = ((electrons + 1 ) // 2 ) + 2
175183
176- n_HOMO = int (electrons / 2 ) - 1
177- n_LUMO = int (electrons / 2 )
178- n_LUMO1 = int (electrons / 2 ) + 1
179- n_LUMO2 = int (electrons / 2 ) + 2
184+ else :
185+ raise InvalidParameter ("Unimplemented multiplicity" )
180186
181187 mo_block = f"""%plots
182188 dim1 45
Original file line number Diff line number Diff line change @@ -227,6 +227,10 @@ def handle_specifications(self):
227227 self .cmd_arguments += "--squick "
228228 elif ss [0 ] == "mquick" :
229229 self .cmd_arguments += "--mquick "
230+ elif ss [0 ] == "molden" :
231+ self .cmd_arguments += "--molden "
232+ elif ss [0 ] == "json" :
233+ self .cmd_arguments += "--json "
230234 elif ss [0 ] == "concerted" :
231235 if self .calc .type not in [
232236 CalcType .CONSTR_OPT ,
@@ -237,7 +241,7 @@ def handle_specifications(self):
237241 self .concerted_scan = True
238242
239243 else :
240- raise InvalidParameter ("Invalid specification" )
244+ raise InvalidParameter ("Invalid specification: {ss} " )
241245 elif len (ss ) == 2 :
242246 if ss [0 ] == "o" or ss [0 ] == "opt" :
243247 if ss [1 ] not in [
Original file line number Diff line number Diff line change @@ -847,3 +847,35 @@ def test_unavailable_calc_type(self):
847847
848848 with self .assertRaises (ImpossibleCalculation ):
849849 xtb = self .generate_calculation (** params )
850+
851+ def test_molden_output (self ):
852+ params = {
853+ "type" : "Geometrical Optimisation" ,
854+ "file" : "Cl.xyz" ,
855+ "software" : "xtb" ,
856+ "charge" : "-1" ,
857+ "specifications" : "--molden" ,
858+ }
859+
860+ xtb = self .generate_calculation (** params )
861+
862+ REF = "xtb Cl.xyz --opt tight --chrg -1 --molden"
863+
864+ self .assertTrue (self .is_equivalent (REF , xtb .command ))
865+ self .assertTrue (self .is_equivalent ("" , xtb .input_file ))
866+
867+ def test_json_output (self ):
868+ params = {
869+ "type" : "Geometrical Optimisation" ,
870+ "file" : "Cl.xyz" ,
871+ "software" : "xtb" ,
872+ "charge" : "-1" ,
873+ "specifications" : "--JSon" ,
874+ }
875+
876+ xtb = self .generate_calculation (** params )
877+
878+ REF = "xtb Cl.xyz --opt tight --chrg -1 --json"
879+
880+ self .assertTrue (self .is_equivalent (REF , xtb .command ))
881+ self .assertTrue (self .is_equivalent ("" , xtb .input_file ))
You can’t perform that action at this time.
0 commit comments