Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new sigma profile #20

Open
Neverland-ss opened this issue Mar 26, 2022 · 19 comments
Open

Adding new sigma profile #20

Neverland-ss opened this issue Mar 26, 2022 · 19 comments

Comments

@Neverland-ss
Copy link

Hi professor, thank you so much for sharing this amazing work. I am new to cmake. I want to add the sigma profile I calculate to cCOSMO and then use it for later calculation, but when I directly adding it to vt-2005 database, it will say wrong. So, I was wondering if I want to add new database, is that means I need to rewrite a code to make new cCOSMO module?

@ianhbell
Copy link
Collaborator

The sigma profiles should not be put in with the existing profiles, you should put them in another folder and change the paths accordingly. You should not need to recompile cCOSMO either.

@Neverland-ss
Copy link
Author

Thank you for your reply! I have tried to put them in another folder and change the paths accordingly. I tried to add my database into profiles fold and change path to mine and run the testit.py in terminal. Like: dbVT = cCOSMO.VirginiaTechProfileDatabase(
here+"/profiles/VT2005/MineDatabase/Sigma_Profile_Database.txt",
here+"/profiles/VT2005/MineDatabase/Sigma_Profiles_v1/")

It says : dbVT = cCOSMO.VirginiaTechProfileDatabase(
ValueError: Need at least 6 entries in line

Then, I tried to change cCOSMO.VirginiaTechProfileDatabase to cCOSMO.MineDatabase. Like: dbVT = cCOSMO.MineDatabase(here+"/profiles/MineDatabase/Sigma_Profile_Database.txt",
here+"/profiles/MineDatabase/Sigma_Profiles_v1/")
it says: AttributeError: module 'cCOSMO' has no attribute 'MineDatabase'.

I don't know why that would happen. Could you please help me with this problem. THANK YOU SO MUCH!

@ianhbell
Copy link
Collaborator

In pseudocode, you need something like this:

import cCOSMO
db = cCOSMO.VirginiaTechProfileDatabase(
"myVT2005/Sigma_Profile_Database.txt",
"myVT2005/Sigma_Profiles/")

where you make the Sigma_Profile_Database.txt in the same format as the original, and put your profile in the folder Sigma_Profiles

@Neverland-ss
Copy link
Author

Neverland-ss commented Mar 28, 2022

Thank you so much for your kindness reply!
I do change the code like this:
import cCOSMO here = os.path.abspath(os.path.dirname(__file__)) dbVT = cCOSMO.VirginiaTechProfileDatabase( here+ "/profiles/VT2005/Sigma_Profile_Database_Index_v1.txt", here+ "/profiles/VT2005/Sigma_Profiles_v1/")
And for the folder, I add it to VT2005 and make a new txt in the same format as the original.
截屏2022-03-28 上午10 08 01

Unfortunately, it still give me this hit:
in
dbVT = cCOSMO.VirginiaTechProfileDatabase(
ValueError: Need at least 6 entries in line.
Also, create a new folder as VT2005 would have the same problem.

@ianhbell
Copy link
Collaborator

What are the contents of your Sigma_Profile_Database_Index_v1.txt and your sigma profile?

@Neverland-ss
Copy link
Author

For Sigma_Profile_Database_Index_v1, because I want to calculate some not existing chemical compounds, so some information like cas, cosmo segments ...were just made up.
截屏2022-03-28 下午8 42 36
For sigma profile, I use the fortran program provided by VT group.
截屏2022-03-28 下午8 43 23

@ianhbell
Copy link
Collaborator

The metadata file needs to be in the same exact format as the original. Are you missing the last column?

@Neverland-ss
Copy link
Author

截屏2022-03-28 下午9 04 33

Actually, I think they are the same. I copy it directly from the original one.

@ianhbell
Copy link
Collaborator

Can you please attach your file? I think the delimiters might be wrong

@ianhbell
Copy link
Collaborator

And please attach one of your sigma profiles, I want to test on my side.

@Neverland-ss
Copy link
Author

Neverland-ss commented Mar 28, 2022

@ianhbell
Copy link
Collaborator

First problem: your metadata file doesn't use tabs for the delimiter, you have to use the same format
Second problem: your sigma profile file uses tabs, not spaces

@Neverland-ss
Copy link
Author

I see! I will try again. Thank you sooooo much!

@ianhbell
Copy link
Collaborator

Also, you need a single delimiter in all cases

@ianhbell
Copy link
Collaborator

Once you get that sorted, you want something like:

import cCOSMO
names = ['C1H1']
db = cCOSMO.VirginiaTechProfileDatabase(
    "profiles/VT2005test/Sigma_Profile_Database_Index_v1.txt",
    "profiles/VT2005test/")

# Add the fluids we want into the database
for name in names:
    iden = db.normalize_identifier(name)
    print(iden)
    db.add_profile(iden)
COSMO = cCOSMO.COSMO1(names, db)
T = 300
composition = [0.5, 0.5]

print(COSMO.get_lngamma_comb(T, composition) + COSMO.get_lngamma_resid(T, composition))

@Neverland-ss
Copy link
Author

This works!!! Thank you a lot!

@Neverland-ss
Copy link
Author

Hello, Professor. I got another problem, would you please give me some help?

I want to add some new sigma profiles, and I got stuck at the file format:

  1. the sigma profile txt has two colums, I check your example and I find they have to be 22 sels, is it correct?
  2. each colums seems to be right-justified, is it correct?
  3. there are two sels between the two columns, is it correct?

Waiting for your reply. Sorry for asking for help again.

@ianhbell
Copy link
Collaborator

  1. Yes, but it doesn't matter, so long as C++ will convert to to double
  2. Yes, but it doesn't matter
  3. Are you sure? For instance this only has one: https://github.com/usnistgov/COSMOSAC/blob/master/profiles/UD/sigma3/AATNZNJRDOVKDD-UHFFFAOYSA-N.sigma

@Neverland-ss
Copy link
Author

I figured it out. Thank you so much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants