Skip to content

Commit fcb48b8

Browse files
authored
Update Others.rst
1 parent 5759ac8 commit fcb48b8

1 file changed

Lines changed: 40 additions & 3 deletions

File tree

doc/Others.rst

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,48 @@ There are 4 options for defining molecules within the molecular_crystal class. Y
1010

1111
2) a `pymatgen.core.structure.Molecule <http://pymatgen.org/pymatgen.core.structure.html?highlight=class%20molecule#pymatgen.core.structure.Molecule>`_ object.
1212

13-
3) the path to a molecule file (as a string). This will generate a pymatgen Molecule object using the `from_file <http://pymatgen.org/pymatgen.core.structure.html#pymatgen.core.structure.IMolecule.from_file>`_ method. Supported formats include ``.xyz``, ``.gjf``, ``.g03``, ``.g09``, ``.com``, ``.inp``, ``.out``, and pymatgen's ``JSON`` serialized molecules.
13+
3) the path to a molecule file (as a string). This will generate a pymatgen Molecule object using the `from_file <http://pymatgen.org/pymatgen.core.structure.html#pymatgen.core.structure.IMolecule.from_file>`_ method. Supported formats include ``.xyz``.
1414

15-
4) a string representing the molecule. This will generate a pymatgen Molecule object using the `from_str <http://pymatgen.org/pymatgen.core.structure.html#pymatgen.core.structure.IMolecule.from_str>`_ method. For this option, you must specify the string format (fmt) within the call to molecular_crystal. fmt must be one of: ``xyz``, ``gjf``, ``g03``, or ``json``.
15+
4) a smile string representing the molecule. For example, 'C1=CC=CC=C1.smi' means a benzene molecule. Note that the `.smi` suffix must be included to indicate that this is a smile string.
16+
17+
**RDKit must be installed to use this function.** One can install RDKit by simply typing
18+
19+
::
20+
21+
$ conda install -c rdkit rdkit
22+
23+
Below is an example to generate a random molecular crystal from smile string.
24+
25+
.. code-block:: Python
26+
27+
from pyxtal import pyxtal
28+
c1 = pyxtal(molecular=True)
29+
c1.from_random(3, 14, ['CC(=O)NC1=CC=CC=C1C(=O)N.smi'], [4])
30+
print(c1)
31+
32+
33+
One advantage of using the smile string is that one can also specify the desired torsions
34+
35+
.. code-block:: Python
36+
37+
from pyxtal import pyxtal
38+
39+
c1 = pyxtal(molecular=True)
40+
c1.from_random(3, 14, ['CC(=O)NC1=CC=CC=C1C(=O)N.smi'], [4], torsions=[[-60.2, 1.7, 126.5]])
41+
print(c1)
42+
print("Torsions", c1.mol_sites[0].encode()[-4:-1])
43+
44+
::
45+
46+
------Crystal from random------
47+
Dimension: 3
48+
Composition: [CC(=O)NC1=CC=CC=C1C(=O)N]4
49+
Group: P21/c (14)
50+
monoclinic lattice: 19.2246 13.2842 10.1448 90.0000 113.3669 90.0000
51+
Wyckoff sites:
52+
H10C9N2O2 @ [ 0.2497 0.4534 0.9597] WP: 4e, Site symmetry 1 ==> Euler: -66.31 25.98 -37.99
53+
angles [-60.19971274864328, 1.6999253045986045, 126.50111998425088]
1654

17-
**For options 3 and 4, installing OpenBabel will allow additional file formats, but is not required.**
1855

1956
Because molecules are less symmetric than individual atoms, they may or may not fit within a given Wyckoff position. Furthermore, the molecule may need to be oriented in a certain direction to be compatible with a site. The `molecular_crystal class <pyxtal.molecular_crystal.html#pyxtal.molecular_crystal.molecular_crystal>`_ handles this automatically, and only inserts molecules in positions and orientations for which the molecules are sufficiently symmetric. Currently, PyXtal only works with rigid molecules; this simplifies the calculation of symmetry compatibility.
2057

0 commit comments

Comments
 (0)