schrodinger.application.matsci.nano.interface_mod module

Classes and functions to create interface models.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.nano.interface_mod.get_formulas_basename(unit_cell_1, unit_cell_2)

Return a formatted basename containing the two unit cell formulas for the given two unit cells.

Parameters
Return type

str

Returns

the formatted basename containing the two unit cell formulas

schrodinger.application.matsci.nano.interface_mod.lcm_approx(smaller, larger, tolerance=0.0, max_mult=10, threshold=1e-10)

From the two given numbers return two least common multiples (LCMs) that are within the specified tolerance of each other. If the numbers are integers and the tolerance is zero then this function is equivalent to the traditional LCM and the two returned LCMs will be identical integers. Raise a ValueError if either integer multiplier is larger than the given maximum.

Parameters
  • smaller (float) – the smaller number

  • larger (float) – the larger number

  • tolerance (float) – a parameter controlling the extent to which two floats may be considered equivalent

  • max_mult (int) – the maximum allowable multiplier, supported to avoid potentially very long loops given that the inputs are floats compared using a specified tolerance

  • threshold (float) – a parameter controlling numerical precision

Raises

ValueError – if either integer multipler is larger than the given maximum

Return type

tuple, tuple

Returns

the first tuple contains the two LCMs, the second contains the two integer multipliers, i.e. those integers which when multiplied by the inputs produce the LCMs

schrodinger.application.matsci.nano.interface_mod.list_to_string(alist, accuracy=3, separator=', ')

Return a formatted string containing the floats in the given list rounded to the given accuracy and separated by the given separator.

Parameters
  • alist (list) – list of floats

  • accuracy (int) – used to round the floats

  • separator (str) – used to separate the rounded floats

Return type

str

Returns

the formatted string

class schrodinger.application.matsci.nano.interface_mod.ParserWrapper(scriptname, description)

Bases: object

Manages the argparse module to parse user command line arguments.

__init__(scriptname, description)

Create a ParserWrapper instance and process it.

Parameters
  • scriptname (str) – name of this script

  • description (str) – description of this script

loadIt()

Load ParserWrapper with all options.

loadRequired()

Load ParserWrapper with required options.

loadOptions()

Load ParserWrapper with options.

loadCommon()

Load ParserWrapper with common options.

parseArgs(args)

Parse the command line arguments.

Parameters

args (tuple) – command line arguments

class schrodinger.application.matsci.nano.interface_mod.Interface(ref_layer, ads_layer, bot_layer='reference', strain_a=0.5, strain_b=0.5, strain_alpha=5.0, strain_beta=5.0, strain_gamma=5.0, separation=0.0, max_extents=10, translate_a=0.0, translate_b=0.0, base_name=None, logger=None)

Bases: object

Manage the building of an interface model.

MSGWIDTH = 100
__init__(ref_layer, ads_layer, bot_layer='reference', strain_a=0.5, strain_b=0.5, strain_alpha=5.0, strain_beta=5.0, strain_gamma=5.0, separation=0.0, max_extents=10, translate_a=0.0, translate_b=0.0, base_name=None, logger=None)

Create an instance.

Parameters
  • ref_layer (schrodinger.structure.Structure) – the reference layer used to define the interface model

  • ads_layer (schrodinger.structure.Structure) – the adsorption layer used to define the interface model

  • bot_layer (str) – specifies which layer, reference or adsorption, is the bottom layer of the interface model

  • strain_a (float) – the amount of strain allowed along the a lattice vector of the adsorption layer in units of Angstrom

  • strain_b (float) – the amount of strain allowed along the b lattice vector of the adsorption layer in units of Angstrom

  • strain_alpha (float) – the amount of strain allowed along the alpha angle of the adsorption layer in units of degrees

  • strain_beta (float) – the amount of strain allowed along the beta angle of the adsorption layer in units of degrees

  • strain_gamma (float) – the amount of strain allowed along the gamma angle of the adsorption layer in units of degrees

  • separation (float) – the separation between the reference and adsorption layers in units of Angstrom

  • max_extents (int) – the maximum allowable extent

  • translate_a (float) – the amount by which to translate the top layer, relative to the bottom layer, along the a lattice vector

  • translate_b (float) – the amount by which to translate the top layer, relative to the bottom layer, along the b lattice vector

  • base_name (str) – a base name used to name output

  • logger (logging.Logger) – output logger

