schrodinger.application.matsci.density_analysis module

Utilities for density analysis

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.density_analysis.DensityAnalysisMixin

Bases: object

Mixin class for density analysis

MEMORY_MSG = 'Bin width of %s A is too small. Try increasing it to avoid memory failure.'
MAX_FILE_SIZE_GB = 50
setGidsAndMass()

Select the gids associated with asl and mass of the gids

estimateResolution(pos)

Estimate the bin size for the given asls

setMinMaxBox(boxes, logger=None)

Set the box dimensions to determine the range of values. This is particularly important for NPT condition.

Parameters
  • boxes (list(3* 3 numpy.ndarray)) – List of box dimensions from trajectory

  • logger (logging.Logger) – The logger object or None if msg should be printed

setBins(logger=None)

Set bins for the density calculation

Parameters

logger (logging.Logger) – The logger object or None if msg should be printed

setBinVolume()

Calculate and set volume associated with each axis.

calculate1DDensity(pos, gids, gmass, axid)

Calculate the 1D density for passed gids in the axis id direction

Parameters
  • pos ('numpy.ndarray') – numpy array containing translated positional coordinates

  • gids (list(int)) – gids of the atoms for which density profile is to be calculated

  • gmass (list(float)) – mass of the gids for which density profile is to be calculated

  • axid (int) – axis id for the density profile to be calculated in. 0 for X-axis, 1 for Y-axis, and 2 for Z-axis

Return ‘numpy.ndarray’, ‘numpy.ndarray’

Return 2 numpy arrays. First array has density for each bin and second has the starting value for each bin.

calculate2DDensity(pos, gids, gmass, axid, logger=None)

Calculate the 1D density for passed gids in the axis id direction

Parameters
  • pos ('numpy.ndarray') – numpy array containing translated positional coordinates

  • gids (list(int)) – gids of the atoms for which density profile is to be calculated

  • gmass (list(float)) – mass of the gids for which density profile is to be calculated

  • axid (int) – axis id for the orthogonal axis for which 2D density profile has to be calculated. 0 for X-axis, 1 for Y-axis, and 2 for Z-axis, hence for XY, the axid will be 2.

  • logger (logging.Logger) – The logger object or None if msg should be printed

Return ‘numpy.ndarray’

Return 2D numpy arrays with density of each cell as the array element.

computeDensity(pos, logger=None)

Compute density for each frame

Parameters
  • pos (numpy.ndarray) – The positional coordinates

  • logger (logging.Logger) – The logger object or None if msg should be printed

getTempFilename(asl, axis)

Gets the temporary filename based on asl and axis

Parameters
  • asl (str) – The asl being analyzed

  • axis (str) – The axis being analyzed

Return type

str

Returns

Filename

dataNameIterator()

Iterator containing all the combinations of asl and axis

Return type

Iterator(str, str)

Returns

Iterator yielding two tuples, first one is the asl name and second is the axis name

getCalculatedData()

Get the all calculated data from temporary pickle files

Return type

dict

Returns

dictionary with asl the key and value as dictionary with key as axis and values as list of densities