Skip to content

Commit

Permalink
make pyshtools as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Jan 22, 2024
1 parent c14fbc9 commit 4512cb3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 5 additions & 1 deletion pyxtal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2793,10 +2793,14 @@ def from_CSD(self, csd_code):
from pymatgen.io.cif import CifParser
try:
from ccdc import io
from rdkit import Chem
except:
msg = 'No CSD-python api is available'
raise CSDError(msg)
try:
from rdkit import Chem
except:
msg = 'No rdkit is available'
raise CSDError(msg)

try:
entry = io.EntryReader('CSD').entry(csd_code)
Expand Down
8 changes: 4 additions & 4 deletions pyxtal/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

def make_entry_from_pyxtal(xtal):
"""
make entry from the pyxtal object, assuming that
make entry from the pyxtal object, assuming that
the smiles/ccdc_number info is given
Args:
xtal: pyxtal object
Expand All @@ -19,7 +19,7 @@ def make_entry_from_pyxtal(xtal):
from rdkit.Chem.Descriptors import ExactMolWt
from rdkit.Chem.rdMolDescriptors import CalcMolFormula
from rdkit import Chem

if xtal.valid:
url0 = "https://www.ccdc.cam.ac.uk/structures/Search?Ccdcid="
m = Chem.MolFromSmiles(xtal.tag['smiles'])
Expand Down Expand Up @@ -54,7 +54,7 @@ def make_entry_from_CSD_web(code, number, smiles, name=None):
smiles: the corresponding molecular smiles
name: name of the compound
"""

url0 = "https://www.ccdc.cam.ac.uk/structures/Search?Ccdcid="
#xtal = pyxtal(molecular=True)
#
Expand Down
2 changes: 1 addition & 1 deletion pyxtal/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def rdkit_mol(self, N_confs=1):
"""
from rdkit import Chem

mol = Chem.MolFromMolBlock(self.rdkit_mb, removeHs=False)
mol = Chem.MolFromMolBlock(self.rdkit_mol, removeHs=False)
if N_confs > 1:
conf = mol.GetConformer(0)
for i in range(N_confs-1):
Expand Down
1 change: 0 additions & 1 deletion pyxtal/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ def to_pyxtal(self, smiles=None, composition=None):
dicts['orientation'] = np.array(v[4:7])
dicts['rotor'] = v[7:-1]
dicts['reflect'] = int(v[-1])
print(dicts)
site = mol_site.from_1D_dicts(dicts)
site.type = i
struc.mol_sites.append(site)
Expand Down

0 comments on commit 4512cb3

Please sign in to comment.