Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _build_new_FWs(self):
"""
Build the list of new fireworks
"""
from atomate.qchem.fireworks.core import FrequencyFlatteningOptimizeFW
new_FWs = []
for ii, molecule in enumerate(self.new_molecules):
new_FWs.append(
FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="ion_pos_" + str(ii) + self.append_name,
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=self.qchem_input_params,
linked=self.linked,
db_file=">>db_file<<"))
# Extremely jank, but its very hard to test dynamic workflows:
if self.testing:
print("testing!")
from fireworks import Workflow
tmp_wf = Workflow(new_FWs, name="tmp")
fake_wf = use_fake_qchem(tmp_wf,self.get("ref_dirs"),"mol.qin.orig.gz")
new_FWs = fake_wf.fws
return new_FWs
from atomate.qchem.fireworks.core import SinglePointFW
new_FWs = []
for ii, unique_molecule in enumerate(self.unique_molecules):
if not self._in_database(unique_molecule):
if len(unique_molecule) == 1:
new_FWs.append(
SinglePointFW(
molecule=unique_molecule,
name="fragment_" + str(ii),
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=self.qchem_input_params,
db_file=">>db_file<<"))
else:
new_FWs.append(
FrequencyFlatteningOptimizeFW(
molecule=unique_molecule,
name="fragment_" + str(ii),
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=self.qchem_input_params,
db_file=">>db_file<<"))
return new_FWs
first_qchem_input_params = qchem_input_params or {}
# Optimize the molecule in vacuum
fw1 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="first_FF_no_pcm",
qchem_cmd=qchem_cmd,
max_cores=max_cores,
qchem_input_params=first_qchem_input_params,
db_file=db_file)
# Optimize the molecule in PCM
second_qchem_input_params = {"pcm_dielectric": pcm_dielectric}
for key in first_qchem_input_params:
second_qchem_input_params[key] = first_qchem_input_params[key]
fw2 = FrequencyFlatteningOptimizeFW(
name="second_FF_with_pcm",
qchem_cmd=qchem_cmd,
max_cores=max_cores,
qchem_input_params=second_qchem_input_params,
db_file=db_file,
parents=fw1)
fws = [fw1, fw2]
wfname = "{}:{}".format(molecule.composition.reduced_formula, name)
return Workflow(fws, name=wfname, **kwargs)
output_file=output_file,
max_cores=max_cores,
job_type="opt_with_frequency_flattener",
max_iterations=max_iterations,
max_molecule_perturb_scale=max_molecule_perturb_scale,
reversed_direction=reversed_direction))
t.append(
QChemToDb(
db_file=db_file,
input_file=input_file,
output_file=output_file,
additional_fields={
"task_label": name,
"special_run_type": "frequency_flattener"
}))
super(FrequencyFlatteningOptimizeFW, self).__init__(
t,
parents=parents,
name=name,
**kwargs)
'following order: dielectric, refractive index, acidity, basicity, ' +
'surface tension, aromaticity, electronegative halogenicity'
)
# Calculate frequencies with the vacuum optimized geometry and the pcm
pcm_qchem_input_params = {"pcm_dielectric": pcm_dielectric}
for key in orig_qchem_input_params:
pcm_qchem_input_params[key] = orig_qchem_input_params[key]
# Calculate frequencies with the vacuum optimized geometry and the pcm
smd_qchem_input_params = {"smd_solvent": smd_solvent}
for key in orig_qchem_input_params:
smd_qchem_input_params[key] = orig_qchem_input_params[key]
# Optimize in PCM
fw1 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="{}:{}".format(molecule.composition.reduced_formula, "pcm_FFopt"+suffix),
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=pcm_qchem_input_params,
linked=linked,
db_file=db_file)
# Optimize in SMD
fw2 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="{}:{}".format(molecule.composition.reduced_formula, "smd_FFopt"+suffix),
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=smd_qchem_input_params,
linked=linked,
smd_qchem_input_params = {"smd_solvent": smd_solvent}
for key in orig_qchem_input_params:
smd_qchem_input_params[key] = orig_qchem_input_params[key]
# Optimize in PCM
fw1 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="{}:{}".format(molecule.composition.reduced_formula, "pcm_FFopt"+suffix),
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=pcm_qchem_input_params,
linked=linked,
db_file=db_file)
# Optimize in SMD
fw2 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="{}:{}".format(molecule.composition.reduced_formula, "smd_FFopt"+suffix),
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=smd_qchem_input_params,
linked=linked,
db_file=db_file)
fws = [fw1, fw2]
wfname = "{}:{}".format(molecule.composition.reduced_formula, name+suffix)
return Workflow(fws, name=wfname, **kwargs)
"""
"""
fw_name = "place ions and optimize"
gather_name = "gather geometries"
if name != "place ions and optimize then gather":
fw_name = name
gather_name = "_"+name
qchem_input_params = qchem_input_params or {}
if pcm_dielectric != None:
qchem_input_params["pcm_dielectric"] = pcm_dielectric
if do_optimization:
# Optimize the original molecule
fw1 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="first FF",
qchem_cmd=">>qchem_cmd<<",
max_cores=">>max_cores<<",
qchem_input_params=qchem_input_params,
linked=linked,
db_file=db_file)
# Place ions around the optimized molecule and optimize the resulting structures
fw2 = PlaceIonFW(
ion=ion,
charges=charges,
stop_num=stop_num,
do_triplets=do_triplets,
linked=linked,
name=fw_name,
Firework 2 : find all unique fragments of the optimized molecule
and add a frequency flattening optimize FW to the
workflow for each one
Note that Firework 1 is only present if do_optimization=True.
"""
qchem_input_params = qchem_input_params or {}
additional_charges = additional_charges or []
if pcm_dielectric != None:
qchem_input_params["pcm_dielectric"] = pcm_dielectric
if do_optimization:
# Optimize the original molecule
fw1 = FrequencyFlatteningOptimizeFW(
molecule=molecule,
name="first FF",
qchem_cmd=qchem_cmd,
max_cores=max_cores,
qchem_input_params=qchem_input_params,
db_file=db_file)
# Fragment the optimized molecule
fw2 = FragmentFW(
depth=depth,
open_rings=open_rings,
additional_charges=additional_charges,
do_triplets=do_triplets,
name="fragment and FF_opt",
qchem_cmd=qchem_cmd,
max_cores=max_cores,