pnnl / isicle

In silico chemical library engine for high-accuracy chemical property prediction
BSD 3-Clause "New" or "Revised" License
57 stars 19 forks source link

not ccs calculations #30

Open samuelcajahuaringa opened 2 months ago

samuelcajahuaringa commented 2 months ago

Hello isicle developers,

I try to calculate the CCS but I have the following errors:

dft2 = isicle.qm.dft(conformer2, tasks=['optimize', 'energy'], functional='B3LYP', basis_set='3-21g*', ao_basis='cartesian', charge=1.0, gas=True, max_iter=100, mem_global=1600, mem_heap=600, mem_stack=1000, scratch_dir='/tmp', processes=1) After run quantum calculations is create a object dft2

dft2 {'protocol': {'functional': ['B3LYP'], 'basis set': ['3-21g*'], 'solvation': [None], 'tasks': ['optimize']}, 'geom': <isicle.geometry.XYZGeometry object at 0x7f040364ff70>, 'energy': -361.429491724169, 'charge': array([-0.15, -0.04, -0.14, -0.12, 0.22, -0.21, -0.21, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.15, 0.15, 0.3 , 0.24]), 'timing': {'single point': 528.2, 'geometry optimization': 0, 'frequency': 125.5, 'total': 653.7}, 'connectivity': [['N', 'C', 2, 1], ['C', 'N', 3, 2], ['C', 'N', 4, 2], ['C', 'C', 5, 4], ['O', 'C', 6, 5], ['O', 'C', 7, 5], ['H', 'C', 8, 1], ['H', 'C', 9, 1], ['H', 'C', 10, 1], ['H', 'C', 11, 3], ['H', 'C', 12, 3], ['H', 'C', 13, 3], ['H', 'C', 14, 4], ['H', 'C', 15, 4], ['H', 'O', 16, 7], ['H', 'N', 17, 2]]}

when I try to calculate the CCS using the tutorial example:

ccs = isicle.mobility.calculate_ccs(dft2.geom, lennard_jones='default', i2=5013489, buffer_gas='nitrogen', buffer_gas_mass=28.014, temp=300, ipr=1000, itn=10, inp=48, imp=1024, processes=1, command='mobcal') Traceback (most recent call last): File "", line 1, in AttributeError: 'dict' object has no attribute 'geom'

I inspect the dft2 dictionary and according to the dictionary dft2['geom'] is equivalent to dft2.geom?

dft2['geom'] <isicle.geometry.XYZGeometry object at 0x7f040364ff70>

dft2['geom'].xyz ['17', 'geometry', 'C -2.12897949 0.76931225 0.98753979', 'N -1.07084857 0.01300318 0.19433796', 'C -1.61095132 -0.47821390 -1.15012574', 'C 0.22848578 0.79395302 0.01908041', 'C 1.33468781 -0.23960220 0.23606989', 'O 1.07843920 -1.37210978 0.64706543', 'O 2.53784464 0.27317512 -0.05193141', 'H -2.40946170 1.66229075 0.42760324', 'H -1.71274218 1.03839493 1.95943764', 'H -2.99288213 0.11561345 1.11529263', 'H -2.49085973 -1.09469274 -0.96204326', 'H -1.87301457 0.39028671 -1.75505865', 'H -0.83196906 -1.07230475 -1.63013093', 'H 0.27988037 1.23785849 -0.97519027', 'H 0.29302866 1.57478659 0.78089334', 'H 3.28037319 -0.37407260 0.11580090', 'H -0.75017636 -0.84213062 0.71620622'] dft2['charge'] array([-0.15, -0.04, -0.14, -0.12, 0.22, -0.21, -0.21, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.15, 0.15, 0.3 , 0.24])

after that, I try run again the CCS

ccs = isicle.mobility.calculate_ccs(dft2['geom'], lennard_jones='default', i2=5013489, buffer_gas='nitrogen', buffer_gas_mass=28.014, temp=300, ipr=1000, itn=10, inp=48, imp=1024, processes=1, command='mobcal') Traceback (most recent call last): File "", line 1, in File "/home/oscar.macollunco/isicle/isicle/mobility.py", line 13, in calculate_ccs return MobcalWrapper().run(geom, **kwargs) File "/home/oscar.macollunco/isicle/isicle/mobility.py", line 151, in run self.set_geometry(geom) File "/home/oscar.macollunco/isicle/isicle/mobility.py", line 44, in set_geometry self.save_geometry() File "/home/oscar.macollunco/isicle/isicle/mobility.py", line 67, in save_geometry isicle.io.save(self.infile, self.geom) File "/home/oscar.macollunco/isicle/isicle/io.py", line 717, in save return save_mfj(path, data) File "/home/oscar.macollunco/isicle/isicle/io.py", line 571, in save_mfj raise KeyError("DFT energy calculation required. " "See isicle.qm.dft.") KeyError: 'DFT energy calculation required. See isicle.qm.dft.'

how can I correct this problem, there are how convert the dictionary dft2 to a object?

Any suggestions thanks Samuel

smcolby commented 2 months ago

Hi Samuel,

A change was pushed that inadvertently broke attribute propagation from a QM result (e.g. NWChem) to its geometry instance. In other words, after calling isicle.qm.dft, the resulting geometry should have attributes for energy, charge, etc., as requested in the configuration step.

This is currently running through continuous integration as a pull request (#31). Alternatively, you can checkout an earlier branch (before we began adding ORCA functionality) to revert to previous, pre-bug behavior (i.e. commit a69208e7c89359d5649914882992eab82e3ea6ec).

Note that we are working on refactoring how some of this functions, to decouple simulations from parsing. Reason being that a simulation may run successfully to completion, but any issues with the parser could cause a workflow management system (e.g. Snakemake, NextFlow) to purge simulation outputs. With these steps separated, the simulation can run to completion independent of the parsing operation. Stay tuned!

Best,

Sean