schrodinger.application.matsci.nano.particle module

Classes and functions to create nanoparticles.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.nano.particle.dict_to_str(x)
schrodinger.application.matsci.nano.particle.get_lattice_properties()

Get the properties which are required for defining a crystal structure

Return type

list of str

Returns

Each item in the list is a structure property that is required to be present if a crystal structure is defined

schrodinger.application.matsci.nano.particle.check_if_lattice_properties_exist(struct, keys=None)

Check if the structure has all the required crystal lattice properties

Parameters
  • struct (schrodinger.structure.Structure) – The structure to check

  • keys (list) – The list of crystal properties to check. If not given, the default set of crystal properties from get_lattice_properties will be checked

Return type

bool

Returns

If all the requested properties are present on the structure

schrodinger.application.matsci.nano.particle.format_alignment_ids(num_unique)

Return a formatted collection of shapes and alignment axis IDs.

Parameters

num_unique (str) – the shape attr to format

Return type

str

Returns

the formatted string

class schrodinger.application.matsci.nano.particle.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 options.

parseArgs(args)

Parse the command line arguments.

Parameters

args (tuple) – command line arguments

class schrodinger.application.matsci.nano.particle.CheckInput

Bases: object

Manage checking user input.

checkShapeParams(shape, params, logger=None)

Check the specified shape and shape parameters.

Parameters
  • shape (str) – the shape of nanoparticle

  • params (list) – contains floats specifying the shapes geometry

  • logger (logging.Logger) – output logger

checkAlignment(shape, primary_alignment, secondary_alignment, logger=None)

Check the specified alignment.

Parameters
  • shape (str) – the shape of nanoparticle

  • primary_alignment (dict) – dictionary defining the primary alignment

  • secondary_alignment (dict) – dictionary defining the secondary alignment

  • logger (logging.Logger) – output logger

Return type

dict, dict

Returns

the final primary and secondary alignment dictionaries

schrodinger.application.matsci.nano.particle.group_subtuples_by_key_and_value(atuple)

Take a tuple of two-element subtuples and group them by both key and value and collect into subsubtuples. For example, take ((1, 2), (1, 3), (4, 5), (6, 7), (8, 7)) and return (((1), (2, 3)), ((4), (5)), ((6, 8), (7))).

Parameters

atuple (tuple) – contains two-element tuples

Return type

tuple

Returns

contains two-element tuples each of which contains a keys tuple and a values tuple

class schrodinger.application.matsci.nano.particle.Nanoparticle(supercell, shape='cube', origin=None, params=None, overwrite_vertices=[], primary_alignment_dict={'axis': '1', 'basis': 'hkl', 'vector': '1.0 0.0 0.0'}, secondary_alignment_dict={'axis': '1', 'basis': 'abc', 'vector': '0.0 1.0 0.0'}, include_axes=False, term_frag='hydrogen', term_bond_length=1.5, allow_fragments=False, logger=None, no_term_faces=None)

Bases: object

Manage the building of a nanoparticle.

MSGWIDTH = 100
__init__(supercell, shape='cube', origin=None, params=None, overwrite_vertices=[], primary_alignment_dict={'axis': '1', 'basis': 'hkl', 'vector': '1.0 0.0 0.0'}, secondary_alignment_dict={'axis': '1', 'basis': 'abc', 'vector': '0.0 1.0 0.0'}, include_axes=False, term_frag='hydrogen', term_bond_length=1.5, allow_fragments=False, logger=None, no_term_faces=None)

Create an instance.

Parameters
  • supercell (schrodinger.structure.Structure) – the crystalline supercell from which to cut the nanaparticle

  • shape (str) – the shape of the nanoparticle

  • origin (list) – list of three floats specifying the origin of the shape in the crystal

  • params (list) – list of parameters defining the specified shape

  • overwrite_vertices (list) – vertices to overwrite those of the created shape, just of list of floats

  • primary_alignment_dict (dict) – a dictionary defining the primary alignment

  • secondary_alignment_dict (dict) – a dictionary defining the secondary alignment

  • include_axes (bool) – include unit vectors for the primary and secondary alignment axes in the template

  • term_frag (str) – the fragment by which to terminate the nanoparticle

  • term_bond_length (float) – the bond length of the bond connecting the nanoparticle with the fragment

  • allow_fragments (bool) – specify if molecular fragments are allowed at the boundary of the nanoparticle

  • logger (logging.Logger) – output logger

  • no_term_faces (list) – by default when terminating polyhedral nanoparticles all faces are considered, this option specifies that the given integer faces not be terminated (integers start at zero)

