File tree 4 files changed +49
-1
lines changed
4 files changed +49
-1
lines changed Original file line number Diff line number Diff line change
1
+ 9
2
+
3
+ C -1.31970 -0.64380 0.00000
4
+ H -0.96310 -1.65260 0.00000
5
+ H -0.96310 -0.13940 -0.87370
6
+ H -2.38970 -0.64380 0.00000
7
+ C -0.80640 0.08220 1.25740
8
+ H -1.16150 1.09160 1.25640
9
+ H -1.16470 -0.42110 2.13110
10
+ O 0.62360 0.07990 1.25870
11
+ H 0.94410 0.53240 2.04240
12
+
Original file line number Diff line number Diff line change @@ -762,6 +762,20 @@ def test_synonym_basis_set(self):
762
762
763
763
objs , outputs = get_input_from_args (args )
764
764
765
+ def test_file_extra_line (self ):
766
+ args = {
767
+ "software" : "gaussian" ,
768
+ "type" : "sp" ,
769
+ "method" : "HF" ,
770
+ "basis_set" : "Def2SVP" ,
771
+ "file" : self .struct ("ethanol_extra_line" ),
772
+ "nproc" : 1 ,
773
+ "mem" : "1G" ,
774
+ "name" : "ethanol" ,
775
+ }
776
+ line = f"gaussian sp HF -bs Def2SVP -f { self .struct ('ethanol' )} -n 1 --mem 1G"
777
+ self .assertTrue (self .args_cmd_equivalent (args , line ))
778
+
765
779
766
780
class CliPresetTests (InputTests ):
767
781
def test_create_preset (self ):
Original file line number Diff line number Diff line change @@ -82,6 +82,21 @@ def test_multiple_atoms_invalid_header2(self):
82
82
with self .assertRaises (InvalidXYZ ):
83
83
standardize_xyz (xyz )
84
84
85
+ def test_multiple_atoms_extra_lines (self ):
86
+ xyz = """3
87
+ header
88
+ Cl 0.0 0.0 0.0
89
+ Cl 0.0 0.0 0.0
90
+ Cl 0.0 0.0 0.0
91
+
92
+
93
+
94
+ """
95
+ self .assertEqual (
96
+ standardize_xyz (xyz ),
97
+ "Cl 0.00000000 0.00000000 0.00000000\n Cl 0.00000000 0.00000000 0.00000000\n Cl 0.00000000 0.00000000 0.00000000\n " ,
98
+ )
99
+
85
100
def test_invalid_element (self ):
86
101
xyz = "1\n \n Bl 0.0 0.0 0.0\n "
87
102
with self .assertRaises (InvalidXYZ ):
Original file line number Diff line number Diff line change @@ -159,7 +159,14 @@ def parse_xyz_from_file(path):
159
159
raise InvalidParameter (f"Input file not found: { path } " )
160
160
161
161
with open (path ) as f :
162
- lines = f .readlines ()
162
+ _lines = f .readlines ()
163
+
164
+ lines = _lines [2 :]
165
+
166
+ if len (_lines ) < 3 :
167
+ raise InvalidXYZ ("Invalid XYZ: No atoms specified" )
168
+
169
+ lines = [i .strip () for i in _lines [2 :] if i .strip () != "" ]
163
170
164
171
return standardize_xyz (lines )
165
172
You can’t perform that action at this time.
0 commit comments