Hi there,
I want to obtain the hydrogen bonding density profile, and as far as I know, script in this forum can't solve it now. I find an example(zhou bo et al, structure and dynamics of ethanol adsorbed on a mica surface, 57(2012):308-314.) listed as following:
Because there are different hbonds pattern (N O ), I hope we can identify what it is. I will be grateful for any help.
Best Regards

I want to obtain it from atomic density profile, however, hydrogen bonds in a set can't be indentified, hence, Jason's script based on concentration profile (https://community.accelrys.com/message/16350#16350) can't be used for it.
I attach the reference for better understanding.
Message was edited by: Stephen Todd - Removed paper as this is copyrighted material and should not be posted into the Community.
There seems to be two options here:
1. Re-create the concentration profile script where you are basically creating a histogram of hydrogen bond centres at intervals from the surface.
2. Iterate through the trajectory and create a new, trajectory where the centres of the hydrogen bonds are represented by atoms. You can then use Jason's original script to analyse this. Although a little bit of a hack, this should be easier to write - something like:
Open existing trajectory
Create a new empty trajectory
Create a copy of the trajectory frame in a temp XSD
Iterate over the $doc->UnitCell->HydrogenBonds
Find the hydrogen bond centre
Create an atom at the hydrogen bond centre
Use AppendFramesFrom to add the temp XSD to the new trajectory
Create set containing those atoms you have added (maybe use a bizarre element)
Cheers
Stephen
Hi Stephen,
I think maybe the second is the best choice, however, I have no idea how to do, whether it is convenient for you to give me the script to realize the process, in my opinion, it is very interseting. I think it is hard for me as a newer to perl.
That would be appreciated!
Best Regards
William
Hi there,
I write a script by myself, however, it need complicated post-process, futhermore, i can't obtain the right result.
somebody can do this? I thirst for this result very much.
I apprecite any help.
Best Regards
william
I have no idea wether I can solve it in other program, such as, gromacs used in that literature, however, the format couldn't be identified by gromacs.
Hi Stephen
I tried your second option. I created hydrogen bonds, then I tried to add an atom to the center of each H-bond by using
$doc->CreateAtom("X", ...);<br>But how can I define the center of H-bond as the position to add an atom?
Thank you!
Jingjing Bu
Hi Stephen
Sorry to bother you. I sent you message weeks ago to ask how to add an atom to the center of each H-bond. Could you please help me out here? I tried to use script, but I failed.
Thank you.
Jingjing Bu
Try something like this:
my $doc = $Documents{"acetic_water.xsd"};
my $doc2 = Documents->New("HB.xsd");
$doc2->CopyFrom($doc);
$doc2->UnitCell->Atoms->Delete;
my $HBs = $doc->CalculateHBonds;
foreach my $HB (@$HBs)
{
$doc2->CreateAtom("C", $HB->MidPoint);
}
Modules->Forcite->ChangeSettings([
ConcentrationProfileUserNumberOfBins => "Yes",
ConcentrationProfileNumberOfBins => 10
]);
Modules->Forcite->Analysis->ConcentrationProfile($doc2);
Hi Jason,
Thank you for your script, I tried to use a trajectory document as the input document to generate a HB.xtd document, so that I could adopt your DensityProfile script to calculate density profile with g/cc as y axis, but I failed with an error
HP-MPI licensed for Accelrys.
Concentration profile analysis failed.
The trajectory is marked as invalid and is unusable in Forcite.Analysis (function/property "ConcentrationProfile") at -e line 21.
which is
Modules->Forcite->Analysis->ConcentrationProfile($doc2);
is there a way to calculate the concentration profile of a trajectory?
Thank you.
Jingjing Bu
Hi Jason
I made a little change to your script, I changed structure document to trajectory document for both doc1 and doc2, so that I could adopt your density profile script to calculate the hydrogen number profile, but I got a trajectory doc2 with 0 frame, and an error in the following density profile part. Is there a way to get through this problem? Thank you.
Regards,
Jingjing Bu
Dear all,
Here is a script that calculates the hydrogen bond profiles in each direction of the cell for an entire trajectory. It should have decent performance since it uses the RelativeConcentrationProfile analysis tool as I illustrated in the snippet above. There is one trick I used here, since a trajectory file must have a fixed number of atoms. I first figured out the maximum number of hydrogen bonds and based the HB trajectory on that. Unused HB atoms are placed at the origin and corrected for later.
If you extend the script, please post your changes back here. For instance, it would be nice to be able to specify a certain subset of hydrogen bonds. Also it would be nice to see a screen shot of any interesting profiles you get. Have fun!
Best regards,
/Jason
Sorry for being late back into this discussion - you can also modify the offsetConcentrationProfile script to do roughly the same thing. Of course, it will still require a set of atoms to define the surface but then the MidPoint property of hydrogen bonds can be used to create a profile.
In the getDistancesTwoSets subroutine, it stores the centres for the two sets of atoms. Instead of doing two sets of atoms, you can do a set of atoms and the hydrogen bonds.
To do this, replace:
my @particles2 = ();
foreach my $particle (@{$Doc->AsymmetricUnit->Sets("$Set2Name")->Items}) {
push (@particles2, $particle->$Axis);
}
with
my @particles2 = ();
foreach my $hbond (@{$Doc->AsymmetricUnit->HydrogenBonds}) {
push (@particles2, $hbond->MidPoint->$Axis);
}
You should also comment out the line
eval { $doc->UnitCell->Sets("$bulkSetName");}; if ($@) {die "Set \"$bulkSetName\" does not exist in this document\n";}otherwise you will get an error about the set not being present.
Finally, you need to calculate hbonds on each frame. Add the line:
after the line $doc->Trajectory->CurrentFrame = $frame;
Cheers
Stephen
It needs a lot of time to calculate all hbonds, i'd like to know how to calculate the hbond profile of (001) direction.
Hi william,
The script I posted above only took a few seconds to run, but I only tested it on a small system with 110 atoms and 101 frames. How large is the system you are using? How long is it taking?
It automatically produces profiles in the x, y and z directions. Here is the z direction (001).
Hi william,
I just ran a test on a system with about 3500 atoms. It takes 4 minutes to analyze 10 frames. So it would take about 2 weeks if I extrapolate to 50,000 frames. For now you might want to analyze every 10th frame -- that should take a couple of days.
The bottleneck is not in calculating profiles X, Y and Z directions. The vast majority of the time is spent in constructing a new trajectory to represent the hydrogen bonds. You would have better performance if you write the script from scratch, building the HB density profile directly from the HB positions.
Best,
/Jason
I want to calculate the z direction, because it need a lot of time to obtain the data. my xtd document is 10Gb, about 3500 atoms.
Yes. Thanks for that suggestion.
Alternatively, you could modify the offsetConcentrationProfile script as I mentioned above. I changed my local version of the concentration profile script and ran both scripts on a 3600 atom system with 10 frames. The time for Jason's script was 43s and the time for the modified concentration profile script was 3s. This is mainly due to the fact that the modified concentration profile script does not create a trajectory but only calculates hydrogen bonds on each frame of the existing trajectory.
Cheers
Stephen
Hi Stephen,
I want to know wether a set include the surface atom, another set include oxygen(or F N) atoms?
william
If you have made the modifications above, you just need a set of surface atoms. The hydrogen bonds are calculated automatically using the standard CalculateHBonds tool so you don't need to search for any atoms to define them.
Stephen
Hi everyone,
I have created a script to calculate the hydrogen bond density profile, if anyone is interested in using it for future work.
It outputs the density profile for each frame which can then be exported into excel to calculate the average and standard devitation.
Regards,
Lachlan.