Welcome to researchscripts’s documentation!¶
agg2lammps¶
Write ‘aggcar’ (positions + velocities) to a lammps file, for visualizing heat dissipation
analysis¶
-
analysis.analyzeFragments(datadir, **kwargs)[source]¶ Pass in name and shallow kwargs if needed for utils.readStruct function
-
analysis.coordLabeller(atoms, fullCoordinations={'F': 1, 'H': 1, 'N': 3, 'Si': 4}, minAngles={'F': 360, 'H': 360, 'N': 109.5, 'Si': 90}, maxBonds_per_element={'F': 1, 'H': 1, 'N': 4, 'Si': 6}, angle_tolerance=0.15, bond_tolerance=0.25, minz=0)[source]¶ Takes a structure, returns two dictionaries, the keys of which are identical: the index of the atom for which the statistic is calculated relativeCoordinations: -1 if atom i is undercoordinated, 1 if overcoordinated, 0 else bonds: list of bonds for atom i Defaults for angle and bond tolerance based on amorphous SiN
cart2dir¶
Performs some kind of parsing on POSCAR file!…?
Erik won’t tell me what this does, so all I can say is that it parses the file passed in and writes some modified version to an outfile.
(it translates cartesian positions to direct positions :P)
- Args:
- POSCAR - filepath for POSCAR file
- Returns:
- None; writes results to “{POSCAR}.out” based on the POSCAR filepath provided as an argument.
energyanimator¶
gen2pos¶
Convert from .gen to POSCAR
genvis¶
View .gen file
input_generation¶
-
input_generation.gridVasp(adsorbate, slab, directory='tempout/', spacing=0.2)[source]¶ Takes in slab, adsorbate, and desired output directory. Writes numbered POSCAR files to output directory with adsorbate placed in grid pattern
- Args:
- adsorbate: either path (str) for POS/CONTCAR or Atoms obj slab: either path (str) for POS/CONTCAR or Atoms obj directory: path (str) for desired output location spacing: spacing between grid points (eg, 0.2 is a 5x5 grid)
- Returns:
- None
-
input_generation.randomGrid(adsorbate, slab, h=2, outputDir='tempout/', numDirs=10, runsPerDir=17, shallow=False, kind='gen')[source]¶ Produces a collection of structures with adsorbate randomly placed on given slab. Writes (.gen or vasp) outputs to desired directory
- Args:
- adsorbate: Atoms obj of adsorbate slab: Atoms obj of slab h: height of adsorbate (above max slab position) outputDir: Path (str) for desired output location. numDirs: Number of batches. Defaults to 10. runsPerDir: Number of sims per batch. Defaults to 17. shallow: If all runs to be at one directory level. Defaults to False. kind: output desired, from (gen, vasp). Defaults to gen.
- Returns:
- None
-
input_generation.randomGridMultiple(n, adsorbate, slab, h=2, outputDir='tempout/', numDirs=10, runsPerDir=17, shallow=False, kind='gen', minDist=1)[source]¶ Produces a collection of structures (of size
numDirs*runsperDir; each has n adsorbates randomly placed on given slab. Writes (.gen or vasp) outputs to desired directory- Args:
- n: number of adsorbates per slab adsorbate: Atoms obj of adsorbate slab: Atoms obj of slab h: height of adsorbate (above max slab position) outputDir: Path (str) for desired output location. numDirs: Number of batches. Defaults to 10. runsPerDir: Number of sims per batch. Defaults to 17. shallow: If all runs to be at one directory level. Defaults to False. kind: output desired, from (gen, vasp). Defaults to gen. minDist: minimum distance between placed adsorbates (in Å)
- Returns:
- None
krr_utils¶
-
krr_utils.convertAdsorbateToHe(struct, centerIndex, molIndices, height=None)[source]¶ Preprocess final relaxed adsorption structures; replace adsorbate with He
- Args:
- struct: total structure (Atoms object)
- centerIndex: index of central atom (where He will be) (int)
- molIndices: list of indices to delete from the slab
- height(float) : height of He to be placed
- Returns:
- output: Atoms object with He representing the location of the adsorbate
-
krr_utils.getSOAPs(geometries, species, rcut=5, nmax=10, lmax=9, sigma=0.1, periodic=True, crossover=True, sparse=False)[source]¶ - Takes a Series of geometries with one He present,
- returns SOAP representation of the chemical environment of He for each item
- Assumes any given structure in
geometrieshas the same collection of elements - as all the other structures
- Assumes any given structure in
geometrieshas the same number of atoms as all - the other structures
- Input:
- geometries: Series of Atoms objects; each must contain exactly 1 He atom rcut, nmax, lmax, sigma, periodic, crossover, sparse: SOAP parameters
- Output:
- output: Series of SOAP matrices, each corresponding to the appropriate index
-
krr_utils.predictz(surf, x, y, zmodel, species)[source]¶ surf: bare substrate x, y: position at which to place adsorbate zmodel: model object (which takes in a dataframe that’s n*p, p = #SOAP features)
returns a predicted z value, based on sum of regionalMaxHeight and zmodel outcome
latticeconstmod¶
Modify lattice constants without modifying atom positions, useful for adding vacuum
measure_damage_depth¶
Meausre depth of damage induced by ion bombardment
pbcprettify¶
Rewrap periodic images that had jumped in a trajectory for nicer visualization I think
periodicprocess¶
Not sure what this does honestly
placeadsorbates¶
-
placeadsorbates.getSOAPs(geometries, rcut=5, nmax=10, lmax=9, sigma=0.1, periodic=True, crossover=True, sparse=False)[source]¶ - Takes a Series of geometries with one He present,
- returns SOAP representation of the chemical environment of He for each item
- Assumes any given structure in geometries has the same collection of elements
- as all the other structures
- Assumes any given structure in geometries has the same number of atoms as all
- the other structures
- Input:
- geometries: Series of Atoms objects; each must contain exactly 1 He atom rcut, nmax, lmax, sigma, periodic, crossover, sparse: SOAP parameters
- Output:
- output: Series of SOAP matrices, each corresponding to the appropriate index
postprocessing¶
random_velos¶
Rewrite a given set of CONTCARs to give bombarding ion random velocity direction
refstructs¶
A collection of reference structures stored as Atoms objects.
- Includes:
- mef
- cf4
- amorphous
- xtl_n
- xtl_si
- xtl2x2
- xtl2x2_sifterm
- heavy_bomb
- bulk222
- annealed
seed_monolayer¶
Designed to work on the cluster, seeding a monolayer of some given adsdorbate based on KRR models
structure¶
translatepos¶
Translate a POSCAR some amount in x,y,z directions for easier visualization
transmute¶
-
transmute.transmute(threshold, transmute=True, target='C', slabElems=['Si', 'N'], surfDepth=6, simple=True, numStructs=-1, numOut=-1, **kwargs)[source]¶ Find undercoordinated surface/near-surface atoms and transmute them to C
- Args:
- threshold (k): maxiumum number of bonds to be considered “undercoordinated” (should be 1 or 2)
- transmute: whether to transmute elements or not
- slabElems: elements to consider as part of the ‘core slab’; only these will be transmuted
- surfDepth: depth of atoms to consider below surface; surface defined as max z coord among slabElems
- simple: Use basic bond counting as implemented in ASE, or advanced with coordLabeller from dependencies (simple=False is UNTESTED!!!)
- numStructs: Number of structures to consider
- numOut: Number of structures to output
- kwargs: to be passed to the readStructs function from dependencies
-
transmute.write_transmuted(outdir, numout, numrep)[source]¶ Write results of transmute function into some directory Args: numout: the top numout structures to output numrep: the number of times to replicate each of the above structures, with random adjustment of last atom position (should be Ar for bomb) files written in input$i-$j.gen format
trim¶
Designed to work on the cluster, removing ‘ejected species’ after each bomb or quench step
trimandseed¶
Designed to work on the cluster, removing ‘ejected species’ after each equilibration step seeding Ar
utils¶
-
utils.calculateVASPtemp(velos, nfixed, POSCAR)[source]¶ Take in a 3N matrix of velocities, subtract of nfixed from DOF POSCAR (Atoms object) used for getting masses from atoms Return T as calculated by VASP
-
utils.readData(outdir, indir, useRemoval=True, useFrags=True, useBonds=True, wrapStructs=True)[source]¶ Specifically made for data with BOTH input and output structures Read structures; append removal data, fragment data, and bond data optionally Wrap structures optionally
- Returns:
- df of the above with columns (struct, in), (struct, out), optionally, (frags, <fragnames>), (bonds, <bondnames>), (removal, <removedelems>) where each <x> corresponds to a column label for a specific subgroup (ie, NH3, N-H, or NH3 resp.)
-
utils.readStructs(datadir, shallow=True, name='output')[source]¶ Currently designed for output from single layer directory trees. Reads in final adsorption geometries and energy data, returns dataframe with geometry and energy data
- Input:
- datadir: string that points to directory containing the following:
- convergence: each line i has convergence status of run i
- energies: each line i has total energy and ads energy from run i
- output{indices}.gen: final geometries for each index
slabEnergy: energy of slab adsorbateEnergy: energy of the adsorbate in the system
- Returns:
- output: pd Dataframe with:
- index: indices for runs that worked
- geometry: final geometry of run
- total energy: raw energy from file
- adsorption energy: energy as adjusted by adsorbate_energy
visualization¶
-
visualization.getabBondcountStructure(data, idx, element)[source]¶ Gets a struture with ‘charges’ equal to nbonds between a (fixed) and b(
element) data needs geom, coordlabels, and (optionally) wantedIndices columns geom is Atoms object of structure coordlabels is a raw output from the coordlabeller function (relcoords and raw bonds) element is desired secondary element (primary element determined by input) Calls view() on resulting geometry Returns the structure
-
visualization.plotElemDist(data, targetElem='C', latticeElems=['Si', 'N', 'H'], nbins=25, stacked=False)[source]¶ Plot distribution of element within slab, data should be arraylike collection of stuctures
-
visualization.show_atoms_grid(data, rotation='-0x, 0y, 0z', save=False, filename='grid_configs')[source]¶ Where data is list of Atoms objects
-
visualization.viewStructs(name, directory, kind='gen')[source]¶ View collection of structures as a “trajectory”
- Args:
- name (str): substring unique to structures (.gen, POSCAR, slab, etc)
- directory (str): Directory where the structures live
- kind: kind of output froim list of (vasp, gen)
Opens viewer with loaded trajectory (if remote, need X server)