Clusters module¶
ClustersTask¶
-
class
esteem.tasks.clusters.
ClustersTask
(**kwargs)[source]¶ -
run
(dryrun=False)[source]¶ Main routine for processing clusters and running them for excitations.
The steps involved are:
1. Load the trajectory file of MD snapshots, which for a given solvent solute pair it expects to find at ‘{solute}_{solvent}_{md_suffix}.traj’ in the current directory
‘Carve’ spheres out of the trajectory, that is to say:
- Delete counterions (checking they are not within the sphere first)
b. Delete any whole solvent molecules for which no atoms of the solvent molecule are within
self.radius
of any atom in the solute molecule.c. Label solvent molecules with a tag if they are within
self.kernel
by the criteria above.d. Rotate and center the cluster in the simulation cell, using the two most-distant pairs of carbon atoms in the solute to find a common ‘plane’ for the solute snapshots.
Calculate energies or electronic excitations for each cluster, using the supplied wrapper
Arguments
self: Argument list for the task, with attributes including:
solute
,solvent
,radius
,output
,task_id
,counterions
,charges
kernel
,basis
,func
,boxsize
,impsolv
,``nroots``,cleanup
,continuation
- wrapper: class
- Wrapper to use in the Clusters task
Output:
Ifself.task_id
is None, excited state calculations for the whole trajectory. If has a int value, then an excited state calculation for just that frame in the trajectory.
-
carve_spheres
(counterions=None, solvent_radius=0.0, kernel_radius=0.0, nmol_solvent_targ=None, boxsize=None, task_id=None)[source]¶ Carves out spheres from a periodic solvent model, centered on the solute
-
remove_solute
(traj_carved, soluseed, solvseed, seed, traj_label, traj_suffix, task_id=None)[source]¶ Removes solute molecules from a previously-carved trajectory
-
Task Arguments¶
usage: __main__.py [-h] [--solute SOLUTE] [--solvent SOLVENT]
[--radius RADIUS] [--kernel KERNEL]
[--max_solvent_mols MAX_SOLVENT_MOLS]
[--max_atoms MAX_ATOMS] [--boxsize BOXSIZE]
[--rotate ROTATE] [--output OUTPUT] [--nroots NROOTS]
[--calc_forces CALC_FORCES] [--task_id TASK_ID] [--cleanup]
[--continuation] [--counterions COUNTERIONS]
[--charges [CHARGES]] [--max_snapshots MAX_SNAPSHOTS]
[--min_snapshots MIN_SNAPSHOTS]
[--valid_snapshots VALID_SNAPSHOTS]
[--subset_selection_method SUBSET_SELECTION_METHOD]
[--subset_selection_nmax SUBSET_SELECTION_NMAX]
[--subset_selection_min_spacing SUBSET_SELECTION_MIN_SPACING]
[--subset_selection_bias_beta SUBSET_SELECTION_BIAS_BETA]
[--subset_selection_which_traj SUBSET_SELECTION_WHICH_TRAJ]
[--repeat_without_solute REPEAT_WITHOUT_SOLUTE]
[--geom_opt_kernel GEOM_OPT_KERNEL]
[--vibfreq_kernel VIBFREQ_KERNEL] [--which_traj WHICH_TRAJ]
[--which_target WHICH_TARGET] [--ref_mol_dir REF_MOL_DIR]
[--calc_seed CALC_SEED] [--calc_suffix CALC_SUFFIX]
[--calc_prefix CALC_PREFIX] [--basis [BASIS ...]]
[--func FUNC] [--disp DISP] [--impsolv IMPSOLV]
Named Arguments¶
--solute, -u | Solute name |
--solvent, -v | Solvent name |
--radius, -r | Maximum distance from any atom of a solvent molecule to atom of a solute molecule for it to be included in cluster Default: 5.0 |
--kernel, -k | Maximum distance from any atom of a solvent molecule to atom of a solute molecule for it to be included in tddft kernel Default: 0.0 |
--max_solvent_mols, -M | |
Maximum number of solvent molecules to include (chosen randomly) | |
--max_atoms, -H | |
Maximum number of atoms to include in carved sphere | |
--boxsize, -B | Size of box in which electronic excitation calculation is performed Default: 50.0 |
--rotate, -O | If True, rotate the molecule to align with xy plane Default: True |
--output, -o | Format of output: takes values nw, dat, nwchem and onetep (former 2 write input files only, latter 2 perform calculation) Default: “nw” |
--nroots, -n | Number of excitations to calculate Default: 5 |
--calc_forces, -F | |
Whether to calculate forces on each snapshot Default: True | |
--task_id, -t | Task ID of the current job, inherited from driver |
--cleanup, -c | Whether to delete all temporary files after the job Default: False |
--continuation, -N | |
Whether to continue from a previous run of this file Default: False | |
--counterions, -C | |
Counterion(s) to add, eg Na Default: {} | |
--charges, -Q | Charges on molecular species. Not for command-line use Default: {} |
--max_snapshots, -S | |
Maximum snapshot to process | |
--min_snapshots, -I | |
Minimum snapshot to process | |
--valid_snapshots, -D | |
Number of validation snapshots to process | |
--subset_selection_method, -Y | |
Method for selecting subset from input trajectory | |
--subset_selection_nmax, -y | |
Number of frames to select in subset from input trajectory | |
--subset_selection_min_spacing, -g | |
Minimum frame spacing for selecting subset from input trajectory Default: 1 | |
--subset_selection_bias_beta, -a | |
Effective inverse temperature 1/kBT (in eV-1) for bias on U trajectories Default: 20 | |
--subset_selection_which_traj, -J | |
Which trajectory name to read/write subset selection to | |
--repeat_without_solute, -W | |
Repeat calculation with no solute present Default: False | |
--geom_opt_kernel, -G | |
Geometry Optimise the kernel region Default: False | |
--vibfreq_kernel, -X | |
Calculate vibrational frequencies of kernel region Default: False | |
--which_traj, -w | |
Which trajectory set to use (default is A, active learning uses higher) Default: “A” | |
--which_target, -T | |
Which target to use in trajectory names Default: 0 | |
--ref_mol_dir, -l | |
Location of output of solutes run from which to find reference energies Default: “{target}_PBE0” | |
--calc_seed, -Z | |
Seed for the calculator | |
--calc_suffix, -K | |
Suffix for the calculator (often specifies ML hyperparameters) Default: “” | |
--calc_prefix, -P | |
Prefix for the calculator (often specifies directory) Default: “” | |
--basis, -b | Basis string or tuple Default: “6-311++G**” |
--func, -f | Functional for electronic excitation calculation Default: “PBE0” |
--disp, -d | Dispersion correction (set to True to activate) Default: True |
--impsolv, -i | Implicit solvent string (may differ from solvent name) |
Note: Expects the input trajectory to be named in the format <solute>_<solvent>_<md_suffix>.traj Writes output to trajectory <solute>_<solvent>_carved.traj and to <solute>_<solvent>_solvXXX.<ext> where XXX is the index of the snapshot and <ext> is the file extension of the input file for the code being used (specified by -o).
Standalone module routines¶
Performs processing of Molecular Dynamics Trajectories to enable use of the results in further tasks such as extraction of cluster models centered on the solute molecule, including all solvent molecules within a given range, for the purpose of ML training or explicit solvent spectroscopy
-
esteem.tasks.clusters.
delete_counterions
(t, solvent_radius, nat_tot, nat_solute, nat_counterions, deleted_atoms=None)[source]¶ Deletes counterions from an Atoms model. Assumes they appear in the range [nat_solute:nat_solute+nat_counterions]
-
esteem.tasks.clusters.
delete_excess_molecules
(t, nat_tot, nat_solvent, nat_solute, nmol_solvent_targ, deleted_atoms=None)[source]¶ Deletes solvent molecules
-
esteem.tasks.clusters.
reimage_cluster
(t, nat_solvent, nat_solute)[source]¶ Translates whole solvent molecules by lattice vectors to minimise distance to solute
-
esteem.tasks.clusters.
delete_distant_molecules
(t, solvent_radius, nat_tot, nat_solvent, nmol_solvent, nat_solute, deleted_atoms=None, keep_idx=None)[source]¶ Deletes solvent molecules beyond a certain radius from the solute from an Atoms model Assumes that the first nat_solute atoms are the solute, and after that solvent atoms are arranged in nmol_solvent groups of size nat_solvent
-
esteem.tasks.clusters.
label_nearby_molecules
(t, kernel_radius, nat_tot, nat_solvent, nmol_solvent, nat_solute)[source]¶ Adds a tag to solvent molecules within a certain radius from the solute to an Atoms model Assumes that the first nat_solute atoms are the solute, and after that solvent atoms are arranged in nmol_solvent groups of size nat_solvent
-
esteem.tasks.clusters.
rotate_and_center_solute
(t, nat_solute=None, boxsize=None)[source]¶ Rotates a cluster model so the solute is centered and lies in the xy plane
-
esteem.tasks.clusters.
sanity_check
(trajname='', wrapper=None, calc_params={}, ref_solu_dir='', ref_solu='', ref_solv_dir='', ref_solv='')[source]¶ Function to check a trajectory has reasonable dipole moments, energies, and forces. return the index of suspected failed calculations (or empty list if none)