force_field
Force field atom typing and export functions for Crystal structures.
assign_atom_types(crystal, force_field='UFF', **kwargs)
Assign atom types and force field parameters to a crystal structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use for typing. Options: "UFF", "UFF4MOF", "DREIDING", "COMPASS" |
'UFF'
|
**kwargs
|
Additional arguments passed to the atom typing system |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Dictionary with typing results containing: - atom_types: mapping of atom indices to (ff_type, descriptor) tuples - parameters: mapping of atom indices to ForceFieldParameters objects - force_field: name of the force field used - unique_types: set of unique atom types found |
Example
crystal = Crystal.load("MOF.cif") results = assign_atom_types(crystal, "UFF") print(f"Found {len(results['unique_types'])} unique atom types") for i, params in results["parameters"].items(): ... print(f"Atom {i}: {params.ff_type} (ε={params.epsilon:.3f})")
Source code in chmpy/crystal/force_field.py
atom_typing_summary(crystal, force_field='UFF', **kwargs)
Print a summary of atom typing results for a crystal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
**kwargs
|
Additional arguments for atom typing |
{}
|
Source code in chmpy/crystal/force_field.py
export_lammps_data(crystal, filename, force_field='UFF', **kwargs)
Export crystal structure with atom types in LAMMPS data format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
filename
|
str
|
Output filename for LAMMPS data file |
required |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
**kwargs
|
Additional arguments for atom typing and export |
{}
|
Note
This is a placeholder - would need integration with LAMMPS export functionality
Source code in chmpy/crystal/force_field.py
export_raspa_files(crystal, force_field='UFF', output_dir='.', **kwargs)
Export force field parameters in RASPA format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
output_dir
|
str
|
Directory to write RASPA files |
'.'
|
**kwargs
|
Additional arguments for atom typing |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Paths to created RASPA files |
Source code in chmpy/crystal/force_field.py
get_atom_types(crystal, force_field='UFF', use_cached=True, **kwargs)
Get atom type assignments for a crystal structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
use_cached
|
bool
|
Whether to use cached results if available |
True
|
**kwargs
|
Additional arguments for atom typing |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Mapping of atom indices to (force_field_type, AtomTypeDescriptor) tuples |
Source code in chmpy/crystal/force_field.py
get_ff_parameters(crystal, force_field='UFF', use_cached=True, **kwargs)
Get force field parameters for a crystal structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
use_cached
|
bool
|
Whether to use cached results if available |
True
|
**kwargs
|
Additional arguments for atom typing |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Mapping of atom indices to ForceFieldParameters objects |
Source code in chmpy/crystal/force_field.py
get_lj_parameters_array(crystal, force_field='UFF', use_cached=True, **kwargs)
Get Lennard-Jones parameters as structured arrays for simulation input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
use_cached
|
bool
|
Whether to use cached results if available |
True
|
**kwargs
|
Additional arguments for atom typing |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
(atom_types_array, epsilon_array, sigma_array, mass_array, charges_array) where each array is ordered by atom index |
Source code in chmpy/crystal/force_field.py
get_unique_atom_types(crystal, force_field='UFF', use_cached=True, **kwargs)
Get the set of unique atom types in a crystal structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
crystal
|
Crystal instance |
required | |
force_field
|
str or ForceFieldType
|
Force field to use |
'UFF'
|
use_cached
|
bool
|
Whether to use cached results if available |
True
|
**kwargs
|
Additional arguments for atom typing |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
set |
Set of unique force field atom type strings |