• Multiwfn forum

    Multiwfn official website: http://www.shanxitv.org/multiwfn. Multiwfn forum in Chinese: http://bbs.keinsci.com/wfn

    You are not logged in.

    #1 2025-05-20 10:47:17

    andrzejek
    Member
    Registered: 2024-12-09
    Posts: 28

    Batching multiple cube generation for several compound

    Hello
    In my current directory [.] are folders named after *.mwfn generated with NTO for different excitations (S1, T1, T2...). So it is like

    ./compound1-S1/compound1-S1.mwfn
    ./compound1-T1/compound1-T1.mwfn
    ./compound2-S1/compound2-S1.mwfn
    ./compound2-T1/compound2-T1.mwfn
    ./compound2-T2/compound2-T2.mwfn

    I need to generate CUBES for occupied and virtual orbitals for each .mwfn file. The commands sequence is:

    200
    3
    h
    2
    3
    l
    2
    0

    Can you share batch code to do that? I dont know programming and doing it manually is cumbersome sad
    Thanks

    Offline

    #2 2025-05-20 16:24:10

    sobereva
    Tian Lu (Multiwfn developer)
    From: Beijing
    Registered: 2017-09-11
    Posts: 2,011
    Website

    Re: Batching multiple cube generation for several compound

    Please check Section 5.3 of Multiwfn manual, where I described how to use Multiwfn in batch mode by writting Linux shell script

    Offline

    #3 2025-05-20 20:14:33

    andrzejek
    Member
    Registered: 2024-12-09
    Posts: 28

    Re: Batching multiple cube generation for several compound

    But this results in multiple Multiwfn instances being run one by one, instead of reloading.

    Offline

    #4 2025-05-21 02:55:52

    sobereva
    Tian Lu (Multiwfn developer)
    From: Beijing
    Registered: 2017-09-11
    Posts: 2,011
    Website

    Re: Batching multiple cube generation for several compound

    It doesn't matter, no extra computational cost.

    Offline

    #5 2025-05-22 07:43:54

    andrzejek
    Member
    Registered: 2024-12-09
    Posts: 28

    Re: Batching multiple cube generation for several compound

    Unfortunately,  it does for me— My computer freezes and I am not able to do anything. I need to reset it

    Offline

    #6 2025-05-23 14:22:34

    andrzejek
    Member
    Registered: 2024-12-09
    Posts: 28

    Re: Batching multiple cube generation for several compound

    this could be overcome i files generate by multiwfn differ, e.g. by prefix, instead of being constiently l or h, this cause overwriting when i iterate

    E.g. this code doesnt work:

    #!/bin/bash
    
    # Save the current directory
    start_dir=$(pwd)
    
    # Find .mwfn files and process each
    find . -type f -name "*.mwfn" | sort | while read -r fullpath; do
        # Extract directory and filename
        dir=$(dirname "$fullpath")
        file=$(basename "$fullpath")
    
        echo "Processing $file in $dir"
    
        # Change to the file's directory
        cd "$dir" || continue
    
        # Run Multiwfn with input commands
        /Users/apm/Applications/Wineskin/Multiwfn.app/Contents/MacOS/wineskinlauncher << EOF
    $file
    200
    3
    h
    2
    3
    l
    2
    0
    r
    EOF
    
        # Wait 15 seconds before processing the next file
        sleep 60
    
        # Return to the original directory
        cd "$start_dir" || exit
    done

    Last edited by andrzejek (2025-05-23 14:34:22)

    Offline

    Board footer

    Powered by FluxBB

    久久精品国产99久久香蕉