Skip to content

Commit

Permalink
prep for v0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Sep 16, 2021
1 parent edd4b25 commit f6fc2f0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/Others.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ There are 4 options for defining molecules within the molecular_crystal class. Y

::

$ conda install -c conda-forge rdkit==2020.09.5
$ conda install -c conda-forge rdkit==2020.03.5

Note that the current code is designed for version no later than ``2020.09.5``.
Note that the current code is designed for version no later than ``2021.03.5``.

Below is an example to generate a random molecular crystal from smile string.

Expand Down
12 changes: 8 additions & 4 deletions pyxtal/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ def rdkit_mol_init(self, smile, fix, torsions):
ps = AllChem.ETKDGv3()
ps.randomSeed=self.seed
AllChem.EmbedMultipleConfs(mol, 1, ps)
if mol.GetNumConformers() == 0:
AllChem.EmbedMultipleConfs(mol, 3, ps)

res = AllChem.MMFFOptimizeMoleculeConfs(mol)
engs = [c[1] for c in res]
cid = engs.index(min(engs))
Expand Down Expand Up @@ -761,7 +764,7 @@ def apply_inversion(self):
xyz *= -1
self.reset_positions(xyz)

def get_symmetry(self, symmetrize=False):
def get_symmetry(self, symmetrize=False, rtol=0.30):
"""
Set the molecule's point symmetry.
- pga: pymatgen.symmetry.analyzer.PointGroupAnalyzer object
Expand All @@ -777,12 +780,12 @@ def get_symmetry(self, symmetrize=False):
mol._spin_multiplicity = None #don't check spin

if symmetrize:
pga = PointGroupAnalyzer(mol)
pga = PointGroupAnalyzer(mol, rtol, eigen_tolerance=1e-3)
mol = pga.symmetrize_molecule()["sym_mol"]

pga = PointGroupAnalyzer(mol)#0.3)
pga = PointGroupAnalyzer(mol, rtol, eigen_tolerance=1e-3)
self.mol_no_h = mol

#print(mol.to(fmt='xyz'), pga.sch_symbol)
# For single atoms, we cannot represent the point group using a list of operations
if len(mol) == 1:
symm_m = []
Expand Down Expand Up @@ -822,6 +825,7 @@ def get_symmetry(self, symmetrize=False):
break
self.symops = symm_m
self.pga = pga
if symbol == 'S2': symbol = 'Ci'
self.pg = Group(symbol, dim=0)

def get_orientations_in_wps(self, wps=None, rtol=1e-2):
Expand Down
20 changes: 20 additions & 0 deletions pyxtal/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,26 @@ def parse_cif(filename, header=False, spg=False, eng=False, csd=False, sim=False
else:
return strings

def process_csd_cif(cif, remove_H=False):
"""
process cif from CSD, sometimes it contains multiple
"""
lines = cif.split('\n')
tmp = []
for l in lines:
if len(re.findall(r"[0-9][A-Z]", l))>0 or len(re.findall(r"[A-Z]\?", l))>0 or \
len(re.findall(r"[0-9]\?", l))>0 or \
len(re.findall(r"[A-Z][0-9]\' [0-9]", l))>0:
#len(re.findall(r"[0-9]_[0-9]", l))>0 or \
#print(l) #; import sys; sys.exit()
continue
else:
if remove_H and len(re.findall(r" H ", l))>0:
continue
else:
tmp.append(l+'\n')
return listToString(tmp)

def get_similar_cids_from_pubchem(base, MaxRecords):

"""
Expand Down

0 comments on commit f6fc2f0

Please sign in to comment.