RagnarB83 / ash

ASH is a Python-based computational chemistry and QM/MM environment, primarily for molecular calculations in the gas phase, explicit solution, crystal or protein environment.
GNU General Public License v2.0
63 stars 13 forks source link

add angle and dihedral restraints in openMM interface and fix UnicodeDecodeError in orca interface #425

Closed YingrongChen closed 2 months ago

YingrongChen commented 2 months ago
  1. add add_angleconstraints and add_dihedralconstraints in openMM interface, with restraints force constant angleforceconstant and dihedralforceconstant. Roughly combined the logic with existing clean_up_constraints_list function to measure current angle and dihedral as the reference for restraints.

  2. Fix UnicodeDecodeError when running OpenMM_MD with qmmm theory using orca as the qmtheory

    
    File ~/.conda/envs/ash/lib/python3.10/site-packages/ash/interfaces/interface_ORCA.py:793, in run_orca_SP_ORCApar(orcadir, inpfile, numcores, check_for_warnings, check_for_errors, bind_to_core_option, ignore_ORCA_error)
    792 if check_for_errors:
    --> 793     grab_ORCA_errors(basename+'.out')
    794 if check_for_warnings:

File ~/.conda/envs/ash/lib/python3.10/site-packages/ash/interfaces/interface_ORCA.py:844, in grab_ORCA_errors(filename) 843 for errstring in error_strings: --> 844 error_l = pygrep2(errstring, filename) 845 for e in error_l:

File ~/.conda/envs/ash/lib/python3.10/site-packages/ash/functions/functions_general.py:261, in pygrep2(string, file, print_output) 260 with open(file) as f: --> 261 for line in f: 262 if string in line:

File ~/.conda/envs/ash/lib/python3.10/encodings/ascii.py:26, in IncrementalDecoder.decode(self, input, final) 25 def decode(self, input, final=False): ---> 26 return codecs.ascii_decode(input, self.errors)[0]

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4231: ordinal not in range(128)

RagnarB83 commented 2 months ago

Thank you for contributing. I'm looking things over, looks like we have some conflicts that I will take care of. The changes to deal with UnicodeDecoderror are all good.

Why did you add: md.simulation.minimizeEnergy() to the OpenMM_box_equilibration function? If one wants to minimize before running NPT MD simulations it is better to just call OpenMM_Opt function first.

YingrongChen commented 2 months ago

Hi Dr.Bjornsson,

I apologize for not removing minimizeEnergy() earlier. I added it accidentally because my simulation kept blowing up.

Additionally, I noticed that there are more with open('') calls in interface_orca.py that could cause UnicodeDecodeError. It might be worth reviewing them.

I wanted to ask: is the gpu4pyscf interface ready for QM/MM broken-symmetry DFT? I keep encountering this error: AttributeError: module 'ash.interfaces.interface_pyXscf_mods' has no attribute 'QMMMUKS'

Thank you so much for your help! I’m currently using Ash for Ni-Fe hydrogenase simulations and have found it to be an excellent tool! I am also developing an interface for my own GPU-DFT software.

On Thu, Sep 19, 2024 at 6:04 AM RagnarB83 @.***> wrote:

Thank you for contributing. I'm looking things over, looks like we have some conflicts that I will take care of. The changes to deal with UnicodeDecoderror are all good.

Why did you add: md.simulation.minimizeEnergy() to the OpenMM_box_equilibration function? If one wants to minimize before running NPT MD simulations it is better to just call OpenMM_Opt function first.

— Reply to this email directly, view it on GitHub https://github.com/RagnarB83/ash/pull/425#issuecomment-2360931790, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATDIQ53RYWB7XHZMK563EALZXLDVJAVCNFSM6AAAAABOOFQZFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRQHEZTCNZZGA . You are receiving this because you authored the thread.Message ID: @.***>

RagnarB83 commented 2 months ago

Gotcha. Great to hear, glad you're finding ASH useful. Any contributions and suggestions are welcome.

The gpu4pyscf library is currently not compatible with pointcharge embedding within pyscf. I was trying to figure out how to get around it within ASH (hence the functions in ash.interfaces.interface_pyXscf_mods) but I was not successful yet and have not had time to revisit. You could try to figure out where I got stuck.

Great to hear you are developing an interface for another GPU-DFT code, more GPU-code interfaces in ASH would be a good thing.