|
5 | 5 | from itertools import chain
|
6 | 6 |
|
7 | 7 | from fireworks import Firework
|
| 8 | +from pymatgen.core.sites import Site |
| 9 | +from pymatgen.core.structure import Molecule |
8 | 10 |
|
9 | 11 | from atomate.qchem.firetasks.critic2 import ProcessCritic2, RunCritic2
|
10 | 12 | from atomate.qchem.firetasks.fragmenter import FragmentMolecule
|
11 | 13 | from atomate.qchem.firetasks.geo_transformations import PerturbGeometry
|
12 |
| -from atomate.qchem.firetasks.parse_outputs import QChemToDb |
| 14 | +from atomate.qchem.firetasks.parse_outputs import ProtCalcToDb, QChemToDb |
13 | 15 | from atomate.qchem.firetasks.run_calc import RunQChemCustodian
|
14 | 16 | from atomate.qchem.firetasks.write_inputs import WriteInputFromIOSet
|
15 | 17 |
|
@@ -99,6 +101,121 @@ def __init__(
|
99 | 101 | super().__init__(t, parents=parents, name=name, **kwargs)
|
100 | 102 |
|
101 | 103 |
|
| 104 | +class ProtonEnergyFW(Firework): |
| 105 | + def __init__( |
| 106 | + self, |
| 107 | + name="proton electronic energy", |
| 108 | + qchem_cmd=">>qchem_cmd<<", |
| 109 | + multimode=">>multimode<<", |
| 110 | + max_cores=">>max_cores<<", |
| 111 | + qchem_input_params=None, |
| 112 | + db_file=None, |
| 113 | + parents=None, |
| 114 | + max_errors=5, |
| 115 | + **kwargs |
| 116 | + ): |
| 117 | + """ |
| 118 | + For this custom Firework the electronic energy of a proton in a specific solvent environment is approximated. |
| 119 | + Since a proton has 0 electrons,running a QChem job would yield an error. The energy can be approximated by |
| 120 | + calculating the electronic energy of a proton and a hydrogen atom at infinite separation and then subtracting |
| 121 | + the electronic energy of a hydrogen atom. This Firework combines these two calculations and adds a task doc to the |
| 122 | + DB with the separate calculation details and the effective energy after subtraction. |
| 123 | +
|
| 124 | + Args: |
| 125 | + name (str): Name for the Firework. |
| 126 | + qchem_cmd (str): Command to run QChem. Supports env_chk. |
| 127 | + multimode (str): Parallelization scheme, either openmp or mpi. Supports env_chk. |
| 128 | + max_cores (int): Maximum number of cores to parallelize over. Supports env_chk. |
| 129 | + qchem_input_params (dict): Specify kwargs for instantiating the input set parameters |
| 130 | + calculating the electronic energy of the proton in a specific solvent environment. |
| 131 | + The energy of the proton will be effectively zero in vacuum. Use either pcm_dieletric |
| 132 | + or some smd_solvent.Basic uses would be to modify the default inputs of the set, |
| 133 | + such as dft_rung, basis_set, pcm_dielectric, scf_algorithm, or max_scf_cycles. |
| 134 | + See pymatgen/io/qchem/sets.py for default values of all input parameters. For |
| 135 | + instance, if a user wanted to use a more advanced DFT functional, include a pcm |
| 136 | + with a dielectric of 30, and use a larger basis, the user would set |
| 137 | + qchem_input_params = {"dft_rung": 5, "pcm_dielectric": 30, "basis_set": |
| 138 | + "6-311++g**"}. However, more advanced customization of the input is also |
| 139 | + possible through the overwrite_inputs key which allows the user to directly |
| 140 | + modify the rem, pcm, smd, and solvent dictionaries that QChemDictSet passes to |
| 141 | + inputs.py to print an actual input file. For instance, if a user wanted to set |
| 142 | + the sym_ignore flag in the rem section of the input file to true, then they |
| 143 | + would set qchem_input_params = {"overwrite_inputs": "rem": {"sym_ignore": |
| 144 | + "true"}}. Of course, overwrite_inputs could be used in conjunction with more |
| 145 | + typical modifications, as seen in the test_double_FF_opt workflow test. |
| 146 | + db_file (str): Path to file specifying db credentials to place output parsing. |
| 147 | + parents ([Firework]): Parents of this particular Firework. |
| 148 | + **kwargs: Other kwargs that are passed to Firework.__init__. |
| 149 | + """ |
| 150 | + |
| 151 | + qchem_input_params = qchem_input_params or {} |
| 152 | + |
| 153 | + H_site = Site("H", [0.0, 0.0, 0.0]) |
| 154 | + H_site_inf = Site("H", [100000.0, 0.0, 0.0]) |
| 155 | + H0_atom = Molecule.from_sites([H_site]) |
| 156 | + H2_plus_mol = Molecule.from_sites([H_site, H_site_inf]) |
| 157 | + H0_atom.set_charge_and_spin(0, 2) |
| 158 | + H2_plus_mol.set_charge_and_spin(1, 2) |
| 159 | + input_file_1 = "H0.qin" |
| 160 | + output_file_1 = "H0.qout" |
| 161 | + input_file_2 = "H2_plus.qin" |
| 162 | + output_file_2 = "H2_plus.qout" |
| 163 | + t = [] |
| 164 | + t.append( |
| 165 | + WriteInputFromIOSet( |
| 166 | + molecule=H0_atom, |
| 167 | + qchem_input_set="SinglePointSet", |
| 168 | + input_file=input_file_1, |
| 169 | + qchem_input_params=qchem_input_params, |
| 170 | + ) |
| 171 | + ) |
| 172 | + t.append( |
| 173 | + RunQChemCustodian( |
| 174 | + qchem_cmd=qchem_cmd, |
| 175 | + multimode=multimode, |
| 176 | + input_file=input_file_1, |
| 177 | + output_file=output_file_1, |
| 178 | + max_cores=max_cores, |
| 179 | + max_errors=max_errors, |
| 180 | + job_type="normal", |
| 181 | + gzipped_output=False, |
| 182 | + ) |
| 183 | + ) |
| 184 | + |
| 185 | + t.append( |
| 186 | + WriteInputFromIOSet( |
| 187 | + molecule=H2_plus_mol, |
| 188 | + qchem_input_set="SinglePointSet", |
| 189 | + input_file=input_file_2, |
| 190 | + qchem_input_params=qchem_input_params, |
| 191 | + ) |
| 192 | + ) |
| 193 | + t.append( |
| 194 | + RunQChemCustodian( |
| 195 | + qchem_cmd=qchem_cmd, |
| 196 | + multimode=multimode, |
| 197 | + input_file=input_file_2, |
| 198 | + output_file=output_file_2, |
| 199 | + max_cores=max_cores, |
| 200 | + max_errors=max_errors, |
| 201 | + job_type="normal", |
| 202 | + gzipped_output=False, |
| 203 | + ) |
| 204 | + ) |
| 205 | + t.append( |
| 206 | + ProtCalcToDb( |
| 207 | + db_file=db_file, |
| 208 | + input_file_H0=input_file_1, |
| 209 | + output_file_H0=output_file_1, |
| 210 | + input_file_H2=input_file_2, |
| 211 | + output_file_H2=output_file_2, |
| 212 | + additional_fields={"task_label": name}, |
| 213 | + ) |
| 214 | + ) |
| 215 | + |
| 216 | + super().__init__(t, parents=parents, name=name, **kwargs) |
| 217 | + |
| 218 | + |
102 | 219 | class ForceFW(Firework):
|
103 | 220 | def __init__(
|
104 | 221 | self,
|
|
0 commit comments