smc_lammps.generate package¶
Subpackages¶
- smc_lammps.generate.lammps package
- smc_lammps.generate.structures package
- Subpackages
- Submodules
- smc_lammps.generate.structures.polymer module
PolymerPolymer.__init__()Polymer.add()Polymer.add_tagged_atoms()Polymer.add_tagged_atom_groups()Polymer.split()Polymer.full_list()Polymer.full_list_length()Polymer.move()Polymer.handle_negative_index()Polymer.get_id_from_list_index()Polymer.get_absolute_index()Polymer.all_indices_list()Polymer.indices_list_from_to()Polymer.indices_list_to()Polymer.convert_ratio()Polymer.indices_list_from_to_percent()Polymer.indices_list_to_percent()Polymer.first_id()Polymer.last_id()Polymer.get_percent_id()
- smc_lammps.generate.structures.structure_creator module
Submodules¶
smc_lammps.generate.default_parameters module¶
- class smc_lammps.generate.default_parameters.Parameters(T: float = 300.0, kB: float = 0.01380649, gamma: float = 0.5, output_steps: int = 10000, timestep: float = 0.0002, seed: int = 123, N: int = 501, n: int = 5, force: float | None = 0.8, cycles: int | None = 2, max_steps: int | None = None, steps_APO: int = 2000000, steps_ATP: int = 8000000, steps_ADP: int = 2000000, non_random_steps: bool = False, dna_config: str = 'folded', add_stopper_bead: bool = False, add_RNA_polymerase: bool = False, RNA_polymerase_size: float = 5.0, RNA_polymerase_type: int = 1, spaced_beads_interval: int | None = None, spaced_beads_size: float = 5.0, spaced_beads_full_dna: bool = False, spaced_beads_smc_clearance: float = 5.0, spaced_beads_custom_stiffness: float = 1.0, spaced_beads_type: int = 1, arm_length: float = 50.0, bridge_width: float = 7.5, use_toroidal_hinge: bool = True, hinge_radius: float = 1.5, rigid_hinge: bool = True, kleisin_radius: float = 7.0, sigma_SMC_DNA: float = 2.5, sigma: float = 2.5, folding_angle_APO: float = 45.0, folding_angle_ATP: float = 160.0, arms_angle_ATP: float = 130.0, add_side_site: bool = False, site_cycle_period: int = 0, site_toggle_delay: int = 0, site_cycle_when: str = 'apo', epsilon3: float = 3.0, epsilon4: float = 6.0, epsilon5: float = 6.0, epsilon6: float = 100.0, cutoff4: float = 3.5, cutoff5: float = 3.5, cutoff6: float = 3.0, arms_stiffness: float = 100.0, elbows_stiffness: float = 30.0, site_stiffness: float = 100.0, folding_stiffness: float = 60.0, asymmetry_stiffness: float = 100.0, elbow_attraction: float = 30.0, elbow_spacing: float = 2.5, smc_force: float = 0.0, use_charges: bool = False)¶
Bases:
objectClass that stores all simulation parameters defined by the user.
- T: float = 300.0¶
Simulation temperature (K).
- kB: float = 0.01380649¶
Boltzmann’s constant (pN nm / K).
- gamma: float = 0.5¶
Inverse of friction coefficient (ns).
- output_steps: int = 10000¶
Printing period (number of time steps).
- timestep: float = 0.0002¶
Simulation timestep (ns).
- seed: int = 123¶
Random number seed. Used in the LAMMPS
fix langevincommand and initial configuration generation.
- n: int = 5¶
Number of base pairs per DNA bead.
- force: float | None = 0.8¶
Stretching forces (pN) (set to
Nonefor fixed end points).
- cycles: int | None = 2¶
Number of SMC cycles (if set to None, will find approximate value using
max_steps). Note: cycles are stochastic, so time per cycle is variable, see alsonon_random_steps.
- max_steps: int | None = None¶
Max time steps for a run (None -> no maximum, will complete every cycle). Note: this is not a hard limit, some extra steps may be performed to complete a cycle.
- steps_APO: int = 2000000¶
Average number of steps spent in APO state (waiting for ATP binding).
- steps_ATP: int = 8000000¶
Average number of steps spent in ATP state (waiting for ATP hydrolysis).
- steps_ADP: int = 2000000¶
Average number of steps spent in ADP state (waiting for return to APO).
- non_random_steps: bool = False¶
Disables the exponential sampling for
steps_APO,steps_ATP, andsteps_ADP.
- dna_config: str = 'folded'¶
Initial DNA configuration to generate.
- add_stopper_bead: bool = False¶
Add a bead that prevents the SMC from slipping off of the wrong end of the DNA.
- add_RNA_polymerase: bool = False¶
Add a bead at the DNA-tether site, see also
RNA_polymerase_size.
- RNA_polymerase_size: float = 5.0¶
Radius of RNA polymerase (nm).
- RNA_polymerase_type: int = 1¶
TODO
- spaced_beads_interval: int | None = None¶
Number of DNA beads to leave between small obstacles.
- spaced_beads_size: float = 5.0¶
Radius of beads along DNA (nm).
- spaced_beads_full_dna: bool = False¶
Whether to place beads across the entire DNA length or stop at the SMC location.
- spaced_beads_smc_clearance: float = 5.0¶
Length of bare DNA to keep next to SMC (nm) (useful to prevent large forces due to overlap in initial configuration).
- spaced_beads_custom_stiffness: float = 1.0¶
Multiple of the default DNA stiffness.
- spaced_beads_type: int = 1¶
Type of beads to use,
0-> fene/expand bonds,1-> rigid molecules.
- arm_length: float = 50.0¶
Length of each coiled-coil arm (nm).
- bridge_width: float = 7.5¶
Width of ATP bridge (nm).
- use_toroidal_hinge: bool = True¶
Whether to use the toroidal hinge or the old hinge type.
- __init__(T: float = 300.0, kB: float = 0.01380649, gamma: float = 0.5, output_steps: int = 10000, timestep: float = 0.0002, seed: int = 123, N: int = 501, n: int = 5, force: float | None = 0.8, cycles: int | None = 2, max_steps: int | None = None, steps_APO: int = 2000000, steps_ATP: int = 8000000, steps_ADP: int = 2000000, non_random_steps: bool = False, dna_config: str = 'folded', add_stopper_bead: bool = False, add_RNA_polymerase: bool = False, RNA_polymerase_size: float = 5.0, RNA_polymerase_type: int = 1, spaced_beads_interval: int | None = None, spaced_beads_size: float = 5.0, spaced_beads_full_dna: bool = False, spaced_beads_smc_clearance: float = 5.0, spaced_beads_custom_stiffness: float = 1.0, spaced_beads_type: int = 1, arm_length: float = 50.0, bridge_width: float = 7.5, use_toroidal_hinge: bool = True, hinge_radius: float = 1.5, rigid_hinge: bool = True, kleisin_radius: float = 7.0, sigma_SMC_DNA: float = 2.5, sigma: float = 2.5, folding_angle_APO: float = 45.0, folding_angle_ATP: float = 160.0, arms_angle_ATP: float = 130.0, add_side_site: bool = False, site_cycle_period: int = 0, site_toggle_delay: int = 0, site_cycle_when: str = 'apo', epsilon3: float = 3.0, epsilon4: float = 6.0, epsilon5: float = 6.0, epsilon6: float = 100.0, cutoff4: float = 3.5, cutoff5: float = 3.5, cutoff6: float = 3.0, arms_stiffness: float = 100.0, elbows_stiffness: float = 30.0, site_stiffness: float = 100.0, folding_stiffness: float = 60.0, asymmetry_stiffness: float = 100.0, elbow_attraction: float = 30.0, elbow_spacing: float = 2.5, smc_force: float = 0.0, use_charges: bool = False) None¶
- hinge_radius: float = 1.5¶
Hinge radius (nm).
- rigid_hinge: bool = True¶
Whether to make the hinge a single rigid object or connect the two hinge sections by bonds.
- kleisin_radius: float = 7.0¶
Radius of lower circular-arc compartment (nm).
- sigma_SMC_DNA: float = 2.5¶
SMC-DNA hard-core repulsion radius = LJ sigma (nm).
- sigma: float = 2.5¶
TODO
- folding_angle_APO: float = 45.0¶
Folding angle of lower compartment (degrees).
- folding_angle_ATP: float = 160.0¶
Folding angle of lower compartment (degrees).
- arms_angle_ATP: float = 130.0¶
Opening angle of arms in ATP-bound state (degrees).
- add_side_site: bool = False¶
Add a binding site on the lower SMC arm to act as the cycling site. If enabled, the lower site operates normally.
- site_cycle_period: int = 0¶
The number of SMC cycles between events where the cycling site is disabled. A value of zero disables this and uses the default site dynamics.
- site_toggle_delay: int = 0¶
The number of SMC cycles between the cycling site being turned off and then on again. A value of zero means that the site will be enabled in the same cycle.
- site_cycle_when: str = 'apo'¶
“apo”, “adp”.
- Type:
When to re-enable the cycling site. Allowed values
- epsilon3: float = 3.0¶
Repulsion strength (kT units).
- epsilon4: float = 6.0¶
Upper site attraction strength (kT units).
- epsilon5: float = 6.0¶
Middle site attraction strength (kT units).
- epsilon6: float = 100.0¶
Lower site attraction strength (kT units).
- cutoff4: float = 3.5¶
Cutoff distance for upper site (nm).
- cutoff5: float = 3.5¶
Cutoff distance for middle site (nm).
- cutoff6: float = 3.0¶
Cutoff distance for lower site (nm).
- arms_stiffness: float = 100.0¶
Bending stiffness of arm-bridge angle (kT units).
- elbows_stiffness: float = 30.0¶
Bending stiffness of elbows (kT units).
- site_stiffness: float = 100.0¶
Alignment stiffness of binding sites (kT units).
- folding_stiffness: float = 60.0¶
Folding stiffness of lower compartment (kT units).
- asymmetry_stiffness: float = 100.0¶
Folding asymmetry stiffness of lower compartment (kT units).
- elbow_attraction: float = 30.0¶
Attractive energy between elbows in the APO state (kT units).
- elbow_spacing: float = 2.5¶
Rest length between elbows in the APO state (nm).
- smc_force: float = 0.0¶
Extra force on SMC in the -x direction and +y direction (left & up) (pN).
- use_charges: bool = False¶
Enable Coulomb interactions in LAMMPS.
smc_lammps.generate.generator module¶
generator.py¶
- How to use:
create a Generator instance
create AtomType instances for each type you need
create BAI_Type for Bond/Angle/Improper types
define AtomGroup with positions and type
define BAI for interactions between specific atoms
define PairWise, and use add_interaction to define global interactions
append all defined AtomGroup, BAI, and PairWise instances to the lists in Generator
call Generator.write(file) to create the final datafile
- class smc_lammps.generate.generator.AtomType(mass: float = 1.0, unused: bool = False)¶
Bases:
objectRepresents a LAMMPS atom type.
See LAMMPS read_data ‘Atom Type Labels section’ and LAMMPS type labels.
- exception UnusedIndex¶
Bases:
AttributeErrorLAMMPS does not allow gaps in atom types, therefore unused indices may cause issues.
- __init__(mass: float = 1.0, unused: bool = False) None¶
- property index: int¶
The LAMMPS atom type index.
If this is called for the first time, the global index is incremented.
- Returns:
Index.
- Raises:
self.UnusedIndex – Marked as unused, should not call this method.
- class smc_lammps.generate.generator.MoleculeId¶
Bases:
objectRepresents a LAMMPS molecule id.
See LAMMPS molecule.
- classmethod get_next() int¶
Increments the global index and returns it.
- Returns:
Index.
- class smc_lammps.generate.generator.BAI_Kind(*values)¶
Bases:
EnumA LAMMPS Bond/Angle/Improper kind, see
BAI_Typefor usage.- BOND = 1¶
- ANGLE = 2¶
- IMPROPER = 3¶
- class smc_lammps.generate.generator.BAI_Type(kind: BAI_Kind, style: str, coefficients: str = '')¶
Bases:
objectA LAMMPS Bond/Angle/Improper type.
- _index¶
LAMMPS type index.
- Type:
int
- style¶
The style definition used in the LAMMPS command.
- Type:
str
- indices = {BAI_Kind.ANGLE: 1, BAI_Kind.BOND: 1, BAI_Kind.IMPROPER: 1}¶
Global LAMMPS indices for each BAI kind.
- __init__(kind: BAI_Kind, style: str, coefficients: str = '') None¶
coefficients will be printed after the index in a datafile e.g. 3 harmonic 2 5 (where 3 is the index and the rest is the coefficients string)
- property index: int¶
The LAMMPS Bond/Angle/Improper type index.
If this is called for the first time, the global index corresponding to the given BAI kind is incremented.
- Returns:
Index.
- get_string(omit_style: bool = False) str¶
Returns the string used with the *_coeff command.
- Example:
>>> from smc_lammps.generate.generator import BAI_Type, BAI_Kind >>> # create a harmonic bond with K=10.0 and a=1.0 >>> my_bond = BAI_Type(BAI_Kind.BOND, 'harmonic', '10.0 1.0') >>> my_bond.get_string() '1 harmonic 10.0 1.0'
- Parameters:
omit_style – If True, do not print the
BAI_Type.style.- Returns:
String in the ‘{index} {style} {coefficients}’ format.
- smc_lammps.generate.generator.COORD_TYPE¶
The type to store coordinate positions.
- smc_lammps.generate.generator.Nx3Array¶
An (N, 3) array of positions.
alias of
ndarray[tuple[Any, …],dtype[float32]]
- class smc_lammps.generate.generator.AtomGroup(positions: ndarray[tuple[Any, ...], dtype[float32]], atom_type: AtomType, molecule_index: int, polymer_bond_type: BAI_Type | None = None, polymer_angle_type: BAI_Type | None = None, charge: float = 0.0)¶
Bases:
objectStores a list of atoms with the same
AtomType.- Also supports polymer bond and angle for convenience.
If
polymer_bond_typeis None, no bonds are created.If
polymer_angle_typeis None, no angle interactions are created.
- molecule_index¶
The molecule index of all atoms in the group (see also
Generator.molecule_override())- Type:
int
- polymer_bond_type¶
BAI.Kind == BAI.BOND, forms a polymer in the order of the
positionslist.- Type:
BAI_Type | None
- polymer_angle_type¶
BAI.Kind == BAI.ANGLE, adds angle potentials along the polymer.
- Type:
BAI_Type | None
- charge¶
The charge of all atoms in the group, used with atom style
full.- Type:
float
- __init__(positions: ndarray[tuple[Any, ...], dtype[float32]], atom_type: AtomType, molecule_index: int, polymer_bond_type: BAI_Type | None = None, polymer_angle_type: BAI_Type | None = None, charge: float = 0.0) None¶
- property n: int¶
Number of atoms in the group.
Returns the length of the positions array.
- Returns:
Number of atoms.
- smc_lammps.generate.generator.AtomIdentifier¶
A unique identifier of an atom in a group.
alias of
tuple[AtomGroup,int]
- class smc_lammps.generate.generator.BAI(type_: BAI_Type, *atoms: tuple[AtomGroup, int])¶
Bases:
objectRepresents a Bond/Angle/Improper interaction between a certain number of atoms.
See also
PairWisefor interactions between types of atoms (e.g. Lennard-Jones).
- class smc_lammps.generate.generator.PairWise(header: str, template: str, default: list[Any] | None)¶
Bases:
objectRepresents pair interactions between all atoms of two atoms ids.
- header¶
Definition of the interaction style, e.g.
'PairIJ Coeffs # hybrid'.- Type:
str
- template¶
Format string with empty formatters
{}for the interaction parameters, e.g.'lj/cut {} {} {}'.- Type:
str
- default¶
List of default parameters. If
None, do not insert missing interactions. This is used to fill out all interactions, since LAMMPS requires them to all be explicitly defined.- Type:
list[Any] | None
- __init__(header: str, template: str, default: list[Any] | None) None¶
- add_interaction(atom_type1: AtomType, atom_type2: AtomType, *args: Any, **kwargs: bool) PairWise¶
Adds an iteraction.
Indices are sorted automatically, which is required by LAMMPS.
- write(file: TextIO, atom_types: list[AtomType]) None¶
Writes the Pair Coeffs header and all pair interactions to a file.
- Example:
PairIJ Coeffs 1 8 lj/cut 0.0 0.0 0.0
- get_all_interaction_pairs(all_atom_types: list[AtomType]) list[tuple[AtomType, AtomType]]¶
Returns all possible interactions, whether they are set by the user or not.
- Parameters:
all_atom_types – List of all the atom types that exist in the simulation.
- Returns:
List of interactions (t_1, t_2) with t_1 <= t_2.
- pair_in_inter(interaction: tuple[AtomType, AtomType]) tuple[AtomType, AtomType, list[Any]] | None¶
Checks if an interaction is defined in
pairs.- Parameters:
interaction – Interaction to look for.
- Returns:
The pair as it is defined in
pairs(may have opposite order), or None if no pair was found.
- get_all_interactions(all_atom_types: list[AtomType]) list[tuple[AtomType, AtomType, str]]¶
Returns actual interactions to define.
Applies the default where no interaction was specified by the user.
- Parameters:
all_atom_types – List of all the atom types that exist in the simulation.
- Returns:
List of (t_1, t_2, f) where t_1 <= t_2 and f is the formatted string.
- smc_lammps.generate.generator.write_if_non_zero(file: TextIO, fmt_string: str, amount: int)¶
Writes an amount to a file only if it is not zero.
- Parameters:
file – File to write to.
fmt_string – Format string with one empty formatter
{}for theamount.amount – The amount to write if non-zero.
- class smc_lammps.generate.generator.Generator¶
Bases:
objectGenerates the LAMMPS data files from the given simulation properties.
- __init__() None¶
- atom_group_map: list[int]¶
Maps the index of an atom group to the global index offset for the LAMMPS atom indices. Note! This is only defined after calling
Generator.write_atoms().
- box_width¶
Size of the simulation box (cube side length).
- molecule_override: dict[tuple[AtomGroup, int], int]¶
Individual molecule id overrides for atoms. Takes precedence over the
AtomGroupmolecule id.
- charge_override: dict[tuple[AtomGroup, int], float]¶
Individual charge value overrides for atoms. Takes precedence over the
AtomGroupcharge value.
- use_charges¶
Whether to enable charges (atom_style ‘full’) or not (atom_style ‘molecule’).
- hybrid_styles¶
Used when multiple styles are defined, default of ‘hybrid’ should work in most cases.
- random_shift¶
Function that returns a random shift vector. This is useful to avoid exact overlap, which causes LAMMPS to crash during kspace calculations (e.g. with pair_style coul).
- add_atom_groups(*args: AtomGroup) None¶
Adds new atom groups.
Atom groups with empty positions are ignored.
- move_all_atoms(shift: ndarray[tuple[Any, ...], dtype[float32]]) None¶
Moves all atoms in a certain direction.
Useful to place the system at the center of the simulation box.
- Parameters:
shift – All atoms are shifted by this vector (1, 3).
- set_system_size(box_width: float) None¶
Sets the box size of the simulation.
Note: box is cubic.
- Parameters:
box_width – Width of box.
- Raises:
ValueError – Received negative or zero
box_width.
- get_total_atoms() int¶
Returns the total number of atoms across all groups.
- write_header(file: TextIO) None¶
Writes the top header to a file.
Note: LAMMPS always ignores the first line of a data file, which should be this header.
- Parameters:
file – File to write to.
- get_all_atom_types() list[AtomType]¶
Returns a list of all atom types across all atom groups.
- Returns:
List of atom types, sorted by
AtomType.index.
- get_all_types(kind: BAI_Kind) list[BAI_Type]¶
Returns a list of all Bond/Angle/Improper types across all atom groups.
- Parameters:
kind – BAI kind to filter by.
- Returns:
List of BAI types of the given
kind, sorted byBAI_Type.index.
- get_bai_dict_by_type() dict[BAI_Kind, list[BAI]]¶
Returns a dictionary mapping the Bond/Angle/Improper kind to a list of all BAIs which have that type.
- Returns:
Dictionary which maps kind to BAIs of that kind.
- get_amounts() tuple[int, int, int]¶
Returns the total amount of bonds, angles, and impropers.
- Returns:
Tuple of (# bonds, # angles, # impropers)
- write_amounts(file: TextIO) None¶
Writes the amount of atoms, bonds, angles, and impropers to a file.
- Parameters:
file – File to write to.
- write_types(file: TextIO) None¶
Writes the amount of atom types, bond types, angle types, and improper types to a file.
- Parameters:
file – File to write to.
- write_system_size(file: TextIO) None¶
Writes the system size to a file.
- Parameters:
file – File to write to.
- Raises:
TypeError – The
box_widthis None.
- write_masses(file: TextIO) None¶
Writes the masses of all atom types to a file.
- Parameters:
file – File to write to.
- get_all_BAI_styles() dict[BAI_Kind, list[str]]¶
Returns a list of unique styles for each BAI kind.
- Returns:
Dictionary which maps each BAI kind to a list of unique styles.
- get_BAI_styles_command() str¶
Returns the command to define the BAI styles in a LAMMPS script.
- Returns:
LAMMPS command string.
- get_hybrid_or_single_style() dict[BAI_Kind, str]¶
Returns the style needed for the BAI Coeffs header.
- get_BAI_coeffs_header(kind: BAI_Kind) str¶
Returns the header string corresponding to a Bond/Angle/Improper kind.
- write_BAI_coeffs(file: TextIO) None¶
Writes the Bond/Angle/Improper coefficients for each BAI kind to a file.
- write_pair_interactions(file: TextIO) None¶
Writes the Pair Coeffs header(s) and corresponding pair interactions to a file.
- get_atom_index(atom_id: tuple[AtomGroup, int]) int¶
Returns the absolute LAMMPS index for an atom.
Attention
You must call
write_atoms()before using this method.
- get_atom_style() str¶
Returns the atom_style for LAMMPS (based on
use_charges).
- get_atoms_header() str¶
- get_atom_style_command() str¶
- check_charges() None¶
Checks for discrepancies between the use_charges flag and the actual atom charges.
- write_atoms(file: TextIO) None¶
Writes the Atoms header and all atom positions to a file.
Attention
This calls
_set_up_atom_group_map(), read the note there.- Parameters:
file – File to write to.
- write_bai(file: TextIO) None¶
Writes the Bond/Angle/Improper headers and all corresponding BAI interactions to a file.
- write_coeffs(file: TextIO) None¶
Writes the coefficient information to a file.
Useful when restarting a simulation.
- write_positions_and_bonds(file: TextIO) None¶
Writes the positions and bonds to a file.
- write_full(file: TextIO) None¶
Writes a full LAMMPS data file.
- class DynamicCoeffs(coeff_string: str, args: BAI_Type | list[AtomType])¶
Bases:
objectHandles coefficients dynamically set within a LAMMPS script using pair_coeff, bond_coeff, angle_coeff, and improper_coeff commands.
- static get_script_bai_command_name(pair_or_BAI: BAI_Kind | None) str¶
Returns the command name for a pair / BAI interaction. Used to redefine coefficients within a LAMMPS script.
- classmethod create_from_pairwise(pairwise: PairWise, type1: AtomType, type2: AtomType, values: list[Any] | None) DynamicCoeffs¶
- write_script_bai_coeffs(file: TextIO) None¶
Writes a LAMMPS command for a pair / BAI interaction to a file.
- smc_lammps.generate.generator.test_simple_atoms()¶
- smc_lammps.generate.generator.test_simple_atoms_polymer()¶
- smc_lammps.generate.generator.test_with_bonds()¶
- smc_lammps.generate.generator.test_with_pairs()¶
- smc_lammps.generate.generator.all_tests()¶
- smc_lammps.generate.generator.main()¶
- smc_lammps.generate.generator.Generator._set_up_atom_group_map(self) None¶
Sets the
atom_group_mapbased on the current atom groups.Attention
The atom groups must not change after calling this function.
smc_lammps.generate.parameters_template module¶
smc_lammps.generate.util module¶
- smc_lammps.generate.util.get_project_root() Path¶
Returns the project root directory (
src/smc_lammps).- Returns:
Project root path.
- smc_lammps.generate.util.get_parameters(file: Path) Parameters¶
Reads the parameters from a python file.
Runs the given
fileas a python script and loads the variable namedp.- Parameters:
file – Python script containing parameters.
- Returns:
Loaded parameters.
- Raises:
ValueError – Could not find variable
pin the file.TypeError – The variable
pis not an instance ofParameters.
- smc_lammps.generate.util.load_parameters(path: Path) Parameters¶
Reads the parameters from a python file.
Runs the python file
parameters.pyunderpathand loads the variable namedp.Note
See
get_parameters()for possible errors.- Parameters:
path – Simulation base path.
- Returns:
Loaded parameters.
- Raises:
FileNotFoundError – No
parameters.pyunderpath.
- smc_lammps.generate.util.create_phase(file: Path, options: Sequence[DynamicCoeffs]) None¶
Creates a file containing coefficients to dynamically load in LAMMPS scripts.
Attention
The given
fileis overwritten.- Parameters:
phase_path – File to write LAMMPS commands to.
options – Coefficients that are passed to
smc_lammps.generate.generator.Generator.DynamicCoeffs.write_script_bai_coeffs().
- smc_lammps.generate.util.create_phase_wrapper(phase_path: Path, options: Sequence[DynamicCoeffs | None]) None¶
Filters out None values and calls
create_phase().- Parameters:
phase_path – File to write LAMMPS commands to.
options – Coefficients that are passed to
smc_lammps.generate.generator.Generator.DynamicCoeffs.write_script_bai_coeffs().
- smc_lammps.generate.util.get_closest(array: ndarray[tuple[Any, ...], dtype[float32]], position) int¶
Returns the index in the
arraythat is closes to theposition.- Parameters:
array – An (n, 3) array of points.
position – A single 3D point.
- Returns:
Index.
- smc_lammps.generate.util.pos_from_id(atom_id: tuple[AtomGroup, int]) ndarray[tuple[Any, ...], dtype[float32]]¶
Returns the 3D position of an atom from its id.
Note
This returns a copied array, which can be edited without affecting the original position.
- Parameters:
atom_id – The atom id.
- Returns:
A 3D Point.