Empirical Map Setup Class

Sets up the calculations for the empirical map.

Notes:

The MapSetup class is used to set up the calculations for the empirical map. It is initialized with the selection, bond atoms, central atom, bond masses, inner cutoff, outer cutoff, calculation directory, scan dr, ngrid, and rmin.

It then uses this information, along with a trajectory, to grab clusters from the frames and write Gaussian input files for the clusters.

To Do:

  1. Make Masses + Total Mass Read In + charges

  2. Refactor _field_on_atom_from_cluster to use MDAnalysis charges.

  3. Refactor calc_eOH to use explicit “safer” selection

  4. Allow for the user to specify the level of theory for Gaussian

  5. Add other QM programs that you can call - ase?

  6. Generalize rOH distance calcualtor to all bonds.

  7. Add a gas phase calculation to the rest.

class empmap.emp_setup.MapSetup(calc_dir='newmap/', selection='type O', bond_atoms=[0, 1], central_atom=1, bond_masses=[1.008, 17.007], inner_cutoff=4.0, outer_cutoff=8.0, scan_dr=0.04, ngrid=14, rmin=0.72, nproc=4, mem=20)
description()

Print the description of the MapSetup class

grab_clusters_from_frames(frames, file_prefix='map_')

Grab the clusters from the frames

Notes:

This method grabs the clusters from the frames in the trajectory. It then writes the Gaussian input files for the clusters. It also calculates the static parameters for the clusters and writes them to files.

Parameters:

frameslist

The frames to grab the clusters from. These should be the indices of the frames in the trajectory. (e.g. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

file_prefixstr

The file prefix for the Gaussian input files. (The default is map) Thus, this will create files like map_0.gjf, map_1.gjf, etc.

Returns:

None

Raises:

ValueError

If the universe is not set up properly. This is based on the status of the universe set by the _test_universe method.

load_universe(*args, **kwargs)

Load the universe using the topology and trajectory files

Stores the MDAnalysis universe as an attribute of the class.

Parameters:

args:

The topology and trajectory files, respectively. These are passed directly to the MDAnalysis Universe class.

kwargs:

Any keyword arguments to pass to the MDAnalysis Universe class. Please see the MDAnalysis documentation for more information.

Returns:

None

Raises:

ValueError:

If the universe cannot be loaded.

set_attribute_by_type(attribute, input_dict)

Set the inputdata by type using a dictionary

Parameters:

attributestr

The attribute to set. This should be a string that is a valid attribute of the atoms in the universe. [e.g. “charges”]

input_dictdict

The input data dictionary mapped to types. The keys should be the types in the universe, and the values should be the input data for the types. (e.g. {“O”: 0.834, “H”: 0.417})

Returns:

None

Raises:

TypeError

If the input data is not a dictionary

ValueError

If the number of charges does not match the number of atoms in the universe.

set_attribute_from_list(attribute, inputdata)

Set the charges from a list

Parameters:

attributestr

The attribute to set. This should be a string that is a valid attribute of the atoms in the universe. [e.g. “charges”]

inputdataarray_like

The inputdata for the atoms in the universe. These should be in the same order as the atoms in the universe.

Returns:

None

Raises:

TypeError

If the attribute is not a string.

ValueError

If the number of charges does not match the number of atoms in the universe.

write_gaussian(resid, inner, outer, frame_number, file_prefix, functional='b3lyp', basis='6-311G(d,p)')

Write the Gaussian input files, and the output data

Notes:

This method writes the Gaussian input files for the clusters. It also calculates the static parameters for the clusters and writes them to files.

The files created (for an example directory) are: newmap/0/scan_0.gjf # The Gaussian input file newmap/0/scan_0.xyz # The XYZ file for the cluster (shows the stretched coordinate)

Parameters:

residMDAnalysis.AtomGroup

The residue to write the Gaussian input files for. This is the central residue.

innerMDAnalysis.AtomGroup

The inner cluster to write the Gaussian input files for. This is the cluster treated quantum mechanically.

outerMDAnalysis.AtomGroup

The outer cluster to write the Gaussian input files for. This is the cluster treated classically.

frame_numberint

The frame number for the Gaussian input files. This is used to create a subdirectory for the frame.

file_prefixstr

The file prefix for the Gaussian input files. This is used to create the file names for the Gaussian input files and the output data.

functionalstr

The functional for the Gaussian input files. (The default is “b3lyp”)

basisstr

The basis set for the Gaussian input files. (The default is “6-311G(d,p)”)

Returns:

vib_bond_distancesnp.ndarray, shape(self.ngrid)

The bond distance values for the scan.

write_output_data(resid, inner, outer, frame_number, file_prefix, vib_bond_distances)

Write the output data needed for the empirical map

Notes:

This method writes the output data needed for the empirical map. This includes the bond vector, the field on the residue from the cluster, the projected field on the residue from the cluster, and the distance from the gridpoint.

The files created (for an example directory) are: newmap/0/scan_eOHs.dat # The bond vector values for the cluster (eOH) newmap/0/scan_fields.dat # The field on the residue from the cluster newmap/0/scan_rOHs.dat # The rOH values for the scan newmap/0/scan_proj_field.dat # The projected field on the residue from the cluster

Parameters:

residMDAnalysis.AtomGroup

The residue to write the output data for. This is the central residue.

innerMDAnalysis.AtomGroup

The inner cluster to write the output data for. This is the cluster treated quantum mechanically.

outerMDAnalysis.AtomGroup

The outer cluster to write the output data for. This is the cluster treated classically.

frame_numberint

The frame number for the output data. This is used to create a subdirectory for the frame.

file_prefixstr

The file prefix for the output data. This is used to create the file names for the output data.

vib_bond_distancesnp.ndarray, shape(self.ngrid)

The bond distance values for the scan.

Returns:

None