Re: [AMBER] Antechamber Charge Methods

From: Melania T <melaniacompchem.gmail.com>
Date: Mon, 1 Jul 2019 19:56:53 -0400

Hi,

I like using python for automating this sort of thing.

Here is a function that will replace the charges in a mol2 file with your
desired charges.

You just need to supply a filename and an array with the charges you want
to put in the mol2 file. It is of course desirable to have a different
function which will extract the charges from a jaguar file... Python also
easily does this, however I cannot supply such a script since I do not know
what a jaguar file is.

If you have more questions about the python aspects feel free to message me
directly, I can give some direction for a simple python script that will
read your jaguar file, get the charges, and then use the below code to
update the mol2 file.

# import os

def updateMol2Charges(filename,newCharges):
    # it is not recommended to use this function if you do not like Monty
Python.
    file = open(filename,'r')
    fileout = open("tempMol2.txt",'w')
    for line in file:
        fileout.write(line)
        if ".<TRIPOS>ATOM" in line:
            break
    for i, line in enumerate(file):
        if ".<TRIPOS>BOND" in line:
            fileout.write(line)
            break
        newline = line[0:72] + str(newCharges[i])
        fileout.write(newline + '\n')
    for line in file:
        fileout.write(line)

    file.close()
    fileout.close()
    """ Now remove original mol2, and rename temp to that name"""
    os.remove(filename)
    os.rename("tempMol2.txt",filename)

Braden

On Mon, Jul 1, 2019 at 5:08 PM Sofia Vasilakaki <svasilak.chem.uoa.gr>
wrote:

> If -c rc not used, then mol2 file returns with no charges.
>
> -cf : not sure how it works.
>
> I am using a text editor to edit mol2 but it would be rather convenient if
> I could do it in the command line. I have more than 10 molecules to
> prepare.
>
> Thank you,
> Sofia
>
> > On Mon, Jul 01, 2019, Sofia Vasilakaki wrote:
> >>
> >>I would like to use the charges included in the Jaguar Output (for a
> >> small
> >>organic molecule) in Antechamber to generated the mol2 file. How I could
> >>do this?
> >>
> >>I have tried
> >>antechamber -i jag_name.out -fi jout -o name.mol2 -fo mol2 -c rc
> >>
> >>but it generates an error: Cannot open file () with mode (r)
> >
> > What happens if you leave out the "-c rc" part? You could also play
> > around with the "-cf" flag, but then I don't understand how the code
> > knows that the charge file is a Jaguar output file.
> >
> > cc-ing to Junmei Wang, who is the author.
> >
> > The "simple" thing is to just use a text editor to edit the mol2 file
> > and enter the charges by hand from the jaguar output.
> >
> > ...good luck...dac
> >
> >
> > _______________________________________________
> > AMBER mailing list
> > AMBER.ambermd.org
> > http://lists.ambermd.org/mailman/listinfo/amber
> >
>
>
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Jul 01 2019 - 17:00:02 PDT
Custom Search