ichor.core.files.dl_poly package
Submodules
ichor.core.files.dl_poly.dl_poly_config module
- class DlPolyConfig(system_name: str, trajectory: Trajectory, path: Path | str = PosixPath('CONFIG'), cell_size: float = 50.0, comment_line='Frame : 1\n')
Bases:
WriteFileWrite out a DLPoly CONFIG file. The name of the file needs to be CONFIG, so DL POLY knows to use it.
- Parameters:
system_name – the name of the chemical system
trajectory – a Trajectory instance containing the geometries that are going to be written to the CONFIG file. Each timestep in the trajectory is an Atoms instance.
path – The path to the CONFIG file, defaults to Path(‘CONFIG’)
cell_size – The size of the box, float
line (comment) –
The very first line in the CONFIG file. Must be below 72 characters
Note
ALL of the timesteps in the Trajectory will be written to one CONFIG file. Each timestep groups geometries which should be represented by a GP model. For example, if each timestep is only one molecule, then it means it is a monomer model and the labels of the atoms in the CONFIG will show that. If each timestep is two molecules, it means it is a dimer model, so then the labels in the CONFIG file will make sure that two molecules which should be represented by one GP model have the correct atom labeling in the CONFIG file.
- path: Path | str
ichor.core.files.dl_poly.dl_poly_control module
- class DlPolyControl(system_name: str, path: Path = PosixPath('CONTROL'), ensemble: str = 'nvt', thermostat: str = 'hoover', thermostat_settings: list = [0.04], temperature: int = 1, timestep=0.001, steps=500, scale=100, cutoff=8.0, rvwd=8.0, dump=1000, trajectory_i=0, trajectory_j=1, trajectory_k=0, print_every=1, stats_every=1, job_time=10000000, close_time=20000)
Bases:
WriteFileWrite out a DLPoly CONTROL file. The name of the file needs to be CONTROL, so DL POLY knows to use it. The default Control file is made to be used for geometry optimizations at very low temperatures. Settings must be changed to write out a file for water box simulations for example.
- path: Path | str
ichor.core.files.dl_poly.dl_poly_fflux module
- class DlPolyFFLUX(path: Path | str = PosixPath('FFLUX'))
Bases:
ReadFileREADS the FFLUX file from FFLUX.
- Parameters:
path – Path to FFLUX file
- Variables:
df – A pandas dataframe storing all the data in the FFLUX file.
sum_iqa_energy – The total energies array of shape ntimesteps
vdw_energy – The Van der Waals energies of each timestep. Only computed if there are multiple molecules. Otherwise they will be 0.0
electrostatic_energy – The electrostatic energies of each timestep. Only computed if there are multiple molecules. Otherwise they will be 0.0
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- property delta_between_timesteps: List[float]
Calculates the delta energy (in kJ mol-1) between each pairs of timesteps. Useful for checking convergence of energy when doing optimizations.
- Returns:
List containing the first index (timestep) where the threshold is met as well as the list of differences for all timesteps
- property delta_between_timesteps_kj_mol: List[float]
Calculates the delta energy (in kJ mol-1) between each pairs of timesteps. Useful for checking convergence of energy when doing optimizations.
- Returns:
List containing the first index (timestep) where the threshold is met as well as the list of differences for all timesteps
- property electrostatic_energy
- first_index_where_delta_less_than(delta=0.0001) int
Returns first index where the energy between timesteps is below delta (in kJ mol-1)
- Parameters:
delta – The threshold when geometry is converged, defaults to 1e-4 kJ mol-1
- property kinetic_energy
- property ntimesteps
- path: Path | str
- plot_abs_differences(until_converged_energy=True)
- property sum_iqa_energy
- property total_energy
- property total_energy_kj_mol
- property vdw_energy
ichor.core.files.dl_poly.dl_poly_field module
- class ConnectedAtom(atom: Atom, parent: ConnectedAtoms)
Bases:
Atom
ichor.core.files.dl_poly.dl_poly_history module
- class DlPolyHistory(path: Path | None = PosixPath('HISTORY'))
Bases:
TrajectoryDLPOLY HISTORY File
Inherits from Trajectory as is a list of Atoms Builds on the Trajectory class by adding DLPOLY information provided by the HISTORY file
Warning
Indexing the history as a python list, i.e. history[1000] is not guaranteed to give the 1000th timestep (0-indexed). This is because sometimes there is binary written to the HISTORY file which messes up some geometries. These geometries are excluded from the read in data, so indexing as a list will might return a different timestep.
To make sure that the exact timestep is returned (useful when you also want to get data from FFLUX or IQA_ENERGIES/IQA_FORCES file, then ensure that you check the
ntimestepattribute of a timestep). This will be correct, even if some geoemtries are missing.To get a list of missing timesteps, use the self.removed_timesteps attribute of the DlPolyHistory class.
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- path: Path | str
- write_final_geometry_to_xyz(xyz_path: Path)
- write_to_trajectory(path: str = 'TRAJECTORY.xyz')
Writes a trajectory .xyz file from the DL POLY HISTORY file.
- class DlpolyPeriodicBoundary(value)
Bases:
EnumAn enumeration.
- Cubic = 1
- HexagonalPrism = 7
- NoBoundary = 0
- Orthorhombic = 2
- Parallelepiped = 3
- RhombicDodecahedral = 5
- TruncatedOctahedral = 4
- XYParallelogram = 6
- class DlpolyTimestepAtom(ty: str, x: float, y: float, z: float, index: int | None = None, parent: Atoms | None = None, units: AtomicDistance = AtomicDistance.Angstroms, velocity=None, force=None)
Bases:
Atom- property force
- property velocity
- class DlpolyTrajectoryKey(value)
Bases:
EnumAn enumeration.
- Coordinate = 0
- CoordinateVelocity = 1
- CoordinateVelocityForce = 2
- exception ForceNotDefined
Bases:
Exception
- exception VelocityNotDefined
Bases:
Exception
ichor.core.files.dl_poly.dl_poly_iqa_energies module
- class DlPolyIQAEnergies(path: Path | str = PosixPath('IQA_ENERGIES'))
Bases:
ReadFileREADS the IQA_ENERGIES file from FFLUX.
- Parameters:
path – Path to IQA_ENERGIES file
- Variables:
natoms – Number of atoms in system
energies – Array of shape ntimesteps x natoms for read energies
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- path: Path | str
ichor.core.files.dl_poly.dl_poly_iqa_forces module
- class DlPolyIQAForces(path: Path | str = PosixPath('IQA_FORCES'))
Bases:
ReadFileREADS the IQA_FORCES file from FFLUX.
- Parameters:
path – Path to IQA_FORCES file
- Variables:
forces – The forces array of shape ntimesteps x natoms x 3. Initialized as FileContents prior to file reading.
natoms – Number of atoms in each timestep
- check_forces_less_than_value(value=0.001) ndarray
Checks what timesteps have all forces less than value. The GP models will revert back to prior mean when far away from training data, so that the forces on atoms will be 0.
We can check for that because if the forces are consistently less than the value then either the simulation has crashed or a minimum is reached
- Parameters:
value – Value for which all forces need to be less than
- Returns:
np.ndarray containing timestep indices for which condition is true If len(array) is 0, then the condition is not met for any timestep. Could be useful to check if a geometry is optimized or simulation crashed.
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- path: Path | str
ichor.core.files.dl_poly.fflux_directory module
- class FFLUXDirectory(path: Path | str)
Bases:
AnnotatedDirectoryREADS a FFLUX Directory containing FFLUX, IQA_ENERGIES, IQA_FORCEs and HISTORY file
- Parameters:
path – Path to FFLUX Directory
- contents = {'fflux_file': <class 'ichor.core.files.dl_poly.dl_poly_fflux.DlPolyFFLUX'>, 'history_file': <class 'ichor.core.files.dl_poly.dl_poly_history.DlPolyHistory'>, 'iqa_energies_file': <class 'ichor.core.files.dl_poly.dl_poly_iqa_energies.DlPolyIQAEnergies'>, 'iqa_forces_file': <class 'ichor.core.files.dl_poly.dl_poly_iqa_forces.DlPolyIQAForces'>}
- property coordinates: ndarray
Returns coordinates as array of shape ntimesteps x natoms x 3
- property iqa_energies: ndarray
Returns individual atom iqa enegy array of shape ntimesteps x natoms
- property iqa_forces: ndarray
Returns iqa forces array of shape ntimesteps x natoms x 3
- property natoms: int
Returns number of atoms
- path: Path | str
- property total_iqa_energies: ndarray
Returns total energy array of shape ntimesteps
Module contents
- class DlPolyConfig(system_name: str, trajectory: Trajectory, path: Path | str = PosixPath('CONFIG'), cell_size: float = 50.0, comment_line='Frame : 1\n')
Bases:
WriteFileWrite out a DLPoly CONFIG file. The name of the file needs to be CONFIG, so DL POLY knows to use it.
- Parameters:
system_name – the name of the chemical system
trajectory – a Trajectory instance containing the geometries that are going to be written to the CONFIG file. Each timestep in the trajectory is an Atoms instance.
path – The path to the CONFIG file, defaults to Path(‘CONFIG’)
cell_size – The size of the box, float
line (comment) –
The very first line in the CONFIG file. Must be below 72 characters
Note
ALL of the timesteps in the Trajectory will be written to one CONFIG file. Each timestep groups geometries which should be represented by a GP model. For example, if each timestep is only one molecule, then it means it is a monomer model and the labels of the atoms in the CONFIG will show that. If each timestep is two molecules, it means it is a dimer model, so then the labels in the CONFIG file will make sure that two molecules which should be represented by one GP model have the correct atom labeling in the CONFIG file.
- path: Path | str
- class DlPolyControl(system_name: str, path: Path = PosixPath('CONTROL'), ensemble: str = 'nvt', thermostat: str = 'hoover', thermostat_settings: list = [0.04], temperature: int = 1, timestep=0.001, steps=500, scale=100, cutoff=8.0, rvwd=8.0, dump=1000, trajectory_i=0, trajectory_j=1, trajectory_k=0, print_every=1, stats_every=1, job_time=10000000, close_time=20000)
Bases:
WriteFileWrite out a DLPoly CONTROL file. The name of the file needs to be CONTROL, so DL POLY knows to use it. The default Control file is made to be used for geometry optimizations at very low temperatures. Settings must be changed to write out a file for water box simulations for example.
- path: Path | str
- class DlPolyFFLUX(path: Path | str = PosixPath('FFLUX'))
Bases:
ReadFileREADS the FFLUX file from FFLUX.
- Parameters:
path – Path to FFLUX file
- Variables:
df – A pandas dataframe storing all the data in the FFLUX file.
sum_iqa_energy – The total energies array of shape ntimesteps
vdw_energy – The Van der Waals energies of each timestep. Only computed if there are multiple molecules. Otherwise they will be 0.0
electrostatic_energy – The electrostatic energies of each timestep. Only computed if there are multiple molecules. Otherwise they will be 0.0
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- property delta_between_timesteps: List[float]
Calculates the delta energy (in kJ mol-1) between each pairs of timesteps. Useful for checking convergence of energy when doing optimizations.
- Returns:
List containing the first index (timestep) where the threshold is met as well as the list of differences for all timesteps
- property delta_between_timesteps_kj_mol: List[float]
Calculates the delta energy (in kJ mol-1) between each pairs of timesteps. Useful for checking convergence of energy when doing optimizations.
- Returns:
List containing the first index (timestep) where the threshold is met as well as the list of differences for all timesteps
- property electrostatic_energy
- first_index_where_delta_less_than(delta=0.0001) int
Returns first index where the energy between timesteps is below delta (in kJ mol-1)
- Parameters:
delta – The threshold when geometry is converged, defaults to 1e-4 kJ mol-1
- property kinetic_energy
- property ntimesteps
- path: Path | str
- plot_abs_differences(until_converged_energy=True)
- property sum_iqa_energy
- property total_energy
- property total_energy_kj_mol
- property vdw_energy
- class DlPolyField(system_name: str, atoms: Atoms, path: Path | str = PosixPath('FIELD'), nummols=1)
Bases:
WriteFile- path: Path | str
- class DlPolyHistory(path: Path | None = PosixPath('HISTORY'))
Bases:
TrajectoryDLPOLY HISTORY File
Inherits from Trajectory as is a list of Atoms Builds on the Trajectory class by adding DLPOLY information provided by the HISTORY file
Warning
Indexing the history as a python list, i.e. history[1000] is not guaranteed to give the 1000th timestep (0-indexed). This is because sometimes there is binary written to the HISTORY file which messes up some geometries. These geometries are excluded from the read in data, so indexing as a list will might return a different timestep.
To make sure that the exact timestep is returned (useful when you also want to get data from FFLUX or IQA_ENERGIES/IQA_FORCES file, then ensure that you check the
ntimestepattribute of a timestep). This will be correct, even if some geoemtries are missing.To get a list of missing timesteps, use the self.removed_timesteps attribute of the DlPolyHistory class.
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- path: Path | str
- write_final_geometry_to_xyz(xyz_path: Path)
- write_to_trajectory(path: str = 'TRAJECTORY.xyz')
Writes a trajectory .xyz file from the DL POLY HISTORY file.
- class DlPolyIQAEnergies(path: Path | str = PosixPath('IQA_ENERGIES'))
Bases:
ReadFileREADS the IQA_ENERGIES file from FFLUX.
- Parameters:
path – Path to IQA_ENERGIES file
- Variables:
natoms – Number of atoms in system
energies – Array of shape ntimesteps x natoms for read energies
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- path: Path | str
- class DlPolyIQAForces(path: Path | str = PosixPath('IQA_FORCES'))
Bases:
ReadFileREADS the IQA_FORCES file from FFLUX.
- Parameters:
path – Path to IQA_FORCES file
- Variables:
forces – The forces array of shape ntimesteps x natoms x 3. Initialized as FileContents prior to file reading.
natoms – Number of atoms in each timestep
- check_forces_less_than_value(value=0.001) ndarray
Checks what timesteps have all forces less than value. The GP models will revert back to prior mean when far away from training data, so that the forces on atoms will be 0.
We can check for that because if the forces are consistently less than the value then either the simulation has crashed or a minimum is reached
- Parameters:
value – Value for which all forces need to be less than
- Returns:
np.ndarray containing timestep indices for which condition is true If len(array) is 0, then the condition is not met for any timestep. Could be useful to check if a geometry is optimized or simulation crashed.
- classmethod check_path(path: Path) bool
Checks the suffix of the given path matches the filetype associated with class that subclasses from File :param path: A Path object to check :return: True if the Path object has the same suffix as the class filetype, False otherwise
- path: Path | str
- class FFLUXDirectory(path: Path | str)
Bases:
AnnotatedDirectoryREADS a FFLUX Directory containing FFLUX, IQA_ENERGIES, IQA_FORCEs and HISTORY file
- Parameters:
path – Path to FFLUX Directory
- contents = {'fflux_file': <class 'ichor.core.files.dl_poly.dl_poly_fflux.DlPolyFFLUX'>, 'history_file': <class 'ichor.core.files.dl_poly.dl_poly_history.DlPolyHistory'>, 'iqa_energies_file': <class 'ichor.core.files.dl_poly.dl_poly_iqa_energies.DlPolyIQAEnergies'>, 'iqa_forces_file': <class 'ichor.core.files.dl_poly.dl_poly_iqa_forces.DlPolyIQAForces'>}
- property coordinates: ndarray
Returns coordinates as array of shape ntimesteps x natoms x 3
- property iqa_energies: ndarray
Returns individual atom iqa enegy array of shape ntimesteps x natoms
- property iqa_forces: ndarray
Returns iqa forces array of shape ntimesteps x natoms x 3
- property natoms: int
Returns number of atoms
- path: Path | str
- property total_iqa_energies: ndarray
Returns total energy array of shape ntimesteps