Skip to content

Commit 7c67a0e

Browse files
committed
Copying Sam's changes for drone, adding ForceFW
1 parent db1344a commit 7c67a0e

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

atomate/qchem/drones.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ def generate_doc(self, dir_name, qcinput_files, qcoutput_files, multirun):
198198
elif "ESP" in d_calc_final:
199199
d["output"]["esp"] = d_calc_final["ESP"][-1]
200200

201+
if "nbo_data" in d_calc_final:
202+
d["output"]["nbo"] = d_calc_final["nbo_data"]
203+
201204
if d["output"]["job_type"] in ["opt", "optimization", "ts"]:
202205
if "molecule_from_optimized_geometry" in d_calc_final:
203206
d["output"]["optimized_molecule"] = d_calc_final[
@@ -233,6 +236,13 @@ def generate_doc(self, dir_name, qcinput_files, qcoutput_files, multirun):
233236
d["output"]["scan_geometries"] = d_calc_final.get("optimized_geometries")
234237
d["output"]["scan_molecules"] = d_calc_final.get("molecules_from_optimized_geometries")
235238

239+
if d["output"]["job_type"] == "force":
240+
d["output"]["gradients"] = d_calc_final["gradients"][0]
241+
if d_calc_final["pcm_gradients"] is not None:
242+
d["output"]["pcm_gradients"] = d_calc_final["pcm_gradients"][0]
243+
if d_calc_final["CDS_gradients"] is not None:
244+
d["output"]["CDS_gradients"] = d_calc_final["CDS_gradients"][0]
245+
236246
opt_trajectory = []
237247
calcs = copy.deepcopy(d["calcs_reversed"])
238248
calcs.reverse()

atomate/qchem/fireworks/core.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,83 @@ def __init__(self,
100100
**kwargs)
101101

102102

103+
class ForceFW(Firework):
104+
def __init__(
105+
self,
106+
molecule=None,
107+
name="force calculation",
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+
**kwargs
115+
):
116+
"""
117+
Converge the electron density and calculate the atomic forces, aka the gradient.
118+
Args:
119+
molecule (Molecule): Input molecule.
120+
name (str): Name for the Firework.
121+
qchem_cmd (str): Command to run QChem. Supports env_chk.
122+
multimode (str): Parallelization scheme, either openmp or mpi. Defaults to openmp.
123+
max_cores (int): Maximum number of cores to parallelize over. Supports env_chk.
124+
qchem_input_params (dict): Specify kwargs for instantiating the input set parameters.
125+
Basic uses would be to modify the default inputs of the set,
126+
such as dft_rung, basis_set, pcm_dielectric, scf_algorithm,
127+
or max_scf_cycles. See pymatgen/io/qchem/sets.py for default
128+
values of all input parameters. For instance, if a user wanted
129+
to use a more advanced DFT functional, include a pcm with a
130+
dielectric of 30, and use a larger basis, the user would set
131+
qchem_input_params = {"dft_rung": 5, "pcm_dielectric": 30,
132+
"basis_set": "6-311++g**"}. However, more advanced customization
133+
of the input is also possible through the overwrite_inputs key
134+
which allows the user to directly modify the rem, pcm, smd, and
135+
solvent dictionaries that QChemDictSet passes to inputs.py to
136+
print an actual input file. For instance, if a user wanted to
137+
set the sym_ignore flag in the rem section of the input file
138+
to true, then they would set qchem_input_params = {"overwrite_inputs":
139+
"rem": {"sym_ignore": "true"}}. Of course, overwrite_inputs
140+
could be used in conjuction with more typical modifications,
141+
as seen in the test_double_FF_opt workflow test.
142+
db_file (str): Path to file specifying db credentials to place output parsing.
143+
parents ([Firework]): Parents of this particular Firework.
144+
**kwargs: Other kwargs that are passed to Firework.__init__.
145+
"""
146+
147+
qchem_input_params = qchem_input_params or {}
148+
input_file = "mol.qin"
149+
output_file = "mol.qout"
150+
t = []
151+
t.append(
152+
WriteInputFromIOSet(
153+
molecule=molecule,
154+
qchem_input_set="ForceSet",
155+
input_file=input_file,
156+
qchem_input_params=qchem_input_params,
157+
)
158+
)
159+
t.append(
160+
RunQChemCustodian(
161+
qchem_cmd=qchem_cmd,
162+
multimode=multimode,
163+
input_file=input_file,
164+
output_file=output_file,
165+
max_cores=max_cores,
166+
job_type="normal",
167+
)
168+
)
169+
t.append(
170+
QChemToDb(
171+
db_file=db_file,
172+
input_file=input_file,
173+
output_file=output_file,
174+
additional_fields={"task_label": name},
175+
)
176+
)
177+
super(ForceFW, self).__init__(t, parents=parents, name=name, **kwargs)
178+
179+
103180
class OptimizeFW(Firework):
104181
def __init__(self,
105182
molecule=None,

0 commit comments

Comments
 (0)