|
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 | from pymatgen.core.structure import Molecule
|
@@ -210,6 +212,121 @@ def __init__(
|
210 | 212 | super().__init__(t, parents=parents, name=name, **kwargs)
|
211 | 213 |
|
212 | 214 |
|
| 215 | +class ProtonEnergyFW(Firework): |
| 216 | + def __init__( |
| 217 | + self, |
| 218 | + name="proton electronic energy", |
| 219 | + qchem_cmd=">>qchem_cmd<<", |
| 220 | + multimode=">>multimode<<", |
| 221 | + max_cores=">>max_cores<<", |
| 222 | + qchem_input_params=None, |
| 223 | + db_file=None, |
| 224 | + parents=None, |
| 225 | + max_errors=5, |
| 226 | + **kwargs |
| 227 | + ): |
| 228 | + """ |
| 229 | + For this custom Firework the electronic energy of a proton in a specific solvent environment is approximated. |
| 230 | + Since a proton has 0 electrons,running a QChem job would yield an error. The energy can be approximated by |
| 231 | + calculating the electronic energy of a proton and a hydrogen atom at infinite separation and then subtracting |
| 232 | + the electronic energy of a hydrogen atom. This Firework combines these two calculations and adds a task doc to the |
| 233 | + DB with the separate calculation details and the effective energy after subtraction. |
| 234 | +
|
| 235 | + Args: |
| 236 | + name (str): Name for the Firework. |
| 237 | + qchem_cmd (str): Command to run QChem. Supports env_chk. |
| 238 | + multimode (str): Parallelization scheme, either openmp or mpi. Supports env_chk. |
| 239 | + max_cores (int): Maximum number of cores to parallelize over. Supports env_chk. |
| 240 | + qchem_input_params (dict): Specify kwargs for instantiating the input set parameters |
| 241 | + calculating the electronic energy of the proton in a specific solvent environment. |
| 242 | + The energy of the proton will be effectively zero in vacuum. Use either pcm_dieletric |
| 243 | + or some smd_solvent.Basic uses would be to modify the default inputs of the set, |
| 244 | + such as dft_rung, basis_set, pcm_dielectric, scf_algorithm, or max_scf_cycles. |
| 245 | + See pymatgen/io/qchem/sets.py for default values of all input parameters. For |
| 246 | + instance, if a user wanted to use a more advanced DFT functional, include a pcm |
| 247 | + with a dielectric of 30, and use a larger basis, the user would set |
| 248 | + qchem_input_params = {"dft_rung": 5, "pcm_dielectric": 30, "basis_set": |
| 249 | + "6-311++g**"}. However, more advanced customization of the input is also |
| 250 | + possible through the overwrite_inputs key which allows the user to directly |
| 251 | + modify the rem, pcm, smd, and solvent dictionaries that QChemDictSet passes to |
| 252 | + inputs.py to print an actual input file. For instance, if a user wanted to set |
| 253 | + the sym_ignore flag in the rem section of the input file to true, then they |
| 254 | + would set qchem_input_params = {"overwrite_inputs": "rem": {"sym_ignore": |
| 255 | + "true"}}. Of course, overwrite_inputs could be used in conjunction with more |
| 256 | + typical modifications, as seen in the test_double_FF_opt workflow test. |
| 257 | + db_file (str): Path to file specifying db credentials to place output parsing. |
| 258 | + parents ([Firework]): Parents of this particular Firework. |
| 259 | + **kwargs: Other kwargs that are passed to Firework.__init__. |
| 260 | + """ |
| 261 | + |
| 262 | + qchem_input_params = qchem_input_params or {} |
| 263 | + |
| 264 | + H_site = Site("H", [0.0, 0.0, 0.0]) |
| 265 | + H_site_inf = Site("H", [100000.0, 0.0, 0.0]) |
| 266 | + H0_atom = Molecule.from_sites([H_site]) |
| 267 | + H2_plus_mol = Molecule.from_sites([H_site, H_site_inf]) |
| 268 | + H0_atom.set_charge_and_spin(0, 2) |
| 269 | + H2_plus_mol.set_charge_and_spin(1, 2) |
| 270 | + input_file_1 = "H0.qin" |
| 271 | + output_file_1 = "H0.qout" |
| 272 | + input_file_2 = "H2_plus.qin" |
| 273 | + output_file_2 = "H2_plus.qout" |
| 274 | + t = [] |
| 275 | + t.append( |
| 276 | + WriteInputFromIOSet( |
| 277 | + molecule=H0_atom, |
| 278 | + qchem_input_set="SinglePointSet", |
| 279 | + input_file=input_file_1, |
| 280 | + qchem_input_params=qchem_input_params, |
| 281 | + ) |
| 282 | + ) |
| 283 | + t.append( |
| 284 | + RunQChemCustodian( |
| 285 | + qchem_cmd=qchem_cmd, |
| 286 | + multimode=multimode, |
| 287 | + input_file=input_file_1, |
| 288 | + output_file=output_file_1, |
| 289 | + max_cores=max_cores, |
| 290 | + max_errors=max_errors, |
| 291 | + job_type="normal", |
| 292 | + gzipped_output=False, |
| 293 | + ) |
| 294 | + ) |
| 295 | + |
| 296 | + t.append( |
| 297 | + WriteInputFromIOSet( |
| 298 | + molecule=H2_plus_mol, |
| 299 | + qchem_input_set="SinglePointSet", |
| 300 | + input_file=input_file_2, |
| 301 | + qchem_input_params=qchem_input_params, |
| 302 | + ) |
| 303 | + ) |
| 304 | + t.append( |
| 305 | + RunQChemCustodian( |
| 306 | + qchem_cmd=qchem_cmd, |
| 307 | + multimode=multimode, |
| 308 | + input_file=input_file_2, |
| 309 | + output_file=output_file_2, |
| 310 | + max_cores=max_cores, |
| 311 | + max_errors=max_errors, |
| 312 | + job_type="normal", |
| 313 | + gzipped_output=False, |
| 314 | + ) |
| 315 | + ) |
| 316 | + t.append( |
| 317 | + ProtCalcToDb( |
| 318 | + db_file=db_file, |
| 319 | + input_file_H0=input_file_1, |
| 320 | + output_file_H0=output_file_1, |
| 321 | + input_file_H2=input_file_2, |
| 322 | + output_file_H2=output_file_2, |
| 323 | + additional_fields={"task_label": name}, |
| 324 | + ) |
| 325 | + ) |
| 326 | + |
| 327 | + super().__init__(t, parents=parents, name=name, **kwargs) |
| 328 | + |
| 329 | + |
213 | 330 | class ForceFW(Firework):
|
214 | 331 | def __init__(
|
215 | 332 | self,
|
|
0 commit comments