Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orca 5 sol #709

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions arc/job/adapters/orca.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
An adapter for executing Orca jobs
An adapter for executing Orca 5 jobs

https://orcaforum.kofo.mpg.de/app.php/portal
"""
Expand Down Expand Up @@ -47,16 +47,13 @@
# method_class: 'HF' for wavefunction methods (hf, mp, cc, dlpno ...). 'KS' for DFT methods.
# options: additional keywords to control job (e.g., TightSCF, NormalPNO ...)
input_template = """!${restricted}${method_class} ${method} ${basis} ${auxiliary_basis} ${keywords}
! NRSCF # using Newton–Raphson SCF algorithm
!${job_type_1}
${job_type_2}
%%maxcore ${memory}
%%pal # job parallelization settings
nprocs ${cpus}
end
%%scf # recommended SCF settings
NRMaxIt 400
NRStart 0.00005
MaxIter 500
end${scan}
${block}
Expand Down Expand Up @@ -312,6 +309,20 @@ def write_input_file(self) -> None:
input_dict['scan'] += f'\nD {torsion} = {dihedral:.1f}, {dihedral - self.scan_res:.1f}, {self.scan_res:.1f}\n'
input_dict['scan'] += '\nend\nend' if len(self.torsions) > 1 else '\nend'

if self.level.solvation_method:
if self.level.solvation_method.lower() == 'smd':
self.add_to_args(val=f"""
%cpcm SMD true
SMDsolvent "{self.level.solvent}"
end
""",
key1='block')
elif self.level.solvation_method.lower() in ['pcm', 'cpcm']:
self.add_to_args(val=f"""
!CPCM({self.level.solvent})
""",
key1='block')

input_dict = update_input_dict_with_args(args=self.args, input_dict=input_dict)

with open(os.path.join(self.local_path, input_filenames[self.job_adapter]), 'w') as f:
Expand Down
111 changes: 101 additions & 10 deletions arc/job/adapters/orca_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""
This module contains unit tests of the arc.job.adapters.orca module
Compatible with Orca version 5
"""

import math
Expand Down Expand Up @@ -40,36 +41,59 @@ def setUpClass(cls):
H -0.53338088 -0.77135867 -0.54806440""")],
testing=True,
)

cls.job_2 = OrcaAdapter(execution_type='queue',
job_type='sp',
level=Level(method='DLPNO-CCSD(T)', basis='def2-tzvp', auxiliary_basis='def2-tzvp/c',
solvation_method='SMD', solvent='DMSO'),
project='test',
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_OrcaAdapter'),
species=[ARCSpecies(label='CH3O',
xyz="""C 0.03807240 0.00035621 -0.00484242
O 1.35198769 0.01264937 -0.17195885
H -0.33965241 -0.14992727 1.02079480
H -0.51702680 0.90828035 -0.29592912
H -0.53338088 -0.77135867 -0.54806440""")],
testing=True,
)
cls.job_3 = OrcaAdapter(execution_type='queue',
job_type='sp',
level=Level(method='DLPNO-CCSD(T)', basis='def2-tzvp', auxiliary_basis='def2-tzvp/c',
solvation_method='cpcm', solvent='water'),
project='test',
project_directory=os.path.join(ARC_PATH, 'arc', 'testing', 'test_OrcaAdapter'),
species=[ARCSpecies(label='CH3O',
xyz="""C 0.03807240 0.00035621 -0.00484242
O 1.35198769 0.01264937 -0.17195885
H -0.33965241 -0.14992727 1.02079480
H -0.51702680 0.90828035 -0.29592912
H -0.53338088 -0.77135867 -0.54806440""")],
testing=True,
)
def test_set_cpu_and_mem(self):
"""Test assigning number of cpu's and memory"""
self.job_1.cpu_cores = 48
self.job_1.input_file_memory = None
self.job_1.submit_script_memory = None
self.job_1.set_cpu_and_mem()
self.assertEqual(self.job_1.cpu_cores, 48)
self.assertEqual(self.job_1.cpu_cores, 8)

