schrodinger.application.matsci.freevolume module

Analyzes free volume in a structure

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.freevolume.FreeVolumeDriver(grid=0.25, probe=1.4, generic_title='free_volume', logger=None, verbose=True)

Bases: object

Driver to compute Free Volume

clearGraph()

Clear out the graph for this driver to preserve memory space

defineVoids()

Define all the voids found in the structure

findFreeVolume(struct)

Find the free volume in the structure. Results are stored as properties on the structure

Parameters:

struct (schrodinger.structure.Structure) – The structure to find the free volume in

Raises:
  • FreeVolumeException – if the PBC dimensions are too small and no logger exists
  • SystemExit – if the PBC dimensions are too small and a logger exists
getVoidVolumes()

Get the volume of each void

Return type:list
Returns:A list of void volumes. Each item is a float.
log(msg, is_verbose=False, **kwargs)

Log a message if logging is being used

Parameters:msg (str) – The message to log

Additonal keyword arguments are passed to textlogger.log_msg

logError(msg, **kwargs)

Log an error message if logging is being used and exit, otherwise raise an Exception.

Parameters:msg (str) – The message to log

Additonal keyword arguments are passed to textlogger.log_error

Raises:
volumeOfGraph()

Get the current total volume of the graph

Return type:float
Returns:The volume of all the remaining nodes in the graph
writeFiles(basename=None)

Write all the data to files

The actual node graph is written to a pkl file

The void data is written to a json file

The volumes are written to a simple text file, one volume per line

Parameters:basename (str) – Use this instead of the structure title as the base file name
Return type:str, str, str
Returns:The paths to the files written (volume file, void file, graph file)
exception schrodinger.application.matsci.freevolume.FreeVolumeException

Bases: exceptions.Exception

Raised if something goes wrong with computing the Free Volume

class schrodinger.application.matsci.freevolume.GridRadius(grid, radius)

Bases: tuple

grid

Alias for field number 0

radius

Alias for field number 1

class schrodinger.application.matsci.freevolume.JsonObject

Bases: object

Base class for custom objects that can be serialized and deserialized by json

classmethod fromJsonData(data)

Create a new VoidInfo object from json data

Parameters:data (dict) – A dict such as returned by the jsonData method
Return type:class
Returns:A new class object created using the data in dict
jsonData()

Return a json-serializable object for this instance

Return type:dict
Returns:A json-serializable object for this instance
class schrodinger.application.matsci.freevolume.Void(size=0, volume=0, nodes=None)

Bases: schrodinger.application.matsci.freevolume.JsonObject

Holds information about a single Void

getSurfaceNodes(vinfo)

Find all the surface nodes in the void

Parameters:vinfo (VoidInfo) – The VoidInfo object used to compute the void
class schrodinger.application.matsci.freevolume.VoidInfo(origin, numxyz, spacing, periodic, probe)

Bases: schrodinger.application.matsci.freevolume.JsonObject

Holds general information about the void calculation

getNodeXYZ(node)

Get the xyz coordinates a node represents

Parameters:node (tuple) – A graph node (a, b, c) for coordinate a, b, c in the grid
Return type:list
Returns:[x, y, z] coordinates of the node
schrodinger.application.matsci.freevolume.extract_grid_and_radius(word)

Given a string, extract the floating point grid spacing and probe radius values

Parameters:word (str) – The string to extract the grid & radius from
Return type:GridRadius
Returns:The GridRadius namedtuple with the extracted values
schrodinger.application.matsci.freevolume.get_atom_layers(atom, origin, num_layers, layer_width, axis)

Get the range of layers that the given atom would intersect.

Parameters:
  • atom (schrodinger.structure._StructureAtom) – The atom to find the layers for
  • origin (float) – The offset to add to each layer because the system starts at a point other than zero. The offset is along the axis defined by the axis parameter.
  • num_layers (int) – The number of layers
  • layer_width (float) – The width of each layer
  • axis (int) – 0, 1 or 2 to indicate the layers are cross sections of the X, Y or Z axis
Return type:

list

Returns:

Each item of the list is a layer the atom intersects based on its VdW radius

schrodinger.application.matsci.freevolume.get_file_data(struct, propbase, file_reader, override_path=None)

Use file_reader to extract the data from the files specified by the given structure properties

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to get data for
  • propbase (str) – The starting string for properties to search for
  • file_reader (callable) – The function that will read the data from the file
  • override_path (str or None) – If given, look for files in this directory rather than the one specified in the structure property
Return type:

(OrderedDict, list)

Returns:

Keys of the dict are GridRadius objects, values are the data extracted from the file for that set of Grid and Radius values. keys are orderd by (radius, grid) sort order. Each item of the list is a str that gives the path of a file that could not be located.

schrodinger.application.matsci.freevolume.get_grid_radius_property_values(struct, propbase)

Get all the grid and radius values for properties on the structure that begin with the given base string.

Parameters:
Return type:

dict

Returns:

Keys are GridRadius instances, values are the property value for that set of grid/radius values.

schrodinger.application.matsci.freevolume.get_voids_data(struct, path=None)

Get all the void data available for the given structure

Parameters:
  • struct (schrodigner.structure.Structure) – The structure to get volume data for
  • path (str or None) – If given, look for files in this directory rather than the one specified in the structure property
Return type:

(See read_void_file function, list)

Returns:

The volume data collected from struct, and a list of paths to the files that could not be read.

schrodinger.application.matsci.freevolume.get_volume_data(struct, path=None)

Get all the volume data available for the given structure

Parameters:
  • struct (schrodigner.structure.Structure) – The structure to get volume data for
  • path (str or None) – If given, look for files in this directory rather than the one specified in the structure property
Return type:

(See read_volume_file function, list)

Returns:

The volume data collected from struct, and a list of paths to files that could not be read

Get atom indexes for atoms that are either crosslinkable, crosslinked or both.

Parameters:struct (schrodinger.structure.Structure) – The structure to look for atoms in.
Return type:set, set, set
Returns:In order, indexes for atoms that are both crosslinked AND crosslinkable, atoms that are crosslinkable, atoms that are crosslinked. The sets are mutually exclusive.
schrodinger.application.matsci.freevolume.read_void_file(path)

Read the void data file located at path

Parameters:path (str) – The path to the file
Return type:dict
Returns:Keys are INFO and VOIDS. INFO value is a VoidInfo object, VOIDS

value is a list of Void objects sorted from largest to smallest.

schrodinger.application.matsci.freevolume.read_volume_file(path)

Read the void volume data file located at path

Parameters:path (str) – The path to the file
Return type:list
Returns:The volumes from the file, each item is a float