@@ -37,6 +37,7 @@ def write_lammpsdata(
37
37
sigma_conversion_factor = None ,
38
38
epsilon_conversion_factor = None ,
39
39
mass_conversion_factor = None ,
40
+ charge_conversion_factor = True ,
40
41
zero_dihedral_weighting_factor = False ,
41
42
moleculeID_offset = 1 ,
42
43
):
@@ -52,51 +53,56 @@ def write_lammpsdata(
52
53
ParmEd structure object
53
54
filename : str
54
55
Path of the output file
55
- atom_style: str
56
+ atom_style: str, optional, default='full'
56
57
Defines the style of atoms to be saved in a LAMMPS data file. The
57
58
following atom styles are currently supported:
58
59
'full', 'atomic', 'charge', 'molecular'
59
60
see http://lammps.sandia.gov/doc/atom_style.html for more information
60
61
on atom styles.
61
- unit_style: str
62
- Defines to unit style to be save in a LAMMPS data file. Defaults to
63
- 'real' units. Current styles are supported: 'real', 'lj'
64
- see https://lammps.sandia.gov/doc/99/units.html for more information
65
- on unit styles
66
- mins : list
67
- minimum box dimension in x, y, z directions, nm
68
- maxs : list
69
- maximum box dimension in x, y, z directions, nm
70
- pair_coeff_label : str
62
+ unit_style : str, optional, default='real'
63
+ Defines to unit style to be save in a LAMMPS data file. Current styles
64
+ are supported: 'real', 'lj', see lammps unit style documentation:
65
+ https://lammps.sandia.gov/doc/99/units.html for more information.
66
+ mins : list, optional, default=None
67
+ Minimum box dimension in x, y, z directions, nm
68
+ maxs : list, optional, default=None
69
+ Maximum box dimension in x, y, z directions, nm
70
+ pair_coeff_label : str, optional, default=None
71
71
Provide a custom label to the pair_coeffs section in the lammps data
72
- file. Defaults to None, which means a suitable default will be chosen.
73
- detect_forcefield_style: boolean
72
+ file. A value of None means a suitable default will be chosen.
73
+ detect_forcefield_style : bool, optional, default=True
74
74
If True, format lammpsdata parameters based on the contents of
75
75
the parmed Structure
76
- use_urey_bradleys: boolean
76
+ use_urey_bradleys : bool, optional, default=False
77
77
If True, will treat angles as CHARMM-style angles with urey bradley
78
78
terms while looking for `structure.urey_bradleys`
79
- use_rb_torsions:
79
+ use_rb_torsions : bool, optional, default=True
80
80
If True, will treat dihedrals OPLS-style torsions while looking for
81
81
`structure.rb_torsions`
82
- use_dihedrals:
82
+ use_dihedrals : bool, optional, default=False
83
83
If True, will treat dihedrals as CHARMM-style dihedrals while looking
84
84
for `structure.dihedrals`
85
- zero_dihedral_weighting_factor:
85
+ zero_dihedral_weighting_factor : bool, optional, default=False
86
86
If True, will set weighting parameter to zero in CHARMM-style dihedrals.
87
87
This should be True if the CHARMM dihedral style is used in non-CHARMM forcefields.
88
- sigma_conversion_factor: None, float
88
+ sigma_conversion_factor : float, optional, default=None
89
89
If unit_style is set to 'lj', then sigma conversion factor is used to non-dimensionalize.
90
- Assume to be in units of nm. Default is None. If None, will take the largest sigma value in
90
+ Assume to be in units of nm. If None, will take the largest sigma value in
91
91
the structure.atoms.sigma values.
92
- epsilon_conversion_factor: None, float
92
+ epsilon_conversion_factor : float, optional, default=None
93
93
If unit_style is set to 'lj', then epsilon conversion factor is used to non-dimensionalize.
94
- Assume to be in units of kCal/mol. Default is None. If None, will take the largest epsilon value in
94
+ Assume to be in units of kCal/mol. If None, will take the largest epsilon value in
95
95
the structure.atoms.epsilon values.
96
- mass_conversion_factor: None, float
96
+ mass_conversion_factor : float, optional, default=None
97
97
If unit_style is set to 'lj', then mass conversion factor is used to non-dimensionalize.
98
- Assume to be in units of amu. Default is None. If None, will take the largest mass value in
98
+ Assume to be in units of amu. If None, will take the largest mass value in
99
99
the structure.atoms.mass values.
100
+ charge_conversion_factor : bool, optional, default=True
101
+ If unit_style is set to 'lj', then charge conversion factor may or may not be used to
102
+ non-dimensionalize. Assume to be in elementary charge units. If ``True``, the charges
103
+ are scaled by ``np.sqrt(4*np.pi()*eps_0*sigma_conversion_factor*epsilon_conversion_factor)``.
104
+ If ``False``, the charges are not scaled and the user must be wary to choose the dielectric
105
+ constant properly, which may be more convenient to implement an implicit solvent.
100
106
moleculeID_offset : int , optional, default=1
101
107
Since LAMMPS treats the MoleculeID as an additional set of information
102
108
to identify what molecule an atom belongs to, this currently
@@ -287,16 +293,17 @@ def write_lammpsdata(
287
293
)
288
294
# Convert coordinates and charges to LJ units
289
295
xyz = xyz / sigma_conversion_factor
290
- charges = (charges * ELEM_TO_COUL ) / np .sqrt (
291
- 4
292
- * np .pi
293
- * sigma_conversion_factor
294
- * NM_TO_ANG ** - 1
295
- * epsilon_conversion_factor
296
- * KCAL_TO_KJ
297
- * epsilon_0
298
- * 10 ** - 6
299
- )
296
+ if charge_conversion_factor :
297
+ charges = (charges * ELEM_TO_COUL ) / np .sqrt (
298
+ 4
299
+ * np .pi
300
+ * sigma_conversion_factor
301
+ * NM_TO_ANG ** - 1
302
+ * epsilon_conversion_factor
303
+ * KCAL_TO_KJ
304
+ * epsilon_0
305
+ * 10 ** - 6
306
+ )
300
307
charges [np .isinf (charges )] = 0
301
308
else :
302
309
sigma_conversion_factor = 1
0 commit comments