def test_set_input_file_memory(self):
"""Test setting the input_file_memory argument"""
expected_memory = math.ceil(14 * 1024 / 48)
expected_memory = math.ceil(14 * 1024 / 8)
self.assertEqual(self.job_1.input_file_memory, expected_memory)

def test_write_input_file(self):
"""Test writing Gaussian input files"""
"""Test writing Orca input files"""
self.job_1.write_input_file()
with open(os.path.join(self.job_1.local_path, input_filenames[self.job_1.job_adapter]), 'r') as f:
content_1 = f.read()
job_1_expected_input_file = """!uHF dlpno-ccsd(t) def2-tzvp def2-tzvp/c tightscf normalpno
! NRSCF # using Newton–Raphson SCF algorithm
!sp

%maxcore 299
%maxcore 1792
%pal # job parallelization settings
nprocs 48
nprocs 8
end
%scf # recommended SCF settings
NRMaxIt 400
NRStart 0.00005
MaxIter 500
end

Expand All @@ -84,6 +108,73 @@ def test_write_input_file(self):
"""
self.assertEqual(content_1, job_1_expected_input_file)

def test_write_input_file_with_SMD_solvation(self):
"""Test writing ORCA input files with SMD solvation"""
self.job_2.write_input_file()
with open(os.path.join(self.job_2.local_path, input_filenames[self.job_2.job_adapter]), 'r') as f:
content_2 = f.read()
job_2_expected_input_file = """!uHF dlpno-ccsd(t) def2-tzvp def2-tzvp/c tightscf normalpno
!sp

%maxcore 1792
%pal # job parallelization settings
nprocs 8
end
%scf # recommended SCF settings
MaxIter 500
end



%cpcm SMD true
SMDsolvent "dmso"
end



* xyz 0 2
C 0.03807240 0.00035621 -0.00484242
O 1.35198769 0.01264937 -0.17195885
H -0.33965241 -0.14992727 1.02079480
H -0.51702680 0.90828035 -0.29592912
H -0.53338088 -0.77135867 -0.54806440
*
"""
self.assertEqual(content_2, job_2_expected_input_file)


def test_write_input_file_with_CPCM_solvation(self):
"""Test writing ORCA input files with CPCM solvation"""
self.job_3.write_input_file()
with open(os.path.join(self.job_3.local_path, input_filenames[self.job_3.job_adapter]), 'r') as f:
content_3 = f.read()
job_3_expected_input_file = """!uHF dlpno-ccsd(t) def2-tzvp def2-tzvp/c tightscf normalpno
!sp

%maxcore 1792
%pal # job parallelization settings
nprocs 8
end
%scf # recommended SCF settings
MaxIter 500
end



!CPCM(water)



* xyz 0 2
C 0.03807240 0.00035621 -0.00484242
O 1.35198769 0.01264937 -0.17195885
H -0.33965241 -0.14992727 1.02079480
H -0.51702680 0.90828035 -0.29592912
H -0.53338088 -0.77135867 -0.54806440
*
"""
self.assertEqual(content_3, job_3_expected_input_file)

def test_set_files(self):
"""Test setting files"""
job_1_files_to_upload = [{'file_name': 'submit.sub',
Expand Down
2 changes: 1 addition & 1 deletion arc/statmech/arkane.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
if not os.path.isfile(freq_path):
return_none_text = f'the freq file in path {freq_path}'
if not os.path.isfile(sp_path):
return_none_text = f'the freq file in path {sp_path}'
return_none_text = f'the sp file in path {sp_path}'

Check warning on line 543 in arc/statmech/arkane.py

View check run for this annotation

Codecov / codecov/patch

arc/statmech/arkane.py#L543

Added line #L543 was not covered by tests
if return_none_text is not None:
logger.error(f'Could not find {return_none_text} for species {species.label}. Not calculating properties.')
return None
Expand Down
Loading