Skip to content

Commit

Permalink
The filename will be used as name by default
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Feb 11, 2022
1 parent 9b53c64 commit 5679583
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions ccinput/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def test_basic_file(self):
'file': self.struct('ethanol'),
'nproc': 1,
'mem': "1G",
'name': 'ethanol',
}
line = f"gaussian sp HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -68,6 +69,7 @@ def test_freeze_distance(self):
'nproc': 1,
'mem': "1G",
'constraints': "Freeze/1_2;",
'name': 'ethanol',
}
line = f"gaussian constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --freeze 1 2"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -82,6 +84,7 @@ def test_freeze_angle(self):
'nproc': 1,
'mem': "1G",
'constraints': "Freeze/3_2_4;",
'name': 'ethanol',
}
line = f"gaussian constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --freeze 3 2 4"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -96,6 +99,7 @@ def test_freeze_dihedral(self):
'nproc': 1,
'mem': "1G",
'constraints': "Freeze/6_3_1_2;",
'name': 'ethanol',
}
line = f"gaussian constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --freeze 6 3 1 2"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -110,6 +114,7 @@ def test_scan_distance(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2;",
'name': 'ethanol',
}
line = f"orca constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 --from 2.0 --to 1.0 --nsteps 10"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -124,6 +129,7 @@ def test_scan_distance_multiple(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2;Scan_2.0_1.0_10/3_4;",
'name': 'ethanol',
}
line = f"orca constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 --from 2.0 --to 1.0 --nsteps 10 --scan 3 4 --from 2.0 --to 1.0 --nsteps 10"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -138,6 +144,7 @@ def test_scan_distance_multiple_no_from(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2;Scan_2.0_1.0_10/3_4;",
'name': 'ethanol',
}
line = f"gaussian constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 --to 1.0 --nsteps 10 --scan 3 4 --to 1.0 --nsteps 10"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -152,6 +159,7 @@ def test_scan_distance_multiple_step(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2;Scan_2.0_1.0_10/3_4;",
'name': 'ethanol',
}
line = f"orca constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 --from 2.0 --to 1.0 --step -0.1 --scan 3 4 --from 2.0 --to 1.0 --step -0.1"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -166,6 +174,7 @@ def test_scan_distance_step_wrong_sign(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2;Scan_2.0_1.0_10/3_4;",
'name': 'ethanol',
}
line = f"orca constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 --from 2.0 --to 1.0 --step 0.1 --scan 3 4 --from 2.0 --to 1.0 --step 0.1"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -180,6 +189,7 @@ def test_scan_angle(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2_3;",
'name': 'ethanol',
}
line = f"orca constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 3 --from 2.0 --to 1.0 --nsteps 10"
self.assertTrue(self.are_equivalent(args, line))
Expand All @@ -194,6 +204,7 @@ def test_scan_dihedral(self):
'nproc': 1,
'mem': "1G",
'constraints': "Scan_2.0_1.0_10/1_2_3_4;",
'name': 'ethanol',
}
line = f"orca constr_opt HF -bs Def2SVP -f {self.struct('ethanol')} -n 1 --mem 1G --scan 1 2 3 4 --from 2.0 --to 1.0 --nsteps 10"
self.assertTrue(self.are_equivalent(args, line))
Expand Down
6 changes: 5 additions & 1 deletion ccinput/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def cmd():
print(inp)

def get_input_from_args(args):
if args.name == "calc" and args.file:
_name = os.path.basename(args.file).split('.')[0]
else:
_name = args.name
try:
inp = gen_input(software=args.software, type=args.type, method=args.method,
basis_set=args.basis_set, solvent=args.solvent,
Expand All @@ -182,7 +186,7 @@ def get_input_from_args(args):
custom_basis_sets=args.custom_basis_sets, xyz=args.xyz, file=args.file,
constraints=args.constraints, nproc=args.nproc, mem=args.mem,
charge=args.charge, multiplicity=args.mult, d3=args.d3, d3bj=args.d3bj,
aux_name=args.aux_name, name=args.name, header=args.header)
aux_name=args.aux_name, name=_name, header=args.header)
except CCInputException as e:
print(f"*** {str(e)} ***")
return
Expand Down

0 comments on commit 5679583

Please sign in to comment.