setIsInfinite()

Set the is_infinite attributes.

setBaseName()

Set a base name.

setLatticeProperties()

Set lattice parameter attributes for both the reference and adsorption layers.

setHKL()

Set hkl for both the reference and adsorption layers.

getExtentsAndStrainedLength(index, strain)

For the lattice vector specified with the given index return (1) the reference and adsorption layer extents necessary to bring the extended lengths to within the specified amount of strain and (2) the strained adsorption layer length.

Parameters
  • index (int) – an index used to specify along which direction to get the extents, i.e. 0 is a, 1 is b, 2 is c

  • strain (float) – the amount of strain allowed along the given lattice vector of the adsorption layer in units of Angstrom

Raises

ValueError – if either extent is larger than the allowable maximum

Return type

tuple, float

Returns

the tuple contains the reference and adsorption layer integer extents, the float is the strained adsorption layer length in units of Angstrom

getStrainedAngle(index, strain)

Return the strained adsorption layer angle.

Parameters
  • index (int) – the angle index

  • strain (float) – the allowable amount of strain in degrees

Raises

ValueError – if the reference and adsorption layer angles are not within the specified amount of strain

Return type

float

Returns

strained adsorption layer angle in units of degree

setStrainedAdsorptionLatticeProperties(strained_a, strained_b, strained_alpha, strained_beta, strained_gamma)

Set the strained lattice parameter attributes for the adsorption layer.

Parameters
  • strained_a (float) – the strained lattice a parameter in units of Angstrom

  • strained_b (float) – the strained lattice b parameter in units of Angstrom

  • strained_alpha (float) – the strained lattice alpha parameter in units of degree

  • strained_beta (float) – the strained lattice beta parameter in units of degree

  • strained_gamma (float) – the strained lattice gamma parameter in units of degree

setInterfaceLatticeProperties()

Set the lattice parameter attributes for the interface model.

logParams()

Log the parameters.

getOrigin(lattice_params)

Return the origin in units of Angstrom for the given lattice parameters.

Parameters

lattice_params (list) – the six lattice parameters

Return type

numpy.array

Returns

the origin in units of Angstrom

translateTopLayer(ref_layer, ads_layer)

Translate the top layer.

Parameters
getInterface(ref_layer, ads_layer)

Build the interface model from the two finalized layers and return it.

Parameters
Return type

schrodinger.structure.Structure

Returns

the interface model

setInterfaceProperties()

Set some interface properties.

getUpdatedCParams(in_params)

Return the set of lattice parameters with an updated c parameter.

Parameters

in_params (list) – the six lattice parameters

Return type

list

Returns

the six lattice parameters with c updated

buildLayer(cell, in_params, extents, is_infinite)

Build a layer by extending the input slab cell, also eliminate any PBC bonds along the c lattice vector.

Parameters
  • cell (schrodinger.structure.Structure) – slab cell to extend

  • in_params (list) – the six lattice parameters

  • extents (list) – extents for layer

  • is_infinite (bool) – whether the slab cell is infinite

Return type

schrodinger.structure.Structure

Returns

extended layer

buildLayers(ref_extents, ads_extents)

Build the reference and adsorption layers by extending the input slab cells, also eliminate any PBC bonds along the c lattice vector.

Parameters
  • ref_extents (list) – extents for reference layer

  • ads_extents (list) – extents for adsorption layer

Return type

schrodinger.structure.Structure, schrodinger.structure.Structure

Returns

extended reference and adsorption layers

getStrainedAdsorptionLayer(ads_layer)

Return the strained adsorption layer.

Parameters

ads_layer (schrodinger.structure.Structure) – the extended unstrained adsorption layer

Return type

schrodinger.structure.Structure

Returns

the strained adsorption layer

runIt()

Create the interface model.