checkInput()

Check user input.

setMoleculeCompletion()

Set whether or not molecules should be completed at the nanoparticle boundary.

isInside(aatom)

Return whether or not the given atom is inside the shape. If the given atom has not yet been categorized then categorize it and append the result to the collections.

Parameters

aatom (schrodinger.structure._StructureAtom) – the atom in question

Return type

bool

Returns

True if the atom is inside the shape, False otherwise

checkIntersectingBond(atom1, atom2)

Check if the bond given by the specified atoms can be intersected by the shape of nanoparticle. We will only be either keeping a single atom from this bond (no termination) or using it to terminate with a fragment that is expected to connect via a single bond.

Parameters
  • atom1 (int) – the first atom index of the bond

  • atom2 (int) – the second atom index of the bond

partitionAtoms()

Return three non-overlapping lists of atom indices, (1) for atoms inside the shape, (2) for atoms belonging to bonds which intersect the shape boundary (a (inside, outside) tuple of atom indices for the intersecting bonds), and (3) for atoms that lie outside of shape.

removeAndRenumber(to_remove=None, renumber_map=None)

Remove the specified atoms from the nanoparticle and renumber all collections of indices or just renumber the collections using the specified renumber map.

Parameters
  • to_remove (list or none) – indices of atoms to remove

  • renumber_map (dict or none) – a renumber map to use in renumbering collections

cutAwayExcess()

Remove the unneeded atoms from the crystalline supercell.

handleOneToMany(inside_index, outside_indices)

Handle the one to many situation, i.e. a single atom inside the region of interest bonded to multiple atoms outside of the region of interest.

Parameters
  • inside_index (int) – the index of the inside atom

  • outside_indices (list) – the indices of the outside atoms

handleManyToOne(inside_indices, outside_index)

Handle the many to one situation, i.e. multiple atoms inside the region of interest are bonded to a single atom that is outside of the region of interest.

Parameters
  • inside_indices (list) – the indices of the inside atoms

  • outside_index (int) – the index of the outside atom

Return type

list

Returns

contains (inside, outside) tuples of newly created bonds

configureBonds()

Configure the nanoparticle bonds that intersect the shape.

doTermination()

Terminate the nanoparticle.

setNanoparticleProperties()

Set nanoparticle properties.

printParams()

Log the parameters.

getAlignmentVector(alignment_dict)

Return the alignment vector.

Parameters

alignment_dict (dict) – defines the alignment

Return type

numpy.array

Returns

the vector on which to align

translateToPlane()

Translate the shape object so that the reference face is coplanar with the requested crystal plane.

overwriteVertices()

Overwrite the vertices of the shape object.

runIt(template_only=False)

Create the nanoparticle.

Parameters

template_only (bool) – If True, the method will return immediately after the template is created and before the nanoparticle has been fully synthesized. Using this parameter means that the .template structure is valid but no .nanoparticle structure is created - the .nanoparticle property will be set to None.

schrodinger.application.matsci.nano.particle.build_kwargs(kwargs_list, defaults, acceptable_keys=None, token_separator=',', key_value_separator='=', all_choices=None)

Build the kwargs dictionary from an unformatted and unvalidated list of kwargs.

Parameters
  • kwargs_list (list) – list of strings that contain kwargs in one form or another

  • defaults (dict) – default kwargs to be updated

  • acceptable_keys (list) – list of acceptable keys

  • token_separator (str) – the separator used for tokens

  • key_value_separator (str) – the separator used in key-value pairs

  • all_choices (dict) – if the values of certain keys are limited then collect those options here in lists for validation purposes

Return type

dict

Returns

dictionary of kwargs, formatted, validated, and contains unspecified defaults

schrodinger.application.matsci.nano.particle.set_representation(astructure)

Set the representation of the given structure.

Parameters

astructure (schrodinger.structure.Structure) – the structure to set the representation for