faps module¶
faps – Frontend for Automated Adsorption Analysis of Porous Solids.
aka
- shpes – Sorption analysis with a High throughput Python
- frontend to Examine binding in Structures
Strucutre adsorption property analysis for high throughput processing. Run as a script, faps will automatically run complete analysis on a structure. Sensible defaults are implemented, but calculations can be easily customised. Faps also provides classes and methods for adapting the simulation or only doing select parts.
-
class
faps.
Atom
(at_type=False, pos=False, parent=None, **kwargs)[source]¶ Bases:
object
Base atom object.
-
atomic_number
¶ The atomic number for the element, or closest match.
-
coordination
¶ The actual coordination of the atom based on bonds in the parent. Counts all the bonds and returns an integer.
Returns: int
Coordination of the atom
-
covalent_radius
¶ Get the covalent radius from the library parameters.
-
element
¶ Guess the element from the type, fall back to type.
-
fractional
¶ Retrieve the fractional coordinates or calculate from the parent.
-
from_cif
(at_dict, cell, symmetry=None, idx=None)[source]¶ Extract an atom description from dictionary of cif items.
-
from_pdb
(line, charges=False)[source]¶ Parse the ATOM line from a pdb file. Occupancy field may be used to specify the charge as in a ‘.pqr’ file.
-
from_vasp
(line, at_type=None, cell=array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]))[source]¶ Set the atom data from vasp input. Only pass cell if fractional.
-
get_fractional_coordinate
()[source]¶ Retrieve the fractional coordinates or calculate from the parent.
-
index
¶ Return the index of the atom in the current parent structure.
-
is_metal
¶ Return True if element is in a predetermined set of metals.
-
uff_coordination
¶ The expected coordination based on the third character of the UFF name for the element. Based on _ipar from OB forcefielduff.cpp
-
vdw_radius
¶ Get the vdw radius from the UFF parameters.
-
-
class
faps.
Cell
[source]¶ Bases:
object
Crystollagraphic cell representations and interconversion methods.
Setter methods can be defined for different file types, however .cell and .params will be self-consistent if set directly.
-
a
¶ Magnitude of cell a vector.
-
alpha
¶ Cell angle alpha.
-
b
¶ Magnitude of cell b vector.
-
beta
¶ Cell angle beta.
-
c
¶ Magnitude of cell c vector.
-
cell
¶ Get the 3x3 vector cell representation.
-
crystal_system
¶ Return the IUCr designation for the crystal system.
-
gamma
¶ Cell angle gamma.
-
imcon
¶ Guess cell shape and return DL_POLY imcon key.
-
inverse
¶ Inverted cell matrix for converting to fractional coordinates.
-
minimum_width
¶ The shortest perpendicular distance within the cell.
-
params
¶ Get the six parameter cell representation as a tuple.
-
to_vector_strings
(scale=1, bohr=False, fmt='%20.12f')[source]¶ Generic [Super]cell vectors in Angstrom as a list of strings.
-
volume
¶ Calculate cell volume a.bxc.
-
-
class
faps.
Guest
(ident=None, guest_path=None)[source]¶ Bases:
object
Guest molecule and properties.
-
aligned_to
(target, align=None, orient=None)[source]¶ Return the atomic positions of the guest with it located at position and aligned using the align and orient vectors. Align and orient are optional and the guest will be aligned using whatever is supplied.
Parameters: target : tuple of int, list of float
The tuple contains the index of the atom to position the guest and the position.
align : tuple of int, list of float
The index of the atom used to align the guest followed by the alignment vector
orient : tuple of int, list of float
The index of the atom used to orient the guest followed by the orientation vector
Returns: positions : list of list of float
The positions of the aligned atoms in a list
-
com
¶ Centre of mass of the guest molecule.
-
is_linear
(idx_1, idx_2=None, idx_3=None)[source]¶ Return whether the atoms at the three indexes are linear. If fewer than three indices are given, always return True.
Parameters: idx_1 : int
Index of an atom in the guest.
idx_2 : int
Index of an atom in the guest. Optional.
idx_3 : int
Index of an atom in the guest. Optional.
Returns: linear : bool
False if three atoms are given and they are not linear, True otherwise.
-
is_reversible
(idx_1, idx_2=None, idx_3=None)[source]¶ Return whether swapping indexes will give you an equivalent guest. For example CO2 is linear and symmetric so each O atom is equivalent.
Parameters: idx_1 : int
Index of an atom in the guest.
idx_2 : int
Index of an atom in the guest. Optional.
idx_3 : int
Index of an atom in the guest. Optional.
Returns: reversible : bool
True if atoms are equivalent.
-
molar_volume
¶ Molar volume at STP in dm3/mol
-
natoms
¶ Number of atoms in the guest.
-
types
¶ Ordered list of atom types.
-
weight
¶ Unit cell weight.
-
-
class
faps.
PyNiss
(options)[source]¶ Bases:
object
PyNiss – Negotiation of Intermediate System States
A single property calculation for one structure. Instance with a set of options, then run the job_dispatcher() to begin the calculation. The calculation will pickle itself, or can be pickled at any time, by calling dump_state().
-
esp_grid
¶ Estimate the esp grid based on resolution and memory.
-
esp_reduced
¶ Has the esp been reduced to fit the memory requirements?
-
-
class
faps.
Structure
(name)[source]¶ Bases:
object
The current state of the structure; update as the calculations proceed.
Structure provides methods to produce input files for and take output from various computational chemistry packages but needs to be told what to do. Internal energy units are kcal/mol.
Methods are grouped: * Initial structure parsers * Output file parsers to update structure * Input file generation * Internal manipulation methods
-
absl_postproc
(filepath, tp_point, options)[source]¶ Update structure properties from DL_POLY outputs.
-
atomic_numbers
¶ Ordered list of atomic numbers.
-
bond_length_check
(too_long=1.25, too_short=0.7)[source]¶ Check if all bonds fall within a sensible range of scale factors of the sum of the covalent radii. Return True if bad bonds are found, otherwise False.
-
check_close_contacts
(absolute=1.0, covalent=None)[source]¶ Check for atoms that are too close. Specify either an absolute distance in Angstrom or a scale factor for the sum of covalent radii. If a covalent factor is specified it will take priority over an absolute distance. Return True if close contacts found, else return False.
-
check_connectivity
()[source]¶ Carry out pre-optimisation checks checks on the structure to determine if bonding information is included and if atom types are needed. No bonding is inferred. Return True if connectivity is bad.
Returns: bool
-
fold_and_maxima
(fold=True, find_maxima=True, tp_point=None, sigma=2.0, radius=0.31, cutoff=0.0, write=False)[source]¶ Determine the positions of maxima and produce an xyz xyz file.
-
from_vasp
(filename='CONTCAR', update=False)[source]¶ Read a structure from a vasp [POS,CONT]CAR file.
-
gcmc_supercell
¶ Supercell used for gcmc.
-
gen_types_from_bonds
()[source]¶ Pass the bonding information into openbabel to get the atomic types. Modifies the atoms in place to set their uff_type attribute.
-
natoms
¶ Number of atoms in the unit cell.
-
order_by_types
()[source]¶ Sort the atoms alphabetically and group them as in old versions. Update bonds to reflect new ordering.
-
sub_property
(name, probe=None, value=None, delete=False)[source]¶ - Helper:
- Return all {probe:value} if no arguments given Return the value or None for a given probe Set area if value given Delete value if delete is True
Units are based on Angstrom
-
supercell
(scale)[source]¶ Iterate over all the atoms of supercell where scale is an integer to scale uniformly or triplet with scale factors for each direction.
-
surface_area
(probe=None, value=None, delete=False)[source]¶ - Helper:
- Return all {probe:area} if no arguments given Return the area or None for a given probe Set area if value given Delete value if delete is True
Areas in A^2
-
symmetry_tree
¶ Tree of atoms that are symmetrically equivalent.
-
to_config_field
(options, fastmc=False, include_guests=None, dummy=False)[source]¶ Return CONFIG and FIELD files in DL_POLY style
Parameters: fastmc : boolean
When set to True, the FIELD file will contain the positions for MC guests and will give incorrect results with DL_POLY.
include_guests : dict or None
A dictionary with guests to be included in the config file with the framework. The guest type is the key and their positions are nested lists.
dummy : boolean
If dummy is set, the interaction parameters and charges for the guest are set to zero
Returns: config : list
The config file as a list of newline terminated strings
field : list
The field file as a list of newline terminated strings
-
to_cssr
(cartesian=False, no_atom_id=False)[source]¶ Return a Cerius2 cssr file with coordinates and cell as a list of strings. Set no_atom_id to produce labels to work with Zeo++.
-
to_gromacs
(metal_geometry='input')[source]¶ Generate GROMACS structure and topology.
metal_geometry will affect topology terms with metal atoms. ‘input’ will use the structure to generate the topology, and ‘fix’ will also apply a stiffer potential.
Return gro, top and itp files as lists of lines.
-
to_gulp
(qeq_fit=False, optimise=False, terse=False, qeq_dict={})[source]¶ Return a GULP file to use for the QEq charges.
-
types
¶ Ordered list of atom types.
-
volume
¶ Unit cell volume.
-
weight
¶ Unit cell weight.
-
-
faps.
angle_between
(left, middle, right, cell=None)[source]¶ Calculate the angle between the atoms middle->left and middle->right.
If a Cell is specified, this will use the minimum image criterion to find the angle with the closest point.
Parameters: left : Atom
one of the atoms
middle : Atom
vertex atom
left : Atom
second atom
cell : Cell or None
if a Cell object is passes the minimum image criterion will be used to calculate the angle
Returns: angle: float
Angle between the atoms in degrees.
-
faps.
cif_bond_dist
(first_atom, second_atom, cell)[source]¶ Calculate the distance to the minimum image and which boundaries have been crossed for _geom_bond_site_symmetry_2.
Parameters: - first_atom – Atom within the cell boundary
- second_atom – Atom to find the distance to
- cell – Cell object
Returns: distance, (dx, dy, dx)
-
faps.
compressed_open
(filename)[source]¶ Return file objects for either compressed and uncompressed files
-
faps.
count_ordered_types
(atoms)[source]¶ Generate a list of atom types and their counts for POSCAR file.
-
faps.
dihedral
(atom_a, atom_b, atom_c, atom_d, cell=None)[source]¶ Calculate the dihedral angle along the path a, b, c, d.
If a Cell is specified, this will use the minimum image criterion to find the atoms that are closest for the vectors.
Parameters: atom_a : Atom
the first atom
atom_b : Atom
one of the atoms
atom_c : Atom
one of the atoms
atom_d : Atom
one of the atoms
cell : Cell or None
if a Cell object is passes the minimum image criterion will be used to calculate the dihedral angle
Returns: angle: float
Angle between the atoms in degrees.
-
faps.
fix_vasp_wrapped_types
(filename='CONTCAR')[source]¶ Output files from VASP with a long list of types sometimes get wrapped. Check if lines have been wrapped and put them all on a single line. Only works with VASP 5 outputs that include type names. Return True if the file has been modified.
Parameters: filename – name of the file to fix Returns: bool
-
faps.
format_tp_path
(tp_point)[source]¶ Format the state point into a short string for use in directory naming, “Txxx.xPyy.yyPzz.zz”. Any pressures above 0.1 bar are fixed at 2 dp, anything below is allowed to float. This is to keep some backwards compatibility with old calculations.
Parameters: tp_point – (temperature, (pressure1, pressure2, ...)) Returns: string “Txxx.xPyy.yyPzz.zz”
-
faps.
incar_extend
(incar, *args)[source]¶ Add the specified (key, value) pairs to the incar string list only if they are not already included in it. Only does startswith() matching, so can be fooled/broken.
-
faps.
lorentz_berthelot
(left, right)[source]¶ Lorentz-Berthelot mixing rules for (sigma, epsilon) tuples.
-
faps.
matrix_rotate
(source, target)[source]¶ Create a rotation matrix that will rotate source on to target.
-
faps.
min_dist
(c_coa, f_coa, c_cob, f_cob_in, box)[source]¶ Calculate the closest distance assuming fractional, in-cell coords.
-
faps.
min_distance
(first_atom, second_atom, cell=None)[source]¶ Helper to find mimimum image criterion distance.
-
faps.
minimum_image
(atom1, atom2, box)[source]¶ Return the minimum image coordinates of atom2 with respect to atom1.
-
faps.
mk_dl_poly_control
(options, dummy=False)[source]¶ CONTROL file for binding site energy calculation.
-
faps.
mk_egulp_params
(param_tuple)[source]¶ Convert an options tuple to an EGULP parameters file filling.
-
faps.
mk_gcmc_control
(temperature, pressures, options, guests, supercell=None)[source]¶ Standard GCMC CONTROL file.
-
faps.
mk_gromacs_mdp
(cell, mode='bfgs', verbose=False)[source]¶ Generate an energy minimsation file for GROMACS, with cell based cutoff.
- Use mode argument to select from:
- ‘bfgs’ standard l-bfgs position optimisation ‘pcoupl’ zero kelivn cell semi anisotropic relaxation ‘sd’ steppest descent minimisation
-
faps.
move_and_overwrite
(src, dest)[source]¶ Move src to dest and overwrite if it is an existing file.
-
faps.
name_from_types
(sites, guest)[source]¶ Generate a string that gives the atoms represented in sites.
-
faps.
remove_files
(files, directory='.')[source]¶ Delete any of the files if they exist using standard globbing, remove empty directories, or ignore silently if not found.
-
faps.
state_points
(temperatures, pressures, individual, nguests)[source]¶ Group temperatures and pressures and append given state point tuples.
-
faps.
subgroup
(iterable, width, itype=None)[source]¶ Split an iterable into nested sub-itypes of width members.