Skip to content

Commit

Permalink
update the function of get_forcefield
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Feb 11, 2024
1 parent 82e7d0e commit 13fa498
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ or make a copy of the source code, and then install it manually.

$ git clone https://github.com/qzhu2017/pyxtal
$ cd pyxtal
$ python setup.py install
$ pip install .


or update the code to our developing version
Expand Down
7 changes: 6 additions & 1 deletion pyxtal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3002,7 +3002,7 @@ def to_atomic_xtal(self):


def get_forcefield(self, ff_style='openff', code='lammps',
chargemethod='am1bcc'):
chargemethod='am1bcc', parameters=None):
"""
An interface to create forcefield for molecular simulation with
- Charmm
Expand All @@ -3014,6 +3014,7 @@ def get_forcefield(self, ff_style='openff', code='lammps',
- ff_style: 'gaff' or 'openff'
- code: 'lammps' or 'charmm'
- charge_method: 'am1bcc', 'am1-mulliken', 'mmff94', 'gasteiger'
- parameters: 1D-array of user-specified FF parameters
Returns:
An ase_atoms_objects with force field information
Expand Down Expand Up @@ -3055,6 +3056,10 @@ def get_forcefield(self, ff_style='openff', code='lammps',
# Initialize the forcefield instance from ost
ff = forcefield(smiles, style=ff_style, chargemethod=chargemethod)

# update the parameters from the user
if parameters is not None:
ff.update_parameters(parameters)

# Create the Parmed to handle FF parameters
if sum(n_mols) == 1:
pd_struc = ff.molecules[0].copy(cls=ParmEdStructure)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ networkx>=2.3
scipy>=1.7.3
importlib_metadata>=1.4
ase>=3.18.0
monty==2023.11.3
2 changes: 1 addition & 1 deletion scripts/pyxtal_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
rand_crystal.from_random(3, sg, system, numIons0, factor, conventional=conventional)
elif dimension == 2:
rand_crystal.from_random(2, sg, system, numIons0, factor, thickness, conventional=conventional)
elif dimension == 1:
elif dimension == 1:
rand_crystal.from_random(1, sg, system, numIons0, factor, thickness, conventional=conventional)
if dimension == 0:
rand_crystal.from_random(0, sg, system, numIons0, factor)
Expand Down

0 comments on commit 13fa498

Please sign in to comment.