{"action":"created","issue":{"url":"https://api.github.com/repos/ramess101/MBAR_ITIC/issues/6","repository_url":"https://api.github.com/repos/ramess101/MBAR_ITIC","labels_url":"https://api.github.com/repos/ramess101/MBAR_ITIC/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/ramess101/MBAR_ITIC/issues/6/comments","events_url":"https://api.github.com/repos/ramess101/MBAR_ITIC/issues/6/events","html_url":"https://github.com/ramess101/MBAR_ITIC/issues/6","id":250426918,"number":6,"title":"Basis Functions","user":{"login":"ramess101","id":23408516,"avatar_url":"https://avatars3.githubusercontent.com/u/23408516?v=4","gravatar_id":"","url":"https://api.github.com/users/ramess101","html_url":"https://github.com/ramess101","followers_url":"https://api.github.com/users/ramess101/followers","following_url":"https://api.github.com/users/ramess101/following{/other_user}","gists_url":"https://api.github.com/users/ramess101/gists{/gist_id}","starred_url":"https://api.github.com/users/ramess101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramess101/subscriptions","organizations_url":"https://api.github.com/users/ramess101/orgs","repos_url":"https://api.github.com/users/ramess101/repos","events_url":"https://api.github.com/users/ramess101/events{/privacy}","received_events_url":"https://api.github.com/users/ramess101/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-08-15T20:23:15Z","updated_at":"2017-09-13T17:56:54Z","closed_at":null,"author_association":"OWNER","body":"@mrshirts I am working on including the ability to use Basis Functions with the Mie potential. Could you look over the python code \"basis_functions_Mie\"? I believe I have this working for the internal energy but pressure is not as straightforward to me. \r\n\r\nExpected outcomes:\r\nPredicted internal energy: -5264.72725683\r\nActual internal energy is -5264.71484375\r\nPredicted virial: 100.363121038\r\nActual virial is 104.601626078\r\nPredicted pressure: 294.28551816\r\nActual pressure is 290.05674235\r\n\r\nFor internal energy, the values that I solve for at each time step are sum(r^-lambda) and sum(r^-6). The way I am obtaining these values is by solving the equation Ax=b, where A is a 2x2 matrix of Clam (or C12) and C6, b is the LJ shortrange energies, and x is what we are solving for. This can be found on line 128:\r\n\r\n `rarray = np.linalg.solve(Cmatrix,U_basis) #First entry of rarray is the sum of r^-lambda and second entry is sum of r^-6`\r\n\r\n The rarray can be used to predict U with any value of epsilon and sigma for the same lambda. This is on line 149:\r\n\r\n`U_new_hat = np.linalg.multi_dot([Cmatrix_new,rarray])`\r\n\r\nwhere \r\n\r\n`Clam_new = eps_new * sig_new ** lam_basis #I intentionally ommitted the prefactor (4 for LJ) and just lumped it into the rarray`\r\n`C6_new = eps_new * sig_new ** 6.`\r\n\r\n`Cmatrix_new = np.array([Clam_new,C6_new])`\r\n\r\n This appears to be working in my code. Notice in the output of basis_functions_Mie.py that the predicted internal energy and actual internal energy are essentially the same.\r\n\r\nHowever, for pressure I am not sure exactly how to construct my basis functions. The approach I have taken gets me in the ballpark for P but is not as accurate as it is for U. Notice that the predicted virial and pressure are different than the actual virial and pressure by about 4 bar (1% error in P). \r\n\r\nThe methodology I am using is:\r\n\r\n1. Obtain the virials from XX, YY, and ZZ\r\n\r\n`#Virial XX,YY,ZZ`...\r\n\r\n2. Solve Ax=b where b is now the virials and x should now be something like sum(r*du/dr) for the repulsive (lambda) and attractive (6) contributions, with the Clambda and C6 terms divided out (since those make up the A matrix)\r\n\r\n`rdrXXarray = np.linalg.solve(Cmatrix,VirXX_basis-Pdc_basis)` ...\r\n\r\n3. Use this array (rdrXXarray, rdrYYarray, or rdrZZarray) to predict the respective virial for a different value of epsilon and sigma.\r\n\r\n`VirXX_new_hat = np.linalg.multi_dot([Cmatrix_new,rdrXXarray])+Pdc_new`\r\n\r\n4. Take the average of the vir-XX,YY,ZZ predicted values to obtain the overall virial\r\n\r\n`Vir_new_hat_alt = (VirXX_new_hat + VirYY_new_hat + VirZZ_new_hat)/3.`\r\n\r\n5. Convert this virial into pressure using kinetic energy and box volume\r\n\r\n`P_new_hat_alt = 2./Vbox*(KE/3.-Vir_new_hat_alt)*nm3tom3*kJm3tobar/NA`\r\n\r\nDo you see anything clearly wrong with this methodology? \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ramess101/MBAR_ITIC/issues/comments/329247503","html_url":"https://github.com/ramess101/MBAR_ITIC/issues/6#issuecomment-329247503","issue_url":"https://api.github.com/repos/ramess101/MBAR_ITIC/issues/6","id":329247503,"user":{"login":"mrshirts","id":4274132,"avatar_url":"https://avatars1.githubusercontent.com/u/4274132?v=4","gravatar_id":"","url":"https://api.github.com/users/mrshirts","html_url":"https://github.com/mrshirts","followers_url":"https://api.github.com/users/mrshirts/followers","following_url":"https://api.github.com/users/mrshirts/following{/other_user}","gists_url":"https://api.github.com/users/mrshirts/gists{/gist_id}","starred_url":"https://api.github.com/users/mrshirts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrshirts/subscriptions","organizations_url":"https://api.github.com/users/mrshirts/orgs","repos_url":"https://api.github.com/users/mrshirts/repos","events_url":"https://api.github.com/users/mrshirts/events{/privacy}","received_events_url":"https://api.github.com/users/mrshirts/received_events","type":"User","site_admin":false},"created_at":"2017-09-13T17:56:54Z","updated_at":"2017-09-13T17:56:54Z","author_association":"COLLABORATOR","body":"Quick question: these simulations were with ethane, correct? and if so, are constraints on?  I wonder if the constraint portion of the virial is doing something non-basis functiony. "}}
{"actor":{"display_login":"mrshirts"}}