Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dear developers,
This PR introduces several updates that I found useful for setting up workflows involving LAMMPS simulations of crystal structures. I believe the community might find these changes valuable as well.
I’ve done my best to maintain backward compatibility and to modify only the minimum necessary parts of the code to avoid breaking existing functionality.
New features
Using bond types from CIF files instead of recalculating them.
Previously, although bond connectivity could be read from the CIF file, the bond types were always recalculated. This behavior could lead to undesired results in some applications. This PR adds a new option,
bond_types_from_cif
, when reading the cif file, which forces the code to use the bond types specified in the CIF file.Example of use:
When
bond_types_from_cif=True
, thebond_types_from_cif
function is skipped. Additionally, a few modifications to thecompute_init_typing
function were also required to ensure that the atom hybridization is detected correctly.Dump the final structure after
minimization
orrelax
simulations.The LAMMPS input now contains a dump after
minimization
orrelax
simulations, creating adata.optimized
file at the end of the simulation. This is especially convenient for parsing the optimized structure with the ASE library.Optional check for small distances
The class
MolecularGraph
now has acheck_distances
attribute, which isTrue
by default but can be set toFalse
, allowing the user to force the creation of the LAMMPS input even if there are atoms to close.Example of use:
Read CIF files with the ASE library
The ase_from_CIF function is now fully implemented, allowing users to read CIF files - including those with non-P1 symmetries - using ASE's read function as described in #5 .
Note
Due to ASE limitations, information about partial charges, custom atom types, and bond connectivity is not preserved when using this function. Still, it can be useful in many scenarios.
Example of use: